@4alldigital/foundation-ui--gamma 1.31.7 → 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, _f = _a.submitType, submitType = _f === void 0 ? BTN_TYPES.SUBMIT : _f, _g = _a.disabledSubmitWithReturn, disabledSubmitWithReturn = _g === void 0 ? false : _g;
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',
@@ -626,10 +626,11 @@ var Form = function (_a) {
626
626
  }, []);
627
627
  var submitClasses = cx({ 'sr-only': hideSubmit });
628
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);
629
630
  if (disabledSubmitWithReturn && event.key === 'Enter') {
630
631
  event.preventDefault();
631
632
  }
632
- }, 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, variant: submitVariant, children: submit }) }))] }) }) })));
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 }) }))] }) }) })));
633
634
  };
634
635
  Form.displayName = 'Form';
635
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, _f = _a.submitType, submitType = _f === void 0 ? exports.BTN_TYPES.SUBMIT : _f, _g = _a.disabledSubmitWithReturn, disabledSubmitWithReturn = _g === void 0 ? false : _g;
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',
@@ -628,10 +628,11 @@ var Form = function (_a) {
628
628
  }, []);
629
629
  var submitClasses = cx({ 'sr-only': hideSubmit });
630
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);
631
632
  if (disabledSubmitWithReturn && event.key === 'Enter') {
632
633
  event.preventDefault();
633
634
  }
634
- }, 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, variant: submitVariant, children: submit }) }))] }) }) })));
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 }) }))] }) }) })));
635
636
  };
636
637
  Form.displayName = 'Form';
637
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, submitType, disabledSubmitWithReturn, }: 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;
@@ -29,5 +29,8 @@ export interface Props {
29
29
  isBoxed?: boolean;
30
30
  /** The submit button type. */
31
31
  submitType?: BTN_TYPES.SUBMIT | BTN_TYPES.BUTTON;
32
+ /** Disable submit button with return key. */
32
33
  disabledSubmitWithReturn?: boolean;
34
+ /** Disable the form submit button. */
35
+ isDisabled?: boolean;
33
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4alldigital/foundation-ui--gamma",
3
- "version": "1.31.7",
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": "e417e292c98e15ed7050342a41ac6dd36736850d",
28
+ "gitHead": "c888df3e4af003fe6acec10ccc9b5eae755eab5d",
29
29
  "dependencies": {
30
30
  "@elastic/datemath": "^5.0.3",
31
31
  "@elastic/eui": "^94.1.0",