@pega/cosmos-react-core 3.0.0-dev.9.1 → 3.0.0-rc.10
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/Actions/Actions.d.ts +5 -0
- package/lib/components/Actions/Actions.d.ts.map +1 -1
- package/lib/components/Actions/Actions.js +2 -2
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +11 -0
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -0
- package/lib/components/AdditionalInfo/AdditionalInfo.js +25 -0
- package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -0
- package/lib/components/AdditionalInfo/index.d.ts +2 -0
- package/lib/components/AdditionalInfo/index.d.ts.map +1 -0
- package/lib/components/AdditionalInfo/index.js +2 -0
- package/lib/components/AdditionalInfo/index.js.map +1 -0
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +17 -8
- 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 +92 -220
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +7 -48
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +54 -527
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +29 -80
- 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 +12 -6
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +10 -5
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts +2 -2
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js +16 -2
- 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 +9 -0
- package/lib/components/AppShell/AppShellSearch.d.ts.map +1 -0
- package/lib/components/AppShell/AppShellSearch.js +39 -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 +193 -0
- package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -0
- package/lib/components/AppShell/Drawer.d.ts +3 -1
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +14 -11
- 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 +6 -0
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
- package/lib/components/AppShell/NavigationList.js +121 -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 +160 -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/AppShell/index.d.ts +2 -3
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js +1 -2
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +4 -4
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Badges/Count.d.ts.map +1 -1
- package/lib/components/Badges/Count.js +37 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Badges/Keyboard.d.ts +2 -2
- package/lib/components/Badges/Keyboard.d.ts.map +1 -1
- package/lib/components/Badges/Keyboard.js +6 -1
- package/lib/components/Badges/Keyboard.js.map +1 -1
- package/lib/components/Badges/Selection.d.ts +1 -1
- package/lib/components/Badges/Selection.d.ts.map +1 -1
- package/lib/components/Badges/Selection.js +42 -42
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Tag.d.ts +9 -3
- package/lib/components/Badges/Tag.d.ts.map +1 -1
- package/lib/components/Badges/Tag.js +3 -2
- package/lib/components/Badges/Tag.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +19 -16
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +4 -12
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +44 -13
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/BareButton.d.ts.map +1 -1
- package/lib/components/Button/BareButton.js +1 -0
- package/lib/components/Button/BareButton.js.map +1 -1
- package/lib/components/Button/BareRoleButton.d.ts.map +1 -1
- package/lib/components/Button/BareRoleButton.js +3 -1
- package/lib/components/Button/BareRoleButton.js.map +1 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +3 -1
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.d.ts +3 -1
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +2 -0
- package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +2 -4
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +70 -13
- 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.styles.js +4 -1
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +11 -1
- 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/ComboBoxInput.d.ts +7 -0
- package/lib/components/ComboBox/ComboBoxInput.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBoxInput.js +5 -2
- package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +130 -36
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.types.d.ts +10 -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 +3 -3
- 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 +5 -0
- package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.js +62 -0
- package/lib/components/CompositeInput/CompositeInput.js.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.styles.d.ts +5 -0
- package/lib/components/CompositeInput/CompositeInput.styles.d.ts.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.styles.js +57 -0
- package/lib/components/CompositeInput/CompositeInput.styles.js.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.types.d.ts +52 -0
- package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -0
- package/lib/components/CompositeInput/CompositeInput.types.js +2 -0
- package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -0
- package/lib/components/CompositeInput/index.d.ts +3 -0
- package/lib/components/CompositeInput/index.d.ts.map +1 -0
- package/lib/components/CompositeInput/index.js +2 -0
- package/lib/components/CompositeInput/index.js.map +1 -0
- package/lib/components/Configuration/Configuration.d.ts +16 -13
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +42 -14
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Configuration/index.d.ts +0 -1
- package/lib/components/Configuration/index.d.ts.map +1 -1
- package/lib/components/Configuration/index.js +0 -1
- package/lib/components/Configuration/index.js.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.d.ts +2 -0
- package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.js.map +1 -1
- package/lib/components/CreditCard/CreditCardInput.js +1 -1
- package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +2 -2
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +92 -26
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +9 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/Currency/utils.d.ts +7 -17
- package/lib/components/Currency/utils.d.ts.map +1 -1
- package/lib/components/Currency/utils.js +50 -51
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTime.types.d.ts +15 -9
- 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/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +8 -1
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +3 -3
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts +9 -2
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +29 -17
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +18 -23
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +98 -83
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +3 -0
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +30 -14
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.js +10 -2
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.types.d.ts +2 -0
- package/lib/components/DateTime/Input/Duration/DurationInput.types.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/DurationInput.types.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +30 -33
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/Time.js +5 -4
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts +3 -0
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +30 -26
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts +1 -0
- package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +10 -7
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +3 -0
- package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.js +31 -25
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts +3 -0
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +21 -9
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +46 -0
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -0
- package/lib/components/DateTime/Input/TimeRangeInput.js +74 -0
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -0
- package/lib/components/DateTime/Input/WeekInput.d.ts +3 -2
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +12 -7
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.d.ts +1 -1
- package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +7 -7
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +19 -6
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +20 -16
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -4
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +13 -55
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +2 -1
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts +3 -0
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -0
- package/lib/components/DateTime/Picker/DatePicker.styles.js +39 -0
- package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -0
- package/lib/components/DateTime/Picker/DateRangePicker.js +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts +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/DateTime/Picker/Weeks.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +14 -6
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
- package/lib/components/DateTime/index.d.ts +4 -0
- package/lib/components/DateTime/index.d.ts.map +1 -1
- package/lib/components/DateTime/index.js +3 -0
- package/lib/components/DateTime/index.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts +5 -4
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +21 -8
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts +32 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.js +150 -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/EmojiPicker/EmojiPicker.styles.d.ts.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.styles.js +8 -6
- package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +7 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +46 -42
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +8 -8
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +13 -7
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +53 -19
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/FieldValueList/index.d.ts +3 -5
- package/lib/components/FieldValueList/index.d.ts.map +1 -1
- package/lib/components/FieldValueList/index.js +2 -4
- package/lib/components/FieldValueList/index.js.map +1 -1
- package/lib/components/File/FileItem.d.ts +3 -0
- package/lib/components/File/FileItem.d.ts.map +1 -1
- package/lib/components/File/FileItem.js +18 -14
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/utils.d.ts +1 -1
- package/lib/components/File/utils.d.ts.map +1 -1
- package/lib/components/File/utils.js.map +1 -1
- package/lib/components/Flex/Flex.d.ts +11 -10
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.d.ts +5 -16
- package/lib/components/Form/Form.d.ts.map +1 -1
- package/lib/components/Form/Form.js +14 -11
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +12 -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 +5 -0
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +87 -16
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.d.ts +1 -1
- package/lib/components/Grid/Grid.d.ts.map +1 -1
- package/lib/components/Grid/Grid.types.d.ts +11 -10
- package/lib/components/Grid/Grid.types.d.ts.map +1 -1
- package/lib/components/Grid/Grid.types.js.map +1 -1
- package/lib/components/HTML/HTML.d.ts +1 -0
- package/lib/components/HTML/HTML.d.ts.map +1 -1
- package/lib/components/HTML/HTML.js +63 -17
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/components/Icon/Icon.d.ts +7 -7
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.js +14 -15
- package/lib/components/Icon/Icon.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 -1
- 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/{script-solid.icon.d.ts → carrot.icon.d.ts} +2 -2
- 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.js +1 -1
- 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/Icon/index.d.ts +1 -1
- package/lib/components/Icon/index.d.ts.map +1 -1
- package/lib/components/Icon/index.js.map +1 -1
- package/lib/components/Input/Input.d.ts +3 -1
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +16 -2
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.styles.d.ts +1 -0
- package/lib/components/Input/Input.styles.d.ts.map +1 -1
- package/lib/components/Input/Input.styles.js +31 -0
- package/lib/components/Input/Input.styles.js.map +1 -1
- package/lib/components/Link/Link.d.ts +4 -1
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js +87 -30
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
- package/lib/components/List/CommaSeparatedList.js +6 -14
- package/lib/components/List/CommaSeparatedList.js.map +1 -1
- package/lib/components/List/List.d.ts +2 -2
- 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.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +108 -53
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +1 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +38 -2
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +28 -10
- 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/PresetMenuPopover.d.ts +12 -0
- package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -0
- package/lib/components/ListToolbar/PresetMenuPopover.js +36 -0
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -0
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +1 -1
- package/lib/components/ListToolbar/QueryOptionPopover.js +14 -44
- package/lib/components/ListToolbar/QueryOptionPopover.js.map +1 -1
- package/lib/components/Location/LocationInput.d.ts +3 -1
- package/lib/components/Location/LocationInput.d.ts.map +1 -1
- package/lib/components/Location/LocationInput.js +2 -2
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.d.ts +1 -1
- package/lib/components/Location/LocationView.d.ts.map +1 -1
- package/lib/components/Location/LocationView.js +16 -10
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/utils.d.ts +3 -2
- package/lib/components/Location/utils.d.ts.map +1 -1
- package/lib/components/Location/utils.js +17 -9
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +11 -7
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.context.d.ts.map +1 -1
- package/lib/components/Menu/Menu.context.js +2 -1
- package/lib/components/Menu/Menu.context.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +42 -15
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +4 -2
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +14 -0
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/MenuGroup.d.ts.map +1 -1
- package/lib/components/Menu/MenuGroup.js +3 -3
- package/lib/components/Menu/MenuGroup.js.map +1 -1
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +4 -8
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +23 -14
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts +2 -2
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +12 -7
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +9 -7
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +16 -13
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/Menu/index.d.ts +1 -1
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -1
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +13 -11
- package/lib/components/MenuButton/MenuButton.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/Modal/Contexts.d.ts.map +1 -1
- package/lib/components/Modal/Contexts.js +2 -3
- package/lib/components/Modal/Contexts.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +2 -5
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +7 -9
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.types.d.ts +2 -6
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js +1 -2
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Modal/ModalManager.d.ts +8 -2
- package/lib/components/Modal/ModalManager.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js +21 -20
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/Modal/index.d.ts +0 -1
- package/lib/components/Modal/index.d.ts.map +1 -1
- package/lib/components/Modal/index.js +0 -1
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.d.ts +10 -0
- package/lib/components/MultiStepForm/FormProgress.d.ts.map +1 -0
- package/lib/components/{MultiStep/MultiStep.js → MultiStepForm/FormProgress.js} +8 -22
- package/lib/components/MultiStepForm/FormProgress.js.map +1 -0
- package/lib/components/{MultiStep/MultiStep.styles.d.ts → MultiStepForm/FormProgress.styles.d.ts} +2 -4
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -0
- package/lib/components/{MultiStep/MultiStep.styles.js → MultiStepForm/FormProgress.styles.js} +4 -8
- package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -0
- package/lib/components/MultiStepForm/MultiStepForm.d.ts +9 -0
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -0
- package/lib/components/MultiStepForm/MultiStepForm.js +50 -0
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +48 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.js +2 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -0
- package/lib/components/MultiStepForm/index.d.ts +2 -0
- package/lib/components/MultiStepForm/index.d.ts.map +1 -0
- package/lib/components/MultiStepForm/index.js +2 -0
- package/lib/components/MultiStepForm/index.js.map +1 -0
- package/lib/components/Number/NumberDisplay.d.ts +0 -5
- package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.js +8 -12
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.d.ts +1 -1
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +51 -25
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +8 -5
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.styles.js +8 -3
- package/lib/components/Number/NumberInput.styles.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +56 -21
- 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/NumberRangeInput.d.ts +6 -0
- package/lib/components/Number/NumberRangeInput.d.ts.map +1 -0
- package/lib/components/Number/NumberRangeInput.js +30 -0
- package/lib/components/Number/NumberRangeInput.js.map +1 -0
- package/lib/components/Number/index.d.ts +3 -2
- package/lib/components/Number/index.d.ts.map +1 -1
- package/lib/components/Number/index.js +1 -0
- package/lib/components/Number/index.js.map +1 -1
- package/lib/components/Number/utils.d.ts +3 -4
- package/lib/components/Number/utils.d.ts.map +1 -1
- package/lib/components/Number/utils.js +41 -22
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts +3 -3
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +1 -4
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +1 -2
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.d.ts +8 -0
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +19 -9
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.d.ts +4 -1
- package/lib/components/Phone/utils.d.ts.map +1 -1
- package/lib/components/Phone/utils.js +4 -2
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +4 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +26 -12
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +1 -0
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +19 -58
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/PopoverContext.d.ts +1 -0
- package/lib/components/Popover/PopoverContext.d.ts.map +1 -1
- package/lib/components/Popover/PopoverContext.js +2 -1
- package/lib/components/Popover/PopoverContext.js.map +1 -1
- package/lib/components/Popover/PopoverManager.d.ts.map +1 -1
- package/lib/components/Popover/PopoverManager.js +2 -1
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +2 -0
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +32 -1
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Ring.js +2 -2
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +3 -1
- package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts +2 -0
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +7 -5
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +3 -0
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +2 -2
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/RadioCheckGroup/index.d.ts +1 -1
- package/lib/components/RadioCheckGroup/index.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/index.js +1 -1
- package/lib/components/RadioCheckGroup/index.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +24 -8
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +127 -94
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.d.ts +16 -0
- package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
- package/lib/components/SearchInput/SearchInput.styles.js +133 -0
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -0
- package/lib/components/SearchInput/index.d.ts +1 -1
- package/lib/components/SearchInput/index.d.ts.map +1 -1
- package/lib/components/SearchInput/index.js +1 -1
- package/lib/components/SearchInput/index.js.map +1 -1
- package/lib/components/Select/Select.d.ts +5 -0
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +18 -8
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -1
- package/lib/components/Sentiment/Sentiment.js.map +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.d.ts.map +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js +2 -2
- package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
- package/lib/components/SkipLinks/SkipLinks.d.ts +15 -0
- package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -0
- package/lib/components/SkipLinks/SkipLinks.js +67 -0
- package/lib/components/SkipLinks/SkipLinks.js.map +1 -0
- package/lib/components/SkipLinks/index.d.ts +4 -0
- package/lib/components/SkipLinks/index.d.ts.map +1 -0
- package/lib/components/SkipLinks/index.js +3 -0
- package/lib/components/SkipLinks/index.js.map +1 -0
- package/lib/components/Slider/Slider.styles.d.ts +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +2 -2
- package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +6 -2
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +11 -4
- package/lib/components/Tabs/Tab.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/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/Tabs.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 +8 -3
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Context.d.ts +7 -0
- package/lib/components/Toaster/Context.d.ts.map +1 -0
- package/lib/components/Toaster/Context.js +6 -0
- package/lib/components/Toaster/Context.js.map +1 -0
- package/lib/components/Toaster/Toaster.d.ts +8 -40
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +12 -12
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/Toaster.types.d.ts +31 -0
- package/lib/components/Toaster/Toaster.types.d.ts.map +1 -0
- package/lib/components/Toaster/Toaster.types.js +2 -0
- package/lib/components/Toaster/Toaster.types.js.map +1 -0
- package/lib/components/Toaster/index.d.ts +1 -2
- package/lib/components/Toaster/index.d.ts.map +1 -1
- package/lib/components/Toaster/index.js +0 -1
- package/lib/components/Toaster/index.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +6 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +24 -5
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.js +27 -13
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +3 -3
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/components/Tree/StandardTree.types.d.ts +1 -0
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.types.js.map +1 -1
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts +5 -1
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +179 -100
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useAutoResize.d.ts +1 -1
- package/lib/hooks/useAutoResize.d.ts.map +1 -1
- package/lib/hooks/useAutoResize.js +14 -6
- package/lib/hooks/useAutoResize.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts +3 -2
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +12 -15
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useConfiguration.d.ts +1 -0
- package/lib/hooks/useConfiguration.d.ts.map +1 -1
- package/lib/hooks/useConfiguration.js +9 -2
- package/lib/hooks/useConfiguration.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +1 -1
- package/lib/hooks/useDraggable.d.ts.map +1 -1
- package/lib/hooks/useDraggable.js +35 -8
- package/lib/hooks/useDraggable.js.map +1 -1
- package/lib/hooks/useFocusTrap.d.ts.map +1 -1
- package/lib/hooks/useFocusTrap.js +4 -5
- package/lib/hooks/useFocusTrap.js.map +1 -1
- package/lib/hooks/useFocusWithin.d.ts.map +1 -1
- package/lib/hooks/useFocusWithin.js +0 -8
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +148 -38
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useI18n.js +2 -1
- package/lib/hooks/useI18n.js.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/hooks/useLongPress.d.ts +1 -1
- package/lib/hooks/useLongPress.d.ts.map +1 -1
- package/lib/hooks/useModalContext.d.ts +7 -0
- package/lib/hooks/useModalContext.d.ts.map +1 -0
- package/lib/hooks/useModalContext.js +12 -0
- package/lib/hooks/useModalContext.js.map +1 -0
- package/lib/hooks/useModalManager.d.ts +8 -0
- package/lib/hooks/useModalManager.d.ts.map +1 -0
- package/lib/hooks/useModalManager.js +16 -0
- package/lib/hooks/useModalManager.js.map +1 -0
- package/lib/hooks/useOS.d.ts.map +1 -1
- package/lib/hooks/useOS.js +1 -2
- package/lib/hooks/useOS.js.map +1 -1
- package/lib/hooks/useScrollStick.d.ts +1 -1
- package/lib/hooks/useScrollStick.d.ts.map +1 -1
- package/lib/hooks/useToaster.d.ts +8 -0
- package/lib/hooks/useToaster.d.ts.map +1 -0
- package/lib/hooks/useToaster.js +16 -0
- package/lib/hooks/useToaster.js.map +1 -0
- package/lib/hooks/useTransitionState.js +1 -1
- package/lib/hooks/useTransitionState.js.map +1 -1
- package/lib/i18n/default.d.ts +148 -38
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +175 -53
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +144 -702
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/translate.d.ts +4 -2
- package/lib/i18n/translate.d.ts.map +1 -1
- package/lib/i18n/translate.js.map +1 -1
- package/lib/index.d.ts +9 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -2
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +8 -0
- package/lib/init.d.ts.map +1 -0
- package/lib/init.js +5 -0
- package/lib/init.js.map +1 -0
- package/lib/register-contexts.d.ts +2 -0
- package/lib/register-contexts.d.ts.map +1 -0
- package/lib/register-contexts.js +10 -0
- package/lib/register-contexts.js.map +1 -0
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +12 -2
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/styles/utils.d.ts +1 -1
- package/lib/styles/utils.d.ts.map +1 -1
- package/lib/styles/utils.js.map +1 -1
- package/lib/theme/ThemeMachine.d.ts +11 -3
- package/lib/theme/ThemeMachine.d.ts.map +1 -1
- package/lib/theme/ThemeMachine.js +28 -26
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/theme/index.js +1 -0
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/theme.d.ts +56 -2
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +37 -5
- package/lib/theme/themeOverrides.schema.json +9 -0
- package/lib/theme/themes/buildTheme.json +0 -3
- package/lib/theme/themes/darkTheme.json +3 -1
- package/lib/theme/themes/legacyBuildTheme.json +0 -3
- package/lib/theme/themes/wssTheme.json +6 -0
- package/lib/types/types.d.ts +3 -0
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/utils.d.ts +11 -0
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +39 -0
- package/lib/utils/utils.js.map +1 -1
- package/package.json +13 -10
- package/lib/components/AppShell/SkipNavigation.d.ts +0 -4
- package/lib/components/AppShell/SkipNavigation.d.ts.map +0 -1
- package/lib/components/AppShell/SkipNavigation.js +0 -61
- package/lib/components/AppShell/SkipNavigation.js.map +0 -1
- package/lib/components/Currency/currencyCodes.d.ts +0 -3
- package/lib/components/Currency/currencyCodes.d.ts.map +0 -1
- package/lib/components/Currency/currencyCodes.js +0 -182
- package/lib/components/Currency/currencyCodes.js.map +0 -1
- package/lib/components/DateTime/types.d.ts +0 -9
- package/lib/components/DateTime/types.d.ts.map +0 -1
- package/lib/components/DateTime/types.js +0 -2
- package/lib/components/DateTime/types.js.map +0 -1
- package/lib/components/Icon/icons/script-solid.icon.d.ts.map +0 -1
- package/lib/components/Icon/icons/script-solid.icon.js +0 -6
- package/lib/components/Icon/icons/script-solid.icon.js.map +0 -1
- package/lib/components/MultiStep/MultiStep.d.ts +0 -6
- package/lib/components/MultiStep/MultiStep.d.ts.map +0 -1
- package/lib/components/MultiStep/MultiStep.js.map +0 -1
- package/lib/components/MultiStep/MultiStep.styles.d.ts.map +0 -1
- package/lib/components/MultiStep/MultiStep.styles.js.map +0 -1
- package/lib/components/MultiStep/MultiStep.types.d.ts +0 -36
- package/lib/components/MultiStep/MultiStep.types.d.ts.map +0 -1
- package/lib/components/MultiStep/MultiStep.types.js +0 -2
- package/lib/components/MultiStep/MultiStep.types.js.map +0 -1
- package/lib/components/MultiStep/index.d.ts +0 -3
- package/lib/components/MultiStep/index.d.ts.map +0 -1
- package/lib/components/MultiStep/index.js +0 -2
- package/lib/components/MultiStep/index.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useRef } from 'react';
|
|
3
|
-
import { useI18n, useFocusWithin } from '../../../../hooks';
|
|
3
|
+
import { useI18n, useFocusWithin, useConfiguration } from '../../../../hooks';
|
|
4
4
|
import { msToTimeFormat, timeFormatToMs } from '../utils';
|
|
5
5
|
import StyledDateTime from '../DateTime.styles';
|
|
6
6
|
import { StyledFormControl } from '../../../FormControl';
|
|
7
7
|
import Flex from '../../../Flex';
|
|
8
8
|
import PartInput from '../PartInput';
|
|
9
9
|
import useAutoFocusNextInput from '../useAutoFocusNextInput';
|
|
10
|
-
const Time = (
|
|
11
|
-
const {
|
|
10
|
+
const Time = ({ value, onChange, disabled, readOnly, required, status, autoFocus, ...restProps }) => {
|
|
11
|
+
const { locale } = useConfiguration();
|
|
12
12
|
const time = value !== undefined
|
|
13
13
|
? msToTimeFormat(value)
|
|
14
14
|
: { hour: undefined, minute: undefined, second: undefined };
|
|
@@ -40,10 +40,11 @@ const Time = (props) => {
|
|
|
40
40
|
const t = useI18n();
|
|
41
41
|
const containerRef = useRef(null);
|
|
42
42
|
useFocusWithin([containerRef], onFocusChange);
|
|
43
|
+
const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });
|
|
43
44
|
return (_jsxs(Flex, { as: StyledDateTime, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
44
45
|
if (e.target === containerRef.current)
|
|
45
46
|
hourInputRef.current?.focus();
|
|
46
|
-
}, ...restProps, children: [_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label":
|
|
47
|
+
}, ...restProps, children: [_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label": displayNames.of('hour'), value: time.hour, readOnly: readOnly, ref: hourInputRef, autoFocus: autoFocus }, 'hour'), ":", _jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": displayNames.of('minute'), value: time.minute, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'), ":", _jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": displayNames.of('second'), value: time.second, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second')] }));
|
|
47
48
|
};
|
|
48
49
|
export default Time;
|
|
49
50
|
//# sourceMappingURL=Time.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../../src/components/DateTime/Input/Duration/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../../src/components/DateTime/Input/Duration/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAM7D,MAAM,IAAI,GAAkB,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,Q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B,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EACrC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,OAEF,KAAC,SAAS,IAER,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,gBACxB,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EACrC,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,cAAc,IARf,QAAQ,CASZ,IACG,CACR,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,IAAI,CAAC","sourcesContent":["import { FC, useCallback, useRef } from 'react';\n\nimport { ForwardProps } from '../../../../types';\nimport { useI18n, useFocusWithin, useConfiguration } from '../../../../hooks';\nimport { msToTimeFormat, timeFormatToMs } from '../utils';\nimport StyledDateTime from '../DateTime.styles';\nimport { StyledFormControl } from '../../../FormControl';\nimport Flex from '../../../Flex';\nimport PartInput from '../PartInput';\nimport useAutoFocusNextInput from '../useAutoFocusNextInput';\n\nimport DurationInputProps from './DurationInput.types';\n\ntype TimeProps = DurationInputProps & ForwardProps;\n\nconst Time: FC<TimeProps> = ({\n value,\n onChange,\n disabled,\n readOnly,\n required,\n status,\n autoFocus,\n ...restProps\n}: DurationInputProps) => {\n const { locale } = useConfiguration();\n\n const time =\n value !== undefined\n ? msToTimeFormat(value)\n : { hour: undefined, minute: undefined, second: undefined };\n\n const [hourInputRef, minuteInputRef, secondInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);\n\n const pickParts = () => {\n return [\n hourInputRef.current?.value || undefined,\n minuteInputRef.current?.value || undefined,\n secondInputRef.current?.value || undefined\n ];\n };\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n if (!focused && !disabled && !readOnly && onChange) {\n const parts = pickParts();\n onChange(\n parts.some(v => v !== undefined)\n ? timeFormatToMs({\n hour: Number(parts[0] ?? 0),\n minute: Number(parts[1] ?? 0),\n second: Number(parts[2] ?? 0)\n })\n : undefined\n );\n }\n },\n [disabled, readOnly, onChange]\n );\n\n const t = useI18n();\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });\n\n return (\n <Flex\n as={StyledDateTime}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) hourInputRef.current?.focus();\n }}\n {...restProps}\n >\n <PartInput\n key='hour'\n placeholder={t('hour_placeholder')}\n aria-label={displayNames.of('hour')}\n value={time.hour}\n readOnly={readOnly}\n ref={hourInputRef}\n autoFocus={autoFocus}\n />\n :\n <PartInput\n key='minute'\n placeholder={t('minute_placeholder')}\n aria-label={displayNames.of('minute')}\n value={time.minute}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={minuteInputRef}\n />\n :\n <PartInput\n key='second'\n placeholder={t('second_placeholder')}\n aria-label={displayNames.of('second')}\n value={time.second}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={secondInputRef}\n />\n </Flex>\n );\n};\nexport default Time;\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../../types';
|
|
3
|
+
import { FormControlProps } from '../../FormControl';
|
|
3
4
|
import DateTimeProps from '../DateTime.types';
|
|
4
5
|
export interface MonthInputProps extends DateTimeProps {
|
|
6
|
+
/** Pass a heading and content to show additional information on the field. */
|
|
7
|
+
additionalInfo?: FormControlProps['additionalInfo'];
|
|
5
8
|
}
|
|
6
9
|
export declare const StyledMonthInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, MonthInputProps, never>;
|
|
7
10
|
declare const MonthInput: FunctionComponent<MonthInputProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"MonthInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AACxE,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAK7E,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,8EAA8E;IAC9E,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,gBAAgB,sHAuB5B,CAAC;AA2CF,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAsIjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, forwardRef, useReducer, useEffect } from 'react';
|
|
3
|
-
import styled
|
|
3
|
+
import styled from 'styled-components';
|
|
4
4
|
import { defaultThemeProp } from '../../../theme';
|
|
5
5
|
import { range } from '../../../utils';
|
|
6
|
-
import { useConfiguration, useConsolidatedRef,
|
|
6
|
+
import { useConfiguration, useConsolidatedRef, useFocusWithin } from '../../../hooks';
|
|
7
7
|
import FormField from '../../FormField';
|
|
8
8
|
import Select, { Option } from '../../Select';
|
|
9
9
|
import { StyledSelect } from '../../Select/Select';
|
|
@@ -11,26 +11,30 @@ import Flex from '../../Flex';
|
|
|
11
11
|
import { StyledFormControl } from '../../FormControl';
|
|
12
12
|
import { parseToDate, getLocalizedMonths } from './utils';
|
|
13
13
|
import StyledDateTime from './DateTime.styles';
|
|
14
|
-
export const StyledMonthInput = styled(StyledDateTime)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
border-bottom-${end}-radius: 0;
|
|
24
|
-
}
|
|
25
|
-
&:last-child {
|
|
26
|
-
max-width: max-content;
|
|
27
|
-
margin-inline-start: -0.0625rem;
|
|
28
|
-
border-top-${start}-radius: 0;
|
|
29
|
-
border-bottom-${start}-radius: 0;
|
|
30
|
-
}
|
|
14
|
+
export const StyledMonthInput = styled(StyledDateTime) `
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: 0;
|
|
17
|
+
|
|
18
|
+
${StyledSelect} {
|
|
19
|
+
min-width: 0;
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
z-index: 1;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
|
|
25
|
+
&:first-child {
|
|
26
|
+
border-start-end-radius: 0;
|
|
27
|
+
border-end-end-radius: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:last-child {
|
|
31
|
+
max-width: max-content;
|
|
32
|
+
margin-inline-start: -0.0625rem;
|
|
33
|
+
border-start-start-radius: 0;
|
|
34
|
+
border-end-start-radius: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
34
38
|
StyledMonthInput.defaultProps = defaultThemeProp;
|
|
35
39
|
const convertToCallbackParameter = (date, parts) => {
|
|
36
40
|
if (parts.every(Boolean)) {
|
|
@@ -65,7 +69,7 @@ const reducer = (state, action) => {
|
|
|
65
69
|
};
|
|
66
70
|
const MonthInput = forwardRef((props, ref) => {
|
|
67
71
|
const { locale } = useConfiguration();
|
|
68
|
-
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
|
|
72
|
+
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, additionalInfo, ...restProps } = props;
|
|
69
73
|
const date = value ? parseToDate(value) : undefined;
|
|
70
74
|
const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();
|
|
71
75
|
const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;
|
|
@@ -94,13 +98,13 @@ const MonthInput = forwardRef((props, ref) => {
|
|
|
94
98
|
};
|
|
95
99
|
const containerRef = useConsolidatedRef(ref);
|
|
96
100
|
useFocusWithin([containerRef], onFocusChange);
|
|
97
|
-
const t = useI18n();
|
|
98
101
|
const monthOptions = months.map((month, index) => (_jsx(Option, { value: index.toString(), children: months[index] }, month)));
|
|
99
102
|
const yearOptions = years.map(year => (_jsx(Option, { value: year.toString(), children: year.toString() }, year.toString())));
|
|
100
|
-
const
|
|
101
|
-
const
|
|
103
|
+
const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });
|
|
104
|
+
const Month = (_jsxs(Select, { "aria-label": displayNames.of('month'), readOnly: readOnly, required: required, value: state[1]?.toString() ?? '', onChange: onSelectChange('month'), status: status, disabled: disabled, autoFocus: autoFocus, children: [!required && _jsx(Option, { children: " " }, 'null'), monthOptions] }, 'month'));
|
|
105
|
+
const Year = (_jsxs(Select, { "aria-label": displayNames.of('year'), readOnly: readOnly, required: required, value: state[0]?.toString() ?? '', onChange: onSelectChange('year'), status: status, disabled: disabled, children: [!required && _jsx(Option, { children: " " }, 'null'), yearOptions] }, 'year'));
|
|
102
106
|
const Comp = (_jsxs(Flex, { as: StyledMonthInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, disabled: disabled, readOnly: readOnly, ...restProps, children: [Month, Year] }));
|
|
103
|
-
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, children: Comp })) : (Comp);
|
|
107
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled, additionalInfo }, children: Comp })) : (Comp);
|
|
104
108
|
});
|
|
105
109
|
export default MonthInput;
|
|
106
110
|
//# sourceMappingURL=MonthInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EAGV,UAAU,EAEV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,W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,EAEhC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EACjC,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,aAEjB,CAAC,QAAQ,IAAI,KAAC,MAAM,qBAAK,MAAM,CAAW,EAC1C,WAAW,KATR,MAAM,CAUH,CACV,CAAC;IAEF,MAAM,IAAI,GAAG,CACX,MAAC,IAAI,IACH,EAAE,EAAE,gBAAgB,EACpB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,SAAS,aAEZ,KAAK,EACL,IAAI,IACA,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAE/D,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n useMemo,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useReducer,\n ChangeEvent,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { range } from '../../../utils';\nimport {\n useConfiguration,\n useConsolidatedRef,\n useDirection,\n useFocusWithin,\n useI18n\n} from '../../../hooks';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport { StyledSelect } from '../../Select/Select';\nimport Flex from '../../Flex';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { parseToDate, getLocalizedMonths } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface MonthInputProps extends DateTimeProps {}\n\nexport const StyledMonthInput = styled(StyledDateTime)<MonthInputProps>(() => {\n const { start, end } = useDirection();\n return css`\n padding: 0;\n border: 0;\n ${StyledSelect} {\n min-width: 0;\n &:first-child {\n border-top-${end}-radius: 0;\n border-bottom-${end}-radius: 0;\n }\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n border-top-${start}-radius: 0;\n border-bottom-${start}-radius: 0;\n }\n }\n `;\n});\n\nStyledMonthInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month] = parts.map(Number);\n date.setUTCFullYear(year, month);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\ntype Field = 'month' | 'year';\ntype State = [year: string | undefined, month: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'month':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst MonthInput: FunctionComponent<MonthInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MonthInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n const months = useMemo(() => getLocalizedMonths(locale), [locale]);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date?.getUTCMonth().toString()\n ]);\n\n useEffect(() => {\n dispatch({ field: 'month', value: date?.getUTCMonth().toString() });\n dispatch({ field: 'year', value: date?.getUTCFullYear().toString() });\n }, [date?.toLocaleDateString()]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const monthOptions = months.map((month, index) => (\n <Option key={month} value={index.toString()}>\n {months[index]}\n </Option>\n ));\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const Month = (\n <Select\n key='month'\n aria-label={t('month_label_a11y')}\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('month')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {monthOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={t('year_label_a11y')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n as={StyledMonthInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n {...restProps}\n >\n {Month}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default MonthInput;\n"]}
|
|
1
|
+
{"version":3,"file":"MonthInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/MonthInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EAEP,UAAU,EAGV,UAAU,EAEV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAoB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAO/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAiB;;;;IAInE,YAAY;;;;;;;;;;;;;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CAAC,QAAQ,IAAI,KAAC,MAAM,qBAAK,MAAM,CAAW,EAC1C,WAAW,KATR,MAAM,CAUH,CACV,CAAC;IAEF,MAAM,IAAI,GAAG,CACX,MAAC,IAAI,IACH,EAAE,EAAE,gBAAgB,EACpB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,SAAS,aAEZ,KAAK,EACL,IAAI,IACA,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,YAE/E,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n useMemo,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useReducer,\n ChangeEvent,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { range } from '../../../utils';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin } from '../../../hooks';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport { StyledSelect } from '../../Select/Select';\nimport Flex from '../../Flex';\nimport { FormControlProps, StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { parseToDate, getLocalizedMonths } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface MonthInputProps extends DateTimeProps {\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n}\n\nexport const StyledMonthInput = styled(StyledDateTime)<MonthInputProps>`\n padding: 0;\n border: 0;\n\n ${StyledSelect} {\n min-width: 0;\n\n &:focus {\n z-index: 1;\n }\n\n &:first-child {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n }\n`;\n\nStyledMonthInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month] = parts.map(Number);\n date.setUTCFullYear(year, month);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\ntype Field = 'month' | 'year';\ntype State = [year: string | undefined, month: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'month':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst MonthInput: FunctionComponent<MonthInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MonthInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n additionalInfo,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n const months = useMemo(() => getLocalizedMonths(locale), [locale]);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date?.getUTCMonth().toString()\n ]);\n\n useEffect(() => {\n dispatch({ field: 'month', value: date?.getUTCMonth().toString() });\n dispatch({ field: 'year', value: date?.getUTCFullYear().toString() });\n }, [date?.toLocaleDateString()]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const monthOptions = months.map((month, index) => (\n <Option key={month} value={index.toString()}>\n {months[index]}\n </Option>\n ));\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });\n\n const Month = (\n <Select\n key='month'\n aria-label={displayNames.of('month')}\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('month')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {monthOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={displayNames.of('year')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n as={StyledMonthInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n {...restProps}\n >\n {Month}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled, additionalInfo }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default MonthInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PartInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,MAAM,WAAW,cAAe,SAAQ,UAAU,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAgE/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -2,7 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback, useEffect } from 'react';
|
|
3
3
|
import { useConsolidatedRef } from '../../../hooks';
|
|
4
4
|
import { BareInput } from './DateTime.styles';
|
|
5
|
-
const
|
|
5
|
+
const padNumberWithZeros = (maxLength, value = '') => {
|
|
6
|
+
if (value === '')
|
|
7
|
+
return '';
|
|
8
|
+
return value.padStart(Number.isFinite(maxLength) ? maxLength : 0, '0');
|
|
9
|
+
};
|
|
10
|
+
const PartInput = forwardRef(({ value, onChange, readOnly, min = 0, max = Infinity, size = 2, maxLength = Infinity, padWithZeros = true, ...restProps }, ref) => {
|
|
6
11
|
const onKeyDown = useCallback((ev) => {
|
|
7
12
|
if (['+', '-', 'e', 'E', '.', ','].includes(ev.key))
|
|
8
13
|
ev.preventDefault();
|
|
@@ -10,7 +15,7 @@ const PartInput = forwardRef(({ value, onChange, readOnly, min = 0, max = Infini
|
|
|
10
15
|
const inputRef = useConsolidatedRef(ref);
|
|
11
16
|
useEffect(() => {
|
|
12
17
|
if (inputRef.current && !Number.isNaN(value)) {
|
|
13
|
-
inputRef.current.value = value?.toString()
|
|
18
|
+
inputRef.current.value = padNumberWithZeros(maxLength, value?.toString());
|
|
14
19
|
}
|
|
15
20
|
}, [value, inputRef.current]);
|
|
16
21
|
const onInputChange = useCallback((ev) => {
|
|
@@ -21,12 +26,10 @@ const PartInput = forwardRef(({ value, onChange, readOnly, min = 0, max = Infini
|
|
|
21
26
|
targetEl.style.width = `${Math.max(targetEl.value.length, size)}ch`;
|
|
22
27
|
}, [maxLength]);
|
|
23
28
|
const onBlur = useCallback((ev) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
targetEl.value = targetEl.value.padStart(2, '0');
|
|
27
|
-
onChange?.(targetEl.value);
|
|
29
|
+
const targetElValue = ev.target.value;
|
|
30
|
+
onChange?.(padWithZeros ? padNumberWithZeros(maxLength, targetElValue) : targetElValue);
|
|
28
31
|
}, [onChange]);
|
|
29
|
-
const defaultValue =
|
|
32
|
+
const defaultValue = padNumberWithZeros(maxLength, value?.toString());
|
|
30
33
|
return (_jsx(BareInput, { type: 'number', defaultValue: defaultValue, onBlur: onBlur, onKeyDown: onKeyDown, onChange: onInputChange, step: 1, min: min, max: max, maxLength: maxLength, readOnly: readOnly, ref: inputRef, size: size, ...restProps }));
|
|
31
34
|
});
|
|
32
35
|
export default PartInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,WAAW,EACX,SAAS,EAEV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PartInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/PartInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EAGV,WAAW,EACX,SAAS,EAEV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAE,QAAgB,EAAE,EAAE,EAAE;IACnE,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAE5B,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzE,CAAC,CAAC;AAYF,MAAM,SAAS,GAAqD,UAAU,CAC5E,CACE,EACE,KAAK,EACL,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AC,IAAI,CAAC;IACxE,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,EAAgC,EAAE,EAAE;QACnC,MAAM,aAAa,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC1F,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtE,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,QAAQ,EACb,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,KACN,SAAS,GACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FocusEvent,\n KeyboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n ChangeEvent\n} from 'react';\n\nimport { useConsolidatedRef } from '../../../hooks';\nimport { ForwardProps, OmitStrict } from '../../../types';\nimport { InputProps } from '../../Input/Input';\n\nimport { BareInput } from './DateTime.styles';\n\nconst padNumberWithZeros = (maxLength: number, value: string = '') => {\n if (value === '') return '';\n\n return value.padStart(Number.isFinite(maxLength) ? maxLength : 0, '0');\n};\n\nexport interface PartInputProps extends OmitStrict<InputProps, 'defaultValue' | 'value'> {\n value?: number;\n min?: number;\n max?: number;\n maxLength?: number;\n padWithZeros?: boolean;\n size?: number;\n onChange?: (value?: string) => void;\n}\n\nconst PartInput: FunctionComponent<PartInputProps & ForwardProps> = forwardRef(\n (\n {\n value,\n onChange,\n readOnly,\n min = 0,\n max = Infinity,\n size = 2,\n maxLength = Infinity,\n padWithZeros = true,\n ...restProps\n }: PropsWithoutRef<PartInputProps>,\n ref: Ref<HTMLInputElement>\n ) => {\n const onKeyDown = useCallback((ev: KeyboardEvent<HTMLInputElement>) => {\n if (['+', '-', 'e', 'E', '.', ','].includes(ev.key)) ev.preventDefault();\n }, []);\n\n const inputRef = useConsolidatedRef(ref);\n useEffect(() => {\n if (inputRef.current && !Number.isNaN(value)) {\n inputRef.current.value = padNumberWithZeros(maxLength, value?.toString());\n }\n }, [value, inputRef.current]);\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const targetEl = ev.target;\n if (targetEl.value.length > maxLength) targetEl.value = targetEl.value.slice(0, maxLength);\n else if (size !== maxLength)\n targetEl.style.width = `${Math.max(targetEl.value.length, size)}ch`;\n },\n [maxLength]\n );\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLInputElement>) => {\n const targetElValue = ev.target.value;\n onChange?.(padWithZeros ? padNumberWithZeros(maxLength, targetElValue) : targetElValue);\n },\n [onChange]\n );\n\n const defaultValue = padNumberWithZeros(maxLength, value?.toString());\n\n return (\n <BareInput\n type='number'\n defaultValue={defaultValue}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n onChange={onInputChange}\n step={1}\n min={min}\n max={max}\n maxLength={maxLength}\n readOnly={readOnly}\n ref={inputRef}\n size={size}\n {...restProps}\n />\n );\n }\n);\n\nexport default PartInput;\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../../types';
|
|
3
3
|
import DateTimeProps from '../DateTime.types';
|
|
4
|
+
import { FormControlProps } from '../../FormControl';
|
|
4
5
|
export interface QuarterInputProps extends DateTimeProps {
|
|
6
|
+
/** Pass a heading and content to show additional information on the field. */
|
|
7
|
+
additionalInfo?: FormControlProps['additionalInfo'];
|
|
5
8
|
}
|
|
6
9
|
export declare const StyledQuarterInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, QuarterInputProps, never>;
|
|
7
10
|
declare const QuarterInput: FunctionComponent<QuarterInputProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"QuarterInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAM7E,OAAO,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AAKxE,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,8EAA8E;IAC9E,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB,wHAuB9B,CAAC;AA4CF,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAsIrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useReducer } from 'react';
|
|
3
|
-
import styled
|
|
3
|
+
import styled from 'styled-components';
|
|
4
4
|
import FormField from '../../FormField';
|
|
5
5
|
import Select, { Option } from '../../Select';
|
|
6
6
|
import Flex from '../../Flex';
|
|
7
7
|
import { range } from '../../../utils';
|
|
8
|
-
import {
|
|
8
|
+
import { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';
|
|
9
9
|
import { StyledSelect } from '../../Select/Select';
|
|
10
10
|
import { defaultThemeProp } from '../../../theme';
|
|
11
11
|
import { StyledFormControl } from '../../FormControl';
|
|
12
12
|
import { getQuarter, parseToDate } from './utils';
|
|
13
13
|
import StyledDateTime from './DateTime.styles';
|
|
14
|
-
export const StyledQuarterInput = styled(StyledDateTime)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
${`border-bottom-${end}-radius`}: 0;
|
|
24
|
-
}
|
|
25
|
-
&:last-child {
|
|
26
|
-
max-width: max-content;
|
|
27
|
-
margin-inline-start: -0.0625rem;
|
|
28
|
-
${`border-top-${start}-radius`}: 0;
|
|
29
|
-
${`border-bottom-${start}-radius`}: 0;
|
|
30
|
-
}
|
|
14
|
+
export const StyledQuarterInput = styled(StyledDateTime) `
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: 0;
|
|
17
|
+
|
|
18
|
+
${StyledSelect} {
|
|
19
|
+
min-width: 0;
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
z-index: 1;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
|
|
25
|
+
&:first-child {
|
|
26
|
+
border-start-end-radius: 0;
|
|
27
|
+
border-end-end-radius: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:last-child {
|
|
31
|
+
max-width: max-content;
|
|
32
|
+
margin-inline-start: -0.0625rem;
|
|
33
|
+
border-start-start-radius: 0;
|
|
34
|
+
border-end-start-radius: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
34
38
|
StyledQuarterInput.defaultProps = defaultThemeProp;
|
|
35
39
|
const convertToCallbackParameter = (date, parts) => {
|
|
36
40
|
if (parts.every(Boolean)) {
|
|
@@ -65,7 +69,8 @@ const reducer = (state, action) => {
|
|
|
65
69
|
}
|
|
66
70
|
};
|
|
67
71
|
const QuarterInput = forwardRef((props, ref) => {
|
|
68
|
-
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
|
|
72
|
+
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info, status, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, additionalInfo, ...restProps } = props;
|
|
73
|
+
const { locale } = useConfiguration();
|
|
69
74
|
const date = value ? parseToDate(value) : undefined;
|
|
70
75
|
const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();
|
|
71
76
|
const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;
|
|
@@ -93,10 +98,11 @@ const QuarterInput = forwardRef((props, ref) => {
|
|
|
93
98
|
const quarters = [1, 2, 3, 4];
|
|
94
99
|
const quarterOptions = quarters.map(quarterNumber => (_jsx(Option, { value: quarterNumber.toString(), children: t(`date_quarter_q${quarterNumber}`).trim() }, t(`date_quarter_q${quarterNumber}`).trim())));
|
|
95
100
|
const yearOptions = years.map(year => (_jsx(Option, { value: year.toString(), children: year.toString() }, year.toString())));
|
|
96
|
-
const
|
|
97
|
-
const
|
|
101
|
+
const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });
|
|
102
|
+
const Quarter = (_jsxs(Select, { "aria-label": displayNames.of('quarter'), readOnly: readOnly, required: required, value: state[1]?.toString() ?? '', onChange: onSelectChange('quarter'), status: status, disabled: disabled, autoFocus: autoFocus, children: [!required && _jsx(Option, { children: " " }, 'null'), quarterOptions] }, 'quarter'));
|
|
103
|
+
const Year = (_jsxs(Select, { "aria-label": displayNames.of('year'), readOnly: readOnly, required: required, value: state[0]?.toString() ?? '', onChange: onSelectChange('year'), status: status, disabled: disabled, children: [!required && _jsx(Option, { children: " " }, 'null'), yearOptions] }, 'year'));
|
|
98
104
|
const Comp = (_jsxs(Flex, { ...restProps, as: StyledQuarterInput, forwardedAs: StyledFormControl, container: { alignItems: 'center' }, ref: containerRef, status: status, disabled: disabled, readOnly: readOnly, children: [Quarter, Year] }));
|
|
99
|
-
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, children: Comp })) : (Comp);
|
|
105
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled, additionalInfo }, children: Comp })) : (Comp);
|
|
100
106
|
});
|
|
101
107
|
export default QuarterInput;
|
|
102
108
|
//# sourceMappingURL=QuarterInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB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AAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,aAEjB,CAAC,QAAQ,IAAI,KAAC,MAAM,qBAAK,MAAM,CAAW,EAC1C,WAAW,KATR,MAAM,CAUH,CACV,CAAC;IAEF,MAAM,IAAI,GAAG,CACX,MAAC,IAAI,OACC,SAAS,EACb,EAAE,EAAE,kBAAkB,EACtB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EACnC,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,aAEjB,OAAO,EACP,IAAI,IACA,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAE/D,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useReducer\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\nimport Flex from '../../Flex';\nimport { range } from '../../../utils';\nimport { useConsolidatedRef, useDirection, useFocusWithin, useI18n } from '../../../hooks';\nimport { StyledSelect } from '../../Select/Select';\nimport { defaultThemeProp } from '../../../theme';\nimport { StyledFormControl } from '../../FormControl';\n\nimport { getQuarter, parseToDate, QuarterNumber } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface QuarterInputProps extends DateTimeProps {}\n\nexport const StyledQuarterInput = styled(StyledDateTime)<QuarterInputProps>(() => {\n const { start, end } = useDirection();\n return css`\n padding: 0;\n border: 0;\n ${StyledSelect} {\n min-width: 0;\n &:first-child {\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n }\n `;\n});\n\nStyledQuarterInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, quarter] = parts.map(Number);\n const quarterStartMonth = [0, 3, 6, 9][quarter - 1];\n date.setUTCFullYear(year, quarterStartMonth, 1);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\ntype Field = 'quarter' | 'year';\ntype State = [year: string | undefined, quarter: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'quarter':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst QuarterInput: FunctionComponent<QuarterInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<QuarterInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date && getQuarter(date).toString()\n ]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const quarters: QuarterNumber[] = [1, 2, 3, 4];\n\n const quarterOptions = quarters.map(quarterNumber => (\n <Option key={t(`date_quarter_q${quarterNumber}`).trim()} value={quarterNumber.toString()}>\n {t(`date_quarter_q${quarterNumber}`).trim()}\n </Option>\n ));\n\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const Quarter = (\n <Select\n aria-label={t('quarter_label_a11y')}\n key='quarter'\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('quarter')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {quarterOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={t('year_label_a11y')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n {...restProps}\n as={StyledQuarterInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n >\n {Quarter}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default QuarterInput;\n"]}
|
|
1
|
+
{"version":3,"file":"QuarterInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/QuarterInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAoB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AACjE,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAO/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAmB;;;;IAIvE,YAAY;;;;;;;;;;;;;;;;;;;CAmBf,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,0BAA0B,GAAG,CACjC,IAAU,EACV,KAA6B,EACF,EAAE;IAC7B,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,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EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,aAEjB,OAAO,EACP,IAAI,IACA,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,YAE/E,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useReducer\n} from 'react';\nimport styled from 'styled-components';\n\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Select, { Option } from '../../Select';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\nimport Flex from '../../Flex';\nimport { range } from '../../../utils';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { StyledSelect } from '../../Select/Select';\nimport { defaultThemeProp } from '../../../theme';\nimport { FormControlProps, StyledFormControl } from '../../FormControl';\n\nimport { getQuarter, parseToDate, QuarterNumber } from './utils';\nimport StyledDateTime from './DateTime.styles';\n\nexport interface QuarterInputProps extends DateTimeProps {\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n}\n\nexport const StyledQuarterInput = styled(StyledDateTime)<QuarterInputProps>`\n padding: 0;\n border: 0;\n\n ${StyledSelect} {\n min-width: 0;\n\n &:focus {\n z-index: 1;\n }\n\n &:first-child {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n &:last-child {\n max-width: max-content;\n margin-inline-start: -0.0625rem;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n }\n`;\n\nStyledQuarterInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, quarter] = parts.map(Number);\n const quarterStartMonth = [0, 3, 6, 9][quarter - 1];\n date.setUTCFullYear(year, quarterStartMonth, 1);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\ntype Field = 'quarter' | 'year';\ntype State = [year: string | undefined, quarter: string | undefined];\n\nconst reducer = (state: State, action: { field: Field; value: string | undefined }): State => {\n switch (action.field) {\n case 'year':\n return [action.value, state[1]];\n case 'quarter':\n return [state[0], action.value];\n default:\n return state.slice(0) as State;\n }\n};\n\nconst QuarterInput: FunctionComponent<QuarterInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<QuarterInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n additionalInfo,\n ...restProps\n } = props;\n\n const { locale } = useConfiguration();\n\n const date = value ? parseToDate(value) : undefined;\n const currentYear = date ? date.getUTCFullYear() : new Date().getFullYear();\n\n const minYear = min ? parseToDate(min).getUTCFullYear() : currentYear - 10;\n const maxYear = max ? parseToDate(max).getUTCFullYear() : currentYear + 10;\n\n const years = range(minYear, maxYear);\n\n const [state, dispatch] = useReducer(reducer, [\n date?.getUTCFullYear().toString(),\n date && getQuarter(date).toString()\n ]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), state);\n if (onFocus && focused) onFocus(callbackParam);\n else if (onBlur && !focused) onBlur(callbackParam);\n };\n\n const onSelectChange = (field: Field) => (ev: ChangeEvent<HTMLSelectElement>) => {\n const action = { field, value: ev.target.value };\n dispatch(action);\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), reducer(state, action))\n );\n };\n\n const containerRef = useConsolidatedRef<HTMLElement>(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const t = useI18n();\n\n const quarters: QuarterNumber[] = [1, 2, 3, 4];\n\n const quarterOptions = quarters.map(quarterNumber => (\n <Option key={t(`date_quarter_q${quarterNumber}`).trim()} value={quarterNumber.toString()}>\n {t(`date_quarter_q${quarterNumber}`).trim()}\n </Option>\n ));\n\n const yearOptions = years.map(year => (\n <Option key={year.toString()} value={year.toString()}>\n {year.toString()}\n </Option>\n ));\n\n const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });\n\n const Quarter = (\n <Select\n aria-label={displayNames.of('quarter')}\n key='quarter'\n readOnly={readOnly}\n required={required}\n value={state[1]?.toString() ?? ''}\n onChange={onSelectChange('quarter')}\n status={status}\n disabled={disabled}\n autoFocus={autoFocus}\n >\n {!required && <Option key='null'> </Option>}\n {quarterOptions}\n </Select>\n );\n\n const Year = (\n <Select\n aria-label={displayNames.of('year')}\n key='year'\n readOnly={readOnly}\n required={required}\n value={state[0]?.toString() ?? ''}\n onChange={onSelectChange('year')}\n status={status}\n disabled={disabled}\n >\n {!required && <Option key='null'> </Option>}\n {yearOptions}\n </Select>\n );\n\n const Comp = (\n <Flex\n {...restProps}\n as={StyledQuarterInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center' }}\n ref={containerRef}\n status={status}\n disabled={disabled}\n readOnly={readOnly}\n >\n {Quarter}\n {Year}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled, additionalInfo }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default QuarterInput;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../../types';
|
|
3
3
|
import { MinuteInterval } from '../Picker/TimePicker';
|
|
4
|
+
import { FormControlProps } from '../../FormControl';
|
|
4
5
|
import DateTimeProps from '../DateTime.types';
|
|
5
6
|
import { ClockFormat } from './utils';
|
|
6
7
|
export interface TimeInputProps extends DateTimeProps {
|
|
@@ -18,6 +19,8 @@ export interface TimeInputProps extends DateTimeProps {
|
|
|
18
19
|
* Defines clock format that overrides locale based format
|
|
19
20
|
*/
|
|
20
21
|
clockFormat?: ClockFormat;
|
|
22
|
+
/** Pass a heading and content to show additional information on the field. */
|
|
23
|
+
additionalInfo?: FormControlProps['additionalInfo'];
|
|
21
24
|
}
|
|
22
25
|
export declare const StyledTimeInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TimeInputProps, never>;
|
|
23
26
|
declare const TimeInput: FunctionComponent<TimeInputProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,OAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"TimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,OAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AACxE,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAKL,WAAW,EAEZ,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,eAAe,qHAE3B,CAAC;AAyDF,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAiS/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -72,7 +72,7 @@ const convertToCallbackParameter = (date, parts, meridiem) => {
|
|
|
72
72
|
};
|
|
73
73
|
const TimeInput = forwardRef((props, ref) => {
|
|
74
74
|
const { locale } = useConfiguration();
|
|
75
|
-
const { defaultValue, value = defaultValue, id, label, labelHidden, status, withSeconds = false, pickerInterval = 30, clockFormat, info = getDateFormat(locale, getTimeOptions(withSeconds), true).join(''), required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
|
|
75
|
+
const { defaultValue, value = defaultValue, id, label, labelHidden, status, withSeconds = false, pickerInterval = 30, clockFormat, info = getDateFormat(locale, getTimeOptions(withSeconds), true).join(''), required, readOnly, disabled, onChange, onFocus, onBlur, onResolveSuggestion, autoFocus, additionalInfo, ...restProps } = props;
|
|
76
76
|
const date = value !== undefined ? parseToDate(value) : undefined;
|
|
77
77
|
const is12h = clockFormat ? clockFormat === 12 : is12HClockFormat(locale);
|
|
78
78
|
const [meridiem, setMeridiem] = useState(is12h ? () => (date ? getMeridiem(date.getUTCHours()) : 'AM') : undefined);
|
|
@@ -99,6 +99,7 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
99
99
|
: undefined;
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
+
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
102
103
|
const inputContainerRef = useRef(null);
|
|
103
104
|
const onFocusChange = (focused) => {
|
|
104
105
|
const currentMeridiem = meridiemSelectRef.current?.value || undefined;
|
|
@@ -109,6 +110,7 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
109
110
|
if (inputContainerRef.current)
|
|
110
111
|
inputContainerRef.current.scrollTop = 0;
|
|
111
112
|
onBlur?.(callbackParam);
|
|
113
|
+
setOpen(false);
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
116
|
const onInputChange = () => {
|
|
@@ -116,15 +118,15 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
116
118
|
onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts(), is12h ? currentMeridiem : undefined));
|
|
117
119
|
};
|
|
118
120
|
const t = useI18n();
|
|
121
|
+
const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });
|
|
119
122
|
const hour = date && is12h ? convertTo12h(date.getUTCHours()) : date?.getUTCHours();
|
|
120
|
-
const HourInput = (_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label":
|
|
121
|
-
const MinuteInput = (_jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label":
|
|
122
|
-
const SecondInput = (_jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label":
|
|
123
|
-
const Period = (_jsxs(Select, { ref: meridiemSelectRef, "aria-label":
|
|
123
|
+
const HourInput = (_jsx(PartInput, { placeholder: t('hour_placeholder'), "aria-label": displayNames.of('hour'), value: hour, onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: is12h ? 1 : 0, max: is12h ? 12 : 23, ref: hourInputRef, autoFocus: autoFocus }, 'hour'));
|
|
124
|
+
const MinuteInput = (_jsx(PartInput, { placeholder: t('minute_placeholder'), "aria-label": displayNames.of('minute'), value: date?.getUTCMinutes(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: minuteInputRef }, 'minute'));
|
|
125
|
+
const SecondInput = (_jsx(PartInput, { placeholder: t('second_placeholder'), "aria-label": displayNames.of('second'), value: date?.getUTCSeconds(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, max: 59, ref: secondInputRef }, 'second'));
|
|
126
|
+
const Period = (_jsxs(Select, { ref: meridiemSelectRef, "aria-label": displayNames.of('dayPeriod'), value: meridiem, required: required, disabled: disabled, onChange: (ev) => {
|
|
124
127
|
setMeridiem(ev.target.value);
|
|
125
128
|
onInputChange();
|
|
126
129
|
}, readOnly: readOnly, children: [_jsx(Option, { value: 'AM', children: t('meridiem_value_am') }), _jsx(Option, { value: 'PM', children: t('meridiem_value_pm') })] }, 'period'));
|
|
127
|
-
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
128
130
|
const containerRef = useConsolidatedRef(ref);
|
|
129
131
|
useFocusWithin([containerRef], onFocusChange);
|
|
130
132
|
const Picker = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": t(open ? 'close_time_button_a11y' : 'open_time_button_a11y'), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'clock' }) }), _jsx(Popover, { show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
|
|
@@ -150,10 +152,10 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
150
152
|
}
|
|
151
153
|
setMeridiem(getMeridiem(selected.getUTCHours()));
|
|
152
154
|
setOpen(false);
|
|
153
|
-
buttonEl?.focus();
|
|
155
|
+
setTimeout(() => buttonEl?.focus());
|
|
154
156
|
onInputChange();
|
|
155
157
|
}, clockFormat: clockFormat }) })] }));
|
|
156
|
-
const Comp = (_jsxs(Flex, { as: StyledTimeInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
158
|
+
const Comp = (_jsxs(Flex, { as: StyledTimeInput, forwardedAs: StyledFormControl, hasSuggestion: status === 'pending' && !!onResolveSuggestion, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
157
159
|
if (e.target === containerRef.current)
|
|
158
160
|
hourInputRef.current?.focus();
|
|
159
161
|
}, ...restProps, children: [_jsx(Flex, { ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, children: getDateFormat(locale, getTimeOptions(withSeconds, is12h)).map(part => {
|
|
@@ -171,7 +173,17 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
171
173
|
return part;
|
|
172
174
|
}
|
|
173
175
|
}) }), !readOnly && Picker] }));
|
|
174
|
-
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{
|
|
176
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{
|
|
177
|
+
label,
|
|
178
|
+
labelHidden,
|
|
179
|
+
id,
|
|
180
|
+
info,
|
|
181
|
+
status,
|
|
182
|
+
required,
|
|
183
|
+
disabled,
|
|
184
|
+
onResolveSuggestion,
|
|
185
|
+
additionalInfo
|
|
186
|
+
}, ref: ref, children: Comp })) : (Comp);
|
|
175
187
|
});
|
|
176
188
|
export default TimeInput;
|
|
177
189
|
//# sourceMappingURL=TimeInput.js.map
|