@4alldigital/foundation-ui--gamma 1.31.6 → 1.31.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -612,7 +612,7 @@ var Card = function (_a) {
612
612
  Card.displayName = 'Card';
613
613
 
614
614
  var Form = function (_a) {
615
- var children = _a.children, className = _a.className, submit = _a.submit, _b = _a.onSubmit, onSubmit = _b === void 0 ? function () { } : _b, onChange = _a.onChange, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, _c = _a.submitVariant, submitVariant = _c === void 0 ? BTN_VARIANTS.PRIMARY : _c, _d = _a.initialValues, initialValues = _d === void 0 ? {} : _d, _e = _a.isBoxed, isBoxed = _e === void 0 ? false : _e;
615
+ var children = _a.children, className = _a.className, submit = _a.submit, _b = _a.onSubmit, onSubmit = _b === void 0 ? function () { } : _b, onChange = _a.onChange, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, _c = _a.submitVariant, submitVariant = _c === void 0 ? BTN_VARIANTS.PRIMARY : _c, _d = _a.initialValues, initialValues = _d === void 0 ? {} : _d, _e = _a.isBoxed, isBoxed = _e === void 0 ? false : _e, _f = _a.submitType, submitType = _f === void 0 ? BTN_TYPES.SUBMIT : _f, _g = _a.disabledSubmitWithReturn, disabledSubmitWithReturn = _g === void 0 ? false : _g, _h = _a.isDisabled, isDisabled = _h === void 0 ? false : _h;
616
616
  var methods = useForm({
617
617
  defaultValues: initialValues,
618
618
  mode: 'onBlur',
@@ -625,7 +625,12 @@ var Form = function (_a) {
625
625
  }
626
626
  }, []);
627
627
  var submitClasses = cx({ 'sr-only': hideSubmit });
628
- return (jsx(FormProvider, __assign({}, methods, { children: jsx("div", { "data-testid": "Form", className: cx('w-full max-w-s @containers @form'), children: jsxs("form", { onSubmit: methods.handleSubmit(onSubmit), className: cx('mb-4 w-2xs relative', { 'form px-8 pt-6 pb-8 ': isBoxed }, { 'opacity-50': methods.formState.isSubmitting }, className), children: [children, submit && (jsx("div", { className: "flex items-center justify-end py-2", children: jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: BTN_TYPES.SUBMIT, outline: true, isLoading: methods.formState.isSubmitting, disabled: methods.formState.isSubmitting || !methods.formState.isValid, variant: submitVariant, children: submit }) }))] }) }) })));
628
+ return (jsx(FormProvider, __assign({}, methods, { children: jsx("div", { "data-testid": "Form", className: cx('w-full max-w-s @containers @form'), children: jsxs("form", { onSubmit: methods.handleSubmit(onSubmit), onKeyDown: function (event) {
629
+ console.info('onKeyDown event', event);
630
+ if (disabledSubmitWithReturn && event.key === 'Enter') {
631
+ event.preventDefault();
632
+ }
633
+ }, className: cx('mb-4 w-2xs relative', { 'form px-8 pt-6 pb-8 ': isBoxed }, { 'opacity-50': methods.formState.isSubmitting }, className), children: [children, submit && (jsx("div", { className: "flex items-center justify-end py-2", children: jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: submitType, outline: true, isLoading: methods.formState.isSubmitting, disabled: methods.formState.isSubmitting || !methods.formState.isValid || isDisabled, variant: submitVariant, children: submit }) }))] }) }) })));
629
634
  };
630
635
  Form.displayName = 'Form';
631
636
 
