@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
|
@@ -4,8 +4,9 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import Flex from '../../Flex';
|
|
5
5
|
import { defaultThemeProp } from '../../../theme';
|
|
6
6
|
import Text from '../../Text';
|
|
7
|
+
import { cap } from '../../../utils';
|
|
7
8
|
import { getDateOfISOWeek, getWeek, parseToDate, toUTCDateString } from '../Input/utils';
|
|
8
|
-
import { useConsolidatedRef, useFocusWithin
|
|
9
|
+
import { useConfiguration, useConsolidatedRef, useFocusWithin } from '../../../hooks';
|
|
9
10
|
import { CALENDAR_TYPES } from '../Input/local';
|
|
10
11
|
import { StyledColumnLabel, StyledPick } from './Calendar.styles';
|
|
11
12
|
import { getWeeksOfMonth } from './utils';
|
|
@@ -30,6 +31,7 @@ const StyledWeekNumber = styled(StyledPick)(props => {
|
|
|
30
31
|
StyledWeekNumber.defaultProps = defaultThemeProp;
|
|
31
32
|
const Weeks = forwardRef((props, ref) => {
|
|
32
33
|
const { selected, current = selected ? new Date(selected.getTime()) : new Date(), calendarType = CALENDAR_TYPES.ISO_8601, onSelect, onFocus, disabled = false, size = 'short' } = props;
|
|
34
|
+
const { locale } = useConfiguration();
|
|
33
35
|
const [focusedWeek, setFocusedWeek] = useState(current);
|
|
34
36
|
useLayoutEffect(() => {
|
|
35
37
|
setFocusedWeek(current);
|
|
@@ -73,8 +75,14 @@ const Weeks = forwardRef((props, ref) => {
|
|
|
73
75
|
return (toUTCDateString(day) ===
|
|
74
76
|
toUTCDateString(getDateOfISOWeek(getWeek(focusedWeek, calendarType), focusedWeek.getFullYear())));
|
|
75
77
|
};
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
+
const displayNames = new Intl.DisplayNames(locale, {
|
|
79
|
+
style: 'long',
|
|
80
|
+
type: 'dateTimeField'
|
|
81
|
+
});
|
|
82
|
+
const displayNamesShort = new Intl.DisplayNames(locale, {
|
|
83
|
+
style: 'short',
|
|
84
|
+
type: 'dateTimeField'
|
|
85
|
+
});
|
|
78
86
|
const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {
|
|
79
87
|
const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());
|
|
80
88
|
return (_jsxs(StyledWeekNumber, { variant: 'simple', icon: false, type: 'button', loading: false, ref: isFocused(dateOfISOWeek)
|
|
@@ -82,13 +90,13 @@ const Weeks = forwardRef((props, ref) => {
|
|
|
82
90
|
if (hasFocus)
|
|
83
91
|
focusedRef?.focus();
|
|
84
92
|
}
|
|
85
|
-
: undefined, tabIndex: isFocused(dateOfISOWeek) ? 0 : -1, disabled: isDisabled(dateOfISOWeek), "aria-selected": isChecked(dateOfISOWeek) || undefined, "aria-label": `${
|
|
93
|
+
: undefined, tabIndex: isFocused(dateOfISOWeek) ? 0 : -1, disabled: isDisabled(dateOfISOWeek), "aria-selected": isChecked(dateOfISOWeek) || undefined, "aria-label": `${displayNames.of('weekOfYear')} ${weekNo.toString()} ${current
|
|
86
94
|
.getUTCFullYear()
|
|
87
95
|
.toString()}`, onClick: () => {
|
|
88
96
|
onSelect?.(dateOfISOWeek);
|
|
89
|
-
}, children: [size === 'long' && `${
|
|
97
|
+
}, children: [size === 'long' && `${cap(displayNames.of('weekOfYear'))} `, weekNo.toString()] }, weekNo));
|
|
90
98
|
});
|
|
91
|
-
const label = size === 'short' ? (_jsx(Text, { as: StyledColumnLabel, forwardedAs: 'abbr', title:
|
|
99
|
+
const label = size === 'short' ? (_jsx(Text, { as: StyledColumnLabel, forwardedAs: 'abbr', title: cap(displayNames.of('weekOfYear')), children: cap(displayNamesShort.of('weekOfYear')) })) : (_jsx(Text, { as: StyledColumnLabel, children: cap(displayNames.of('weekOfYear')) }));
|
|
92
100
|
return (_jsxs(Flex, { as: StyledWeekNumbers, container: { direction: 'column' }, ref: containerRef, onKeyDown: onKeyDown, children: [label, weeks] }));
|
|
93
101
|
});
|
|
94
102
|
export default Weeks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Weeks.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/Weeks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EAEf,QAAQ,EACR,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,M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,CAAC,SAAS,EAEf,QAAQ,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3C,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,mBACpB,SAAS,CAAC,aAAa,CAAC,IAAI,SAAS,gBACxC,GAAG,CAAC,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,OAAO;iBAChE,cAAc,EAAE;iBAChB,QAAQ,EAAE,EAAE,EACf,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC;YAC5B,CAAC,aAEA,IAAI,KAAK,MAAM,IAAI,GAAG,QAAQ,GAAG,EACjC,MAAM,CAAC,QAAQ,EAAE,KAvBb,MAAM,CAwBM,CACpB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GACT,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CACjB,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,EAAC,KAAK,EAAE,QAAQ,YAC5D,CAAC,CAAC,iBAAiB,CAAC,GAChB,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,YAAG,QAAQ,GAAQ,CAC/C,CAAC;IAEJ,OAAO,CACL,MAAC,IAAI,IACH,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,aAEnB,KAAK,EACL,KAAK,IACD,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n FC,\n useLayoutEffect,\n KeyboardEvent,\n useState,\n forwardRef,\n PropsWithoutRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { defaultThemeProp } from '../../../theme';\nimport Text from '../../Text';\nimport { getDateOfISOWeek, getWeek, parseToDate, toUTCDateString } from '../Input/utils';\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { CALENDAR_TYPES } from '../Input/local';\nimport { ForwardProps } from '../../../types';\nimport { FormControlProps } from '../../FormControl';\n\nimport { StyledColumnLabel, StyledPick } from './Calendar.styles';\nimport { getWeeksOfMonth } from './utils';\n\nexport interface WeeksProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Defines default week that will be selected when the Date Picker is opened.\n */\n selected?: Date;\n /**\n * Defines default week that will be focused initially when the Date Picker is opened.\n * @default new Date()\n */\n current?: Date;\n /** Callback fired when user focuses new week. */\n onFocus?: (date: Date) => void;\n /** Callback fired when new week is selected. */\n onSelect?: (date: Date) => void;\n /** Sets the type of calendar to be used. This will be determined by locale if no value is provided. */\n calendarType?: string;\n /** Defines minimum available value that can be selected by the user. */\n min?: string | number | Date;\n /** Defines maximum available value that can be selected by the user. */\n max?: string | number | Date;\n /** Set the calendar to disabled state, ie. non-interactive. */\n disabled?: boolean;\n /** Should text be in long or short format (ie. only number). */\n size?: 'short' | 'long';\n}\n\nexport const StyledWeekNumbers = styled.div`\n margin-inline-end: ${props => props.theme.base.spacing};\n color: rgba(0, 0, 0, 0.75);\n`;\n\nStyledWeekNumbers.defaultProps = defaultThemeProp;\n\nconst StyledWeekNumber = styled(StyledPick)(props => {\n const {\n theme: {\n base: { 'border-radius': borderRadius }\n }\n } = props;\n\n return css`\n &:disabled {\n &:nth-child(2) {\n border-radius: calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius}) 0 0;\n }\n &:last-child {\n border-radius: 0 0 calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius});\n }\n }\n `;\n});\n\nStyledWeekNumber.defaultProps = defaultThemeProp;\n\nconst Weeks: FC<WeeksProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeeksProps>, ref: Ref<HTMLButtonElement>) => {\n const {\n selected,\n current = selected ? new Date(selected.getTime()) : new Date(),\n calendarType = CALENDAR_TYPES.ISO_8601,\n onSelect,\n onFocus,\n disabled = false,\n size = 'short'\n } = props;\n\n const [focusedWeek, setFocusedWeek] = useState(current);\n useLayoutEffect(() => {\n setFocusedWeek(current);\n }, [current.getUTCFullYear(), current.getUTCMonth()]);\n\n let newFocused: Date;\n const onKeyDown = (ev: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter'].includes(ev.key)) ev.preventDefault();\n switch (ev.key) {\n case 'ArrowUp':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() - 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'ArrowDown':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() + 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'Enter':\n onSelect?.(focusedWeek);\n break;\n default:\n }\n };\n\n const containerRef = useConsolidatedRef(ref);\n const hasFocus = useFocusWithin([containerRef]);\n\n const min = props.min ? parseToDate(props.min) : -Infinity;\n const max = props.max ? parseToDate(props.max) : Infinity;\n const isDisabled = (day: Date) => {\n return disabled || min > day.getTime() || day.getTime() > max;\n };\n\n const isChecked = (day: Date) => {\n return (\n selected &&\n toUTCDateString(day) ===\n toUTCDateString(getDateOfISOWeek(getWeek(selected, calendarType), selected.getFullYear()))\n );\n };\n\n const isFocused = (day: Date) => {\n return (\n toUTCDateString(day) ===\n toUTCDateString(\n getDateOfISOWeek(getWeek(focusedWeek, calendarType), focusedWeek.getFullYear())\n )\n );\n };\n\n const t = useI18n();\n\n const weekText = t('week_label_a11y');\n\n const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {\n const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());\n return (\n <StyledWeekNumber\n key={weekNo}\n variant='simple'\n icon={false}\n type='button'\n loading={false}\n ref={\n isFocused(dateOfISOWeek)\n ? (focusedRef: HTMLButtonElement) => {\n if (hasFocus) focusedRef?.focus();\n }\n : undefined\n }\n tabIndex={isFocused(dateOfISOWeek) ? 0 : -1}\n disabled={isDisabled(dateOfISOWeek)}\n aria-selected={isChecked(dateOfISOWeek) || undefined}\n aria-label={`${t('week_label_a11y')} ${weekNo.toString()} ${current\n .getUTCFullYear()\n .toString()}`}\n onClick={() => {\n onSelect?.(dateOfISOWeek);\n }}\n >\n {size === 'long' && `${weekText} `}\n {weekNo.toString()}\n </StyledWeekNumber>\n );\n });\n\n const label =\n size === 'short' ? (\n <Text as={StyledColumnLabel} forwardedAs='abbr' title={weekText}>\n {t('week_text_short')}\n </Text>\n ) : (\n <Text as={StyledColumnLabel}>{weekText}</Text>\n );\n\n return (\n <Flex\n as={StyledWeekNumbers}\n container={{ direction: 'column' }}\n ref={containerRef}\n onKeyDown={onKeyDown}\n >\n {label}\n {weeks}\n </Flex>\n );\n }\n);\n\nexport default Weeks;\n"]}
|
|
1
|
+
{"version":3,"file":"Weeks.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/Weeks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EAEf,QAAQ,EACR,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBA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CACF,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,YAAG,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,GAAQ,CACzE,CAAC;IAEJ,OAAO,CACL,MAAC,IAAI,IACH,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,aAEnB,KAAK,EACL,KAAK,IACD,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n FC,\n useLayoutEffect,\n KeyboardEvent,\n useState,\n forwardRef,\n PropsWithoutRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { defaultThemeProp } from '../../../theme';\nimport Text from '../../Text';\nimport { cap } from '../../../utils';\nimport { getDateOfISOWeek, getWeek, parseToDate, toUTCDateString } from '../Input/utils';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin } from '../../../hooks';\nimport { CALENDAR_TYPES } from '../Input/local';\nimport { ForwardProps } from '../../../types';\nimport { FormControlProps } from '../../FormControl';\n\nimport { StyledColumnLabel, StyledPick } from './Calendar.styles';\nimport { getWeeksOfMonth } from './utils';\n\nexport interface WeeksProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Defines default week that will be selected when the Date Picker is opened.\n */\n selected?: Date;\n /**\n * Defines default week that will be focused initially when the Date Picker is opened.\n * @default new Date()\n */\n current?: Date;\n /** Callback fired when user focuses new week. */\n onFocus?: (date: Date) => void;\n /** Callback fired when new week is selected. */\n onSelect?: (date: Date) => void;\n /** Sets the type of calendar to be used. This will be determined by locale if no value is provided. */\n calendarType?: string;\n /** Defines minimum available value that can be selected by the user. */\n min?: string | number | Date;\n /** Defines maximum available value that can be selected by the user. */\n max?: string | number | Date;\n /** Set the calendar to disabled state, ie. non-interactive. */\n disabled?: boolean;\n /** Should text be in long or short format (ie. only number). */\n size?: 'short' | 'long';\n}\n\nexport const StyledWeekNumbers = styled.div`\n margin-inline-end: ${props => props.theme.base.spacing};\n color: rgba(0, 0, 0, 0.75);\n`;\n\nStyledWeekNumbers.defaultProps = defaultThemeProp;\n\nconst StyledWeekNumber = styled(StyledPick)(props => {\n const {\n theme: {\n base: { 'border-radius': borderRadius }\n }\n } = props;\n\n return css`\n &:disabled {\n &:nth-child(2) {\n border-radius: calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius}) 0 0;\n }\n &:last-child {\n border-radius: 0 0 calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius});\n }\n }\n `;\n});\n\nStyledWeekNumber.defaultProps = defaultThemeProp;\n\nconst Weeks: FC<WeeksProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeeksProps>, ref: Ref<HTMLButtonElement>) => {\n const {\n selected,\n current = selected ? new Date(selected.getTime()) : new Date(),\n calendarType = CALENDAR_TYPES.ISO_8601,\n onSelect,\n onFocus,\n disabled = false,\n size = 'short'\n } = props;\n\n const { locale } = useConfiguration();\n\n const [focusedWeek, setFocusedWeek] = useState(current);\n useLayoutEffect(() => {\n setFocusedWeek(current);\n }, [current.getUTCFullYear(), current.getUTCMonth()]);\n\n let newFocused: Date;\n const onKeyDown = (ev: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter'].includes(ev.key)) ev.preventDefault();\n switch (ev.key) {\n case 'ArrowUp':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() - 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'ArrowDown':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() + 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'Enter':\n onSelect?.(focusedWeek);\n break;\n default:\n }\n };\n\n const containerRef = useConsolidatedRef(ref);\n const hasFocus = useFocusWithin([containerRef]);\n\n const min = props.min ? parseToDate(props.min) : -Infinity;\n const max = props.max ? parseToDate(props.max) : Infinity;\n const isDisabled = (day: Date) => {\n return disabled || min > day.getTime() || day.getTime() > max;\n };\n\n const isChecked = (day: Date) => {\n return (\n selected &&\n toUTCDateString(day) ===\n toUTCDateString(getDateOfISOWeek(getWeek(selected, calendarType), selected.getFullYear()))\n );\n };\n\n const isFocused = (day: Date) => {\n return (\n toUTCDateString(day) ===\n toUTCDateString(\n getDateOfISOWeek(getWeek(focusedWeek, calendarType), focusedWeek.getFullYear())\n )\n );\n };\n\n const displayNames = new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n const displayNamesShort = new Intl.DisplayNames(locale, {\n style: 'short',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n\n const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {\n const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());\n return (\n <StyledWeekNumber\n key={weekNo}\n variant='simple'\n icon={false}\n type='button'\n loading={false}\n ref={\n isFocused(dateOfISOWeek)\n ? (focusedRef: HTMLButtonElement) => {\n if (hasFocus) focusedRef?.focus();\n }\n : undefined\n }\n tabIndex={isFocused(dateOfISOWeek) ? 0 : -1}\n disabled={isDisabled(dateOfISOWeek)}\n aria-selected={isChecked(dateOfISOWeek) || undefined}\n aria-label={`${displayNames.of('weekOfYear')} ${weekNo.toString()} ${current\n .getUTCFullYear()\n .toString()}`}\n onClick={() => {\n onSelect?.(dateOfISOWeek);\n }}\n >\n {size === 'long' && `${cap(displayNames.of('weekOfYear'))} `}\n {weekNo.toString()}\n </StyledWeekNumber>\n );\n });\n\n const label =\n size === 'short' ? (\n <Text as={StyledColumnLabel} forwardedAs='abbr' title={cap(displayNames.of('weekOfYear'))}>\n {cap(displayNamesShort.of('weekOfYear'))}\n </Text>\n ) : (\n <Text as={StyledColumnLabel}>{cap(displayNames.of('weekOfYear'))}</Text>\n );\n\n return (\n <Flex\n as={StyledWeekNumbers}\n container={{ direction: 'column' }}\n ref={containerRef}\n onKeyDown={onKeyDown}\n >\n {label}\n {weeks}\n </Flex>\n );\n }\n);\n\nexport default Weeks;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getLocalizedDays: (calendarType: string, localeTag?: string
|
|
1
|
+
export declare const getLocalizedDays: (calendarType: string, localeTag?: string) => string[][];
|
|
2
2
|
export declare const isValidDate: (date: Date) => boolean;
|
|
3
3
|
export declare const getDaysOfMonth: (date: Date, calendarType: string) => Date[];
|
|
4
4
|
export declare const getWeeksOfMonth: (date: Date, calendarType: string) => number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,iBAAkB,MAAM
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,iBAAkB,MAAM,cAAc,MAAM,eAOxE,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,IAAI,YAErC,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,IAAI,gBAAgB,MAAM,KAAG,IAAI,EAQrE,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,IAAI,gBAAgB,MAAM,KAAG,MAAM,EAmBxE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,IAAI,WAGtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,IAAI,WAG1C,CAAC;AAIF,wBAAiB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,kCAMrD"}
|
|
@@ -8,6 +8,8 @@ export { default as TimeInput } from './Input/TimeInput';
|
|
|
8
8
|
export type { TimeInputProps } from './Input/TimeInput';
|
|
9
9
|
export { default as DateRangeInput } from './Input/DateRangeInput';
|
|
10
10
|
export type { DateRangeInputProps } from './Input/DateRangeInput';
|
|
11
|
+
export { default as TimeRangeInput } from './Input/TimeRangeInput';
|
|
12
|
+
export type { TimeRangeInputProps } from './Input/TimeRangeInput';
|
|
11
13
|
export { default as DurationInput } from './Input/Duration/DurationInput';
|
|
12
14
|
export type { default as DurationInputProps } from './Input/Duration/DurationInput.types';
|
|
13
15
|
export { Format } from './Input/Duration/DurationInput.types';
|
|
@@ -26,4 +28,6 @@ export type { DateTimeDisplayProps } from './DateTimeDisplay';
|
|
|
26
28
|
export { default as DurationDisplay } from './DurationDisplay';
|
|
27
29
|
export type { DurationDisplayProps } from './DurationDisplay';
|
|
28
30
|
export { formatDateTime, formatDuration } from './utils';
|
|
31
|
+
export { parseToDate } from './Input/utils';
|
|
32
|
+
export { isValidDate } from './Picker/utils';
|
|
29
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,mBAA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AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,7 @@ export { default as WeekInput } from './Input/WeekInput';
|
|
|
3
3
|
export { default as MonthInput } from './Input/MonthInput';
|
|
4
4
|
export { default as TimeInput } from './Input/TimeInput';
|
|
5
5
|
export { default as DateRangeInput } from './Input/DateRangeInput';
|
|
6
|
+
export { default as TimeRangeInput } from './Input/TimeRangeInput';
|
|
6
7
|
export { default as DurationInput } from './Input/Duration/DurationInput';
|
|
7
8
|
export { Format } from './Input/Duration/DurationInput.types';
|
|
8
9
|
export { default as DateTimeInput } from './Input/DateTimeInput';
|
|
@@ -13,4 +14,6 @@ export { default as DatePicker } from './Picker/DatePicker';
|
|
|
13
14
|
export { default as DateTimeDisplay } from './DateTimeDisplay';
|
|
14
15
|
export { default as DurationDisplay } from './DurationDisplay';
|
|
15
16
|
export { formatDateTime, formatDuration } from './utils';
|
|
17
|
+
export { parseToDate } from './Input/utils';
|
|
18
|
+
export { isValidDate } from './Picker/utils';
|
|
16
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { default as DateInput } from './Input/DateInput';\nexport type { DateInputProps } from './Input/DateInput';\nexport { default as WeekInput } from './Input/WeekInput';\nexport type { WeekInputProps } from './Input/WeekInput';\nexport { default as MonthInput } from './Input/MonthInput';\nexport type { MonthInputProps } from './Input/MonthInput';\nexport { default as TimeInput } from './Input/TimeInput';\nexport type { TimeInputProps } from './Input/TimeInput';\nexport { default as DateRangeInput } from './Input/DateRangeInput';\nexport type { DateRangeInputProps } from './Input/DateRangeInput';\nexport { default as DurationInput } from './Input/Duration/DurationInput';\nexport type { default as DurationInputProps } from './Input/Duration/DurationInput.types';\nexport { Format } from './Input/Duration/DurationInput.types';\nexport { default as DateTimeInput } from './Input/DateTimeInput';\nexport type { DateTimeInputProps } from './Input/DateTimeInput';\nexport { default as DayOfWeekInput } from './Input/DayOfWeekInput';\nexport type { DayOfWeekInputProps } from './Input/DayOfWeekInput';\nexport { default as QuarterInput } from './Input/QuarterInput';\nexport type { QuarterInputProps } from './Input/QuarterInput';\n\nexport { default as TimePicker } from './Picker/TimePicker';\nexport type { TimePickerProps } from './Picker/TimePicker';\nexport { default as DatePicker } from './Picker/DatePicker';\nexport type { default as DatePickerProps } from './Picker/DatePicker.types';\n\nexport { default as DateTimeDisplay } from './DateTimeDisplay';\nexport type { DateTimeDisplayProps } from './DateTimeDisplay';\nexport { default as DurationDisplay } from './DurationDisplay';\nexport type { DurationDisplayProps } from './DurationDisplay';\nexport { formatDateTime, formatDuration } from './utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default as DateInput } from './Input/DateInput';\nexport type { DateInputProps } from './Input/DateInput';\nexport { default as WeekInput } from './Input/WeekInput';\nexport type { WeekInputProps } from './Input/WeekInput';\nexport { default as MonthInput } from './Input/MonthInput';\nexport type { MonthInputProps } from './Input/MonthInput';\nexport { default as TimeInput } from './Input/TimeInput';\nexport type { TimeInputProps } from './Input/TimeInput';\nexport { default as DateRangeInput } from './Input/DateRangeInput';\nexport type { DateRangeInputProps } from './Input/DateRangeInput';\nexport { default as TimeRangeInput } from './Input/TimeRangeInput';\nexport type { TimeRangeInputProps } from './Input/TimeRangeInput';\nexport { default as DurationInput } from './Input/Duration/DurationInput';\nexport type { default as DurationInputProps } from './Input/Duration/DurationInput.types';\nexport { Format } from './Input/Duration/DurationInput.types';\nexport { default as DateTimeInput } from './Input/DateTimeInput';\nexport type { DateTimeInputProps } from './Input/DateTimeInput';\nexport { default as DayOfWeekInput } from './Input/DayOfWeekInput';\nexport type { DayOfWeekInputProps } from './Input/DayOfWeekInput';\nexport { default as QuarterInput } from './Input/QuarterInput';\nexport type { QuarterInputProps } from './Input/QuarterInput';\n\nexport { default as TimePicker } from './Picker/TimePicker';\nexport type { TimePickerProps } from './Picker/TimePicker';\nexport { default as DatePicker } from './Picker/DatePicker';\nexport type { default as DatePickerProps } from './Picker/DatePicker.types';\n\nexport { default as DateTimeDisplay } from './DateTimeDisplay';\nexport type { DateTimeDisplayProps } from './DateTimeDisplay';\nexport { default as DurationDisplay } from './DurationDisplay';\nexport type { DurationDisplayProps } from './DurationDisplay';\nexport { formatDateTime, formatDuration } from './utils';\nexport { parseToDate } from './Input/utils';\nexport { isValidDate } from './Picker/utils';\n"]}
|
|
@@ -10,9 +10,9 @@ interface DateTimeFormatOptions {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function formatDateTime(value: Date, { t, locale, format, variant, clockFormat }: DateTimeFormatOptions): string;
|
|
12
12
|
interface DurationFormatOptions {
|
|
13
|
-
|
|
13
|
+
locale: string;
|
|
14
14
|
significantUnits: 4 | 3 | 2 | 1;
|
|
15
15
|
}
|
|
16
|
-
export declare function formatDuration(valueInMs: number, {
|
|
16
|
+
export declare function formatDuration(valueInMs: number, { locale, significantUnits }: DurationFormatOptions): string;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EAChB,MAAM,gEAAgE,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EAChB,MAAM,gEAAgE,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EACL,WAAW,EAMZ,MAAM,eAAe,CAAC;AAsBvB,UAAU,qBAAqB;IAC7B,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,EACX,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,qBAAqB,UA0GnE;AAOD,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACjC;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,qBAAqB,UAiCpD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cap } from '../../utils';
|
|
1
2
|
import { getEndOfWeek, getQuarter, getStartOfWeek, getWeek, getWeekYear } from './Input/utils';
|
|
2
3
|
const unitsInMs = {
|
|
3
4
|
year: 24 * 60 * 60 * 1000 * 365,
|
|
@@ -79,9 +80,13 @@ export function formatDateTime(value, { t, locale, format, variant, clockFormat
|
|
|
79
80
|
return relativeTimeFormatter(Math.round(elapsed / unitsInMs[unit]), unit);
|
|
80
81
|
};
|
|
81
82
|
const getFormattedWeek = (date) => {
|
|
83
|
+
const displayNames = new Intl.DisplayNames(locale, {
|
|
84
|
+
style: 'long',
|
|
85
|
+
type: 'dateTimeField'
|
|
86
|
+
});
|
|
82
87
|
const startDate = getFormattedDate(getStartOfWeek(date), 'week');
|
|
83
88
|
const endDate = getFormattedDate(getEndOfWeek(date), 'week');
|
|
84
|
-
return `${
|
|
89
|
+
return `${cap(displayNames.of('weekOfYear'))} ${getWeek(date)}, ${getWeekYear(date)} (${startDate} - ${endDate})`;
|
|
85
90
|
};
|
|
86
91
|
const getFormattedQuarterYear = (date) => {
|
|
87
92
|
const formattedYear = getFormattedDate(date, 'year');
|
|
@@ -103,11 +108,16 @@ const dayInMs = 24 * 60 * 60 * 1000;
|
|
|
103
108
|
const hourInMs = 60 * 60 * 1000;
|
|
104
109
|
const minuteInMs = 60 * 1000;
|
|
105
110
|
const secondInMs = 1000;
|
|
106
|
-
export function formatDuration(valueInMs, {
|
|
111
|
+
export function formatDuration(valueInMs, { locale, significantUnits }) {
|
|
112
|
+
const numberFormatterSeconds = new Intl.NumberFormat(locale, {
|
|
113
|
+
style: 'unit',
|
|
114
|
+
unit: 'second',
|
|
115
|
+
unitDisplay: 'narrow'
|
|
116
|
+
});
|
|
107
117
|
const sign = valueInMs < 0 ? '-' : '';
|
|
108
118
|
const absMs = Math.abs(valueInMs);
|
|
109
119
|
if (absMs < secondInMs) {
|
|
110
|
-
return
|
|
120
|
+
return numberFormatterSeconds.format(0);
|
|
111
121
|
}
|
|
112
122
|
const durationParts = [
|
|
113
123
|
{ unit: 'day', value: Math.floor(absMs / dayInMs) },
|
|
@@ -118,7 +128,11 @@ export function formatDuration(valueInMs, { t, significantUnits }) {
|
|
|
118
128
|
const result = [];
|
|
119
129
|
for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {
|
|
120
130
|
if (durationParts[i].value > 0) {
|
|
121
|
-
result.push(
|
|
131
|
+
result.push(new Intl.NumberFormat(locale, {
|
|
132
|
+
style: 'unit',
|
|
133
|
+
unit: durationParts[i].unit,
|
|
134
|
+
unitDisplay: 'narrow'
|
|
135
|
+
}).format(durationParts[i].value));
|
|
122
136
|
}
|
|
123
137
|
}
|
|
124
138
|
return `${sign}${result.join(' ')}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources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AC9B,MAAM,CAAC,IAAI,CACT,GACE,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,aAAsC,CAC3F,EAAE,CACH,CAAC;SACH;KACF;IACD,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import {\n AbsoluteVariant,\n DateTimeFormat,\n DateTimeVariant\n} from '@pega/cosmos-react-core/lib/components/DateTime/DateTime.types';\n\nimport { TranslationFunction, TranslationPack } from '../../i18n';\n\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} as const;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ninterface TimeShort {\n hour: 'numeric';\n minute: 'numeric';\n hour12: boolean | undefined;\n}\ninterface TimeLong extends TimeShort {\n second: 'numeric';\n}\n\ninterface DateTimeFormatOptions {\n t: TranslationFunction<TranslationPack>;\n locale: string;\n format: DateTimeFormat;\n variant: DateTimeVariant;\n clockFormat?: ClockFormat;\n}\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat }: DateTimeFormatOptions\n) {\n const timeShort: TimeShort = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n };\n const timeLong: TimeLong = {\n ...timeShort,\n second: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n };\n const formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric' } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' } as const\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort } as const\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n month: {\n short: { month: 'short' } as const,\n long: { month: 'long' } as const,\n numeric: { month: 'numeric' } as const\n },\n year: {\n short: { year: 'numeric' } as const,\n long: { year: 'numeric' } as const,\n numeric: { year: '2-digit' } as const\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' } as const,\n long: { year: 'numeric', month: 'long' } as const,\n numeric: { year: 'numeric', month: 'numeric' } as const\n },\n week: {\n short: { month: 'short', day: 'numeric' } as const,\n long: { month: 'long', day: 'numeric' } as const,\n numeric: { month: 'numeric', day: 'numeric' } as const\n },\n relative: {\n short: { style: 'long', numeric: 'auto' } as const,\n long: { style: 'long', numeric: 'auto' } as const,\n numeric: { style: 'short', numeric: 'auto' } as const\n }\n };\n\n const getFormattedDate = (date: Date, dateVariant: Exclude<AbsoluteVariant, 'quarteryear'>) => {\n return new Intl.DateTimeFormat(locale, {\n ...formatMapping[dateVariant][format],\n timeZone: 'UTC'\n }).format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n return new Intl.RelativeTimeFormat(locale, formatMapping.relative[format]).format(\n relativeValue,\n unit\n );\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n return relativeTimeFormatter(Math.round(elapsed / unitsInMs[unit]), unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n const startDate = getFormattedDate(getStartOfWeek(date), 'week');\n const endDate = getFormattedDate(getEndOfWeek(date), 'week');\n return `${t('week_text')} ${getWeek(date)}, ${getWeekYear(date)} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const quarterNumber = getQuarter(date);\n return `${t(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n t: TranslationFunction<TranslationPack>;\n significantUnits: 4 | 3 | 2 | 1;\n}\n\nexport function formatDuration(valueInMs: number, { t, significantUnits }: DurationFormatOptions) {\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n return `0${t('second_text_short')}`;\n }\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n if (durationParts[i].value > 0) {\n result.push(\n `${\n durationParts[i].value + t(`${durationParts[i].unit}_text_short` as keyof TranslationPack)\n }`\n );\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,SAAS,G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EAAE,MAAM,CAAC,MAAM,GAAG,gBAAgB,IAAI,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACpF,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE;YAC9B,MAAM,CAAC,IAAI,CACT,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBAC5B,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI;gBAC3B,WAAW,EAAE,QAAQ;aACtB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAClC,CAAC;SACH;KACF;IACD,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import {\n AbsoluteVariant,\n DateTimeFormat,\n DateTimeVariant\n} from '@pega/cosmos-react-core/lib/components/DateTime/DateTime.types';\n\nimport { TranslationFunction, TranslationPack } from '../../i18n';\nimport { cap } from '../../utils';\n\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} as const;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ninterface TimeShort {\n hour: 'numeric';\n minute: 'numeric';\n hour12: boolean | undefined;\n}\ninterface TimeLong extends TimeShort {\n second: 'numeric';\n}\n\ninterface DateTimeFormatOptions {\n t: TranslationFunction<TranslationPack>;\n locale: string;\n format: DateTimeFormat;\n variant: DateTimeVariant;\n clockFormat?: ClockFormat;\n}\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat }: DateTimeFormatOptions\n) {\n const timeShort: TimeShort = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n };\n const timeLong: TimeLong = {\n ...timeShort,\n second: 'numeric',\n hour12: clockFormat ? clockFormat === 12 : undefined\n };\n const formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric' } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' } as const\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort } as const,\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong } as const,\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort } as const\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n month: {\n short: { month: 'short' } as const,\n long: { month: 'long' } as const,\n numeric: { month: 'numeric' } as const\n },\n year: {\n short: { year: 'numeric' } as const,\n long: { year: 'numeric' } as const,\n numeric: { year: '2-digit' } as const\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' } as const,\n long: { year: 'numeric', month: 'long' } as const,\n numeric: { year: 'numeric', month: 'numeric' } as const\n },\n week: {\n short: { month: 'short', day: 'numeric' } as const,\n long: { month: 'long', day: 'numeric' } as const,\n numeric: { month: 'numeric', day: 'numeric' } as const\n },\n relative: {\n short: { style: 'long', numeric: 'auto' } as const,\n long: { style: 'long', numeric: 'auto' } as const,\n numeric: { style: 'short', numeric: 'auto' } as const\n }\n };\n\n const getFormattedDate = (date: Date, dateVariant: Exclude<AbsoluteVariant, 'quarteryear'>) => {\n return new Intl.DateTimeFormat(locale, {\n ...formatMapping[dateVariant][format],\n timeZone: 'UTC'\n }).format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n return new Intl.RelativeTimeFormat(locale, formatMapping.relative[format]).format(\n relativeValue,\n unit\n );\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n return relativeTimeFormatter(Math.round(elapsed / unitsInMs[unit]), unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n const displayNames = new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n const startDate = getFormattedDate(getStartOfWeek(date), 'week');\n const endDate = getFormattedDate(getEndOfWeek(date), 'week');\n return `${cap(displayNames.of('weekOfYear'))} ${getWeek(date)}, ${getWeekYear(\n date\n )} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const quarterNumber = getQuarter(date);\n return `${t(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n locale: string;\n significantUnits: 4 | 3 | 2 | 1;\n}\n\nexport function formatDuration(\n valueInMs: number,\n { locale, significantUnits }: DurationFormatOptions\n) {\n const numberFormatterSeconds = new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'second',\n unitDisplay: 'narrow'\n });\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n return numberFormatterSeconds.format(0);\n }\n\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n if (durationParts[i].value > 0) {\n result.push(\n new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: durationParts[i].unit,\n unitDisplay: 'narrow'\n }).format(durationParts[i].value)\n );\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FunctionComponent, Ref, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
2
|
+
import { BaseProps, ForwardProps } from '../../types';
|
|
3
|
+
import { PopoverProps } from '../Popover';
|
|
4
|
+
export interface DialogProps extends BaseProps {
|
|
5
|
+
target: HTMLElement | null;
|
|
6
|
+
placement?: PopoverProps['placement'];
|
|
7
|
+
children: PopoverProps['children'];
|
|
8
|
+
heading: string;
|
|
9
|
+
headingHidden?: boolean;
|
|
10
|
+
onSubmit?: (arg: {
|
|
11
|
+
close: () => void;
|
|
12
|
+
}) => void;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
onOpen?: () => void;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
ref?: Ref<HTMLDivElement>;
|
|
17
|
+
}
|
|
18
|
+
export declare const StyledDialog: import("styled-components").StyledComponent<"dialog", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
+
export declare const StyledDialogTitle: import("styled-components").StyledComponent<FunctionComponent<import("../Text").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
+
export declare const useDialog: () => {
|
|
21
|
+
target: HTMLElement | null;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
24
|
+
events: {
|
|
25
|
+
onMouseDown: (e: ReactMouseEvent) => void;
|
|
26
|
+
onKeyDown: (e: ReactKeyboardEvent) => void;
|
|
27
|
+
};
|
|
28
|
+
setTargetWithEvent: (e: ReactMouseEvent | ReactKeyboardEvent) => void;
|
|
29
|
+
};
|
|
30
|
+
declare const Dialog: FunctionComponent<DialogProps & ForwardProps>;
|
|
31
|
+
export default Dialog;
|
|
32
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,GAAG,EAKH,UAAU,IAAI,eAAe,EAC7B,aAAa,IAAI,kBAAkB,EACpC,MAAM,OAAO,CAAC;AAcf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKtD,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAKnD,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY,4GAYxB,CAAC;AAIF,eAAO,MAAM,iBAAiB,iKAsB7B,CAAC;AAIF,eAAO,MAAM,SAAS;;;;;yBAeC,eAAe;uBAGjB,kBAAkB;;4BAdN,eAAe,GAAG,kBAAkB;CAsBpE,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAgKzD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { useConsolidatedRef, useElement, useEscape, useFocusTrap, useI18n, useOuterEvent, usePrevious, useUID } from '../../hooks';
|
|
5
|
+
import { defaultThemeProp } from '../../theme';
|
|
6
|
+
import { getFocusables } from '../../utils';
|
|
7
|
+
import Button from '../Button';
|
|
8
|
+
import { CardContent, CardFooter, CardHeader } from '../Card';
|
|
9
|
+
import Icon from '../Icon';
|
|
10
|
+
import Popover from '../Popover';
|
|
11
|
+
import Progress from '../Progress';
|
|
12
|
+
import Text from '../Text';
|
|
13
|
+
import VisuallyHiddenText from '../VisuallyHiddenText';
|
|
14
|
+
export const StyledDialog = styled.dialog(({ theme: { base: { 'content-width': contentWidth } } }) => {
|
|
15
|
+
return css `
|
|
16
|
+
border: none;
|
|
17
|
+
min-width: ${contentWidth.sm};
|
|
18
|
+
max-width: ${contentWidth.lg};
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
21
|
+
StyledDialog.defaultProps = defaultThemeProp;
|
|
22
|
+
export const StyledDialogTitle = styled(Text)(({ theme: { base: { shadow, 'border-radius': borderRadius } } }) => {
|
|
23
|
+
return css `
|
|
24
|
+
position: relative;
|
|
25
|
+
::after {
|
|
26
|
+
content: '';
|
|
27
|
+
border-radius: ${borderRadius};
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset: -0.25rem;
|
|
30
|
+
}
|
|
31
|
+
:focus-visible {
|
|
32
|
+
outline: none;
|
|
33
|
+
::after {
|
|
34
|
+
box-shadow: ${shadow.focus}, inset ${shadow['focus-solid']};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
});
|
|
39
|
+
StyledDialogTitle.defaultProps = defaultThemeProp;
|
|
40
|
+
export const useDialog = () => {
|
|
41
|
+
const [target, setTarget] = useState(null);
|
|
42
|
+
const [loading, setLoading] = useState(false);
|
|
43
|
+
const setTargetWithEvent = (e) => {
|
|
44
|
+
if (e.target instanceof HTMLElement) {
|
|
45
|
+
setTarget(e.target);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
target,
|
|
50
|
+
loading,
|
|
51
|
+
setLoading,
|
|
52
|
+
events: {
|
|
53
|
+
onMouseDown: (e) => {
|
|
54
|
+
setTargetWithEvent(e);
|
|
55
|
+
},
|
|
56
|
+
onKeyDown: (e) => {
|
|
57
|
+
if (e.key === 'Enter') {
|
|
58
|
+
setTargetWithEvent(e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
setTargetWithEvent
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const Dialog = forwardRef(({ target, placement, heading, headingHidden = false, onSubmit, onClose, onOpen, loading, children, ...restProps }, ref) => {
|
|
66
|
+
const t = useI18n();
|
|
67
|
+
const headingId = useUID();
|
|
68
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
69
|
+
const popoverRef = useConsolidatedRef(ref, setPopoverEl);
|
|
70
|
+
const headingRef = useRef(null);
|
|
71
|
+
const [currentTarget, setCurrentTarget] = useState(() => target);
|
|
72
|
+
const [show, setShow] = useState(false);
|
|
73
|
+
const skipChangeShow = useRef(false);
|
|
74
|
+
const prevTarget = usePrevious(target);
|
|
75
|
+
useEscape(() => {
|
|
76
|
+
if (show) {
|
|
77
|
+
setShow(false);
|
|
78
|
+
}
|
|
79
|
+
}, undefined, [show, setShow]);
|
|
80
|
+
useOuterEvent('mousedown', [target, popoverEl], () => {
|
|
81
|
+
if (target && popoverEl && show) {
|
|
82
|
+
setShow(false);
|
|
83
|
+
onClose?.();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
useFocusTrap(popoverRef);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!show) {
|
|
89
|
+
currentTarget?.focus();
|
|
90
|
+
}
|
|
91
|
+
}, [show]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (show && popoverEl) {
|
|
94
|
+
if (headingRef.current) {
|
|
95
|
+
headingRef.current.focus();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const focusables = getFocusables(popoverRef);
|
|
99
|
+
focusables[0]?.focus();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, [show, popoverEl]);
|
|
103
|
+
useLayoutEffect(() => {
|
|
104
|
+
const onTargetClick = (e) => {
|
|
105
|
+
setCurrentTarget(prev => (e.target ? e.target : prev));
|
|
106
|
+
if (!skipChangeShow.current) {
|
|
107
|
+
setShow(prev => !prev);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
skipChangeShow.current = false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
if (target instanceof HTMLElement) {
|
|
114
|
+
target.addEventListener('click', onTargetClick);
|
|
115
|
+
}
|
|
116
|
+
return () => {
|
|
117
|
+
if (target instanceof HTMLElement) {
|
|
118
|
+
target.removeEventListener('click', onTargetClick);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [target]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (show) {
|
|
124
|
+
onOpen?.();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
onClose?.();
|
|
128
|
+
}
|
|
129
|
+
}, [show]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
/* If our target is changing and the popover is already open we will want
|
|
132
|
+
to skip the next change. The next show change would come from a click on the new button,
|
|
133
|
+
the popover should stay open. */
|
|
134
|
+
if (target !== prevTarget && show) {
|
|
135
|
+
skipChangeShow.current = true;
|
|
136
|
+
}
|
|
137
|
+
}, [target, show]);
|
|
138
|
+
const onTitleKeyDown = (e) => {
|
|
139
|
+
const focusables = getFocusables(popoverRef);
|
|
140
|
+
if (e.shiftKey && e.key === 'Tab') {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
focusables[focusables.length - 1].focus();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const progress = loading ? _jsx(Progress, { placement: 'local' }) : null;
|
|
146
|
+
return (_jsxs(Popover, { ...restProps, as: StyledDialog, ref: popoverRef, target: currentTarget, placement: placement, show: show, open: show, "aria-labelledby": headingId, children: [_jsx(CardHeader, { actions: !onSubmit ? (_jsx(Button, { icon: true, variant: 'simple', onClick: () => setShow(false), "aria-label": t('close'), children: _jsx(Icon, { name: 'times' }) })) : undefined, children: headingHidden ? (_jsx(VisuallyHiddenText, { id: headingId, children: heading })) : (_jsx(StyledDialogTitle, { variant: 'h2', tabIndex: -1, ref: headingRef, onKeyDown: onTitleKeyDown, id: headingId, children: heading })) }), _jsxs(CardContent, { children: [children, progress] }), onSubmit && (_jsxs(CardFooter, { justify: 'between', children: [_jsx(Button, { variant: 'secondary', onClick: () => setShow(false), children: t('cancel') }), _jsx(Button, { variant: 'primary', onClick: () => onSubmit({ close: () => setShow(false) }), disabled: loading, children: t('submit') })] }))] }));
|
|
147
|
+
});
|
|
148
|
+
export default Dialog;
|
|
149
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EAGT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACb,WAAW,EACX,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,O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CAAC,KAAK,CAAC,EAAE,CAAC,EACxD,QAAQ,EAAE,OAAO,YAEhB,CAAC,CAAC,QAAQ,CAAC,GACL,IACE,CACd,IACO,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n MouseEvent as ReactMouseEvent,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useElement,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n usePrevious,\n useUID\n} from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { getFocusables } from '../../utils';\nimport Button from '../Button';\nimport { CardContent, CardFooter, CardHeader } from '../Card';\nimport Icon from '../Icon';\nimport Popover, { PopoverProps } from '../Popover';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nexport interface DialogProps extends BaseProps {\n target: HTMLElement | null;\n placement?: PopoverProps['placement'];\n children: PopoverProps['children'];\n heading: string;\n headingHidden?: boolean;\n onSubmit?: (arg: { close: () => void }) => void;\n onClose?: () => void;\n onOpen?: () => void;\n loading?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledDialog = styled.dialog(\n ({\n theme: {\n base: { 'content-width': contentWidth }\n }\n }) => {\n return css`\n border: none;\n min-width: ${contentWidth.sm};\n max-width: ${contentWidth.lg};\n `;\n }\n);\n\nStyledDialog.defaultProps = defaultThemeProp;\n\nexport const StyledDialogTitle = styled(Text)(\n ({\n theme: {\n base: { shadow, 'border-radius': borderRadius }\n }\n }) => {\n return css`\n position: relative;\n ::after {\n content: '';\n border-radius: ${borderRadius};\n position: absolute;\n inset: -0.25rem;\n }\n :focus-visible {\n outline: none;\n ::after {\n box-shadow: ${shadow.focus}, inset ${shadow['focus-solid']};\n }\n }\n `;\n }\n);\n\nStyledDialogTitle.defaultProps = defaultThemeProp;\n\nexport const useDialog = () => {\n const [target, setTarget] = useState<HTMLElement | null>(null);\n const [loading, setLoading] = useState(false);\n\n const setTargetWithEvent = (e: ReactMouseEvent | ReactKeyboardEvent) => {\n if (e.target instanceof HTMLElement) {\n setTarget(e.target);\n }\n };\n\n return {\n target,\n loading,\n setLoading,\n events: {\n onMouseDown: (e: ReactMouseEvent) => {\n setTargetWithEvent(e);\n },\n onKeyDown: (e: ReactKeyboardEvent) => {\n if (e.key === 'Enter') {\n setTargetWithEvent(e);\n }\n }\n },\n setTargetWithEvent\n };\n};\n\nconst Dialog: FunctionComponent<DialogProps & ForwardProps> = forwardRef(\n (\n {\n target,\n placement,\n heading,\n headingHidden = false,\n onSubmit,\n onClose,\n onOpen,\n loading,\n children,\n ...restProps\n }: PropsWithoutRef<DialogProps>,\n ref: DialogProps['ref']\n ) => {\n const t = useI18n();\n const headingId = useUID();\n const [popoverEl, setPopoverEl] = useElement<HTMLDivElement>();\n const popoverRef = useConsolidatedRef(ref, setPopoverEl);\n const headingRef = useRef<HTMLSpanElement>(null);\n const [currentTarget, setCurrentTarget] = useState(() => target);\n const [show, setShow] = useState(false);\n const skipChangeShow = useRef(false);\n const prevTarget = usePrevious(target);\n useEscape(\n () => {\n if (show) {\n setShow(false);\n }\n },\n undefined,\n [show, setShow]\n );\n useOuterEvent('mousedown', [target, popoverEl], () => {\n if (target && popoverEl && show) {\n setShow(false);\n onClose?.();\n }\n });\n useFocusTrap(popoverRef);\n\n useEffect(() => {\n if (!show) {\n currentTarget?.focus();\n }\n }, [show]);\n\n useEffect(() => {\n if (show && popoverEl) {\n if (headingRef.current) {\n headingRef.current.focus();\n } else {\n const focusables = getFocusables(popoverRef);\n focusables[0]?.focus();\n }\n }\n }, [show, popoverEl]);\n\n useLayoutEffect(() => {\n const onTargetClick = (e: MouseEvent) => {\n setCurrentTarget(prev => (e.target ? (e.target as HTMLElement) : prev));\n if (!skipChangeShow.current) {\n setShow(prev => !prev);\n } else {\n skipChangeShow.current = false;\n }\n };\n if (target instanceof HTMLElement) {\n target.addEventListener('click', onTargetClick);\n }\n return () => {\n if (target instanceof HTMLElement) {\n target.removeEventListener('click', onTargetClick);\n }\n };\n }, [target]);\n\n useEffect(() => {\n if (show) {\n onOpen?.();\n } else {\n onClose?.();\n }\n }, [show]);\n\n useEffect(() => {\n /* If our target is changing and the popover is already open we will want\n to skip the next change. The next show change would come from a click on the new button,\n the popover should stay open. */\n if (target !== prevTarget && show) {\n skipChangeShow.current = true;\n }\n }, [target, show]);\n\n const onTitleKeyDown = (e: ReactKeyboardEvent) => {\n const focusables = getFocusables(popoverRef);\n if (e.shiftKey && e.key === 'Tab') {\n e.preventDefault();\n focusables[focusables.length - 1].focus();\n }\n };\n\n const progress = loading ? <Progress placement='local' /> : null;\n\n return (\n <Popover\n {...restProps}\n as={StyledDialog}\n ref={popoverRef}\n target={currentTarget}\n placement={placement}\n show={show}\n open={show}\n aria-labelledby={headingId}\n >\n <CardHeader\n actions={\n !onSubmit ? (\n <Button icon variant='simple' onClick={() => setShow(false)} aria-label={t('close')}>\n <Icon name='times' />\n </Button>\n ) : undefined\n }\n >\n {headingHidden ? (\n <VisuallyHiddenText id={headingId}>{heading}</VisuallyHiddenText>\n ) : (\n <StyledDialogTitle\n variant='h2'\n tabIndex={-1}\n ref={headingRef}\n onKeyDown={onTitleKeyDown}\n id={headingId}\n >\n {heading}\n </StyledDialogTitle>\n )}\n </CardHeader>\n <CardContent>\n {children}\n {progress}\n </CardContent>\n {onSubmit && (\n <CardFooter justify='between'>\n <Button variant='secondary' onClick={() => setShow(false)}>\n {t('cancel')}\n </Button>\n <Button\n variant='primary'\n onClick={() => onSubmit({ close: () => setShow(false) })}\n disabled={loading}\n >\n {t('submit')}\n </Button>\n </CardFooter>\n )}\n </Popover>\n );\n }\n);\n\nexport default Dialog;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAe,SAAS,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { default } from './Dialog';\nexport { DialogProps, useDialog } from './Dialog';\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent, Ref, ReactNode } from 'react';
|
|
2
2
|
import { ActionsProps } from '../Actions';
|
|
3
3
|
import { BaseProps, ForwardProps } from '../../types';
|
|
4
|
+
import { AdditionalInfoProps } from '../AdditionalInfo';
|
|
4
5
|
export interface FieldGroupProps extends BaseProps {
|
|
5
6
|
/** The content of the Field Group. */
|
|
6
7
|
children: ReactNode;
|
|
@@ -18,11 +19,17 @@ export interface FieldGroupProps extends BaseProps {
|
|
|
18
19
|
defaultCollapsed?: boolean;
|
|
19
20
|
/** The name associated with the Field Group. */
|
|
20
21
|
name?: string;
|
|
22
|
+
/** Provides additional info relevant to the field group. */
|
|
23
|
+
additionalInfo?: {
|
|
24
|
+
heading: AdditionalInfoProps['heading'];
|
|
25
|
+
content: AdditionalInfoProps['children'];
|
|
26
|
+
};
|
|
21
27
|
/** An array of actions to add to the header. */
|
|
22
28
|
actions?: ActionsProps['items'];
|
|
23
29
|
/** A reference to the wrapping element. */
|
|
24
30
|
ref?: Ref<HTMLFieldSetElement>;
|
|
25
31
|
}
|
|
32
|
+
export declare const StyledFieldGroupName: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
26
33
|
export declare const StyledFieldGroupLegend: import("styled-components").StyledComponent<"legend", import("styled-components").DefaultTheme, {
|
|
27
34
|
open: boolean;
|
|
28
35
|
}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjG,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjG,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAuB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxE,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,sCAAsC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,cAAc,CAAC,EAAE;QACf,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACxC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;KAC1C,CAAC;IACF,gDAAgD;IAChD,OAAO,CAAC,EAAE,YAAY,CAAC,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