@pega/cosmos-react-core 3.0.0-dev.15.0 → 3.0.0-dev.17.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/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +4 -6
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.d.ts +16 -0
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppHeader.styles.js +155 -0
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -0
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +44 -157
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +7 -51
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +44 -535
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +16 -5
- 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 +2 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +2 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.js +3 -1
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts +19 -0
- package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppShellList.styles.js +141 -0
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -0
- package/lib/components/AppShell/AppShellSearch.d.ts +10 -0
- package/lib/components/AppShell/AppShellSearch.d.ts.map +1 -0
- package/lib/components/AppShell/AppShellSearch.js +32 -0
- package/lib/components/AppShell/AppShellSearch.js.map +1 -0
- package/lib/components/AppShell/AppShellSearch.styles.d.ts +8 -0
- package/lib/components/AppShell/AppShellSearch.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppShellSearch.styles.js +190 -0
- package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -0
- package/lib/components/AppShell/Drawer.js +2 -2
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Drawer.styles.d.ts +15 -0
- package/lib/components/AppShell/Drawer.styles.d.ts.map +1 -0
- package/lib/components/AppShell/Drawer.styles.js +153 -0
- package/lib/components/AppShell/Drawer.styles.js.map +1 -0
- package/lib/components/AppShell/NavigationList.d.ts +5 -0
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
- package/lib/components/AppShell/NavigationList.js +123 -0
- package/lib/components/AppShell/NavigationList.js.map +1 -0
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts +5 -0
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -0
- package/lib/components/AppShell/NavigationListItemWrapper.js +109 -0
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -0
- package/lib/components/AppShell/Operator.js +4 -4
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +2 -0
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +10 -3
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +11 -2
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts +3 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +2 -0
- package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +2 -2
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts +2 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +2 -2
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts +2 -0
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.js +4 -1
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +33 -6
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/utils.js +1 -1
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTime.types.d.ts +2 -0
- package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +13 -4
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +17 -4
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +1 -1
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +2 -2
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +10 -5
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts +30 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.js +148 -0
- package/lib/components/Dialog/Dialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/Dialog/index.js +3 -0
- package/lib/components/Dialog/index.js.map +1 -0
- package/lib/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +28 -26
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +6 -2
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js +60 -35
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +65 -5
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- 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/ai-assist.icon.js +1 -1
- package/lib/components/Icon/icons/ai-assist.icon.js.map +1 -1
- package/lib/components/Icon/icons/align-center.icon.js +1 -1
- package/lib/components/Icon/icons/align-center.icon.js.map +1 -1
- package/lib/components/Icon/icons/align-left.icon.js +1 -1
- package/lib/components/Icon/icons/align-left.icon.js.map +1 -1
- package/lib/components/Icon/icons/align-right.icon.js +1 -1
- package/lib/components/Icon/icons/align-right.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-left.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-left.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-micro-down.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-micro-down.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-micro-left.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-micro-left.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-micro-right.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-micro-right.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-micro-up-down.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-micro-up-down.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-micro-up.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-micro-up.icon.js.map +1 -1
- package/lib/components/Icon/icons/arrow-up-down.icon.js +1 -1
- package/lib/components/Icon/icons/arrow-up-down.icon.js.map +1 -1
- package/lib/components/Icon/icons/bars.icon.js +1 -1
- package/lib/components/Icon/icons/bars.icon.js.map +1 -1
- package/lib/components/Icon/icons/bell-solid.icon.js +1 -1
- package/lib/components/Icon/icons/bell-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/bell.icon.js +1 -1
- package/lib/components/Icon/icons/bell.icon.js.map +1 -1
- package/lib/components/Icon/icons/box-4-solid.icon.js +1 -1
- package/lib/components/Icon/icons/box-4-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/box-4.icon.js +1 -1
- package/lib/components/Icon/icons/box-4.icon.js.map +1 -1
- package/lib/components/Icon/icons/calendar-range.icon.js +1 -1
- package/lib/components/Icon/icons/calendar-range.icon.js.map +1 -1
- package/lib/components/Icon/icons/calendar-solid.icon.js +1 -1
- package/lib/components/Icon/icons/calendar-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/caret-down.icon.js +1 -1
- package/lib/components/Icon/icons/caret-down.icon.js.map +1 -1
- package/lib/components/Icon/icons/caret-left.icon.js +1 -1
- package/lib/components/Icon/icons/caret-left.icon.js.map +1 -1
- package/lib/components/Icon/icons/caret-right.icon.js +1 -1
- package/lib/components/Icon/icons/caret-right.icon.js.map +1 -1
- package/lib/components/Icon/icons/caret-up.icon.js +1 -1
- package/lib/components/Icon/icons/caret-up.icon.js.map +1 -1
- package/lib/components/Icon/icons/carrot.icon.d.ts +4 -0
- package/lib/components/Icon/icons/carrot.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/carrot.icon.js +6 -0
- package/lib/components/Icon/icons/carrot.icon.js.map +1 -0
- package/lib/components/Icon/icons/case-solid.icon.js +1 -1
- package/lib/components/Icon/icons/case-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/case.icon.js +1 -1
- package/lib/components/Icon/icons/case.icon.js.map +1 -1
- package/lib/components/Icon/icons/chain.icon.js +1 -1
- package/lib/components/Icon/icons/chain.icon.js.map +1 -1
- package/lib/components/Icon/icons/chat-solid.icon.js +1 -1
- package/lib/components/Icon/icons/chat-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/chat.icon.js +1 -1
- package/lib/components/Icon/icons/chat.icon.js.map +1 -1
- package/lib/components/Icon/icons/check.icon.js +1 -1
- package/lib/components/Icon/icons/check.icon.js.map +1 -1
- package/lib/components/Icon/icons/clipboard-plus-solid.icon.js +1 -1
- package/lib/components/Icon/icons/clipboard-plus-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/clipboard-plus.icon.js +1 -1
- package/lib/components/Icon/icons/clipboard-plus.icon.js.map +1 -1
- package/lib/components/Icon/icons/clock-solid.icon.js +1 -1
- package/lib/components/Icon/icons/clock-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/clock.icon.js +1 -1
- package/lib/components/Icon/icons/clock.icon.js.map +1 -1
- package/lib/components/Icon/icons/code.icon.js +1 -1
- package/lib/components/Icon/icons/code.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-string-field.icon.d.ts +1 -1
- package/lib/components/Icon/icons/dataviz-string-field.icon.js +2 -2
- package/lib/components/Icon/icons/dataviz-string-field.icon.js.map +1 -1
- package/lib/components/Icon/icons/dock.icon.js +1 -1
- package/lib/components/Icon/icons/dock.icon.js.map +1 -1
- package/lib/components/Icon/icons/dot-9-solid.icon.js +1 -1
- package/lib/components/Icon/icons/dot-9-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/dot-9.icon.js +1 -1
- package/lib/components/Icon/icons/dot-9.icon.js.map +1 -1
- package/lib/components/Icon/icons/download.icon.js +1 -1
- package/lib/components/Icon/icons/download.icon.js.map +1 -1
- package/lib/components/Icon/icons/drag.icon.js +1 -1
- package/lib/components/Icon/icons/drag.icon.js.map +1 -1
- package/lib/components/Icon/icons/eye-off-solid.icon.js +1 -1
- package/lib/components/Icon/icons/eye-off-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/eye-off.icon.js +1 -1
- package/lib/components/Icon/icons/eye-off.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-blank-solid.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-blank-solid.icon.js +1 -1
- package/lib/components/Icon/icons/face-blank-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-blank.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-blank.icon.js +1 -1
- package/lib/components/Icon/icons/face-blank.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-happy-solid.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-happy-solid.icon.js +1 -1
- package/lib/components/Icon/icons/face-happy-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-happy.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-happy.icon.js +1 -1
- package/lib/components/Icon/icons/face-happy.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-sad-solid.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-sad-solid.icon.js +1 -1
- package/lib/components/Icon/icons/face-sad-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/face-sad.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/face-sad.icon.js +1 -1
- package/lib/components/Icon/icons/face-sad.icon.js.map +1 -1
- package/lib/components/Icon/icons/fast-forward-solid.icon.js +1 -1
- package/lib/components/Icon/icons/fast-forward-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/filetype-text.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/filetype-text.icon.js +2 -2
- package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
- package/lib/components/Icon/icons/filter-on.icon.js +1 -1
- package/lib/components/Icon/icons/filter-on.icon.js.map +1 -1
- package/lib/components/Icon/icons/filter.icon.js +1 -1
- package/lib/components/Icon/icons/filter.icon.js.map +1 -1
- package/lib/components/Icon/icons/folder-hierarchy-solid.icon.js +1 -1
- package/lib/components/Icon/icons/folder-hierarchy-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/folder-hierarchy.icon.js +1 -1
- package/lib/components/Icon/icons/folder-hierarchy.icon.js.map +1 -1
- package/lib/components/Icon/icons/forward-all-solid.icon.js +1 -1
- package/lib/components/Icon/icons/forward-all-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/forward-all.icon.js +1 -1
- package/lib/components/Icon/icons/forward-all.icon.js.map +1 -1
- package/lib/components/Icon/icons/forward-solid.icon.js +1 -1
- package/lib/components/Icon/icons/forward-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/forward.icon.js +1 -1
- package/lib/components/Icon/icons/forward.icon.js.map +1 -1
- package/lib/components/Icon/icons/galaxy.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/galaxy.icon.js +2 -2
- package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
- package/lib/components/Icon/icons/globe-solid.icon.js +1 -1
- package/lib/components/Icon/icons/globe-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/globe.icon.js +1 -1
- package/lib/components/Icon/icons/globe.icon.js.map +1 -1
- package/lib/components/Icon/icons/hand.icon.js +1 -1
- package/lib/components/Icon/icons/hand.icon.js.map +1 -1
- package/lib/components/Icon/icons/help-solid.icon.js +1 -1
- package/lib/components/Icon/icons/help-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/help.icon.js +1 -1
- package/lib/components/Icon/icons/help.icon.js.map +1 -1
- package/lib/components/Icon/icons/home-solid.icon.js +1 -1
- package/lib/components/Icon/icons/home-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/home.icon.js +1 -1
- package/lib/components/Icon/icons/home.icon.js.map +1 -1
- package/lib/components/Icon/icons/information-solid.icon.js +1 -1
- package/lib/components/Icon/icons/information-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/information.icon.js +1 -1
- package/lib/components/Icon/icons/information.icon.js.map +1 -1
- package/lib/components/Icon/icons/list-number.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/list-number.icon.js +2 -2
- package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
- package/lib/components/Icon/icons/list.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/list.icon.js +2 -2
- package/lib/components/Icon/icons/list.icon.js.map +1 -1
- package/lib/components/Icon/icons/mail-solid.icon.js +1 -1
- package/lib/components/Icon/icons/mail-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/mail.icon.js +1 -1
- package/lib/components/Icon/icons/mail.icon.js.map +1 -1
- package/lib/components/Icon/icons/minus.icon.js +1 -1
- package/lib/components/Icon/icons/minus.icon.js.map +1 -1
- package/lib/components/Icon/icons/more.icon.js +1 -1
- package/lib/components/Icon/icons/more.icon.js.map +1 -1
- package/lib/components/Icon/icons/move-left-solid.icon.js +1 -1
- package/lib/components/Icon/icons/move-left-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/move-right-solid.icon.js +1 -1
- package/lib/components/Icon/icons/move-right-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/open.icon.js +1 -1
- package/lib/components/Icon/icons/open.icon.js.map +1 -1
- package/lib/components/Icon/icons/paper-clip.icon.js +1 -1
- package/lib/components/Icon/icons/paper-clip.icon.js.map +1 -1
- package/lib/components/Icon/icons/phone-solid.icon.js +1 -1
- package/lib/components/Icon/icons/phone-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/phone.icon.js +1 -1
- package/lib/components/Icon/icons/phone.icon.js.map +1 -1
- package/lib/components/Icon/icons/picture-solid.icon.js +1 -1
- package/lib/components/Icon/icons/picture-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/picture.icon.js +1 -1
- package/lib/components/Icon/icons/picture.icon.js.map +1 -1
- package/lib/components/Icon/icons/placeholder.icon.d.ts +4 -0
- package/lib/components/Icon/icons/placeholder.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/placeholder.icon.js +6 -0
- package/lib/components/Icon/icons/placeholder.icon.js.map +1 -0
- package/lib/components/Icon/icons/plus.icon.js +1 -1
- package/lib/components/Icon/icons/plus.icon.js.map +1 -1
- package/lib/components/Icon/icons/polaris-solid.icon.js +1 -1
- package/lib/components/Icon/icons/polaris-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/polaris.icon.js +1 -1
- package/lib/components/Icon/icons/polaris.icon.js.map +1 -1
- package/lib/components/Icon/icons/qr.icon.js +1 -1
- package/lib/components/Icon/icons/qr.icon.js.map +1 -1
- package/lib/components/Icon/icons/reply-all-solid.icon.js +1 -1
- package/lib/components/Icon/icons/reply-all-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/reply-all.icon.js +1 -1
- package/lib/components/Icon/icons/reply-all.icon.js.map +1 -1
- package/lib/components/Icon/icons/reply-solid.icon.js +1 -1
- package/lib/components/Icon/icons/reply-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/reply.icon.js +1 -1
- package/lib/components/Icon/icons/reply.icon.js.map +1 -1
- package/lib/components/Icon/icons/reset.icon.js +1 -1
- package/lib/components/Icon/icons/reset.icon.js.map +1 -1
- package/lib/components/Icon/icons/robot-happy-solid.icon.js +1 -1
- package/lib/components/Icon/icons/robot-happy-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/robot-happy.icon.js +1 -1
- package/lib/components/Icon/icons/robot-happy.icon.js.map +1 -1
- package/lib/components/Icon/icons/row-insert.icon.js +1 -1
- package/lib/components/Icon/icons/row-insert.icon.js.map +1 -1
- package/lib/components/Icon/icons/row.icon.js +1 -1
- package/lib/components/Icon/icons/row.icon.js.map +1 -1
- package/lib/components/Icon/icons/scale-down.icon.js +1 -1
- package/lib/components/Icon/icons/scale-down.icon.js.map +1 -1
- package/lib/components/Icon/icons/scale-up-solid.icon.js +1 -1
- package/lib/components/Icon/icons/scale-up-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/scale-up.icon.js +1 -1
- package/lib/components/Icon/icons/scale-up.icon.js.map +1 -1
- package/lib/components/Icon/icons/script.icon.d.ts +1 -1
- package/lib/components/Icon/icons/script.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/script.icon.js +3 -3
- package/lib/components/Icon/icons/script.icon.js.map +1 -1
- package/lib/components/Icon/icons/search-analytics-solid.icon.js +1 -1
- package/lib/components/Icon/icons/search-analytics-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/search-analytics.icon.js +1 -1
- package/lib/components/Icon/icons/search-analytics.icon.js.map +1 -1
- package/lib/components/Icon/icons/search.icon.js +1 -1
- package/lib/components/Icon/icons/search.icon.js.map +1 -1
- package/lib/components/Icon/icons/send-solid.icon.js +1 -1
- package/lib/components/Icon/icons/send-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/send.icon.js +1 -1
- package/lib/components/Icon/icons/send.icon.js.map +1 -1
- package/lib/components/Icon/icons/slideshow-solid.icon.js +1 -1
- package/lib/components/Icon/icons/slideshow-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/slideshow.icon.js +1 -1
- package/lib/components/Icon/icons/slideshow.icon.js.map +1 -1
- package/lib/components/Icon/icons/snow.icon.js +1 -1
- package/lib/components/Icon/icons/snow.icon.js.map +1 -1
- package/lib/components/Icon/icons/speaker-solid.icon.js +1 -1
- package/lib/components/Icon/icons/speaker-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/speaker.icon.js +1 -1
- package/lib/components/Icon/icons/speaker.icon.js.map +1 -1
- package/lib/components/Icon/icons/star-solid.icon.js +1 -1
- package/lib/components/Icon/icons/star-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/star.icon.js +1 -1
- package/lib/components/Icon/icons/star.icon.js.map +1 -1
- package/lib/components/Icon/icons/target-solid.icon.js +1 -1
- package/lib/components/Icon/icons/target-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/target.icon.js +1 -1
- package/lib/components/Icon/icons/target.icon.js.map +1 -1
- package/lib/components/Icon/icons/thumbs-up-solid.icon.js +1 -1
- package/lib/components/Icon/icons/thumbs-up-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/thumbs-up.icon.js +1 -1
- package/lib/components/Icon/icons/thumbs-up.icon.js.map +1 -1
- package/lib/components/Icon/icons/times.icon.js +1 -1
- package/lib/components/Icon/icons/times.icon.js.map +1 -1
- package/lib/components/Icon/icons/trash-solid.icon.js +1 -1
- package/lib/components/Icon/icons/trash-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/trash.icon.js +1 -1
- package/lib/components/Icon/icons/trash.icon.js.map +1 -1
- package/lib/components/Icon/icons/twitter.icon.js +1 -1
- package/lib/components/Icon/icons/twitter.icon.js.map +1 -1
- package/lib/components/Icon/icons/undock.icon.js +1 -1
- package/lib/components/Icon/icons/undock.icon.js.map +1 -1
- package/lib/components/Icon/icons/user-solid.icon.js +1 -1
- package/lib/components/Icon/icons/user-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/user-star-solid.icon.js +1 -1
- package/lib/components/Icon/icons/user-star-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/user-star.icon.js +1 -1
- package/lib/components/Icon/icons/user-star.icon.js.map +1 -1
- package/lib/components/Icon/icons/user.icon.js +1 -1
- package/lib/components/Icon/icons/user.icon.js.map +1 -1
- package/lib/components/Icon/icons/warn-solid.icon.js +1 -1
- package/lib/components/Icon/icons/warn-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/warn.icon.js +1 -1
- package/lib/components/Icon/icons/warn.icon.js.map +1 -1
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +13 -2
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +16 -10
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +8 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/MetaList/MetaList.d.ts.map +1 -1
- package/lib/components/MetaList/MetaList.js +13 -10
- package/lib/components/MetaList/MetaList.js.map +1 -1
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +25 -7
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +6 -2
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.styles.js +4 -2
- package/lib/components/Number/NumberInput.styles.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +2 -0
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/utils.d.ts.map +1 -1
- package/lib/components/Number/utils.js +1 -5
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +12 -3
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +5 -0
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +14 -4
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.d.ts +3 -0
- package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js +6 -0
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
- package/lib/components/Select/Select.d.ts +2 -0
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +4 -3
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +1 -7
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Text/Text.js +2 -2
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +4 -2
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +5 -0
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +22 -5
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +6 -3
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +16 -5
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useInputFormatter.d.ts.map +1 -1
- package/lib/hooks/useInputFormatter.js +5 -0
- package/lib/hooks/useInputFormatter.js.map +1 -1
- package/lib/i18n/default.d.ts +16 -5
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +18 -6
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +32 -10
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/theme/theme.d.ts +54 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +33 -1
- package/lib/theme/themeOverrides.schema.json +9 -0
- package/package.json +1 -1
|
@@ -9,43 +9,45 @@ import Icon, { StyledIcon, registerIcon } from '../Icon';
|
|
|
9
9
|
import * as caretRightIcon from '../Icon/icons/caret-right.icon';
|
|
10
10
|
import Actions from '../Actions';
|
|
11
11
|
import { defaultThemeProp } from '../../theme';
|
|
12
|
-
import { useI18n, useUID } from '../../hooks';
|
|
12
|
+
import { useDirection, useI18n, useUID } from '../../hooks';
|
|
13
13
|
import { calculateFontSize } from '../../styles';
|
|
14
14
|
registerIcon(caretRightIcon);
|
|
15
|
-
export const StyledFieldGroupLegend = styled.legend(({ open, theme: { base: { spacing, animation, 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger } } } }) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export const StyledFieldGroupLegend = styled.legend(({ open, theme: { base: { spacing, animation, 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger } } } }) => {
|
|
16
|
+
const { rtl } = useDirection();
|
|
17
|
+
return css `
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-bottom: 0;
|
|
20
|
+
${open &&
|
|
21
|
+
css `
|
|
22
|
+
margin-block-end: calc(1.5 * ${spacing});
|
|
23
|
+
`}
|
|
24
|
+
transition: margin-block-end ${animation.speed} ${animation.timing.ease};
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
button ${StyledIcon} {
|
|
27
|
+
transition: transform ${animation.speed} ${animation.timing.ease};
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
button[aria-expanded='true'] ${StyledIcon} {
|
|
31
|
+
transform: rotate(90deg);
|
|
32
|
+
}
|
|
33
|
+
button[aria-expanded='false'] ${StyledIcon} {
|
|
34
|
+
transform: rotate(${rtl ? 180 : 0}deg);
|
|
35
|
+
}
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
> ${StyledFlex} ${StyledButton} {
|
|
38
|
+
min-height: ${hitAreaMouse};
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
@media (pointer: 'coarse') {
|
|
41
|
+
min-height: ${hitAreaFinger};
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
`;
|
|
45
|
+
});
|
|
43
46
|
StyledFieldGroupLegend.defaultProps = defaultThemeProp;
|
|
44
|
-
export const StyledFieldGroup = styled.fieldset(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale
|
|
47
|
+
export const StyledFieldGroup = styled.fieldset(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale }, components: { text } } }) => {
|
|
45
48
|
const fontSizes = calculateFontSize(fontSize, fontScale);
|
|
46
49
|
return css `
|
|
47
50
|
border: none;
|
|
48
|
-
margin-block-start: calc(3 * ${spacing});
|
|
49
51
|
|
|
50
52
|
${StyledFieldGroupLegend} ${StyledButton} {
|
|
51
53
|
font-weight: inherit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAsD,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAA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AAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAC/D,WAAW,EAAC,MAAM,aAElB,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,yBAAO,IAAI,GAAQ,IACd,GACA,CACV,CAAC,CAAC,CAAC,CACF,yBAAO,IAAI,GAAQ,CACpB,GACgB,CACpB,EACA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,eAAe,GAAkB,CACrE,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button, { StyledButton } from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Flex, { StyledFlex } from '../Flex';\nimport HTML from '../HTML';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport Actions, { ActionsProps } from '../Actions';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useI18n, useUID } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nregisterIcon(caretRightIcon);\n\nexport interface FieldGroupProps extends BaseProps {\n /** The content of the Field Group. */\n children: ReactNode;\n /** A description of the field group to be displayed above the controls. */\n description?: string;\n /**\n * If true, the Field Group will be able to collapse the content of its children by clicking on the name.\n * @default false\n */\n collapsible?: boolean;\n /**\n * If true, the Field Group will be collapsed on the first render.\n * @default false\n */\n defaultCollapsed?: boolean;\n /** The name associated with the Field Group. */\n name?: string;\n /** An array of actions to add to the header. */\n actions?: ActionsProps['items'];\n /** A reference to the wrapping element. */\n ref?: Ref<HTMLFieldSetElement>;\n}\n\ninterface FieldGroupLegendProps {\n open: boolean;\n actions?: ActionsProps['items'];\n children?: ReactNode;\n}\n\nexport const StyledFieldGroupLegend = styled.legend<{ open: boolean }>(\n ({\n open,\n theme: {\n base: {\n spacing,\n animation,\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n }\n }\n }) => css`\n width: 100%;\n margin-bottom: 0;\n ${open &&\n css`\n margin-block-end: calc(1.5 * ${spacing});\n `}\n transition: margin-block-end ${animation.speed} ${animation.timing.ease};\n\n button ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n button[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n button[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n > ${StyledFlex} ${StyledButton} {\n min-height: ${hitAreaMouse};\n\n @media (pointer: 'coarse') {\n min-height: ${hitAreaFinger};\n }\n }\n `\n);\n\nStyledFieldGroupLegend.defaultProps = defaultThemeProp;\n\nexport const StyledFieldGroup = styled.fieldset(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { text }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n border: none;\n margin-block-start: calc(3 * ${spacing});\n\n ${StyledFieldGroupLegend} ${StyledButton} {\n font-weight: inherit;\n }\n\n & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n }\n\n & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n }\n\n & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n }\n\n & & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n }\n `;\n }\n);\n\nStyledFieldGroup.defaultProps = defaultThemeProp;\n\nconst FieldGroupLegend: FunctionComponent<FieldGroupLegendProps> = ({\n children,\n open,\n actions,\n ...restProps\n}) => {\n return (\n <StyledFieldGroupLegend open={open} {...restProps}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {children}\n {actions && <Actions items={actions} />}\n </Flex>\n </StyledFieldGroupLegend>\n );\n};\n\nconst FieldGroup: FunctionComponent<FieldGroupProps & ForwardProps> = forwardRef(\n (\n {\n children,\n description,\n name,\n actions,\n collapsible = false,\n defaultCollapsed = false,\n ...restProps\n }: PropsWithoutRef<FieldGroupProps>,\n ref: FieldGroupProps['ref']\n ) => {\n const [open, setOpen] = useState(!defaultCollapsed);\n const t = useI18n();\n const uid = useUID();\n\n const descAndChildren = (\n <Flex container={{ direction: 'column', gap: 3 }}>\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n <div>{children}</div>\n </Flex>\n );\n\n return (\n <StyledFieldGroup\n aria-label={name}\n aria-describedby={description ? `${uid}-description` : undefined}\n {...restProps}\n ref={ref}\n >\n {name && (\n <FieldGroupLegend open={open} actions={actions}>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex\n container={{ direction: 'row', alignItems: 'center', gap: 0.5 }}\n forwardedAs='span'\n >\n <Icon name='caret-right' />\n <span>{name}</span>\n </Flex>\n </Button>\n ) : (\n <span>{name}</span>\n )}\n </FieldGroupLegend>\n )}\n {collapsible ? (\n <ExpandCollapse collapsed={!open}>{descAndChildren}</ExpandCollapse>\n ) : (\n descAndChildren\n )}\n </StyledFieldGroup>\n );\n }\n);\n\nexport default FieldGroup;\n"]}
|
|
1
|
+
{"version":3,"file":"FieldGroup.js","sourceRoot":"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C,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAC/D,WAAW,EAAC,MAAM,aAElB,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,yBAAO,IAAI,GAAQ,IACd,GACA,CACV,CAAC,CAAC,CAAC,CACF,yBAAO,IAAI,GAAQ,CACpB,GACgB,CACpB,EACA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,eAAe,GAAkB,CACrE,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button, { StyledButton } from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Flex, { StyledFlex } from '../Flex';\nimport HTML from '../HTML';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport Actions, { ActionsProps } from '../Actions';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useDirection, useI18n, useUID } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nregisterIcon(caretRightIcon);\n\nexport interface FieldGroupProps extends BaseProps {\n /** The content of the Field Group. */\n children: ReactNode;\n /** A description of the field group to be displayed above the controls. */\n description?: string;\n /**\n * If true, the Field Group will be able to collapse the content of its children by clicking on the name.\n * @default false\n */\n collapsible?: boolean;\n /**\n * If true, the Field Group will be collapsed on the first render.\n * @default false\n */\n defaultCollapsed?: boolean;\n /** The name associated with the Field Group. */\n name?: string;\n /** An array of actions to add to the header. */\n actions?: ActionsProps['items'];\n /** A reference to the wrapping element. */\n ref?: Ref<HTMLFieldSetElement>;\n}\n\ninterface FieldGroupLegendProps {\n open: boolean;\n actions?: ActionsProps['items'];\n children?: ReactNode;\n}\n\nexport const StyledFieldGroupLegend = styled.legend<{ open: boolean }>(\n ({\n open,\n theme: {\n base: {\n spacing,\n animation,\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n }\n }\n }) => {\n const { rtl } = useDirection();\n return css`\n width: 100%;\n margin-bottom: 0;\n ${open &&\n css`\n margin-block-end: calc(1.5 * ${spacing});\n `}\n transition: margin-block-end ${animation.speed} ${animation.timing.ease};\n\n button ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n button[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n button[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(${rtl ? 180 : 0}deg);\n }\n\n > ${StyledFlex} ${StyledButton} {\n min-height: ${hitAreaMouse};\n\n @media (pointer: 'coarse') {\n min-height: ${hitAreaFinger};\n }\n }\n `;\n }\n);\n\nStyledFieldGroupLegend.defaultProps = defaultThemeProp;\n\nexport const StyledFieldGroup = styled.fieldset(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: { text }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n border: none;\n\n ${StyledFieldGroupLegend} ${StyledButton} {\n font-weight: inherit;\n }\n\n & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n }\n\n & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n }\n\n & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n }\n\n & & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n }\n `;\n }\n);\n\nStyledFieldGroup.defaultProps = defaultThemeProp;\n\nconst FieldGroupLegend: FunctionComponent<FieldGroupLegendProps> = ({\n children,\n open,\n actions,\n ...restProps\n}) => {\n return (\n <StyledFieldGroupLegend open={open} {...restProps}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {children}\n {actions && <Actions items={actions} />}\n </Flex>\n </StyledFieldGroupLegend>\n );\n};\n\nconst FieldGroup: FunctionComponent<FieldGroupProps & ForwardProps> = forwardRef(\n (\n {\n children,\n description,\n name,\n actions,\n collapsible = false,\n defaultCollapsed = false,\n ...restProps\n }: PropsWithoutRef<FieldGroupProps>,\n ref: FieldGroupProps['ref']\n ) => {\n const [open, setOpen] = useState(!defaultCollapsed);\n const t = useI18n();\n const uid = useUID();\n\n const descAndChildren = (\n <Flex container={{ direction: 'column', gap: 3 }}>\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n <div>{children}</div>\n </Flex>\n );\n\n return (\n <StyledFieldGroup\n aria-label={name}\n aria-describedby={description ? `${uid}-description` : undefined}\n {...restProps}\n ref={ref}\n >\n {name && (\n <FieldGroupLegend open={open} actions={actions}>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex\n container={{ direction: 'row', alignItems: 'center', gap: 0.5 }}\n forwardedAs='span'\n >\n <Icon name='caret-right' />\n <span>{name}</span>\n </Flex>\n </Button>\n ) : (\n <span>{name}</span>\n )}\n </FieldGroupLegend>\n )}\n {collapsible ? (\n <ExpandCollapse collapsed={!open}>{descAndChildren}</ExpandCollapse>\n ) : (\n descAndChildren\n )}\n </StyledFieldGroup>\n );\n }\n);\n\nexport default FieldGroup;\n"]}
|
|
@@ -7,7 +7,7 @@ export interface FormControlProps extends BaseProps {
|
|
|
7
7
|
*/
|
|
8
8
|
id?: string;
|
|
9
9
|
/** Set visual state based on a validation state. */
|
|
10
|
-
status?: 'success' | 'warning' | 'error';
|
|
10
|
+
status?: 'success' | 'warning' | 'error' | 'pending';
|
|
11
11
|
/** Pass a string or a fragment with an Icon and string. */
|
|
12
12
|
label?: ReactNode;
|
|
13
13
|
/** Visually hides the label region. */
|
|
@@ -33,8 +33,12 @@ export interface FormControlProps extends BaseProps {
|
|
|
33
33
|
readOnly?: boolean;
|
|
34
34
|
/** Sets html name attribute for the underlying control. Useful for mapping to a data field. */
|
|
35
35
|
name?: string;
|
|
36
|
+
/** Callback fired when AI suggestion is accepted/rejected */
|
|
37
|
+
onResolveSuggestion?: (accepted: boolean) => void;
|
|
36
38
|
}
|
|
37
|
-
export declare const StyledFormControl: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../types").OmitStrict<FormControlProps, never> & Required<Pick<FormControlProps, never
|
|
39
|
+
export declare const StyledFormControl: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../types").OmitStrict<FormControlProps, never> & Required<Pick<FormControlProps, never>> & {
|
|
40
|
+
hasSuggestion?: boolean | undefined;
|
|
41
|
+
}, never>;
|
|
38
42
|
declare const FormControl: FunctionComponent<FormControlProps & ForwardProps>;
|
|
39
43
|
export default FormControl;
|
|
40
44
|
//# sourceMappingURL=FormControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAIzE,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AAID,eAAO,MAAM,iBAAiB;;SA2G7B,CAAC;AAIF,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAInE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,53 +1,78 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
+
import { mix, rgba } from 'polished';
|
|
4
5
|
import { defaultThemeProp } from '../../theme';
|
|
5
6
|
import { calculateFontSize } from '../../styles';
|
|
6
|
-
export const StyledFormControl = styled.div(
|
|
7
|
-
const { theme: { base: { 'border-radius': baseRadius, 'font-size': baseFontSize, 'font-scale': baseFontScale }, components: { 'form-field': formField, 'form-control': { 'foreground-color': foreground, 'background-color': background, 'border-color': brd, 'border-radius': radius, 'border-width': borderWidth, ':hover': { 'border-color': hoverBorderColor }, ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow }, ':disabled': { 'border-color': disabledBorderColor, 'background-color': disabledBackgroundColor }, ':read-only': { 'border-color': readOnlyBorderColor, 'background-color': readOnlyBackgroundColor } } } }, status } = props;
|
|
7
|
+
export const StyledFormControl = styled.div(({ theme: { base: { 'border-radius': baseRadius, 'font-size': baseFontSize, 'font-scale': baseFontScale, animation: { speed, timing }, palette }, components: { 'form-field': formField, 'form-control': { 'foreground-color': foreground, 'background-color': background, 'border-color': brd, 'border-radius': radius, 'border-width': borderWidth, ':hover': { 'border-color': hoverBorderColor }, ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow }, ':disabled': { 'border-color': disabledBorderColor, 'background-color': disabledBackgroundColor }, ':read-only': { 'border-color': readOnlyBorderColor, 'background-color': readOnlyBackgroundColor } } } }, status, hasSuggestion }) => {
|
|
8
8
|
const fontSize = calculateFontSize(baseFontSize, baseFontScale);
|
|
9
9
|
const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;
|
|
10
|
+
const backgroundColor = hasSuggestion && status
|
|
11
|
+
? mix(0.1, formField[status]['status-color'], palette['primary-background'])
|
|
12
|
+
: background;
|
|
10
13
|
return css `
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
color: ${foreground};
|
|
15
|
+
background-color: ${backgroundColor};
|
|
16
|
+
border-radius: calc(${baseRadius} * ${radius});
|
|
17
|
+
border-color: ${borderColor};
|
|
18
|
+
border-width: ${borderWidth};
|
|
19
|
+
border-style: solid;
|
|
20
|
+
transition: all ${timing.ease} ${speed};
|
|
21
|
+
&,
|
|
22
|
+
& > select {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:disabled,
|
|
27
|
+
&[disabled] {
|
|
28
|
+
background-color: ${disabledBackgroundColor};
|
|
29
|
+
border-color: ${disabledBorderColor};
|
|
30
|
+
cursor: not-allowed;
|
|
31
|
+
}
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
&:focus:not([disabled]) {
|
|
34
|
+
border-color: ${focusBorderColor};
|
|
35
|
+
box-shadow: ${shadow};
|
|
36
|
+
${hasSuggestion &&
|
|
37
|
+
css `
|
|
38
|
+
background-color: ${background};
|
|
39
|
+
`}
|
|
40
|
+
}
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
&:focus-within:not([disabled]) {
|
|
43
|
+
${hasSuggestion &&
|
|
44
|
+
css `
|
|
45
|
+
background-color: ${background};
|
|
46
|
+
`}
|
|
47
|
+
}
|
|
33
48
|
|
|
34
|
-
|
|
49
|
+
&:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {
|
|
50
|
+
${!status &&
|
|
51
|
+
css `
|
|
52
|
+
border-color: ${hoverBorderColor};
|
|
53
|
+
`}
|
|
54
|
+
${hasSuggestion &&
|
|
35
55
|
css `
|
|
36
|
-
|
|
37
|
-
|
|
56
|
+
background-color: ${background};
|
|
57
|
+
box-shadow: 0 0 0 0.125rem ${rgba(borderColor, 0.2)};
|
|
58
|
+
`}
|
|
38
59
|
}
|
|
39
|
-
`}
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
${hasSuggestion &&
|
|
62
|
+
css `
|
|
63
|
+
border-end-end-radius: 0;
|
|
64
|
+
`}
|
|
65
|
+
|
|
66
|
+
&[readonly] {
|
|
67
|
+
background-color: ${readOnlyBackgroundColor};
|
|
68
|
+
border-color: ${readOnlyBorderColor};
|
|
69
|
+
}
|
|
45
70
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
@media (pointer: coarse) {
|
|
72
|
+
/* stylelint-disable-next-line unit-allowed-list */
|
|
73
|
+
font-size: max(${fontSize.s}, 16px);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
51
76
|
});
|
|
52
77
|
StyledFormControl.defaultProps = defaultThemeProp;
|
|
53
78
|
const FormControl = forwardRef((props, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAyCjD,MAAM,CAAC,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M,MAAM;sBAC5B,WAAW;sBACX,WAAW;;wBAET,MAAM,CAAC,IAAI,IAAI,KAAK;;;;;;;;4BAQhB,uBAAuB;wBAC3B,mBAAmB;;;;;wBAKnB,gBAAgB;sBAClB,MAAM;UAClB,aAAa;QACf,GAAG,CAAA;8BACmB,UAAU;SAC/B;;;;UAIC,aAAa;QACf,GAAG,CAAA;8BACmB,UAAU;SAC/B;;;;UAIC,CAAC,MAAM;QACT,GAAG,CAAA;0BACe,gBAAgB;SACjC;UACC,aAAa;QACf,GAAG,CAAA;8BACmB,UAAU;uCACD,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;SACpD;;;QAGD,aAAa;QACf,GAAG,CAAA;;OAEF;;;4BAGqB,uBAAuB;wBAC3B,mBAAmB;;;;;yBAKlB,QAAQ,CAAC,CAAC;;KAE9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,KAAwC,EAAE,GAAwB,EAAE,EAAE;IACrE,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACpD,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, rgba } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nexport interface FormControlProps extends BaseProps {\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?: string;\n /** Set visual state based on a validation state. */\n status?: 'success' | 'warning' | 'error' | 'pending';\n /** Pass a string or a fragment with an Icon and string. */\n label?: ReactNode;\n /** Visually hides the label region. */\n labelHidden?: boolean;\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: ReactNode;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: boolean;\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: string;\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: boolean;\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: string;\n /** Callback fired when AI suggestion is accepted/rejected */\n onResolveSuggestion?: (accepted: boolean) => void;\n}\n\ntype FormControlPropsWithDefaults = PropsWithDefaults<FormControlProps>;\n\nexport const StyledFormControl = styled.div<\n FormControlPropsWithDefaults & { hasSuggestion?: boolean }\n>(\n ({\n theme: {\n base: {\n 'border-radius': baseRadius,\n 'font-size': baseFontSize,\n 'font-scale': baseFontScale,\n animation: { speed, timing },\n palette\n },\n components: {\n 'form-field': formField,\n 'form-control': {\n 'foreground-color': foreground,\n 'background-color': background,\n 'border-color': brd,\n 'border-radius': radius,\n 'border-width': borderWidth,\n ':hover': { 'border-color': hoverBorderColor },\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow },\n ':disabled': {\n 'border-color': disabledBorderColor,\n 'background-color': disabledBackgroundColor\n },\n ':read-only': {\n 'border-color': readOnlyBorderColor,\n 'background-color': readOnlyBackgroundColor\n }\n }\n }\n },\n status,\n hasSuggestion\n }) => {\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;\n const backgroundColor =\n hasSuggestion && status\n ? mix(0.1, formField[status]['status-color'], palette['primary-background'])\n : background;\n\n return css`\n color: ${foreground};\n background-color: ${backgroundColor};\n border-radius: calc(${baseRadius} * ${radius});\n border-color: ${borderColor};\n border-width: ${borderWidth};\n border-style: solid;\n transition: all ${timing.ease} ${speed};\n &,\n & > select {\n outline: none;\n }\n\n &:disabled,\n &[disabled] {\n background-color: ${disabledBackgroundColor};\n border-color: ${disabledBorderColor};\n cursor: not-allowed;\n }\n\n &:focus:not([disabled]) {\n border-color: ${focusBorderColor};\n box-shadow: ${shadow};\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:focus-within:not([disabled]) {\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${!status &&\n css`\n border-color: ${hoverBorderColor};\n `}\n ${hasSuggestion &&\n css`\n background-color: ${background};\n box-shadow: 0 0 0 0.125rem ${rgba(borderColor, 0.2)};\n `}\n }\n\n ${hasSuggestion &&\n css`\n border-end-end-radius: 0;\n `}\n\n &[readonly] {\n background-color: ${readOnlyBackgroundColor};\n border-color: ${readOnlyBorderColor};\n }\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n font-size: max(${fontSize.s}, 16px);\n }\n `;\n }\n);\n\nStyledFormControl.defaultProps = defaultThemeProp;\n\nconst FormControl: FunctionComponent<FormControlProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormControlProps>, ref: Ref<HTMLDivElement>) => {\n return <StyledFormControl ref={ref} {...props} />;\n }\n);\n\nexport default FormControl;\n"]}
|
|
@@ -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;
|
|
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,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,EAAE,EAAE,CAAC,cAAc,GAAG,YAAY,CA0KhD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, useEffect, useState, forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
+
import { readableColor, rgba } from 'polished';
|
|
4
5
|
import { defaultThemeProp } from '../../theme';
|
|
5
6
|
import Flex from '../Flex';
|
|
6
7
|
import Actions from '../Actions';
|
|
7
|
-
import { useUID } from '../../hooks';
|
|
8
|
+
import { useConsolidatedRef, useI18n, useUID } from '../../hooks';
|
|
8
9
|
import Label, { StyledLabel } from '../Label';
|
|
9
|
-
import { calculateFontSize } from '../../styles';
|
|
10
|
+
import { calculateFontSize, getHoverColors } from '../../styles';
|
|
11
|
+
import VisuallyHiddenText from '../VisuallyHiddenText';
|
|
12
|
+
import { getFocusables, tryCatch } from '../../utils';
|
|
13
|
+
import Button from '../Button';
|
|
10
14
|
import Icon, { registerIcon } from '../Icon';
|
|
11
15
|
import * as warnSolidIcon from '../Icon/icons/warn-solid.icon';
|
|
12
16
|
import * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';
|
|
@@ -66,15 +70,52 @@ export const StyledFormField = styled.div(props => {
|
|
|
66
70
|
`;
|
|
67
71
|
});
|
|
68
72
|
StyledFormField.defaultProps = defaultThemeProp;
|
|
73
|
+
const StyledSuggestionButton = styled(Button)(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, 'border-radius': baseRadius, spacing }, components: { 'form-control': { 'border-radius': radius, 'border-width': borderWidth }, 'form-field': formField } } }) => {
|
|
74
|
+
const { xxs: buttonFontSize } = calculateFontSize(fontSize, fontScale);
|
|
75
|
+
const backgroundColor = formField.pending['status-color'];
|
|
76
|
+
const hoverColors = getHoverColors(backgroundColor);
|
|
77
|
+
const color = tryCatch(() => readableColor(backgroundColor));
|
|
78
|
+
const borderColor = color ? rgba(color, 0.4) : color;
|
|
79
|
+
return css `
|
|
80
|
+
background-color: ${backgroundColor};
|
|
81
|
+
color: ${color};
|
|
82
|
+
font-size: ${buttonFontSize};
|
|
83
|
+
min-width: calc(3 * ${spacing});
|
|
84
|
+
min-height: calc(3 * ${spacing});
|
|
85
|
+
padding: 0 ${spacing};
|
|
86
|
+
border-radius: 0;
|
|
87
|
+
border: none;
|
|
88
|
+
&:first-child {
|
|
89
|
+
border-inline-end: ${borderWidth} solid ${borderColor};
|
|
90
|
+
border-end-start-radius: calc(${baseRadius} * ${radius});
|
|
91
|
+
margin-inline-start: calc(2 * ${spacing});
|
|
92
|
+
}
|
|
93
|
+
&:last-child {
|
|
94
|
+
border-end-end-radius: calc(${baseRadius} * ${radius});
|
|
95
|
+
margin-inline-start: 0;
|
|
96
|
+
}
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: ${hoverColors.background};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (pointer: coarse) {
|
|
102
|
+
min-height: 2rem;
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
});
|
|
106
|
+
StyledSuggestionButton.defaultProps = defaultThemeProp;
|
|
69
107
|
const statusIconMap = { error: 'warn-solid', warning: 'flag-wave-solid', success: 'check' };
|
|
70
108
|
const FormField = forwardRef((props, ref) => {
|
|
71
109
|
const uid = useUID();
|
|
72
|
-
const { children: controlElement, id = uid, as = 'div', label, labelAs = 'label', labelFor = id, labelId, labelHidden = false, labelAfter = false, info, status, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = false, actions, container, ...restProps } = props;
|
|
110
|
+
const { children: controlElement, id = uid, as = 'div', label, labelAs = 'label', labelFor = id, labelId, labelHidden = false, labelAfter = false, info, status, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = false, actions, container, onResolveSuggestion, ...restProps } = props;
|
|
111
|
+
const t = useI18n();
|
|
73
112
|
const labelAsLegend = labelAs === 'legend';
|
|
113
|
+
const hasSuggestion = status === 'pending' && !!onResolveSuggestion;
|
|
114
|
+
const consolidatedRef = useConsolidatedRef(ref);
|
|
74
115
|
const styledLabel = (_jsxs(Label, { id: labelId, as: labelAs, htmlFor: labelAs === 'label' ? labelFor : undefined, labelHidden: labelHidden, onClick: (e) => {
|
|
75
116
|
if (readOnly)
|
|
76
117
|
e.preventDefault();
|
|
77
|
-
}, inline: inline, children: [status && !labelHidden && (_jsx(StyledStatusIcon, { status: status, name: statusIconMap[status] })), label] }));
|
|
118
|
+
}, inline: inline, children: [status && status !== 'pending' && !labelHidden && (_jsx(StyledStatusIcon, { status: status, name: statusIconMap[status] })), label] }));
|
|
78
119
|
/*
|
|
79
120
|
We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.
|
|
80
121
|
This is to ensure screen readers will announce info on errors when role is set to alert.
|
|
@@ -107,11 +148,30 @@ const FormField = forwardRef((props, ref) => {
|
|
|
107
148
|
if (charLimitDisplay) {
|
|
108
149
|
infoContent = (_jsxs(Flex, { container: { justify: infoContent ? 'between' : 'end', gap: 1 }, children: [infoContent, _jsx(Flex, { item: { shrink: 0 }, children: charLimitDisplay })] }));
|
|
109
150
|
}
|
|
151
|
+
if (hasSuggestion) {
|
|
152
|
+
const focusables = getFocusables(consolidatedRef);
|
|
153
|
+
infoContent = (_jsxs(Flex, { container: { alignItems: 'start', justify: 'between' }, children: [_jsxs(StyledFormFieldInfo, { status: status, id: `${id}-info`, children: [t('suggestion_info'), _jsx(VisuallyHiddenText, { "aria-live": 'polite', children: t('suggestion_assist') })] }), _jsxs(Flex, { container: { wrap: 'nowrap' }, children: [_jsx(StyledSuggestionButton, { onClick: () => {
|
|
154
|
+
onResolveSuggestion(false);
|
|
155
|
+
focusables[0]?.focus();
|
|
156
|
+
}, "aria-label": t('reject_suggestion_button_a11y'), children: t('no') }), _jsx(StyledSuggestionButton, { onClick: () => {
|
|
157
|
+
onResolveSuggestion(true);
|
|
158
|
+
focusables[0]?.focus();
|
|
159
|
+
}, "aria-label": t('accept_suggestion_button_a11y'), children: t('yes') })] })] }));
|
|
160
|
+
}
|
|
161
|
+
const onKeyDown = (e) => {
|
|
162
|
+
if (e.key === 'Enter') {
|
|
163
|
+
const target = e.target;
|
|
164
|
+
if (!target.closest('button')) {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
onResolveSuggestion?.(true);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
110
170
|
return (_jsxs(Flex, { ...restProps, container: {
|
|
111
171
|
direction: inline ? 'row' : 'column',
|
|
112
172
|
alignItems: inline ? 'center' : undefined,
|
|
113
173
|
...container
|
|
114
|
-
}, as: StyledFormField, id: `${id}-field`, forwardedAs: as, required: required, disabled: disabled, readOnly: readOnly, "aria-describedby": labelAsLegend && info ? `${id}-info` : undefined, ref:
|
|
174
|
+
}, as: StyledFormField, id: `${id}-field`, forwardedAs: as, required: required, disabled: disabled, readOnly: readOnly, onKeyDown: hasSuggestion ? onKeyDown : undefined, "aria-describedby": labelAsLegend && info ? `${id}-info` : undefined, ref: consolidatedRef, children: [(labelAsLegend || !labelAfter) && styledLabel, content, !labelAsLegend && labelAfter && styledLabel, infoContent] }));
|
|
115
175
|
});
|
|
116
176
|
export default FormField;
|
|
117
177
|
//# sourceMappingURL=FormField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,YAAY,EAEZ,SAAS,EACT,QAAQ,EAER,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC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C","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';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize } from '../../styles';\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';\n\nregisterIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\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 * 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\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} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\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 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 charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n ...restProps\n } = props;\n\n const labelAsLegend: boolean = labelAs === 'legend';\n\n const styledLabel = (\n <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 {status && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\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 = info ? (\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 <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\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 return (\n <Flex\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 aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={ref}\n >\n {(labelAsLegend || !labelAfter) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {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,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,EAAc,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,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P,CAAC,aAAa,IAAI,UAAU,IAAI,WAAW,EAC3C,WAAW,IACP,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 } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useConsolidatedRef, useI18n, 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';\n\nregisterIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\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 * 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\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} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\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 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 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 charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n onResolveSuggestion,\n ...restProps\n } = props;\n const t = useI18n();\n const labelAsLegend: boolean = labelAs === 'legend';\n const hasSuggestion = status === 'pending' && !!onResolveSuggestion;\n const consolidatedRef = useConsolidatedRef(ref);\n\n const styledLabel = (\n <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 {status && status !== 'pending' && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\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 = info ? (\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 <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\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 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 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 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 {...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) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
|