@pega/cosmos-react-core 3.0.0-dev.9.0 → 3.0.0-rc.2
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 +16 -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 +89 -218
- 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 +48 -527
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +27 -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 +157 -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 +4 -2
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +8 -2
- 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/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/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 +1 -1
- 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 +68 -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.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 +116 -31
- 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 +2 -2
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts +2 -0
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.types.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.d.ts +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 +14 -13
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +25 -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/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/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 +27 -15
- 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 +28 -12
- 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 +23 -26
- package/lib/components/DateTime/Input/MonthInput.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 +24 -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 +6 -6
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +2 -1
- 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 +2 -2
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +18 -4
- 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 +149 -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/FieldGroup/FieldGroup.d.ts +7 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +45 -41
- 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 +6 -2
- 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 +41 -13
- 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 +6 -3
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileVisual.d.ts.map +1 -1
- package/lib/components/File/FileVisual.js +6 -5
- package/lib/components/File/FileVisual.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.map +1 -1
- package/lib/components/HTML/HTML.js +56 -16
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.js +1 -1
- 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/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +10 -6
- 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 +13 -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 +7 -7
- package/lib/components/Menu/helpers.d.ts.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/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 +3 -5
- 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 +14 -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} +3 -4
- 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 +60 -35
- 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 +6 -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 -21
- 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/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +13 -3
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +2 -0
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +13 -9
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +12 -57
- 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/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 +6 -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 +1 -1
- 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 +129 -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 +14 -5
- package/lib/components/Select/Select.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 +0 -1
- 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 +5 -0
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +23 -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 +175 -99
- 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 +10 -13
- 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/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 +131 -34
- 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 +131 -34
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +154 -47
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +127 -698
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/translate.d.ts +3 -0
- 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/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 +54 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +33 -1
- package/lib/theme/themeOverrides.schema.json +9 -0
- package/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 +5 -0
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +23 -0
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -5
- 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
|
@@ -52,7 +52,7 @@ const convertToCallbackParameter = (date, parts) => {
|
|
|
52
52
|
};
|
|
53
53
|
const DateInput = forwardRef((props, ref) => {
|
|
54
54
|
const { locale } = useConfiguration();
|
|
55
|
-
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info = getDateFormat(locale).join(''), status, required, readOnly, disabled, onChange, onFocus, onBlur, showWeekNumber, picker, autoFocus, ...restProps } = props;
|
|
55
|
+
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, info = getDateFormat(locale).join(''), status, required, readOnly, disabled, onChange, onFocus, onBlur, onResolveSuggestion, showWeekNumber, picker: { renderer: PickerComp = DatePicker, rendererProps = {} } = {}, autoFocus, additionalInfo, ...restProps } = props;
|
|
56
56
|
const t = useI18n();
|
|
57
57
|
const date = value !== undefined ? parseToDate(value) : undefined;
|
|
58
58
|
const [yearInputRef, monthInputRef, dayInputRef] = [
|
|
@@ -79,6 +79,7 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
79
79
|
: undefined;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
+
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
82
83
|
const inputContainerRef = useRef(null);
|
|
83
84
|
const onFocusChange = (focused) => {
|
|
84
85
|
const callbackParam = convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts());
|
|
@@ -88,9 +89,9 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
88
89
|
if (inputContainerRef.current)
|
|
89
90
|
inputContainerRef.current.scrollTop = 0;
|
|
90
91
|
onBlur?.(callbackParam);
|
|
92
|
+
setOpen(false);
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
|
-
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
94
95
|
const onInputChange = () => {
|
|
95
96
|
onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));
|
|
96
97
|
buttonEl?.setAttribute('aria-label', generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open));
|
|
@@ -109,9 +110,10 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
109
110
|
onInputChange();
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
113
|
+
const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });
|
|
114
|
+
const DayInput = (_jsx(PartInput, { placeholder: t('day_placeholder'), "aria-label": displayNames.of('day'), value: date?.getUTCDate(), onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 31, ref: dayInputRef }, 'day'));
|
|
115
|
+
const MonthInput = (_jsx(PartInput, { placeholder: t('month_placeholder'), "aria-label": displayNames.of('month'), value: date ? date?.getUTCMonth() + 1 : undefined, onChange: onInputChange, size: 2, maxLength: 2, readOnly: readOnly, min: 1, max: 12, ref: monthInputRef }, 'month'));
|
|
116
|
+
const YearInput = (_jsx(PartInput, { placeholder: t('year_placeholder'), "aria-label": displayNames.of('year'), value: date?.getUTCFullYear(), onChange: onInputChange, size: 4, maxLength: 4, readOnly: readOnly, min: 1, ref: yearInputRef }, 'year'));
|
|
115
117
|
const containerRef = useRef(null);
|
|
116
118
|
useFocusWithin([containerRef], onFocusChange);
|
|
117
119
|
useImperativeHandle(ref, () => ({
|
|
@@ -121,22 +123,22 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
121
123
|
return currentlySelectedDate();
|
|
122
124
|
}
|
|
123
125
|
}));
|
|
124
|
-
const
|
|
125
|
-
setInputValue(selected);
|
|
126
|
-
setOpen(false);
|
|
127
|
-
setTimeout(() => buttonEl?.focus());
|
|
128
|
-
onInputChange();
|
|
129
|
-
}, min: min, max: max, showWeekNumber: showWeekNumber }));
|
|
130
|
-
const PickerButton = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'calendar' }) }), _jsx(Popover, { show: open, ref: setPopoverRef, target: containerRef.current, placement: 'bottom-end', strategy: 'fixed', modifiers: [
|
|
126
|
+
const PickerButton = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'calendar' }) }), open && (_jsx(Popover, { ref: setPopoverRef, target: buttonEl, placement: 'bottom-end', strategy: 'fixed', modifiers: [
|
|
131
127
|
{
|
|
132
128
|
name: 'flip',
|
|
133
129
|
options: {
|
|
134
130
|
fallbackPlacements: ['top-end', 'right', 'left']
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
|
-
], children:
|
|
133
|
+
], children: _jsx(PickerComp, { selected: currentlySelectedDate(), min: min, max: max, showWeekNumber: showWeekNumber, ...rendererProps, onChange: selected => {
|
|
134
|
+
setInputValue(selected);
|
|
135
|
+
setOpen(false);
|
|
136
|
+
setTimeout(() => buttonEl?.focus());
|
|
137
|
+
onInputChange();
|
|
138
|
+
rendererProps?.onChange?.(selected);
|
|
139
|
+
} }) }))] }));
|
|
138
140
|
const orderedRefs = [];
|
|
139
|
-
const Comp = (_jsxs(Flex, { as: StyledDateInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
141
|
+
const Comp = (_jsxs(Flex, { as: StyledDateInput, forwardedAs: StyledFormControl, hasSuggestion: status === 'pending' && !!onResolveSuggestion, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
140
142
|
if (e.target === containerRef.current)
|
|
141
143
|
orderedRefs[0].current?.focus();
|
|
142
144
|
}, ...restProps, children: [_jsx(Flex, { ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, onPaste: onPaste, children: getDateFormat(locale).map(part => {
|
|
@@ -159,7 +161,17 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
159
161
|
orderedRefs[0].current?.focus();
|
|
160
162
|
}, [autoFocus]);
|
|
161
163
|
useAutoFocusNextInput(orderedRefs);
|
|
162
|
-
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{
|
|
164
|
+
return label ? (_jsx(FormField, { as: 'fieldset', "aria-labelledby": id, labelAs: 'legend', ...{
|
|
165
|
+
label,
|
|
166
|
+
labelHidden,
|
|
167
|
+
id,
|
|
168
|
+
info,
|
|
169
|
+
status,
|
|
170
|
+
required,
|
|
171
|
+
disabled,
|
|
172
|
+
onResolveSuggestion,
|
|
173
|
+
additionalInfo
|
|
174
|
+
}, ref: ref, children: Comp })) : (Comp);
|
|
163
175
|
});
|
|
164
176
|
export default DateInput;
|
|
165
177
|
//# sourceMappingURL=DateInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAGV,MAAM,EAKN,mBAAmB,EACnB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAkBtC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,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CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n ClipboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef,\n RefObject,\n ReactNode,\n Dispatch,\n SetStateAction,\n useImperativeHandle,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { useConfiguration, useFocusWithin, useI18n } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as timesIcon from '../../Icon/icons/times.icon';\nimport * as calendarIcon from '../../Icon/icons/calendar.icon';\nimport DatePicker from '../Picker/DatePicker';\nimport Popover from '../../Popover';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n getDateFormat,\n parsePastedTextToDate,\n parseToDate,\n validateDate,\n generatePickerButtonAriaLabel\n} from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\n\nregisterIcon(timesIcon, calendarIcon);\n\nexport interface DateInputProps extends DateTimeProps {\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n /** Changes default date picker */\n picker?: ReactNode;\n}\n\nexport interface DateInputRefObject {\n readonly value: Date | undefined;\n setOpen: Dispatch<SetStateAction<boolean>>;\n buttonEl: HTMLElement | null;\n}\n\nexport const StyledDateInput = styled(StyledDateTime)<DateInputProps>`\n padding-inline-end: 0;\n`;\n\nStyledDateInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n if (!validateDate(year, monthIndex + 1, day)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCFullYear(year, monthIndex, day);\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\nconst DateInput: FunctionComponent<DateInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<DateInputProps>, ref: Ref<DateInputRefObject>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info = getDateFormat(locale).join(''),\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n showWeekNumber,\n picker,\n autoFocus,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [yearInputRef, monthInputRef, dayInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n const pickParts = () => {\n const month = monthInputRef.current?.value\n ? (Number(monthInputRef.current.value) - 1).toString()\n : undefined;\n return [\n yearInputRef.current?.value || undefined,\n month,\n dayInputRef.current?.value || undefined\n ];\n };\n\n const currentlySelectedDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n return validateDate(year, monthIndex + 1, day)\n ? new Date(Date.UTC(year, monthIndex, day))\n : undefined;\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const onInputChange = () => {\n onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));\n buttonEl?.setAttribute(\n 'aria-label',\n generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open)\n );\n };\n\n const setInputValue = (newValue: Date) => {\n dayInputRef.current!.value = newValue.getUTCDate().toString().padStart(2, '0');\n monthInputRef.current!.value = (newValue.getUTCMonth() + 1).toString().padStart(2, '0');\n yearInputRef.current!.value = newValue.getUTCFullYear().toString();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n const text = e.clipboardData.getData('text');\n const newDate = parsePastedTextToDate(text, locale, date || new Date());\n if (newDate) {\n e.preventDefault();\n setInputValue(newDate);\n onInputChange();\n }\n };\n\n const DayInput = (\n <PartInput\n key='day'\n placeholder={t('day_placeholder')}\n aria-label={t('day_label_a11y')}\n value={date?.getUTCDate()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={31}\n ref={dayInputRef}\n />\n );\n\n const MonthInput = (\n <PartInput\n key='month'\n placeholder={t('month_placeholder')}\n aria-label={t('month_label_a11y')}\n value={date ? date?.getUTCMonth() + 1 : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={12}\n ref={monthInputRef}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={t('year_label_a11y')}\n value={date?.getUTCFullYear()}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n readOnly={readOnly}\n min={1}\n ref={yearInputRef}\n />\n );\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n useImperativeHandle(ref, () => ({\n setOpen,\n buttonEl,\n get value() {\n return currentlySelectedDate();\n }\n }));\n\n const Picker = (\n <DatePicker\n selected={currentlySelectedDate()}\n onChange={selected => {\n setInputValue(selected);\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n }}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n );\n\n const PickerButton = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={generatePickerButtonAriaLabel(\n currentlySelectedDate(),\n 'date',\n locale,\n t,\n open\n )}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n {picker || Picker}\n </Popover>\n </>\n );\n\n const orderedRefs: RefObject<HTMLInputElement>[] = [];\n\n const Comp = (\n <Flex\n as={StyledDateInput}\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) orderedRefs[0].current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n onPaste={onPaste}\n >\n {getDateFormat(locale).map(part => {\n switch (part) {\n case 'DD':\n orderedRefs.push(dayInputRef);\n return DayInput;\n case 'MM':\n orderedRefs.push(monthInputRef);\n return MonthInput;\n case 'YYYY':\n orderedRefs.push(yearInputRef);\n return YearInput;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && PickerButton}\n </Flex>\n );\n\n useEffect(() => {\n if (autoFocus) orderedRefs[0].current?.focus();\n }, [autoFocus]);\n\n useAutoFocusNextInput(orderedRefs);\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default DateInput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AC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,qBACI,EAAE,EACnB,OAAO,EAAC,QAAQ,KACZ;YACF,KAAK;YACL,WAAW;YACX,EAAE;YACF,IAAI;YACJ,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,mBAAmB;YACnB,cAAc;SACf,EACD,GAAG,EAAE,GAAG,YAEP,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n ClipboardEvent,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useRef,\n RefObject,\n Dispatch,\n SetStateAction,\n useImperativeHandle,\n useEffect,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { useConfiguration, useFocusWithin, useI18n } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as timesIcon from '../../Icon/icons/times.icon';\nimport * as calendarIcon from '../../Icon/icons/calendar.icon';\nimport DatePicker from '../Picker/DatePicker';\nimport type DatePickerProps from '../Picker/DatePicker.types';\nimport Popover from '../../Popover';\nimport { FormControlProps, StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n getDateFormat,\n parsePastedTextToDate,\n parseToDate,\n validateDate,\n generatePickerButtonAriaLabel\n} from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\n\nregisterIcon(timesIcon, calendarIcon);\n\nexport interface DateInputProps extends DateTimeProps {\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n /** Changes default date picker */\n picker?: {\n renderer: ComponentType;\n rendererProps?: Partial<DatePickerProps> & ForwardProps;\n };\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n}\n\nexport interface DateInputRefObject {\n readonly value: Date | undefined;\n setOpen: Dispatch<SetStateAction<boolean>>;\n buttonEl: HTMLElement | null;\n}\n\nexport const StyledDateInput = styled(StyledDateTime)<DateInputProps>`\n padding-inline-end: 0;\n`;\n\nStyledDateInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n if (!validateDate(year, monthIndex + 1, day)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCFullYear(year, monthIndex, day);\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\nconst DateInput: FunctionComponent<DateInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<DateInputProps>, ref: Ref<DateInputRefObject>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n info = getDateFormat(locale).join(''),\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n onResolveSuggestion,\n showWeekNumber,\n picker: { renderer: PickerComp = DatePicker, rendererProps = {} } = {},\n autoFocus,\n additionalInfo,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [yearInputRef, monthInputRef, dayInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n const pickParts = () => {\n const month = monthInputRef.current?.value\n ? (Number(monthInputRef.current.value) - 1).toString()\n : undefined;\n return [\n yearInputRef.current?.value || undefined,\n month,\n dayInputRef.current?.value || undefined\n ];\n };\n\n const currentlySelectedDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const [year, monthIndex, day] = parts.map(Number);\n\n return validateDate(year, monthIndex + 1, day)\n ? new Date(Date.UTC(year, monthIndex, day))\n : undefined;\n }\n };\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n setOpen(false);\n }\n };\n\n const onInputChange = () => {\n onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), pickParts()));\n buttonEl?.setAttribute(\n 'aria-label',\n generatePickerButtonAriaLabel(currentlySelectedDate(), 'date', locale, t, open)\n );\n };\n\n const setInputValue = (newValue: Date) => {\n dayInputRef.current!.value = newValue.getUTCDate().toString().padStart(2, '0');\n monthInputRef.current!.value = (newValue.getUTCMonth() + 1).toString().padStart(2, '0');\n yearInputRef.current!.value = newValue.getUTCFullYear().toString();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n const text = e.clipboardData.getData('text');\n const newDate = parsePastedTextToDate(text, locale, date || new Date());\n if (newDate) {\n e.preventDefault();\n setInputValue(newDate);\n onInputChange();\n }\n };\n\n const displayNames = new Intl.DisplayNames(locale, { style: 'long', type: 'dateTimeField' });\n\n const DayInput = (\n <PartInput\n key='day'\n placeholder={t('day_placeholder')}\n aria-label={displayNames.of('day')}\n value={date?.getUTCDate()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={31}\n ref={dayInputRef}\n />\n );\n\n const MonthInput = (\n <PartInput\n key='month'\n placeholder={t('month_placeholder')}\n aria-label={displayNames.of('month')}\n value={date ? date?.getUTCMonth() + 1 : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={1}\n max={12}\n ref={monthInputRef}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={displayNames.of('year')}\n value={date?.getUTCFullYear()}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n readOnly={readOnly}\n min={1}\n ref={yearInputRef}\n />\n );\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n useImperativeHandle(ref, () => ({\n setOpen,\n buttonEl,\n get value() {\n return currentlySelectedDate();\n }\n }));\n\n const PickerButton = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={generatePickerButtonAriaLabel(\n currentlySelectedDate(),\n 'date',\n locale,\n t,\n open\n )}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n {open && (\n <Popover\n ref={setPopoverRef}\n target={buttonEl}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n <PickerComp\n selected={currentlySelectedDate()}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n {...rendererProps}\n onChange={selected => {\n setInputValue(selected);\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n rendererProps?.onChange?.(selected);\n }}\n />\n </Popover>\n )}\n </>\n );\n\n const orderedRefs: RefObject<HTMLInputElement>[] = [];\n\n const Comp = (\n <Flex\n as={StyledDateInput}\n forwardedAs={StyledFormControl}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\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) orderedRefs[0].current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n onPaste={onPaste}\n >\n {getDateFormat(locale).map(part => {\n switch (part) {\n case 'DD':\n orderedRefs.push(dayInputRef);\n return DayInput;\n case 'MM':\n orderedRefs.push(monthInputRef);\n return MonthInput;\n case 'YYYY':\n orderedRefs.push(yearInputRef);\n return YearInput;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && PickerButton}\n </Flex>\n );\n\n useEffect(() => {\n if (autoFocus) orderedRefs[0].current?.focus();\n }, [autoFocus]);\n\n useAutoFocusNextInput(orderedRefs);\n\n return label ? (\n <FormField\n as='fieldset'\n aria-labelledby={id}\n labelAs='legend'\n {...{\n label,\n labelHidden,\n id,\n info,\n status,\n required,\n disabled,\n onResolveSuggestion,\n additionalInfo\n }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default DateInput;\n"]}
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../../types';
|
|
3
3
|
import { FormControlProps } from '../../FormControl';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import type { DateRangeCallbackParameter, DateTimeProperties } from '../DateTime.types';
|
|
5
|
+
import DateTimeProps from '../DateTime.types';
|
|
6
6
|
export interface DateRangeInputProps extends DateTimeProperties {
|
|
7
|
+
/** Object of range boundaries. */
|
|
8
|
+
value?: {
|
|
9
|
+
start?: DateTimeProps['value'];
|
|
10
|
+
end?: DateTimeProps['value'];
|
|
11
|
+
};
|
|
7
12
|
/**
|
|
8
13
|
* Display additional column with week number in date picker popover.
|
|
9
14
|
* @default false
|
|
10
15
|
*/
|
|
11
16
|
showWeekNumber?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Date as ISO8601 string, timestamp or native Date object. Requires onChange prop to update value for controlled inputs.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
fromValue?: string | number | Date;
|
|
25
|
-
/**
|
|
26
|
-
* Date as ISO8601 string, timestamp or native Date object. Requires onChange prop to update value for controlled inputs.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
toValue?: string | number | Date;
|
|
17
|
+
/** Pass a string or a fragment with an Icon and string for first part of DataRangeInput. */
|
|
18
|
+
fromLabel?: FormControlProps['label'];
|
|
19
|
+
/** Pass a string or a fragment with an Icon and string for second part of DataRangeInput. */
|
|
20
|
+
toLabel?: FormControlProps['label'];
|
|
21
|
+
/** Pass an object with "heading" and "content" properties to show AdditionalInfo for second part of DataRangeInput. */
|
|
22
|
+
toAdditionalInfo?: FormControlProps['additionalInfo'];
|
|
23
|
+
/** Pass an object with "heading" and "content" properties to show AdditionalInfo for first part of DataRangeInput. */
|
|
24
|
+
fromAdditionalInfo?: FormControlProps['additionalInfo'];
|
|
30
25
|
/** Callback fired when input value changes. */
|
|
31
|
-
onChange
|
|
26
|
+
onChange: (value: DateRangeCallbackParameter) => void;
|
|
32
27
|
/** Callback fired when the component gets focused. */
|
|
33
|
-
onFocus?: (value:
|
|
28
|
+
onFocus?: (value: DateRangeCallbackParameter) => void;
|
|
34
29
|
/** Callback fired when the component loses focus. */
|
|
35
|
-
onBlur?: (value:
|
|
30
|
+
onBlur?: (value: DateRangeCallbackParameter) => void;
|
|
36
31
|
/** Automatically focuses the input on render. */
|
|
37
32
|
autoFocus?: boolean;
|
|
38
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateRangeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAA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ED,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAwLzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, forwardRef, useCallback, useReducer } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { useConsolidatedRef,
|
|
4
|
+
import { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';
|
|
5
5
|
import { defaultThemeProp } from '../../../theme';
|
|
6
6
|
import Flex from '../../Flex';
|
|
7
|
-
import { StyledFormField } from '../../FormField/FormField';
|
|
7
|
+
import FormField, { StyledFormField } from '../../FormField/FormField';
|
|
8
8
|
import DateRangePicker from '../Picker/DateRangePicker';
|
|
9
|
-
import
|
|
9
|
+
import { StyledRangeInputContainer } from '../../Input/Input.styles';
|
|
10
10
|
import DateInput from './DateInput';
|
|
11
11
|
import { parseToDate } from './utils';
|
|
12
12
|
import StyledDateInput from './DateTime.styles';
|
|
13
13
|
const StyledDateRangeInput = styled.div(props => {
|
|
14
14
|
const { theme: { components: { input } } } = props;
|
|
15
|
-
const { start, end } = useDirection();
|
|
16
15
|
return css `
|
|
17
16
|
border: 0;
|
|
18
17
|
min-width: min-content;
|
|
19
|
-
|
|
20
|
-
min-width: 50%;
|
|
21
|
-
}
|
|
18
|
+
|
|
22
19
|
${StyledFormField} {
|
|
23
|
-
&:first-child > ${StyledDateInput} {
|
|
24
|
-
border-top-${end}-radius: 0;
|
|
25
|
-
border-bottom-${end}-radius: 0;
|
|
26
|
-
}
|
|
27
20
|
&:last-child > ${StyledDateInput} {
|
|
28
|
-
border-top-${start}-radius: 0;
|
|
29
|
-
border-bottom-${start}-radius: 0;
|
|
30
21
|
margin-inline-start: -${input['border-width']};
|
|
31
22
|
}
|
|
23
|
+
& legend {
|
|
24
|
+
align-self: center;
|
|
25
|
+
}
|
|
32
26
|
&:focus,
|
|
33
27
|
&:hover,
|
|
34
28
|
&:focus-within {
|
|
@@ -38,30 +32,24 @@ const StyledDateRangeInput = styled.div(props => {
|
|
|
38
32
|
`;
|
|
39
33
|
});
|
|
40
34
|
StyledDateRangeInput.defaultProps = defaultThemeProp;
|
|
41
|
-
const convertStateToCallbackParam = (v) => {
|
|
42
|
-
return {
|
|
43
|
-
valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),
|
|
44
|
-
valueAsTimestamp: v
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
const convertToCallbackParameter = (state) => {
|
|
48
|
-
return {
|
|
49
|
-
start: convertStateToCallbackParam(state[0]),
|
|
50
|
-
end: convertStateToCallbackParam(state[1])
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
35
|
const reducer = (prevState, action) => {
|
|
54
36
|
switch (action.type) {
|
|
55
37
|
case 'start': {
|
|
56
|
-
return
|
|
38
|
+
return { ...prevState, start: action.value };
|
|
57
39
|
}
|
|
58
40
|
case 'end': {
|
|
59
|
-
return
|
|
41
|
+
return { ...prevState, end: action.value };
|
|
60
42
|
}
|
|
61
43
|
default:
|
|
62
44
|
return prevState;
|
|
63
45
|
}
|
|
64
46
|
};
|
|
47
|
+
const convertToCallbackParameter = (v) => {
|
|
48
|
+
return {
|
|
49
|
+
valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),
|
|
50
|
+
valueAsTimestamp: v
|
|
51
|
+
};
|
|
52
|
+
};
|
|
65
53
|
const getSelected = (first, second) => {
|
|
66
54
|
const selected = first ?? second;
|
|
67
55
|
return selected ? parseToDate(selected) : undefined;
|
|
@@ -69,86 +57,113 @@ const getSelected = (first, second) => {
|
|
|
69
57
|
const parseValueToDate = (value) => {
|
|
70
58
|
return value ? parseToDate(value) : undefined;
|
|
71
59
|
};
|
|
72
|
-
const DateRangeInput = forwardRef((
|
|
73
|
-
const
|
|
74
|
-
const [state, dispatch] = useReducer(reducer, [
|
|
75
|
-
parseValueToDate(fromValue)?.getTime(),
|
|
76
|
-
parseValueToDate(toValue)?.getTime()
|
|
77
|
-
]);
|
|
60
|
+
const DateRangeInput = forwardRef(({ value = {}, min, max, label, fromLabel, toLabel, labelHidden, status, required, readOnly, disabled, onChange, onFocus, onBlur, showWeekNumber, autoFocus, fromAdditionalInfo, toAdditionalInfo, ...restProps }, ref) => {
|
|
61
|
+
const t = useI18n();
|
|
78
62
|
const startDateInputRef = useRef(null);
|
|
79
63
|
const endDateInputRef = useRef(null);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
const [state, dispatch] = useReducer(reducer, {
|
|
65
|
+
start: value.start ? parseToDate(value.start).getTime() : undefined,
|
|
66
|
+
end: value.end ? parseToDate(value.end).getTime() : undefined
|
|
67
|
+
});
|
|
68
|
+
// Need to keep the value in ref also, to be able to call onBlur with newest value
|
|
69
|
+
const startDateRef = useRef(state.start);
|
|
70
|
+
const endDateRef = useRef(state.end);
|
|
83
71
|
const onFocusChange = useCallback((focused) => {
|
|
84
|
-
(focused ? onFocus : onBlur)?.(
|
|
85
|
-
|
|
72
|
+
(focused ? onFocus : onBlur)?.({
|
|
73
|
+
start: convertToCallbackParameter(startDateRef.current),
|
|
74
|
+
end: convertToCallbackParameter(endDateRef.current)
|
|
75
|
+
});
|
|
76
|
+
}, [onFocus, onBlur]);
|
|
86
77
|
const containerRef = useConsolidatedRef(ref);
|
|
87
78
|
useFocusWithin([containerRef], onFocusChange);
|
|
88
79
|
const onStartDateChange = (selectedDate) => {
|
|
89
|
-
if (state
|
|
90
|
-
dispatch({ type: 'start', value: state
|
|
80
|
+
if (state.end && selectedDate && selectedDate.getTime() > state.end) {
|
|
81
|
+
dispatch({ type: 'start', value: state.end });
|
|
91
82
|
dispatch({ type: 'end', value: selectedDate.getTime() });
|
|
83
|
+
onChange({
|
|
84
|
+
start: convertToCallbackParameter(state.start),
|
|
85
|
+
end: convertToCallbackParameter(state.end)
|
|
86
|
+
});
|
|
92
87
|
}
|
|
93
88
|
else {
|
|
94
|
-
dispatch({ type: 'start', value: selectedDate
|
|
89
|
+
dispatch({ type: 'start', value: selectedDate?.getTime() });
|
|
90
|
+
onChange({
|
|
91
|
+
start: convertToCallbackParameter(selectedDate?.getTime()),
|
|
92
|
+
end: convertToCallbackParameter(state.end)
|
|
93
|
+
});
|
|
95
94
|
}
|
|
96
|
-
|
|
95
|
+
startDateRef.current = state.start;
|
|
96
|
+
endDateRef.current = state.end;
|
|
97
97
|
endDateInputRef.current?.setOpen(true);
|
|
98
98
|
};
|
|
99
99
|
const onEndDateChange = (selectedDate) => {
|
|
100
|
-
if (state
|
|
100
|
+
if (state.start && selectedDate && selectedDate.getTime() < state.start) {
|
|
101
|
+
dispatch({ type: 'end', value: state.start });
|
|
101
102
|
dispatch({ type: 'start', value: selectedDate.getTime() });
|
|
102
|
-
|
|
103
|
+
onChange({
|
|
104
|
+
start: convertToCallbackParameter(state.start),
|
|
105
|
+
end: convertToCallbackParameter(state.end)
|
|
106
|
+
});
|
|
103
107
|
}
|
|
104
108
|
else {
|
|
105
|
-
dispatch({ type: 'end', value: selectedDate
|
|
109
|
+
dispatch({ type: 'end', value: selectedDate?.getTime() });
|
|
110
|
+
onChange({
|
|
111
|
+
start: convertToCallbackParameter(state.start),
|
|
112
|
+
end: convertToCallbackParameter(selectedDate?.getTime())
|
|
113
|
+
});
|
|
106
114
|
}
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
startDateRef.current = state.start;
|
|
116
|
+
endDateRef.current = state.end;
|
|
109
117
|
};
|
|
110
118
|
const getSelectedRange = () => {
|
|
111
|
-
const startDate = parseValueToDate(state
|
|
112
|
-
const endDate = parseValueToDate(state
|
|
119
|
+
const startDate = parseValueToDate(state.start);
|
|
120
|
+
const endDate = parseValueToDate(state.end);
|
|
113
121
|
if (startDate && endDate && startDate > endDate)
|
|
114
122
|
return undefined;
|
|
115
123
|
return {
|
|
116
|
-
startDate
|
|
117
|
-
endDate
|
|
124
|
+
startDate,
|
|
125
|
+
endDate
|
|
118
126
|
};
|
|
119
127
|
};
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
required,
|
|
128
|
-
readOnly,
|
|
129
|
-
disabled,
|
|
130
|
-
min,
|
|
131
|
-
max,
|
|
132
|
-
status,
|
|
133
|
-
autoFocus
|
|
134
|
-
},
|
|
135
|
-
info: props.info
|
|
136
|
-
};
|
|
137
|
-
const toProps = {
|
|
138
|
-
value: state[1],
|
|
139
|
-
label: toLabel,
|
|
140
|
-
labelHidden,
|
|
141
|
-
...{
|
|
142
|
-
required,
|
|
143
|
-
readOnly,
|
|
144
|
-
disabled,
|
|
145
|
-
min,
|
|
146
|
-
max,
|
|
147
|
-
status
|
|
148
|
-
},
|
|
149
|
-
info: props.info
|
|
128
|
+
const commonProps = {
|
|
129
|
+
required,
|
|
130
|
+
readOnly,
|
|
131
|
+
disabled,
|
|
132
|
+
min,
|
|
133
|
+
max,
|
|
134
|
+
status
|
|
150
135
|
};
|
|
151
|
-
return (
|
|
136
|
+
return (_jsx(FormField, { as: StyledDateRangeInput, ...restProps, ref: containerRef, container: { wrap: 'nowrap' }, labelHidden: labelHidden, label: label, labelAs: 'legend', required: required, readOnly: readOnly, status: status, disabled: disabled, children: _jsxs(Flex, { container: true, as: StyledRangeInputContainer, children: [_jsx(DateInput, { ...commonProps, value: state.start, ref: startDateInputRef, picker: {
|
|
137
|
+
renderer: DateRangePicker,
|
|
138
|
+
rendererProps: {
|
|
139
|
+
selected: getSelected(state.start, state.end),
|
|
140
|
+
selectedRange: getSelectedRange(),
|
|
141
|
+
onChange: onStartDateChange
|
|
142
|
+
}
|
|
143
|
+
}, onBlur: changedValue => {
|
|
144
|
+
if (!changedValue.state)
|
|
145
|
+
dispatch({ type: 'start', value: changedValue.valueAsTimestamp });
|
|
146
|
+
startDateRef.current = changedValue.valueAsTimestamp;
|
|
147
|
+
onChange({
|
|
148
|
+
start: changedValue,
|
|
149
|
+
end: convertToCallbackParameter(state.end)
|
|
150
|
+
});
|
|
151
|
+
}, additionalInfo: fromAdditionalInfo, label: fromLabel, "aria-label": `${t('range_from_datetime') + (label ? ` - ${label}` : '')}`, autoFocus: autoFocus }), _jsx(DateInput, { ...commonProps, value: state.end, ref: endDateInputRef, picker: {
|
|
152
|
+
renderer: DateRangePicker,
|
|
153
|
+
rendererProps: {
|
|
154
|
+
selected: getSelected(state.end, state.start),
|
|
155
|
+
selectedRange: getSelectedRange(),
|
|
156
|
+
onChange: onEndDateChange
|
|
157
|
+
}
|
|
158
|
+
}, onBlur: changedValue => {
|
|
159
|
+
if (!changedValue.state)
|
|
160
|
+
dispatch({ type: 'end', value: changedValue.valueAsTimestamp });
|
|
161
|
+
endDateRef.current = changedValue.valueAsTimestamp;
|
|
162
|
+
onChange({
|
|
163
|
+
start: convertToCallbackParameter(state.start),
|
|
164
|
+
end: changedValue
|
|
165
|
+
});
|
|
166
|
+
}, additionalInfo: toAdditionalInfo, label: toLabel, "aria-label": `${t('range_to_datetime') + (label ? ` - ${label}` : '')}` })] }) }));
|
|
152
167
|
});
|
|
153
168
|
export default DateRangeInput;
|
|
154
169
|
//# sourceMappingURL=DateRangeInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateRangeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,SAAS,EACT,MAAM,EACN,UAAU,EAGV,UAAU,EACV,WAAW,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,IA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KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACf,KAAK,EAAE,SAAS;QAChB,WAAW;QACX,GAAG;YACD,QAAQ;YACR,QAAQ;YACR,QAAQ;YACR,GAAG;YACH,GAAG;YACH,MAAM;YACN,SAAS;SACV;QACD,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACf,KAAK,EAAE,OAAO;QACd,WAAW;QACX,GAAG;YACD,QAAQ;YACR,QAAQ;YACR,QAAQ;YACR,GAAG;YACH,GAAG;YACH,MAAM;SACP;QACD,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IAEF,OAAO,CACL,MAAC,IAAI,IACH,EAAE,EAAE,oBAAoB,EACxB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KACzB,SAAS,EACb,GAAG,EAAE,YAAY,aAEjB,KAAC,SAAS,OACJ,SAAS,EACb,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,YAAY,CAAC,EAAE,CACvB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC,GAEnE,EACF,KAAC,SAAS,OACJ,OAAO,EACX,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC,GACzF,IACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n FunctionComponent,\n useEffect,\n useRef,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useReducer,\n useCallback\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useConsolidatedRef, useDirection, useFocusWithin } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport { FormControlProps } from '../../FormControl';\nimport Flex from '../../Flex';\nimport { StyledFormField } from '../../FormField/FormField';\nimport { DateRangeCallbackValue, DateTimeCallbackValue } from '../types';\nimport DateRangePicker from '../Picker/DateRangePicker';\nimport DatePicker from '../Picker/DatePicker';\nimport type { DateTimeProperties } from '../DateTime.types';\n\nimport DateInput, { DateInputRefObject } from './DateInput';\nimport { parseToDate } from './utils';\nimport StyledDateInput from './DateTime.styles';\n\nexport interface DateRangeInputProps extends DateTimeProperties {\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n\n /**\n * Pass a string or a fragment with an Icon and string for first part of DataRangeInput.\n */\n fromLabel: FormControlProps['label'];\n\n /**\n * Pass a string or a fragment with an Icon and string for second part of DataRangeInput.\n */\n toLabel: FormControlProps['label'];\n\n /**\n * Date as ISO8601 string, timestamp or native Date object. Requires onChange prop to update value for controlled inputs.\n *\n */\n fromValue?: string | number | Date;\n\n /**\n * Date as ISO8601 string, timestamp or native Date object. Requires onChange prop to update value for controlled inputs.\n *\n */\n toValue?: string | number | Date;\n /** Callback fired when input value changes. */\n onChange?: (value: DateRangeCallbackValue) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateRangeCallbackValue) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateRangeCallbackValue) => void;\n /** Automatically focuses the input on render. */\n autoFocus?: boolean;\n}\n\nconst StyledDateRangeInput = styled.div<DateRangeInputProps>(props => {\n const {\n theme: {\n components: { input }\n }\n } = props;\n\n const { start, end } = useDirection();\n\n return css`\n border: 0;\n min-width: min-content;\n ${StyledDateInput} {\n min-width: 50%;\n }\n ${StyledFormField} {\n &:first-child > ${StyledDateInput} {\n border-top-${end}-radius: 0;\n border-bottom-${end}-radius: 0;\n }\n &:last-child > ${StyledDateInput} {\n border-top-${start}-radius: 0;\n border-bottom-${start}-radius: 0;\n margin-inline-start: -${input['border-width']};\n }\n &:focus,\n &:hover,\n &:focus-within {\n z-index: 2;\n }\n }\n `;\n});\n\nStyledDateRangeInput.defaultProps = defaultThemeProp;\n\ntype DateRepresentable = string | number | Date;\n\ntype State = [start?: number, end?: number];\n\nconst convertStateToCallbackParam = (v?: number): DateTimeCallbackValue => {\n return {\n valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),\n valueAsTimestamp: v\n };\n};\n\nconst convertToCallbackParameter = (state: State) => {\n return {\n start: convertStateToCallbackParam(state[0]),\n end: convertStateToCallbackParam(state[1])\n };\n};\n\ntype DateRangeAction = { type: 'start' | 'end'; value?: number };\n\nconst reducer = (prevState: State, action: DateRangeAction): State => {\n switch (action.type) {\n case 'start': {\n return [action.value, prevState[1]];\n }\n case 'end': {\n return [prevState[0], action.value];\n }\n default:\n return prevState;\n }\n};\n\nconst getSelected = (first: number | undefined, second: number | undefined) => {\n const selected = first ?? second;\n return selected ? parseToDate(selected) : undefined;\n};\n\nconst parseValueToDate = (value: DateRepresentable | undefined) => {\n return value ? parseToDate(value) : undefined;\n};\n\nconst DateRangeInput: FunctionComponent<DateRangeInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<DateRangeInputProps>, ref: Ref<HTMLDivElement>) => {\n const {\n fromValue,\n toValue,\n min,\n max,\n fromLabel,\n toLabel,\n labelHidden,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n showWeekNumber,\n autoFocus,\n ...restProps\n } = props;\n\n const [state, dispatch] = useReducer(reducer, [\n parseValueToDate(fromValue)?.getTime(),\n parseValueToDate(toValue)?.getTime()\n ]);\n\n const startDateInputRef = useRef<DateInputRefObject>(null);\n const endDateInputRef = useRef<DateInputRefObject>(null);\n\n useEffect(() => {\n onChange?.(convertToCallbackParameter(state));\n }, [state[0], state[1]]);\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n (focused ? onFocus : onBlur)?.(convertToCallbackParameter(state));\n },\n [onFocus, onBlur, state]\n );\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const onStartDateChange = (selectedDate: Date) => {\n if (state[1] && selectedDate.getTime() > state[1]) {\n dispatch({ type: 'start', value: state[1] });\n dispatch({ type: 'end', value: selectedDate.getTime() });\n } else {\n dispatch({ type: 'start', value: selectedDate.getTime() });\n }\n startDateInputRef.current?.setOpen(false);\n endDateInputRef.current?.setOpen(true);\n };\n\n const onEndDateChange = (selectedDate: Date) => {\n if (state[0] && selectedDate.getTime() < state[0]) {\n dispatch({ type: 'start', value: selectedDate.getTime() });\n dispatch({ type: 'end', value: state[0] });\n } else {\n dispatch({ type: 'end', value: selectedDate.getTime() });\n }\n endDateInputRef.current?.setOpen(false);\n endDateInputRef.current?.buttonEl?.focus();\n };\n\n const getSelectedRange = () => {\n const startDate = parseValueToDate(state[0]);\n const endDate = parseValueToDate(state[1]);\n\n if (startDate && endDate && startDate > endDate) return undefined;\n\n return {\n startDate: startDate ? parseValueToDate(startDate) : undefined,\n endDate: endDate ? parseValueToDate(endDate) : undefined\n };\n };\n\n const startPicker = !(state[0] && !state[1]) ? (\n <DateRangePicker\n selected={getSelected(state[0], state[1])}\n selectedRange={getSelectedRange()}\n onChange={onStartDateChange}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n ) : (\n <DatePicker\n selected={parseValueToDate(state[0])}\n onChange={onStartDateChange}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n );\n\n const endPicker = !(!state[0] && state[1]) ? (\n <DateRangePicker\n selected={getSelected(state[1], state[0])}\n selectedRange={getSelectedRange()}\n onChange={onEndDateChange}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n ) : (\n <DatePicker\n selected={parseValueToDate(state[1])}\n onChange={onEndDateChange}\n min={min}\n max={max}\n showWeekNumber={showWeekNumber}\n />\n );\n\n const fromProps = {\n value: state[0],\n label: fromLabel,\n labelHidden,\n ...{\n required,\n readOnly,\n disabled,\n min,\n max,\n status,\n autoFocus\n },\n info: props.info\n };\n\n const toProps = {\n value: state[1],\n label: toLabel,\n labelHidden,\n ...{\n required,\n readOnly,\n disabled,\n min,\n max,\n status\n },\n info: props.info\n };\n\n return (\n <Flex\n as={StyledDateRangeInput}\n container={{ wrap: 'nowrap' }}\n {...restProps}\n ref={containerRef}\n >\n <DateInput\n {...fromProps}\n ref={startDateInputRef}\n picker={startPicker}\n onChange={changedValue =>\n dispatch({ type: 'start', value: changedValue.valueAsTimestamp })\n }\n />\n <DateInput\n {...toProps}\n ref={endDateInputRef}\n picker={endPicker}\n onChange={changedValue => dispatch({ type: 'end', value: changedValue.valueAsTimestamp })}\n />\n </Flex>\n );\n }\n);\n\nexport default DateRangeInput;\n"]}
|
|
1
|
+
{"version":3,"file":"DateRangeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateRangeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,UAAU,EAGV,WAAW,EACX,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAMxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,OAAO,SAAiC,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AA4BhD,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAsB,KAAK,CAAC,E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KAAK,EAAE,SAAS,gBACJ,GAAG,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACxE,SAAS,EAAE,SAAS,GACpB,EACF,KAAC,SAAS,OACJ,WAAW,EACf,KAAK,EAAE,KAAK,CAAC,GAAG,EAChB,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE;wBACN,QAAQ,EAAE,eAAe;wBACzB,aAAa,EAAE;4BACb,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;4BAC7C,aAAa,EAAE,gBAAgB,EAAE;4BACjC,QAAQ,EAAE,eAAe;yBAC1B;qBACF,EACD,MAAM,EAAE,YAAY,CAAC,EAAE;wBACrB,IAAI,CAAC,YAAY,CAAC,KAAK;4BACrB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;wBAElE,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC,gBAAgB,CAAC;wBACnD,QAAQ,CAAC;4BACP,KAAK,EAAE,0BAA0B,CAAC,KAAK,CAAC,KAAK,CAAC;4BAC9C,GAAG,EAAE,YAAY;yBAClB,CAAC,CAAC;oBACL,CAAC,EACD,cAAc,EAAE,gBAAgB,EAChC,KAAK,EAAE,OAAO,gBACF,GAAG,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GACtE,IACG,GACG,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n FunctionComponent,\n useRef,\n forwardRef,\n PropsWithoutRef,\n Ref,\n useCallback,\n useReducer\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { ForwardProps } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport { FormControlProps } from '../../FormControl';\nimport Flex from '../../Flex';\nimport FormField, { StyledFormField } from '../../FormField/FormField';\nimport DateRangePicker from '../Picker/DateRangePicker';\nimport type {\n DateRangeCallbackParameter,\n DateTimeCallbackParameter,\n DateTimeProperties\n} from '../DateTime.types';\nimport { StyledRangeInputContainer } from '../../Input/Input.styles';\nimport DateTimeProps from '../DateTime.types';\n\nimport DateInput, { DateInputRefObject } from './DateInput';\nimport { parseToDate } from './utils';\nimport StyledDateInput from './DateTime.styles';\n\nexport interface DateRangeInputProps extends DateTimeProperties {\n /** Object of range boundaries. */\n value?: { start?: DateTimeProps['value']; end?: DateTimeProps['value'] };\n /**\n * Display additional column with week number in date picker popover.\n * @default false\n */\n showWeekNumber?: boolean;\n /** Pass a string or a fragment with an Icon and string for first part of DataRangeInput. */\n fromLabel?: FormControlProps['label'];\n /** Pass a string or a fragment with an Icon and string for second part of DataRangeInput. */\n toLabel?: FormControlProps['label'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for second part of DataRangeInput. */\n toAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for first part of DataRangeInput. */\n fromAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Callback fired when input value changes. */\n onChange: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateRangeCallbackParameter) => void;\n /** Automatically focuses the input on render. */\n autoFocus?: boolean;\n}\n\nconst StyledDateRangeInput = styled.div<DateRangeInputProps>(props => {\n const {\n theme: {\n components: { input }\n }\n } = props;\n\n return css`\n border: 0;\n min-width: min-content;\n\n ${StyledFormField} {\n &:last-child > ${StyledDateInput} {\n margin-inline-start: -${input['border-width']};\n }\n & legend {\n align-self: center;\n }\n &:focus,\n &:hover,\n &:focus-within {\n z-index: 2;\n }\n }\n `;\n});\n\nStyledDateRangeInput.defaultProps = defaultThemeProp;\n\ntype DateRepresentable = string | number | Date;\n\ntype DateRangeAction = { type: 'start' | 'end'; value?: number };\ntype State = { start?: number; end?: number };\n\nconst reducer = (prevState: State, action: DateRangeAction): State => {\n switch (action.type) {\n case 'start': {\n return { ...prevState, start: action.value };\n }\n case 'end': {\n return { ...prevState, end: action.value };\n }\n default:\n return prevState;\n }\n};\n\nconst convertToCallbackParameter = (v?: number): DateTimeCallbackParameter => {\n return {\n valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),\n valueAsTimestamp: v\n };\n};\n\nconst getSelected = (first: number | undefined, second: number | undefined) => {\n const selected = first ?? second;\n return selected ? parseToDate(selected) : undefined;\n};\n\nconst parseValueToDate = (value: DateRepresentable | undefined) => {\n return value ? parseToDate(value) : undefined;\n};\n\nconst DateRangeInput: FunctionComponent<DateRangeInputProps & ForwardProps> = forwardRef(\n (\n {\n value = {},\n min,\n max,\n label,\n fromLabel,\n toLabel,\n labelHidden,\n status,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n showWeekNumber,\n autoFocus,\n fromAdditionalInfo,\n toAdditionalInfo,\n ...restProps\n }: PropsWithoutRef<DateRangeInputProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const t = useI18n();\n\n const startDateInputRef = useRef<DateInputRefObject>(null);\n const endDateInputRef = useRef<DateInputRefObject>(null);\n\n const [state, dispatch] = useReducer(reducer, {\n start: value.start ? parseToDate(value.start).getTime() : undefined,\n end: value.end ? parseToDate(value.end).getTime() : undefined\n });\n\n // Need to keep the value in ref also, to be able to call onBlur with newest value\n const startDateRef = useRef(state.start);\n const endDateRef = useRef(state.end);\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n (focused ? onFocus : onBlur)?.({\n start: convertToCallbackParameter(startDateRef.current),\n end: convertToCallbackParameter(endDateRef.current)\n });\n },\n [onFocus, onBlur]\n );\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const onStartDateChange = (selectedDate?: Date) => {\n if (state.end && selectedDate && selectedDate.getTime() > state.end) {\n dispatch({ type: 'start', value: state.end });\n dispatch({ type: 'end', value: selectedDate.getTime() });\n onChange({\n start: convertToCallbackParameter(state.start),\n end: convertToCallbackParameter(state.end)\n });\n } else {\n dispatch({ type: 'start', value: selectedDate?.getTime() });\n onChange({\n start: convertToCallbackParameter(selectedDate?.getTime()),\n end: convertToCallbackParameter(state.end)\n });\n }\n startDateRef.current = state.start;\n endDateRef.current = state.end;\n endDateInputRef.current?.setOpen(true);\n };\n\n const onEndDateChange = (selectedDate?: Date) => {\n if (state.start && selectedDate && selectedDate.getTime() < state.start) {\n dispatch({ type: 'end', value: state.start });\n dispatch({ type: 'start', value: selectedDate.getTime() });\n onChange({\n start: convertToCallbackParameter(state.start),\n end: convertToCallbackParameter(state.end)\n });\n } else {\n dispatch({ type: 'end', value: selectedDate?.getTime() });\n onChange({\n start: convertToCallbackParameter(state.start),\n end: convertToCallbackParameter(selectedDate?.getTime())\n });\n }\n startDateRef.current = state.start;\n endDateRef.current = state.end;\n };\n\n const getSelectedRange = () => {\n const startDate = parseValueToDate(state.start);\n const endDate = parseValueToDate(state.end);\n\n if (startDate && endDate && startDate > endDate) return undefined;\n\n return {\n startDate,\n endDate\n };\n };\n\n const commonProps = {\n required,\n readOnly,\n disabled,\n min,\n max,\n status\n };\n\n return (\n <FormField\n as={StyledDateRangeInput}\n {...restProps}\n ref={containerRef}\n container={{ wrap: 'nowrap' }}\n labelHidden={labelHidden}\n label={label}\n labelAs='legend'\n required={required}\n readOnly={readOnly}\n status={status}\n disabled={disabled}\n >\n <Flex container as={StyledRangeInputContainer}>\n <DateInput\n {...commonProps}\n value={state.start}\n ref={startDateInputRef}\n picker={{\n renderer: DateRangePicker,\n rendererProps: {\n selected: getSelected(state.start, state.end),\n selectedRange: getSelectedRange(),\n onChange: onStartDateChange\n }\n }}\n onBlur={changedValue => {\n if (!changedValue.state)\n dispatch({ type: 'start', value: changedValue.valueAsTimestamp });\n\n startDateRef.current = changedValue.valueAsTimestamp;\n onChange({\n start: changedValue,\n end: convertToCallbackParameter(state.end)\n });\n }}\n additionalInfo={fromAdditionalInfo}\n label={fromLabel}\n aria-label={`${t('range_from_datetime') + (label ? ` - ${label}` : '')}`}\n autoFocus={autoFocus}\n />\n <DateInput\n {...commonProps}\n value={state.end}\n ref={endDateInputRef}\n picker={{\n renderer: DateRangePicker,\n rendererProps: {\n selected: getSelected(state.end, state.start),\n selectedRange: getSelectedRange(),\n onChange: onEndDateChange\n }\n }}\n onBlur={changedValue => {\n if (!changedValue.state)\n dispatch({ type: 'end', value: changedValue.valueAsTimestamp });\n\n endDateRef.current = changedValue.valueAsTimestamp;\n onChange({\n start: convertToCallbackParameter(state.start),\n end: changedValue\n });\n }}\n additionalInfo={toAdditionalInfo}\n label={toLabel}\n aria-label={`${t('range_to_datetime') + (label ? ` - ${label}` : '')}`}\n />\n </Flex>\n </FormField>\n );\n }\n);\n\nexport default DateRangeInput;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../../types';
|
|
3
|
+
import { FormControlProps } from '../../FormControl';
|
|
3
4
|
import { MinuteInterval } from '../Picker/TimePicker';
|
|
4
5
|
import DateTimeProps from '../DateTime.types';
|
|
5
6
|
import { ClockFormat } from './utils';
|
|
@@ -23,6 +24,8 @@ export interface DateTimeInputProps extends DateTimeProps {
|
|
|
23
24
|
* Defines clock format that overrides locale based format.
|
|
24
25
|
*/
|
|
25
26
|
clockFormat?: ClockFormat;
|
|
27
|
+
/** Pass a heading and content to show additional information on the field. */
|
|
28
|
+
additionalInfo?: FormControlProps['additionalInfo'];
|
|
26
29
|
}
|
|
27
30
|
export declare const StyledDateTimeInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, DateTimeInputProps, never>;
|
|
28
31
|
declare const DateTimeInput: FunctionComponent<DateTimeInputProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateTimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/DateTimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AAWxE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EACL,WAAW,EASZ,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;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,mBAAmB,yHAe9B,CAAC;AAqFH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA+gBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|