@flipdish/ui-library 0.62.0 → 0.64.0
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/README.md +22 -21
- package/dist/components/__internal__/listOption/listOption.styles.cjs +20 -0
- package/dist/components/__internal__/listOption/listOption.styles.cjs.map +1 -0
- package/dist/components/__internal__/listOption/listOption.styles.d.ts +16 -0
- package/dist/components/__internal__/listOption/listOption.styles.d.ts.map +1 -0
- package/dist/components/__internal__/listOption/listOption.styles.js +18 -0
- package/dist/components/__internal__/listOption/listOption.styles.js.map +1 -0
- package/dist/components/atoms/BackgroundPattern/components/Circle.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Circle.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Circle.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Circle.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Circle.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Circle.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Grid.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Grid.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Grid.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.cjs +13 -8
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.js +13 -8
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Square.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Square.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Square.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.cjs +5 -3
- package/dist/components/atoms/BackgroundPattern/index.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.d.ts +11 -11
- package/dist/components/atoms/BackgroundPattern/index.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.js +5 -3
- package/dist/components/atoms/BackgroundPattern/index.js.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.cjs +7 -3
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.cjs.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.d.ts +4 -4
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.d.ts.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.js +7 -3
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.js.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs +6 -3
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts +4 -4
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js +7 -4
- package/dist/components/atoms/Buttons/IconButton/IconButton.js.map +1 -1
- package/dist/components/atoms/Card/index.cjs +5 -3
- package/dist/components/atoms/Card/index.cjs.map +1 -1
- package/dist/components/atoms/Card/index.d.ts +3 -3
- package/dist/components/atoms/Card/index.d.ts.map +1 -1
- package/dist/components/atoms/Card/index.js +5 -3
- package/dist/components/atoms/Card/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.d.ts +1 -4
- package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.cjs +3 -3
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.d.ts +2 -7
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.js +4 -4
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/atoms/Dot/index.cjs +5 -3
- package/dist/components/atoms/Dot/index.cjs.map +1 -1
- package/dist/components/atoms/Dot/index.d.ts +3 -3
- package/dist/components/atoms/Dot/index.d.ts.map +1 -1
- package/dist/components/atoms/Dot/index.js +5 -3
- package/dist/components/atoms/Dot/index.js.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.cjs +4 -3
- package/dist/components/atoms/FeaturedIcon/index.cjs.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.d.ts +2 -4
- package/dist/components/atoms/FeaturedIcon/index.d.ts.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.js +5 -4
- package/dist/components/atoms/FeaturedIcon/index.js.map +1 -1
- package/dist/components/atoms/Flag/index.cjs +10 -6
- package/dist/components/atoms/Flag/index.cjs.map +1 -1
- package/dist/components/atoms/Flag/index.d.ts +3 -3
- package/dist/components/atoms/Flag/index.d.ts.map +1 -1
- package/dist/components/atoms/Flag/index.js +12 -8
- package/dist/components/atoms/Flag/index.js.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.cjs +5 -3
- package/dist/components/atoms/FlipdishLogo/index.cjs.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.d.ts +3 -3
- package/dist/components/atoms/FlipdishLogo/index.d.ts.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.js +5 -3
- package/dist/components/atoms/FlipdishLogo/index.js.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.cjs +7 -4
- package/dist/components/atoms/Illustration/components/TextIllustration.cjs.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.d.ts +2 -3
- package/dist/components/atoms/Illustration/components/TextIllustration.d.ts.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.js +7 -4
- package/dist/components/atoms/Illustration/components/TextIllustration.js.map +1 -1
- package/dist/components/atoms/Input/index.d.ts +2 -8
- package/dist/components/atoms/Input/index.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.cjs +4 -4
- package/dist/components/atoms/Inputs/Input/Input.cjs.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.d.ts +3 -11
- package/dist/components/atoms/Inputs/Input/Input.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.js +6 -6
- package/dist/components/atoms/Inputs/Input/Input.js.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.cjs +3 -2
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.cjs.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.d.ts +2 -7
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.js +3 -2
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.cjs +7 -6
- package/dist/components/atoms/Inputs/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.d.ts +4 -13
- package/dist/components/atoms/Inputs/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.js +8 -7
- package/dist/components/atoms/Inputs/TextArea/TextArea.js.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs +5 -5
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts +2 -7
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js +6 -6
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.cjs +4 -3
- package/dist/components/atoms/Inputs/components/HintText.cjs.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.d.ts +3 -8
- package/dist/components/atoms/Inputs/components/HintText.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.js +4 -3
- package/dist/components/atoms/Inputs/components/HintText.js.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.cjs +4 -3
- package/dist/components/atoms/Inputs/components/Label.cjs.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.d.ts +3 -8
- package/dist/components/atoms/Inputs/components/Label.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.js +4 -3
- package/dist/components/atoms/Inputs/components/Label.js.map +1 -1
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs +35 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts +24 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js +33 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs +100 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts +35 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js +98 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js.map +1 -0
- package/dist/components/atoms/PhoneInput/index.cjs +79 -0
- package/dist/components/atoms/PhoneInput/index.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/index.d.ts +48 -0
- package/dist/components/atoms/PhoneInput/index.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/index.js +77 -0
- package/dist/components/atoms/PhoneInput/index.js.map +1 -0
- package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts +17 -0
- package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs +304 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts +147 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js +288 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js.map +1 -0
- package/dist/components/atoms/RadioButton/index.d.ts +1 -4
- package/dist/components/atoms/RadioButton/index.d.ts.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.cjs +6 -4
- package/dist/components/atoms/Radios/RadioButton/RadioButton.cjs.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.d.ts +2 -7
- package/dist/components/atoms/Radios/RadioButton/RadioButton.d.ts.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.js +7 -5
- package/dist/components/atoms/Radios/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/atoms/RatingStars/index.cjs +4 -3
- package/dist/components/atoms/RatingStars/index.cjs.map +1 -1
- package/dist/components/atoms/RatingStars/index.d.ts +3 -3
- package/dist/components/atoms/RatingStars/index.d.ts.map +1 -1
- package/dist/components/atoms/RatingStars/index.js +6 -5
- package/dist/components/atoms/RatingStars/index.js.map +1 -1
- package/dist/components/atoms/SearchInput/index.d.ts +1 -4
- package/dist/components/atoms/SearchInput/index.d.ts.map +1 -1
- package/dist/components/atoms/SocialButton/index.d.ts +1 -1
- package/dist/components/atoms/SocialButton/index.d.ts.map +1 -1
- package/dist/components/atoms/UtilityButton/index.cjs.map +1 -1
- package/dist/components/atoms/UtilityButton/index.d.ts +2 -2
- package/dist/components/atoms/UtilityButton/index.d.ts.map +1 -1
- package/dist/components/atoms/UtilityButton/index.js.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.cjs +18 -18
- package/dist/components/atoms/VerificationCodeInput/index.cjs.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.d.ts +10 -29
- package/dist/components/atoms/VerificationCodeInput/index.d.ts.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.js +19 -19
- package/dist/components/atoms/VerificationCodeInput/index.js.map +1 -1
- package/dist/components/forms/Form/index.cjs +14 -11
- package/dist/components/forms/Form/index.cjs.map +1 -1
- package/dist/components/forms/Form/index.d.ts +9 -8
- package/dist/components/forms/Form/index.d.ts.map +1 -1
- package/dist/components/forms/Form/index.js +16 -13
- package/dist/components/forms/Form/index.js.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs +10 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js +10 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js.map +1 -1
- package/dist/components/forms/fields/FormPhoneInput/index.cjs +36 -0
- package/dist/components/forms/fields/FormPhoneInput/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormPhoneInput/index.d.ts +19 -0
- package/dist/components/forms/fields/FormPhoneInput/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormPhoneInput/index.js +34 -0
- package/dist/components/forms/fields/FormPhoneInput/index.js.map +1 -0
- package/dist/components/forms/validation/index.cjs +25 -56
- package/dist/components/forms/validation/index.cjs.map +1 -1
- package/dist/components/forms/validation/index.d.ts +2 -12
- package/dist/components/forms/validation/index.d.ts.map +1 -1
- package/dist/components/forms/validation/index.js +1 -32
- package/dist/components/forms/validation/index.js.map +1 -1
- package/dist/components/forms/validation/phoneNumber/index.cjs +20 -0
- package/dist/components/forms/validation/phoneNumber/index.cjs.map +1 -0
- package/dist/components/forms/validation/phoneNumber/index.d.ts +14 -0
- package/dist/components/forms/validation/phoneNumber/index.d.ts.map +1 -0
- package/dist/components/forms/validation/phoneNumber/index.js +18 -0
- package/dist/components/forms/validation/phoneNumber/index.js.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs +34 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -1
- package/dist/components/forms/validation/utilities/validation.utils.d.ts +29 -1
- package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -1
- package/dist/components/forms/validation/utilities/validation.utils.js +33 -2
- package/dist/components/forms/validation/utilities/validation.utils.js.map +1 -1
- package/dist/components/forms/validation/validation.types.d.ts +10 -0
- package/dist/components/forms/validation/validation.types.d.ts.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.cjs +8 -6
- package/dist/components/molecules/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.d.ts +7 -5
- package/dist/components/molecules/ButtonGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.js +12 -10
- package/dist/components/molecules/ButtonGroup/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +33 -33
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts +23 -24
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +36 -36
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/Messaging/index.cjs +5 -3
- package/dist/components/molecules/Messaging/index.cjs.map +1 -1
- package/dist/components/molecules/Messaging/index.d.ts +3 -3
- package/dist/components/molecules/Messaging/index.d.ts.map +1 -1
- package/dist/components/molecules/Messaging/index.js +5 -3
- package/dist/components/molecules/Messaging/index.js.map +1 -1
- package/dist/components/molecules/SectionFooter/index.cjs +9 -6
- package/dist/components/molecules/SectionFooter/index.cjs.map +1 -1
- package/dist/components/molecules/SectionFooter/index.d.ts +5 -5
- package/dist/components/molecules/SectionFooter/index.d.ts.map +1 -1
- package/dist/components/molecules/SectionFooter/index.js +10 -7
- package/dist/components/molecules/SectionFooter/index.js.map +1 -1
- package/dist/components/molecules/SectionHeader/index.cjs +21 -15
- package/dist/components/molecules/SectionHeader/index.cjs.map +1 -1
- package/dist/components/molecules/SectionHeader/index.d.ts +11 -11
- package/dist/components/molecules/SectionHeader/index.d.ts.map +1 -1
- package/dist/components/molecules/SectionHeader/index.js +22 -16
- package/dist/components/molecules/SectionHeader/index.js.map +1 -1
- package/dist/components/molecules/Select/index.d.ts +2 -5
- package/dist/components/molecules/Select/index.d.ts.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs +3 -2
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.d.ts +3 -3
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js +4 -3
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.cjs +5 -5
- package/dist/components/molecules/Selects/Select/Select.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.d.ts +3 -6
- package/dist/components/molecules/Selects/Select/Select.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.js +6 -6
- package/dist/components/molecules/Selects/Select/Select.js.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs +7 -5
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.d.ts +3 -3
- package/dist/components/molecules/Selects/Select/components/Combobox.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.js +10 -8
- package/dist/components/molecules/Selects/Select/components/Combobox.js.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.cjs +2 -3
- package/dist/components/molecules/Selects/Select/components/Popover.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.js +2 -3
- package/dist/components/molecules/Selects/Select/components/Popover.js.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.cjs +2 -1
- package/dist/components/molecules/Selects/components/SelectItem.cjs.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.d.ts.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.js +2 -1
- package/dist/components/molecules/Selects/components/SelectItem.js.map +1 -1
- package/dist/components/molecules/Tabs/index.cjs +10 -7
- package/dist/components/molecules/Tabs/index.cjs.map +1 -1
- package/dist/components/molecules/Tabs/index.d.ts +12 -15
- package/dist/components/molecules/Tabs/index.d.ts.map +1 -1
- package/dist/components/molecules/Tabs/index.js +13 -10
- package/dist/components/molecules/Tabs/index.js.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.cjs +4 -3
- package/dist/components/molecules/Tags/Tag/Tag.cjs.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.d.ts +4 -3
- package/dist/components/molecules/Tags/Tag/Tag.d.ts.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.js +5 -4
- package/dist/components/molecules/Tags/Tag/Tag.js.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.cjs +5 -3
- package/dist/components/molecules/Tags/TagGroup/TagGroup.cjs.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts +2 -3
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.js +6 -4
- package/dist/components/molecules/Tags/TagGroup/TagGroup.js.map +1 -1
- package/dist/components/molecules/TextArea/index.d.ts +1 -4
- package/dist/components/molecules/TextArea/index.d.ts.map +1 -1
- package/dist/components/organisms/Carousel/index.cjs +26 -14
- package/dist/components/organisms/Carousel/index.cjs.map +1 -1
- package/dist/components/organisms/Carousel/index.d.ts +8 -10
- package/dist/components/organisms/Carousel/index.d.ts.map +1 -1
- package/dist/components/organisms/Carousel/index.js +28 -16
- package/dist/components/organisms/Carousel/index.js.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs +3 -2
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts +2 -4
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js +4 -3
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js.map +1 -1
- package/dist/components/organisms/ColorPicker/index.cjs +3 -1
- package/dist/components/organisms/ColorPicker/index.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/index.js +7 -5
- package/dist/components/organisms/ColorPicker/index.js.map +1 -1
- package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.js +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs +5 -3
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.d.ts +3 -5
- package/dist/components/organisms/CommandMenu/components/CommandInput.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.js +5 -3
- package/dist/components/organisms/CommandMenu/components/CommandInput.js.map +1 -1
- package/dist/components/organisms/CommandMenu/index.cjs +8 -6
- package/dist/components/organisms/CommandMenu/index.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/index.d.ts +4 -4
- package/dist/components/organisms/CommandMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/index.js +9 -7
- package/dist/components/organisms/CommandMenu/index.js.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs +4 -2
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.d.ts +2 -4
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js +4 -2
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +3 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts +2 -4
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +4 -3
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js +2 -2
- package/dist/components/organisms/FileUpload/index.cjs +8 -6
- package/dist/components/organisms/FileUpload/index.cjs.map +1 -1
- package/dist/components/organisms/FileUpload/index.d.ts +7 -7
- package/dist/components/organisms/FileUpload/index.d.ts.map +1 -1
- package/dist/components/organisms/FileUpload/index.js +12 -10
- package/dist/components/organisms/FileUpload/index.js.map +1 -1
- package/dist/components/organisms/FilterBar/index.cjs +13 -9
- package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/index.d.ts +7 -7
- package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/index.js +14 -10
- package/dist/components/organisms/FilterBar/index.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts +12 -6
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts +11 -6
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs +12 -10
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts +8 -7
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js +15 -13
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs +2 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.js +2 -1
- package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs +8 -8
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts +9 -18
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +9 -9
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +15 -10
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +10 -19
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +18 -13
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorExtensions.js +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.cjs +5 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.cjs.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.d.ts +2 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.d.ts.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.js +5 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.js.map +1 -1
- package/dist/components/organisms/TextEditor/index.cjs +16 -9
- package/dist/components/organisms/TextEditor/index.cjs.map +1 -1
- package/dist/components/organisms/TextEditor/index.d.ts +7 -9
- package/dist/components/organisms/TextEditor/index.d.ts.map +1 -1
- package/dist/components/organisms/TextEditor/index.js +21 -14
- package/dist/components/organisms/TextEditor/index.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.cjs +3 -2
- package/dist/components/organisms/VideoPlayer/index.cjs.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.d.ts +1 -6
- package/dist/components/organisms/VideoPlayer/index.d.ts.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.js +4 -3
- package/dist/components/organisms/VideoPlayer/index.js.map +1 -1
- package/dist/native/components/atoms/PhoneInput/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormPhoneInput/index.d.ts +12 -0
- package/dist/native/components/forms/validation/phoneNumber/index.d.ts +12 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.cjs +17 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts +11 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.js +17 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.js.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.cjs +20 -0
- package/dist/utilities/__internal__/refUtils/ref.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.d.ts +10 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.js +20 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.js.map +1 -1
- package/package.json +13 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
2
|
import { type ButtonProps as ButtonPropsNext, type CommonProps as CommonPropsNext, type Props as PropsNext, styles as stylesNext } from '../Buttons/IconButton/IconButton';
|
|
3
3
|
/** @deprecated Use `IconButton` from `@flipdish/ui-library/components/atoms/Buttons`, which requires a `tooltip` or an `aria-label`. Removed in the next major. */
|
|
4
|
-
export declare const ButtonUtility:
|
|
4
|
+
export declare const ButtonUtility: ForwardRefExoticComponent<PropsWithoutRef<PropsNext> & RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
5
5
|
/** @deprecated Use `IconButtonProps` from `@flipdish/ui-library/components/atoms/Buttons`. Removed in the next major. */
|
|
6
6
|
export type Props = PropsNext;
|
|
7
7
|
/** @deprecated Not exported from `@flipdish/ui-library/components/atoms/Buttons`. Removed in the next major. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/UtilityButton/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/UtilityButton/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvF,OAAO,EACL,KAAK,WAAW,IAAI,eAAe,EACnC,KAAK,WAAW,IAAI,eAAe,EACnC,KAAK,KAAK,IAAI,SAAS,EACvB,MAAM,IAAI,UAAU,EACrB,MAAM,kCAAkC,CAAC;AAE1C,mKAAmK;AACnK,eAAO,MAAM,aAAa,EAAqB,yBAAyB,CACtE,eAAe,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAClF,CAAC;AACF,yHAAyH;AACzH,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAC9B,gHAAgH;AAChH,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,gHAAgH;AAChH,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,gHAAgH;AAChH,eAAO,MAAM,MAAM,EAAE,OAAO,UAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/UtilityButton/index.tsx"],"sourcesContent":[null],"names":["IconButtonNext","stylesNext"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/UtilityButton/index.tsx"],"sourcesContent":[null],"names":["IconButtonNext","stylesNext"],"mappings":";;;AAeA;AACO,MAAM,aAAa,GAAGA;AAS7B;AACO,MAAM,MAAM,GAAsBC;;"}
|
|
@@ -20,11 +20,11 @@ const usePinInputContext = () => {
|
|
|
20
20
|
}
|
|
21
21
|
return context;
|
|
22
22
|
};
|
|
23
|
-
const Root = ({ className, size = 'md', disabled = false, invalid = false, 'data-testid': dataTestId, ...props }) => {
|
|
23
|
+
const Root = React.forwardRef(({ className, size = 'md', disabled = false, invalid = false, 'data-testid': dataTestId, ...props }, ref) => {
|
|
24
24
|
const id = React.useId();
|
|
25
25
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'pin-input', rootName: 'pin-input' });
|
|
26
|
-
return (jsxRuntime.jsx(PinInputContext.Provider, { value: { size, disabled, id, invalid }, children: jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx("div", { role: "group", className: cx.cx('flex h-max flex-col gap-1.5', className), ...props, "data-testid": rootTestId }) }) }));
|
|
27
|
-
};
|
|
26
|
+
return (jsxRuntime.jsx(PinInputContext.Provider, { value: { size, disabled, id, invalid }, children: jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx("div", { role: "group", className: cx.cx('flex h-max flex-col gap-1.5', className), ...props, ref: ref, "data-testid": rootTestId }) }) }));
|
|
27
|
+
});
|
|
28
28
|
Root.displayName = 'Root';
|
|
29
29
|
const styles = {
|
|
30
30
|
xxxs: { group: 'gap-1.5 h-9', slot: 'size-9 px-3 py-2 text-sm rounded-lg font-medium text-placeholder/50', caret: 'text-sm font-medium' },
|
|
@@ -34,14 +34,14 @@ const styles = {
|
|
|
34
34
|
md: { group: 'gap-3 h-20.5', slot: 'size-20 px-2 py-2.5 text-display-lg font-medium', caret: 'text-display-lg font-medium' },
|
|
35
35
|
lg: { group: 'gap-3 h-24.5', slot: 'size-24 px-2 py-3 text-display-xl font-medium', caret: 'text-display-xl font-medium' },
|
|
36
36
|
};
|
|
37
|
-
const Group = ({ inputClassName, containerClassName, width, maxLength = 4, ...props }) => {
|
|
37
|
+
const Group = React.forwardRef(({ inputClassName, containerClassName, width, maxLength = 4, ...props }, ref) => {
|
|
38
38
|
const { id, size, disabled, invalid } = usePinInputContext();
|
|
39
39
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
40
40
|
const inputTestId = prefix ? testIdUtils.joinTestId(prefix, 'input') : undefined;
|
|
41
|
-
return (jsxRuntime.jsx(inputOtp.OTPInput, { ...props, size: width, maxLength: maxLength, disabled: disabled, id: `pin-input-${id}`, "aria-label": "Enter your pin", "aria-labelledby": `pin-input-label-${id}`, "aria-describedby": `pin-input-description-${id}`, "aria-invalid": invalid, containerClassName: cx.cx('flex flex-row', styles[size].group, containerClassName), className: cx.cx('disabled:cursor-not-allowed', inputClassName), "data-testid": inputTestId }));
|
|
42
|
-
};
|
|
41
|
+
return (jsxRuntime.jsx(inputOtp.OTPInput, { ...props, ref: ref, size: width, maxLength: maxLength, disabled: disabled, id: `pin-input-${id}`, "aria-label": "Enter your pin", "aria-labelledby": `pin-input-label-${id}`, "aria-describedby": `pin-input-description-${id}`, "aria-invalid": invalid, containerClassName: cx.cx('flex flex-row', styles[size].group, containerClassName), className: cx.cx('disabled:cursor-not-allowed', inputClassName), "data-testid": inputTestId }));
|
|
42
|
+
});
|
|
43
43
|
Group.displayName = 'Group';
|
|
44
|
-
const Slot = ({ index, className, 'data-testid': dataTestId, ...props }) => {
|
|
44
|
+
const Slot = React.forwardRef(({ index, className, 'data-testid': dataTestId, ...props }, ref) => {
|
|
45
45
|
const { size, disabled, invalid } = usePinInputContext();
|
|
46
46
|
const { slots, isFocused } = React.useContext(inputOtp.OTPInputContext);
|
|
47
47
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
@@ -53,30 +53,30 @@ const Slot = ({ index, className, 'data-testid': dataTestId, ...props }) => {
|
|
|
53
53
|
// from assistive tech rather than labelled — an `aria-label` here would be prohibited on a
|
|
54
54
|
// role-less `<div>` (and doubly announce each digit alongside the real input's value), and
|
|
55
55
|
// `aria-invalid` here would never reach assistive tech at all since the node is hidden.
|
|
56
|
-
jsxRuntime.jsx("div", { ...props, "aria-hidden": "true", "data-testid": slotTestId, className: cx.cx('relative flex items-center justify-center rounded-xl bg-primary text-center text-placeholder/40 shadow-xs ring-1 ring-primary transition-[box-shadow,background-color] duration-100 ease-linear ring-inset', styles[size].slot, isFocused && slot?.isActive && 'ring-2 ring-brand outline-2 outline-offset-2 outline-brand', slot?.char && 'text-brand-tertiary_alt ring-2 ring-brand', disabled && 'opacity-50', invalid && 'text-error-primary ring-error_subtle', className), children: slot?.char || (slot?.hasFakeCaret ? jsxRuntime.jsx(FakeCaret, { size: size }) : 0) }));
|
|
57
|
-
};
|
|
56
|
+
jsxRuntime.jsx("div", { ...props, ref: ref, "aria-hidden": "true", "data-testid": slotTestId, className: cx.cx('relative flex items-center justify-center rounded-xl bg-primary text-center text-placeholder/40 shadow-xs ring-1 ring-primary transition-[box-shadow,background-color] duration-100 ease-linear ring-inset', styles[size].slot, isFocused && slot?.isActive && 'ring-2 ring-brand outline-2 outline-offset-2 outline-brand', slot?.char && 'text-brand-tertiary_alt ring-2 ring-brand', disabled && 'opacity-50', invalid && 'text-error-primary ring-error_subtle', className), children: slot?.char || (slot?.hasFakeCaret ? jsxRuntime.jsx(FakeCaret, { size: size }) : 0) }));
|
|
57
|
+
});
|
|
58
58
|
Slot.displayName = 'Slot';
|
|
59
59
|
const FakeCaret = ({ size = 'md' }) => {
|
|
60
60
|
return jsxRuntime.jsx("div", { className: cx.cx('pointer-events-none h-[1em] w-0.5 animate-caret-blink bg-fg-brand-primary', styles[size].caret) });
|
|
61
61
|
};
|
|
62
|
-
const Separator = (props) => {
|
|
62
|
+
const Separator = React.forwardRef((props, ref) => {
|
|
63
63
|
return (
|
|
64
64
|
// biome-ignore lint/a11y/useFocusableInteractive: this is a separator
|
|
65
65
|
// biome-ignore lint/a11y/useSemanticElements: this is a separator
|
|
66
66
|
// biome-ignore lint/a11y/useAriaPropsForRole: this is a separator
|
|
67
|
-
jsxRuntime.jsx("div", { role: "separator", ...props, className: cx.cx('text-center text-display-xl font-medium text-utility-neutral-300', props.className), children: "-" }));
|
|
68
|
-
};
|
|
67
|
+
jsxRuntime.jsx("div", { role: "separator", ...props, ref: ref, className: cx.cx('text-center text-display-xl font-medium text-utility-neutral-300', props.className), children: "-" }));
|
|
68
|
+
});
|
|
69
69
|
Separator.displayName = 'Separator';
|
|
70
|
-
const Label = (props) => {
|
|
70
|
+
const Label = React.forwardRef((props, ref) => {
|
|
71
71
|
const { id } = usePinInputContext();
|
|
72
|
-
return jsxRuntime.jsx(Inputs.Label, { ...props, htmlFor: `pin-input-${id}`, id: `pin-input-label-${id}` });
|
|
73
|
-
};
|
|
72
|
+
return jsxRuntime.jsx(Inputs.Label, { ...props, ref: ref, htmlFor: `pin-input-${id}`, id: `pin-input-label-${id}` });
|
|
73
|
+
});
|
|
74
74
|
Label.displayName = 'Label';
|
|
75
|
-
const Description = (props) => {
|
|
75
|
+
const Description = React.forwardRef((props, ref) => {
|
|
76
76
|
const { id, size } = usePinInputContext();
|
|
77
77
|
// Referenced by the input's `aria-describedby`; no ARIA role needed (and `role="description"` is invalid).
|
|
78
|
-
return jsxRuntime.jsx(Inputs.HintText, { ...props, id: `pin-input-description-${id}`, className: cx.cx(size === 'xxxs' && 'text-xs') });
|
|
79
|
-
};
|
|
78
|
+
return jsxRuntime.jsx(Inputs.HintText, { ...props, ref: ref, id: `pin-input-description-${id}`, className: cx.cx(size === 'xxxs' && 'text-xs') });
|
|
79
|
+
});
|
|
80
80
|
Description.displayName = 'Description';
|
|
81
81
|
/**
|
|
82
82
|
* One box per character for entering a verification or one-time code, with paste and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"sourcesContent":[null],"names":["createContext","useContext","useId","useResolvedTestId","_jsx","TestIdProvider","cx","useTestIdPrefix","joinTestId","OTPInput","OTPInputContext","LabelBase","HintText"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"sourcesContent":[null],"names":["createContext","useContext","forwardRef","useId","useResolvedTestId","_jsx","TestIdProvider","cx","useTestIdPrefix","joinTestId","OTPInput","OTPInputContext","LabelBase","HintText"],"mappings":";;;;;;;;;AAiBA,MAAM,eAAe,GAAGA,mBAAa,CAAsB;AACzD,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,OAAO,EAAE,KAAK;AACf,CAAA,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AK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAA,sBAAA,EAAyB,EAAE,EAAE,EAAE,SAAS,EAAEN,KAAE,CAAC,IAAI,KAAK,MAAM,IAAI,SAAS,CAAC,EAAA,CAAI;AAC1H,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,aAAa;AAEvC;;;;;AAKG;AACH,MAAM,QAAQ,GAAG;AAOjB,QAAQ,CAAC,IAAI,GAAG,IAAI;AACpB,QAAQ,CAAC,KAAK,GAAG,KAAK;AACtB,QAAQ,CAAC,KAAK,GAAG,KAAK;AACtB,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,WAAW,GAAG,WAAW;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { HintText, Label as LabelBase } from '@flipdish/ui-library/components/atoms/Inputs';
|
|
2
1
|
import { OTPInput } from 'input-otp';
|
|
3
|
-
import type
|
|
2
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
4
3
|
type PinInputSize = 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
5
4
|
type PinInputContextType = {
|
|
6
5
|
size: PinInputSize;
|
|
@@ -9,7 +8,7 @@ type PinInputContextType = {
|
|
|
9
8
|
invalid: boolean;
|
|
10
9
|
};
|
|
11
10
|
export declare const usePinInputContext: () => PinInputContextType;
|
|
12
|
-
export interface RootProps extends
|
|
11
|
+
export interface RootProps extends ComponentPropsWithoutRef<'div'> {
|
|
13
12
|
/** Size of every slot and its digits, shared through context. */
|
|
14
13
|
size?: PinInputSize;
|
|
15
14
|
/** Disables the input and dims every slot. */
|
|
@@ -19,40 +18,22 @@ export interface RootProps extends ComponentPropsWithRef<'div'> {
|
|
|
19
18
|
/** Overrides the derived root `data-testid` (defaults to `fd-pin-input`). */
|
|
20
19
|
'data-testid'?: string;
|
|
21
20
|
}
|
|
22
|
-
declare const Root:
|
|
23
|
-
|
|
24
|
-
displayName: string;
|
|
25
|
-
};
|
|
26
|
-
type GroupProps = ComponentPropsWithRef<typeof OTPInput> & {
|
|
21
|
+
declare const Root: import("react").ForwardRefExoticComponent<RootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
type GroupProps = ComponentPropsWithoutRef<typeof OTPInput> & {
|
|
27
23
|
width?: number;
|
|
28
24
|
inputClassName?: string;
|
|
29
25
|
};
|
|
30
|
-
declare const Group:
|
|
31
|
-
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
34
|
-
export interface SlotProps extends ComponentPropsWithRef<'div'> {
|
|
26
|
+
declare const Group: import("react").ForwardRefExoticComponent<GroupProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export interface SlotProps extends ComponentPropsWithoutRef<'div'> {
|
|
35
28
|
/** Zero-based position of the character this slot displays. */
|
|
36
29
|
index: number;
|
|
37
30
|
/** Overrides the derived `data-testid` for this slot (defaults to `<root>--slot-<index>`). */
|
|
38
31
|
'data-testid'?: string;
|
|
39
32
|
}
|
|
40
|
-
declare const Slot:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
declare const Separator: {
|
|
45
|
-
(props: ComponentPropsWithRef<"div">): import("react").JSX.Element;
|
|
46
|
-
displayName: string;
|
|
47
|
-
};
|
|
48
|
-
declare const Label: {
|
|
49
|
-
(props: ComponentPropsWithRef<typeof LabelBase>): import("react").JSX.Element;
|
|
50
|
-
displayName: string;
|
|
51
|
-
};
|
|
52
|
-
declare const Description: {
|
|
53
|
-
(props: ComponentPropsWithRef<typeof HintText>): import("react").JSX.Element;
|
|
54
|
-
displayName: string;
|
|
55
|
-
};
|
|
33
|
+
declare const Slot: import("react").ForwardRefExoticComponent<SlotProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const Separator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
declare const Label: import("react").ForwardRefExoticComponent<Omit<import("../Inputs/components/Label").LabelProps & import("react").RefAttributes<HTMLLabelElement>, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
36
|
+
declare const Description: import("react").ForwardRefExoticComponent<Omit<import("../Inputs/components/HintText").HintTextProps & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
56
37
|
/**
|
|
57
38
|
* One box per character for entering a verification or one-time code, with paste and
|
|
58
39
|
* auto-advance handled. Use in sign-in and confirmation flows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,KAAK,wBAAwB,EAAgD,MAAM,OAAO,CAAC;AAEpG,KAAK,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/D,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AASF,eAAO,MAAM,kBAAkB,2BAQ9B,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChE,iEAAiE;IACjE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,IAAI,sGAcT,CAAC;AAYF,KAAK,UAAU,GAAG,wBAAwB,CAAC,OAAO,QAAQ,CAAC,GAAG;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,KAAK,yGAsBT,CAAC;AAGH,MAAM,WAAW,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChE,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,IAAI,sGAgCR,CAAC;AAOH,QAAA,MAAM,SAAS,2MASb,CAAC;AAGH,QAAA,MAAM,KAAK,6MAIT,CAAC;AAGH,QAAA,MAAM,WAAW,yMAKf,CAAC;AAGH;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,EAAW,OAAO,IAAI,GAAG;IACrC,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,WAAW,CAAC;CACjC,CAAC;AAOF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Label as Label$1, HintText } from '@flipdish/ui-library/components/atom
|
|
|
3
3
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
4
|
import { useResolvedTestId, TestIdProvider, useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
5
|
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
6
|
-
import { createContext, useId, useContext } from 'react';
|
|
6
|
+
import { createContext, forwardRef, useId, useContext } from 'react';
|
|
7
7
|
|
|
8
8
|
const PinInputContext = createContext({
|
|
9
9
|
size: 'sm',
|
|
@@ -18,11 +18,11 @@ const usePinInputContext = () => {
|
|
|
18
18
|
}
|
|
19
19
|
return context;
|
|
20
20
|
};
|
|
21
|
-
const Root = ({ className, size = 'md', disabled = false, invalid = false, 'data-testid': dataTestId, ...props }) => {
|
|
21
|
+
const Root = forwardRef(({ className, size = 'md', disabled = false, invalid = false, 'data-testid': dataTestId, ...props }, ref) => {
|
|
22
22
|
const id = useId();
|
|
23
23
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'pin-input', rootName: 'pin-input' });
|
|
24
|
-
return (jsx(PinInputContext.Provider, { value: { size, disabled, id, invalid }, children: jsx(TestIdProvider, { value: rootTestId, children: jsx("div", { role: "group", className: cx('flex h-max flex-col gap-1.5', className), ...props, "data-testid": rootTestId }) }) }));
|
|
25
|
-
};
|
|
24
|
+
return (jsx(PinInputContext.Provider, { value: { size, disabled, id, invalid }, children: jsx(TestIdProvider, { value: rootTestId, children: jsx("div", { role: "group", className: cx('flex h-max flex-col gap-1.5', className), ...props, ref: ref, "data-testid": rootTestId }) }) }));
|
|
25
|
+
});
|
|
26
26
|
Root.displayName = 'Root';
|
|
27
27
|
const styles = {
|
|
28
28
|
xxxs: { group: 'gap-1.5 h-9', slot: 'size-9 px-3 py-2 text-sm rounded-lg font-medium text-placeholder/50', caret: 'text-sm font-medium' },
|
|
@@ -32,14 +32,14 @@ const styles = {
|
|
|
32
32
|
md: { group: 'gap-3 h-20.5', slot: 'size-20 px-2 py-2.5 text-display-lg font-medium', caret: 'text-display-lg font-medium' },
|
|
33
33
|
lg: { group: 'gap-3 h-24.5', slot: 'size-24 px-2 py-3 text-display-xl font-medium', caret: 'text-display-xl font-medium' },
|
|
34
34
|
};
|
|
35
|
-
const Group = ({ inputClassName, containerClassName, width, maxLength = 4, ...props }) => {
|
|
35
|
+
const Group = forwardRef(({ inputClassName, containerClassName, width, maxLength = 4, ...props }, ref) => {
|
|
36
36
|
const { id, size, disabled, invalid } = usePinInputContext();
|
|
37
37
|
const prefix = useTestIdPrefix();
|
|
38
38
|
const inputTestId = prefix ? joinTestId(prefix, 'input') : undefined;
|
|
39
|
-
return (jsx(OTPInput, { ...props, size: width, maxLength: maxLength, disabled: disabled, id: `pin-input-${id}`, "aria-label": "Enter your pin", "aria-labelledby": `pin-input-label-${id}`, "aria-describedby": `pin-input-description-${id}`, "aria-invalid": invalid, containerClassName: cx('flex flex-row', styles[size].group, containerClassName), className: cx('disabled:cursor-not-allowed', inputClassName), "data-testid": inputTestId }));
|
|
40
|
-
};
|
|
39
|
+
return (jsx(OTPInput, { ...props, ref: ref, size: width, maxLength: maxLength, disabled: disabled, id: `pin-input-${id}`, "aria-label": "Enter your pin", "aria-labelledby": `pin-input-label-${id}`, "aria-describedby": `pin-input-description-${id}`, "aria-invalid": invalid, containerClassName: cx('flex flex-row', styles[size].group, containerClassName), className: cx('disabled:cursor-not-allowed', inputClassName), "data-testid": inputTestId }));
|
|
40
|
+
});
|
|
41
41
|
Group.displayName = 'Group';
|
|
42
|
-
const Slot = ({ index, className, 'data-testid': dataTestId, ...props }) => {
|
|
42
|
+
const Slot = forwardRef(({ index, className, 'data-testid': dataTestId, ...props }, ref) => {
|
|
43
43
|
const { size, disabled, invalid } = usePinInputContext();
|
|
44
44
|
const { slots, isFocused } = useContext(OTPInputContext);
|
|
45
45
|
const prefix = useTestIdPrefix();
|
|
@@ -51,30 +51,30 @@ const Slot = ({ index, className, 'data-testid': dataTestId, ...props }) => {
|
|
|
51
51
|
// from assistive tech rather than labelled — an `aria-label` here would be prohibited on a
|
|
52
52
|
// role-less `<div>` (and doubly announce each digit alongside the real input's value), and
|
|
53
53
|
// `aria-invalid` here would never reach assistive tech at all since the node is hidden.
|
|
54
|
-
jsx("div", { ...props, "aria-hidden": "true", "data-testid": slotTestId, className: cx('relative flex items-center justify-center rounded-xl bg-primary text-center text-placeholder/40 shadow-xs ring-1 ring-primary transition-[box-shadow,background-color] duration-100 ease-linear ring-inset', styles[size].slot, isFocused && slot?.isActive && 'ring-2 ring-brand outline-2 outline-offset-2 outline-brand', slot?.char && 'text-brand-tertiary_alt ring-2 ring-brand', disabled && 'opacity-50', invalid && 'text-error-primary ring-error_subtle', className), children: slot?.char || (slot?.hasFakeCaret ? jsx(FakeCaret, { size: size }) : 0) }));
|
|
55
|
-
};
|
|
54
|
+
jsx("div", { ...props, ref: ref, "aria-hidden": "true", "data-testid": slotTestId, className: cx('relative flex items-center justify-center rounded-xl bg-primary text-center text-placeholder/40 shadow-xs ring-1 ring-primary transition-[box-shadow,background-color] duration-100 ease-linear ring-inset', styles[size].slot, isFocused && slot?.isActive && 'ring-2 ring-brand outline-2 outline-offset-2 outline-brand', slot?.char && 'text-brand-tertiary_alt ring-2 ring-brand', disabled && 'opacity-50', invalid && 'text-error-primary ring-error_subtle', className), children: slot?.char || (slot?.hasFakeCaret ? jsx(FakeCaret, { size: size }) : 0) }));
|
|
55
|
+
});
|
|
56
56
|
Slot.displayName = 'Slot';
|
|
57
57
|
const FakeCaret = ({ size = 'md' }) => {
|
|
58
58
|
return jsx("div", { className: cx('pointer-events-none h-[1em] w-0.5 animate-caret-blink bg-fg-brand-primary', styles[size].caret) });
|
|
59
59
|
};
|
|
60
|
-
const Separator = (props) => {
|
|
60
|
+
const Separator = forwardRef((props, ref) => {
|
|
61
61
|
return (
|
|
62
62
|
// biome-ignore lint/a11y/useFocusableInteractive: this is a separator
|
|
63
63
|
// biome-ignore lint/a11y/useSemanticElements: this is a separator
|
|
64
64
|
// biome-ignore lint/a11y/useAriaPropsForRole: this is a separator
|
|
65
|
-
jsx("div", { role: "separator", ...props, className: cx('text-center text-display-xl font-medium text-utility-neutral-300', props.className), children: "-" }));
|
|
66
|
-
};
|
|
65
|
+
jsx("div", { role: "separator", ...props, ref: ref, className: cx('text-center text-display-xl font-medium text-utility-neutral-300', props.className), children: "-" }));
|
|
66
|
+
});
|
|
67
67
|
Separator.displayName = 'Separator';
|
|
68
|
-
const Label = (props) => {
|
|
68
|
+
const Label = forwardRef((props, ref) => {
|
|
69
69
|
const { id } = usePinInputContext();
|
|
70
|
-
return jsx(Label$1, { ...props, htmlFor: `pin-input-${id}`, id: `pin-input-label-${id}` });
|
|
71
|
-
};
|
|
70
|
+
return jsx(Label$1, { ...props, ref: ref, htmlFor: `pin-input-${id}`, id: `pin-input-label-${id}` });
|
|
71
|
+
});
|
|
72
72
|
Label.displayName = 'Label';
|
|
73
|
-
const Description = (props) => {
|
|
73
|
+
const Description = forwardRef((props, ref) => {
|
|
74
74
|
const { id, size } = usePinInputContext();
|
|
75
75
|
// Referenced by the input's `aria-describedby`; no ARIA role needed (and `role="description"` is invalid).
|
|
76
|
-
return jsx(HintText, { ...props, id: `pin-input-description-${id}`, className: cx(size === 'xxxs' && 'text-xs') });
|
|
77
|
-
};
|
|
76
|
+
return jsx(HintText, { ...props, ref: ref, id: `pin-input-description-${id}`, className: cx(size === 'xxxs' && 'text-xs') });
|
|
77
|
+
});
|
|
78
78
|
Description.displayName = 'Description';
|
|
79
79
|
/**
|
|
80
80
|
* One box per character for entering a verification or one-time code, with paste and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"sourcesContent":[null],"names":["_jsx","LabelBase"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/VerificationCodeInput/index.tsx"],"sourcesContent":[null],"names":["_jsx","LabelBase"],"mappings":";;;;;;;AAiBA,MAAM,eAAe,GAAG,aAAa,CAAsB;AACzD,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,OAAO,EAAE,KAAK;AACf,CAAA,CAAC;AAEK,MAAM,kBAAkB,GAAG,MAAK;AACrC,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC;IAE3C,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC;IACvF;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;AAKG;AACH,MAAM,QAAQ,GAAG;AAOjB,QAAQ,CAAC,IAAI,GAAG,IAAI;AACpB,QAAQ,CAAC,KAAK,GAAG,KAAK;AACtB,QAAQ,CAAC,KAAK,GAAG,KAAK;AACtB,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,WAAW,GAAG,WAAW;;"}
|
|
@@ -15,18 +15,12 @@ var useForm = require('./hooks/useForm.cjs');
|
|
|
15
15
|
var useSaveForm = require('./hooks/useSaveForm.cjs');
|
|
16
16
|
|
|
17
17
|
/** Wraps a form's fields and marks them busy while the form submits, which is when they lock themselves. */
|
|
18
|
-
const FormFields = (props) => {
|
|
18
|
+
const FormFields = React.forwardRef((props, ref) => {
|
|
19
19
|
const { isSubmitting } = reactHookForm.useFormState();
|
|
20
|
-
return jsxRuntime.jsx("div", { ...props, "aria-busy": isSubmitting });
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* focuses the first invalid field in page order after a failed submit, and ignores a second submit while one is running.
|
|
25
|
-
* Use one per form.
|
|
26
|
-
*
|
|
27
|
-
* @summary form element that provides a react-hook-form form to its fields
|
|
28
|
-
*/
|
|
29
|
-
const Form = ({ form, onSubmit, onInvalid, ref, className, children, 'data-testid': dataTestId, ...formProps }) => {
|
|
20
|
+
return jsxRuntime.jsx("div", { ...props, ref: ref, "aria-busy": isSubmitting });
|
|
21
|
+
});
|
|
22
|
+
FormFields.displayName = 'Form.Fields';
|
|
23
|
+
const FormRoot = ({ form, onSubmit, onInvalid, className, children, 'data-testid': dataTestId, ...formProps }, ref) => {
|
|
30
24
|
const formTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'form', rootName: 'form' });
|
|
31
25
|
const [fieldElements] = React.useState(fieldElements_utils.createFieldElements);
|
|
32
26
|
// Kept beside the caller's ref: a retry inside the form submits this element, whether or not the caller holds one.
|
|
@@ -55,6 +49,15 @@ const Form = ({ form, onSubmit, onInvalid, ref, className, children, 'data-testi
|
|
|
55
49
|
// Focusable from code only: a control that turns itself off, such as Discard, hands focus here so it is not lost.
|
|
56
50
|
tabIndex: -1, onSubmit: submit, "data-testid": formTestId, className: cx.cx('outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2', className), children: children }) }) }) }));
|
|
57
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* The `<form>` around `Form*` fields: it provides the react-hook-form form to them, leaves validation to the schema,
|
|
54
|
+
* focuses the first invalid field in page order after a failed submit, and ignores a second submit while one is running.
|
|
55
|
+
* Use one per form.
|
|
56
|
+
*
|
|
57
|
+
* @summary form element that provides a react-hook-form form to its fields
|
|
58
|
+
*/
|
|
59
|
+
const Form = React.forwardRef(FormRoot);
|
|
60
|
+
Form.displayName = 'Form';
|
|
58
61
|
Form.Fields = FormFields;
|
|
59
62
|
|
|
60
63
|
exports.useForm = useForm.useForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/forms/Form/index.tsx"],"sourcesContent":[null],"names":["useFormState","_jsx","useResolvedTestId","useState","createFieldElements","useRef","useCallback","firstInvalidFieldOnPage","useSubmitInTurn","submitAfterValidations","FormProvider","FieldElementsContext","FormSubmitContext","cx"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/forms/Form/index.tsx"],"sourcesContent":[null],"names":["forwardRef","useFormState","_jsx","useResolvedTestId","useState","createFieldElements","useRef","useCallback","firstInvalidFieldOnPage","useSubmitInTurn","submitAfterValidations","FormProvider","FieldElementsContext","FormSubmitContext","cx"],"mappings":";;;;;;;;;;;;;;;;AAwDA;AACA,MAAM,UAAU,GAAGA,gBAAU,CAAkC,CAAC,KAAK,EAAE,GAAG,KAAI;AAC5E,IAAA,MAAM,EAAE,YAAY,EAAE,GAAGC,0BAAY,EAAE;IAEvC,OAAOC,cAAA,CAAA,KAAA,EAAA,EAAA,GAAS,KAAK,EAAE,GAAG,EAAE,GAAG,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AAA,MAAM,MAAM,GAAGC,+BAAe,CAACC,uCAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAEzF,IAAA,QACER,cAAA,CAACS,0BAAY,EAAA,EAAA,GAAK,IAAI,EAAA,QAAA,EACpBT,cAAA,CAACU,0CAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,aAAa,EAAA,QAAA,EACjDV,cAAA,CAACW,oCAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,aAAa,EAAA,QAAA,EAC9CX,cAAA,CAAA,MAAA,EAAA,EAAA,GACM,SAAS,EACb,GAAG,EAAE,cAAc;;oBAEnB,UAAU,EAAA,IAAA;;oBAEV,QAAQ,EAAE,EAAE,EACZ,QAAQ,EAAE,MAAM,EAAA,aAAA,EACH,UAAU,EACvB,SAAS,EAAEY,KAAE,CAAC,2EAA2E,EAAE,SAAS,CAAC,EAAA,QAAA,EAEpG,QAAQ,EAAA,CACJ,EAAA,CACoB,EAAA,CACC,EAAA,CACnB;AAEnB,CAAC;AAOD;;;;;;AAMG;MACU,IAAI,GAAGd,gBAAU,CAAC,QAAQ;AAEvC,IAAI,CAAC,WAAW,GAAG,MAAM;AACzB,IAAI,CAAC,MAAM,GAAG,UAAU;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentProps, type
|
|
1
|
+
import { type ComponentProps, type ComponentPropsWithoutRef, type ReactElement, type RefAttributes } from 'react';
|
|
2
2
|
import { type FieldValues, type SubmitErrorHandler, type SubmitHandler, type UseFormReturn } from 'react-hook-form';
|
|
3
3
|
export { useForm } from './hooks/useForm';
|
|
4
4
|
export type { SaveFieldError, UseSaveFormOptions, UseSaveFormReturn } from './hooks/useSaveForm';
|
|
@@ -16,13 +16,17 @@ export interface FormProps<TValues extends FieldValues = FieldValues, TSubmitVal
|
|
|
16
16
|
onSubmit: SubmitHandler<TSubmitValues>;
|
|
17
17
|
/** Called with the errors when validation fails. The first invalid field takes focus as the submit ends. */
|
|
18
18
|
onInvalid?: SubmitErrorHandler<TValues>;
|
|
19
|
-
/** Ref to the `<form>` element. */
|
|
20
|
-
ref?: Ref<HTMLFormElement>;
|
|
21
19
|
/** Overrides the `data-testid` (defaults to `fd-form`). */
|
|
22
20
|
'data-testid'?: string;
|
|
23
21
|
}
|
|
24
|
-
export interface FormFieldsProps extends Omit<
|
|
22
|
+
export interface FormFieldsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'aria-busy'> {
|
|
25
23
|
}
|
|
24
|
+
/** Wraps a form's fields and marks them busy while the form submits, which is when they lock themselves. */
|
|
25
|
+
declare const FormFields: import("react").ForwardRefExoticComponent<FormFieldsProps & RefAttributes<HTMLDivElement>>;
|
|
26
|
+
type FormComponent = (<TValues extends FieldValues = FieldValues, TSubmitValues = TValues>(props: FormProps<TValues, TSubmitValues> & RefAttributes<HTMLFormElement>) => ReactElement) & {
|
|
27
|
+
displayName?: string;
|
|
28
|
+
Fields: typeof FormFields;
|
|
29
|
+
};
|
|
26
30
|
/**
|
|
27
31
|
* The `<form>` around `Form*` fields: it provides the react-hook-form form to them, leaves validation to the schema,
|
|
28
32
|
* focuses the first invalid field in page order after a failed submit, and ignores a second submit while one is running.
|
|
@@ -30,8 +34,5 @@ export interface FormFieldsProps extends Omit<ComponentProps<'div'>, 'aria-busy'
|
|
|
30
34
|
*
|
|
31
35
|
* @summary form element that provides a react-hook-form form to its fields
|
|
32
36
|
*/
|
|
33
|
-
export declare const Form:
|
|
34
|
-
<TValues extends FieldValues = FieldValues, TSubmitValues = TValues>({ form, onSubmit, onInvalid, ref, className, children, "data-testid": dataTestId, ...formProps }: FormProps<TValues, TSubmitValues>): import("react").JSX.Element;
|
|
35
|
-
Fields: (props: FormFieldsProps) => import("react").JSX.Element;
|
|
36
|
-
};
|
|
37
|
+
export declare const Form: FormComponent;
|
|
37
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/Form/index.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/Form/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAG7B,KAAK,YAAY,EACjB,KAAK,aAAa,EAInB,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,WAAW,SAAS,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,aAAa,GAAG,OAAO,CAC3F,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,KAAK,CAAC;IACrF;;;OAGG;IAEH,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,4GAA4G;IAC5G,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;CAAG;AAE9F,4GAA4G;AAC5G,QAAA,MAAM,UAAU,4FAId,CAAC;AAyDH,KAAK,aAAa,GAAG,CAAC,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,aAAa,GAAG,OAAO,EACvF,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,KACtE,YAAY,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,UAAU,CAAA;CAAE,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAsC,aAAa,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
3
|
import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
4
|
-
import { useState, useRef, useCallback } from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import { forwardRef, useState, useRef, useCallback } from 'react';
|
|
5
|
+
import { useFormState, FormProvider } from 'react-hook-form';
|
|
6
6
|
import { FieldElementsContext } from '../__internal__/formField/providers/FieldElements.context.js';
|
|
7
7
|
import { createFieldElements } from '../__internal__/formField/utilities/fieldElements.utils.js';
|
|
8
8
|
import { firstInvalidFieldOnPage } from '../__internal__/formField/utilities/formFocus.utils.js';
|
|
@@ -13,18 +13,12 @@ export { useForm } from './hooks/useForm.js';
|
|
|
13
13
|
export { useSaveForm } from './hooks/useSaveForm.js';
|
|
14
14
|
|
|
15
15
|
/** Wraps a form's fields and marks them busy while the form submits, which is when they lock themselves. */
|
|
16
|
-
const FormFields = (props) => {
|
|
16
|
+
const FormFields = forwardRef((props, ref) => {
|
|
17
17
|
const { isSubmitting } = useFormState();
|
|
18
|
-
return jsx("div", { ...props, "aria-busy": isSubmitting });
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* focuses the first invalid field in page order after a failed submit, and ignores a second submit while one is running.
|
|
23
|
-
* Use one per form.
|
|
24
|
-
*
|
|
25
|
-
* @summary form element that provides a react-hook-form form to its fields
|
|
26
|
-
*/
|
|
27
|
-
const Form = ({ form, onSubmit, onInvalid, ref, className, children, 'data-testid': dataTestId, ...formProps }) => {
|
|
18
|
+
return jsx("div", { ...props, ref: ref, "aria-busy": isSubmitting });
|
|
19
|
+
});
|
|
20
|
+
FormFields.displayName = 'Form.Fields';
|
|
21
|
+
const FormRoot = ({ form, onSubmit, onInvalid, className, children, 'data-testid': dataTestId, ...formProps }, ref) => {
|
|
28
22
|
const formTestId = useResolvedTestId({ testId: dataTestId, segment: 'form', rootName: 'form' });
|
|
29
23
|
const [fieldElements] = useState(createFieldElements);
|
|
30
24
|
// Kept beside the caller's ref: a retry inside the form submits this element, whether or not the caller holds one.
|
|
@@ -53,6 +47,15 @@ const Form = ({ form, onSubmit, onInvalid, ref, className, children, 'data-testi
|
|
|
53
47
|
// Focusable from code only: a control that turns itself off, such as Discard, hands focus here so it is not lost.
|
|
54
48
|
tabIndex: -1, onSubmit: submit, "data-testid": formTestId, className: cx('outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2', className), children: children }) }) }) }));
|
|
55
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* The `<form>` around `Form*` fields: it provides the react-hook-form form to them, leaves validation to the schema,
|
|
52
|
+
* focuses the first invalid field in page order after a failed submit, and ignores a second submit while one is running.
|
|
53
|
+
* Use one per form.
|
|
54
|
+
*
|
|
55
|
+
* @summary form element that provides a react-hook-form form to its fields
|
|
56
|
+
*/
|
|
57
|
+
const Form = forwardRef(FormRoot);
|
|
58
|
+
Form.displayName = 'Form';
|
|
56
59
|
Form.Fields = FormFields;
|
|
57
60
|
|
|
58
61
|
export { Form };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/forms/Form/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/forms/Form/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";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AAK,GAAG,uBAAuB,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;AACrE,QAAA,IAAI,KAAK;AAAE,YAAA,IAAI,CAAC,QAAQ,CAAC,KAA2B,CAAC;AACrD,QAAA,OAAO,SAAS,GAAG,MAAM,EAAE,KAAK,CAAC;AACnC,IAAA,CAAC;AAED,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAEzF,IAAA,QACEA,GAAA,CAAC,YAAY,EAAA,EAAA,GAAK,IAAI,EAAA,QAAA,EACpBA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,aAAa,EAAA,QAAA,EACjDA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,aAAa,EAAA,QAAA,EAC9CA,GAAA,CAAA,MAAA,EAAA,EAAA,GACM,SAAS,EACb,GAAG,EAAE,cAAc;;oBAEnB,UAAU,EAAA,IAAA;;oBAEV,QAAQ,EAAE,EAAE,EACZ,QAAQ,EAAE,MAAM,EAAA,aAAA,EACH,UAAU,EACvB,SAAS,EAAE,EAAE,CAAC,2EAA2E,EAAE,SAAS,CAAC,EAAA,QAAA,EAEpG,QAAQ,EAAA,CACJ,EAAA,CACoB,EAAA,CACC,EAAA,CACnB;AAEnB,CAAC;AAOD;;;;;;AAMG;MACU,IAAI,GAAG,UAAU,CAAC,QAAQ;AAEvC,IAAI,CAAC,WAAW,GAAG,MAAM;AACzB,IAAI,CAAC,MAAM,GAAG,UAAU;;"}
|
|
@@ -57,8 +57,17 @@ const useFocusThroughSubmit = (fieldRef, isSubmitting) => {
|
|
|
57
57
|
setHasReadFocus(false);
|
|
58
58
|
// Focus sits on `<body>` only when the lock took it; anywhere else, the user chose it.
|
|
59
59
|
const isStillLost = state.wasLost && ownerDocument.activeElement === ownerDocument.body;
|
|
60
|
-
|
|
60
|
+
// Focus the lock took goes back to the element that held it, such as a phone field's country trigger, not the control's first.
|
|
61
|
+
const heldBy = state.heldBy;
|
|
62
|
+
if (state.isOwed)
|
|
61
63
|
control.focus();
|
|
64
|
+
else if (isStillLost) {
|
|
65
|
+
if (heldBy?.isConnected && !heldBy.matches(':disabled'))
|
|
66
|
+
heldBy.focus();
|
|
67
|
+
// An element hidden meanwhile refuses focus, so the control's own focus target takes it instead.
|
|
68
|
+
if (ownerDocument.activeElement === ownerDocument.body)
|
|
69
|
+
control.focus();
|
|
70
|
+
}
|
|
62
71
|
focus.current = { heldBy: null, wasLost: false, isOwed: false };
|
|
63
72
|
}, [isSubmitting, hasReadFocus]);
|
|
64
73
|
return { ref, isLocked };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusThroughSubmit.cjs","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"sourcesContent":[null],"names":["useRef","useState","useCallback","useLayoutEffect"],"mappings":";;;;AAeA;;;;;;;;AAQG;MACU,qBAAqB,GAAG,CAAC,QAAqB,EAAE,YAAqB,KAAI;AACpF,IAAA,MAAM,MAAM,GAAGA,YAAM,CAAqB,IAAI,CAAC;AAC/C,IAAA,MAAM,KAAK,GAAGA,YAAM,CAAgE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;;IAEpI,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,YAAY,IAAI,YAAY;AAE7C,IAAA,MAAM,GAAG,GAAGC,iBAAW,CACrB,CAAC,QAA4B,KAAI;AAC/B,QAAA,MAAM,CAAC,OAAO,GAAG,QAAQ;AACzB,QAAA,IAAI,CAAC,QAAQ;AAAE,YAAA,OAAO,QAAQ,CAAC,IAAI,CAAC;AACpC,QAAA,QAAQ,CAAC;YACP,KAAK,EAAE,MAAK;gBACV,Q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tB,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"useFocusThroughSubmit.cjs","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"sourcesContent":[null],"names":["useRef","useState","useCallback","useLayoutEffect"],"mappings":";;;;AAeA;;;;;;;;AAQG;MACU,qBAAqB,GAAG,CAAC,QAAqB,EAAE,YAAqB,KAAI;AACpF,IAAA,MAAM,MAAM,GAAGA,YAAM,CAAqB,IAAI,CAAC;AAC/C,IAAA,MAAM,KAAK,GAAGA,YAAM,CAAgE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;;IAEpI,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,YAAY,IAAI,YAAY;AAE7C,IAAA,MAAM,GAAG,GAAGC,iBAAW,CACrB,CAAC,QAA4B,KAAI;AAC/B,QAAA,MAAM,CAAC,OAAO,GAAG,QAAQ;AACzB,QAAA,IAAI,CAAC,QAAQ;AAAE,YAAA,OAAO,QAAQ,CAAC,IAAI,CAAC;AACpC,QAAA,QAAQ,CAAC;YACP,KAAK,EAAE,MAAK;gBACV,QAAQ,CAAC,KAAK,EAAE;AAChB,gBAAA,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC;YACjF,CAAC;YACD,MAAM,EAAE,MAAM,QAAQ,CAAC,MAAM,IAAI;AAClC,SAAA,CAAC;AACJ,IAAA,CAAC,EACD,CAAC,QAAQ,CAAC,CACX;IAEDC,qBAAe,CAAC,MAAK;AACnB,QAAA,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO;AAC3B,QAAA,MAAM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aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI;gBAAE,OAAO,CAAC,KAAK,EAAE;QACzE;AACA,QAAA,KAAK,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AACjE,IAAA,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAEhC,IAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE;AAC1B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusThroughSubmit.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,kIAAkI;AAClI,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,mHAAmH;IACnH,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC;IACzC,yEAAyE;IACzE,aAAa,EAAE,QAAQ,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,WAAW,EAAE,cAAc,OAAO;oBAQnE,WAAW,GAAG,IAAI;;
|
|
1
|
+
{"version":3,"file":"useFocusThroughSubmit.d.ts","sourceRoot":"","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,kIAAkI;AAClI,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,mHAAmH;IACnH,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC;IACzC,yEAAyE;IACzE,aAAa,EAAE,QAAQ,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,WAAW,EAAE,cAAc,OAAO;oBAQnE,WAAW,GAAG,IAAI;;CAqDhC,CAAC"}
|
|
@@ -55,8 +55,17 @@ const useFocusThroughSubmit = (fieldRef, isSubmitting) => {
|
|
|
55
55
|
setHasReadFocus(false);
|
|
56
56
|
// Focus sits on `<body>` only when the lock took it; anywhere else, the user chose it.
|
|
57
57
|
const isStillLost = state.wasLost && ownerDocument.activeElement === ownerDocument.body;
|
|
58
|
-
|
|
58
|
+
// Focus the lock took goes back to the element that held it, such as a phone field's country trigger, not the control's first.
|
|
59
|
+
const heldBy = state.heldBy;
|
|
60
|
+
if (state.isOwed)
|
|
59
61
|
control.focus();
|
|
62
|
+
else if (isStillLost) {
|
|
63
|
+
if (heldBy?.isConnected && !heldBy.matches(':disabled'))
|
|
64
|
+
heldBy.focus();
|
|
65
|
+
// An element hidden meanwhile refuses focus, so the control's own focus target takes it instead.
|
|
66
|
+
if (ownerDocument.activeElement === ownerDocument.body)
|
|
67
|
+
control.focus();
|
|
68
|
+
}
|
|
60
69
|
focus.current = { heldBy: null, wasLost: false, isOwed: false };
|
|
61
70
|
}, [isSubmitting, hasReadFocus]);
|
|
62
71
|
return { ref, isLocked };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusThroughSubmit.js","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeA;;;;;;;;AAQG;MACU,qBAAqB,GAAG,CAAC,QAAqB,EAAE,YAAqB,KAAI;AACpF,IAAA,MAAM,MAAM,GAAG,MAAM,C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K,CAAC,MAAM,GAAG,KAAK;AACpB,YAAA,OAAO,eAAe,CAAC,IAAI,CAAC;QAC9B;QACA,IAAI,YAAY,EAAE;;AAEhB,YAAA,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,KAAK;;;YAG3D,MAAM,MAAM,GAAG,MAAK;AAClB,gBAAA,KAAK,CAAC,OAAO,GAAG,KAAK;AACrB,gBAAA,KAAK,CAAC,MAAM,GAAG,KAAK;AACtB,YAAA,CAAC;AACD,YAAA,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC;YACjD,OAAO,MAAM,aAAa,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC;QACnE;QACA,eAAe,CAAC,KAAK,CAAC;;AAEtB,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,IAAI,aAAa,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"useFocusThroughSubmit.js","sources":["../../../../../../src/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeA;;;;;;;;AAQG;MACU,qBAAqB,GAAG,CAAC,QAAqB,EAAE,YAAqB,KAAI;AACpF,IAAA,MAAM,MAAM,GAAG,MAAM,CAAqB,IAAI,CAAC;AAC/C,IAAA,MAAM,KAAK,GAAG,MAAM,CAAgE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;;IAEpI,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,YAAY,IAAI,YAAY;AAE7C,IAAA,MAAM,GAAG,GAAG,WAAW,CACrB,CAAC,QAA4B,KAAI;AAC/B,QAAA,MAAM,CAAC,OAAO,GAAG,QAAQ;AACzB,QAAA,IAAI,CAA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