package/dist/index.js CHANGED
@@ -614,7 +614,7 @@ var Card = function (_a) {
614
614
  Card.displayName = 'Card';
615
615
 
616
616
  var Form = function (_a) {
617
- var children = _a.children, className = _a.className, submit = _a.submit, _b = _a.onSubmit, onSubmit = _b === void 0 ? function () { } : _b, onChange = _a.onChange, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, _c = _a.submitVariant, submitVariant = _c === void 0 ? exports.BTN_VARIANTS.PRIMARY : _c, _d = _a.initialValues, initialValues = _d === void 0 ? {} : _d, _e = _a.isBoxed, isBoxed = _e === void 0 ? false : _e;
617
+ var children = _a.children, className = _a.className, submit = _a.submit, _b = _a.onSubmit, onSubmit = _b === void 0 ? function () { } : _b, onChange = _a.onChange, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, _c = _a.submitVariant, submitVariant = _c === void 0 ? exports.BTN_VARIANTS.PRIMARY : _c, _d = _a.initialValues, initialValues = _d === void 0 ? {} : _d, _e = _a.isBoxed, isBoxed = _e === void 0 ? false : _e, _f = _a.submitType, submitType = _f === void 0 ? exports.BTN_TYPES.SUBMIT : _f, _g = _a.disabledSubmitWithReturn, disabledSubmitWithReturn = _g === void 0 ? false : _g, _h = _a.isDisabled, isDisabled = _h === void 0 ? false : _h;
618
618
  var methods = reactHookForm.useForm({
619
619
  defaultValues: initialValues,
620
620
  mode: 'onBlur',
@@ -627,7 +627,12 @@ var Form = function (_a) {
627
627
  }
628
628
  }, []);
629
629
  var submitClasses = cx({ 'sr-only': hideSubmit });
630
- return (jsxRuntime.jsx(reactHookForm.FormProvider, __assign({}, methods, { children: jsxRuntime.jsx("div", { "data-testid": "Form", className: cx('w-full max-w-s @containers @form'), children: jsxRuntime.jsxs("form", { onSubmit: methods.handleSubmit(onSubmit), className: cx('mb-4 w-2xs relative', { 'form px-8 pt-6 pb-8 ': isBoxed }, { 'opacity-50': methods.formState.isSubmitting }, className), children: [children, submit && (jsxRuntime.jsx("div", { className: "flex items-center justify-end py-2", children: jsxRuntime.jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: exports.BTN_TYPES.SUBMIT, outline: true, isLoading: methods.formState.isSubmitting, disabled: methods.formState.isSubmitting || !methods.formState.isValid, variant: submitVariant, children: submit }) }))] }) }) })));
630
+ return (jsxRuntime.jsx(reactHookForm.FormProvider, __assign({}, methods, { children: jsxRuntime.jsx("div", { "data-testid": "Form", className: cx('w-full max-w-s @containers @form'), children: jsxRuntime.jsxs("form", { onSubmit: methods.handleSubmit(onSubmit), onKeyDown: function (event) {
631
+ console.info('onKeyDown event', event);
632
+ if (disabledSubmitWithReturn && event.key === 'Enter') {
633
+ event.preventDefault();
634
+ }
635
+ }, className: cx('mb-4 w-2xs relative', { 'form px-8 pt-6 pb-8 ': isBoxed }, { 'opacity-50': methods.formState.isSubmitting }, className), children: [children, submit && (jsxRuntime.jsx("div", { className: "flex items-center justify-end py-2", children: jsxRuntime.jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: submitType, outline: true, isLoading: methods.formState.isSubmitting, disabled: methods.formState.isSubmitting || !methods.formState.isValid || isDisabled, variant: submitVariant, children: submit }) }))] }) }) })));
631
636
  };
632
637
  Form.displayName = 'Form';
633
638
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Props } from './Form.types';
3
3
  declare const Form: {
4
- ({ children, className, submit, onSubmit, onChange, hideSubmit, ariaSubmitLabel, submitID, submitVariant, initialValues, isBoxed, }: Props): React.ReactElement;
4
+ ({ children, className, submit, onSubmit, onChange, hideSubmit, ariaSubmitLabel, submitID, submitVariant, initialValues, isBoxed, submitType, disabledSubmitWithReturn, isDisabled, }: Props): React.ReactElement;
5
5
  displayName: string;
6
6
  };
7
7
  export default Form;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { BTN_VARIANTS } from '../Button/Button.types';
2
+ import { BTN_TYPES, BTN_VARIANTS } from '../Button/Button.types';
3
3
  export interface Props {
4
4
  /** The form inputs and content. */
5
5
  children: React.ReactNode;
@@ -27,4 +27,10 @@ export interface Props {
27
27
  submitVariant?: BTN_VARIANTS;
28
28
  /** The form is boxed. */
29
29
  isBoxed?: boolean;
30
+ /** The submit button type. */
31
+ submitType?: BTN_TYPES.SUBMIT | BTN_TYPES.BUTTON;
32
+ /** Disable submit button with return key. */
33
+ disabledSubmitWithReturn?: boolean;
34
+ /** Disable the form submit button. */
35
+ isDisabled?: boolean;
30
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4alldigital/foundation-ui--gamma",
3
- "version": "1.31.6",
3
+ "version": "1.31.8",
4
4
  "description": "Foundation UI Component library with GAMMA theme. ",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -25,7 +25,7 @@
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
- "gitHead": "2dee6ed0cc592c27c3c936a79b39430fa2b4a025",
28
+ "gitHead": "c888df3e4af003fe6acec10ccc9b5eae755eab5d",
29
29
  "dependencies": {
30
30
  "@elastic/datemath": "^5.0.3",
31
31
  "@elastic/eui": "^94.1.0",