diff --git a/package-lock.json b/package-lock.json index 3e5e33a3..c5a0b453 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@dassana-io/web-components", - "version": "0.8.7", + "version": "0.8.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6d00de93..aa28c9ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dassana-io/web-components", - "version": "0.8.8", + "version": "0.8.9", "publishConfig": { "registry": "https://npm.pkg.github.com/dassana-io" }, diff --git a/src/components/Form/FormSubmitButton/index.tsx b/src/components/Form/FormSubmitButton/index.tsx index 73f5b42e..65f8c106 100644 --- a/src/components/Form/FormSubmitButton/index.tsx +++ b/src/components/Form/FormSubmitButton/index.tsx @@ -4,6 +4,10 @@ import { useFormContext } from 'react-hook-form' import { useShortcut } from '@dassana-io/web-utils' import { Button, ButtonProps } from 'components/Button' import React, { FC, useContext } from 'react' +import { + ShortcutMicrocopy, + ShortcutMicrocopyProps +} from 'components/ShortcutMicrocopy' export interface FormButtonProps extends Omit { @@ -11,10 +15,14 @@ export interface FormButtonProps formState: FormStateProxy, formValues: Record ) => boolean + renderShortcutMicrocopy?: boolean + shortcutMicrocopyProps?: ShortcutMicrocopyProps } const FormSubmitButton: FC = ({ isDisabled, + renderShortcutMicrocopy = false, + shortcutMicrocopyProps, ...rest }: FormButtonProps) => { const { handleSubmit, formState, watch } = useFormContext() @@ -24,6 +32,7 @@ const FormSubmitButton: FC = ({ const isButtonDisabled = () => isDisabled ? isDisabled(formState, watch()) : !isDirty + /* TODO: Refactor to allow for multiple keys */ useShortcut({ additionalConditionalFn: () => !isButtonDisabled(), callback: handleSubmit(onSubmit), @@ -32,13 +41,21 @@ const FormSubmitButton: FC = ({ }) return ( -