@pega/cosmos-react-core 2.0.0-dev.9.2 → 2.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/README.md +3 -3
- package/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts +2 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +4 -9
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +89 -62
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +227 -173
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +7 -7
- 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 +3 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -1
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts +4 -3
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js +24 -19
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +7 -8
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.js +3 -5
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +30 -39
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +5 -4
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +7 -6
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Alert.d.ts +2 -2
- package/lib/components/Badges/Alert.d.ts.map +1 -1
- package/lib/components/Badges/Alert.js +1 -1
- package/lib/components/Badges/Alert.js.map +1 -1
- package/lib/components/Badges/Count.js +1 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Badges/Selection.d.ts.map +1 -1
- package/lib/components/Badges/Selection.js +10 -9
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/Badges/Status.d.ts +2 -2
- package/lib/components/Badges/Status.d.ts.map +1 -1
- package/lib/components/Badges/Status.js +1 -1
- package/lib/components/Badges/Status.js.map +1 -1
- package/lib/components/Badges/Tag.js +1 -1
- package/lib/components/Badges/Tag.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +2 -2
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +6 -8
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
- package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +1 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
- package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/components/Button/BareButton.d.ts.map +1 -1
- package/lib/components/Button/BareButton.js +21 -2
- package/lib/components/Button/BareButton.js.map +1 -1
- package/lib/components/Button/BareRoleButton.d.ts +12 -0
- package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
- package/lib/components/Button/BareRoleButton.js +20 -0
- package/lib/components/Button/BareRoleButton.js.map +1 -0
- package/lib/components/Button/Button.d.ts +5 -0
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +34 -10
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +3 -2
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js +5 -4
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.d.ts.map +1 -1
- package/lib/components/Card/CardFooter.js +5 -4
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.d.ts +3 -1
- package/lib/components/Card/CardHeader.d.ts.map +1 -1
- package/lib/components/Card/CardHeader.js +9 -7
- package/lib/components/Card/CardHeader.js.map +1 -1
- package/lib/components/Card/CardMedia.js +1 -1
- package/lib/components/Card/CardMedia.js.map +1 -1
- package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
- package/lib/components/Card/CollapsibleCard.js +5 -7
- package/lib/components/Card/CollapsibleCard.js.map +1 -1
- package/lib/components/Card/SelectableCard.js +1 -1
- package/lib/components/Card/SelectableCard.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js +8 -11
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +30 -33
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.types.d.ts +2 -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.js +4 -4
- 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 +23 -29
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +16 -12
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +11 -13
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +11 -7
- 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 +16 -16
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
- 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 +12 -1
- package/lib/components/Currency/utils.d.ts.map +1 -1
- package/lib/components/Currency/utils.js +30 -2
- package/lib/components/Currency/utils.js.map +1 -1
- package/lib/components/DateTime/DateTime.types.d.ts +2 -1
- package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +14 -3
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +11 -6
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +25 -27
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +14 -3
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +42 -42
- 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 +7 -5
- 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 +3 -3
- package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
- 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 +12 -15
- package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +12 -17
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +3 -4
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
- package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
- package/lib/components/DateTime/Input/QuarterInput.js +102 -0
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +26 -30
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +22 -23
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
- package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.js +4 -4
- package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +7 -0
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +52 -10
- 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 +47 -72
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
- 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 +13 -17
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +13 -17
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +9 -10
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js +9 -11
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.d.ts +1 -0
- package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/utils.js +3 -0
- package/lib/components/DateTime/Picker/utils.js.map +1 -1
- package/lib/components/DateTime/index.d.ts +2 -0
- package/lib/components/DateTime/index.d.ts.map +1 -1
- package/lib/components/DateTime/index.js +1 -0
- package/lib/components/DateTime/index.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +6 -6
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Email/EmailDisplay.d.ts +2 -2
- package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
- package/lib/components/Email/EmailDisplay.js +2 -2
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
- package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.js +3 -4
- package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.d.ts +14 -0
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
- package/lib/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/components/EmptyState/index.d.ts +4 -0
- package/lib/components/EmptyState/index.d.ts.map +1 -0
- package/lib/components/EmptyState/index.js +3 -0
- package/lib/components/EmptyState/index.js.map +1 -0
- package/lib/components/ErrorState/ErrorState.d.ts +16 -0
- package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
- package/lib/components/ErrorState/ErrorState.js +31 -0
- package/lib/components/ErrorState/ErrorState.js.map +1 -0
- package/lib/components/ErrorState/index.d.ts +4 -0
- package/lib/components/ErrorState/index.d.ts.map +1 -0
- package/lib/components/ErrorState/index.js +3 -0
- package/lib/components/ErrorState/index.js.map +1 -0
- package/lib/components/ExpandCollapse/ExpandCollapse.js +5 -5
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +6 -7
- 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 +7 -6
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +5 -7
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.d.ts +6 -3
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js +7 -7
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +3 -3
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js +18 -19
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/File/FileItem.d.ts +0 -2
- package/lib/components/File/FileItem.d.ts.map +1 -1
- package/lib/components/File/FileItem.js +3 -4
- package/lib/components/File/FileItem.js.map +1 -1
- package/lib/components/File/FileUploadItem.d.ts +4 -2
- package/lib/components/File/FileUploadItem.d.ts.map +1 -1
- package/lib/components/File/FileUploadItem.js +58 -20
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/File/FileVisual.d.ts +7 -16
- package/lib/components/File/FileVisual.d.ts.map +1 -1
- package/lib/components/File/FileVisual.js +44 -47
- package/lib/components/File/FileVisual.js.map +1 -1
- package/lib/components/File/utils.js +2 -3
- package/lib/components/File/utils.js.map +1 -1
- package/lib/components/Flex/Flex.d.ts +17 -7
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js +25 -9
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/Form/Form.d.ts +7 -1
- package/lib/components/Form/Form.d.ts.map +1 -1
- package/lib/components/Form/Form.js +5 -4
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +5 -7
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +9 -19
- 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.js +17 -21
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Icon/Icon.js +3 -5
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
- package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
- package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
- package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
- package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
- package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
- package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/dock.icon.js +6 -0
- package/lib/components/Icon/icons/dock.icon.js.map +1 -0
- package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
- package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
- package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
- package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
- package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
- package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
- package/lib/components/Icon/icons/galaxy.icon.js +1 -3
- package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
- package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/grad.icon.js +1 -5
- package/lib/components/Icon/icons/grad.icon.js.map +1 -1
- package/lib/components/Icon/icons/list-number.icon.js +1 -6
- package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
- package/lib/components/Icon/icons/list.icon.js +1 -6
- package/lib/components/Icon/icons/list.icon.js.map +1 -1
- package/lib/components/Icon/icons/pin.icon.js +1 -2
- package/lib/components/Icon/icons/pin.icon.js.map +1 -1
- package/lib/components/Icon/icons/search-solid.icon.js +1 -2
- package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tracer.icon.js +1 -2
- package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
- package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/tribox.icon.js +1 -3
- package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
- package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
- package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/undock.icon.js +6 -0
- package/lib/components/Icon/icons/undock.icon.js.map +1 -0
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/index.d.ts +1 -1
- package/lib/components/Image/index.d.ts.map +1 -1
- package/lib/components/Image/index.js +1 -0
- package/lib/components/Image/index.js.map +1 -1
- package/lib/components/Input/Input.d.ts +2 -2
- package/lib/components/Input/Input.d.ts.map +1 -1
- package/lib/components/Input/Input.js +13 -13
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/Input.styles.js +2 -2
- package/lib/components/Input/Input.styles.js.map +1 -1
- package/lib/components/Label/Label.js +1 -1
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts +6 -0
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.js +129 -0
- package/lib/components/Lightbox/Lightbox.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.styles.js +166 -0
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
- package/lib/components/Lightbox/Lightbox.types.js +2 -0
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
- package/lib/components/Lightbox/index.d.ts +3 -0
- package/lib/components/Lightbox/index.d.ts.map +1 -0
- package/lib/components/Lightbox/index.js +2 -0
- package/lib/components/Lightbox/index.js.map +1 -0
- package/lib/components/Link/Link.js +5 -8
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/List/CommaSeparatedList.d.ts +15 -0
- package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
- package/lib/components/List/CommaSeparatedList.js +61 -0
- package/lib/components/List/CommaSeparatedList.js.map +1 -0
- package/lib/components/List/List.d.ts +30 -0
- package/lib/components/List/List.d.ts.map +1 -0
- package/lib/components/List/List.js +56 -0
- package/lib/components/List/List.js.map +1 -0
- package/lib/components/List/OrderedList.d.ts +6 -0
- package/lib/components/List/OrderedList.d.ts.map +1 -0
- package/lib/components/List/OrderedList.js +6 -0
- package/lib/components/List/OrderedList.js.map +1 -0
- package/lib/components/List/UnorderedList.d.ts +6 -0
- package/lib/components/List/UnorderedList.d.ts.map +1 -0
- package/lib/components/List/UnorderedList.js +6 -0
- package/lib/components/List/UnorderedList.js.map +1 -0
- package/lib/components/List/index.d.ts +5 -0
- package/lib/components/List/index.d.ts.map +1 -0
- package/lib/components/List/index.js +4 -0
- package/lib/components/List/index.js.map +1 -0
- package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
- package/lib/components/Location/CurrentLocationButton.js +7 -7
- package/lib/components/Location/CurrentLocationButton.js.map +1 -1
- package/lib/components/Location/Location.types.d.ts +2 -1
- package/lib/components/Location/Location.types.d.ts.map +1 -1
- package/lib/components/Location/Location.types.js.map +1 -1
- package/lib/components/Location/LocationDisplay.js +8 -9
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/LocationInput.js +27 -28
- package/lib/components/Location/LocationInput.js.map +1 -1
- package/lib/components/Location/LocationView.js +8 -13
- package/lib/components/Location/LocationView.js.map +1 -1
- package/lib/components/Location/utils.js +11 -15
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +12 -15
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.context.d.ts.map +1 -1
- package/lib/components/Menu/Menu.context.js +2 -0
- package/lib/components/Menu/Menu.context.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +89 -46
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +11 -0
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +202 -3
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +30 -12
- 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 +6 -0
- package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
- package/lib/components/Menu/MenuGroup.js +17 -0
- package/lib/components/Menu/MenuGroup.js.map +1 -0
- package/lib/components/Menu/MenuItem.d.ts +0 -3
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +57 -164
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +28 -30
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts +0 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +7 -55
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +2 -3
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +13 -12
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +40 -36
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/Menu/index.d.ts +2 -3
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -2
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +3 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +13 -14
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MetaList/MetaList.d.ts +13 -4
- package/lib/components/MetaList/MetaList.d.ts.map +1 -1
- package/lib/components/MetaList/MetaList.js +34 -20
- 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 +3 -0
- package/lib/components/Modal/Contexts.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +5 -4
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +53 -38
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts +1 -6
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +82 -134
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +9 -0
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
- package/lib/components/Modal/Modal.styles.js +135 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -0
- package/lib/components/Modal/Modal.types.d.ts +56 -5
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Modal/ModalManager.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js +74 -65
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +10 -12
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
- package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
- package/lib/components/Number/NumberDisplay.d.ts +2 -2
- package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.js +1 -1
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +18 -25
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +2 -2
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/utils.js +2 -3
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +8 -18
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +48 -28
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +89 -79
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/index.d.ts +3 -0
- package/lib/components/PageTemplates/index.d.ts.map +1 -1
- package/lib/components/PageTemplates/index.js +1 -0
- package/lib/components/PageTemplates/index.js.map +1 -1
- package/lib/components/Pagination/Pagination.d.ts +2 -2
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +7 -6
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
- package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
- package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
- package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
- package/lib/components/Paragraph/index.d.ts +3 -0
- package/lib/components/Paragraph/index.d.ts.map +1 -0
- package/lib/components/Paragraph/index.js +2 -0
- package/lib/components/Paragraph/index.js.map +1 -0
- package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -3
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +2 -2
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +18 -17
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.js +2 -3
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +0 -4
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +11 -122
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +5 -0
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
- package/lib/components/Popover/Popover.styles.js +116 -0
- package/lib/components/Popover/Popover.styles.js.map +1 -0
- package/lib/components/Popover/PopoverManager.js +2 -2
- package/lib/components/Popover/PopoverManager.js.map +1 -1
- package/lib/components/Popover/index.d.ts +1 -1
- package/lib/components/Popover/index.d.ts.map +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Progress/Bar.js +2 -2
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ellipsis.d.ts +1 -1
- package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
- package/lib/components/Progress/Ellipsis.js +48 -50
- package/lib/components/Progress/Ellipsis.js.map +1 -1
- package/lib/components/Progress/Progress.js +3 -4
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Progress.types.d.ts +2 -2
- package/lib/components/Progress/Progress.types.d.ts.map +1 -1
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/Progress/Ring.d.ts +1 -1
- package/lib/components/Progress/Ring.d.ts.map +1 -1
- package/lib/components/Progress/Ring.js +40 -40
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +7 -8
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
- package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.d.ts +2 -2
- package/lib/components/Rating/Rating.d.ts.map +1 -1
- package/lib/components/Rating/Rating.js +6 -7
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +4 -4
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +14 -14
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Option.js +1 -1
- package/lib/components/Select/Option.js.map +1 -1
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +15 -16
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Sentiment/Sentiment.d.ts +2 -2
- package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
- package/lib/components/Sentiment/Sentiment.js +1 -2
- package/lib/components/Sentiment/Sentiment.js.map +1 -1
- package/lib/components/Skeleton/LineSkeleton.js +1 -1
- package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
- package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
- package/lib/components/Slider/Slider.d.ts.map +1 -1
- package/lib/components/Slider/Slider.js +12 -19
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +4 -1
- package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
- package/lib/components/Slider/Slider.styles.js +17 -5
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/Slider/Slider.types.d.ts +2 -2
- package/lib/components/Slider/Slider.types.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/Slider/SliderTicks.d.ts +1 -0
- package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
- package/lib/components/Slider/SliderTicks.js +19 -12
- package/lib/components/Slider/SliderTicks.js.map +1 -1
- package/lib/components/Slider/utils.d.ts +10 -11
- package/lib/components/Slider/utils.d.ts.map +1 -1
- package/lib/components/Slider/utils.js +24 -18
- package/lib/components/Slider/utils.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
- package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js +3 -5
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts +8 -2
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +10 -11
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +14 -10
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.d.ts +2 -2
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +41 -30
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.d.ts +2 -2
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +14 -13
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/Tab.d.ts +1 -1
- package/lib/components/Tabs/Tab.d.ts.map +1 -1
- package/lib/components/Tabs/Tab.js +9 -7
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +10 -2
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +24 -8
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts +1 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +22 -18
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/Tabs.types.d.ts +2 -2
- package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.types.js.map +1 -1
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.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 +2 -2
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +31 -30
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/Toaster/Toaster.d.ts +8 -36
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +97 -102
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +6 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +6 -13
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts +6 -0
- package/lib/components/Tree/StandardTree.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.js +175 -0
- package/lib/components/Tree/StandardTree.js.map +1 -0
- package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
- package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.styles.js +155 -0
- package/lib/components/Tree/StandardTree.styles.js.map +1 -0
- package/lib/components/Tree/StandardTree.types.d.ts +25 -0
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
- package/lib/components/Tree/StandardTree.types.js +2 -0
- package/lib/components/Tree/StandardTree.types.js.map +1 -0
- package/lib/components/Tree/Tree.d.ts +35 -49
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/Tree.js +18 -56
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/helpers.d.ts +19 -0
- package/lib/components/Tree/helpers.d.ts.map +1 -0
- package/lib/components/Tree/helpers.js +180 -0
- package/lib/components/Tree/helpers.js.map +1 -0
- package/lib/components/Tree/index.d.ts +4 -2
- package/lib/components/Tree/index.d.ts.map +1 -1
- package/lib/components/Tree/index.js +3 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts +2 -2
- package/lib/components/URL/URLDisplay.d.ts.map +1 -1
- package/lib/components/URL/URLDisplay.js +2 -2
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/index.d.ts +7 -4
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +7 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts +17 -3
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +86 -64
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useAutoResize.d.ts.map +1 -1
- package/lib/hooks/useAutoResize.js +6 -7
- package/lib/hooks/useAutoResize.js.map +1 -1
- package/lib/hooks/useBreakpoint.js +2 -4
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +8 -0
- package/lib/hooks/useDraggable.d.ts.map +1 -0
- package/lib/hooks/useDraggable.js +64 -0
- package/lib/hooks/useDraggable.js.map +1 -0
- package/lib/hooks/useFocusWithin.d.ts +1 -1
- package/lib/hooks/useFocusWithin.d.ts.map +1 -1
- package/lib/hooks/useFocusWithin.js +29 -24
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +505 -170
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useI18n.js +2 -2
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useLongPress.d.ts +16 -0
- package/lib/hooks/useLongPress.d.ts.map +1 -0
- package/lib/hooks/useLongPress.js +59 -0
- package/lib/hooks/useLongPress.js.map +1 -0
- package/lib/hooks/useOuterEvent.js +1 -1
- package/lib/hooks/useOuterEvent.js.map +1 -1
- package/lib/hooks/useOverride.js +1 -1
- package/lib/hooks/useOverride.js.map +1 -1
- package/lib/hooks/useScrollStick.js +14 -3
- package/lib/hooks/useScrollStick.js.map +1 -1
- package/lib/hooks/useScrollToggle.d.ts +6 -0
- package/lib/hooks/useScrollToggle.d.ts.map +1 -0
- package/lib/hooks/useScrollToggle.js +40 -0
- package/lib/hooks/useScrollToggle.js.map +1 -0
- package/lib/hooks/useTransitionState.d.ts +39 -0
- package/lib/hooks/useTransitionState.d.ts.map +1 -0
- package/lib/hooks/useTransitionState.js +56 -0
- package/lib/hooks/useTransitionState.js.map +1 -0
- package/lib/i18n/default.d.ts +583 -0
- package/lib/i18n/default.d.ts.map +1 -0
- package/lib/i18n/default.js +627 -0
- package/lib/i18n/default.js.map +1 -0
- package/lib/i18n/i18n.d.ts +988 -318
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/i18n/i18n.js +1 -1
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/i18n/index.d.ts +1 -0
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/translate.d.ts +29 -4
- package/lib/i18n/translate.d.ts.map +1 -1
- package/lib/i18n/translate.js +21 -8
- package/lib/i18n/translate.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +2 -26
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/ThemeMachine.js +7 -1
- 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 +83 -53
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +50 -30
- package/lib/theme/themeOverrides.schema.json +24 -3
- package/lib/theme/themes/buildTheme.json +3 -39
- package/lib/theme/themes/darkTheme.json +6 -0
- package/lib/theme/themes/legacyBuildTheme.json +50 -0
- package/lib/types/types.d.ts +6 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/utils.d.ts +41 -4
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +55 -9
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -11
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
- package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
- package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
- package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
- package/lib/components/NoItems/NoItems.d.ts +0 -14
- package/lib/components/NoItems/NoItems.d.ts.map +0 -1
- package/lib/components/NoItems/NoItems.js.map +0 -1
- package/lib/components/NoItems/index.d.ts +0 -4
- package/lib/components/NoItems/index.d.ts.map +0 -1
- package/lib/components/NoItems/index.js +0 -3
- package/lib/components/NoItems/index.js.map +0 -1
- package/lib/i18n/default.json +0 -246
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,QAAQ,EAER,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,UAA8B,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EACL,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,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E,CAAC,IACG,SAAS,eAEb,KAAC,IAAI,kBACH,GAAG,EAAE,iBAAiB,EACtB,EAAE,EAAE,oBAAoB,EACxB,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,gBAEhD,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBACpE,QAAQ,IAAI,EAAE;wBACZ,KAAK,IAAI;4BACP,OAAO,SAAS,CAAC;wBACnB,KAAK,IAAI;4BACP,OAAO,WAAW,CAAC;wBACrB,KAAK,IAAI;4BACP,OAAO,WAAW,CAAC;wBACrB,KAAK,IAAI,CAAC;wBACV,KAAK,IAAI;4BACP,OAAO,MAAM,CAAC;wBAChB;4BACE,OAAO,IAAI,CAAC;qBACf;gBACH,CAAC,CAAC,YACG;YACN,CAAC,QAAQ,IAAI,MAAM,aACf,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,kBACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,IACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAChE,GAAG,EAAE,GAAG,gBAEP,IAAI,YACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FunctionComponent,\n useRef,\n useState,\n ChangeEvent,\n forwardRef,\n Ref,\n PropsWithoutRef\n} from 'react';\nimport styled from 'styled-components';\n\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Select, { Option } from '../../Select';\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport Popover from '../../Popover';\nimport TimePicker, { MinuteInterval } from '../Picker/TimePicker';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n getDateFormat,\n parseToDate,\n is12HClockFormat,\n validateTime,\n ClockFormat,\n getTimeOptions\n} from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\n\nexport interface TimeInputProps extends DateTimeProps {\n /**\n * Display the time with seconds.\n * @default false\n */\n withSeconds?: boolean;\n /**\n * Defines interval for time picker options (in minutes).\n * @default 30\n */\n pickerInterval?: MinuteInterval;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n}\n\nexport const StyledTimeInput = styled(StyledDateTime)<TimeInputProps>`\n padding-inline-end: 0;\n`;\n\nfunction getMeridiem(hour: number) {\n return hour >= 12 ? 'PM' : 'AM';\n}\n\nconst convertTo12h = (hour: number) => {\n let converted: number = hour;\n if (hour > 12) converted = hour - 12;\n else if (hour === 0) converted = 12;\n return converted;\n};\n\nconst convertTo24h = (hour: number, meridiem: string) => {\n let converted: number = hour;\n if (meridiem === 'PM' && hour < 12) converted = hour + 12;\n else if (meridiem === 'AM' && hour === 12) converted = 0;\n return converted;\n};\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[],\n meridiem?: string\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [hour, minute, second = date.getUTCSeconds()] = parts.map(Number);\n\n const is12h = meridiem !== undefined;\n\n if (!validateTime(hour, minute, second, is12h)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCHours(is12h ? convertTo24h(hour, meridiem!) : hour, minute, second);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst TimeInput: FunctionComponent<TimeInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TimeInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n id,\n label,\n labelHidden,\n status,\n withSeconds = false,\n pickerInterval = 30,\n clockFormat,\n info = getDateFormat(locale, getTimeOptions(withSeconds), true).join(''),\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const is12h = clockFormat ? clockFormat === 12 : is12HClockFormat(locale);\n const [meridiem, setMeridiem] = useState<'AM' | 'PM' | undefined>(\n is12h ? () => (date ? getMeridiem(date.getUTCHours()) : 'AM') : undefined\n );\n\n const [hourInputRef, minuteInputRef, secondInputRef, meridiemSelectRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLSelectElement>(null)\n ];\n\n useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);\n\n const pickParts = () => {\n return [\n hourInputRef.current?.value || undefined,\n minuteInputRef.current?.value || undefined\n ].concat(withSeconds ? [secondInputRef.current?.value] : []);\n };\n\n const currentlySelectedTime = () => {\n const parts = pickParts();\n\n if (parts.every(Boolean)) {\n const [hour, minute, second = 0] = parts.map(Number);\n const current = date ?? new Date();\n return validateTime(hour, minute, second, is12h)\n ? new Date(\n current.setUTCHours(is12h ? convertTo24h(hour, meridiem!) : hour, minute, second)\n )\n : undefined;\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const currentMeridiem = meridiemSelectRef.current?.value || undefined;\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts(),\n is12h ? currentMeridiem : undefined\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const onInputChange = () => {\n const currentMeridiem = meridiemSelectRef.current?.value || undefined;\n onChange?.(\n convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts(),\n is12h ? currentMeridiem : undefined\n )\n );\n };\n\n const t = useI18n();\n\n const hour = date && is12h ? convertTo12h(date.getUTCHours()) : date?.getUTCHours();\n const HourInput = (\n <PartInput\n key='hour'\n placeholder={t('hour_placeholder')}\n aria-label={t('hour_label_a11y')}\n value={hour}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={is12h ? 1 : 0}\n max={is12h ? 12 : 23}\n ref={hourInputRef}\n autoFocus={autoFocus}\n />\n );\n\n const MinuteInput = (\n <PartInput\n key='minute'\n placeholder={t('minute_placeholder')}\n aria-label={t('minute_label_a11y')}\n value={date?.getUTCMinutes()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={minuteInputRef}\n />\n );\n\n const SecondInput = (\n <PartInput\n key='second'\n placeholder={t('second_placeholder')}\n aria-label={t('second_label_a11y')}\n value={date?.getUTCSeconds()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={secondInputRef}\n />\n );\n\n const Period = (\n <Select\n ref={meridiemSelectRef}\n aria-label={t('meridiem_label_a11y')}\n key='period'\n value={meridiem}\n required={required}\n disabled={disabled}\n onChange={(ev: ChangeEvent<HTMLSelectElement>) => {\n setMeridiem(ev.target.value as 'AM' | 'PM');\n onInputChange();\n }}\n readOnly={readOnly}\n >\n <Option value='AM'>{t('meridiem_value_am')}</Option>\n <Option value='PM'>{t('meridiem_value_pm')}</Option>\n </Select>\n );\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const Picker = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={t(open ? 'close_time_button_a11y' : 'open_time_button_a11y')}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'clock'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n fn({ state }) {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n }\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end']\n }\n }\n ]}\n >\n <TimePicker\n selected={currentlySelectedTime()}\n interval={pickerInterval}\n onSelect={selected => {\n hourInputRef.current!.value = (\n is12h ? convertTo12h(selected.getUTCHours()) : selected.getUTCHours()\n )\n .toString()\n .padStart(2, '0');\n minuteInputRef.current!.value = selected.getUTCMinutes().toString().padStart(2, '0');\n if (withSeconds)\n secondInputRef.current!.value = selected\n .getUTCSeconds()\n .toString()\n .padStart(2, '0');\n if (meridiemSelectRef.current) {\n meridiemSelectRef.current!.value = getMeridiem(selected.getUTCHours());\n }\n setMeridiem(getMeridiem(selected.getUTCHours()));\n setOpen(false);\n buttonEl?.focus();\n onInputChange();\n }}\n clockFormat={clockFormat}\n />\n </Popover>\n </>\n );\n\n const Comp = (\n <Flex\n as={StyledTimeInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) hourInputRef.current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n >\n {getDateFormat(locale, getTimeOptions(withSeconds, is12h)).map(part => {\n switch (part) {\n case 'hh':\n return HourInput;\n case 'mm':\n return MinuteInput;\n case 'ss':\n return SecondInput;\n case 'AM':\n case 'PM':\n return Period;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && Picker}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default TimeInput;\n"]}
|
|
1
|
+
{"version":3,"file":"TimeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,QAAQ,EAER,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,UAA8B,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EACL,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OA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AC,MAAM,EAAE,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBACpE,QAAQ,IAAI,EAAE;wBACZ,KAAK,IAAI;4BACP,OAAO,SAAS,CAAC;wBACnB,KAAK,IAAI;4BACP,OAAO,WAAW,CAAC;wBACrB,KAAK,IAAI;4BACP,OAAO,WAAW,CAAC;wBACrB,KAAK,IAAI,CAAC;wBACV,KAAK,IAAI;4BACP,OAAO,MAAM,CAAC;wBAChB;4BACE,OAAO,IAAI,CAAC;qBACf;gBACH,CAAC,CAAC,WACG,EACN,CAAC,QAAQ,IAAI,MAAM,YACf,CACR,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAChE,GAAG,EAAE,GAAG,YAEP,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FunctionComponent,\n useRef,\n useState,\n ChangeEvent,\n forwardRef,\n Ref,\n PropsWithoutRef\n} from 'react';\nimport styled from 'styled-components';\n\nimport { ForwardProps } from '../../../types';\nimport FormField from '../../FormField';\nimport Flex from '../../Flex';\nimport Select, { Option } from '../../Select';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as timesIcon from '../../Icon/icons/times.icon';\nimport * as clockIcon from '../../Icon/icons/clock.icon';\nimport Popover from '../../Popover';\nimport TimePicker, { MinuteInterval } from '../Picker/TimePicker';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { StyledFormControl } from '../../FormControl';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n getDateFormat,\n parseToDate,\n is12HClockFormat,\n validateTime,\n ClockFormat,\n getTimeOptions\n} from './utils';\nimport StyledDateTime, { StyledInputContainer } from './DateTime.styles';\nimport PartInput from './PartInput';\nimport usePickerButton from './usePickerButton';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\n\nregisterIcon(timesIcon, clockIcon);\n\nexport interface TimeInputProps extends DateTimeProps {\n /**\n * Display the time with seconds.\n * @default false\n */\n withSeconds?: boolean;\n /**\n * Defines interval for time picker options (in minutes).\n * @default 30\n */\n pickerInterval?: MinuteInterval;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n}\n\nexport const StyledTimeInput = styled(StyledDateTime)<TimeInputProps>`\n padding-inline-end: 0;\n`;\n\nfunction getMeridiem(hour: number) {\n return hour >= 12 ? 'PM' : 'AM';\n}\n\nconst convertTo12h = (hour: number) => {\n let converted: number = hour;\n if (hour > 12) converted = hour - 12;\n else if (hour === 0) converted = 12;\n return converted;\n};\n\nconst convertTo24h = (hour: number, meridiem: string) => {\n let converted: number = hour;\n if (meridiem === 'PM' && hour < 12) converted = hour + 12;\n else if (meridiem === 'AM' && hour === 12) converted = 0;\n return converted;\n};\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[],\n meridiem?: string\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [hour, minute, second = date.getUTCSeconds()] = parts.map(Number);\n\n const is12h = meridiem !== undefined;\n\n if (!validateTime(hour, minute, second, is12h)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'invalid'\n };\n }\n\n date.setUTCHours(is12h ? convertTo24h(hour, meridiem!) : hour, minute, second);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst TimeInput: FunctionComponent<TimeInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TimeInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const { locale } = useConfiguration();\n const {\n defaultValue,\n value = defaultValue,\n id,\n label,\n labelHidden,\n status,\n withSeconds = false,\n pickerInterval = 30,\n clockFormat,\n info = getDateFormat(locale, getTimeOptions(withSeconds), true).join(''),\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const is12h = clockFormat ? clockFormat === 12 : is12HClockFormat(locale);\n const [meridiem, setMeridiem] = useState<'AM' | 'PM' | undefined>(\n is12h ? () => (date ? getMeridiem(date.getUTCHours()) : 'AM') : undefined\n );\n\n const [hourInputRef, minuteInputRef, secondInputRef, meridiemSelectRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null),\n useRef<HTMLSelectElement>(null)\n ];\n\n useAutoFocusNextInput([hourInputRef, minuteInputRef, secondInputRef]);\n\n const pickParts = () => {\n return [\n hourInputRef.current?.value || undefined,\n minuteInputRef.current?.value || undefined\n ].concat(withSeconds ? [secondInputRef.current?.value] : []);\n };\n\n const currentlySelectedTime = () => {\n const parts = pickParts();\n\n if (parts.every(Boolean)) {\n const [hour, minute, second = 0] = parts.map(Number);\n const current = date ?? new Date();\n return validateTime(hour, minute, second, is12h)\n ? new Date(\n current.setUTCHours(is12h ? convertTo24h(hour, meridiem!) : hour, minute, second)\n )\n : undefined;\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const currentMeridiem = meridiemSelectRef.current?.value || undefined;\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts(),\n is12h ? currentMeridiem : undefined\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const onInputChange = () => {\n const currentMeridiem = meridiemSelectRef.current?.value || undefined;\n onChange?.(\n convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n pickParts(),\n is12h ? currentMeridiem : undefined\n )\n );\n };\n\n const t = useI18n();\n\n const hour = date && is12h ? convertTo12h(date.getUTCHours()) : date?.getUTCHours();\n const HourInput = (\n <PartInput\n key='hour'\n placeholder={t('hour_placeholder')}\n aria-label={t('hour_label_a11y')}\n value={hour}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n min={is12h ? 1 : 0}\n max={is12h ? 12 : 23}\n ref={hourInputRef}\n autoFocus={autoFocus}\n />\n );\n\n const MinuteInput = (\n <PartInput\n key='minute'\n placeholder={t('minute_placeholder')}\n aria-label={t('minute_label_a11y')}\n value={date?.getUTCMinutes()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={minuteInputRef}\n />\n );\n\n const SecondInput = (\n <PartInput\n key='second'\n placeholder={t('second_placeholder')}\n aria-label={t('second_label_a11y')}\n value={date?.getUTCSeconds()}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n readOnly={readOnly}\n max={59}\n ref={secondInputRef}\n />\n );\n\n const Period = (\n <Select\n ref={meridiemSelectRef}\n aria-label={t('meridiem_label_a11y')}\n key='period'\n value={meridiem}\n required={required}\n disabled={disabled}\n onChange={(ev: ChangeEvent<HTMLSelectElement>) => {\n setMeridiem(ev.target.value as 'AM' | 'PM');\n onInputChange();\n }}\n readOnly={readOnly}\n >\n <Option value='AM'>{t('meridiem_value_am')}</Option>\n <Option value='PM'>{t('meridiem_value_pm')}</Option>\n </Select>\n );\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const Picker = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={t(open ? 'close_time_button_a11y' : 'open_time_button_a11y')}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'clock'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n placement='bottom-end'\n strategy='fixed'\n modifiers={[\n {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n fn({ state }) {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n }\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end']\n }\n }\n ]}\n >\n <TimePicker\n selected={currentlySelectedTime()}\n interval={pickerInterval}\n onSelect={selected => {\n hourInputRef.current!.value = (\n is12h ? convertTo12h(selected.getUTCHours()) : selected.getUTCHours()\n )\n .toString()\n .padStart(2, '0');\n minuteInputRef.current!.value = selected.getUTCMinutes().toString().padStart(2, '0');\n if (withSeconds)\n secondInputRef.current!.value = selected\n .getUTCSeconds()\n .toString()\n .padStart(2, '0');\n if (meridiemSelectRef.current) {\n meridiemSelectRef.current!.value = getMeridiem(selected.getUTCHours());\n }\n setMeridiem(getMeridiem(selected.getUTCHours()));\n setOpen(false);\n buttonEl?.focus();\n onInputChange();\n }}\n clockFormat={clockFormat}\n />\n </Popover>\n </>\n );\n\n const Comp = (\n <Flex\n as={StyledTimeInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) hourInputRef.current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n >\n {getDateFormat(locale, getTimeOptions(withSeconds, is12h)).map(part => {\n switch (part) {\n case 'hh':\n return HourInput;\n case 'mm':\n return MinuteInput;\n case 'ss':\n return SecondInput;\n case 'AM':\n case 'PM':\n return Period;\n default:\n return part;\n }\n })}\n </Flex>\n {!readOnly && Picker}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default TimeInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeekInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/WeekInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAIpF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"WeekInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/WeekInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAIpF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C,OAAO,aAA4C,MAAM,mBAAmB,CAAC;AAgB7E,MAAM,WAAW,cAAe,SAAQ,aAAa;CAAG;AAExD,eAAO,MAAM,eAAe,qHAY1B,CAAC;AA6BH,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAwN/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -5,17 +5,19 @@ import { defaultThemeProp } from '../../../theme';
|
|
|
5
5
|
import { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';
|
|
6
6
|
import FormField from '../../FormField';
|
|
7
7
|
import Button from '../../Button';
|
|
8
|
-
import Icon from '../../Icon';
|
|
8
|
+
import Icon, { registerIcon } from '../../Icon';
|
|
9
|
+
import * as timesIcon from '../../Icon/icons/times.icon';
|
|
10
|
+
import * as calendarIcon from '../../Icon/icons/calendar.icon';
|
|
9
11
|
import Flex from '../../Flex';
|
|
10
12
|
import { StyledFormControl } from '../../FormControl';
|
|
11
13
|
import DatePicker from '../Picker/DatePicker';
|
|
12
14
|
import Popover from '../../Popover';
|
|
13
|
-
import { parseToDate, getWeekYear, getDateOfISOWeek, getWeek } from './utils';
|
|
15
|
+
import { parseToDate, getWeekYear, getDateOfISOWeek, getWeek, generatePickerButtonAriaLabel } from './utils';
|
|
14
16
|
import StyledDateTime, { BareInput, StyledInputContainer } from './DateTime.styles';
|
|
15
17
|
import usePickerButton from './usePickerButton';
|
|
16
18
|
import PartInput from './PartInput';
|
|
17
19
|
import useAutoFocusNextInput from './useAutoFocusNextInput';
|
|
18
|
-
|
|
20
|
+
registerIcon(timesIcon, calendarIcon);
|
|
19
21
|
export const StyledWeekInput = styled(StyledDateTime)(props => {
|
|
20
22
|
const { theme: { base } } = props;
|
|
21
23
|
return css `
|
|
@@ -51,6 +53,7 @@ const convertToCallbackParameter = (date, parts) => {
|
|
|
51
53
|
const WeekInput = forwardRef((props, ref) => {
|
|
52
54
|
const { defaultValue, value = defaultValue, min, max, id, label, labelHidden, status, info, required, readOnly, disabled, onChange, onFocus, onBlur, autoFocus, ...restProps } = props;
|
|
53
55
|
const { locale } = useConfiguration();
|
|
56
|
+
const t = useI18n();
|
|
54
57
|
const date = value !== undefined ? parseToDate(value) : undefined;
|
|
55
58
|
const [weekInputRef, yearInputRef] = [
|
|
56
59
|
useRef(null),
|
|
@@ -58,8 +61,7 @@ const WeekInput = forwardRef((props, ref) => {
|
|
|
58
61
|
];
|
|
59
62
|
useAutoFocusNextInput([weekInputRef, yearInputRef]);
|
|
60
63
|
const pickParts = () => {
|
|
61
|
-
|
|
62
|
-
return [((_a = weekInputRef.current) === null || _a === void 0 ? void 0 : _a.value) || undefined, ((_b = yearInputRef.current) === null || _b === void 0 ? void 0 : _b.value) || undefined];
|
|
64
|
+
return [weekInputRef.current?.value || undefined, yearInputRef.current?.value || undefined];
|
|
63
65
|
};
|
|
64
66
|
const convertPartsToDate = () => {
|
|
65
67
|
const parts = pickParts();
|
|
@@ -73,11 +75,11 @@ const WeekInput = forwardRef((props, ref) => {
|
|
|
73
75
|
}
|
|
74
76
|
return parts;
|
|
75
77
|
};
|
|
76
|
-
const
|
|
78
|
+
const currentlySelectedDate = () => {
|
|
77
79
|
if (pickParts().every(Boolean)) {
|
|
78
80
|
const [year, month, day] = convertPartsToDate().map(v => (v ? Number(v) : undefined));
|
|
79
|
-
const current = date
|
|
80
|
-
return new Date(current.setUTCFullYear(year
|
|
81
|
+
const current = date ?? new Date();
|
|
82
|
+
return new Date(current.setUTCFullYear(year ?? current.getUTCFullYear(), month ?? current.getUTCMonth(), day ?? current.getUTCDate()));
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
const inputContainerRef = useRef(null);
|
|
@@ -88,40 +90,37 @@ const WeekInput = forwardRef((props, ref) => {
|
|
|
88
90
|
if (!focused) {
|
|
89
91
|
if (inputContainerRef.current)
|
|
90
92
|
inputContainerRef.current.scrollTop = 0;
|
|
91
|
-
onBlur
|
|
93
|
+
onBlur?.(callbackParam);
|
|
92
94
|
}
|
|
93
95
|
};
|
|
96
|
+
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
94
97
|
const onInputChange = () => {
|
|
95
|
-
onChange
|
|
98
|
+
onChange?.(convertToCallbackParameter(date ? new Date(date) : new Date(), convertPartsToDate()));
|
|
99
|
+
buttonEl?.setAttribute('aria-label', generatePickerButtonAriaLabel(currentlySelectedDate(), 'week', locale, t, open));
|
|
96
100
|
};
|
|
97
|
-
const t = useI18n();
|
|
98
101
|
const WeekNumberInput = (_jsx(PartInput, { placeholder: t('week_placeholder'), "aria-label": t('week_label_a11y'), value: date ? getWeek(date) : undefined, onChange: onInputChange, size: 2, maxLength: 2, min: 1, max: 53, readOnly: readOnly, ref: weekInputRef, autoFocus: autoFocus }, 'week'));
|
|
99
102
|
const YearInput = (_jsx(PartInput, { placeholder: t('year_placeholder'), "aria-label": t('year_label_a11y'), value: date ? getWeekYear(date) : undefined, onChange: onInputChange, size: 4, maxLength: 4, min: 1, readOnly: readOnly, ref: yearInputRef }, 'year'));
|
|
100
|
-
const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();
|
|
101
103
|
const containerRef = useConsolidatedRef(ref);
|
|
102
104
|
useFocusWithin([containerRef], onFocusChange);
|
|
103
|
-
const Picker = (_jsxs(_Fragment, { children: [_jsx(Button,
|
|
104
|
-
_jsx(Popover, Object.assign({ show: open, ref: setPopoverRef, target: containerRef.current, strategy: 'fixed', placement: 'bottom-end', modifiers: [
|
|
105
|
+
const Picker = (_jsxs(_Fragment, { children: [_jsx(Button, { variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), "aria-label": generatePickerButtonAriaLabel(currentlySelectedDate(), 'week', locale, t, open), readOnly: readOnly, disabled: disabled, children: _jsx(Icon, { name: open ? 'times' : 'calendar' }, void 0) }, void 0), _jsx(Popover, { show: open, ref: setPopoverRef, target: containerRef.current, strategy: 'fixed', placement: 'bottom-end', modifiers: [
|
|
105
106
|
{
|
|
106
107
|
name: 'flip',
|
|
107
108
|
options: {
|
|
108
109
|
fallbackPlacements: ['top-end', 'right', 'left']
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
]
|
|
112
|
+
], children: _jsx(DatePicker, { selected: currentlySelectedDate(), onChange: selected => {
|
|
112
113
|
weekInputRef.current.value = getWeek(selected).toString().padStart(2, '0');
|
|
113
114
|
yearInputRef.current.value = getWeekYear(selected).toString();
|
|
114
115
|
setOpen(false);
|
|
115
|
-
setTimeout(() => buttonEl
|
|
116
|
+
setTimeout(() => buttonEl?.focus());
|
|
116
117
|
onInputChange();
|
|
117
|
-
}, min: min, max: max, mode: 'week' }, void 0) }
|
|
118
|
-
const Comp = (_jsxs(Flex,
|
|
119
|
-
var _a;
|
|
118
|
+
}, min: min, max: max, mode: 'week' }, void 0) }, void 0)] }, void 0));
|
|
119
|
+
const Comp = (_jsxs(Flex, { as: StyledWeekInput, forwardedAs: StyledFormControl, container: { alignItems: 'center', wrap: 'nowrap' }, status: status, readOnly: readOnly, disabled: disabled, ref: containerRef, onClick: (e) => {
|
|
120
120
|
if (e.target === containerRef.current)
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return label ? (_jsx(FormField, Object.assign({ as: 'fieldset', labelAs: 'legend' }, { label, labelHidden, id, labelOrder: -1, info, status, required, disabled }, { ref: ref }, { children: Comp }), void 0)) : (Comp);
|
|
121
|
+
weekInputRef.current?.focus();
|
|
122
|
+
}, ...restProps, children: [_jsxs(Flex, { ref: inputContainerRef, as: StyledInputContainer, container: { alignItems: 'center', wrap: 'wrap' }, children: [t('week_text'), " ", WeekNumberInput, ",", YearInput] }, void 0), !readOnly && Picker] }, void 0));
|
|
123
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, ref: ref, children: Comp }, void 0)) : (Comp);
|
|
125
124
|
});
|
|
126
125
|
export default WeekInput;
|
|
127
126
|
//# sourceMappingURL=WeekInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeekInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/WeekInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mB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;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,kBACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,IACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAChF,GAAG,EAAE,GAAG,gBAEP,IAAI,YACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, useRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport FormField from '../../FormField';\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport Flex from '../../Flex';\nimport { StyledFormControl } from '../../FormControl';\nimport DatePicker from '../Picker/DatePicker';\nimport Popover from '../../Popover';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport { parseToDate, getWeekYear, getDateOfISOWeek, getWeek } from './utils';\nimport StyledDateTime, { BareInput, StyledInputContainer } from './DateTime.styles';\nimport usePickerButton from './usePickerButton';\nimport PartInput from './PartInput';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\nimport useButtonAriaLabel from './useButtonAriaLabel';\n\nexport interface WeekInputProps extends DateTimeProps {}\n\nexport const StyledWeekInput = styled(StyledDateTime)<WeekInputProps>(props => {\n const {\n theme: { base }\n } = props;\n\n return css`\n padding-inline-end: 0;\n\n ${StyledInputContainer} > ${BareInput}:first-of-type {\n margin-inline-start: ${base.spacing};\n }\n `;\n});\n\nStyledWeekInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month, day] = parts.map(Number);\n date.setUTCFullYear(year, month, day);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst WeekInput: FunctionComponent<WeekInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeekInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n status,\n info,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const { locale } = useConfiguration();\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [weekInputRef, yearInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n useAutoFocusNextInput([weekInputRef, yearInputRef]);\n\n const pickParts = () => {\n return [weekInputRef.current?.value || undefined, yearInputRef.current?.value || undefined];\n };\n\n const convertPartsToDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const dateOfWeek = getDateOfISOWeek(Number(parts[0]), Number(parts[1]));\n return [\n dateOfWeek.getUTCFullYear().toString(),\n dateOfWeek.getUTCMonth().toString(),\n dateOfWeek.getUTCDate().toString()\n ];\n }\n return parts;\n };\n\n const currentDate = () => {\n if (pickParts().every(Boolean)) {\n const [year, month, day] = convertPartsToDate().map(v => (v ? Number(v) : undefined));\n const current = date ?? new Date();\n return new Date(\n current.setUTCFullYear(\n year ?? current.getUTCFullYear(),\n month ?? current.getUTCMonth(),\n day ?? current.getUTCDate()\n )\n );\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n convertPartsToDate()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const onInputChange = () => {\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), convertPartsToDate())\n );\n };\n\n const t = useI18n();\n\n const WeekNumberInput = (\n <PartInput\n key='week'\n placeholder={t('week_placeholder')}\n aria-label={t('week_label_a11y')}\n value={date ? getWeek(date) : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n min={1}\n max={53}\n readOnly={readOnly}\n ref={weekInputRef}\n autoFocus={autoFocus}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={t('year_label_a11y')}\n value={date ? getWeekYear(date) : undefined}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n min={1}\n readOnly={readOnly}\n ref={yearInputRef}\n />\n );\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const Picker = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={useButtonAriaLabel(locale, currentDate(), 'week', open)}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n strategy='fixed'\n placement='bottom-end'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n <DatePicker\n selected={currentDate()}\n onChange={selected => {\n weekInputRef.current!.value = getWeek(selected).toString().padStart(2, '0');\n yearInputRef.current!.value = getWeekYear(selected).toString();\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n }}\n min={min}\n max={max}\n mode='week'\n />\n </Popover>\n </>\n );\n\n const Comp = (\n <Flex\n as={StyledWeekInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) weekInputRef.current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n >\n {t('week_text')} {WeekNumberInput},{YearInput}\n </Flex>\n {!readOnly && Picker}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, labelOrder: -1, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default WeekInput;\n"]}
|
|
1
|
+
{"version":3,"file":"WeekInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/WeekInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,OAAO,MAAM,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,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAChE,GAAG,EAAE,GAAG,YAEP,IAAI,WACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, useRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { ForwardProps } from '../../../types';\nimport { useConfiguration, useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport FormField from '../../FormField';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as timesIcon from '../../Icon/icons/times.icon';\nimport * as calendarIcon from '../../Icon/icons/calendar.icon';\nimport Flex from '../../Flex';\nimport { StyledFormControl } from '../../FormControl';\nimport DatePicker from '../Picker/DatePicker';\nimport Popover from '../../Popover';\nimport DateTimeProps, { DateTimeCallbackParameter } from '../DateTime.types';\n\nimport {\n parseToDate,\n getWeekYear,\n getDateOfISOWeek,\n getWeek,\n generatePickerButtonAriaLabel\n} from './utils';\nimport StyledDateTime, { BareInput, StyledInputContainer } from './DateTime.styles';\nimport usePickerButton from './usePickerButton';\nimport PartInput from './PartInput';\nimport useAutoFocusNextInput from './useAutoFocusNextInput';\n\nregisterIcon(timesIcon, calendarIcon);\n\nexport interface WeekInputProps extends DateTimeProps {}\n\nexport const StyledWeekInput = styled(StyledDateTime)<WeekInputProps>(props => {\n const {\n theme: { base }\n } = props;\n\n return css`\n padding-inline-end: 0;\n\n ${StyledInputContainer} > ${BareInput}:first-of-type {\n margin-inline-start: ${base.spacing};\n }\n `;\n});\n\nStyledWeekInput.defaultProps = defaultThemeProp;\n\nconst convertToCallbackParameter = (\n date: Date,\n parts: (string | undefined)[]\n): DateTimeCallbackParameter => {\n if (parts.every(Boolean)) {\n const [year, month, day] = parts.map(Number);\n date.setUTCFullYear(year, month, day);\n return {\n valueAsISOString: date.toISOString(),\n valueAsTimestamp: date.getTime()\n };\n }\n if (parts.every(p => !p)) {\n return {\n valueAsISOString: '',\n valueAsTimestamp: undefined\n };\n }\n return {\n valueAsISOString: '',\n valueAsTimestamp: NaN,\n state: 'incomplete'\n };\n};\n\nconst WeekInput: FunctionComponent<WeekInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeekInputProps>, ref: Ref<HTMLFieldSetElement>) => {\n const {\n defaultValue,\n value = defaultValue,\n min,\n max,\n id,\n label,\n labelHidden,\n status,\n info,\n required,\n readOnly,\n disabled,\n onChange,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n } = props;\n\n const { locale } = useConfiguration();\n const t = useI18n();\n\n const date = value !== undefined ? parseToDate(value) : undefined;\n\n const [weekInputRef, yearInputRef] = [\n useRef<HTMLInputElement>(null),\n useRef<HTMLInputElement>(null)\n ];\n\n useAutoFocusNextInput([weekInputRef, yearInputRef]);\n\n const pickParts = () => {\n return [weekInputRef.current?.value || undefined, yearInputRef.current?.value || undefined];\n };\n\n const convertPartsToDate = () => {\n const parts = pickParts();\n if (parts.every(Boolean)) {\n const dateOfWeek = getDateOfISOWeek(Number(parts[0]), Number(parts[1]));\n return [\n dateOfWeek.getUTCFullYear().toString(),\n dateOfWeek.getUTCMonth().toString(),\n dateOfWeek.getUTCDate().toString()\n ];\n }\n return parts;\n };\n\n const currentlySelectedDate = () => {\n if (pickParts().every(Boolean)) {\n const [year, month, day] = convertPartsToDate().map(v => (v ? Number(v) : undefined));\n const current = date ?? new Date();\n return new Date(\n current.setUTCFullYear(\n year ?? current.getUTCFullYear(),\n month ?? current.getUTCMonth(),\n day ?? current.getUTCDate()\n )\n );\n }\n };\n\n const inputContainerRef = useRef<HTMLDivElement>(null);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(\n date ? new Date(date) : new Date(),\n convertPartsToDate()\n );\n if (onFocus && focused) onFocus(callbackParam);\n if (!focused) {\n if (inputContainerRef.current) inputContainerRef.current.scrollTop = 0;\n onBlur?.(callbackParam);\n }\n };\n\n const [open, setOpen, , setPopoverRef, buttonEl, setButtonEl] = usePickerButton();\n\n const onInputChange = () => {\n onChange?.(\n convertToCallbackParameter(date ? new Date(date) : new Date(), convertPartsToDate())\n );\n buttonEl?.setAttribute(\n 'aria-label',\n generatePickerButtonAriaLabel(currentlySelectedDate(), 'week', locale, t, open)\n );\n };\n\n const WeekNumberInput = (\n <PartInput\n key='week'\n placeholder={t('week_placeholder')}\n aria-label={t('week_label_a11y')}\n value={date ? getWeek(date) : undefined}\n onChange={onInputChange}\n size={2}\n maxLength={2}\n min={1}\n max={53}\n readOnly={readOnly}\n ref={weekInputRef}\n autoFocus={autoFocus}\n />\n );\n\n const YearInput = (\n <PartInput\n key='year'\n placeholder={t('year_placeholder')}\n aria-label={t('year_label_a11y')}\n value={date ? getWeekYear(date) : undefined}\n onChange={onInputChange}\n size={4}\n maxLength={4}\n min={1}\n readOnly={readOnly}\n ref={yearInputRef}\n />\n );\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const Picker = (\n <>\n <Button\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n aria-label={generatePickerButtonAriaLabel(\n currentlySelectedDate(),\n 'week',\n locale,\n t,\n open\n )}\n readOnly={readOnly}\n disabled={disabled}\n >\n <Icon name={open ? 'times' : 'calendar'} />\n </Button>\n\n <Popover\n show={open}\n ref={setPopoverRef}\n target={containerRef.current}\n strategy='fixed'\n placement='bottom-end'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['top-end', 'right', 'left']\n }\n }\n ]}\n >\n <DatePicker\n selected={currentlySelectedDate()}\n onChange={selected => {\n weekInputRef.current!.value = getWeek(selected).toString().padStart(2, '0');\n yearInputRef.current!.value = getWeekYear(selected).toString();\n setOpen(false);\n setTimeout(() => buttonEl?.focus());\n onInputChange();\n }}\n min={min}\n max={max}\n mode='week'\n />\n </Popover>\n </>\n );\n\n const Comp = (\n <Flex\n as={StyledWeekInput}\n forwardedAs={StyledFormControl}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n ref={containerRef}\n onClick={(e: MouseEvent) => {\n if (e.target === containerRef.current) weekInputRef.current?.focus();\n }}\n {...restProps}\n >\n <Flex\n ref={inputContainerRef}\n as={StyledInputContainer}\n container={{ alignItems: 'center', wrap: 'wrap' }}\n >\n {t('week_text')} {WeekNumberInput},{YearInput}\n </Flex>\n {!readOnly && Picker}\n </Flex>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n ref={ref}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default WeekInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocusNextInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/useAutoFocusNextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAC;AAE1D;;;;GAIG;AACH,QAAA,MAAM,qBAAqB,SAAU,UAAU,gBAAgB,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"useAutoFocusNextInput.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/useAutoFocusNextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAC;AAE1D;;;;GAIG;AACH,QAAA,MAAM,qBAAqB,SAAU,UAAU,gBAAgB,CAAC,EAAE,SA8BjE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -7,26 +7,25 @@ import { useCallback, useEffect } from 'react';
|
|
|
7
7
|
const useAutoFocusNextInput = (refs) => {
|
|
8
8
|
const wrapListener = useCallback((nextElement) => {
|
|
9
9
|
return (ev) => {
|
|
10
|
-
var _a, _b;
|
|
11
10
|
const targetElement = ev.target;
|
|
12
11
|
if (ev.inputType === 'insertText' &&
|
|
13
12
|
targetElement.value.length === targetElement.maxLength) {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
nextElement?.current?.focus();
|
|
14
|
+
nextElement?.current?.select();
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
17
|
}, []);
|
|
19
18
|
useEffect(() => {
|
|
19
|
+
// Save current state of ref array to ensure it is the same during cleanup.
|
|
20
|
+
const els = refs.flatMap(ref => ref.current ?? []);
|
|
20
21
|
const callbacks = [];
|
|
21
|
-
|
|
22
|
-
var _a;
|
|
22
|
+
els.forEach((el, index) => {
|
|
23
23
|
callbacks.push(wrapListener(refs[index + 1]));
|
|
24
|
-
|
|
24
|
+
el.addEventListener('input', callbacks[index]);
|
|
25
25
|
});
|
|
26
26
|
return () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('input', callbacks[index]);
|
|
27
|
+
els.forEach((el, index) => {
|
|
28
|
+
el.removeEventListener('input', callbacks[index]);
|
|
30
29
|
});
|
|
31
30
|
};
|
|
32
31
|
}, refs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocusNextInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/useAutoFocusNextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAAC,IAAmC,EAAE,EAAE;IACpE,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,WAAwC,EAAE,EAAE;QAC5E,OAAO,CAAC,EAAS,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"useAutoFocusNextInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/useAutoFocusNextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,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AC;AACX,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import { RefObject, useCallback, useEffect } from 'react';\n\n/**\n * Automatically moves focus to next referenced input when current one's number of chars is equal to max-length.\n * @example useAutoFocusNextInput([ref1, ref2, ref3]);\n * @param refs - array of references to relevant input elements\n */\nconst useAutoFocusNextInput = (refs: RefObject<HTMLInputElement>[]) => {\n const wrapListener = useCallback((nextElement: RefObject<HTMLInputElement>) => {\n return (ev: Event) => {\n const targetElement = ev.target as HTMLInputElement;\n if (\n (ev as InputEvent).inputType === 'insertText' &&\n targetElement.value.length === targetElement.maxLength\n ) {\n nextElement?.current?.focus();\n nextElement?.current?.select();\n }\n };\n }, []);\n\n useEffect(() => {\n // Save current state of ref array to ensure it is the same during cleanup.\n const els = refs.flatMap(ref => ref.current ?? []);\n const callbacks: ((ev: Event) => void)[] = [];\n\n els.forEach((el: HTMLInputElement, index: number) => {\n callbacks.push(wrapListener(refs[index + 1]));\n el.addEventListener('input', callbacks[index]);\n });\n\n return () => {\n els.forEach((el: HTMLInputElement, index: number) => {\n el.removeEventListener('input', callbacks[index]);\n });\n };\n }, refs);\n};\n\nexport default useAutoFocusNextInput;\n"]}
|
|
@@ -6,7 +6,7 @@ const usePickerButton = (onClose) => {
|
|
|
6
6
|
const [buttonEl, setButtonEl] = useElement();
|
|
7
7
|
const closeWithCallback = () => {
|
|
8
8
|
setOpen(false);
|
|
9
|
-
onClose
|
|
9
|
+
onClose?.();
|
|
10
10
|
};
|
|
11
11
|
useOuterEvent('mousedown', [popoverEl, buttonEl], () => {
|
|
12
12
|
if (open)
|
|
@@ -20,15 +20,15 @@ const usePickerButton = (onClose) => {
|
|
|
20
20
|
// stop propagation if triggered inside the picker to prevent closing a modal
|
|
21
21
|
if (e.currentTarget === popoverEl) {
|
|
22
22
|
e.stopPropagation();
|
|
23
|
-
buttonEl
|
|
23
|
+
buttonEl?.focus();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
document.addEventListener('keydown', closePopover);
|
|
28
|
-
popoverEl
|
|
28
|
+
popoverEl?.addEventListener('keydown', closePopover);
|
|
29
29
|
return () => {
|
|
30
30
|
document.removeEventListener('keydown', closePopover);
|
|
31
|
-
popoverEl
|
|
31
|
+
popoverEl?.removeEventListener('keydown', closePopover);
|
|
32
32
|
};
|
|
33
33
|
}, [popoverEl]);
|
|
34
34
|
return [open, setOpen, popoverEl, setPopoverRef, buttonEl, setButtonEl];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickerButton.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/usePickerButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,eAAe,GAAG,CACtB,OAAoB,EAQpB,EAAE;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,UAAU,EAAe,CAAC;IAC7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,EAAe,CAAC;IAE1D,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,
|
|
1
|
+
{"version":3,"file":"usePickerButton.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/usePickerButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,eAAe,GAAG,CACtB,OAAoB,EAQpB,EAAE;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,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,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { Dispatch, SetStateAction, useEffect, useState } from 'react';\n\nimport { useElement, useOuterEvent } from '../../../hooks';\n\nconst usePickerButton = (\n onClose?: () => void\n): [\n boolean,\n Dispatch<SetStateAction<boolean>>,\n HTMLElement | null,\n (instance: HTMLElement | null) => void,\n HTMLElement | null,\n (instance: HTMLElement | null) => void\n] => {\n const [open, setOpen] = useState(false);\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n\n const closeWithCallback = () => {\n setOpen(false);\n onClose?.();\n };\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n if (open) closeWithCallback();\n });\n\n useEffect(() => {\n const closePopover = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n closeWithCallback();\n // stop propagation if triggered inside the picker to prevent closing a modal\n if (e.currentTarget === popoverEl) {\n e.stopPropagation();\n buttonEl?.focus();\n }\n }\n };\n document.addEventListener('keydown', closePopover);\n popoverEl?.addEventListener('keydown', closePopover);\n\n return () => {\n document.removeEventListener('keydown', closePopover);\n popoverEl?.removeEventListener('keydown', closePopover);\n };\n }, [popoverEl]);\n\n return [open, setOpen, popoverEl, setPopoverRef, buttonEl, setButtonEl];\n};\n\nexport default usePickerButton;\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TranslationFunction, TranslationPack } from '../../../i18n';
|
|
1
2
|
export declare const getWeekYear: (date: Date) => number;
|
|
2
3
|
export declare const getDayOfWeek: (date: Date, calendarType?: string) => number;
|
|
3
4
|
export declare const getWeekdays: (calendarType: string) => Date[];
|
|
@@ -5,12 +6,17 @@ export declare const getWeek: (date: Date, calendarType?: string) => number;
|
|
|
5
6
|
export declare const getCalendarTypeFromLocale: (localeTag?: string | undefined) => string;
|
|
6
7
|
export declare const getDateOfISOWeek: (week: number, year: number) => Date;
|
|
7
8
|
export declare const parseToDate: (value: string | number | Date) => Date;
|
|
9
|
+
export declare type QuarterNumber = 1 | 2 | 3 | 4;
|
|
10
|
+
export declare function getQuarter(date: string | number | Date): QuarterNumber;
|
|
8
11
|
export declare const getDateFormat: (localeTag?: string | undefined, options?: Intl.DateTimeFormatOptions | undefined, labelFormat?: boolean | undefined) => string[];
|
|
9
12
|
export declare const getStartOfWeek: (date: Date, calendarType?: string) => Date;
|
|
10
13
|
export declare const getEndOfWeek: (date: Date, calendarType?: string) => Date;
|
|
11
14
|
export declare type ClockFormat = 12 | 24;
|
|
12
15
|
export declare const is12HClockFormat: (localeTag?: string | undefined) => boolean;
|
|
13
16
|
export declare const getLocalizedMonths: (localeTag?: string | undefined) => string[];
|
|
17
|
+
export declare const getLocalizedWeekDays: (localeTag?: string | undefined) => {
|
|
18
|
+
[key: number]: string;
|
|
19
|
+
};
|
|
14
20
|
export declare const MS_IN_SECOND = 1000;
|
|
15
21
|
export declare const MS_IN_MINUTE: number;
|
|
16
22
|
export declare const MS_IN_HOUR: number;
|
|
@@ -40,4 +46,5 @@ export declare const isISODate: (value: string) => boolean;
|
|
|
40
46
|
export declare const isTime: (value: string) => boolean;
|
|
41
47
|
export declare const parseLocaleTextToDateParams: (value: string, localeTag: string) => number[] | undefined;
|
|
42
48
|
export declare const parsePastedTextToDate: (value: string, localeTag: string, currentDate: Date) => Date | undefined;
|
|
49
|
+
export declare const generatePickerButtonAriaLabel: (date: Date | undefined, type: 'date' | 'datetime' | 'week', locale: string, translateFn: TranslationFunction<TranslationPack>, open: boolean) => string;
|
|
43
50
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,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CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAS5F,CAAC;AAEF,eAAO,MAAM,cAAc;UAKnB,MAAM;YACJ,MAAM;YACN,MAAM;MACZ,MAKH,CAAC;AAEF,eAAO,MAAM,YAAY,OAAQ,MAAM,UAAU,MAAM,KAAG,MAgBzD,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,UAAU,MAAM,KAAG,MAgB5D,CAAC;AAEF,eAAO,MAAM,cAAc,gBAAiB,OAAO,UAAS,OAAO;;;;;CAOlE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,SAAS,MAAM,OAAO,MAAM,YAEpE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,UAAU,MAAM,UAAU,MAAM,SAAS,OAAO,YAIxF,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,IAAI,qDAGzC,CAAC;AAKF,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,OAEzC,CAAC;AAIF,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,OAEtC,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAAW,MAAM,aAAa,MAAM,yBAyB3E,CAAC;AAEF,eAAO,MAAM,qBAAqB,UACzB,MAAM,aACF,MAAM,eACJ,IAAI,KAChB,IAAI,GAAG,SAiBT,CAAC;AAiBF,eAAO,MAAM,6BAA6B,SAClC,IAAI,GAAG,SAAS,QAChB,MAAM,GAAG,UAAU,GAAG,MAAM,UAC1B,MAAM,eACD,oBAAoB,eAAe,CAAC,QAC3C,OAAO,KACZ,MAuBF,CAAC"}
|
|
@@ -43,7 +43,7 @@ export const getWeek = (date, calendarType = CALENDAR_TYPES.ISO_8601) => {
|
|
|
43
43
|
Math.round(((result.getTime() - week1.getTime()) / 86400000 - 3 + getDayOfWeek(result, calendarType)) / 7));
|
|
44
44
|
};
|
|
45
45
|
export const getCalendarTypeFromLocale = (localeTag) => {
|
|
46
|
-
const calendarType = Object.keys(CALENDAR_TYPE_LOCALES).find(type => CALENDAR_TYPE_LOCALES[type].includes(localeTag
|
|
46
|
+
const calendarType = Object.keys(CALENDAR_TYPE_LOCALES).find(type => CALENDAR_TYPE_LOCALES[type].includes(localeTag ?? navigator.language));
|
|
47
47
|
return calendarType || CALENDAR_TYPES.ISO_8601;
|
|
48
48
|
};
|
|
49
49
|
export const getDateOfISOWeek = (week, year) => {
|
|
@@ -81,6 +81,11 @@ export const parseToDate = (value) => {
|
|
|
81
81
|
}
|
|
82
82
|
return result;
|
|
83
83
|
};
|
|
84
|
+
export function getQuarter(date) {
|
|
85
|
+
const parsedDate = parseToDate(date);
|
|
86
|
+
const quarter = [1, 2, 3, 4];
|
|
87
|
+
return quarter[Math.floor(parsedDate.getUTCMonth() / 3)];
|
|
88
|
+
}
|
|
84
89
|
export const getDateFormat = (localeTag, options, labelFormat) => {
|
|
85
90
|
return new Intl.DateTimeFormat(localeTag, options).formatToParts().map(({ type, value }) => {
|
|
86
91
|
switch (type) {
|
|
@@ -121,22 +126,31 @@ export const getEndOfWeek = (date, calendarType = CALENDAR_TYPES.ISO_8601) => {
|
|
|
121
126
|
endDate.setUTCHours(24 * (6 - day));
|
|
122
127
|
return endDate;
|
|
123
128
|
};
|
|
124
|
-
const objDate = new Date();
|
|
125
|
-
objDate.setUTCDate(1);
|
|
126
129
|
export const is12HClockFormat = (localeTag) => {
|
|
127
130
|
const meridiem = new Intl.DateTimeFormat(localeTag, {
|
|
128
131
|
hour: 'numeric'
|
|
129
132
|
})
|
|
130
133
|
.formatToParts()
|
|
131
134
|
.find(({ type }) => type === 'dayPeriod');
|
|
132
|
-
return !!
|
|
135
|
+
return !!meridiem?.value;
|
|
133
136
|
};
|
|
137
|
+
const objDate = new Date();
|
|
138
|
+
objDate.setUTCDate(1);
|
|
134
139
|
export const getLocalizedMonths = (localeTag) => {
|
|
135
|
-
return [...
|
|
136
|
-
objDate.setUTCMonth(
|
|
137
|
-
return cap(objDate.toLocaleString(localeTag, { month: 'long' }));
|
|
140
|
+
return [...Array(12).keys()].map(monthNo => {
|
|
141
|
+
objDate.setUTCMonth(monthNo);
|
|
142
|
+
return cap(objDate.toLocaleString(localeTag, { month: 'long', timeZone: 'UTC' }));
|
|
138
143
|
});
|
|
139
144
|
};
|
|
145
|
+
export const getLocalizedWeekDays = (localeTag) => {
|
|
146
|
+
const calendarType = getCalendarTypeFromLocale(localeTag);
|
|
147
|
+
return getWeekdays(calendarType).reduce((accumulator, dayDate, index) => {
|
|
148
|
+
accumulator[index + 1] = cap(dayDate.toLocaleString(localeTag, {
|
|
149
|
+
weekday: 'long'
|
|
150
|
+
}));
|
|
151
|
+
return accumulator;
|
|
152
|
+
}, {});
|
|
153
|
+
};
|
|
140
154
|
export const MS_IN_SECOND = 1000;
|
|
141
155
|
export const MS_IN_MINUTE = 1000 * 60;
|
|
142
156
|
export const MS_IN_HOUR = 1000 * 60 * 60;
|
|
@@ -208,9 +222,8 @@ export const validateTime = (hour, minute, second, is12h) => {
|
|
|
208
222
|
return !(hour > hourMax || hour < hourMin || minute > 59 || second > 59);
|
|
209
223
|
};
|
|
210
224
|
export const toUTCDateString = (date, format) => {
|
|
211
|
-
var _a;
|
|
212
225
|
const adjustedDate = new Date(date.getTime() + date.getTimezoneOffset() * 60000);
|
|
213
|
-
return
|
|
226
|
+
return format?.format(adjustedDate) ?? adjustedDate.toDateString();
|
|
214
227
|
};
|
|
215
228
|
const ISO_DATE_REG_EXP = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
|
|
216
229
|
export const isISODate = (value) => {
|
|
@@ -229,7 +242,7 @@ export const parseLocaleTextToDateParams = (value, localeTag) => {
|
|
|
229
242
|
.join('')
|
|
230
243
|
.match(/\w+/g);
|
|
231
244
|
const valueParts = value.match(/\d+/g);
|
|
232
|
-
if (template &&
|
|
245
|
+
if (template && valueParts?.length === template?.length) {
|
|
233
246
|
let year = 0;
|
|
234
247
|
let month = 0;
|
|
235
248
|
let day = 0;
|
|
@@ -268,4 +281,33 @@ export const parsePastedTextToDate = (value, localeTag, currentDate) => {
|
|
|
268
281
|
}
|
|
269
282
|
return result;
|
|
270
283
|
};
|
|
284
|
+
const ariaDateTimeOpts = {
|
|
285
|
+
weekday: 'long',
|
|
286
|
+
day: 'numeric',
|
|
287
|
+
month: 'long',
|
|
288
|
+
year: 'numeric',
|
|
289
|
+
hour: '2-digit',
|
|
290
|
+
minute: '2-digit'
|
|
291
|
+
};
|
|
292
|
+
const ariaDateOpts = {
|
|
293
|
+
weekday: 'long',
|
|
294
|
+
day: 'numeric',
|
|
295
|
+
month: 'long',
|
|
296
|
+
year: 'numeric'
|
|
297
|
+
};
|
|
298
|
+
export const generatePickerButtonAriaLabel = (date, type, locale, translateFn, open) => {
|
|
299
|
+
let datePart = '';
|
|
300
|
+
if (type === 'week') {
|
|
301
|
+
datePart = date
|
|
302
|
+
? `${translateFn('selected_date_a11y')} ${translateFn('week_text')} ${getWeek(date, CALENDAR_TYPES.ISO_8601)}, ${date.getUTCFullYear()}, `
|
|
303
|
+
: '';
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
const ariaFormat = Intl.DateTimeFormat(locale, type === 'date' ? ariaDateOpts : ariaDateTimeOpts);
|
|
307
|
+
datePart = date
|
|
308
|
+
? `${translateFn('selected_date_a11y')} ${toUTCDateString(date, ariaFormat)}, `
|
|
309
|
+
: '';
|
|
310
|
+
}
|
|
311
|
+
return `${datePart}${translateFn(open ? 'close_calendar_button_a11y' : 'open_calendar_button_a11y')}`;
|
|
312
|
+
};
|
|
271
313
|
//# sourceMappingURL=utils.js.map
|