@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
|
@@ -3,12 +3,16 @@ import { useState, useEffect, useRef } from 'react';
|
|
|
3
3
|
import Flex from '../../Flex';
|
|
4
4
|
import MonthInput from '../Input/MonthInput';
|
|
5
5
|
import Button from '../../Button';
|
|
6
|
-
import Icon from '../../Icon';
|
|
6
|
+
import Icon, { registerIcon } from '../../Icon';
|
|
7
|
+
import * as caretLeftIcon from '../../Icon/icons/caret-left.icon';
|
|
8
|
+
import * as caretRightIcon from '../../Icon/icons/caret-right.icon';
|
|
7
9
|
import { useConfiguration, useDirection, useI18n } from '../../../hooks';
|
|
8
10
|
import { getCalendarTypeFromLocale, toUTCDateString } from '../Input/utils';
|
|
9
11
|
import { CALENDAR_TYPES } from '../Input/local';
|
|
10
12
|
import Calendar from './Calendar';
|
|
11
13
|
import { ScreenReaderOnly, StyledDatePicker, StyledMonthPicker } from './Calendar.styles';
|
|
14
|
+
import { isValidDate } from './utils';
|
|
15
|
+
registerIcon(caretLeftIcon, caretRightIcon);
|
|
12
16
|
const defaultProps = {
|
|
13
17
|
showWeekNumber: false,
|
|
14
18
|
mode: 'date'
|
|
@@ -16,14 +20,11 @@ const defaultProps = {
|
|
|
16
20
|
function toDateString(date) {
|
|
17
21
|
return date ? toUTCDateString(date) : undefined;
|
|
18
22
|
}
|
|
19
|
-
function getValidatedDate(date) {
|
|
20
|
-
return date && Number.isNaN(date.getTime()) ? undefined : date;
|
|
21
|
-
}
|
|
22
23
|
const DatePicker = (props) => {
|
|
23
24
|
const { locale } = useConfiguration();
|
|
24
25
|
const { selected: initial, onChange, min, max, mode, showWeekNumber, ...restProps } = props;
|
|
25
26
|
const [selected, setSelected] = useState(initial);
|
|
26
|
-
const [current, setCurrent] = useState(
|
|
27
|
+
const [current, setCurrent] = useState(selected && isValidDate(selected) ? selected : new Date());
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
if (toDateString(initial) !== toDateString(selected)) {
|
|
29
30
|
setSelected(initial);
|
|
@@ -34,36 +35,31 @@ const DatePicker = (props) => {
|
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
// need to postpone focusing to make sure onFocusWithin has been attached
|
|
36
37
|
setTimeout(() => {
|
|
37
|
-
|
|
38
|
-
(_b = (_a = calendarRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('button[tabindex="0"]:enabled')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
38
|
+
calendarRef.current?.querySelector('button[tabindex="0"]:enabled')?.focus();
|
|
39
39
|
});
|
|
40
40
|
}, []);
|
|
41
41
|
const calendarType = getCalendarTypeFromLocale(locale);
|
|
42
42
|
const t = useI18n();
|
|
43
43
|
const { start, end } = useDirection();
|
|
44
|
-
return (_jsxs(StyledDatePicker,
|
|
44
|
+
return (_jsxs(StyledDatePicker, { ...restProps, children: [_jsxs(Flex, { as: StyledMonthPicker, container: { justify: 'between', alignItems: 'center' }, children: [_jsx(Button, { variant: 'simple', icon: true, onClick: () => {
|
|
45
45
|
const newCurrent = new Date(current);
|
|
46
46
|
newCurrent.setUTCMonth(newCurrent.getUTCMonth() - 1);
|
|
47
47
|
setCurrent(newCurrent);
|
|
48
|
-
}, "aria-label": t('picker_prev_month')
|
|
49
|
-
_jsx(MonthInput, { value: current, required: true, "aria-label": t('picker_jump_to_month'), onChange: ({ valueAsTimestamp }) => {
|
|
48
|
+
}, "aria-label": t('picker_prev_month'), children: _jsx(Icon, { name: `caret-${start}` }, void 0) }, void 0), _jsx(MonthInput, { value: current, required: true, "aria-label": t('picker_jump_to_month'), onChange: ({ valueAsTimestamp }) => {
|
|
50
49
|
const newCurrent = new Date(valueAsTimestamp);
|
|
51
50
|
newCurrent.setUTCDate(current.getUTCDate());
|
|
52
51
|
setCurrent(newCurrent);
|
|
53
|
-
}, min: min, max: max }, void 0),
|
|
54
|
-
_jsx(ScreenReaderOnly, Object.assign({ "aria-live": 'polite' }, { children: current.toLocaleString(locale, { month: 'long', year: 'numeric' }) }), void 0),
|
|
55
|
-
_jsx(Button, Object.assign({ variant: 'simple', icon: true, onClick: () => {
|
|
52
|
+
}, min: min, max: max }, void 0), _jsx(ScreenReaderOnly, { "aria-live": 'polite', children: current.toLocaleString(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }) }, void 0), _jsx(Button, { variant: 'simple', icon: true, onClick: () => {
|
|
56
53
|
const newCurrent = new Date(current);
|
|
57
54
|
newCurrent.setUTCMonth(newCurrent.getUTCMonth() + 1);
|
|
58
55
|
setCurrent(newCurrent);
|
|
59
|
-
}, "aria-label": t('picker_next_month')
|
|
60
|
-
_jsx(Flex, Object.assign({ container: { wrap: 'nowrap' }, dir: 'ltr' }, { children: _jsx(Calendar, { ref: calendarRef, selected: getValidatedDate(selected), current: current, calendarType: mode === 'date' ? calendarType : CALENDAR_TYPES.ISO_8601, showWeekNumber: showWeekNumber, mode: mode, onFocus: date => {
|
|
56
|
+
}, "aria-label": t('picker_next_month'), children: _jsx(Icon, { name: `caret-${end}` }, void 0) }, void 0)] }, void 0), _jsx(Flex, { container: { wrap: 'nowrap' }, dir: 'ltr', children: _jsx(Calendar, { ref: calendarRef, selected: selected && isValidDate(selected) ? selected : undefined, current: current, calendarType: mode === 'date' ? calendarType : CALENDAR_TYPES.ISO_8601, showWeekNumber: showWeekNumber, mode: mode, onFocus: date => {
|
|
61
57
|
setCurrent(date);
|
|
62
58
|
}, onSelect: date => {
|
|
63
59
|
setCurrent(date);
|
|
64
60
|
setSelected(date);
|
|
65
|
-
onChange
|
|
66
|
-
}, min: min, max: max }, void 0) }
|
|
61
|
+
onChange?.(date);
|
|
62
|
+
}, min: min, max: max }, void 0) }, void 0)] }, void 0));
|
|
67
63
|
};
|
|
68
64
|
DatePicker.defaultProps = defaultProps;
|
|
69
65
|
export default DatePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DatePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DatePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CA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AG,WACR,WACG,YACU,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;AAEvC,eAAe,UAAU,CAAC","sourcesContent":["import { FunctionComponent, useState, useEffect, useRef } from 'react';\n\nimport Flex from '../../Flex';\nimport MonthInput from '../Input/MonthInput';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as caretLeftIcon from '../../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../../Icon/icons/caret-right.icon';\nimport { useConfiguration, useDirection, useI18n } from '../../../hooks';\nimport { getCalendarTypeFromLocale, toUTCDateString } from '../Input/utils';\nimport { CALENDAR_TYPES } from '../Input/local';\n\nimport Calendar from './Calendar';\nimport DatePickerProps from './DatePicker.types';\nimport { ScreenReaderOnly, StyledDatePicker, StyledMonthPicker } from './Calendar.styles';\nimport { isValidDate } from './utils';\n\nregisterIcon(caretLeftIcon, caretRightIcon);\n\nconst defaultProps: Partial<DatePickerProps> = {\n showWeekNumber: false,\n mode: 'date'\n};\n\nfunction toDateString(date: Date | undefined) {\n return date ? toUTCDateString(date) : undefined;\n}\n\nconst DatePicker: FunctionComponent<DatePickerProps> = (props: DatePickerProps) => {\n const { locale } = useConfiguration();\n const { selected: initial, onChange, min, max, mode, showWeekNumber, ...restProps } = props;\n\n const [selected, setSelected] = useState(initial);\n const [current, setCurrent] = useState(selected && isValidDate(selected) ? selected : new Date());\n\n useEffect(() => {\n if (toDateString(initial) !== toDateString(selected)) {\n setSelected(initial);\n setCurrent(initial || new Date());\n }\n }, [toDateString(initial)]);\n\n const calendarRef = useRef<HTMLTableElement>(null);\n useEffect(() => {\n // need to postpone focusing to make sure onFocusWithin has been attached\n setTimeout(() => {\n calendarRef.current?.querySelector<HTMLElement>('button[tabindex=\"0\"]:enabled')?.focus();\n });\n }, []);\n\n const calendarType = getCalendarTypeFromLocale(locale);\n const t = useI18n();\n const { start, end } = useDirection();\n\n return (\n <StyledDatePicker {...restProps}>\n <Flex as={StyledMonthPicker} container={{ justify: 'between', alignItems: 'center' }}>\n <Button\n variant='simple'\n icon\n onClick={() => {\n const newCurrent = new Date(current);\n newCurrent.setUTCMonth(newCurrent.getUTCMonth() - 1);\n setCurrent(newCurrent);\n }}\n aria-label={t('picker_prev_month')}\n >\n <Icon name={`caret-${start}`} />\n </Button>\n <MonthInput\n value={current}\n required\n aria-label={t('picker_jump_to_month')}\n onChange={({ valueAsTimestamp }) => {\n const newCurrent = new Date(valueAsTimestamp!);\n newCurrent.setUTCDate(current.getUTCDate());\n setCurrent(newCurrent);\n }}\n min={min}\n max={max}\n />\n <ScreenReaderOnly aria-live='polite'>\n {current.toLocaleString(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' })}\n </ScreenReaderOnly>\n <Button\n variant='simple'\n icon\n onClick={() => {\n const newCurrent = new Date(current);\n newCurrent.setUTCMonth(newCurrent.getUTCMonth() + 1);\n setCurrent(newCurrent);\n }}\n aria-label={t('picker_next_month')}\n >\n <Icon name={`caret-${end}`} />\n </Button>\n </Flex>\n <Flex container={{ wrap: 'nowrap' }} dir='ltr'>\n <Calendar\n ref={calendarRef}\n selected={selected && isValidDate(selected) ? selected : undefined}\n current={current}\n calendarType={mode === 'date' ? calendarType : CALENDAR_TYPES.ISO_8601}\n showWeekNumber={showWeekNumber}\n mode={mode}\n onFocus={date => {\n setCurrent(date);\n }}\n onSelect={date => {\n setCurrent(date);\n setSelected(date);\n onChange?.(date);\n }}\n min={min}\n max={max}\n />\n </Flex>\n </StyledDatePicker>\n );\n};\n\nDatePicker.defaultProps = defaultProps;\n\nexport default DatePicker;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAYvE,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAOjD,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,uDAAuD;IACvD,aAAa,CAAC,EAAE;QAAE,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,IAAI,GAAG,SAAS,CAAA;KAAE,CAAC;CAC5E;AAMD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAiG5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -3,23 +3,24 @@ import { useState, useEffect, useRef } from 'react';
|
|
|
3
3
|
import Flex from '../../Flex';
|
|
4
4
|
import MonthInput from '../Input/MonthInput';
|
|
5
5
|
import Button from '../../Button';
|
|
6
|
-
import Icon from '../../Icon';
|
|
6
|
+
import Icon, { registerIcon } from '../../Icon';
|
|
7
|
+
import * as caretLeftIcon from '../../Icon/icons/caret-left.icon';
|
|
8
|
+
import * as caretRightIcon from '../../Icon/icons/caret-right.icon';
|
|
7
9
|
import { useConfiguration, useI18n } from '../../../hooks';
|
|
8
10
|
import { getCalendarTypeFromLocale, toUTCDateString } from '../Input/utils';
|
|
9
11
|
import Calendar from './Calendar';
|
|
10
12
|
import Weeks from './Weeks';
|
|
11
13
|
import { StyledDatePicker, StyledMonthPicker } from './Calendar.styles';
|
|
14
|
+
import { isValidDate } from './utils';
|
|
15
|
+
registerIcon(caretLeftIcon, caretRightIcon);
|
|
12
16
|
function toDateString(date) {
|
|
13
17
|
return date ? toUTCDateString(date) : undefined;
|
|
14
18
|
}
|
|
15
|
-
function getValidatedDate(date) {
|
|
16
|
-
return date && Number.isNaN(date.getTime()) ? undefined : date;
|
|
17
|
-
}
|
|
18
19
|
const DateRangePicker = (props) => {
|
|
19
20
|
const { locale } = useConfiguration();
|
|
20
21
|
const { selected: initial, selectedRange, onChange, min, max, mode, showWeekNumber, ...restProps } = props;
|
|
21
22
|
const [selected, setSelected] = useState(initial);
|
|
22
|
-
const [current, setCurrent] = useState(
|
|
23
|
+
const [current, setCurrent] = useState(selected && isValidDate(selected) ? selected : new Date());
|
|
23
24
|
useEffect(() => {
|
|
24
25
|
if (toDateString(initial) !== toDateString(selected)) {
|
|
25
26
|
setSelected(initial);
|
|
@@ -30,35 +31,30 @@ const DateRangePicker = (props) => {
|
|
|
30
31
|
useEffect(() => {
|
|
31
32
|
// need to postpone focusing to make sure onFocusWithin has been attached
|
|
32
33
|
setTimeout(() => {
|
|
33
|
-
|
|
34
|
-
(_b = (_a = calendarRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('button[tabindex="0"]:enabled')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
34
|
+
calendarRef.current?.querySelector('button[tabindex="0"]:enabled')?.focus();
|
|
35
35
|
});
|
|
36
36
|
}, []);
|
|
37
37
|
const calendarType = getCalendarTypeFromLocale(locale);
|
|
38
38
|
const t = useI18n();
|
|
39
|
-
return (_jsxs(StyledDatePicker,
|
|
39
|
+
return (_jsxs(StyledDatePicker, { ...restProps, children: [_jsxs(Flex, { as: StyledMonthPicker, container: { justify: 'between', alignItems: 'center' }, children: [_jsx(Button, { variant: 'simple', icon: true, onClick: () => {
|
|
40
40
|
const newCurrent = new Date(current);
|
|
41
41
|
newCurrent.setUTCMonth(newCurrent.getUTCMonth() - 1);
|
|
42
42
|
setCurrent(newCurrent);
|
|
43
|
-
}, "aria-label": t('picker_prev_month')
|
|
44
|
-
_jsx(MonthInput, { value: current, required: true, "aria-label": t('picker_jump_to_month'), onChange: ({ valueAsTimestamp }) => {
|
|
43
|
+
}, "aria-label": t('picker_prev_month'), children: _jsx(Icon, { name: 'caret-left' }, void 0) }, void 0), _jsx(MonthInput, { value: current, required: true, "aria-label": t('picker_jump_to_month'), onChange: ({ valueAsTimestamp }) => {
|
|
45
44
|
const newCurrent = new Date(valueAsTimestamp);
|
|
46
45
|
newCurrent.setUTCDate(current.getUTCDate());
|
|
47
46
|
setCurrent(newCurrent);
|
|
48
|
-
}, min: min, max: max }, void 0),
|
|
49
|
-
_jsx(Button, Object.assign({ variant: 'simple', icon: true, onClick: () => {
|
|
47
|
+
}, min: min, max: max }, void 0), _jsx(Button, { variant: 'simple', icon: true, onClick: () => {
|
|
50
48
|
const newCurrent = new Date(current);
|
|
51
49
|
newCurrent.setUTCMonth(newCurrent.getUTCMonth() + 1);
|
|
52
50
|
setCurrent(newCurrent);
|
|
53
|
-
}, "aria-label": t('picker_next_month')
|
|
54
|
-
_jsxs(Flex, Object.assign({ container: { wrap: 'nowrap' } }, { children: [showWeekNumber && _jsx(Weeks, { current: current, calendarType: calendarType, disabled: true }, void 0),
|
|
55
|
-
_jsx(Calendar, { ref: calendarRef, selected: getValidatedDate(selected), current: current, selectedRange: selectedRange, showHighlight: true, calendarType: calendarType, onFocus: date => {
|
|
51
|
+
}, "aria-label": t('picker_next_month'), children: _jsx(Icon, { name: 'caret-right' }, void 0) }, void 0)] }, void 0), _jsxs(Flex, { container: { wrap: 'nowrap' }, children: [showWeekNumber && _jsx(Weeks, { current: current, calendarType: calendarType, disabled: true }, void 0), _jsx(Calendar, { ref: calendarRef, selected: selected && isValidDate(selected) ? selected : undefined, current: current, selectedRange: selectedRange, showHighlight: true, calendarType: calendarType, onFocus: date => {
|
|
56
52
|
setCurrent(date);
|
|
57
53
|
}, onSelect: date => {
|
|
58
54
|
setCurrent(date);
|
|
59
55
|
setSelected(date);
|
|
60
|
-
onChange
|
|
61
|
-
}, min: min, max: max }, void 0)] }
|
|
56
|
+
onChange?.(date);
|
|
57
|
+
}, min: min, max: max }, void 0)] }, void 0)] }, void 0));
|
|
62
58
|
};
|
|
63
59
|
export default DateRangePicker;
|
|
64
60
|
//# sourceMappingURL=DateRangePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DateRangePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/DateRangePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,aAAa,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5E,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAO5C,SAAS,YAAY,CAAC,IAAsB;IAC1C,OAAO,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC;AAED,MAAM,e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AE,aAChC,cAAc,IAAI,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,iBAAG,EACnF,KAAC,QAAQ,IACP,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAClE,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,QACb,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,IAAI,CAAC,EAAE;4BACd,UAAU,CAAC,IAAI,CAAC,CAAC;wBACnB,CAAC,EACD,QAAQ,EAAE,IAAI,CAAC,EAAE;4BACf,UAAU,CAAC,IAAI,CAAC,CAAC;4BACjB,WAAW,CAAC,IAAI,CAAC,CAAC;4BAClB,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;wBACnB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,WACR,YACG,YACU,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FunctionComponent, useState, useEffect, useRef } from 'react';\n\nimport Flex from '../../Flex';\nimport MonthInput from '../Input/MonthInput';\nimport Button from '../../Button';\nimport Icon, { registerIcon } from '../../Icon';\nimport * as caretLeftIcon from '../../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../../Icon/icons/caret-right.icon';\nimport { useConfiguration, useI18n } from '../../../hooks';\nimport { getCalendarTypeFromLocale, toUTCDateString } from '../Input/utils';\n\nimport Calendar from './Calendar';\nimport DatePickerProps from './DatePicker.types';\nimport Weeks from './Weeks';\nimport { StyledDatePicker, StyledMonthPicker } from './Calendar.styles';\nimport { isValidDate } from './utils';\n\nregisterIcon(caretLeftIcon, caretRightIcon);\n\nexport interface DateRangePickerProps extends DatePickerProps {\n /** Defines dates range that can be set by the user. */\n selectedRange?: { startDate: Date | undefined; endDate: Date | undefined };\n}\n\nfunction toDateString(date: Date | undefined) {\n return date ? toUTCDateString(date) : undefined;\n}\n\nconst DateRangePicker: FunctionComponent<DateRangePickerProps> = (props: DateRangePickerProps) => {\n const { locale } = useConfiguration();\n const {\n selected: initial,\n selectedRange,\n onChange,\n min,\n max,\n mode,\n showWeekNumber,\n ...restProps\n } = props;\n\n const [selected, setSelected] = useState(initial);\n const [current, setCurrent] = useState(selected && isValidDate(selected) ? selected : new Date());\n\n useEffect(() => {\n if (toDateString(initial) !== toDateString(selected)) {\n setSelected(initial);\n setCurrent(initial || new Date());\n }\n }, [toDateString(initial)]);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n // need to postpone focusing to make sure onFocusWithin has been attached\n setTimeout(() => {\n calendarRef.current?.querySelector<HTMLElement>('button[tabindex=\"0\"]:enabled')?.focus();\n });\n }, []);\n\n const calendarType = getCalendarTypeFromLocale(locale);\n const t = useI18n();\n\n return (\n <StyledDatePicker {...restProps}>\n <Flex as={StyledMonthPicker} container={{ justify: 'between', alignItems: 'center' }}>\n <Button\n variant='simple'\n icon\n onClick={() => {\n const newCurrent = new Date(current);\n newCurrent.setUTCMonth(newCurrent.getUTCMonth() - 1);\n setCurrent(newCurrent);\n }}\n aria-label={t('picker_prev_month')}\n >\n <Icon name='caret-left' />\n </Button>\n <MonthInput\n value={current}\n required\n aria-label={t('picker_jump_to_month')}\n onChange={({ valueAsTimestamp }) => {\n const newCurrent = new Date(valueAsTimestamp!);\n newCurrent.setUTCDate(current.getUTCDate());\n setCurrent(newCurrent);\n }}\n min={min}\n max={max}\n />\n <Button\n variant='simple'\n icon\n onClick={() => {\n const newCurrent = new Date(current);\n newCurrent.setUTCMonth(newCurrent.getUTCMonth() + 1);\n setCurrent(newCurrent);\n }}\n aria-label={t('picker_next_month')}\n >\n <Icon name='caret-right' />\n </Button>\n </Flex>\n <Flex container={{ wrap: 'nowrap' }}>\n {showWeekNumber && <Weeks current={current} calendarType={calendarType} disabled />}\n <Calendar\n ref={calendarRef}\n selected={selected && isValidDate(selected) ? selected : undefined}\n current={current}\n selectedRange={selectedRange}\n showHighlight\n calendarType={calendarType}\n onFocus={date => {\n setCurrent(date);\n }}\n onSelect={date => {\n setCurrent(date);\n setSelected(date);\n onChange?.(date);\n }}\n min={min}\n max={max}\n />\n </Flex>\n </StyledDatePicker>\n );\n};\n\nexport default DateRangePicker;\n"]}
|
|
@@ -68,26 +68,25 @@ const TimePicker = (props) => {
|
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
70
|
const isSelected = (date) => {
|
|
71
|
-
return (
|
|
72
|
-
|
|
71
|
+
return (selected?.getUTCHours() === date.getUTCHours() &&
|
|
72
|
+
selected?.getUTCMinutes() === date.getUTCMinutes());
|
|
73
73
|
};
|
|
74
74
|
const [buttonEl, setButtonEl] = useElement();
|
|
75
75
|
const menuRef = useRef(null);
|
|
76
76
|
useArrows(menuRef, { cycle: true });
|
|
77
77
|
const renderTime = (text) => {
|
|
78
78
|
const [hour, minute, meridiem] = text.split(/:| /);
|
|
79
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { children: hour }, void 0), ":", _jsx("span", { children: minute }, void 0),
|
|
80
|
-
meridiem && _jsx("span", { children: meridiem }, void 0)] }, void 0));
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { children: hour }, void 0), ":", _jsx("span", { children: minute }, void 0), meridiem && _jsx("span", { children: meridiem }, void 0)] }, void 0));
|
|
81
80
|
};
|
|
82
81
|
useEffect(() => {
|
|
83
|
-
buttonEl
|
|
82
|
+
buttonEl?.focus();
|
|
84
83
|
}, [buttonEl]);
|
|
85
|
-
return (_jsx(StyledTimePicker,
|
|
84
|
+
return (_jsx(StyledTimePicker, { role: 'menu', tabIndex: 0, ref: menuRef, ...restProps, children: actionsList.map(({ text, id }) => {
|
|
86
85
|
const item = new Date(Number(id));
|
|
87
|
-
return (_jsx(StyledTimeItem,
|
|
88
|
-
onSelect
|
|
89
|
-
}
|
|
90
|
-
}) }
|
|
86
|
+
return (_jsx(StyledTimeItem, { role: 'presentation', children: _jsx(StyledTimeButton, { role: 'menuitem', as: Button, variant: 'simple', ref: isSelected(item) ? setButtonEl : null, "aria-label": text, selected: isSelected(item), onClick: () => {
|
|
87
|
+
onSelect?.(item);
|
|
88
|
+
}, children: renderTime(text) }, void 0) }, id));
|
|
89
|
+
}) }, void 0));
|
|
91
90
|
};
|
|
92
91
|
export default TimePicker;
|
|
93
92
|
//# sourceMappingURL=TimePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/TimePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAuB/C,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAKjC,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAiB;;;;;;;;;;;sBAWjC,KAAK,CAAC,EAAE,CAC1B,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa;;;;;6BAKnD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,c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IAAI,CAAC,CAAC;oBACnB,CAAC,YAEA,UAAU,CAAC,IAAI,CAAC,WACA,IAboB,EAAE,CAc1B,CAClB,CAAC;QACJ,CAAC,CAAC,WACe,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { FunctionComponent, useEffect, useRef } from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../../theme';\nimport { BaseProps, Action, ForwardProps } from '../../../types';\nimport Button from '../../Button';\nimport { useArrows, useConfiguration, useElement } from '../../../hooks';\nimport { ClockFormat, is12HClockFormat } from '../Input/utils';\n\nimport { getIntervalGenerator } from './utils';\n\nexport type MinuteInterval = 15 | 30 | 60;\n\nexport interface TimePickerProps extends BaseProps {\n /**\n * Defines default time that will be selected when the Time Picker is opened.\n * @default new Date()\n */\n selected?: Date;\n /** Callback fired when selected value changes. */\n onSelect?: (date: Date) => void;\n /**\n * Defines interval for time picker options (in minutes).\n * @default 30\n */\n interval?: MinuteInterval;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n}\n\nconst StyledTimePicker = styled.ul`\n list-style: none;\n max-height: 10rem;\n overflow: auto;\n width: 100%;\n`;\n\nStyledTimePicker.defaultProps = defaultThemeProp;\n\nconst StyledTimeButton = styled.button<TimePickerProps>`\n color: black;\n width: 100%;\n border-radius: inherit;\n overflow: hidden;\n text-align: start;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-width: 0;\n justify-content: start;\n padding: 0;\n background-color: ${props =>\n props.selected ? props.theme.base.colors.blue['extra-light'] : 'transparent'};\n\n > span {\n margin-inline-end: 0.125rem;\n &:first-child {\n margin-inline-start: ${({ theme }) => theme.components['form-control']['border-width']};\n }\n &:nth-child(2) {\n margin-inline-start: 0.125rem;\n }\n &:first-child,\n &:nth-child(3) {\n padding-inline-start: 0.5rem;\n }\n }\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: inset ${props => props.theme.base.shadow.focus};\n }\n`;\n\nStyledTimeButton.defaultProps = defaultThemeProp;\n\nconst StyledTimeItem = styled.li`\n border-radius: 0;\n`;\n\nStyledTimeItem.defaultProps = defaultThemeProp;\n\nconst TimePicker: FunctionComponent<TimePickerProps & ForwardProps> = (props: TimePickerProps) => {\n const { locale } = useConfiguration();\n const { selected = new Date(0), interval = 30, clockFormat, onSelect, ...restProps } = props;\n\n const intervalInMS = interval * 60000;\n\n const actionsList = Array.from(getIntervalGenerator(intervalInMS), time => {\n const date = new Date(selected);\n date.setUTCHours(time.getUTCHours(), time.getUTCMinutes());\n return {\n id: date.getTime().toString(),\n text: Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n timeZone: 'UTC',\n hour12: clockFormat ? clockFormat === 12 : is12HClockFormat(locale)\n }).format(date)\n };\n });\n\n const isSelected = (date: Date) => {\n return (\n selected?.getUTCHours() === date.getUTCHours() &&\n selected?.getUTCMinutes() === date.getUTCMinutes()\n );\n };\n\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const menuRef = useRef<HTMLUListElement>(null);\n\n useArrows(menuRef, { cycle: true });\n\n const renderTime = (text: string) => {\n const [hour, minute, meridiem] = text.split(/:| /);\n return (\n <>\n <span>{hour}</span>:<span>{minute}</span>\n {meridiem && <span>{meridiem}</span>}\n </>\n );\n };\n\n useEffect(() => {\n buttonEl?.focus();\n }, [buttonEl]);\n\n return (\n <StyledTimePicker role='menu' tabIndex={0} ref={menuRef} {...restProps}>\n {actionsList.map(({ text, id }: Action) => {\n const item = new Date(Number(id));\n return (\n <StyledTimeItem role='presentation' key={id}>\n <StyledTimeButton\n role='menuitem'\n as={Button}\n variant='simple'\n ref={isSelected(item) ? setButtonEl : null}\n aria-label={text}\n selected={isSelected(item)}\n onClick={() => {\n onSelect?.(item);\n }}\n >\n {renderTime(text)}\n </StyledTimeButton>\n </StyledTimeItem>\n );\n })}\n </StyledTimePicker>\n );\n};\n\nexport default TimePicker;\n"]}
|
|
@@ -43,16 +43,16 @@ const Weeks = forwardRef((props, ref) => {
|
|
|
43
43
|
newFocused = new Date(focusedWeek);
|
|
44
44
|
newFocused.setUTCDate(focusedWeek.getUTCDate() - 7);
|
|
45
45
|
setFocusedWeek(newFocused);
|
|
46
|
-
onFocus
|
|
46
|
+
onFocus?.(newFocused);
|
|
47
47
|
break;
|
|
48
48
|
case 'ArrowDown':
|
|
49
49
|
newFocused = new Date(focusedWeek);
|
|
50
50
|
newFocused.setUTCDate(focusedWeek.getUTCDate() + 7);
|
|
51
51
|
setFocusedWeek(newFocused);
|
|
52
|
-
onFocus
|
|
52
|
+
onFocus?.(newFocused);
|
|
53
53
|
break;
|
|
54
54
|
case 'Enter':
|
|
55
|
-
onSelect
|
|
55
|
+
onSelect?.(focusedWeek);
|
|
56
56
|
break;
|
|
57
57
|
default:
|
|
58
58
|
}
|
|
@@ -77,21 +77,19 @@ const Weeks = forwardRef((props, ref) => {
|
|
|
77
77
|
const weekText = t('week_label_a11y');
|
|
78
78
|
const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {
|
|
79
79
|
const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());
|
|
80
|
-
return (_jsxs(StyledWeekNumber,
|
|
80
|
+
return (_jsxs(StyledWeekNumber, { variant: 'simple', icon: false, type: 'button', loading: false, ref: isFocused(dateOfISOWeek)
|
|
81
81
|
? (focusedRef) => {
|
|
82
82
|
if (hasFocus)
|
|
83
|
-
focusedRef
|
|
83
|
+
focusedRef?.focus();
|
|
84
84
|
}
|
|
85
85
|
: undefined, tabIndex: isFocused(dateOfISOWeek) ? 0 : -1, disabled: isDisabled(dateOfISOWeek), "aria-selected": isChecked(dateOfISOWeek) || undefined, "aria-label": `${t('week_label_a11y')} ${weekNo.toString()} ${current
|
|
86
86
|
.getUTCFullYear()
|
|
87
87
|
.toString()}`, onClick: () => {
|
|
88
|
-
onSelect
|
|
89
|
-
}
|
|
90
|
-
weekNo.toString()] }), weekNo));
|
|
88
|
+
onSelect?.(dateOfISOWeek);
|
|
89
|
+
}, children: [size === 'long' && `${weekText} `, weekNo.toString()] }, weekNo));
|
|
91
90
|
});
|
|
92
|
-
const label = size === 'short' ? (_jsx(Text,
|
|
93
|
-
return (_jsxs(Flex,
|
|
94
|
-
weeks] }), void 0));
|
|
91
|
+
const label = size === 'short' ? (_jsx(Text, { as: StyledColumnLabel, forwardedAs: 'abbr', title: weekText, children: t('week_text_short') }, void 0)) : (_jsx(Text, { as: StyledColumnLabel, children: weekText }, void 0));
|
|
92
|
+
return (_jsxs(Flex, { as: StyledWeekNumbers, container: { direction: 'column' }, ref: containerRef, onKeyDown: onKeyDown, children: [label, weeks] }, void 0));
|
|
95
93
|
});
|
|
96
94
|
export default Weeks;
|
|
97
95
|
//# sourceMappingURL=Weeks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Weeks.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/Weeks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EAEf,QAAQ,EACR,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,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AQ,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3C,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,mBACpB,SAAS,CAAC,aAAa,CAAC,IAAI,SAAS,gBACxC,GAAG,CAAC,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,OAAO;iBAChE,cAAc,EAAE;iBAChB,QAAQ,EAAE,EAAE,EACf,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,aAAa,CAAC,CAAC;YAC5B,CAAC,iBAEA,IAAI,KAAK,MAAM,IAAI,GAAG,QAAQ,GAAG;gBACjC,MAAM,CAAC,QAAQ,EAAE,MAvBb,MAAM,CAwBM,CACpB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GACT,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CACjB,KAAC,IAAI,kBAAC,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,EAAC,KAAK,EAAE,QAAQ,gBAC5D,CAAC,CAAC,iBAAiB,CAAC,YAChB,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,kBAAC,EAAE,EAAE,iBAAiB,gBAAG,QAAQ,YAAQ,CAC/C,CAAC;IAEJ,OAAO,CACL,MAAC,IAAI,kBACH,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,iBAEnB,KAAK;YACL,KAAK,aACD,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n FC,\n useLayoutEffect,\n KeyboardEvent,\n useState,\n forwardRef,\n PropsWithoutRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { defaultThemeProp } from '../../../theme';\nimport Text from '../../Text';\nimport { getDateOfISOWeek, getWeek, parseToDate, toUTCDateString } from '../Input/utils';\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { CALENDAR_TYPES } from '../Input/local';\nimport { ForwardProps } from '../../../types';\nimport { FormControlProps } from '../../FormControl';\n\nimport { StyledColumnLabel, StyledPick } from './Calendar.styles';\nimport { getWeeksOfMonth } from './utils';\n\nexport interface WeeksProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Defines default week that will be selected when the Date Picker is opened.\n */\n selected?: Date;\n /**\n * Defines default week that will be focused initially when the Date Picker is opened.\n * @default new Date()\n */\n current?: Date;\n /** Callback fired when user focuses new week. */\n onFocus?: (date: Date) => void;\n /** Callback fired when new week is selected. */\n onSelect?: (date: Date) => void;\n /** Sets the type of calendar to be used. This will be determined by locale if no value is provided. */\n calendarType?: string;\n /** Defines minimum available value that can be selected by the user. */\n min?: string | number | Date;\n /** Defines maximum available value that can be selected by the user. */\n max?: string | number | Date;\n /** Set the calendar to disabled state, ie. non-interactive. */\n disabled?: boolean;\n /** Should text be in long or short format (ie. only number). */\n size?: 'short' | 'long';\n}\n\nexport const StyledWeekNumbers = styled.div`\n margin-inline-end: ${props => props.theme.base.spacing};\n color: rgba(0, 0, 0, 0.75);\n`;\n\nStyledWeekNumbers.defaultProps = defaultThemeProp;\n\nconst StyledWeekNumber = styled(StyledPick)(props => {\n const {\n theme: {\n base: { 'border-radius': borderRadius }\n }\n } = props;\n\n return css`\n &:disabled {\n &:nth-child(2) {\n border-radius: calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius}) 0 0;\n }\n &:last-child {\n border-radius: 0 0 calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius});\n }\n }\n `;\n});\n\nStyledWeekNumber.defaultProps = defaultThemeProp;\n\nconst Weeks: FC<WeeksProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeeksProps>, ref: Ref<HTMLButtonElement>) => {\n const {\n selected,\n current = selected ? new Date(selected.getTime()) : new Date(),\n calendarType = CALENDAR_TYPES.ISO_8601,\n onSelect,\n onFocus,\n disabled = false,\n size = 'short'\n } = props;\n\n const [focusedWeek, setFocusedWeek] = useState(current);\n useLayoutEffect(() => {\n setFocusedWeek(current);\n }, [current.getUTCFullYear(), current.getUTCMonth()]);\n\n let newFocused: Date;\n const onKeyDown = (ev: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter'].includes(ev.key)) ev.preventDefault();\n switch (ev.key) {\n case 'ArrowUp':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() - 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'ArrowDown':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() + 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'Enter':\n onSelect?.(focusedWeek);\n break;\n default:\n }\n };\n\n const containerRef = useConsolidatedRef(ref);\n const hasFocus = useFocusWithin([containerRef]);\n\n const min = props.min ? parseToDate(props.min) : -Infinity;\n const max = props.max ? parseToDate(props.max) : Infinity;\n const isDisabled = (day: Date) => {\n return disabled || min > day.getTime() || day.getTime() > max;\n };\n\n const isChecked = (day: Date) => {\n return (\n selected &&\n toUTCDateString(day) ===\n toUTCDateString(getDateOfISOWeek(getWeek(selected, calendarType), selected.getFullYear()))\n );\n };\n\n const isFocused = (day: Date) => {\n return (\n toUTCDateString(day) ===\n toUTCDateString(\n getDateOfISOWeek(getWeek(focusedWeek, calendarType), focusedWeek.getFullYear())\n )\n );\n };\n\n const t = useI18n();\n\n const weekText = t('week_label_a11y');\n\n const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {\n const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());\n return (\n <StyledWeekNumber\n key={weekNo}\n variant='simple'\n icon={false}\n type='button'\n loading={false}\n ref={\n isFocused(dateOfISOWeek)\n ? (focusedRef: HTMLButtonElement) => {\n if (hasFocus) focusedRef?.focus();\n }\n : undefined\n }\n tabIndex={isFocused(dateOfISOWeek) ? 0 : -1}\n disabled={isDisabled(dateOfISOWeek)}\n aria-selected={isChecked(dateOfISOWeek) || undefined}\n aria-label={`${t('week_label_a11y')} ${weekNo.toString()} ${current\n .getUTCFullYear()\n .toString()}`}\n onClick={() => {\n onSelect?.(dateOfISOWeek);\n }}\n >\n {size === 'long' && `${weekText} `}\n {weekNo.toString()}\n </StyledWeekNumber>\n );\n });\n\n const label =\n size === 'short' ? (\n <Text as={StyledColumnLabel} forwardedAs='abbr' title={weekText}>\n {t('week_text_short')}\n </Text>\n ) : (\n <Text as={StyledColumnLabel}>{weekText}</Text>\n );\n\n return (\n <Flex\n as={StyledWeekNumbers}\n container={{ direction: 'column' }}\n ref={containerRef}\n onKeyDown={onKeyDown}\n >\n {label}\n {weeks}\n </Flex>\n );\n }\n);\n\nexport default Weeks;\n"]}
|
|
1
|
+
{"version":3,"file":"Weeks.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/Weeks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EAEf,QAAQ,EACR,UAAU,EAGX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,M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} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { defaultThemeProp } from '../../../theme';\nimport Text from '../../Text';\nimport { getDateOfISOWeek, getWeek, parseToDate, toUTCDateString } from '../Input/utils';\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport { CALENDAR_TYPES } from '../Input/local';\nimport { ForwardProps } from '../../../types';\nimport { FormControlProps } from '../../FormControl';\n\nimport { StyledColumnLabel, StyledPick } from './Calendar.styles';\nimport { getWeeksOfMonth } from './utils';\n\nexport interface WeeksProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Defines default week that will be selected when the Date Picker is opened.\n */\n selected?: Date;\n /**\n * Defines default week that will be focused initially when the Date Picker is opened.\n * @default new Date()\n */\n current?: Date;\n /** Callback fired when user focuses new week. */\n onFocus?: (date: Date) => void;\n /** Callback fired when new week is selected. */\n onSelect?: (date: Date) => void;\n /** Sets the type of calendar to be used. This will be determined by locale if no value is provided. */\n calendarType?: string;\n /** Defines minimum available value that can be selected by the user. */\n min?: string | number | Date;\n /** Defines maximum available value that can be selected by the user. */\n max?: string | number | Date;\n /** Set the calendar to disabled state, ie. non-interactive. */\n disabled?: boolean;\n /** Should text be in long or short format (ie. only number). */\n size?: 'short' | 'long';\n}\n\nexport const StyledWeekNumbers = styled.div`\n margin-inline-end: ${props => props.theme.base.spacing};\n color: rgba(0, 0, 0, 0.75);\n`;\n\nStyledWeekNumbers.defaultProps = defaultThemeProp;\n\nconst StyledWeekNumber = styled(StyledPick)(props => {\n const {\n theme: {\n base: { 'border-radius': borderRadius }\n }\n } = props;\n\n return css`\n &:disabled {\n &:nth-child(2) {\n border-radius: calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius}) 0 0;\n }\n &:last-child {\n border-radius: 0 0 calc(0.5 * ${borderRadius}) calc(0.5 * ${borderRadius});\n }\n }\n `;\n});\n\nStyledWeekNumber.defaultProps = defaultThemeProp;\n\nconst Weeks: FC<WeeksProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<WeeksProps>, ref: Ref<HTMLButtonElement>) => {\n const {\n selected,\n current = selected ? new Date(selected.getTime()) : new Date(),\n calendarType = CALENDAR_TYPES.ISO_8601,\n onSelect,\n onFocus,\n disabled = false,\n size = 'short'\n } = props;\n\n const [focusedWeek, setFocusedWeek] = useState(current);\n useLayoutEffect(() => {\n setFocusedWeek(current);\n }, [current.getUTCFullYear(), current.getUTCMonth()]);\n\n let newFocused: Date;\n const onKeyDown = (ev: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter'].includes(ev.key)) ev.preventDefault();\n switch (ev.key) {\n case 'ArrowUp':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() - 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'ArrowDown':\n newFocused = new Date(focusedWeek);\n newFocused.setUTCDate(focusedWeek.getUTCDate() + 7);\n setFocusedWeek(newFocused);\n onFocus?.(newFocused);\n break;\n case 'Enter':\n onSelect?.(focusedWeek);\n break;\n default:\n }\n };\n\n const containerRef = useConsolidatedRef(ref);\n const hasFocus = useFocusWithin([containerRef]);\n\n const min = props.min ? parseToDate(props.min) : -Infinity;\n const max = props.max ? parseToDate(props.max) : Infinity;\n const isDisabled = (day: Date) => {\n return disabled || min > day.getTime() || day.getTime() > max;\n };\n\n const isChecked = (day: Date) => {\n return (\n selected &&\n toUTCDateString(day) ===\n toUTCDateString(getDateOfISOWeek(getWeek(selected, calendarType), selected.getFullYear()))\n );\n };\n\n const isFocused = (day: Date) => {\n return (\n toUTCDateString(day) ===\n toUTCDateString(\n getDateOfISOWeek(getWeek(focusedWeek, calendarType), focusedWeek.getFullYear())\n )\n );\n };\n\n const t = useI18n();\n\n const weekText = t('week_label_a11y');\n\n const weeks = getWeeksOfMonth(current, calendarType).map(weekNo => {\n const dateOfISOWeek = getDateOfISOWeek(weekNo, current.getUTCFullYear());\n return (\n <StyledWeekNumber\n key={weekNo}\n variant='simple'\n icon={false}\n type='button'\n loading={false}\n ref={\n isFocused(dateOfISOWeek)\n ? (focusedRef: HTMLButtonElement) => {\n if (hasFocus) focusedRef?.focus();\n }\n : undefined\n }\n tabIndex={isFocused(dateOfISOWeek) ? 0 : -1}\n disabled={isDisabled(dateOfISOWeek)}\n aria-selected={isChecked(dateOfISOWeek) || undefined}\n aria-label={`${t('week_label_a11y')} ${weekNo.toString()} ${current\n .getUTCFullYear()\n .toString()}`}\n onClick={() => {\n onSelect?.(dateOfISOWeek);\n }}\n >\n {size === 'long' && `${weekText} `}\n {weekNo.toString()}\n </StyledWeekNumber>\n );\n });\n\n const label =\n size === 'short' ? (\n <Text as={StyledColumnLabel} forwardedAs='abbr' title={weekText}>\n {t('week_text_short')}\n </Text>\n ) : (\n <Text as={StyledColumnLabel}>{weekText}</Text>\n );\n\n return (\n <Flex\n as={StyledWeekNumbers}\n container={{ direction: 'column' }}\n ref={containerRef}\n onKeyDown={onKeyDown}\n >\n {label}\n {weeks}\n </Flex>\n );\n }\n);\n\nexport default Weeks;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const getLocalizedDays: (calendarType: string, localeTag?: string | undefined) => string[][];
|
|
2
|
+
export declare const isValidDate: (date: Date) => boolean;
|
|
2
3
|
export declare const getDaysOfMonth: (date: Date, calendarType: string) => Date[];
|
|
3
4
|
export declare const getWeeksOfMonth: (date: Date, calendarType: string) => number[];
|
|
4
5
|
export declare const getNextMonth: (date: Date) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,iBAAkB,MAAM,+CAOpD,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,IAAI,gBAAgB,MAAM,KAAG,IAAI,EAQrE,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,IAAI,gBAAgB,MAAM,KAAG,MAAM,EAmBxE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,IAAI,WAGtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,IAAI,WAG1C,CAAC;AAIF,wBAAiB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,kCAMrD"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,iBAAkB,MAAM,+CAOpD,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,IAAI,YAErC,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,IAAI,gBAAgB,MAAM,KAAG,IAAI,EAQrE,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,IAAI,gBAAgB,MAAM,KAAG,MAAM,EAmBxE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,IAAI,WAGtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,IAAI,WAG1C,CAAC;AAIF,wBAAiB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,kCAMrD"}
|
|
@@ -8,6 +8,9 @@ export const getLocalizedDays = (calendarType, localeTag) => {
|
|
|
8
8
|
];
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
export const isValidDate = (date) => {
|
|
12
|
+
return date.toString() !== 'Invalid Date';
|
|
13
|
+
};
|
|
11
14
|
export const getDaysOfMonth = (date, calendarType) => {
|
|
12
15
|
const firstDayInMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
|
|
13
16
|
const startingWeekDay = getDayOfWeek(firstDayInMonth, calendarType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE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;IAClF,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,MAAM,SAAS,CAAC,CAAC,oBAAoB,CAAC,QAAgB;IACpD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,OAAO,CAAC,OAAO,EAAE,GAAG,mBAAmB,EAAE;QAC9C,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC;KAC/C;AACH,CAAC","sourcesContent":["import { cap, range } from '../../../utils';\nimport { getDayOfWeek, getWeek, getWeekdays } from '../Input/utils';\n\nexport const getLocalizedDays = (calendarType: string, localeTag?: string) => {\n return getWeekdays(calendarType).map(weekdayDate => {\n return [\n cap(weekdayDate.toLocaleString(localeTag, { weekday: 'long' })),\n cap(weekdayDate.toLocaleString(localeTag, { weekday: 'short' }))\n ];\n });\n};\n\nexport const getDaysOfMonth = (date: Date, calendarType: string): Date[] => {\n const firstDayInMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));\n const startingWeekDay = getDayOfWeek(firstDayInMonth, calendarType);\n\n /** 6 rows * 7 days = 42 */\n return range(1 - startingWeekDay, 42 - startingWeekDay).map((day: number) => {\n return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), day));\n });\n};\n\nexport const getWeeksOfMonth = (date: Date, calendarType: string): number[] => {\n const weekdays = [];\n const year = date.getUTCFullYear();\n const month = date.getUTCMonth();\n const dayInLastWeek = new Date(Date.UTC(year, month, 36));\n const lastWeek = getWeek(dayInLastWeek, calendarType);\n\n let day;\n let currentWeek;\n let iterator = 1;\n\n do {\n day = new Date(Date.UTC(year, month, iterator));\n currentWeek = getWeek(day, calendarType);\n weekdays.push(currentWeek);\n iterator += 7;\n } while (currentWeek !== lastWeek);\n\n return weekdays;\n};\n\nexport const getNextMonth = (date: Date) => {\n const next = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1));\n return next.getUTCMonth();\n};\n\nexport const getPreviousMonth = (date: Date) => {\n const prev = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() - 1, 1));\n return prev.getUTCMonth();\n};\n\nconst DAY_IN_MILLISECONDS = 86400000;\n\nexport function* getIntervalGenerator(interval: number) {\n const current = new Date(0);\n while (current.getTime() < DAY_IN_MILLISECONDS) {\n yield new Date(current);\n current.setTime(current.getTime() + interval);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Picker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,SAAkB,EAAE,EAAE;IAC3E,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QACjD,OAAO;YACL,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YAC/D,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;SACjE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAU,EAAE,EAAE;IACxC,OAAO,IAAI,CAAC,QAAQ,EAAE,KAAK,cAAc,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAU,EAAE,YAAoB,EAAU,EAAE;IACzE,MAAM,eA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C;QAC3B,QAAQ,IAAI,CAAC,CAAC;KACf,QAAQ,WAAW,KAAK,QAAQ,EAAE;IAEnC,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,EAAE;IACzC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,MAAM,SAAS,CAAC,CAAC,oBAAoB,CAAC,QAAgB;IACpD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,OAAO,CAAC,OAAO,EAAE,GAAG,mBAAmB,EAAE;QAC9C,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC;KAC/C;AACH,CAAC","sourcesContent":["import { cap, range } from '../../../utils';\nimport { getDayOfWeek, getWeek, getWeekdays } from '../Input/utils';\n\nexport const getLocalizedDays = (calendarType: string, localeTag?: string) => {\n return getWeekdays(calendarType).map(weekdayDate => {\n return [\n cap(weekdayDate.toLocaleString(localeTag, { weekday: 'long' })),\n cap(weekdayDate.toLocaleString(localeTag, { weekday: 'short' }))\n ];\n });\n};\n\nexport const isValidDate = (date: Date) => {\n return date.toString() !== 'Invalid Date';\n};\n\nexport const getDaysOfMonth = (date: Date, calendarType: string): Date[] => {\n const firstDayInMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));\n const startingWeekDay = getDayOfWeek(firstDayInMonth, calendarType);\n\n /** 6 rows * 7 days = 42 */\n return range(1 - startingWeekDay, 42 - startingWeekDay).map((day: number) => {\n return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), day));\n });\n};\n\nexport const getWeeksOfMonth = (date: Date, calendarType: string): number[] => {\n const weekdays = [];\n const year = date.getUTCFullYear();\n const month = date.getUTCMonth();\n const dayInLastWeek = new Date(Date.UTC(year, month, 36));\n const lastWeek = getWeek(dayInLastWeek, calendarType);\n\n let day;\n let currentWeek;\n let iterator = 1;\n\n do {\n day = new Date(Date.UTC(year, month, iterator));\n currentWeek = getWeek(day, calendarType);\n weekdays.push(currentWeek);\n iterator += 7;\n } while (currentWeek !== lastWeek);\n\n return weekdays;\n};\n\nexport const getNextMonth = (date: Date) => {\n const next = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1));\n return next.getUTCMonth();\n};\n\nexport const getPreviousMonth = (date: Date) => {\n const prev = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() - 1, 1));\n return prev.getUTCMonth();\n};\n\nconst DAY_IN_MILLISECONDS = 86400000;\n\nexport function* getIntervalGenerator(interval: number) {\n const current = new Date(0);\n while (current.getTime() < DAY_IN_MILLISECONDS) {\n yield new Date(current);\n current.setTime(current.getTime() + interval);\n }\n}\n"]}
|
|
@@ -14,6 +14,8 @@ export { default as DateTimeInput } from './Input/DateTimeInput';
|
|
|
14
14
|
export type { DateTimeInputProps } from './Input/DateTimeInput';
|
|
15
15
|
export { default as DayOfWeekInput } from './Input/DayOfWeekInput';
|
|
16
16
|
export type { DayOfWeekInputProps } from './Input/DayOfWeekInput';
|
|
17
|
+
export { default as QuarterInput } from './Input/QuarterInput';
|
|
18
|
+
export type { QuarterInputProps } from './Input/QuarterInput';
|
|
17
19
|
export { default as TimePicker } from './Picker/TimePicker';
|
|
18
20
|
export type { TimePickerProps } from './Picker/TimePicker';
|
|
19
21
|
export { default as DatePicker } from './Picker/DatePicker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,mBAAmB,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AY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -6,6 +6,7 @@ export { default as DateRangeInput } from './Input/DateRangeInput';
|
|
|
6
6
|
export { default as DurationInput } from './Input/Duration/DurationInput';
|
|
7
7
|
export { default as DateTimeInput } from './Input/DateTimeInput';
|
|
8
8
|
export { default as DayOfWeekInput } from './Input/DayOfWeekInput';
|
|
9
|
+
export { default as QuarterInput } from './Input/QuarterInput';
|
|
9
10
|
export { default as TimePicker } from './Picker/TimePicker';
|
|
10
11
|
export { default as DatePicker } from './Picker/DatePicker';
|
|
11
12
|
export { default as DateTimeDisplay } from './DateTimeDisplay';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DateTime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { default as DateInput } from './Input/DateInput';\nexport type { DateInputProps } from './Input/DateInput';\nexport { default as WeekInput } from './Input/WeekInput';\nexport type { WeekInputProps } from './Input/WeekInput';\nexport { default as MonthInput } from './Input/MonthInput';\nexport type { MonthInputProps } from './Input/MonthInput';\nexport { default as TimeInput } from './Input/TimeInput';\nexport type { TimeInputProps } from './Input/TimeInput';\nexport { default as DateRangeInput } from './Input/DateRangeInput';\nexport type { DateRangeInputProps } from './Input/DateRangeInput';\nexport { default as DurationInput } from './Input/Duration/DurationInput';\nexport type { default as DurationInputProps } from './Input/Duration/DurationInput.types';\nexport { default as DateTimeInput } from './Input/DateTimeInput';\nexport type { DateTimeInputProps } from './Input/DateTimeInput';\nexport { default as DayOfWeekInput } from './Input/DayOfWeekInput';\nexport type { DayOfWeekInputProps } from './Input/DayOfWeekInput';\nexport { default as QuarterInput } from './Input/QuarterInput';\nexport type { QuarterInputProps } from './Input/QuarterInput';\n\nexport { default as TimePicker } from './Picker/TimePicker';\nexport type { TimePickerProps } from './Picker/TimePicker';\nexport { default as DatePicker } from './Picker/DatePicker';\nexport type { default as DatePickerProps } from './Picker/DatePicker.types';\n\nexport { default as DateTimeDisplay } from './DateTimeDisplay';\nexport type { DateTimeDisplayProps } from './DateTimeDisplay';\nexport { default as DurationDisplay } from './DurationDisplay';\nexport type { DurationDisplayProps } from './DurationDisplay';\n"]}
|
|
@@ -43,23 +43,23 @@ const Drawer = forwardRef((props, ref) => {
|
|
|
43
43
|
prevState = state;
|
|
44
44
|
useOuterEvent('mousedown', [drawerRef.current], useCallback(() => {
|
|
45
45
|
if (open)
|
|
46
|
-
onOuterClick
|
|
46
|
+
onOuterClick?.();
|
|
47
47
|
}, [open, onOuterClick]));
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
if (open && (state === 'closed' || state === 'closing')) {
|
|
50
|
-
onBeforeOpen
|
|
50
|
+
onBeforeOpen?.();
|
|
51
51
|
reflow(drawerRef.current);
|
|
52
52
|
setState('opening');
|
|
53
53
|
}
|
|
54
54
|
else if (!open && (state === 'open' || state === 'opening')) {
|
|
55
|
-
onBeforeClose
|
|
55
|
+
onBeforeClose?.();
|
|
56
56
|
setState('closing');
|
|
57
57
|
}
|
|
58
58
|
else if (open && state === 'open' && prevState !== 'open') {
|
|
59
|
-
onAfterOpen
|
|
59
|
+
onAfterOpen?.();
|
|
60
60
|
}
|
|
61
61
|
else if (!open && state === 'closed' && prevState !== 'closed') {
|
|
62
|
-
onAfterClose
|
|
62
|
+
onAfterClose?.();
|
|
63
63
|
}
|
|
64
64
|
}, [open, state, prevState, onBeforeOpen, onBeforeClose, onAfterOpen, onAfterClose]);
|
|
65
65
|
const onTransitionEnd = useCallback((e) => {
|
|
@@ -67,7 +67,7 @@ const Drawer = forwardRef((props, ref) => {
|
|
|
67
67
|
return;
|
|
68
68
|
setState(open ? 'open' : 'closed');
|
|
69
69
|
}, [open]);
|
|
70
|
-
return state === 'closed' && !open && nullWhenClosed ? null : (_jsx(StyledDrawer,
|
|
70
|
+
return state === 'closed' && !open && nullWhenClosed ? null : (_jsx(StyledDrawer, { ref: drawerRef, position: position, shadow: shadow && open, transitionSpeed: transitionSpeed, placement: placement, size: size, open: open, state: state, onTransitionEnd: onTransitionEnd, ...restProps, children: children }, void 0));
|
|
71
71
|
});
|
|
72
72
|
export default Drawer;
|
|
73
73
|
//# sourceMappingURL=Drawer.js.map
|