@trellixio/roaster-react 1.1.1 → 2.0.0
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 +31 -17
- package/cjs/components/ActionCard/ActionCard.js +20 -4
- package/cjs/components/ActionCard/ActionCard.js.map +1 -1
- package/cjs/components/ActionCard/ActionCardGroup.js +42 -0
- package/cjs/components/ActionCard/ActionCardGroup.js.map +1 -0
- package/cjs/components/ActionList/ActionList.context.js.map +1 -1
- package/cjs/components/ActionList/ActionList.js +20 -23
- package/cjs/components/ActionList/ActionList.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListDivider.js +6 -3
- package/cjs/components/ActionList/components/ActionListDivider.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListDropdown.js +30 -15
- package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListGroup.js +25 -4
- package/cjs/components/ActionList/components/ActionListGroup.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListItem.js +54 -4
- package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSearch.js +67 -0
- package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -0
- package/cjs/components/ActionList/components/ActionListSubmenu.js +125 -0
- package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -0
- package/cjs/components/ActionList/components/ActionListSwitchItem.js +64 -0
- package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -0
- package/cjs/components/ActionList/components/ActionListTrigger.js +2 -36
- package/cjs/components/ActionList/components/ActionListTrigger.js.map +1 -1
- package/cjs/components/Alert/Alert.js +19 -2
- package/cjs/components/Alert/Alert.js.map +1 -1
- package/cjs/components/AppFrame/AppFrame.js +56 -0
- package/cjs/components/AppFrame/AppFrame.js.map +1 -0
- package/cjs/components/Avatar/Avatar.js +31 -8
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/cjs/components/BlockCard/BlockCard.js +98 -4
- package/cjs/components/BlockCard/BlockCard.js.map +1 -1
- package/cjs/components/Button/Button.js +36 -15
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/ButtonIcon/ButtonIcon.js +8 -9
- package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/cjs/components/Chart/Chart.js +185 -0
- package/cjs/components/Chart/Chart.js.map +1 -0
- package/cjs/components/Checkbox/Checkbox.js +65 -38
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.context.js.map +1 -1
- package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.js +45 -11
- package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/cjs/components/Checkbox/ChoiceText.js +49 -0
- package/cjs/components/Checkbox/ChoiceText.js.map +1 -0
- package/cjs/components/ColorField/ColorField.js +69 -18
- package/cjs/components/ColorField/ColorField.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.js +86 -48
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/components/Calendar/Calendar.js +65 -35
- package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/DatePicker/components/Day/Day.js +16 -31
- package/cjs/components/DatePicker/components/Day/Day.js.map +1 -1
- package/cjs/components/DatePicker/components/Month/Month.js +92 -29
- package/cjs/components/DatePicker/components/Month/Month.js.map +1 -1
- package/cjs/components/DatePicker/components/MonthGrid/MonthGrid.js +97 -0
- package/cjs/components/DatePicker/components/MonthGrid/MonthGrid.js.map +1 -0
- package/cjs/components/DatePicker/components/Weekday/Weekday.js +3 -15
- package/cjs/components/DatePicker/components/Weekday/Weekday.js.map +1 -1
- package/cjs/components/DatePicker/utils/index.js +43 -25
- package/cjs/components/DatePicker/utils/index.js.map +1 -1
- package/cjs/components/DescriptiveList/DescriptiveList.js +14 -5
- package/cjs/components/DescriptiveList/DescriptiveList.js.map +1 -1
- package/cjs/components/DescriptiveList/DescriptiveListItem.js +15 -3
- package/cjs/components/DescriptiveList/DescriptiveListItem.js.map +1 -1
- package/cjs/components/DropdownCard/DropdownCard.context.js.map +1 -1
- package/cjs/components/DropdownCard/DropdownCard.js +17 -22
- package/cjs/components/DropdownCard/DropdownCard.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardActions.js +5 -3
- package/cjs/components/DropdownCard/components/DropdownCardActions.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardContent.js +5 -3
- package/cjs/components/DropdownCard/components/DropdownCardContent.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +18 -13
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js +136 -0
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -0
- package/cjs/components/DropdownCard/components/DropdownCardTrigger.js +2 -34
- package/cjs/components/DropdownCard/components/DropdownCardTrigger.js.map +1 -1
- package/cjs/components/Field/Field.js +27 -0
- package/cjs/components/Field/Field.js.map +1 -0
- package/cjs/components/FileField/FileField.js +64 -24
- package/cjs/components/FileField/FileField.js.map +1 -1
- package/cjs/components/FormActions/FormActions.js +27 -0
- package/cjs/components/FormActions/FormActions.js.map +1 -0
- package/cjs/components/HyperlinkCard/HyperlinkCard.js +22 -6
- package/cjs/components/HyperlinkCard/HyperlinkCard.js.map +1 -1
- package/cjs/components/Icon/Icon.js +10 -12
- package/cjs/components/Icon/Icon.js.map +1 -1
- package/cjs/components/IconBadge/IconBadge.js +40 -0
- package/cjs/components/IconBadge/IconBadge.js.map +1 -0
- package/cjs/components/Loader/Loader.js +35 -2
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/Modal/Modal.js +91 -4
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/ModalProvider/ModalProviderFooter.js +7 -4
- package/cjs/components/Modal/ModalProvider/ModalProviderFooter.js.map +1 -1
- package/cjs/components/Modal/ModalProvider/index.js +16 -17
- package/cjs/components/Modal/ModalProvider/index.js.map +1 -1
- package/cjs/components/Modal/utils/reducer.js +4 -1
- package/cjs/components/Modal/utils/reducer.js.map +1 -1
- package/cjs/components/Modal/utils/useModal.js +1 -1
- package/cjs/components/Modal/utils/useModal.js.map +1 -1
- package/cjs/components/Page/Breadcrumbs.js +43 -0
- package/cjs/components/Page/Breadcrumbs.js.map +1 -0
- package/cjs/components/Page/Page.js +73 -8
- package/cjs/components/Page/Page.js.map +1 -1
- package/cjs/components/Pagination/Pagination.js +23 -12
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/Progress/Progress.js +48 -3
- package/cjs/components/Progress/Progress.js.map +1 -1
- package/cjs/components/Radio/Radio.js +35 -25
- package/cjs/components/Radio/Radio.js.map +1 -1
- package/cjs/components/Radio/RadioGroup/RadioGroup.context.js.map +1 -1
- package/cjs/components/Radio/RadioGroup/RadioGroup.js +37 -24
- package/cjs/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/RangeField/RangeField.js +31 -27
- package/cjs/components/RangeField/RangeField.js.map +1 -1
- package/cjs/components/Select/Select.js +75 -31
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Sidebar/Sidebar.js +122 -110
- package/cjs/components/Sidebar/Sidebar.js.map +1 -1
- package/cjs/components/Sidebar/components/Back.js +38 -0
- package/cjs/components/Sidebar/components/Back.js.map +1 -0
- package/cjs/components/Sidebar/components/Menu.js +17 -6
- package/cjs/components/Sidebar/components/Menu.js.map +1 -1
- package/cjs/components/Sidebar/components/MenuItem.js +37 -6
- package/cjs/components/Sidebar/components/MenuItem.js.map +1 -1
- package/cjs/components/Sidebar/components/Section.js +15 -3
- package/cjs/components/Sidebar/components/Section.js.map +1 -1
- package/cjs/components/Sidebar/components/SubMenu.js +15 -2
- package/cjs/components/Sidebar/components/SubMenu.js.map +1 -1
- package/cjs/components/Spinner/Spinner.js +20 -2
- package/cjs/components/Spinner/Spinner.js.map +1 -1
- package/cjs/components/StatCard/StatCard.js +47 -10
- package/cjs/components/StatCard/StatCard.js.map +1 -1
- package/cjs/components/Switch/Switch.js +42 -20
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/cjs/components/Table/Table.js +95 -31
- package/cjs/components/Table/Table.js.map +1 -1
- package/cjs/components/Table/components/Checkbox/index.js +8 -8
- package/cjs/components/Table/components/Checkbox/index.js.map +1 -1
- package/cjs/components/Table/components/TableBody.js +3 -3
- package/cjs/components/Table/components/TableBody.js.map +1 -1
- package/cjs/components/Table/components/TableCell.js +3 -4
- package/cjs/components/Table/components/TableCell.js.map +1 -1
- package/cjs/components/Table/components/TableGroup.js +30 -0
- package/cjs/components/Table/components/TableGroup.js.map +1 -0
- package/cjs/components/Table/components/TableHead.js +19 -16
- package/cjs/components/Table/components/TableHead.js.map +1 -1
- package/cjs/components/Table/components/TableHeadCell.js +23 -5
- package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
- package/cjs/components/Table/components/TablePagination.js +6 -16
- package/cjs/components/Table/components/TablePagination.js.map +1 -1
- package/cjs/components/Table/components/TableProvider/TableProvider.js +4 -4
- package/cjs/components/Table/components/TableProvider/TableProvider.js.map +1 -1
- package/cjs/components/Table/components/TableRow.js +12 -9
- package/cjs/components/Table/components/TableRow.js.map +1 -1
- package/cjs/components/Table/labels.js +34 -0
- package/cjs/components/Table/labels.js.map +1 -0
- package/cjs/components/Table/utils/rows/context.js.map +1 -1
- package/cjs/components/Table/utils/table/context.js.map +1 -1
- package/cjs/components/Table/utils/table/hooks.js +3 -3
- package/cjs/components/Table/utils/table/hooks.js.map +1 -1
- package/cjs/components/Table/utils/table/types.js +0 -7
- package/cjs/components/Table/utils/table/types.js.map +1 -1
- package/cjs/components/Table/utils/useSelectableResourceState/index.js +4 -5
- package/cjs/components/Table/utils/useSelectableResourceState/index.js.map +1 -1
- package/cjs/components/Tag/Tag.js +36 -5
- package/cjs/components/Tag/Tag.js.map +1 -1
- package/cjs/components/Tag/TagGroup.js +3 -2
- package/cjs/components/Tag/TagGroup.js.map +1 -1
- package/cjs/components/TextField/TextField.js +41 -38
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/Textarea/Textarea.js +10 -26
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Thumbnail/Thumbnail.js +22 -8
- package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
- package/cjs/components/Timeline/Timeline.js +40 -0
- package/cjs/components/Timeline/Timeline.js.map +1 -0
- package/cjs/components/Timeline/TimelineGroup.js +42 -0
- package/cjs/components/Timeline/TimelineGroup.js.map +1 -0
- package/cjs/components/Timeline/TimelineItem.js +38 -0
- package/cjs/components/Timeline/TimelineItem.js.map +1 -0
- package/cjs/components/Toast/Toast.js +18 -2
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toast/Toasts.context.js +31 -3
- package/cjs/components/Toast/Toasts.context.js.map +1 -1
- package/cjs/components/Toast/ToastsContainer/index.js +43 -19
- package/cjs/components/Toast/ToastsContainer/index.js.map +1 -1
- package/cjs/components/Toast/ToastsProvider/index.js +11 -15
- package/cjs/components/Toast/ToastsProvider/index.js.map +1 -1
- package/cjs/components/Toast/store.js +49 -0
- package/cjs/components/Toast/store.js.map +1 -0
- package/cjs/components/Tooltip/Tooltip.js +34 -53
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/Tooltip/TooltipCallout.js +60 -0
- package/cjs/components/Tooltip/TooltipCallout.js.map +1 -0
- package/cjs/components/Tooltip/useTooltip.js +11 -45
- package/cjs/components/Tooltip/useTooltip.js.map +1 -1
- package/cjs/components/Visualizer/Visualizer.js +70 -10
- package/cjs/components/Visualizer/Visualizer.js.map +1 -1
- package/cjs/index.js +68 -66
- package/cjs/index.js.map +1 -1
- package/cjs/tokens/tokens.js +1532 -0
- package/cjs/tokens/tokens.js.map +1 -0
- package/cjs/utils/Slot/index.js +52 -0
- package/cjs/utils/Slot/index.js.map +1 -0
- package/cjs/utils/classNames/index.js +3 -3
- package/cjs/utils/classNames/index.js.map +1 -1
- package/cjs/utils/getElementRef/index.js +16 -0
- package/cjs/utils/getElementRef/index.js.map +1 -0
- package/cjs/utils/guid/index.js.map +1 -1
- package/cjs/utils/toPercent/index.js +9 -0
- package/cjs/utils/toPercent/index.js.map +1 -0
- package/cjs/utils/useControllableState/index.js +39 -0
- package/cjs/utils/useControllableState/index.js.map +1 -0
- package/cjs/utils/useDropdown/DropdownTrigger.js +33 -0
- package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -0
- package/cjs/utils/useDropdown/index.js +54 -23
- package/cjs/utils/useDropdown/index.js.map +1 -1
- package/cjs/utils/useImageFallback/index.js +26 -0
- package/cjs/utils/useImageFallback/index.js.map +1 -0
- package/cjs/utils/useUid/index.js.map +1 -1
- package/esm/components/ActionCard/ActionCard.js +20 -4
- package/esm/components/ActionCard/ActionCard.js.map +1 -1
- package/esm/components/ActionCard/ActionCardGroup.js +26 -0
- package/esm/components/ActionCard/ActionCardGroup.js.map +1 -0
- package/esm/components/ActionList/ActionList.context.js.map +1 -1
- package/esm/components/ActionList/ActionList.js +21 -11
- package/esm/components/ActionList/ActionList.js.map +1 -1
- package/esm/components/ActionList/components/ActionListDivider.js +6 -3
- package/esm/components/ActionList/components/ActionListDivider.js.map +1 -1
- package/esm/components/ActionList/components/ActionListDropdown.js +31 -16
- package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/esm/components/ActionList/components/ActionListGroup.js +24 -3
- package/esm/components/ActionList/components/ActionListGroup.js.map +1 -1
- package/esm/components/ActionList/components/ActionListItem.js +53 -3
- package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSearch.js +52 -0
- package/esm/components/ActionList/components/ActionListSearch.js.map +1 -0
- package/esm/components/ActionList/components/ActionListSubmenu.js +110 -0
- package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -0
- package/esm/components/ActionList/components/ActionListSwitchItem.js +49 -0
- package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -0
- package/esm/components/ActionList/components/ActionListTrigger.js +2 -23
- package/esm/components/ActionList/components/ActionListTrigger.js.map +1 -1
- package/esm/components/Alert/Alert.js +19 -2
- package/esm/components/Alert/Alert.js.map +1 -1
- package/esm/components/AppFrame/AppFrame.js +37 -0
- package/esm/components/AppFrame/AppFrame.js.map +1 -0
- package/esm/components/Avatar/Avatar.js +31 -8
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/BlockCard/BlockCard.js +98 -4
- package/esm/components/BlockCard/BlockCard.js.map +1 -1
- package/esm/components/Button/Button.js +36 -15
- package/esm/components/Button/Button.js.map +1 -1
- package/esm/components/ButtonIcon/ButtonIcon.js +8 -9
- package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/esm/components/Chart/Chart.js +170 -0
- package/esm/components/Chart/Chart.js.map +1 -0
- package/esm/components/Checkbox/Checkbox.js +64 -37
- package/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.context.js.map +1 -1
- package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.js +45 -11
- package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/esm/components/Checkbox/ChoiceText.js +33 -0
- package/esm/components/Checkbox/ChoiceText.js.map +1 -0
- package/esm/components/ColorField/ColorField.js +69 -18
- package/esm/components/ColorField/ColorField.js.map +1 -1
- package/esm/components/DatePicker/DatePicker.js +86 -48
- package/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/esm/components/DatePicker/components/Calendar/Calendar.js +60 -18
- package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/esm/components/DatePicker/components/Day/Day.js +18 -20
- package/esm/components/DatePicker/components/Day/Day.js.map +1 -1
- package/esm/components/DatePicker/components/Month/Month.js +93 -30
- package/esm/components/DatePicker/components/Month/Month.js.map +1 -1
- package/esm/components/DatePicker/components/MonthGrid/MonthGrid.js +82 -0
- package/esm/components/DatePicker/components/MonthGrid/MonthGrid.js.map +1 -0
- package/esm/components/DatePicker/components/Weekday/Weekday.js +4 -3
- package/esm/components/DatePicker/components/Weekday/Weekday.js.map +1 -1
- package/esm/components/DatePicker/utils/index.js +37 -25
- package/esm/components/DatePicker/utils/index.js.map +1 -1
- package/esm/components/DescriptiveList/DescriptiveList.js +14 -5
- package/esm/components/DescriptiveList/DescriptiveList.js.map +1 -1
- package/esm/components/DescriptiveList/DescriptiveListItem.js +15 -3
- package/esm/components/DescriptiveList/DescriptiveListItem.js.map +1 -1
- package/esm/components/DropdownCard/DropdownCard.context.js.map +1 -1
- package/esm/components/DropdownCard/DropdownCard.js +18 -10
- package/esm/components/DropdownCard/DropdownCard.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardActions.js +5 -3
- package/esm/components/DropdownCard/components/DropdownCardActions.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardContent.js +5 -3
- package/esm/components/DropdownCard/components/DropdownCardContent.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js +19 -14
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardTabs.js +118 -0
- package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -0
- package/esm/components/DropdownCard/components/DropdownCardTrigger.js +2 -21
- package/esm/components/DropdownCard/components/DropdownCardTrigger.js.map +1 -1
- package/esm/components/Field/Field.js +24 -0
- package/esm/components/Field/Field.js.map +1 -0
- package/esm/components/FileField/FileField.js +64 -24
- package/esm/components/FileField/FileField.js.map +1 -1
- package/esm/components/FormActions/FormActions.js +12 -0
- package/esm/components/FormActions/FormActions.js.map +1 -0
- package/esm/components/HyperlinkCard/HyperlinkCard.js +10 -7
- package/esm/components/HyperlinkCard/HyperlinkCard.js.map +1 -1
- package/esm/components/Icon/Icon.js +10 -12
- package/esm/components/Icon/Icon.js.map +1 -1
- package/esm/components/IconBadge/IconBadge.js +25 -0
- package/esm/components/IconBadge/IconBadge.js.map +1 -0
- package/esm/components/Loader/Loader.js +24 -4
- package/esm/components/Loader/Loader.js.map +1 -1
- package/esm/components/Modal/Modal.js +90 -3
- package/esm/components/Modal/Modal.js.map +1 -1
- package/esm/components/Modal/ModalProvider/ModalProviderFooter.js +7 -4
- package/esm/components/Modal/ModalProvider/ModalProviderFooter.js.map +1 -1
- package/esm/components/Modal/ModalProvider/index.js +16 -17
- package/esm/components/Modal/ModalProvider/index.js.map +1 -1
- package/esm/components/Modal/utils/reducer.js +4 -1
- package/esm/components/Modal/utils/reducer.js.map +1 -1
- package/esm/components/Modal/utils/useModal.js +1 -1
- package/esm/components/Modal/utils/useModal.js.map +1 -1
- package/esm/components/Page/Breadcrumbs.js +28 -0
- package/esm/components/Page/Breadcrumbs.js.map +1 -0
- package/esm/components/Page/Page.js +73 -9
- package/esm/components/Page/Page.js.map +1 -1
- package/esm/components/Pagination/Pagination.js +23 -12
- package/esm/components/Pagination/Pagination.js.map +1 -1
- package/esm/components/Progress/Progress.js +35 -3
- package/esm/components/Progress/Progress.js.map +1 -1
- package/esm/components/Radio/Radio.js +35 -25
- package/esm/components/Radio/Radio.js.map +1 -1
- package/esm/components/Radio/RadioGroup/RadioGroup.context.js.map +1 -1
- package/esm/components/Radio/RadioGroup/RadioGroup.js +37 -24
- package/esm/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/esm/components/RangeField/RangeField.js +31 -27
- package/esm/components/RangeField/RangeField.js.map +1 -1
- package/esm/components/Select/Select.js +75 -31
- package/esm/components/Select/Select.js.map +1 -1
- package/esm/components/Sidebar/Sidebar.js +121 -109
- package/esm/components/Sidebar/Sidebar.js.map +1 -1
- package/esm/components/Sidebar/components/Back.js +23 -0
- package/esm/components/Sidebar/components/Back.js.map +1 -0
- package/esm/components/Sidebar/components/Menu.js +5 -7
- package/esm/components/Sidebar/components/Menu.js.map +1 -1
- package/esm/components/Sidebar/components/MenuItem.js +25 -7
- package/esm/components/Sidebar/components/MenuItem.js.map +1 -1
- package/esm/components/Sidebar/components/Section.js +4 -5
- package/esm/components/Sidebar/components/Section.js.map +1 -1
- package/esm/components/Sidebar/components/SubMenu.js +4 -4
- package/esm/components/Sidebar/components/SubMenu.js.map +1 -1
- package/esm/components/Spinner/Spinner.js +9 -4
- package/esm/components/Spinner/Spinner.js.map +1 -1
- package/esm/components/StatCard/StatCard.js +46 -10
- package/esm/components/StatCard/StatCard.js.map +1 -1
- package/esm/components/Switch/Switch.js +42 -20
- package/esm/components/Switch/Switch.js.map +1 -1
- package/esm/components/Table/Table.js +95 -31
- package/esm/components/Table/Table.js.map +1 -1
- package/esm/components/Table/components/Checkbox/index.js +8 -8
- package/esm/components/Table/components/Checkbox/index.js.map +1 -1
- package/esm/components/Table/components/TableBody.js +3 -3
- package/esm/components/Table/components/TableBody.js.map +1 -1
- package/esm/components/Table/components/TableCell.js +3 -4
- package/esm/components/Table/components/TableCell.js.map +1 -1
- package/esm/components/Table/components/TableGroup.js +15 -0
- package/esm/components/Table/components/TableGroup.js.map +1 -0
- package/esm/components/Table/components/TableHead.js +19 -16
- package/esm/components/Table/components/TableHead.js.map +1 -1
- package/esm/components/Table/components/TableHeadCell.js +23 -6
- package/esm/components/Table/components/TableHeadCell.js.map +1 -1
- package/esm/components/Table/components/TablePagination.js +6 -3
- package/esm/components/Table/components/TablePagination.js.map +1 -1
- package/esm/components/Table/components/TableProvider/TableProvider.js +5 -5
- package/esm/components/Table/components/TableProvider/TableProvider.js.map +1 -1
- package/esm/components/Table/components/TableRow.js +11 -8
- package/esm/components/Table/components/TableRow.js.map +1 -1
- package/esm/components/Table/labels.js +18 -0
- package/esm/components/Table/labels.js.map +1 -0
- package/esm/components/Table/utils/rows/context.js.map +1 -1
- package/esm/components/Table/utils/table/context.js.map +1 -1
- package/esm/components/Table/utils/table/hooks.js +4 -4
- package/esm/components/Table/utils/table/hooks.js.map +1 -1
- package/esm/components/Table/utils/table/types.js +1 -7
- package/esm/components/Table/utils/table/types.js.map +1 -1
- package/esm/components/Table/utils/useSelectableResourceState/index.js +4 -5
- package/esm/components/Table/utils/useSelectableResourceState/index.js.map +1 -1
- package/esm/components/Tag/Tag.js +36 -5
- package/esm/components/Tag/Tag.js.map +1 -1
- package/esm/components/Tag/TagGroup.js +3 -2
- package/esm/components/Tag/TagGroup.js.map +1 -1
- package/esm/components/TextField/TextField.js +41 -38
- package/esm/components/TextField/TextField.js.map +1 -1
- package/esm/components/Textarea/Textarea.js +10 -26
- package/esm/components/Textarea/Textarea.js.map +1 -1
- package/esm/components/Thumbnail/Thumbnail.js +22 -8
- package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
- package/esm/components/Timeline/Timeline.js +25 -0
- package/esm/components/Timeline/Timeline.js.map +1 -0
- package/esm/components/Timeline/TimelineGroup.js +27 -0
- package/esm/components/Timeline/TimelineGroup.js.map +1 -0
- package/esm/components/Timeline/TimelineItem.js +23 -0
- package/esm/components/Timeline/TimelineItem.js.map +1 -0
- package/esm/components/Toast/Toast.js +18 -2
- package/esm/components/Toast/Toast.js.map +1 -1
- package/esm/components/Toast/Toasts.context.js +17 -4
- package/esm/components/Toast/Toasts.context.js.map +1 -1
- package/esm/components/Toast/ToastsContainer/index.js +44 -20
- package/esm/components/Toast/ToastsContainer/index.js.map +1 -1
- package/esm/components/Toast/ToastsProvider/index.js +10 -14
- package/esm/components/Toast/ToastsProvider/index.js.map +1 -1
- package/esm/components/Toast/store.js +47 -0
- package/esm/components/Toast/store.js.map +1 -0
- package/esm/components/Tooltip/Tooltip.js +34 -53
- package/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/esm/components/Tooltip/TooltipCallout.js +45 -0
- package/esm/components/Tooltip/TooltipCallout.js.map +1 -0
- package/esm/components/Tooltip/useTooltip.js +12 -33
- package/esm/components/Tooltip/useTooltip.js.map +1 -1
- package/esm/components/Visualizer/Visualizer.js +69 -9
- package/esm/components/Visualizer/Visualizer.js.map +1 -1
- package/esm/index.js +31 -27
- package/esm/index.js.map +1 -1
- package/esm/tokens/tokens.js +1530 -0
- package/esm/tokens/tokens.js.map +1 -0
- package/esm/utils/Slot/index.js +37 -0
- package/esm/utils/Slot/index.js.map +1 -0
- package/esm/utils/classNames/index.js +3 -3
- package/esm/utils/classNames/index.js.map +1 -1
- package/esm/utils/getElementRef/index.js +14 -0
- package/esm/utils/getElementRef/index.js.map +1 -0
- package/esm/utils/guid/index.js.map +1 -1
- package/esm/utils/toPercent/index.js +7 -0
- package/esm/utils/toPercent/index.js.map +1 -0
- package/esm/utils/useControllableState/index.js +24 -0
- package/esm/utils/useControllableState/index.js.map +1 -0
- package/esm/utils/useDropdown/DropdownTrigger.js +18 -0
- package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -0
- package/esm/utils/useDropdown/index.js +55 -25
- package/esm/utils/useDropdown/index.js.map +1 -1
- package/esm/utils/useImageFallback/index.js +11 -0
- package/esm/utils/useImageFallback/index.js.map +1 -0
- package/esm/utils/useUid/index.js.map +1 -1
- package/fonts/dm-sans/LICENSE +93 -0
- package/fonts/dm-sans/dm-sans-latin-400-italic.woff2 +0 -0
- package/fonts/dm-sans/dm-sans-latin-400-normal.woff2 +0 -0
- package/fonts/dm-sans/dm-sans-latin-700-italic.woff2 +0 -0
- package/fonts/dm-sans/dm-sans-latin-700-normal.woff2 +0 -0
- package/fonts/inter/LICENSE +93 -0
- package/fonts/inter/inter-latin-opsz-italic.woff2 +0 -0
- package/fonts/inter/inter-latin-opsz-normal.woff2 +0 -0
- package/fonts/roboto-mono/LICENSE +93 -0
- package/fonts/roboto-mono/roboto-mono-latin-wght-normal.woff2 +0 -0
- package/lib/components/ActionCard/ActionCard.d.ts +14 -13
- package/lib/components/ActionCard/ActionCard.d.ts.map +1 -1
- package/lib/components/ActionCard/ActionCardGroup.d.ts +22 -0
- package/lib/components/ActionCard/ActionCardGroup.d.ts.map +1 -0
- package/lib/components/ActionCard/index.d.ts +1 -0
- package/lib/components/ActionCard/index.d.ts.map +1 -1
- package/lib/components/ActionList/ActionList.context.d.ts +6 -3
- package/lib/components/ActionList/ActionList.context.d.ts.map +1 -1
- package/lib/components/ActionList/ActionList.d.ts +18 -18
- package/lib/components/ActionList/ActionList.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListDivider.d.ts +4 -5
- package/lib/components/ActionList/components/ActionListDivider.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListDropdown.d.ts +4 -1
- package/lib/components/ActionList/components/ActionListDropdown.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListGroup.d.ts +7 -5
- package/lib/components/ActionList/components/ActionListGroup.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListItem.d.ts +32 -7
- package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListSearch.d.ts +21 -0
- package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -0
- package/lib/components/ActionList/components/ActionListSubmenu.d.ts +22 -0
- package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -0
- package/lib/components/ActionList/components/ActionListSwitchItem.d.ts +17 -0
- package/lib/components/ActionList/components/ActionListSwitchItem.d.ts.map +1 -0
- package/lib/components/ActionList/components/ActionListTrigger.d.ts +4 -6
- package/lib/components/ActionList/components/ActionListTrigger.d.ts.map +1 -1
- package/lib/components/Alert/Alert.d.ts +25 -11
- package/lib/components/Alert/Alert.d.ts.map +1 -1
- package/lib/components/AppFrame/AppFrame.d.ts +48 -0
- package/lib/components/AppFrame/AppFrame.d.ts.map +1 -0
- package/lib/components/AppFrame/index.d.ts +3 -0
- package/lib/components/AppFrame/index.d.ts.map +1 -0
- package/lib/components/Avatar/Avatar.d.ts +20 -8
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/BlockCard/BlockCard.d.ts +77 -11
- package/lib/components/BlockCard/BlockCard.d.ts.map +1 -1
- package/lib/components/BlockCard/index.d.ts +1 -1
- package/lib/components/BlockCard/index.d.ts.map +1 -1
- package/lib/components/Button/Button.d.ts +45 -26
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/ButtonIcon/ButtonIcon.d.ts +18 -17
- package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/lib/components/Chart/Chart.d.ts +142 -0
- package/lib/components/Chart/Chart.d.ts.map +1 -0
- package/lib/components/Chart/index.d.ts +3 -0
- package/lib/components/Chart/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +25 -33
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.context.d.ts +2 -0
- package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.context.d.ts.map +1 -1
- package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.d.ts +23 -5
- package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/lib/components/Checkbox/ChoiceText.d.ts +17 -0
- package/lib/components/Checkbox/ChoiceText.d.ts.map +1 -0
- package/lib/components/Checkbox/index.d.ts +0 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/ColorField/ColorField.d.ts +15 -13
- package/lib/components/ColorField/ColorField.d.ts.map +1 -1
- package/lib/components/ColorField/index.d.ts +1 -1
- package/lib/components/ColorField/index.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts +13 -5
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/components/Calendar/Calendar.d.ts +24 -3
- package/lib/components/DatePicker/components/Calendar/Calendar.d.ts.map +1 -1
- package/lib/components/DatePicker/components/Day/Day.d.ts +11 -10
- package/lib/components/DatePicker/components/Day/Day.d.ts.map +1 -1
- package/lib/components/DatePicker/components/Month/Month.d.ts +21 -17
- package/lib/components/DatePicker/components/Month/Month.d.ts.map +1 -1
- package/lib/components/DatePicker/components/MonthGrid/MonthGrid.d.ts +32 -0
- package/lib/components/DatePicker/components/MonthGrid/MonthGrid.d.ts.map +1 -0
- package/lib/components/DatePicker/components/MonthGrid/index.d.ts +3 -0
- package/lib/components/DatePicker/components/MonthGrid/index.d.ts.map +1 -0
- package/lib/components/DatePicker/components/Weekday/Weekday.d.ts +4 -3
- package/lib/components/DatePicker/components/Weekday/Weekday.d.ts.map +1 -1
- package/lib/components/DatePicker/components/index.d.ts +1 -0
- package/lib/components/DatePicker/components/index.d.ts.map +1 -1
- package/lib/components/DatePicker/utils/index.d.ts +339 -17
- package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
- package/lib/components/DatePicker/utils/types.d.ts +4 -2
- package/lib/components/DatePicker/utils/types.d.ts.map +1 -1
- package/lib/components/DescriptiveList/DescriptiveList.d.ts +10 -11
- package/lib/components/DescriptiveList/DescriptiveList.d.ts.map +1 -1
- package/lib/components/DescriptiveList/DescriptiveListItem.d.ts +10 -4
- package/lib/components/DescriptiveList/DescriptiveListItem.d.ts.map +1 -1
- package/lib/components/DropdownCard/DropdownCard.context.d.ts +5 -2
- package/lib/components/DropdownCard/DropdownCard.context.d.ts.map +1 -1
- package/lib/components/DropdownCard/DropdownCard.d.ts +15 -13
- package/lib/components/DropdownCard/DropdownCard.d.ts.map +1 -1
- package/lib/components/DropdownCard/components/DropdownCardActions.d.ts +4 -3
- package/lib/components/DropdownCard/components/DropdownCardActions.d.ts.map +1 -1
- package/lib/components/DropdownCard/components/DropdownCardContent.d.ts +4 -3
- package/lib/components/DropdownCard/components/DropdownCardContent.d.ts.map +1 -1
- package/lib/components/DropdownCard/components/DropdownCardDropdown.d.ts +12 -3
- package/lib/components/DropdownCard/components/DropdownCardDropdown.d.ts.map +1 -1
- package/lib/components/DropdownCard/components/DropdownCardTabs.d.ts +44 -0
- package/lib/components/DropdownCard/components/DropdownCardTabs.d.ts.map +1 -0
- package/lib/components/DropdownCard/components/DropdownCardTrigger.d.ts +4 -6
- package/lib/components/DropdownCard/components/DropdownCardTrigger.d.ts.map +1 -1
- package/lib/components/DropdownCard/components/index.d.ts +1 -0
- package/lib/components/DropdownCard/components/index.d.ts.map +1 -1
- package/lib/components/Field/Field.d.ts +47 -0
- package/lib/components/Field/Field.d.ts.map +1 -0
- package/lib/components/Field/index.d.ts +3 -0
- package/lib/components/Field/index.d.ts.map +1 -0
- package/lib/components/FileField/FileField.d.ts +20 -11
- package/lib/components/FileField/FileField.d.ts.map +1 -1
- package/lib/components/FileField/index.d.ts +1 -1
- package/lib/components/FileField/index.d.ts.map +1 -1
- package/lib/components/FormActions/FormActions.d.ts +9 -0
- package/lib/components/FormActions/FormActions.d.ts.map +1 -0
- package/lib/components/FormActions/index.d.ts +3 -0
- package/lib/components/FormActions/index.d.ts.map +1 -0
- package/lib/components/HyperlinkCard/HyperlinkCard.d.ts +11 -8
- package/lib/components/HyperlinkCard/HyperlinkCard.d.ts.map +1 -1
- package/lib/components/Icon/Icon.d.ts +14 -13
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/IconBadge/IconBadge.d.ts +24 -0
- package/lib/components/IconBadge/IconBadge.d.ts.map +1 -0
- package/lib/components/IconBadge/index.d.ts +3 -0
- package/lib/components/IconBadge/index.d.ts.map +1 -0
- package/lib/components/Loader/Loader.d.ts +17 -6
- package/lib/components/Loader/Loader.d.ts.map +1 -1
- package/lib/components/Loader/index.d.ts +1 -1
- package/lib/components/Loader/index.d.ts.map +1 -1
- package/lib/components/Modal/Modal.d.ts +4 -6
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/ModalProvider/ModalProviderFooter.d.ts.map +1 -1
- package/lib/components/Modal/ModalProvider/index.d.ts.map +1 -1
- package/lib/components/Modal/index.d.ts +1 -1
- package/lib/components/Modal/index.d.ts.map +1 -1
- package/lib/components/Modal/types/index.d.ts +36 -15
- package/lib/components/Modal/types/index.d.ts.map +1 -1
- package/lib/components/Modal/utils/index.d.ts +0 -1
- package/lib/components/Modal/utils/index.d.ts.map +1 -1
- package/lib/components/Modal/utils/reducer.d.ts +286 -6
- package/lib/components/Modal/utils/reducer.d.ts.map +1 -1
- package/lib/components/Modal/utils/useModal.d.ts +3 -2
- package/lib/components/Modal/utils/useModal.d.ts.map +1 -1
- package/lib/components/Page/Breadcrumbs.d.ts +20 -0
- package/lib/components/Page/Breadcrumbs.d.ts.map +1 -0
- package/lib/components/Page/Page.d.ts +61 -27
- package/lib/components/Page/Page.d.ts.map +1 -1
- package/lib/components/Page/index.d.ts +3 -1
- package/lib/components/Page/index.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.d.ts +22 -20
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/Pagination/index.d.ts.map +1 -1
- package/lib/components/Progress/Progress.d.ts +29 -6
- package/lib/components/Progress/Progress.d.ts.map +1 -1
- package/lib/components/Progress/index.d.ts +1 -1
- package/lib/components/Progress/index.d.ts.map +1 -1
- package/lib/components/Radio/Radio.d.ts +19 -33
- package/lib/components/Radio/Radio.d.ts.map +1 -1
- package/lib/components/Radio/RadioGroup/RadioGroup.context.d.ts +2 -0
- package/lib/components/Radio/RadioGroup/RadioGroup.context.d.ts.map +1 -1
- package/lib/components/Radio/RadioGroup/RadioGroup.d.ts +22 -18
- package/lib/components/Radio/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RangeField/RangeField.d.ts +8 -15
- package/lib/components/RangeField/RangeField.d.ts.map +1 -1
- package/lib/components/Select/Select.d.ts +45 -43
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Sidebar/Sidebar.d.ts +48 -25
- package/lib/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/components/Sidebar/components/Back.d.ts +14 -0
- package/lib/components/Sidebar/components/Back.d.ts.map +1 -0
- package/lib/components/Sidebar/components/Menu.d.ts +9 -14
- package/lib/components/Sidebar/components/Menu.d.ts.map +1 -1
- package/lib/components/Sidebar/components/MenuItem.d.ts +18 -15
- package/lib/components/Sidebar/components/MenuItem.d.ts.map +1 -1
- package/lib/components/Sidebar/components/Section.d.ts +6 -6
- package/lib/components/Sidebar/components/Section.d.ts.map +1 -1
- package/lib/components/Sidebar/components/SubMenu.d.ts +6 -8
- package/lib/components/Sidebar/components/SubMenu.d.ts.map +1 -1
- package/lib/components/Sidebar/index.d.ts +1 -1
- package/lib/components/Sidebar/index.d.ts.map +1 -1
- package/lib/components/Spinner/Spinner.d.ts +12 -5
- package/lib/components/Spinner/Spinner.d.ts.map +1 -1
- package/lib/components/Spinner/index.d.ts +1 -1
- package/lib/components/Spinner/index.d.ts.map +1 -1
- package/lib/components/StatCard/StatCard.d.ts +31 -11
- package/lib/components/StatCard/StatCard.d.ts.map +1 -1
- package/lib/components/StatCard/index.d.ts +1 -1
- package/lib/components/StatCard/index.d.ts.map +1 -1
- package/lib/components/Switch/Switch.d.ts +14 -15
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Table/Table.d.ts +54 -25
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.types.d.ts +1 -1
- package/lib/components/Table/Table.types.d.ts.map +1 -1
- package/lib/components/Table/components/Checkbox/index.d.ts +7 -3
- package/lib/components/Table/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Table/components/TableBody.d.ts +2 -2
- package/lib/components/Table/components/TableBody.d.ts.map +1 -1
- package/lib/components/Table/components/TableCell.d.ts +7 -3
- package/lib/components/Table/components/TableCell.d.ts.map +1 -1
- package/lib/components/Table/components/TableGroup.d.ts +16 -0
- package/lib/components/Table/components/TableGroup.d.ts.map +1 -0
- package/lib/components/Table/components/TableHead.d.ts +8 -2
- package/lib/components/Table/components/TableHead.d.ts.map +1 -1
- package/lib/components/Table/components/TableHeadCell.d.ts +24 -5
- package/lib/components/Table/components/TableHeadCell.d.ts.map +1 -1
- package/lib/components/Table/components/TablePagination.d.ts +3 -1
- package/lib/components/Table/components/TablePagination.d.ts.map +1 -1
- package/lib/components/Table/components/TableProvider/TableProvider.d.ts +1 -2
- package/lib/components/Table/components/TableProvider/TableProvider.d.ts.map +1 -1
- package/lib/components/Table/components/TableRow.d.ts +8 -2
- package/lib/components/Table/components/TableRow.d.ts.map +1 -1
- package/lib/components/Table/index.d.ts +3 -3
- package/lib/components/Table/index.d.ts.map +1 -1
- package/lib/components/Table/labels.d.ts +23 -0
- package/lib/components/Table/labels.d.ts.map +1 -0
- package/lib/components/Table/utils/table/types.d.ts +6 -11
- package/lib/components/Table/utils/table/types.d.ts.map +1 -1
- package/lib/components/Table/utils/useSelectableResourceState/index.d.ts +1 -2
- package/lib/components/Table/utils/useSelectableResourceState/index.d.ts.map +1 -1
- package/lib/components/Tag/Tag.d.ts +42 -15
- package/lib/components/Tag/Tag.d.ts.map +1 -1
- package/lib/components/Tag/TagGroup.d.ts +3 -3
- package/lib/components/Tag/TagGroup.d.ts.map +1 -1
- package/lib/components/Tag/index.d.ts +1 -1
- package/lib/components/Tag/index.d.ts.map +1 -1
- package/lib/components/TextField/TextField.d.ts +11 -27
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/Textarea/Textarea.d.ts +10 -26
- package/lib/components/Textarea/Textarea.d.ts.map +1 -1
- package/lib/components/Thumbnail/Thumbnail.d.ts +11 -7
- package/lib/components/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts +26 -0
- package/lib/components/Timeline/Timeline.d.ts.map +1 -0
- package/lib/components/Timeline/TimelineGroup.d.ts +15 -0
- package/lib/components/Timeline/TimelineGroup.d.ts.map +1 -0
- package/lib/components/Timeline/TimelineItem.d.ts +19 -0
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -0
- package/lib/components/Timeline/index.d.ts +5 -0
- package/lib/components/Timeline/index.d.ts.map +1 -0
- package/lib/components/Toast/Toast.d.ts +20 -10
- package/lib/components/Toast/Toast.d.ts.map +1 -1
- package/lib/components/Toast/Toasts.context.d.ts +15 -2
- package/lib/components/Toast/Toasts.context.d.ts.map +1 -1
- package/lib/components/Toast/ToastsContainer/index.d.ts.map +1 -1
- package/lib/components/Toast/ToastsProvider/index.d.ts +1 -3
- package/lib/components/Toast/ToastsProvider/index.d.ts.map +1 -1
- package/lib/components/Toast/index.d.ts +3 -5
- package/lib/components/Toast/index.d.ts.map +1 -1
- package/lib/components/Toast/store.d.ts +30 -0
- package/lib/components/Toast/store.d.ts.map +1 -0
- package/lib/components/Toast/types.d.ts +8 -5
- package/lib/components/Toast/types.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +29 -23
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/TooltipCallout.d.ts +31 -0
- package/lib/components/Tooltip/TooltipCallout.d.ts.map +1 -0
- package/lib/components/Tooltip/useTooltip.d.ts +16 -27
- package/lib/components/Tooltip/useTooltip.d.ts.map +1 -1
- package/lib/components/Visualizer/Visualizer.d.ts +19 -8
- package/lib/components/Visualizer/Visualizer.d.ts.map +1 -1
- package/lib/components/Visualizer/index.d.ts +1 -1
- package/lib/components/Visualizer/index.d.ts.map +1 -1
- package/lib/index.d.ts +134 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/showcase/chartData.d.ts +29 -0
- package/lib/showcase/chartData.d.ts.map +1 -0
- package/lib/tokens/tokens.d.ts +1528 -0
- package/lib/tokens/tokens.d.ts.map +1 -0
- package/lib/types.d.ts +4 -29
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/Slot/index.d.ts +11 -0
- package/lib/utils/Slot/index.d.ts.map +1 -0
- package/lib/utils/classNames/index.d.ts +3 -1
- package/lib/utils/classNames/index.d.ts.map +1 -1
- package/lib/utils/getElementRef/index.d.ts +9 -0
- package/lib/utils/getElementRef/index.d.ts.map +1 -0
- package/lib/utils/index.d.ts +4 -7
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/toPercent/index.d.ts +3 -0
- package/lib/utils/toPercent/index.d.ts.map +1 -0
- package/lib/utils/useControllableState/index.d.ts +19 -0
- package/lib/utils/useControllableState/index.d.ts.map +1 -0
- package/lib/utils/useDropdown/DropdownTrigger.d.ts +12 -0
- package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -0
- package/lib/utils/useDropdown/index.d.ts +30 -6
- package/lib/utils/useDropdown/index.d.ts.map +1 -1
- package/lib/utils/useImageFallback/index.d.ts +15 -0
- package/lib/utils/useImageFallback/index.d.ts.map +1 -0
- package/package.json +19 -11
- package/theme.css +1 -1
- package/theme.css.d.ts +2 -0
- package/cjs/components/ActionList/useDropdown.js +0 -47
- package/cjs/components/ActionList/useDropdown.js.map +0 -1
- package/cjs/components/Modal/utils/events.js +0 -19
- package/cjs/components/Modal/utils/events.js.map +0 -1
- package/cjs/components/Toast/ToastsProvider/useToastsState/useToastsState.js +0 -55
- package/cjs/components/Toast/ToastsProvider/useToastsState/useToastsState.js.map +0 -1
- package/cjs/components/Toast/events.js +0 -20
- package/cjs/components/Toast/events.js.map +0 -1
- package/cjs/components/Visualizer/Visualizer.context.js +0 -12
- package/cjs/components/Visualizer/Visualizer.context.js.map +0 -1
- package/cjs/components/Visualizer/VisualizerMobileOpener.js +0 -28
- package/cjs/components/Visualizer/VisualizerMobileOpener.js.map +0 -1
- package/cjs/utils/createUseExternalEvents/index.js +0 -32
- package/cjs/utils/createUseExternalEvents/index.js.map +0 -1
- package/cjs/utils/useIsomorphicEffect/index.js +0 -22
- package/cjs/utils/useIsomorphicEffect/index.js.map +0 -1
- package/cjs/utils/useQueue/index.js +0 -36
- package/cjs/utils/useQueue/index.js.map +0 -1
- package/cjs/utils/useUncontrolled/index.js +0 -25
- package/cjs/utils/useUncontrolled/index.js.map +0 -1
- package/esm/components/ActionList/useDropdown.js +0 -45
- package/esm/components/ActionList/useDropdown.js.map +0 -1
- package/esm/components/Modal/utils/events.js +0 -13
- package/esm/components/Modal/utils/events.js.map +0 -1
- package/esm/components/Toast/ToastsProvider/useToastsState/useToastsState.js +0 -51
- package/esm/components/Toast/ToastsProvider/useToastsState/useToastsState.js.map +0 -1
- package/esm/components/Toast/events.js +0 -12
- package/esm/components/Toast/events.js.map +0 -1
- package/esm/components/Visualizer/Visualizer.context.js +0 -9
- package/esm/components/Visualizer/Visualizer.context.js.map +0 -1
- package/esm/components/Visualizer/VisualizerMobileOpener.js +0 -13
- package/esm/components/Visualizer/VisualizerMobileOpener.js.map +0 -1
- package/esm/utils/createUseExternalEvents/index.js +0 -30
- package/esm/utils/createUseExternalEvents/index.js.map +0 -1
- package/esm/utils/useIsomorphicEffect/index.js +0 -7
- package/esm/utils/useIsomorphicEffect/index.js.map +0 -1
- package/esm/utils/useQueue/index.js +0 -34
- package/esm/utils/useQueue/index.js.map +0 -1
- package/esm/utils/useUncontrolled/index.js +0 -23
- package/esm/utils/useUncontrolled/index.js.map +0 -1
- package/lib/components/ActionList/useDropdown.d.ts +0 -57
- package/lib/components/ActionList/useDropdown.d.ts.map +0 -1
- package/lib/components/CodeBlock/CodeBlock.d.ts +0 -16
- package/lib/components/CodeBlock/CodeBlock.d.ts.map +0 -1
- package/lib/components/CodeBlock/index.d.ts +0 -2
- package/lib/components/CodeBlock/index.d.ts.map +0 -1
- package/lib/components/Modal/utils/events.d.ts +0 -9
- package/lib/components/Modal/utils/events.d.ts.map +0 -1
- package/lib/components/Toast/ToastsProvider/useToastsState/useToastsState.d.ts +0 -13
- package/lib/components/Toast/ToastsProvider/useToastsState/useToastsState.d.ts.map +0 -1
- package/lib/components/Toast/events.d.ts +0 -37
- package/lib/components/Toast/events.d.ts.map +0 -1
- package/lib/components/Visualizer/Visualizer.context.d.ts +0 -14
- package/lib/components/Visualizer/Visualizer.context.d.ts.map +0 -1
- package/lib/components/Visualizer/VisualizerMobileOpener.d.ts +0 -7
- package/lib/components/Visualizer/VisualizerMobileOpener.d.ts.map +0 -1
- package/lib/components/index.d.ts +0 -36
- package/lib/components/index.d.ts.map +0 -1
- package/lib/utils/createUseExternalEvents/index.d.ts +0 -14
- package/lib/utils/createUseExternalEvents/index.d.ts.map +0 -1
- package/lib/utils/useDidUpdate/index.d.ts +0 -30
- package/lib/utils/useDidUpdate/index.d.ts.map +0 -1
- package/lib/utils/useEventListener/index.d.ts +0 -7
- package/lib/utils/useEventListener/index.d.ts.map +0 -1
- package/lib/utils/useForceUpdate/index.d.ts +0 -28
- package/lib/utils/useForceUpdate/index.d.ts.map +0 -1
- package/lib/utils/useIsomorphicEffect/index.d.ts +0 -21
- package/lib/utils/useIsomorphicEffect/index.d.ts.map +0 -1
- package/lib/utils/useQueue/index.d.ts +0 -65
- package/lib/utils/useQueue/index.d.ts.map +0 -1
- package/lib/utils/useUncontrolled/index.d.ts +0 -38
- package/lib/utils/useUncontrolled/index.d.ts.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var index = require('./utils/index.js');
|
|
6
|
-
require('./components/Day/Day.js');
|
|
7
|
-
require('./components/Weekday/Weekday.js');
|
|
8
7
|
var Calendar = require('./components/Calendar/Calendar.js');
|
|
8
|
+
var MonthGrid = require('./components/MonthGrid/MonthGrid.js');
|
|
9
9
|
var TextField = require('../TextField/TextField.js');
|
|
10
|
-
var
|
|
10
|
+
var react = require('@floating-ui/react');
|
|
11
|
+
var index$1 = require('../../utils/useControllableState/index.js');
|
|
11
12
|
|
|
12
13
|
function _interopNamespaceDefault(e) {
|
|
13
14
|
var n = Object.create(null);
|
|
@@ -22,12 +23,13 @@ function _interopNamespaceDefault(e) {
|
|
|
22
23
|
|
|
23
24
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
24
25
|
|
|
25
|
-
function
|
|
26
|
+
const DatePickerBase = React__namespace.forwardRef(function DatePicker2(props, ref) {
|
|
26
27
|
const { calendarProps, others } = index.pickCalendarProps(props);
|
|
28
|
+
const { labels, ...inputProps } = others;
|
|
27
29
|
const {
|
|
28
30
|
month,
|
|
29
31
|
year,
|
|
30
|
-
|
|
32
|
+
onValueChange,
|
|
31
33
|
onInputError,
|
|
32
34
|
value: passedValue,
|
|
33
35
|
disableSpecificDates,
|
|
@@ -36,16 +38,17 @@ function DatePicker(props) {
|
|
|
36
38
|
minDate,
|
|
37
39
|
maxDate,
|
|
38
40
|
defaultValue,
|
|
39
|
-
onMonthChange
|
|
41
|
+
onMonthChange,
|
|
42
|
+
locale,
|
|
43
|
+
weekStartsOn
|
|
40
44
|
} = calendarProps;
|
|
41
|
-
const textFieldRef = React__namespace.useRef(null);
|
|
42
45
|
const calendarRef = React__namespace.useRef(null);
|
|
43
46
|
const [isTextFieldFocused, setIsTextFieldFocused] = React__namespace.useState(false);
|
|
44
47
|
const [inputError, setInputError] = React__namespace.useState(false);
|
|
45
48
|
const [currentKey, setCurrentKey] = React__namespace.useState("");
|
|
46
49
|
const [{ currentDisplayedMonth, currentDisplayedYear }, setCalendarDate] = React__namespace.useState({
|
|
47
|
-
currentDisplayedMonth: month,
|
|
48
|
-
currentDisplayedYear: year
|
|
50
|
+
currentDisplayedMonth: defaultValue ? defaultValue.getMonth() : month,
|
|
51
|
+
currentDisplayedYear: defaultValue ? defaultValue.getFullYear() : year
|
|
49
52
|
});
|
|
50
53
|
const separatorIndex = index.getSeparatorIndex(dateFormat);
|
|
51
54
|
const handleMonthChange = React__namespace.useCallback(
|
|
@@ -55,17 +58,29 @@ function DatePicker(props) {
|
|
|
55
58
|
},
|
|
56
59
|
[onMonthChange]
|
|
57
60
|
);
|
|
58
|
-
const [date, setDate] = index$1.
|
|
61
|
+
const [date, setDate] = index$1.useControllableState({
|
|
59
62
|
value: passedValue,
|
|
60
|
-
defaultValue,
|
|
61
|
-
|
|
62
|
-
onChange
|
|
63
|
+
defaultValue: defaultValue ?? null,
|
|
64
|
+
onChange: onValueChange
|
|
63
65
|
});
|
|
64
66
|
const [inputValue, setInputValue] = React__namespace.useState(
|
|
65
67
|
date instanceof Date ? index.formatDate(date, separator, dateFormat) : ""
|
|
66
68
|
);
|
|
67
|
-
const
|
|
69
|
+
const inputRef = React__namespace.useRef(null);
|
|
70
|
+
const mergedRef = react.useMergeRefs([inputRef, ref]);
|
|
71
|
+
const returningFocus = React__namespace.useRef(false);
|
|
72
|
+
const onFocus = () => {
|
|
73
|
+
if (returningFocus.current) returningFocus.current = false;
|
|
74
|
+
else setIsTextFieldFocused(true);
|
|
75
|
+
};
|
|
68
76
|
const onBlur = () => setIsTextFieldFocused(false);
|
|
77
|
+
const closeToInput = React__namespace.useCallback(() => {
|
|
78
|
+
setIsTextFieldFocused(false);
|
|
79
|
+
if (inputRef.current && document.activeElement !== inputRef.current) {
|
|
80
|
+
returningFocus.current = true;
|
|
81
|
+
inputRef.current.focus();
|
|
82
|
+
}
|
|
83
|
+
}, []);
|
|
69
84
|
const handleDateSelection = React__namespace.useCallback(
|
|
70
85
|
(selectedDate) => {
|
|
71
86
|
setInputValue(index.formatDate(selectedDate, separator, dateFormat));
|
|
@@ -75,9 +90,9 @@ function DatePicker(props) {
|
|
|
75
90
|
currentDisplayedYear: selectedDate.getFullYear()
|
|
76
91
|
});
|
|
77
92
|
setInputError("");
|
|
78
|
-
window.setTimeout(
|
|
93
|
+
window.setTimeout(closeToInput, 10);
|
|
79
94
|
},
|
|
80
|
-
[setDate, separator, dateFormat]
|
|
95
|
+
[setDate, separator, dateFormat, closeToInput]
|
|
81
96
|
);
|
|
82
97
|
const controlledTime = passedValue === void 0 ? void 0 : passedValue?.getTime() ?? null;
|
|
83
98
|
React__namespace.useEffect(() => {
|
|
@@ -104,41 +119,64 @@ function DatePicker(props) {
|
|
|
104
119
|
}
|
|
105
120
|
return setInputError(onInputError?.("OUT_OF_RANGE") ?? true);
|
|
106
121
|
}
|
|
107
|
-
|
|
108
|
-
return setInputError(onInputError?.("INVALID_DATE") ?? true);
|
|
109
|
-
}
|
|
122
|
+
setInputError("");
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
...others,
|
|
118
|
-
value: inputValue,
|
|
119
|
-
ref: textFieldRef,
|
|
120
|
-
onFocus,
|
|
121
|
-
maxLength: 10,
|
|
122
|
-
onChange: (value) => handleInputChange(value),
|
|
123
|
-
onKeyDown: (event) => setCurrentKey(event.key),
|
|
124
|
-
error: inputError
|
|
125
|
-
}
|
|
126
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
127
|
-
Calendar.Calendar,
|
|
124
|
+
const handleInputBlur = (event) => {
|
|
125
|
+
others.onBlur?.(event);
|
|
126
|
+
if (inputValue.length > 0 && inputValue.length < 10) setInputError(onInputError?.("INVALID_DATE") ?? true);
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
129
|
+
"div",
|
|
128
130
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
className: "roaster-date-picker",
|
|
132
|
+
ref: calendarRef,
|
|
133
|
+
onBlur: (event) => {
|
|
134
|
+
if (!event.currentTarget.contains(event.relatedTarget)) onBlur();
|
|
135
|
+
},
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
TextField.TextField,
|
|
139
|
+
{
|
|
140
|
+
...inputProps,
|
|
141
|
+
value: inputValue,
|
|
142
|
+
ref: mergedRef,
|
|
143
|
+
onFocus,
|
|
144
|
+
onBlur: handleInputBlur,
|
|
145
|
+
maxLength: 10,
|
|
146
|
+
role: "combobox",
|
|
147
|
+
"aria-haspopup": "dialog",
|
|
148
|
+
"aria-expanded": isTextFieldFocused,
|
|
149
|
+
onValueChange: (value) => handleInputChange(value),
|
|
150
|
+
onKeyDown: (event) => {
|
|
151
|
+
setCurrentKey(event.key);
|
|
152
|
+
if (event.key === "Escape") onBlur();
|
|
153
|
+
},
|
|
154
|
+
error: inputError || others.error
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
Calendar.Calendar,
|
|
159
|
+
{
|
|
160
|
+
selected: date ?? void 0,
|
|
161
|
+
onClose: closeToInput,
|
|
162
|
+
minDate,
|
|
163
|
+
maxDate,
|
|
164
|
+
isOpen: isTextFieldFocused,
|
|
165
|
+
year: currentDisplayedYear,
|
|
166
|
+
month: currentDisplayedMonth,
|
|
167
|
+
onMonthChange: handleMonthChange,
|
|
168
|
+
handleDateSelection,
|
|
169
|
+
disableSpecificDates,
|
|
170
|
+
locale,
|
|
171
|
+
weekStartsOn,
|
|
172
|
+
labels
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
]
|
|
139
176
|
}
|
|
140
|
-
)
|
|
141
|
-
}
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
const DatePicker = Object.assign(DatePickerBase, { MonthGrid: MonthGrid.MonthGrid });
|
|
142
180
|
|
|
143
181
|
exports.DatePicker = DatePicker;
|
|
144
182
|
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { dateStringParser, formatDate, getSeparatorIndex, isDateValid, pickCalendarProps } from './utils';\n\nimport { Calendar, CalendarProps } from './components';\nimport { TextField, TextFieldProps } from '../TextField';\nimport { useUncontrolled } from '@/utils';\nimport { DateSeparator, DateFormat, DatePickerInputError } from './utils/types';\n\nexport interface DatePickerProps\n extends\n Omit<CalendarProps, 'handleDateSelection' | 'year' | 'month' | 'selected' | 'isOpen' | 'onClose'>,\n Omit<TextFieldProps, 'onChange' | 'defaultValue' | 'value' | 'onAbort' | 'ref'> {\n /** The separator used for the date input fields. Defaults to '-' */\n separator?: DateSeparator;\n /** The format used as input mask. Defaults to 'YYYY MM DD' */\n dateFormat?: DateFormat;\n /** Callback function that will be called when an error occurs when parsing the date */\n onInputError?(type: DatePickerInputError): string;\n /** Callback function that will be called when the date is changed */\n onChange?(date: Date): void;\n /** Default value for uncontrolled input */\n defaultValue?: Date | null;\n /** Selected date, required with controlled input */\n value?: Date | null;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month?: number;\n /** The year to show */\n year?: number;\n}\n\n/** A text field with a calendar, to type or pick a date, with optional minimum and maximum dates. */\nexport function DatePicker(props: DatePickerProps) {\n const { calendarProps, others } = pickCalendarProps<DatePickerProps>(props);\n\n const {\n month,\n year,\n onChange,\n onInputError,\n value: passedValue,\n disableSpecificDates,\n dateFormat,\n separator,\n minDate,\n maxDate,\n defaultValue,\n onMonthChange,\n } = calendarProps;\n\n const textFieldRef = React.useRef<HTMLInputElement>(null);\n const calendarRef = React.useRef<HTMLDivElement>(null);\n const [isTextFieldFocused, setIsTextFieldFocused] = React.useState(false);\n const [inputError, setInputError] = React.useState<string | boolean>(false);\n const [currentKey, setCurrentKey] = React.useState('');\n const [{ currentDisplayedMonth, currentDisplayedYear }, setCalendarDate] = React.useState({\n currentDisplayedMonth: month,\n currentDisplayedYear: year,\n });\n\n const separatorIndex = getSeparatorIndex(dateFormat);\n\n const handleMonthChange = React.useCallback(\n (targetMonth: number, targetYear: number) => {\n setCalendarDate({ currentDisplayedMonth: targetMonth, currentDisplayedYear: targetYear });\n onMonthChange?.(targetMonth, targetYear);\n },\n [onMonthChange]\n );\n\n const [date, setDate] = useUncontrolled<Date | null>({\n value: passedValue,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const [inputValue, setInputValue] = React.useState(\n date instanceof Date ? formatDate(date, separator, dateFormat) : ''\n );\n\n const onFocus = () => setIsTextFieldFocused(true);\n const onBlur = () => setIsTextFieldFocused(false);\n\n const handleDateSelection = React.useCallback(\n (selectedDate: Date) => {\n setInputValue(formatDate(selectedDate, separator, dateFormat));\n setDate(selectedDate);\n setCalendarDate({\n currentDisplayedMonth: selectedDate.getMonth(),\n currentDisplayedYear: selectedDate.getFullYear(),\n });\n setInputError('');\n window.setTimeout(onBlur, 10);\n },\n [setDate, separator, dateFormat]\n );\n\n // A controlled date picker shows the new value whenever the parent changes it. Compared by time, since the parent\n // may pass a new Date object for the same day on every render.\n const controlledTime = passedValue === undefined ? undefined : (passedValue?.getTime() ?? null);\n React.useEffect(() => {\n if (controlledTime === undefined) return;\n setInputValue(controlledTime === null ? '' : formatDate(new Date(controlledTime), separator, dateFormat));\n }, [controlledTime, separator, dateFormat]);\n\n function handleInputChange(value: string) {\n const valueLength = value.length;\n\n if (currentKey !== 'Backspace' && (valueLength === separatorIndex.first || valueLength === separatorIndex.second)) {\n return setInputValue(value + separator);\n }\n\n if (valueLength === 0) {\n setDate(null);\n }\n\n setInputValue(value);\n\n if (valueLength === 10) {\n const dateValue = dateStringParser(value, dateFormat, separator);\n if (!dateValue) {\n return setInputError(onInputError?.('INVALID_DATE') ?? true);\n }\n setInputError('');\n\n if (isDateValid({ date: dateValue, minDate, maxDate })) {\n return handleDateSelection(dateValue);\n }\n return setInputError(onInputError?.('OUT_OF_RANGE') ?? true);\n }\n if (valueLength < 10 && valueLength > 0) {\n return setInputError(onInputError?.('INVALID_DATE') ?? true);\n }\n }\n\n React.useEffect(() => {\n if (defaultValue) handleDateSelection(defaultValue);\n }, []);\n\n return (\n <div className=\"date-picker\" ref={calendarRef}>\n <TextField\n {...others}\n value={inputValue}\n ref={textFieldRef}\n onFocus={onFocus}\n maxLength={10}\n onChange={(value) => handleInputChange(value)}\n onKeyDown={(event) => setCurrentKey(event.key)}\n error={inputError as string}\n />\n <Calendar\n selected={date ?? undefined}\n onClose={onBlur}\n minDate={minDate}\n maxDate={maxDate}\n isOpen={isTextFieldFocused}\n year={currentDisplayedYear}\n month={currentDisplayedMonth}\n onMonthChange={handleMonthChange}\n handleDateSelection={handleDateSelection}\n disableSpecificDates={disableSpecificDates}\n />\n </div>\n );\n}\n"],"names":["pickCalendarProps","React","getSeparatorIndex","useUncontrolled","formatDate","dateString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/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { dateStringParser, formatDate, getSeparatorIndex, isDateValid, pickCalendarProps } from './utils';\n\nimport { Calendar, CalendarProps } from './components';\nimport type { CalendarLabels } from './components/Calendar/Calendar';\nimport { TextField, TextFieldProps } from '../TextField';\nimport { useMergeRefs } from '@floating-ui/react';\nimport { useControllableState } from '@/utils';\nimport { MonthGrid } from './components/MonthGrid';\nimport { DateSeparator, DateFormat, DatePickerInputError } from './utils/types';\n\nexport interface DatePickerProps\n extends\n Omit<CalendarProps, 'handleDateSelection' | 'year' | 'month' | 'selected' | 'isOpen' | 'onClose'>,\n Omit<TextFieldProps, 'onChange' | 'onValueChange' | 'defaultValue' | 'value' | 'onAbort' | 'ref'> {\n /** The separator used for the date input fields. Defaults to '-' */\n separator?: DateSeparator;\n /** The format used as input mask. Defaults to 'YYYY MM DD' */\n dateFormat?: DateFormat;\n /** Callback function that will be called when an error occurs when parsing the date */\n onInputError?(type: DatePickerInputError): string;\n /** Called with the new date, or `null` when the field is cleared. */\n onValueChange?(date: Date | null): void;\n /** Default value for uncontrolled input */\n defaultValue?: Date | null;\n /** Selected date, required with controlled input */\n value?: Date | null;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month?: number;\n /** The year to show */\n year?: number;\n /** The text of the calendar, in English by default. */\n labels?: Partial<CalendarLabels>;\n}\n\nconst DatePickerBase = React.forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(props, ref) {\n const { calendarProps, others } = pickCalendarProps(props);\n const { labels, ...inputProps } = others as typeof others & { labels?: Partial<CalendarLabels> };\n\n const {\n month,\n year,\n onValueChange,\n onInputError,\n value: passedValue,\n disableSpecificDates,\n dateFormat,\n separator,\n minDate,\n maxDate,\n defaultValue,\n onMonthChange,\n locale,\n weekStartsOn,\n } = calendarProps;\n\n const calendarRef = React.useRef<HTMLDivElement>(null);\n const [isTextFieldFocused, setIsTextFieldFocused] = React.useState(false);\n const [inputError, setInputError] = React.useState<string | boolean>(false);\n const [currentKey, setCurrentKey] = React.useState('');\n // The calendar opens on the default date's month, if there is one.\n const [{ currentDisplayedMonth, currentDisplayedYear }, setCalendarDate] = React.useState({\n currentDisplayedMonth: defaultValue ? defaultValue.getMonth() : month,\n currentDisplayedYear: defaultValue ? defaultValue.getFullYear() : year,\n });\n\n const separatorIndex = getSeparatorIndex(dateFormat);\n\n const handleMonthChange = React.useCallback(\n (targetMonth: number, targetYear: number) => {\n setCalendarDate({ currentDisplayedMonth: targetMonth, currentDisplayedYear: targetYear });\n onMonthChange?.(targetMonth, targetYear);\n },\n [onMonthChange]\n );\n\n const [date, setDate] = useControllableState<Date | null>({\n value: passedValue,\n defaultValue: defaultValue ?? null,\n onChange: onValueChange,\n });\n\n const [inputValue, setInputValue] = React.useState(\n date instanceof Date ? formatDate(date, separator, dateFormat) : ''\n );\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n // Set while the focus goes back to the input after closing, so that focus doesn't open the calendar again.\n const returningFocus = React.useRef(false);\n const onFocus = () => {\n if (returningFocus.current) returningFocus.current = false;\n else setIsTextFieldFocused(true);\n };\n const onBlur = () => setIsTextFieldFocused(false);\n // Escape closes the calendar, and the focus goes back to the input.\n const closeToInput = React.useCallback(() => {\n setIsTextFieldFocused(false);\n // Only when the focus really moves: focusing the focused input fires no focus event to clear the flag.\n if (inputRef.current && document.activeElement !== inputRef.current) {\n returningFocus.current = true;\n inputRef.current.focus();\n }\n }, []);\n\n const handleDateSelection = React.useCallback(\n (selectedDate: Date) => {\n setInputValue(formatDate(selectedDate, separator, dateFormat));\n setDate(selectedDate);\n setCalendarDate({\n currentDisplayedMonth: selectedDate.getMonth(),\n currentDisplayedYear: selectedDate.getFullYear(),\n });\n setInputError('');\n // Chosen: the calendar closes and the focus goes back to the input.\n window.setTimeout(closeToInput, 10);\n },\n [setDate, separator, dateFormat, closeToInput]\n );\n\n // A controlled date picker shows the new value whenever the parent changes it. Compared by time, since the parent\n // may pass a new Date object for the same day on every render.\n const controlledTime = passedValue === undefined ? undefined : (passedValue?.getTime() ?? null);\n React.useEffect(() => {\n if (controlledTime === undefined) return;\n setInputValue(controlledTime === null ? '' : formatDate(new Date(controlledTime), separator, dateFormat));\n }, [controlledTime, separator, dateFormat]);\n\n function handleInputChange(value: string) {\n const valueLength = value.length;\n\n if (currentKey !== 'Backspace' && (valueLength === separatorIndex.first || valueLength === separatorIndex.second)) {\n return setInputValue(value + separator);\n }\n\n if (valueLength === 0) {\n setDate(null);\n }\n\n setInputValue(value);\n\n if (valueLength === 10) {\n const dateValue = dateStringParser(value, dateFormat, separator);\n if (!dateValue) {\n return setInputError(onInputError?.('INVALID_DATE') ?? true);\n }\n setInputError('');\n\n if (isDateValid({ date: dateValue, minDate, maxDate })) {\n return handleDateSelection(dateValue);\n }\n return setInputError(onInputError?.('OUT_OF_RANGE') ?? true);\n }\n // Still typing: the error, if any, waits for the field to lose the focus.\n setInputError('');\n }\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n others.onBlur?.(event);\n if (inputValue.length > 0 && inputValue.length < 10) setInputError(onInputError?.('INVALID_DATE') ?? true);\n };\n\n return (\n <div\n className=\"roaster-date-picker\"\n ref={calendarRef}\n // Close when the focus leaves the date picker (Tab past the calendar, or a click elsewhere).\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) onBlur();\n }}\n >\n <TextField\n {...inputProps}\n value={inputValue}\n ref={mergedRef}\n onFocus={onFocus}\n onBlur={handleInputBlur}\n maxLength={10}\n // The WAI-ARIA date picker combobox: a text input that opens a calendar dialog.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={isTextFieldFocused}\n onValueChange={(value) => handleInputChange(value)}\n onKeyDown={(event) => {\n setCurrentKey(event.key);\n if (event.key === 'Escape') onBlur();\n }}\n // A typing error wins over the one the parent passes.\n error={inputError || others.error}\n />\n <Calendar\n selected={date ?? undefined}\n onClose={closeToInput}\n minDate={minDate}\n maxDate={maxDate}\n isOpen={isTextFieldFocused}\n year={currentDisplayedYear}\n month={currentDisplayedMonth}\n onMonthChange={handleMonthChange}\n handleDateSelection={handleDateSelection}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n labels={labels}\n />\n </div>\n );\n});\n\n/**\n * A text field with a calendar, to type or pick a date, with optional minimum and maximum dates. DatePicker.MonthGrid\n * chooses a range of whole months instead.\n */\nexport const DatePicker = Object.assign(DatePickerBase, { MonthGrid });\n"],"names":["React","pickCalendarProps","getSeparatorIndex","useControllableState","formatDate","useMergeRefs","dateStringParser","isDateValid","jsxs","jsx","TextField","Calendar","MonthGrid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,cAAc,GAAGA,gBAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE;AACzE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAGC,uBAAiB,CAAC,KAAK,CAAC;AAC5D,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM;AAC1C,EAAE,MAAM;AACR,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,oBAAoB;AACxB,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,aAAa;AACjB,IAAI,MAAM;AACV,IAAI;AACJ,GAAG,GAAG,aAAa;AACnB,EAAE,MAAM,WAAW,GAAGD,gBAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACxC,EAAE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAGA,gBAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC3E,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,G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;AAClD,YAAY,CAAC;AACb,YAAY,KAAK,EAAE,UAAU,IAAI,MAAM,CAAC;AACxC;AACA,SAAS;AACT,wBAAwBD,cAAG;AAC3B,UAAUE,iBAAQ;AAClB,UAAU;AACV,YAAY,QAAQ,EAAE,IAAI,IAAI,MAAM;AACpC,YAAY,OAAO,EAAE,YAAY;AACjC,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,MAAM,EAAE,kBAAkB;AACtC,YAAY,IAAI,EAAE,oBAAoB;AACtC,YAAY,KAAK,EAAE,qBAAqB;AACxC,YAAY,aAAa,EAAE,iBAAiB;AAC5C,YAAY,mBAAmB;AAC/B,YAAY,oBAAoB;AAChC,YAAY,MAAM;AAClB,YAAY,YAAY;AACxB,YAAY;AACZ;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC,CAAC;AACU,MAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,aAAEC,mBAAS,EAAE;;"}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var Button = require('../../../Button/Button.js');
|
|
6
|
-
var index
|
|
6
|
+
var index = require('../../utils/index.js');
|
|
7
7
|
var Month = require('../Month/Month.js');
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
function _interopNamespaceDefault(e) {
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
for (var k in e) {
|
|
14
|
-
n[k] = e[k];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
n.default = e;
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
8
|
+
var Icon = require('../../../Icon/Icon.js');
|
|
22
9
|
|
|
10
|
+
const defaultCalendarLabels = {
|
|
11
|
+
calendar: "Choose a date",
|
|
12
|
+
previousMonth: "Previous month",
|
|
13
|
+
nextMonth: "Next month"
|
|
14
|
+
};
|
|
23
15
|
function Calendar({
|
|
24
|
-
ref,
|
|
25
16
|
selected,
|
|
26
17
|
month,
|
|
27
18
|
year,
|
|
@@ -29,28 +20,67 @@ function Calendar({
|
|
|
29
20
|
maxDate,
|
|
30
21
|
disableSpecificDates,
|
|
31
22
|
onMonthChange,
|
|
32
|
-
handleDateSelection = index
|
|
23
|
+
handleDateSelection = index.noop,
|
|
33
24
|
isOpen = false,
|
|
34
|
-
onClose
|
|
25
|
+
onClose,
|
|
26
|
+
locale,
|
|
27
|
+
weekStartsOn,
|
|
28
|
+
labels
|
|
35
29
|
}) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
30
|
+
const text = { ...defaultCalendarLabels, ...labels };
|
|
31
|
+
const showNextYear = index.getNextDisplayYear(month, year);
|
|
32
|
+
const showNextMonth = index.getNextDisplayMonth(month);
|
|
33
|
+
const showPreviousYear = index.getPreviousDisplayYear(month, year);
|
|
34
|
+
const showPreviousMonth = index.getPreviousDisplayMonth(month);
|
|
40
35
|
if (!isOpen) return null;
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
return (
|
|
37
|
+
// A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would
|
|
38
|
+
// otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.
|
|
39
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-date-picker__popup", onMouseDown: (event) => event.preventDefault(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-date-picker__calendar", role: "dialog", "aria-label": text.calendar, children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-date-picker__nav", children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
Button.Button,
|
|
44
|
+
{
|
|
45
|
+
variant: "secondary",
|
|
46
|
+
iconOnly: true,
|
|
47
|
+
"aria-label": text.previousMonth,
|
|
48
|
+
onClick: () => onMonthChange?.(showPreviousMonth, showPreviousYear),
|
|
49
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "arrow-left" })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "roaster-date-picker__month", "aria-live": "polite", children: index.monthTitle(month, year, locale) }),
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
Button.Button,
|
|
55
|
+
{
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
iconOnly: true,
|
|
58
|
+
"aria-label": text.nextMonth,
|
|
59
|
+
onClick: () => onMonthChange?.(showNextMonth, showNextYear),
|
|
60
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "arrow-right" })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
Month.Month,
|
|
66
|
+
{
|
|
67
|
+
month,
|
|
68
|
+
year,
|
|
69
|
+
selected,
|
|
70
|
+
onChange: handleDateSelection,
|
|
71
|
+
onMonthChange,
|
|
72
|
+
onEscape: onClose,
|
|
73
|
+
minDate,
|
|
74
|
+
maxDate,
|
|
75
|
+
disableSpecificDates,
|
|
76
|
+
locale,
|
|
77
|
+
weekStartsOn
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }) })
|
|
81
|
+
);
|
|
53
82
|
}
|
|
54
83
|
|
|
55
84
|
exports.Calendar = Calendar;
|
|
85
|
+
exports.defaultCalendarLabels = defaultCalendarLabels;
|
|
56
86
|
//# sourceMappingURL=Calendar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["import { Button } from '@/components/Button';\nimport {\n getNextDisplayMonth,\n getNextDisplayYear,\n getPreviousDisplayMonth,\n getPreviousDisplayYear,\n monthTitle,\n type WeekStartsOn,\n noop,\n} from '../../utils';\n\nimport { Month } from '../Month';\nimport { Icon } from '@/components/Icon';\n\nexport interface CalendarProps {\n /**\n * The language of the month and weekday names, as a BCP 47 tag such as `fr-FR`.\n * @defaultValue 'en-US'\n */\n locale?: string;\n /**\n * The day the week starts on: 0 is Sunday, 1 Monday ... 6 Saturday.\n * @defaultValue 0\n */\n weekStartsOn?: WeekStartsOn;\n /** Mounts Calendar if true */\n isOpen?: boolean;\n /** Callback to close the calendar. */\n onClose?(): void;\n /** The selected date */\n selected?: Date;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month: number;\n /** The year to show */\n year: number;\n /** Disable selecting dates before this. */\n minDate?: Date;\n /** Disable selecting dates after this. */\n maxDate?: Date;\n /** Disable specific dates. */\n disableSpecificDates?: Date[];\n /** Callback when date is selected. */\n handleDateSelection?(date: Date): void;\n /** Callback when month is changed. */\n onMonthChange?(month: number, year: number): void;\n}\n\n/** The text of the calendar, for other languages. */\nexport interface CalendarLabels {\n /** The name of the calendar, read by screen readers. */\n calendar: string;\n /** The name of the previous month button. */\n previousMonth: string;\n /** The name of the next month button. */\n nextMonth: string;\n}\n\nexport const defaultCalendarLabels: CalendarLabels = {\n calendar: 'Choose a date',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport function Calendar({\n selected,\n month,\n year,\n minDate,\n maxDate,\n disableSpecificDates,\n onMonthChange,\n handleDateSelection = noop,\n isOpen = false,\n onClose,\n locale,\n weekStartsOn,\n labels,\n}: CalendarProps & { labels?: Partial<CalendarLabels> }) {\n const text = { ...defaultCalendarLabels, ...labels };\n const showNextYear = getNextDisplayYear(month, year);\n const showNextMonth = getNextDisplayMonth(month);\n\n const showPreviousYear = getPreviousDisplayYear(month, year);\n const showPreviousMonth = getPreviousDisplayMonth(month);\n\n if (!isOpen) return null;\n\n return (\n // A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would\n // otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"roaster-date-picker__popup\" onMouseDown={(event) => event.preventDefault()}>\n <div className=\"roaster-date-picker__calendar\" role=\"dialog\" aria-label={text.calendar}>\n <div className=\"roaster-date-picker__nav\">\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.previousMonth}\n onClick={() => onMonthChange?.(showPreviousMonth, showPreviousYear)}\n >\n <Icon name=\"arrow-left\" />\n </Button>\n <span className=\"roaster-date-picker__month\" aria-live=\"polite\">\n {monthTitle(month, year, locale)}\n </span>\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.nextMonth}\n onClick={() => onMonthChange?.(showNextMonth, showNextYear)}\n >\n <Icon name=\"arrow-right\" />\n </Button>\n </div>\n <Month\n month={month}\n year={year}\n selected={selected}\n onChange={handleDateSelection}\n onMonthChange={onMonthChange}\n onEscape={onClose}\n minDate={minDate}\n maxDate={maxDate}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n />\n </div>\n </div>\n );\n}\n"],"names":["noop","getNextDisplayYear","getNextDisplayMonth","getPreviousDisplayYear","getPreviousDisplayMonth","jsx","jsxs","Button","Icon","monthTitle","Month"],"mappings":";;;;;;;;;AAaY,MAAC,qBAAqB,GAAG;AACrC,EAAE,QAAQ,EAAE,eAAe;AAC3B,EAAE,aAAa,EAAE,gBAAgB;AACjC,EAAE,SAAS,E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AAa;AAC5C,YAAY,OAAO,EAAE,MAAM,aAAa,GAAG,iBAAiB,EAAE,gBAAgB,CAAC;AAC/E,YAAY,QAAQ,kBAAkBF,cAAG,CAACG,SAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AACtE;AACA,SAAS;AACT,wBAAwBH,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAEI,gBAAU,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;AAClJ,wBAAwBJ,cAAG;AAC3B,UAAUE,aAAM;AAChB,UAAU;AACV,YAAY,OAAO,EAAE,WAAW;AAChC,YAAY,QAAQ,EAAE,IAAI;AAC1B,YAAY,YAAY,EAAE,IAAI,CAAC,SAAS;AACxC,YAAY,OAAO,EAAE,MAAM,aAAa,GAAG,aAAa,EAAE,YAAY,CAAC;AACvE,YAAY,QAAQ,kBAAkBF,cAAG,CAACG,SAAI,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AACvE;AACA;AACA,OAAO,EAAE,CAAC;AACV,sBAAsBH,cAAG;AACzB,QAAQK,WAAK;AACb,QAAQ;AACR,UAAU,KAAK;AACf,UAAU,IAAI;AACd,UAAU,QAAQ;AAClB,UAAU,QAAQ,EAAE,mBAAmB;AACvC,UAAU,aAAa;AACvB,UAAU,QAAQ,EAAE,OAAO;AAC3B,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB,UAAU,oBAAoB;AAC9B,UAAU,MAAM;AAChB,UAAU;AACV;AACA;AACA,KAAK,EAAE,CAAC,EAAE;AACV;AACA;;;"}
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var index = require('../../utils/index.js');
|
|
6
|
-
var index$1 = require('../../../../utils/classNames/index.js');
|
|
7
6
|
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function Day({ day, selected, disabled, focused, locale, onSelect }) {
|
|
8
|
+
if (!day) return /* @__PURE__ */ jsxRuntime.jsx("td", { className: "roaster-date-picker__cell" });
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { className: "roaster-date-picker__cell", "aria-selected": selected || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
"button",
|
|
11
|
+
{
|
|
12
|
+
type: "button",
|
|
13
|
+
className: "roaster-date-picker__day",
|
|
14
|
+
"data-date": day.toDateString(),
|
|
15
|
+
tabIndex: focused ? 0 : -1,
|
|
16
|
+
disabled,
|
|
17
|
+
"aria-label": index.dayLabel(day, locale),
|
|
18
|
+
"aria-current": index.isSameDay(/* @__PURE__ */ new Date(), day) ? "date" : void 0,
|
|
19
|
+
onClick: () => onSelect?.(day),
|
|
20
|
+
children: day.getDate()
|
|
13
21
|
}
|
|
14
|
-
}
|
|
15
|
-
n.default = e;
|
|
16
|
-
return Object.freeze(n);
|
|
22
|
+
) });
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
20
|
-
|
|
21
|
-
const Day = React__namespace.memo(({ day, onClick, selected, disabled }) => {
|
|
22
|
-
if (!day) {
|
|
23
|
-
return /* @__PURE__ */ React__namespace.createElement("td", { className: "day empty" });
|
|
24
|
-
}
|
|
25
|
-
const handleClick = onClick && !disabled ? onClick.bind(null, day) : index.noop;
|
|
26
|
-
const isToday = index.isSameDay(/* @__PURE__ */ new Date(), day);
|
|
27
|
-
const date = day.getDate();
|
|
28
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
29
|
-
"td",
|
|
30
|
-
{
|
|
31
|
-
className: index$1.classNames("day", { disabled, selected }),
|
|
32
|
-
onClick: handleClick,
|
|
33
|
-
style: { ...isToday && { fontWeight: 700 } }
|
|
34
|
-
},
|
|
35
|
-
date
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
Day.displayName = "Day";
|
|
39
|
-
|
|
40
25
|
exports.Day = Day;
|
|
41
26
|
//# sourceMappingURL=Day.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Day.js","sources":["../../../../../../src/components/DatePicker/components/Day/Day.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Day.js","sources":["../../../../../../src/components/DatePicker/components/Day/Day.tsx"],"sourcesContent":["import { dayLabel, isSameDay } from '../../utils';\n\nexport interface DayProps {\n /** The day the cell shows; an empty cell pads the first and last weeks. */\n day?: Date;\n /** Whether it is the chosen day. */\n selected?: boolean;\n /** Whether it can't be chosen, being outside the limits or disabled. */\n disabled?: boolean;\n /** Whether it is the day the keyboard is on: the one tab stop of the grid. */\n focused?: boolean;\n /** The language of the day's full name, read by screen readers. */\n locale?: string;\n /** Called with the day when it is chosen. */\n onSelect?(day: Date): void;\n}\n\n/** One day of the calendar grid: a button in a grid cell. */\nexport function Day({ day, selected, disabled, focused, locale, onSelect }: DayProps) {\n if (!day) return <td className=\"roaster-date-picker__cell\" />;\n\n return (\n <td className=\"roaster-date-picker__cell\" aria-selected={selected || undefined}>\n <button\n type=\"button\"\n className=\"roaster-date-picker__day\"\n data-date={day.toDateString()}\n tabIndex={focused ? 0 : -1}\n disabled={disabled}\n aria-label={dayLabel(day, locale)}\n aria-current={isSameDay(new Date(), day) ? 'date' : undefined}\n onClick={() => onSelect?.(day)}\n >\n {day.getDate()}\n </button>\n </td>\n );\n}\n"],"names":["jsx","dayLabel","isSameDay"],"mappings":";;;;;;AAGO,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;AAC5E,EAAE,IAAI,CAAC,GAAG,EAAE,uBAAuBA,cAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC;AACxF,EAAE,uBAAuBA,cAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,eAAe,EAAE,QAAQ,IAAI,MAAM,EAAE,QAAQ,kBAAkBA,cAAG;AAC/I,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,SAAS,EAAE,0BAA0B;AAC3C,MAAM,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE;AACrC,MAAM,QAAQ,EAAE,OAAO,GAAG,CAAC,GAAG,EAAE;AAChC,MAAM,QAAQ;AACd,MAAM,YAAY,EAAEC,cAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;AACzC,MAAM,cAAc,EAAEC,eAAS,iBAAiB,IAAI,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM;AAClF,MAAM,OAAO,EAAE,MAAM,QAAQ,GAAG,GAAG,CAAC;AACpC,MAAM,QAAQ,EAAE,GAAG,CAAC,OAAO;AAC3B;AACA,GAAG,EAAE,CAAC;AACN;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var index = require('../../utils/index.js');
|
|
6
7
|
var Day = require('../Day/Day.js');
|
|
@@ -19,36 +20,98 @@ function _interopNamespaceDefault(e) {
|
|
|
19
20
|
|
|
20
21
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
21
22
|
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
function initialFocus(month, year, selected) {
|
|
24
|
+
const inMonth = (date) => date && date.getMonth() === month && date.getFullYear() === year;
|
|
25
|
+
if (inMonth(selected)) return selected;
|
|
26
|
+
const today = /* @__PURE__ */ new Date();
|
|
27
|
+
return inMonth(today) ? new Date(today.getFullYear(), today.getMonth(), today.getDate()) : new Date(year, month, 1);
|
|
28
|
+
}
|
|
29
|
+
function Month({
|
|
30
|
+
selected,
|
|
31
|
+
minDate,
|
|
32
|
+
maxDate,
|
|
33
|
+
disableSpecificDates,
|
|
34
|
+
onChange = index.noop,
|
|
35
|
+
onMonthChange,
|
|
36
|
+
onEscape,
|
|
37
|
+
month,
|
|
38
|
+
year,
|
|
39
|
+
locale,
|
|
40
|
+
weekStartsOn = 0
|
|
41
|
+
}) {
|
|
42
|
+
const weeks = React__namespace.useMemo(() => index.getWeeksForMonth(month, year, weekStartsOn), [month, year, weekStartsOn]);
|
|
43
|
+
const [focused, setFocused] = React__namespace.useState(() => initialFocus(month, year, selected));
|
|
44
|
+
const gridRef = React__namespace.useRef(null);
|
|
45
|
+
const moveFocus = React__namespace.useRef(false);
|
|
46
|
+
const focusInMonth = focused.getMonth() === month && focused.getFullYear() === year;
|
|
47
|
+
const tabStop = focusInMonth ? focused : initialFocus(month, year, selected);
|
|
48
|
+
React__namespace.useEffect(() => {
|
|
49
|
+
if (!moveFocus.current) return;
|
|
50
|
+
moveFocus.current = false;
|
|
51
|
+
gridRef.current?.querySelector(`[data-date="${tabStop.toDateString()}"]`)?.focus();
|
|
50
52
|
});
|
|
51
|
-
|
|
53
|
+
const isDisabled = (day) => minDate && index.isDateBefore(day, minDate) || maxDate && index.isDateAfter(day, maxDate) || disableSpecificDates && index.isDateDisabled(day, disableSpecificDates) || false;
|
|
54
|
+
const handleKeyDown = (event) => {
|
|
55
|
+
const moves = {
|
|
56
|
+
ArrowLeft: (day) => index.addDays(day, -1),
|
|
57
|
+
ArrowRight: (day) => index.addDays(day, 1),
|
|
58
|
+
ArrowUp: (day) => index.addDays(day, -7),
|
|
59
|
+
ArrowDown: (day) => index.addDays(day, 7),
|
|
60
|
+
Home: (day) => index.startOfWeek(day, weekStartsOn),
|
|
61
|
+
End: (day) => index.endOfWeek(day, weekStartsOn),
|
|
62
|
+
PageUp: (day) => index.addMonths(day, event.shiftKey ? -12 : -1),
|
|
63
|
+
PageDown: (day) => index.addMonths(day, event.shiftKey ? 12 : 1)
|
|
64
|
+
};
|
|
65
|
+
if (event.key === "Escape") {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
onEscape?.();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const move = moves[event.key];
|
|
71
|
+
if (!move) return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
const next = move(tabStop);
|
|
74
|
+
moveFocus.current = true;
|
|
75
|
+
setFocused(next);
|
|
76
|
+
if (next.getMonth() !== month || next.getFullYear() !== year) onMonthChange?.(next.getMonth(), next.getFullYear());
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
+
"table",
|
|
80
|
+
{
|
|
81
|
+
ref: gridRef,
|
|
82
|
+
className: "roaster-date-picker__grid",
|
|
83
|
+
role: "grid",
|
|
84
|
+
"aria-label": index.monthTitle(month, year, locale),
|
|
85
|
+
onKeyDown: handleKeyDown,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: index.weekdaysFrom(weekStartsOn).map((weekday) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
+
Weekday.Weekday,
|
|
89
|
+
{
|
|
90
|
+
title: index.weekdayName(weekday, locale),
|
|
91
|
+
fullName: index.weekdayName(weekday, locale, "long")
|
|
92
|
+
},
|
|
93
|
+
weekday
|
|
94
|
+
)) }) }),
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: weeks.map((week) => /* @__PURE__ */ jsxRuntime.jsx("tr", { children: week.map(
|
|
96
|
+
(day, index$1) => day == null ? /* @__PURE__ */ jsxRuntime.jsx(Day.Day, {}, `empty-${index$1}`) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
Day.Day,
|
|
98
|
+
{
|
|
99
|
+
day,
|
|
100
|
+
locale,
|
|
101
|
+
focused: index.isSameDay(day, tabStop),
|
|
102
|
+
selected: selected != null && index.dateIsSelected(day, selected),
|
|
103
|
+
disabled: isDisabled(day),
|
|
104
|
+
onSelect: (chosen) => {
|
|
105
|
+
setFocused(chosen);
|
|
106
|
+
onChange(chosen);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
day.toDateString()
|
|
110
|
+
)
|
|
111
|
+
) }, `week-${week.find((day) => day)?.toISOString() ?? ""}`)) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
52
115
|
}
|
|
53
116
|
|
|
54
117
|
exports.Month = Month;
|