@pega/cosmos-react-core 4.0.0-dev.13.0 → 4.0.0-dev.14.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 +2 -2
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +10 -12
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +6 -6
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +1 -1
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +3 -3
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +2 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Button/Button.d.ts +3 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +168 -142
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +1 -1
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.js +5 -1
- package/lib/components/ColorPicker/ColorPicker.test-ids.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -10
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.js +2 -1
- package/lib/components/ComboBox/ComboxBox.test-ids.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.js +8 -10
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.js +5 -1
- package/lib/components/CompositeInput/CompositeInput.test-ids.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +5 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
- package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
- package/lib/components/Currency/Currency.test-ids.js +5 -1
- package/lib/components/Currency/Currency.test-ids.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +1 -1
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +25 -32
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts +1 -0
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +3 -0
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +20 -27
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +1 -9
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +11 -17
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +1 -1
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +1 -1
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +8 -6
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +2 -2
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts +3 -0
- package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.styles.js +29 -2
- package/lib/components/Dialog/Dialog.styles.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.d.ts +36 -14
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.types.js +0 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/FormDialog.d.ts +4 -1
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +4 -5
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.d.ts +0 -1
- package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +15 -13
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.styles.d.ts +6 -0
- package/lib/components/Dialog/InfoDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialog.styles.js +18 -0
- package/lib/components/Dialog/InfoDialog.styles.js.map +1 -0
- package/lib/components/EmojiPicker/EmojiPicker.styles.js +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +4 -2
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts +2 -2
- package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts.map +1 -1
- package/lib/components/FieldValueList/index.d.ts +1 -1
- package/lib/components/FieldValueList/index.d.ts.map +1 -1
- package/lib/components/FieldValueList/index.js.map +1 -1
- package/lib/components/File/File.test-ids.d.ts +1 -1
- package/lib/components/File/File.test-ids.d.ts.map +1 -1
- package/lib/components/File/File.test-ids.js +6 -1
- package/lib/components/File/File.test-ids.js.map +1 -1
- package/lib/components/File/FileInput.js +1 -1
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/Flex/Flex.d.ts +7 -1
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js +37 -10
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +2 -1
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/FormField/FormField.test-ids.d.ts +2 -1
- package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
- package/lib/components/FormField/FormField.test-ids.js +3 -2
- package/lib/components/FormField/FormField.test-ids.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +2 -2
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/phone-merge-solid.icon.d.ts +4 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.js +6 -0
- package/lib/components/Icon/icons/phone-merge-solid.icon.js.map +1 -0
- package/lib/components/Icon/icons/phone-merge.icon.d.ts +4 -0
- package/lib/components/Icon/icons/phone-merge.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/phone-merge.icon.js +6 -0
- package/lib/components/Icon/icons/phone-merge.icon.js.map +1 -0
- package/lib/components/IconPicker/IconPicker.js +2 -2
- package/lib/components/IconPicker/IconPicker.js.map +1 -1
- package/lib/components/Input/Input.js +1 -1
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.test-ids.d.ts +1 -1
- package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
- package/lib/components/Input/Input.test-ids.js +2 -1
- package/lib/components/Input/Input.test-ids.js.map +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +49 -17
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +3 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +2 -3
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +2 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.js +7 -0
- package/lib/components/ListToolbar/ListToolbar.test-ids.js.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +31 -8
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/ListToolbar/helpers.d.ts +10 -0
- package/lib/components/ListToolbar/helpers.d.ts.map +1 -0
- package/lib/components/ListToolbar/helpers.js +46 -0
- package/lib/components/ListToolbar/helpers.js.map +1 -0
- package/lib/components/ListToolbar/index.d.ts +1 -0
- package/lib/components/ListToolbar/index.d.ts.map +1 -1
- package/lib/components/ListToolbar/index.js +1 -0
- package/lib/components/ListToolbar/index.js.map +1 -1
- package/lib/components/LiveLog/LiveLog.d.ts.map +1 -1
- package/lib/components/LiveLog/LiveLog.js +17 -16
- package/lib/components/LiveLog/LiveLog.js.map +1 -1
- package/lib/components/Location/Location.test-ids.d.ts +1 -1
- package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
- package/lib/components/Location/Location.test-ids.js +5 -1
- package/lib/components/Location/Location.test-ids.js.map +1 -1
- package/lib/components/Location/LocationInput.js +1 -1
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +1 -4
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.test-ids.d.ts +2 -2
- package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +2 -0
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +2 -2
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +6 -4
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts +2 -0
- package/lib/components/MenuButton/MenuButton.test-ids.d.ts.map +1 -0
- package/lib/components/MenuButton/MenuButton.test-ids.js +3 -0
- package/lib/components/MenuButton/MenuButton.test-ids.js.map +1 -0
- package/lib/components/MetaList/MetaList.test-ids.d.ts +1 -1
- package/lib/components/MetaList/MetaList.test-ids.d.ts.map +1 -1
- package/lib/components/Modal/Modal.styles.js +1 -1
- package/lib/components/Modal/Modal.styles.js.map +1 -1
- package/lib/components/Modal/ModalManager.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js +5 -2
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/Number/Number.test-ids.d.ts +2 -2
- package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
- package/lib/components/Number/Number.test-ids.js +8 -2
- package/lib/components/Number/Number.test-ids.js.map +1 -1
- package/lib/components/Number/NumberInput.js +1 -1
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberRangeInput.js +1 -1
- package/lib/components/Number/NumberRangeInput.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +2 -2
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
- package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
- package/lib/components/Phone/Phone.test-ids.js +3 -1
- package/lib/components/Phone/Phone.test-ids.js.map +1 -1
- package/lib/components/Phone/PhoneInput.js +2 -2
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +1 -0
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +37 -40
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/PopoverManager.d.ts.map +1 -1
- package/lib/components/Popover/PopoverManager.js +11 -10
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +1 -0
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +97 -1
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
- package/lib/components/Progress/Progress.styles.js +25 -20
- package/lib/components/Progress/Progress.styles.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +2 -2
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +1 -9
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Select.js +2 -2
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/Select.test-ids.d.ts +1 -1
- package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
- package/lib/components/Select/Select.test-ids.js +2 -1
- package/lib/components/Select/Select.test-ids.js.map +1 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
- package/lib/components/Slider/Slider.styles.js +114 -128
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
- package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
- package/lib/components/Slider/Slider.test-ids.js +2 -1
- package/lib/components/Slider/Slider.test-ids.js.map +1 -1
- package/lib/components/Slider/utils.d.ts.map +1 -1
- package/lib/components/Slider/utils.js +0 -1
- package/lib/components/Slider/utils.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts +1 -1
- package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +21 -18
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
- package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.test-ids.js +2 -1
- package/lib/components/TextArea/TextArea.test-ids.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +4 -1
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useChToPxConversionFactor.d.ts +3 -0
- package/lib/hooks/useChToPxConversionFactor.d.ts.map +1 -0
- package/lib/hooks/useChToPxConversionFactor.js +13 -0
- package/lib/hooks/useChToPxConversionFactor.js.map +1 -0
- package/lib/hooks/useElement.d.ts +1 -1
- package/lib/hooks/useElement.d.ts.map +1 -1
- package/lib/hooks/useI18n.d.ts +13 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useScrollToggle.d.ts.map +1 -1
- package/lib/hooks/useScrollToggle.js +0 -1
- package/lib/hooks/useScrollToggle.js.map +1 -1
- package/lib/hooks/useTestIds.d.ts +1 -1
- package/lib/hooks/useTestIds.d.ts.map +1 -1
- package/lib/hooks/useTestIds.js +3 -0
- package/lib/hooks/useTestIds.js.map +1 -1
- package/lib/i18n/default.d.ts +13 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +14 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +13 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/gradients.d.ts.map +1 -1
- package/lib/styles/gradients.js.map +1 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/types/types.d.ts +7 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/createTestIds.d.ts +1 -6
- package/lib/utils/createTestIds.d.ts.map +1 -1
- package/lib/utils/createTestIds.js +2 -4
- package/lib/utils/createTestIds.js.map +1 -1
- package/lib/utils/debounce.d.ts +2 -2
- package/lib/utils/debounce.d.ts.map +1 -1
- package/lib/utils/debounce.js +9 -10
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/getEdge.d.ts +7 -0
- package/lib/utils/getEdge.d.ts.map +1 -0
- package/lib/utils/getEdge.js +9 -0
- package/lib/utils/getEdge.js.map +1 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/throttle.d.ts +4 -0
- package/lib/utils/throttle.d.ts.map +1 -0
- package/lib/utils/throttle.js +15 -0
- package/lib/utils/throttle.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { createTestIds } from '../../utils';
|
|
2
|
-
|
|
2
|
+
import { elements } from '../FormField/FormField.test-ids';
|
|
3
|
+
export const getFileInputTestIds = createTestIds('file-input', [
|
|
4
|
+
'control',
|
|
5
|
+
'files',
|
|
6
|
+
...elements
|
|
7
|
+
]);
|
|
3
8
|
//# sourceMappingURL=File.test-ids.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.test-ids.js","sourceRoot":"","sources":["../../../src/components/File/File.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"File.test-ids.js","sourceRoot":"","sources":["../../../src/components/File/File.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,YAAY,EAAE;IAC7D,SAAS;IACT,OAAO;IACP,GAAG,QAAQ;CACH,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\nimport { elements } from '../FormField/FormField.test-ids';\n\nexport const getFileInputTestIds = createTestIds('file-input', [\n 'control',\n 'files',\n ...elements\n] as const);\n"]}
|
|
@@ -88,7 +88,7 @@ const FileInput = forwardRef((props, ref) => {
|
|
|
88
88
|
_jsx(StyledInteractiveText, { children: t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one') })
|
|
89
89
|
]), "\u00A0"] }), rtl && icon] })] }));
|
|
90
90
|
return (_jsxs(Grid, { container: { rowGap: 1 }, children: [label ? (_jsx(FormField, { ...{
|
|
91
|
-
testId: testIds
|
|
91
|
+
testId: testIds,
|
|
92
92
|
label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","sourcesContent":["import {\n FunctionComponent,\n Ref,\n forwardRef,\n ChangeEvent,\n useCallback,\n PropsWithoutRef,\n DragEvent,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport {\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport { useConsolidatedRef, useI18n, useUID, useDirection, useTestIds } from '../../hooks';\nimport FormControl, { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as paperClipIcon from '../Icon/icons/paper-clip.icon';\nimport FormField from '../FormField';\nimport Grid from '../Grid';\n\nimport FileUploadItem, { FileUploadItemProps } from './FileUploadItem';\nimport { getFileInputTestIds } from './File.test-ids';\n\nregisterIcon(paperClipIcon);\n\ntype FileInputPropsWithDefaults = PropsWithDefaults<FileInputProps>;\n\nexport interface FileInputProps extends BaseProps, NoChildrenProp, TestIdProp {\n /**\n * Called when files are added either via the input or drop zone.\n */\n onFilesAdded?: (files: File[]) => void;\n /**\n * Allow multiple files to be selected from the OS specific file browser.\n * NOTE: This does not restrict multiple files from being added via drag and drop.\n * Restrict multi file drag and drop via onFilesAdded and custom info message.\n * @default false\n */\n multiple?: boolean;\n /** An array of files that have been uploaded. */\n files?: FileUploadItemProps[];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Ref for the input element within the component's dom structure. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const StyledDropZone = styled(FormControl)<{ dragOver: boolean }>(({ dragOver, theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n min-height: 4rem;\n border-style: dashed;\n cursor: pointer;\n\n ${dragOver &&\n css`\n border-style: solid;\n `}\n `;\n});\n\nexport const StyledFileInput = styled.div<FileInputPropsWithDefaults & ForwardProps>(\n ({ theme }) => {\n return css`\n position: relative;\n\n input {\n ${hideVisually}\n }\n\n input:enabled:focus + ${StyledDropZone} {\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n }\n\n input[hidden] + ${StyledDropZone} {\n display: none;\n }\n `;\n }\n);\n\nStyledFileInput.defaultProps = defaultThemeProp;\n\nconst StyledInteractiveText = styled.span(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledInteractiveText.defaultProps = defaultThemeProp;\n\nconst FileInput: FunctionComponent<FileInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileInputProps>, ref: FileInputProps['ref']) => {\n const uid = useUID();\n const {\n testId,\n id = uid,\n label,\n labelHidden,\n info,\n required = false,\n disabled = false,\n files,\n onFilesAdded,\n multiple = false,\n status,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getFileInputTestIds);\n\n const icon = <Icon name='paper-clip' />;\n const inputRef = useConsolidatedRef(ref);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n onFilesAdded?.(Array.from(e.target.files));\n }\n /**\n * WHY are we doing this?\n * We are not working with the \"value\" prop of the input but rather the File instances that are created.\n * The consumer of this component should manage an array or File(s) and allow for a user to remove a selected file.\n * Since we can not modify the input value of files for browser security reasons,\n * and since setting the files property is less than ideal, we reset/toggle the input to a fresh state after a render.\n * This enables onChange to fire even if the user had just previously selected a file, removed it, and selected it again.\n */\n if (inputRef.current) inputRef.current.value = '';\n },\n [onFilesAdded]\n );\n\n const t = useI18n();\n const [dragOver, setDragOver] = useState(false);\n const { ltr, rtl } = useDirection();\n\n const fileInput = (\n <StyledFileInput>\n <input\n data-testid={testIds.control}\n {...restProps}\n ref={inputRef}\n type='file'\n id={id}\n disabled={disabled}\n onChange={onChange}\n multiple={multiple}\n />\n <Flex\n container={{ alignItems: 'center', justify: 'center' }}\n item={{ grow: 1 }}\n as={StyledDropZone}\n dragOver={dragOver}\n onClick={() => {\n inputRef.current?.focus();\n inputRef.current?.click();\n }}\n onDragOver={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n }}\n onDragEnter={() => setDragOver(true)}\n onDragLeave={() => setDragOver(false)}\n onDrop={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragOver(false);\n onFilesAdded?.(Array.from(e.dataTransfer.files));\n }}\n >\n {ltr && icon}\n <Text variant='primary'>\n \n {t('file_upload_text_main', [\n <StyledInteractiveText>\n {t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one')}\n </StyledInteractiveText>\n ])}\n \n </Text>\n {rtl && icon}\n </Flex>\n </StyledFileInput>\n );\n\n return (\n <Grid container={{ rowGap: 1 }}>\n {label ? (\n <FormField\n {...{\n testId: testIds.root,\n label,\n labelHidden,\n id,\n info,\n required,\n disabled,\n status\n }}\n >\n {fileInput}\n </FormField>\n ) : (\n fileInput\n )}\n {!!files?.length && (\n <Grid\n data-testid={testIds.files}\n container={{\n gap: 1,\n cols: 'repeat(2, minmax(0, 1fr))'\n }}\n as='ul'\n >\n {files.map(({ name, ...file }, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <FileUploadItem key={index} name={name} {...file} />;\n })}\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default FileInput;\n"]}
|
|
1
|
+
{"version":3,"file":"FileInput.js","sourceRoot":"","sources":["../../../src/components/File/FileInput.tsx"],"names":[],"mappings":";AAAA,OAAO,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AAC,aAEA,GAAG,IAAI,IAAI,EACZ,MAAC,IAAI,IAAC,OAAO,EAAC,SAAS,uBAEpB,CAAC,CAAC,uBAAuB,EAAE;gCAC1B,KAAC,qBAAqB,cACnB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,sBAAsB,CAAC,GAC7C;6BACzB,CAAC,cAEG,EACN,GAAG,IAAI,IAAI,IACP,IACS,CACnB,CAAC;IAEF,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,aAC3B,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,SAAS,OACJ;oBACF,MAAM,EAAE,OAAO;oBACf,KAAK;oBACL,WAAW;oBACX,EAAE;oBACF,IAAI;oBACJ,QAAQ;oBACR,QAAQ;oBACR,MAAM;iBACP,YAEA,SAAS,GACA,CACb,CAAC,CAAC,CAAC,CACF,SAAS,CACV,EACA,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAClB,KAAC,IAAI,mBACU,OAAO,CAAC,KAAK,EAC1B,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,2BAA2B;iBAClC,EACD,EAAE,EAAC,IAAI,YAEN,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE;oBACtC,oDAAoD;oBACpD,OAAO,KAAC,cAAc,IAAa,IAAI,EAAE,IAAI,KAAM,IAAI,IAA3B,KAAK,CAA0B,CAAC;gBAC9D,CAAC,CAAC,GACG,CACR,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FunctionComponent,\n Ref,\n forwardRef,\n ChangeEvent,\n useCallback,\n PropsWithoutRef,\n DragEvent,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport {\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport { useConsolidatedRef, useI18n, useUID, useDirection, useTestIds } from '../../hooks';\nimport FormControl, { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Icon, { registerIcon } from '../Icon';\nimport * as paperClipIcon from '../Icon/icons/paper-clip.icon';\nimport FormField from '../FormField';\nimport Grid from '../Grid';\n\nimport FileUploadItem, { FileUploadItemProps } from './FileUploadItem';\nimport { getFileInputTestIds } from './File.test-ids';\n\nregisterIcon(paperClipIcon);\n\ntype FileInputPropsWithDefaults = PropsWithDefaults<FileInputProps>;\n\nexport interface FileInputProps extends BaseProps, NoChildrenProp, TestIdProp {\n /**\n * Called when files are added either via the input or drop zone.\n */\n onFilesAdded?: (files: File[]) => void;\n /**\n * Allow multiple files to be selected from the OS specific file browser.\n * NOTE: This does not restrict multiple files from being added via drag and drop.\n * Restrict multi file drag and drop via onFilesAdded and custom info message.\n * @default false\n */\n multiple?: boolean;\n /** An array of files that have been uploaded. */\n files?: FileUploadItemProps[];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Ref for the input element within the component's dom structure. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const StyledDropZone = styled(FormControl)<{ dragOver: boolean }>(({ dragOver, theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n min-height: 4rem;\n border-style: dashed;\n cursor: pointer;\n\n ${dragOver &&\n css`\n border-style: solid;\n `}\n `;\n});\n\nexport const StyledFileInput = styled.div<FileInputPropsWithDefaults & ForwardProps>(\n ({ theme }) => {\n return css`\n position: relative;\n\n input {\n ${hideVisually}\n }\n\n input:enabled:focus + ${StyledDropZone} {\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n }\n\n input[hidden] + ${StyledDropZone} {\n display: none;\n }\n `;\n }\n);\n\nStyledFileInput.defaultProps = defaultThemeProp;\n\nconst StyledInteractiveText = styled.span(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledInteractiveText.defaultProps = defaultThemeProp;\n\nconst FileInput: FunctionComponent<FileInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FileInputProps>, ref: FileInputProps['ref']) => {\n const uid = useUID();\n const {\n testId,\n id = uid,\n label,\n labelHidden,\n info,\n required = false,\n disabled = false,\n files,\n onFilesAdded,\n multiple = false,\n status,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getFileInputTestIds);\n\n const icon = <Icon name='paper-clip' />;\n const inputRef = useConsolidatedRef(ref);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n onFilesAdded?.(Array.from(e.target.files));\n }\n /**\n * WHY are we doing this?\n * We are not working with the \"value\" prop of the input but rather the File instances that are created.\n * The consumer of this component should manage an array or File(s) and allow for a user to remove a selected file.\n * Since we can not modify the input value of files for browser security reasons,\n * and since setting the files property is less than ideal, we reset/toggle the input to a fresh state after a render.\n * This enables onChange to fire even if the user had just previously selected a file, removed it, and selected it again.\n */\n if (inputRef.current) inputRef.current.value = '';\n },\n [onFilesAdded]\n );\n\n const t = useI18n();\n const [dragOver, setDragOver] = useState(false);\n const { ltr, rtl } = useDirection();\n\n const fileInput = (\n <StyledFileInput>\n <input\n data-testid={testIds.control}\n {...restProps}\n ref={inputRef}\n type='file'\n id={id}\n disabled={disabled}\n onChange={onChange}\n multiple={multiple}\n />\n <Flex\n container={{ alignItems: 'center', justify: 'center' }}\n item={{ grow: 1 }}\n as={StyledDropZone}\n dragOver={dragOver}\n onClick={() => {\n inputRef.current?.focus();\n inputRef.current?.click();\n }}\n onDragOver={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n }}\n onDragEnter={() => setDragOver(true)}\n onDragLeave={() => setDragOver(false)}\n onDrop={(e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n setDragOver(false);\n onFilesAdded?.(Array.from(e.dataTransfer.files));\n }}\n >\n {ltr && icon}\n <Text variant='primary'>\n \n {t('file_upload_text_main', [\n <StyledInteractiveText>\n {t(multiple ? 'file_upload_text_multiple' : 'file_upload_text_one')}\n </StyledInteractiveText>\n ])}\n \n </Text>\n {rtl && icon}\n </Flex>\n </StyledFileInput>\n );\n\n return (\n <Grid container={{ rowGap: 1 }}>\n {label ? (\n <FormField\n {...{\n testId: testIds,\n label,\n labelHidden,\n id,\n info,\n required,\n disabled,\n status\n }}\n >\n {fileInput}\n </FormField>\n ) : (\n fileInput\n )}\n {!!files?.length && (\n <Grid\n data-testid={testIds.files}\n container={{\n gap: 1,\n cols: 'repeat(2, minmax(0, 1fr))'\n }}\n as='ul'\n >\n {files.map(({ name, ...file }, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <FileUploadItem key={index} name={name} {...file} />;\n })}\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default FileInput;\n"]}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { FunctionComponent, Ref, ReactNode } from 'react';
|
|
2
2
|
import { ForwardProps, BaseProps, AsProp, RequireAtLeastOne } from '../../types';
|
|
3
|
+
type PaddingValue = number | undefined;
|
|
3
4
|
export interface FlexContainerProps {
|
|
4
5
|
/** Display as inline-flex. */
|
|
5
6
|
inline?: boolean;
|
|
6
7
|
/** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */
|
|
7
|
-
pad?: number | [
|
|
8
|
+
pad?: number | [blockInline: PaddingValue] | [block: PaddingValue, inline: PaddingValue] | [blockStart: PaddingValue, inline: PaddingValue, blockEnd: PaddingValue] | [
|
|
9
|
+
blockStart: PaddingValue,
|
|
10
|
+
inlineEnd: PaddingValue,
|
|
11
|
+
inlineStart: PaddingValue,
|
|
12
|
+
blockEnd: PaddingValue
|
|
13
|
+
];
|
|
8
14
|
/** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */
|
|
9
15
|
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
16
|
/** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGjF,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yHAAyH;IACzH,GAAG,CAAC,EACA,MAAM,GACN,CAAC,
|
|
1
|
+
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGjF,KAAK,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO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AAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACtC,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,KAAK,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;AAElF,MAAM,MAAM,SAAS,GAAG,iBAAiB,CACvC,aAAa,GACX,SAAS,GACT,MAAM,GAAG;IACP,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gCAAgC;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACnB,4DAA4D;IAC5D,EAAE,CAAC,EAAE,mBAAmB,CAAC;IACzB,sDAAsD;IACtD,EAAE,CAAC,EAAE,mBAAmB,CAAC;IACzB,uDAAuD;IACvD,EAAE,CAAC,EAAE,mBAAmB,CAAC;IACzB,sDAAsD;IACtD,EAAE,CAAC,EAAE,mBAAmB,CAAC;IACzB,4DAA4D;IAC5D,EAAE,CAAC,EAAE,mBAAmB,CAAC;CAC1B,EACH,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CACxD,CAAC;AAsJF,eAAO,MAAM,UAAU,qHAqCtB,CAAC;AAIF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAIrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -9,7 +9,24 @@ const prefix = (value) => {
|
|
|
9
9
|
return `flex-${value}`;
|
|
10
10
|
return value;
|
|
11
11
|
};
|
|
12
|
-
const
|
|
12
|
+
const getLogicalPadding = (pad) => {
|
|
13
|
+
if (!Array.isArray(pad)) {
|
|
14
|
+
return [pad, pad, pad, pad];
|
|
15
|
+
}
|
|
16
|
+
switch (pad.length) {
|
|
17
|
+
case 1:
|
|
18
|
+
return [pad[0], pad[0], pad[0], pad[0]];
|
|
19
|
+
case 2:
|
|
20
|
+
return [pad[0], pad[1], pad[0], pad[1]];
|
|
21
|
+
case 3:
|
|
22
|
+
return [pad[0], pad[1], pad[2], pad[1]];
|
|
23
|
+
case 4:
|
|
24
|
+
return pad;
|
|
25
|
+
default:
|
|
26
|
+
return [undefined, undefined, undefined, undefined];
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const getContainerStyles = (container, spacing) => {
|
|
13
30
|
if (!container)
|
|
14
31
|
return '';
|
|
15
32
|
if (container === true) {
|
|
@@ -17,20 +34,30 @@ const getContainerStyles = (container) => {
|
|
|
17
34
|
display: flex;
|
|
18
35
|
`;
|
|
19
36
|
}
|
|
37
|
+
const paddingConfig = getLogicalPadding(container.pad);
|
|
20
38
|
if (container && typeof container === 'object') {
|
|
21
39
|
const isRow = !container.direction || container.direction.includes('row');
|
|
22
40
|
const isReverse = container.direction && container.direction.includes('reverse');
|
|
23
41
|
return css `
|
|
24
42
|
display: ${container.inline ? 'inline-flex' : 'flex'};
|
|
25
43
|
|
|
26
|
-
${
|
|
44
|
+
${paddingConfig[0] !== undefined &&
|
|
45
|
+
css `
|
|
46
|
+
padding-block-start: calc(${paddingConfig[0]} * ${spacing});
|
|
47
|
+
`}
|
|
48
|
+
${paddingConfig[1] !== undefined &&
|
|
49
|
+
css `
|
|
50
|
+
padding-inline-end: calc(${paddingConfig[1]} * ${spacing});
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
${paddingConfig[2] !== undefined &&
|
|
27
54
|
css `
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.map(p => `calc(${p} * ${spacing})`)
|
|
31
|
-
.join(' ')};
|
|
55
|
+
padding-block-end: calc(${paddingConfig[2]} * ${spacing});
|
|
56
|
+
`}
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
${paddingConfig[3] !== undefined &&
|
|
59
|
+
css `
|
|
60
|
+
padding-inline-start: calc(${paddingConfig[3]} * ${spacing});
|
|
34
61
|
`}
|
|
35
62
|
|
|
36
63
|
${container.direction &&
|
|
@@ -115,7 +142,7 @@ const getItemStyles = (item) => {
|
|
|
115
142
|
`;
|
|
116
143
|
};
|
|
117
144
|
const breakpointOrder = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
118
|
-
export const StyledFlex = styled.div(({ container, item, theme: { base: { breakpoints: themeBreakpoints } }, xs, sm, md, lg, xl }) => {
|
|
145
|
+
export const StyledFlex = styled.div(({ container, item, theme: { base: { breakpoints: themeBreakpoints, spacing } }, xs, sm, md, lg, xl }) => {
|
|
119
146
|
const breakpoints = {
|
|
120
147
|
xs,
|
|
121
148
|
sm,
|
|
@@ -124,13 +151,13 @@ export const StyledFlex = styled.div(({ container, item, theme: { base: { breakp
|
|
|
124
151
|
xl
|
|
125
152
|
};
|
|
126
153
|
return css `
|
|
127
|
-
${getContainerStyles(container)}
|
|
154
|
+
${getContainerStyles(container, spacing)}
|
|
128
155
|
${getItemStyles(item)}
|
|
129
156
|
|
|
130
157
|
${breakpointOrder.map(breakpoint => breakpoints[breakpoint] &&
|
|
131
158
|
css `
|
|
132
159
|
@media screen and (min-width: ${themeBreakpoints[breakpoint]}) {
|
|
133
|
-
${getContainerStyles(breakpoints[breakpoint]?.container)}
|
|
160
|
+
${getContainerStyles(breakpoints[breakpoint]?.container, spacing)}
|
|
134
161
|
${getItemStyles(breakpoints[breakpoint]?.item)}
|
|
135
162
|
}
|
|
136
163
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAg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AAC;gBACxD,kBAAkB,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC;gBACtD,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;;WAEjD,CACJ;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp, RequireAtLeastOne } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [topRightBottomLeft: number]\n | [topBottom: number, rightLeft: number]\n | [top: number, rightLeft: number, bottom: number]\n | [top: number, right: number, bottom: number, left: number];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface BaseFlexProps {\n container?: FlexContainerProps | true;\n item?: FlexItemProps;\n}\n\ntype BreakpointFlexProps = RequireAtLeastOne<BaseFlexProps, 'container' | 'item'>;\n\nexport type FlexProps = RequireAtLeastOne<\n BaseFlexProps &\n BaseProps &\n AsProp & {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n /** Override props at extra small screen sizes and above. */\n xs?: BreakpointFlexProps;\n /** Override props at small screen sizes and above. */\n sm?: BreakpointFlexProps;\n /** Override props at medium screen sizes and above. */\n md?: BreakpointFlexProps;\n /** Override props at large screen sizes and above. */\n lg?: BreakpointFlexProps;\n /** Override props at extra large screen sizes and above. */\n xl?: BreakpointFlexProps;\n },\n 'container' | 'item' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n>;\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getContainerStyles = (container: FlexProps['container']) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${container.pad !== undefined &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) =>\n (Array.isArray(container.pad) ? container.pad : [container.pad])\n .map(p => `calc(${p} * ${spacing})`)\n .join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${container.gap !== undefined &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${container.colGap !== undefined &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${container.rowGap !== undefined &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nconst breakpointOrder = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const StyledFlex = styled.div<FlexProps>(\n ({\n container,\n item,\n theme: {\n base: { breakpoints: themeBreakpoints }\n },\n xs,\n sm,\n md,\n lg,\n xl\n }) => {\n const breakpoints = {\n xs,\n sm,\n md,\n lg,\n xl\n };\n\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n\n ${breakpointOrder.map(\n breakpoint =>\n breakpoints[breakpoint] &&\n css`\n @media screen and (min-width: ${themeBreakpoints[breakpoint]}) {\n ${getContainerStyles(breakpoints[breakpoint]?.container)}\n ${getItemStyles(breakpoints[breakpoint]?.item)}\n }\n `\n )}\n `;\n }\n);\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
|
|
1
|
+
{"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2F/C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,KAAK,EAAE,CAAC;IAC7E,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,Q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react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp, RequireAtLeastOne } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\ntype PaddingValue = number | undefined;\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [blockInline: PaddingValue]\n | [block: PaddingValue, inline: PaddingValue]\n | [blockStart: PaddingValue, inline: PaddingValue, blockEnd: PaddingValue]\n | [\n blockStart: PaddingValue,\n inlineEnd: PaddingValue,\n inlineStart: PaddingValue,\n blockEnd: PaddingValue\n ];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface BaseFlexProps {\n container?: FlexContainerProps | true;\n item?: FlexItemProps;\n}\n\ntype BreakpointFlexProps = RequireAtLeastOne<BaseFlexProps, 'container' | 'item'>;\n\nexport type FlexProps = RequireAtLeastOne<\n BaseFlexProps &\n BaseProps &\n AsProp & {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n /** Override props at extra small screen sizes and above. */\n xs?: BreakpointFlexProps;\n /** Override props at small screen sizes and above. */\n sm?: BreakpointFlexProps;\n /** Override props at medium screen sizes and above. */\n md?: BreakpointFlexProps;\n /** Override props at large screen sizes and above. */\n lg?: BreakpointFlexProps;\n /** Override props at extra large screen sizes and above. */\n xl?: BreakpointFlexProps;\n },\n 'container' | 'item' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n>;\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getLogicalPadding = (pad: FlexContainerProps['pad']) => {\n if (!Array.isArray(pad)) {\n return [pad, pad, pad, pad];\n }\n\n switch (pad.length) {\n case 1:\n return [pad[0], pad[0], pad[0], pad[0]];\n case 2:\n return [pad[0], pad[1], pad[0], pad[1]];\n case 3:\n return [pad[0], pad[1], pad[2], pad[1]];\n case 4:\n return pad;\n default:\n return [undefined, undefined, undefined, undefined];\n }\n};\n\nconst getContainerStyles = (container: FlexProps['container'], spacing: string) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n const paddingConfig = getLogicalPadding(container.pad);\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${paddingConfig[0] !== undefined &&\n css`\n padding-block-start: calc(${paddingConfig[0]} * ${spacing});\n `}\n ${paddingConfig[1] !== undefined &&\n css`\n padding-inline-end: calc(${paddingConfig[1]} * ${spacing});\n `}\n\n ${paddingConfig[2] !== undefined &&\n css`\n padding-block-end: calc(${paddingConfig[2]} * ${spacing});\n `}\n\n ${paddingConfig[3] !== undefined &&\n css`\n padding-inline-start: calc(${paddingConfig[3]} * ${spacing});\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${container.gap !== undefined &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${container.colGap !== undefined &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${container.rowGap !== undefined &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nconst breakpointOrder = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const StyledFlex = styled.div<FlexProps>(\n ({\n container,\n item,\n theme: {\n base: { breakpoints: themeBreakpoints, spacing }\n },\n xs,\n sm,\n md,\n lg,\n xl\n }) => {\n const breakpoints = {\n xs,\n sm,\n md,\n lg,\n xl\n };\n\n return css`\n ${getContainerStyles(container, spacing)}\n ${getItemStyles(item)}\n\n ${breakpointOrder.map(\n breakpoint =>\n breakpoints[breakpoint] &&\n css`\n @media screen and (min-width: ${themeBreakpoints[breakpoint]}) {\n ${getContainerStyles(breakpoints[breakpoint]?.container, spacing)}\n ${getItemStyles(breakpoints[breakpoint]?.item)}\n }\n `\n )}\n `;\n }\n);\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
|
|
@@ -3,7 +3,8 @@ import { Action, ForwardProps, OmitStrict, TestIdProp } from '../../types';
|
|
|
3
3
|
import { FlexProps } from '../Flex';
|
|
4
4
|
import { FormControlProps } from '../FormControl';
|
|
5
5
|
import { LabelProps } from '../Label';
|
|
6
|
-
|
|
6
|
+
import { elements } from './FormField.test-ids';
|
|
7
|
+
export interface FormFieldProps extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'>, TestIdProp<typeof elements> {
|
|
7
8
|
/** Pass a single form control component i.e. Input | TextArea | Select | etc.. */
|
|
8
9
|
children: ReactElement | ReactElement[];
|
|
9
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,SAAS,EACT,aAAa,EAEb,YAAY,EAMb,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAc,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,SAAS,EACT,aAAa,EAEb,YAAY,EAMb,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAc,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AAW1D,OAAO,EAAuB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIrE,MAAM,WAAW,cACf,SAAQ,UAAU,CAAC,gBAAgB,EAAE,aAAa,GAAG,OAAO,GAAG,cAAc,CAAC,EAC5E,UAAU,CAAC,OAAO,QAAQ,CAAC;IAC7B,kFAAkF;IAClF,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACxC;;;;;;;;OAQG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACjC;;;OAGG;IACH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,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,sBAC9B,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAClE,GAAG,EAAE,eAAe,aAEnB,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,QAAQ,EAC1C,OAAO,EACP,CAAC,aAAa,IAAI,UAAU,IAAI,QAAQ,EACxC,CAAC,QAAQ,IAAI,WAAW,IACpB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor, rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict, TestIdProp } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize, getHoverColors } from '../../styles';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { getFocusables, tryCatch } from '../../utils';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport AdditionalInfo from '../AdditionalInfo';\n\nimport { getFormFieldTestIds } from './FormField.test-ids';\n\nregisterIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'>,\n TestIdProp {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Property used to check whether input type is radio to handle styling for RadioCheck\n * @default false\n */\n isRadioCheck?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nconst StyledLabelRow = styled.div``;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel}, > ${StyledLabelRow} {\n margin-bottom: calc(0.25 * ${spacing});\n }\n\n > ${StyledLabel}, > ${StyledLabelRow} > ${StyledLabel} {\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst StyledSuggestionButton = styled(Button)(\n ({\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': baseRadius,\n spacing\n },\n components: {\n 'form-control': { 'border-radius': radius, 'border-width': borderWidth },\n 'form-field': formField\n }\n }\n }) => {\n const { xxs: buttonFontSize } = calculateFontSize(fontSize, fontScale);\n const backgroundColor = formField.pending['status-color'];\n const hoverColors = getHoverColors(backgroundColor);\n const color = tryCatch(() => readableColor(backgroundColor));\n const borderColor = color ? rgba(color, 0.4) : color;\n\n return css`\n background-color: ${backgroundColor};\n color: ${color};\n font-size: ${buttonFontSize};\n min-width: calc(3 * ${spacing});\n min-height: calc(3 * ${spacing});\n padding: 0 ${spacing};\n border-radius: 0;\n border: none;\n &:first-child {\n border-inline-end: ${borderWidth} solid ${borderColor};\n border-end-start-radius: calc(${baseRadius} * ${radius});\n margin-inline-start: calc(2 * ${spacing});\n }\n &:last-child {\n border-end-end-radius: calc(${baseRadius} * ${radius});\n margin-inline-start: 0;\n }\n &:hover {\n background-color: ${hoverColors.background};\n }\n\n @media (pointer: coarse) {\n min-height: 2rem;\n }\n `;\n }\n);\n\nStyledSuggestionButton.defaultProps = defaultThemeProp;\n\nconst StyledInfo = styled.span`\n display: contents;\n`;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'flag-wave-solid', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n testId,\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelFor = id,\n labelId,\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n isRadioCheck,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n additionalInfo,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getFormFieldTestIds);\n\n const t = useI18n();\n const labelAsLegend: boolean = labelAs === 'legend';\n const hasSuggestion = status === 'pending' && !!onResolveSuggestion;\n const consolidatedRef = useConsolidatedRef(ref);\n\n const showAdditionalInfo = !!additionalInfo && !disabled && !labelHidden;\n\n const labelAndInfo = (\n <>\n <Label\n data-testid={testIds.label}\n id={labelId}\n as={labelAs}\n htmlFor={labelAs === 'label' ? labelFor : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {label}\n </Label>\n {showAdditionalInfo && (\n <AdditionalInfo data-testid={testIds.additionalInfo} heading={additionalInfo.heading}>\n {additionalInfo.content}\n </AdditionalInfo>\n )}\n </>\n );\n\n const labelRow =\n showAdditionalInfo && !isRadioCheck ? (\n <Flex\n as={StyledLabelRow}\n container={{ justify: 'between', alignItems: 'end' }}\n item={{ alignSelf: 'stretch' }}\n >\n {labelAndInfo}\n </Flex>\n ) : (\n labelAndInfo\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <Flex\n data-testid={testIds.info}\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n as={StyledFormFieldInfo}\n container={{ alignItems: 'center' }}\n >\n {status && status !== 'pending' && typeof label === 'string' && (\n <VisuallyHiddenText aria-hidden>{label}</VisuallyHiddenText>\n )}\n <StyledInfo id={`${id}-info`}>\n {status && status !== 'pending' && (\n <>\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n <VisuallyHiddenText>{` ${t(status)} `}</VisuallyHiddenText>\n </>\n )}\n {liveRegionInfo}\n </StyledInfo>\n </Flex>\n );\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n if (hasSuggestion) {\n const focusables = getFocusables(consolidatedRef);\n infoContent = (\n <Flex container={{ alignItems: 'start', justify: 'between' }}>\n <StyledFormFieldInfo data-testid={testIds.info} status={status} id={`${id}-info`}>\n {t('suggestion_info')}\n <VisuallyHiddenText aria-live='polite'>{t('suggestion_assist')}</VisuallyHiddenText>\n </StyledFormFieldInfo>\n <Flex container={{ wrap: 'nowrap' }}>\n <StyledSuggestionButton\n data-testid={testIds.suggestionReject}\n onClick={() => {\n onResolveSuggestion(false);\n focusables[0]?.focus();\n }}\n aria-label={t('reject_suggestion_button_a11y')}\n >\n {t('no')}\n </StyledSuggestionButton>\n <StyledSuggestionButton\n data-testid={testIds.suggestionAccept}\n onClick={() => {\n onResolveSuggestion(true);\n focusables[0]?.focus();\n }}\n aria-label={t('accept_suggestion_button_a11y')}\n >\n {t('yes')}\n </StyledSuggestionButton>\n </Flex>\n </Flex>\n );\n }\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n const target = e.target as HTMLElement;\n if (!target.closest('button')) {\n e.preventDefault();\n onResolveSuggestion?.(true);\n }\n }\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n onKeyDown={hasSuggestion ? onKeyDown : undefined}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={consolidatedRef}\n >\n {(labelAsLegend || !labelAfter) && labelRow}\n {content}\n {!labelAsLegend && labelAfter && labelRow}\n {!readOnly && infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
|
|
1
|
+
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,YAAY,EAEZ,SAAS,EACT,QAAQ,EAER,UA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SAAS,EACb,SAAS,EAAE;YACT,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;YACpC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzC,GAAG,SAAS;SACb,EACD,EAAE,EAAE,eAAe,EACnB,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,sBAC9B,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAClE,GAAG,EAAE,eAAe,aAEnB,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,QAAQ,EAC1C,OAAO,EACP,CAAC,aAAa,IAAI,UAAU,IAAI,QAAQ,EACxC,CAAC,QAAQ,IAAI,WAAW,IACpB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor, rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict, TestIdProp } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useConsolidatedRef, useI18n, useTestIds, useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize, getHoverColors } from '../../styles';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { getFocusables, tryCatch } from '../../utils';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport AdditionalInfo from '../AdditionalInfo';\n\nimport { getFormFieldTestIds, elements } from './FormField.test-ids';\n\nregisterIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'>,\n TestIdProp<typeof elements> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Property used to check whether input type is radio to handle styling for RadioCheck\n * @default false\n */\n isRadioCheck?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nconst StyledLabelRow = styled.div``;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel}, > ${StyledLabelRow} {\n margin-bottom: calc(0.25 * ${spacing});\n }\n\n > ${StyledLabel}, > ${StyledLabelRow} > ${StyledLabel} {\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst StyledSuggestionButton = styled(Button)(\n ({\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': baseRadius,\n spacing\n },\n components: {\n 'form-control': { 'border-radius': radius, 'border-width': borderWidth },\n 'form-field': formField\n }\n }\n }) => {\n const { xxs: buttonFontSize } = calculateFontSize(fontSize, fontScale);\n const backgroundColor = formField.pending['status-color'];\n const hoverColors = getHoverColors(backgroundColor);\n const color = tryCatch(() => readableColor(backgroundColor));\n const borderColor = color ? rgba(color, 0.4) : color;\n\n return css`\n background-color: ${backgroundColor};\n color: ${color};\n font-size: ${buttonFontSize};\n min-width: calc(3 * ${spacing});\n min-height: calc(3 * ${spacing});\n padding: 0 ${spacing};\n border-radius: 0;\n border: none;\n &:first-child {\n border-inline-end: ${borderWidth} solid ${borderColor};\n border-end-start-radius: calc(${baseRadius} * ${radius});\n margin-inline-start: calc(2 * ${spacing});\n }\n &:last-child {\n border-end-end-radius: calc(${baseRadius} * ${radius});\n margin-inline-start: 0;\n }\n &:hover {\n background-color: ${hoverColors.background};\n }\n\n @media (pointer: coarse) {\n min-height: 2rem;\n }\n `;\n }\n);\n\nStyledSuggestionButton.defaultProps = defaultThemeProp;\n\nconst StyledInfo = styled.span`\n display: contents;\n`;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'flag-wave-solid', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n testId,\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelFor = id,\n labelId,\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n isRadioCheck,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n additionalInfo,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getFormFieldTestIds);\n\n const t = useI18n();\n const labelAsLegend: boolean = labelAs === 'legend';\n const hasSuggestion = status === 'pending' && !!onResolveSuggestion;\n const consolidatedRef = useConsolidatedRef(ref);\n\n const showAdditionalInfo = !!additionalInfo && !disabled && !labelHidden;\n\n const labelAndInfo = (\n <>\n <Label\n data-testid={testIds.label}\n id={labelId}\n as={labelAs}\n htmlFor={labelAs === 'label' ? labelFor : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {label}\n </Label>\n {showAdditionalInfo && (\n <AdditionalInfo data-testid={testIds.additionalInfo} heading={additionalInfo.heading}>\n {additionalInfo.content}\n </AdditionalInfo>\n )}\n </>\n );\n\n const labelRow =\n showAdditionalInfo && !isRadioCheck ? (\n <Flex\n as={StyledLabelRow}\n container={{ justify: 'between', alignItems: 'end' }}\n item={{ alignSelf: 'stretch' }}\n >\n {labelAndInfo}\n </Flex>\n ) : (\n labelAndInfo\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <Flex\n data-testid={testIds.info}\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n as={StyledFormFieldInfo}\n container={{ alignItems: 'center' }}\n >\n {status && status !== 'pending' && typeof label === 'string' && (\n <VisuallyHiddenText aria-hidden>{label}</VisuallyHiddenText>\n )}\n <StyledInfo id={`${id}-info`}>\n {status && status !== 'pending' && (\n <>\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n <VisuallyHiddenText>{` ${t(status)} `}</VisuallyHiddenText>\n </>\n )}\n {liveRegionInfo}\n </StyledInfo>\n </Flex>\n );\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n if (hasSuggestion) {\n const focusables = getFocusables(consolidatedRef);\n infoContent = (\n <Flex container={{ alignItems: 'start', justify: 'between' }}>\n <StyledFormFieldInfo data-testid={testIds.info} status={status} id={`${id}-info`}>\n {t('suggestion_info')}\n <VisuallyHiddenText aria-live='polite'>{t('suggestion_assist')}</VisuallyHiddenText>\n </StyledFormFieldInfo>\n <Flex container={{ wrap: 'nowrap' }}>\n <StyledSuggestionButton\n data-testid={testIds.suggestionReject}\n onClick={() => {\n onResolveSuggestion(false);\n focusables[0]?.focus();\n }}\n aria-label={t('reject_suggestion_button_a11y')}\n >\n {t('no')}\n </StyledSuggestionButton>\n <StyledSuggestionButton\n data-testid={testIds.suggestionAccept}\n onClick={() => {\n onResolveSuggestion(true);\n focusables[0]?.focus();\n }}\n aria-label={t('accept_suggestion_button_a11y')}\n >\n {t('yes')}\n </StyledSuggestionButton>\n </Flex>\n </Flex>\n );\n }\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n const target = e.target as HTMLElement;\n if (!target.closest('button')) {\n e.preventDefault();\n onResolveSuggestion?.(true);\n }\n }\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n onKeyDown={hasSuggestion ? onKeyDown : undefined}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={consolidatedRef}\n >\n {(labelAsLegend || !labelAfter) && labelRow}\n {content}\n {!labelAsLegend && labelAfter && labelRow}\n {!readOnly && infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const elements: readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"];
|
|
2
|
+
export declare const getFormFieldTestIds: (testIdProp?: string | undefined) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
2
3
|
//# sourceMappingURL=FormField.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FormField.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,yFAMX,CAAC;AAEX,eAAO,MAAM,mBAAmB,6JAAwC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createTestIds } from '../../utils';
|
|
2
|
-
export const
|
|
2
|
+
export const elements = [
|
|
3
3
|
'label',
|
|
4
4
|
'info',
|
|
5
5
|
'additional-info',
|
|
6
6
|
'suggestion-accept',
|
|
7
7
|
'suggestion-reject'
|
|
8
|
-
]
|
|
8
|
+
];
|
|
9
|
+
export const getFormFieldTestIds = createTestIds('form-field', elements);
|
|
9
10
|
//# sourceMappingURL=FormField.test-ids.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.test-ids.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"FormField.test-ids.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO;IACP,MAAM;IACN,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\n\nexport const elements = [\n 'label',\n 'info',\n 'additional-info',\n 'suggestion-accept',\n 'suggestion-reject'\n] as const;\n\nexport const getFormFieldTestIds = createTestIds('form-field', elements);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const iconNames: readonly ["1-1-solid", "1-1", "a11y", "ai-assist", "align-center", "align-item-center-solid", "align-item-center", "align-item-down-solid", "align-item-down", "align-item-left-solid", "align-item-left", "align-item-right-solid", "align-item-right", "align-item-up-solid", "align-item-up", "align-item-vert-center-solid", "align-item-vert-center", "align-left", "align-right", "amazon", "ambulance-solid", "ambulance", "analytics-bad-solid", "analytics-bad", "analytics-good-solid", "analytics-good", "analytics-neutral-solid", "analytics-neutral", "antenna", "app-solid", "app", "archery", "archive-solid", "archive", "arrow-above-or", "arrow-above-row-left", "arrow-above-row-right", "arrow-below-or", "arrow-below-row-left", "arrow-below-row-right", "arrow-bend-left", "arrow-bend-right", "arrow-between-column-down", "arrow-down-between-left-column", "arrow-down-between-right-column", "arrow-down-row", "arrow-down", "arrow-in", "arrow-left-column", "arrow-left-right", "arrow-left", "arrow-micro-down", "arrow-micro-left", "arrow-micro-right", "arrow-micro-up-down", "arrow-micro-up", "arrow-out", "arrow-right-between-rows", "arrow-right-column", "arrow-right", "arrow-up-down", "arrow-up-row", "arrow-up", "atom", "backspace-solid", "backspace", "badge-solid", "badge", "bank-solid", "bank", "bars", "battery-charge-solid", "battery-charge", "battery-solid", "battery", "bell-off-solid", "bell-off", "bell-solid", "bell", "blocks-solid", "blocks", "bluetooth", "bolt-solid", "bolt", "book-open-solid", "book-open", "book-solid", "book", "bookmark-solid", "bookmark", "bounding-box-solid", "bounding-box", "box-3-solid", "box-3", "box-4-solid", "box-4", "box-crosshair", "box-dashed-labeled-solid", "box-dashed-labeled", "box-grid", "box-lines-2-solid", "box-lines-2", "box", "browser-solid", "browser", "bug-solid", "bug", "building-2-solid", "building-2", "building-3-solid", "building-3", "building-solid", "building", "bulb-solid", "bulb", "calculator-solid", "calculator", "calendar-empty-solid", "calendar-empty", "calendar-plus-solid", "calendar-plus", "calendar-range", "calendar-solid", "calendar", "camera-solid", "camera", "cancel", "car-solid", "car", "card-stack-solid", "card-stack", "caret-2-left", "caret-2-right", "caret-down", "caret-left", "caret-right", "caret-up", "carrot", "cart-close-solid", "cart-close", "cart-solid", "cart", "case-medical-solid", "case-medical", "case-solid", "case", "chain-solid", "chain-up", "chain", "chat-help-solid", "chat-help", "chat-sentiment-solid", "chat-sentiment", "chat-solid", "chat-typing-solid", "chat-typing", "chat", "chats-solid", "chats", "check", "checkbook", "chevron-solid", "chevron", "church-solid", "church", "circle-mixed-down", "circle-mixed-left", "circle-mixed-up", "circle-solid", "circle-stacked-mixed", "circle-stacked-solid", "circle-stacked", "circle", "city-solid", "city", "clipboard-check-solid", "clipboard-check", "clipboard-data-solid", "clipboard-data", "clipboard-medical-solid", "clipboard-medical", "clipboard-plus-solid", "clipboard-plus", "clipboard-solid", "clipboard", "clock-solid", "clock", "cloud-down", "cloud-issue-solid", "cloud-issue", "cloud-solid", "cloud-up", "cloud", "cloudy-solid", "cloudy", "code", "column-delete", "column-insert", "column-no-left", "column-no-right", "column-top-fill", "columns-solid", "columns", "command", "compass-solid", "compass", "controller-solid", "controller", "copy-solid", "copy", "credit-solid", "credit", "crop", "crosshairs", "cuppa-solid", "cuppa", "dataviz-area-multi", "dataviz-area-stacked", "dataviz-area", "dataviz-bar-clustered", "dataviz-bar-stacked", "dataviz-bar", "dataviz-bubble", "dataviz-column-clustered", "dataviz-column-stacked", "dataviz-column", "dataviz-combo", "dataviz-datetime-field", "dataviz-donut", "dataviz-flip-counter", "dataviz-forecast", "dataviz-funnel-solid", "dataviz-funnel", "dataviz-gauge", "dataviz-geo-choropleth", "dataviz-line-multi", "dataviz-line", "dataviz-numeric-field", "dataviz-pareto", "dataviz-pie", "dataviz-pivot-table", "dataviz-radar", "dataviz-scatter", "dataviz-spark", "dataviz-string-field", "dataviz-table-with-bars", "dataviz-table-with-cross", "dataviz-waterfall", "desktop-solid", "desktop", "diamond-solid", "diamond", "disc-stack-solid", "disc-stack", "distribute-item-center-solid", "distribute-item-center", "distribute-item-vert-center-solid", "distribute-item-vert-center", "dna", "dock", "document-check-solid", "document-check", "document-compress-solid", "document-compress", "document-data-solid", "document-doc", "document-download-solid", "document-download", "document-minus-solid", "document-minus", "document-pdf", "document-plus-solid", "document-plus", "document-solid", "document-upload-solid", "document-upload", "document-xls", "document", "documents-check-solid", "documents-check", "documents-data-solid", "documents-data", "documents-solid", "documents", "docusign", "dollar-sign-solid", "dollar-sign", "dot-9-solid", "dot-9", "download", "drag", "drink-solid", "drink", "earth-solid", "earth", "edit-shape-solid", "edit-shape", "erase-solid", "erase", "eye-off-solid", "eye-off", "eye-solid", "eye", "face-blank-solid", "face-blank", "face-happy-solid", "face-happy", "face-sad-solid", "face-sad", "facebook", "farm-solid", "farm", "fast-forward-solid", "fast-forward", "filetype-text", "filter-on", "filter", "fire-solid", "fire", "flag-finish", "flag-solid", "flag-wave-solid", "flag-wave", "flag", "flashlight-solid", "flashlight", "folder-close-solid", "folder-close", "folder-closed-solid", "folder-closed", "folder-dollar-solid", "folder-dollar", "folder-hierarchy-solid", "folder-hierarchy", "folder-nested-solid", "folder-nested", "folder-plus-solid", "folder-plus", "folder-solid", "folder", "folders-solid", "folders", "forward-all-solid", "forward-all", "forward-solid", "forward", "freeze-column", "function", "galaxy", "gauge-solid", "gauge", "gear-solid", "gear", "glasses-solid", "glasses", "globe-solid", "globe", "google", "government-solid", "government", "grad-solid", "grad", "grid-solid", "grid", "hand-solid", "hand", "handshake-solid", "handshake", "hanger", "header", "headline-solid", "headline", "headphone-solid", "headphone", "headset", "heart-mixed", "heart-pulse-solid", "heart-pulse", "heart-solid", "heart", "help-solid", "help", "history-solid", "history", "home-alt-solid", "home-alt", "home-solid", "home", "inbox-data-solid", "inbox-data", "inbox-empty", "inbox-solid", "indent", "infinity", "information-solid", "information", "ink-solid", "ink", "inspect", "interact", "ios-face-id", "ios-finger-id", "key", "keyboard-solid", "keyboard", "knight-solid", "knight", "knobs-alt-solid", "knobs-alt", "knobs-solid", "knobs", "laptop-solid", "laptop", "layers-solid", "layers", "layout-solid", "layout", "leaf-solid", "leaf", "legal", "letter-solid", "letter", "life-ring-solid", "life-ring", "linkedin", "list-number", "list", "location-check-solid", "location-check", "location-solid", "location", "locations-solid", "locations", "lock-closed-solid", "lock-closed", "lock-open-solid", "lock-open", "magnet-solid", "magnet", "mail-check-solid", "mail-check", "mail-plus-solid", "mail-plus", "mail-solid", "mail", "mailbox-solid", "mailbox", "map-sigma-solid", "map-sigma", "map-solid", "map", "material-finger", "medal", "megaphone-solid", "megaphone", "mic-off-solid", "mic-off", "mic-solid", "mic", "minus", "mobile-phone-solid", "mobile-phone", "money-send-solid", "money-send", "money-solid", "money", "monkey-solid", "monkey", "moon-solid", "moon", "more-alt", "more", "move-left-solid", "move-right-solid", "move-up-solid", "moving", "multi-device-solid", "multi-device", "music-solid", "music", "navigation-solid", "navigation", "node-solid", "node", "nodes-down-solid", "nodes-down", "nodes-left-solid", "nodes-left", "nodes-right-solid", "nodes-right", "nodes-up-solid", "nodes-up", "notepad-empty-solid", "notepad-empty", "notepad-solid", "notepad", "notes-solid", "notes", "open", "opportunity-solid", "opportunity", "or-delete", "os-android", "os-apple", "os-windows", "paper-clip", "passbook-solid", "passbook", "pause-solid", "pause", "paypal", "peekpanel-arrow-left-solid", "peekpanel-arrow-left", "peekpanel-arrow-right-solid", "peekpanel-arrow-right", "pega", "pegasus", "pen-solid", "pen", "pencil-solid", "pencil", "person-solid", "person", "phone-call-solid", "phone-call", "phone-disabled-solid", "phone-disabled", "phone-hangup-solid", "phone-hangup", "phone-in-solid", "phone-in", "phone-list-solid", "phone-list", "phone-out-solid", "phone-out", "phone-pause-solid", "phone-pause", "phone-solid", "phone-split-solid", "phone-split", "phone", "picture-solid", "picture", "piggybank-solid", "piggybank", "pin-solid", "pin", "pipeline-solid", "pipeline", "placeholder", "plane-solid", "plane", "plant-solid", "plant", "play-solid", "play", "playbook-solid", "playbook", "plug-solid", "plug", "plus-between-left-column", "plus-between-right-column", "plus-line-above-below", "plus-line-above", "plus-line-below", "plus-line-left", "plus-line-right", "plus", "podium-solid", "podium", "polaris-solid", "polaris", "pong-solid", "pong", "potion-solid", "potion", "power", "print-solid", "print", "processor-solid", "processor", "progress-solid", "progress", "puzzle-solid", "puzzle", "qr", "quill", "rabbit", "radio-solid", "radio", "rain-solid", "rain", "receipt-solid", "receipt", "rectangle-solid", "rectangle", "reply-all-solid", "reply-all", "reply-solid", "reply", "reset", "retweet", "rewind-solid", "rewind", "robot-happy-solid", "robot-happy", "robot-sad-solid", "robot-sad", "robot-solid", "robot", "rocket-solid", "rocket", "roller-solid", "roller", "route-solid", "route", "row-delete", "row-insert", "row-left-fill", "row-right-fill", "row", "scale-down", "scale-up-solid", "scale-up", "school-solid", "school", "scissors", "script", "search-analytics-solid", "search-analytics", "search-case", "search-check", "search-close", "search-minus", "search-org", "search-plus", "search-solid", "search-table", "search", "send-solid", "send", "server-cloud-solid", "server-cloud", "server-solid", "server", "sextant", "share-point-up-solid", "share-point-up", "share-solid", "share", "shield-solid", "shield", "shoe-solid", "shoe", "shuffle", "sigma", "signpost-solid", "signpost", "slideshow-solid", "slideshow", "snail", "snow", "social-solid", "social", "speaker-mute-solid", "speaker-mute", "speaker-on-solid", "speaker-on", "speaker-solid", "speaker", "spellcheck", "square-solid", "square", "star-mixed", "star-solid", "star", "steps-solid", "steps", "stethoscope-solid", "stethoscope", "stoplight-solid", "stoplight", "stopwatch-solid", "stopwatch", "store-solid", "store", "sun-solid", "sun", "swipe-left-solid", "swipe-left", "swipe-right-solid", "swipe-right", "table", "tablet-solid", "tablet", "tag-check-solid", "tag-check", "tag-close-solid", "tag-close", "tag-solid", "tag", "target-solid", "target", "temp-solid", "temp", "thumbs-down-solid", "thumbs-down", "thumbs-up-solid", "thumbs-up", "times", "todo-solid", "todo", "tow-truck-solid", "tow-truck", "tracer-solid", "tracer", "transform", "trash-solid", "trash", "triangle-mixed-left", "triangle-mixed-right", "triangle-solid", "triangle", "tribox-solid", "tribox", "trophy-solid", "trophy", "truck-solid", "truck", "tv-solid", "tv", "twitter", "umbrella-solid", "umbrella", "undo", "undock", "unindent", "upload", "user-check-solid", "user-check", "user-close-solid", "user-close", "user-female-solid", "user-female", "user-list-solid", "user-list", "user-plus-solid", "user-plus", "user-question-mark-solid", "user-question-mark", "user-search-solid", "user-search", "user-solid", "user-star-solid", "user-star", "user", "users-solid", "users", "video-solid", "video", "voicemail", "vr-solid", "vr", "walkie-solid", "walkie", "wallet-solid", "wallet", "wand", "warn-solid", "warn", "watch-solid", "watch", "waypoint-solid", "waypoint", "webcam-solid", "webcam", "whatsapp", "wifi-none", "wifi-off", "wifi", "wizard-solid", "wizard", "wrench-solid", "wrench", "youtube"];
|
|
1
|
+
declare const iconNames: readonly ["1-1-solid", "1-1", "a11y", "ai-assist", "align-center", "align-item-center-solid", "align-item-center", "align-item-down-solid", "align-item-down", "align-item-left-solid", "align-item-left", "align-item-right-solid", "align-item-right", "align-item-up-solid", "align-item-up", "align-item-vert-center-solid", "align-item-vert-center", "align-left", "align-right", "amazon", "ambulance-solid", "ambulance", "analytics-bad-solid", "analytics-bad", "analytics-good-solid", "analytics-good", "analytics-neutral-solid", "analytics-neutral", "antenna", "app-solid", "app", "archery", "archive-solid", "archive", "arrow-above-or", "arrow-above-row-left", "arrow-above-row-right", "arrow-below-or", "arrow-below-row-left", "arrow-below-row-right", "arrow-bend-left", "arrow-bend-right", "arrow-between-column-down", "arrow-down-between-left-column", "arrow-down-between-right-column", "arrow-down-row", "arrow-down", "arrow-in", "arrow-left-column", "arrow-left-right", "arrow-left", "arrow-micro-down", "arrow-micro-left", "arrow-micro-right", "arrow-micro-up-down", "arrow-micro-up", "arrow-out", "arrow-right-between-rows", "arrow-right-column", "arrow-right", "arrow-up-down", "arrow-up-row", "arrow-up", "atom", "backspace-solid", "backspace", "badge-solid", "badge", "bank-solid", "bank", "bars", "battery-charge-solid", "battery-charge", "battery-solid", "battery", "bell-off-solid", "bell-off", "bell-solid", "bell", "blocks-solid", "blocks", "bluetooth", "bolt-solid", "bolt", "book-open-solid", "book-open", "book-solid", "book", "bookmark-solid", "bookmark", "bounding-box-solid", "bounding-box", "box-3-solid", "box-3", "box-4-solid", "box-4", "box-crosshair", "box-dashed-labeled-solid", "box-dashed-labeled", "box-grid", "box-lines-2-solid", "box-lines-2", "box", "browser-solid", "browser", "bug-solid", "bug", "building-2-solid", "building-2", "building-3-solid", "building-3", "building-solid", "building", "bulb-solid", "bulb", "calculator-solid", "calculator", "calendar-empty-solid", "calendar-empty", "calendar-plus-solid", "calendar-plus", "calendar-range", "calendar-solid", "calendar", "camera-solid", "camera", "cancel", "car-solid", "car", "card-stack-solid", "card-stack", "caret-2-left", "caret-2-right", "caret-down", "caret-left", "caret-right", "caret-up", "carrot", "cart-close-solid", "cart-close", "cart-solid", "cart", "case-medical-solid", "case-medical", "case-solid", "case", "chain-solid", "chain-up", "chain", "chat-help-solid", "chat-help", "chat-sentiment-solid", "chat-sentiment", "chat-solid", "chat-typing-solid", "chat-typing", "chat", "chats-solid", "chats", "check", "checkbook", "chevron-solid", "chevron", "church-solid", "church", "circle-mixed-down", "circle-mixed-left", "circle-mixed-up", "circle-solid", "circle-stacked-mixed", "circle-stacked-solid", "circle-stacked", "circle", "city-solid", "city", "clipboard-check-solid", "clipboard-check", "clipboard-data-solid", "clipboard-data", "clipboard-medical-solid", "clipboard-medical", "clipboard-plus-solid", "clipboard-plus", "clipboard-solid", "clipboard", "clock-solid", "clock", "cloud-down", "cloud-issue-solid", "cloud-issue", "cloud-solid", "cloud-up", "cloud", "cloudy-solid", "cloudy", "code", "column-delete", "column-insert", "column-no-left", "column-no-right", "column-top-fill", "columns-solid", "columns", "command", "compass-solid", "compass", "controller-solid", "controller", "copy-solid", "copy", "credit-solid", "credit", "crop", "crosshairs", "cuppa-solid", "cuppa", "dataviz-area-multi", "dataviz-area-stacked", "dataviz-area", "dataviz-bar-clustered", "dataviz-bar-stacked", "dataviz-bar", "dataviz-bubble", "dataviz-column-clustered", "dataviz-column-stacked", "dataviz-column", "dataviz-combo", "dataviz-datetime-field", "dataviz-donut", "dataviz-flip-counter", "dataviz-forecast", "dataviz-funnel-solid", "dataviz-funnel", "dataviz-gauge", "dataviz-geo-choropleth", "dataviz-line-multi", "dataviz-line", "dataviz-numeric-field", "dataviz-pareto", "dataviz-pie", "dataviz-pivot-table", "dataviz-radar", "dataviz-scatter", "dataviz-spark", "dataviz-string-field", "dataviz-table-with-bars", "dataviz-table-with-cross", "dataviz-waterfall", "desktop-solid", "desktop", "diamond-solid", "diamond", "disc-stack-solid", "disc-stack", "distribute-item-center-solid", "distribute-item-center", "distribute-item-vert-center-solid", "distribute-item-vert-center", "dna", "dock", "document-check-solid", "document-check", "document-compress-solid", "document-compress", "document-data-solid", "document-doc", "document-download-solid", "document-download", "document-minus-solid", "document-minus", "document-pdf", "document-plus-solid", "document-plus", "document-solid", "document-upload-solid", "document-upload", "document-xls", "document", "documents-check-solid", "documents-check", "documents-data-solid", "documents-data", "documents-solid", "documents", "docusign", "dollar-sign-solid", "dollar-sign", "dot-9-solid", "dot-9", "download", "drag", "drink-solid", "drink", "earth-solid", "earth", "edit-shape-solid", "edit-shape", "erase-solid", "erase", "eye-off-solid", "eye-off", "eye-solid", "eye", "face-blank-solid", "face-blank", "face-happy-solid", "face-happy", "face-sad-solid", "face-sad", "facebook", "farm-solid", "farm", "fast-forward-solid", "fast-forward", "filetype-text", "filter-on", "filter", "fire-solid", "fire", "flag-finish", "flag-solid", "flag-wave-solid", "flag-wave", "flag", "flashlight-solid", "flashlight", "folder-close-solid", "folder-close", "folder-closed-solid", "folder-closed", "folder-dollar-solid", "folder-dollar", "folder-hierarchy-solid", "folder-hierarchy", "folder-nested-solid", "folder-nested", "folder-plus-solid", "folder-plus", "folder-solid", "folder", "folders-solid", "folders", "forward-all-solid", "forward-all", "forward-solid", "forward", "freeze-column", "function", "galaxy", "gauge-solid", "gauge", "gear-solid", "gear", "glasses-solid", "glasses", "globe-solid", "globe", "google", "government-solid", "government", "grad-solid", "grad", "grid-solid", "grid", "hand-solid", "hand", "handshake-solid", "handshake", "hanger", "header", "headline-solid", "headline", "headphone-solid", "headphone", "headset", "heart-mixed", "heart-pulse-solid", "heart-pulse", "heart-solid", "heart", "help-solid", "help", "history-solid", "history", "home-alt-solid", "home-alt", "home-solid", "home", "inbox-data-solid", "inbox-data", "inbox-empty", "inbox-solid", "indent", "infinity", "information-solid", "information", "ink-solid", "ink", "inspect", "interact", "ios-face-id", "ios-finger-id", "key", "keyboard-solid", "keyboard", "knight-solid", "knight", "knobs-alt-solid", "knobs-alt", "knobs-solid", "knobs", "laptop-solid", "laptop", "layers-solid", "layers", "layout-solid", "layout", "leaf-solid", "leaf", "legal", "letter-solid", "letter", "life-ring-solid", "life-ring", "linkedin", "list-number", "list", "location-check-solid", "location-check", "location-solid", "location", "locations-solid", "locations", "lock-closed-solid", "lock-closed", "lock-open-solid", "lock-open", "magnet-solid", "magnet", "mail-check-solid", "mail-check", "mail-plus-solid", "mail-plus", "mail-solid", "mail", "mailbox-solid", "mailbox", "map-sigma-solid", "map-sigma", "map-solid", "map", "material-finger", "medal", "megaphone-solid", "megaphone", "mic-off-solid", "mic-off", "mic-solid", "mic", "minus", "mobile-phone-solid", "mobile-phone", "money-send-solid", "money-send", "money-solid", "money", "monkey-solid", "monkey", "moon-solid", "moon", "more-alt", "more", "move-left-solid", "move-right-solid", "move-up-solid", "moving", "multi-device-solid", "multi-device", "music-solid", "music", "navigation-solid", "navigation", "node-solid", "node", "nodes-down-solid", "nodes-down", "nodes-left-solid", "nodes-left", "nodes-right-solid", "nodes-right", "nodes-up-solid", "nodes-up", "notepad-empty-solid", "notepad-empty", "notepad-solid", "notepad", "notes-solid", "notes", "open", "opportunity-solid", "opportunity", "or-delete", "os-android", "os-apple", "os-windows", "paper-clip", "passbook-solid", "passbook", "pause-solid", "pause", "paypal", "peekpanel-arrow-left-solid", "peekpanel-arrow-left", "peekpanel-arrow-right-solid", "peekpanel-arrow-right", "pega", "pegasus", "pen-solid", "pen", "pencil-solid", "pencil", "person-solid", "person", "phone-call-solid", "phone-call", "phone-disabled-solid", "phone-disabled", "phone-hangup-solid", "phone-hangup", "phone-in-solid", "phone-in", "phone-list-solid", "phone-list", "phone-merge-solid", "phone-merge", "phone-out-solid", "phone-out", "phone-pause-solid", "phone-pause", "phone-solid", "phone-split-solid", "phone-split", "phone", "picture-solid", "picture", "piggybank-solid", "piggybank", "pin-solid", "pin", "pipeline-solid", "pipeline", "placeholder", "plane-solid", "plane", "plant-solid", "plant", "play-solid", "play", "playbook-solid", "playbook", "plug-solid", "plug", "plus-between-left-column", "plus-between-right-column", "plus-line-above-below", "plus-line-above", "plus-line-below", "plus-line-left", "plus-line-right", "plus", "podium-solid", "podium", "polaris-solid", "polaris", "pong-solid", "pong", "potion-solid", "potion", "power", "print-solid", "print", "processor-solid", "processor", "progress-solid", "progress", "puzzle-solid", "puzzle", "qr", "quill", "rabbit", "radio-solid", "radio", "rain-solid", "rain", "receipt-solid", "receipt", "rectangle-solid", "rectangle", "reply-all-solid", "reply-all", "reply-solid", "reply", "reset", "retweet", "rewind-solid", "rewind", "robot-happy-solid", "robot-happy", "robot-sad-solid", "robot-sad", "robot-solid", "robot", "rocket-solid", "rocket", "roller-solid", "roller", "route-solid", "route", "row-delete", "row-insert", "row-left-fill", "row-right-fill", "row", "scale-down", "scale-up-solid", "scale-up", "school-solid", "school", "scissors", "script", "search-analytics-solid", "search-analytics", "search-case", "search-check", "search-close", "search-minus", "search-org", "search-plus", "search-solid", "search-table", "search", "send-solid", "send", "server-cloud-solid", "server-cloud", "server-solid", "server", "sextant", "share-point-up-solid", "share-point-up", "share-solid", "share", "shield-solid", "shield", "shoe-solid", "shoe", "shuffle", "sigma", "signpost-solid", "signpost", "slideshow-solid", "slideshow", "snail", "snow", "social-solid", "social", "speaker-mute-solid", "speaker-mute", "speaker-on-solid", "speaker-on", "speaker-solid", "speaker", "spellcheck", "square-solid", "square", "star-mixed", "star-solid", "star", "steps-solid", "steps", "stethoscope-solid", "stethoscope", "stoplight-solid", "stoplight", "stopwatch-solid", "stopwatch", "store-solid", "store", "sun-solid", "sun", "swipe-left-solid", "swipe-left", "swipe-right-solid", "swipe-right", "table", "tablet-solid", "tablet", "tag-check-solid", "tag-check", "tag-close-solid", "tag-close", "tag-solid", "tag", "target-solid", "target", "temp-solid", "temp", "thumbs-down-solid", "thumbs-down", "thumbs-up-solid", "thumbs-up", "times", "todo-solid", "todo", "tow-truck-solid", "tow-truck", "tracer-solid", "tracer", "transform", "trash-solid", "trash", "triangle-mixed-left", "triangle-mixed-right", "triangle-solid", "triangle", "tribox-solid", "tribox", "trophy-solid", "trophy", "truck-solid", "truck", "tv-solid", "tv", "twitter", "umbrella-solid", "umbrella", "undo", "undock", "unindent", "upload", "user-check-solid", "user-check", "user-close-solid", "user-close", "user-female-solid", "user-female", "user-list-solid", "user-list", "user-plus-solid", "user-plus", "user-question-mark-solid", "user-question-mark", "user-search-solid", "user-search", "user-solid", "user-star-solid", "user-star", "user", "users-solid", "users", "video-solid", "video", "voicemail", "vr-solid", "vr", "walkie-solid", "walkie", "wallet-solid", "wallet", "wand", "warn-solid", "warn", "watch-solid", "watch", "waypoint-solid", "waypoint", "webcam-solid", "webcam", "whatsapp", "wifi-none", "wifi-off", "wifi", "wizard-solid", "wizard", "wrench-solid", "wrench", "youtube"];
|
|
2
2
|
export default iconNames;
|
|
3
|
-
export type IconName = typeof iconNames[number];
|
|
3
|
+
export type IconName = (typeof iconNames)[number];
|
|
4
4
|
//# sourceMappingURL=iconNames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/iconNames.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/iconNames.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,oyXAoxBL,CAAC;AAEX,eAAe,SAAS,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC"}
|