@trellixio/roaster-react 1.1.1 → 2.1.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 +39 -23
- 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/jetbrains-mono/LICENSE +93 -0
- package/fonts/jetbrains-mono/jetbrains-mono-latin-wght-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 +23 -11
- package/roaster.css +1 -0
- package/roaster.css.d.ts +2 -0
- package/themes/azoth.css +1 -0
- package/themes/azoth.css.d.ts +2 -0
- package/themes/coffee.css +1 -0
- package/themes/coffee.css.d.ts +2 -0
- package/themes/scalar.css +1 -0
- package/themes/scalar.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
- package/theme.css +0 -1
|
@@ -1,33 +1,54 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import * as React from 'react';
|
|
4
|
+
import { Icon } from '../Icon/Icon.js';
|
|
3
5
|
import { classNames } from '../../utils/classNames/index.js';
|
|
6
|
+
import { Slot } from '../../utils/Slot/index.js';
|
|
4
7
|
|
|
5
8
|
const Button = React.forwardRef((props, ref) => {
|
|
6
9
|
const {
|
|
7
10
|
children,
|
|
8
|
-
submit,
|
|
9
11
|
variant = "primary",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
tone,
|
|
13
|
+
size = "medium",
|
|
14
|
+
iconOnly,
|
|
15
|
+
caret,
|
|
16
|
+
fullWidth,
|
|
17
|
+
flush,
|
|
18
|
+
row,
|
|
19
|
+
loading,
|
|
20
|
+
asChild,
|
|
12
21
|
className,
|
|
13
|
-
style,
|
|
14
22
|
onClick,
|
|
15
|
-
|
|
23
|
+
type = "button",
|
|
16
24
|
...others
|
|
17
25
|
} = props;
|
|
18
|
-
|
|
19
|
-
"button",
|
|
26
|
+
const classes = classNames(
|
|
27
|
+
"roaster-button",
|
|
28
|
+
`roaster-button--${variant}`,
|
|
29
|
+
tone && `roaster-button--${tone}`,
|
|
20
30
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className: classNames("button", variant, color, { disabled, icon: isIconButton }, className)
|
|
31
|
+
"roaster-button--small": size === "small",
|
|
32
|
+
"roaster-button--large": size === "large",
|
|
33
|
+
"roaster-button--icon-only": iconOnly,
|
|
34
|
+
"roaster-button--full-width": fullWidth,
|
|
35
|
+
"roaster-button--flush": flush,
|
|
36
|
+
"roaster-button--row": row
|
|
28
37
|
},
|
|
29
|
-
|
|
38
|
+
className
|
|
30
39
|
);
|
|
40
|
+
const loadingProps = loading ? { "aria-busy": true, "aria-disabled": true } : {};
|
|
41
|
+
const handleClick = (event) => {
|
|
42
|
+
if (loading) event.preventDefault();
|
|
43
|
+
else onClick?.(event);
|
|
44
|
+
};
|
|
45
|
+
if (asChild) {
|
|
46
|
+
return /* @__PURE__ */ jsx(Slot, { ...others, ...loadingProps, ref, className: classes, onClick: handleClick, children });
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsxs("button", { ...others, ...loadingProps, ref, type, className: classes, onClick: handleClick, children: [
|
|
49
|
+
children,
|
|
50
|
+
caret && /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: "roaster-button__caret" })
|
|
51
|
+
] });
|
|
31
52
|
});
|
|
32
53
|
Button.displayName = "Button";
|
|
33
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<button>` prop (`
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Icon } from '../Icon';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<button>` prop (`type`, `name`, `aria-*`, ...) is accepted and forwarded to it. */\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The button's content: its text, and an `Icon` if any. */\n children: React.ReactNode;\n /**\n * The look of the button:\n * - `primary`: filled, for the main action\n * - `secondary`: for other actions: outlined in coffee, filled in Azoth\n * - `plain`: a link-like text button\n * - `ghost`: no background or border, such as an icon in a toolbar\n * - `chip`: a filter or a toggle, such as the filters above a table; `aria-pressed` turns it on. It looks like\n * `secondary` in the coffee theme\n * @defaultValue 'primary'\n */\n variant?: 'primary' | 'secondary' | 'plain' | 'ghost' | 'chip';\n /**\n * A status color: `success` for positive actions, `danger` for destructive ones. `neutral`, for a `plain` button: a\n * quiet action in the text's secondary color, such as one under a form.\n */\n tone?: 'success' | 'danger' | 'neutral';\n /**\n * `large` for the buttons of full-page flows and a few prominent calls to action. Buttons in a modal's footer and in\n * `FormActions` are large without it. `small` for smaller text, such as a quiet action under a field. The sizes look\n * the same in the coffee theme.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** A square button holding only an icon. Name it with `aria-label`. */\n iconOnly?: boolean;\n /** A chevron after the text, for a button that opens a menu, such as a filter chip. Not with `asChild`. */\n caret?: boolean;\n /** Takes the whole width of its container. */\n fullWidth?: boolean;\n /** Its label lines up with the text before it, its padding hanging out of its place, such as a period picker. */\n flush?: boolean;\n /**\n * A value in a column of rows, such as a property in a page's side column: its icon nearer the start, its text cut\n * short with an ellipsis when it doesn't fit.\n */\n row?: boolean;\n /** Shows a spinner in place of the content, and ignores clicks, while an action runs. */\n loading?: boolean;\n /**\n * Render the element your child is, such as a link (`<Button asChild><a href=\"/new\">New</a></Button>`), with the\n * button's look.\n */\n asChild?: boolean;\n}\n\n/**\n * A button in the primary, secondary, plain, ghost or chip style, optionally in the success, danger or (plain) neutral\n * tone, and in the small, medium or large size. It is\n * `type=\"button\"` unless you say otherwise, so it never submits a form by accident.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n children,\n variant = 'primary',\n tone,\n size = 'medium',\n iconOnly,\n caret,\n fullWidth,\n flush,\n row,\n loading,\n asChild,\n className,\n onClick,\n type = 'button',\n ...others\n } = props;\n\n const classes = classNames(\n 'roaster-button',\n `roaster-button--${variant}`,\n tone && `roaster-button--${tone}`,\n {\n 'roaster-button--small': size === 'small',\n 'roaster-button--large': size === 'large',\n 'roaster-button--icon-only': iconOnly,\n 'roaster-button--full-width': fullWidth,\n 'roaster-button--flush': flush,\n 'roaster-button--row': row,\n },\n className\n );\n const loadingProps = loading ? { 'aria-busy': true, 'aria-disabled': true } : {};\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // A loading button stays focusable, so a click can still reach it from the keyboard.\n if (loading) event.preventDefault();\n else onClick?.(event);\n };\n\n if (asChild) {\n return (\n <Slot {...others} {...loadingProps} ref={ref as React.Ref<HTMLElement>} className={classes} onClick={handleClick}>\n {children}\n </Slot>\n );\n }\n return (\n <button {...others} {...loadingProps} ref={ref} type={type} className={classes} onClick={handleClick}>\n {children}\n {caret && <Icon name=\"chevron-down\" className=\"roaster-button__caret\" />}\n </button>\n );\n});\n\nButton.displayName = 'Button';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,GAAG,SAAS;AACvB,IAAI,IAAI;AACR,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,IAAI,G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SAAS,EAAE,uBAAuB,EAAE;AACnG,GAAG,EAAE,CAAC;AACN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { classNames } from '../../utils/classNames/index.js';
|
|
4
5
|
|
|
5
6
|
const ButtonIcon = React.forwardRef((props, ref) => {
|
|
6
|
-
const { children,
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
const { children, size = "small", className, type = "button", ...others } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
8
9
|
"button",
|
|
9
10
|
{
|
|
11
|
+
...others,
|
|
10
12
|
ref,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: classNames("button-icon", variant, { disabled }, className)
|
|
16
|
-
},
|
|
17
|
-
children
|
|
13
|
+
type,
|
|
14
|
+
className: classNames("roaster-icon-button", { "roaster-icon-button--medium": size === "medium" }, className),
|
|
15
|
+
children
|
|
16
|
+
}
|
|
18
17
|
);
|
|
19
18
|
});
|
|
20
19
|
ButtonIcon.displayName = "ButtonIcon";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\
|
|
1
|
+
{"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\ninterface ButtonIconBaseProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'aria-labelledby'> {\n /** The icon, such as `<Icon name=\"xmark\" />`. */\n children: React.ReactNode;\n /**\n * The size of the icon: `small` (alerts, toasts, tags) or `medium` (modals).\n * @defaultValue 'small'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A small icon-only button, such as the close button of an alert, a tag or a modal. It has no text, so it needs a\n * name: `aria-label`, or `aria-labelledby` pointing at text on the page. Every native `<button>` prop is accepted.\n */\nexport type ButtonIconProps = ButtonIconBaseProps &\n ({ 'aria-label': string; 'aria-labelledby'?: string } | { 'aria-label'?: string; 'aria-labelledby': string });\n\n/** A small icon-only button, such as the close button of an alert, a tag or a modal. Name it with `aria-label`. */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>((props, ref) => {\n const { children, size = 'small', className, type = 'button', ...others } = props;\n\n return (\n <button\n {...others}\n ref={ref}\n type={type}\n className={classNames('roaster-icon-button', { 'roaster-icon-button--medium': size === 'medium' }, className)}\n >\n {children}\n </button>\n );\n});\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnF,EAAE,uBAAuB,GAAG;AAC5B,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,6BAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,EAAE,SAAS,CAAC;AACnH,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { classNames } from '../../utils/classNames/index.js';
|
|
5
|
+
|
|
6
|
+
const seriesClass = (series) => series && `roaster-chart__series--${series}`;
|
|
7
|
+
const ChartBase = React.forwardRef(
|
|
8
|
+
({ children, size = "medium", bleed, grid = "dots", className, ...others }, ref) => /* @__PURE__ */ jsx(
|
|
9
|
+
"figure",
|
|
10
|
+
{
|
|
11
|
+
...others,
|
|
12
|
+
ref,
|
|
13
|
+
className: classNames(
|
|
14
|
+
"roaster-chart",
|
|
15
|
+
{
|
|
16
|
+
"roaster-chart--large": size === "large",
|
|
17
|
+
"roaster-chart--bleed": bleed,
|
|
18
|
+
"roaster-chart--grid-lines": grid === "lines"
|
|
19
|
+
},
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
ChartBase.displayName = "Chart";
|
|
27
|
+
const ChartHeader = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("div", { ...others, ref, className: classNames("roaster-chart__header", className) }));
|
|
28
|
+
ChartHeader.displayName = "Chart.Header";
|
|
29
|
+
const ChartPlot = React.forwardRef(({ inline, className, ...others }, ref) => /* @__PURE__ */ jsx(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
role: "img",
|
|
33
|
+
...others,
|
|
34
|
+
ref,
|
|
35
|
+
className: classNames("roaster-chart__plot", { "roaster-chart__plot--inline": inline }, className)
|
|
36
|
+
}
|
|
37
|
+
));
|
|
38
|
+
ChartPlot.displayName = "Chart.Plot";
|
|
39
|
+
const ChartSeriesGroup = React.forwardRef(
|
|
40
|
+
({ series, className, ...others }, ref) => /* @__PURE__ */ jsx("g", { ...others, ref, className: classNames(seriesClass(series), className) })
|
|
41
|
+
);
|
|
42
|
+
ChartSeriesGroup.displayName = "Chart.Series";
|
|
43
|
+
const ChartFill = React.forwardRef(
|
|
44
|
+
({ series, direction = "down", className, ...others }, ref) => /* @__PURE__ */ jsxs(
|
|
45
|
+
"linearGradient",
|
|
46
|
+
{
|
|
47
|
+
x1: "0",
|
|
48
|
+
x2: "0",
|
|
49
|
+
y1: direction === "down" ? "0" : "1",
|
|
50
|
+
y2: direction === "down" ? "1" : "0",
|
|
51
|
+
...others,
|
|
52
|
+
ref,
|
|
53
|
+
className: classNames("roaster-chart__fill", seriesClass(series), className),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx("stop", { className: "roaster-chart__stop", offset: "0" }),
|
|
56
|
+
/* @__PURE__ */ jsx("stop", { className: "roaster-chart__stop roaster-chart__stop--end", offset: "1" })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
ChartFill.displayName = "Chart.Fill";
|
|
62
|
+
const ChartLine = React.forwardRef(({ series, bold, className, ...others }, ref) => /* @__PURE__ */ jsx(
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
...others,
|
|
66
|
+
ref,
|
|
67
|
+
className: classNames("roaster-chart__line", { "roaster-chart__line--bold": bold }, seriesClass(series), className)
|
|
68
|
+
}
|
|
69
|
+
));
|
|
70
|
+
ChartLine.displayName = "Chart.Line";
|
|
71
|
+
const ChartArea = React.forwardRef(({ series, className, ...others }, ref) => /* @__PURE__ */ jsx("path", { ...others, ref, className: classNames("roaster-chart__area", seriesClass(series), className) }));
|
|
72
|
+
ChartArea.displayName = "Chart.Area";
|
|
73
|
+
const ChartBar = React.forwardRef(
|
|
74
|
+
({ series, edge = "none", edgeWidth = 1, className, ...others }, ref) => {
|
|
75
|
+
const bar = /* @__PURE__ */ jsx(
|
|
76
|
+
"rect",
|
|
77
|
+
{
|
|
78
|
+
...others,
|
|
79
|
+
ref,
|
|
80
|
+
className: classNames("roaster-chart__bar", edge === "none" && seriesClass(series), className)
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
if (edge === "none") return bar;
|
|
84
|
+
const { x, y = 0, width, height = 0 } = others;
|
|
85
|
+
const edgeY = edge === "top" ? Number(y) : Number(y) + Number(height) - edgeWidth;
|
|
86
|
+
return /* @__PURE__ */ jsxs("g", { className: seriesClass(series), children: [
|
|
87
|
+
bar,
|
|
88
|
+
/* @__PURE__ */ jsx("rect", { className: "roaster-chart__edge", x, y: edgeY, width, height: edgeWidth })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
ChartBar.displayName = "Chart.Bar";
|
|
93
|
+
const ChartPoint = React.forwardRef(
|
|
94
|
+
({ series, r = 3, className, ...others }, ref) => /* @__PURE__ */ jsx(
|
|
95
|
+
"circle",
|
|
96
|
+
{
|
|
97
|
+
...others,
|
|
98
|
+
r,
|
|
99
|
+
ref,
|
|
100
|
+
className: classNames("roaster-chart__point", seriesClass(series), className)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
ChartPoint.displayName = "Chart.Point";
|
|
105
|
+
const ChartGrid = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("line", { ...others, ref, className: classNames("roaster-chart__grid", className) }));
|
|
106
|
+
ChartGrid.displayName = "Chart.Grid";
|
|
107
|
+
const ChartBaseline = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("line", { ...others, ref, className: classNames("roaster-chart__baseline", className) }));
|
|
108
|
+
ChartBaseline.displayName = "Chart.Baseline";
|
|
109
|
+
const ChartLabel = React.forwardRef(
|
|
110
|
+
({ variant = "default", className, ...others }, ref) => /* @__PURE__ */ jsx(
|
|
111
|
+
"text",
|
|
112
|
+
{
|
|
113
|
+
...others,
|
|
114
|
+
ref,
|
|
115
|
+
className: classNames(
|
|
116
|
+
"roaster-chart__label",
|
|
117
|
+
{ [`roaster-chart__label--${variant}`]: variant !== "default" },
|
|
118
|
+
className
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
ChartLabel.displayName = "Chart.Label";
|
|
124
|
+
const ChartTick = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("line", { ...others, ref, className: classNames("roaster-chart__tick", className) }));
|
|
125
|
+
ChartTick.displayName = "Chart.Tick";
|
|
126
|
+
const ChartMarker = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("line", { ...others, ref, className: classNames("roaster-chart__marker", className) }));
|
|
127
|
+
ChartMarker.displayName = "Chart.Marker";
|
|
128
|
+
const ChartRange = React.forwardRef(({ rx = 4, className, ...others }, ref) => /* @__PURE__ */ jsx("rect", { ...others, rx, ref, className: classNames("roaster-chart__range", className) }));
|
|
129
|
+
ChartRange.displayName = "Chart.Range";
|
|
130
|
+
const ChartHandle = React.forwardRef(({ rx = 2.5, className, ...others }, ref) => /* @__PURE__ */ jsx("rect", { ...others, rx, ref, className: classNames("roaster-chart__handle", className) }));
|
|
131
|
+
ChartHandle.displayName = "Chart.Handle";
|
|
132
|
+
const ChartRangeLabel = React.forwardRef(
|
|
133
|
+
({ children, textX, textY, rx = 2, className, ...others }, ref) => /* @__PURE__ */ jsxs("g", { children: [
|
|
134
|
+
/* @__PURE__ */ jsx("rect", { ...others, rx, ref, className: classNames("roaster-chart__range-label", className) }),
|
|
135
|
+
/* @__PURE__ */ jsx("text", { className: "roaster-chart__range-text", x: textX, y: textY, children })
|
|
136
|
+
] })
|
|
137
|
+
);
|
|
138
|
+
ChartRangeLabel.displayName = "Chart.RangeLabel";
|
|
139
|
+
const ChartLegend = React.forwardRef(({ className, ...others }, ref) => /* @__PURE__ */ jsx("ul", { ...others, ref, className: classNames("roaster-chart__legend", className) }));
|
|
140
|
+
ChartLegend.displayName = "Chart.Legend";
|
|
141
|
+
const ChartLegendItem = React.forwardRef(
|
|
142
|
+
({ children, series, swatch = true, ...others }, ref) => /* @__PURE__ */ jsxs("li", { ...others, ref, children: [
|
|
143
|
+
children,
|
|
144
|
+
swatch && /* @__PURE__ */ jsx("span", { className: classNames("roaster-chart__key", seriesClass(series)) })
|
|
145
|
+
] })
|
|
146
|
+
);
|
|
147
|
+
ChartLegendItem.displayName = "Chart.LegendItem";
|
|
148
|
+
const Chart = Object.assign(ChartBase, {
|
|
149
|
+
Header: ChartHeader,
|
|
150
|
+
Plot: ChartPlot,
|
|
151
|
+
Series: ChartSeriesGroup,
|
|
152
|
+
Fill: ChartFill,
|
|
153
|
+
Line: ChartLine,
|
|
154
|
+
Area: ChartArea,
|
|
155
|
+
Bar: ChartBar,
|
|
156
|
+
Point: ChartPoint,
|
|
157
|
+
Grid: ChartGrid,
|
|
158
|
+
Baseline: ChartBaseline,
|
|
159
|
+
Label: ChartLabel,
|
|
160
|
+
Tick: ChartTick,
|
|
161
|
+
Marker: ChartMarker,
|
|
162
|
+
Range: ChartRange,
|
|
163
|
+
Handle: ChartHandle,
|
|
164
|
+
RangeLabel: ChartRangeLabel,
|
|
165
|
+
Legend: ChartLegend,
|
|
166
|
+
LegendItem: ChartLegendItem
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
export { Chart };
|
|
170
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","sources":["../../../../src/components/Chart/Chart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/**\n * A series other than the chart's first: `neutral` stays quiet (money out against money in), `negative` is below\n * zero, `secondary` stands beside the first (pending against posted).\n */\nexport type ChartSeries = 'neutral' | 'negative' | 'secondary';\n\n/** The part of every shape's props that picks its series. */\nexport interface ChartSeriesProps {\n /** The series it belongs to. Leave it out for the chart's first series, in its own color. */\n series?: ChartSeries;\n}\n\nconst seriesClass = (series?: ChartSeries) => series && `roaster-chart__series--${series}`;\n\n/** Every native `<figure>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface ChartProps extends React.ComponentPropsWithoutRef<'figure'> {\n /** The chart: a `Chart.Header`, a `Chart.Plot`, a `Chart.Legend`. */\n children: React.ReactNode;\n /**\n * `large` fills part of a page, its labels a step larger.\n * @defaultValue 'medium'\n */\n size?: 'medium' | 'large';\n /** In a full-width page, reaches the window's edges, ruled off under it, such as a time axis over a report. */\n bleed?: boolean;\n /**\n * How the `Chart.Grid` lines are drawn: dotted, or `lines`, dashed (draw one for each axis label).\n * @defaultValue 'dots'\n */\n grid?: 'dots' | 'lines';\n}\n\nconst ChartBase = React.forwardRef<HTMLElement, ChartProps>(\n ({ children, size = 'medium', bleed, grid = 'dots', className, ...others }, ref) => (\n <figure\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-chart',\n {\n 'roaster-chart--large': size === 'large',\n 'roaster-chart--bleed': bleed,\n 'roaster-chart--grid-lines': grid === 'lines',\n },\n className\n )}\n >\n {children}\n </figure>\n )\n);\nChartBase.displayName = 'Chart';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport type ChartHeaderProps = React.ComponentPropsWithoutRef<'div'>;\n\n/** A row over the plot: the period it shows, and its totals. */\nconst ChartHeader = React.forwardRef<HTMLDivElement, ChartHeaderProps>(({ className, ...others }, ref) => (\n <div {...others} ref={ref} className={classNames('roaster-chart__header', className)} />\n));\nChartHeader.displayName = 'Chart.Header';\n\n/** Every native `<svg>` prop (`viewBox`, `role`, `aria-label`, ...) is accepted and forwarded to it. */\nexport interface ChartPlotProps extends React.ComponentPropsWithoutRef<'svg'> {\n /** The shapes: lines, areas, bars, points, the grid and the labels, in the viewBox's coordinates. */\n children: React.ReactNode;\n /** At the size of its `width` and `height`, such as a small chart beside a figure. Otherwise it fills the width. */\n inline?: boolean;\n}\n\n/**\n * The SVG the chart draws in, at its viewBox's size, scaling with the chart's width. Name it, as an image, with\n * `aria-label`: it has `role=\"img\"`.\n */\nconst ChartPlot = React.forwardRef<SVGSVGElement, ChartPlotProps>(({ inline, className, ...others }, ref) => (\n <svg\n role=\"img\"\n {...others}\n ref={ref}\n className={classNames('roaster-chart__plot', { 'roaster-chart__plot--inline': inline }, className)}\n />\n));\nChartPlot.displayName = 'Chart.Plot';\n\n/** Every native `<g>` prop is accepted and forwarded to it. */\nexport interface ChartSeriesGroupProps extends React.ComponentPropsWithoutRef<'g'>, ChartSeriesProps {}\n\n/** A group of shapes in one series, such as money out's bars. */\nconst ChartSeriesGroup = React.forwardRef<SVGGElement, ChartSeriesGroupProps>(\n ({ series, className, ...others }, ref) => (\n <g {...others} ref={ref} className={classNames(seriesClass(series), className)} />\n )\n);\nChartSeriesGroup.displayName = 'Chart.Series';\n\n/** Every native `<linearGradient>` prop is accepted and forwarded to it. */\nexport interface ChartFillProps\n extends Omit<React.ComponentPropsWithoutRef<'linearGradient'>, 'children'>, ChartSeriesProps {\n /** The fill's id, which an area or a bar names in its `fill`: `fill=\"url(#balance-fill)\"`. */\n id: string;\n /**\n * Which way it fades: from the series' color at the top to almost nothing at the bottom (`down`), or the other way\n * (`up`, such as for bars below zero).\n * @defaultValue 'down'\n */\n direction?: 'down' | 'up';\n}\n\n/** A fill that fades, for areas and bars: put it in the plot's `<defs>`. */\nconst ChartFill = React.forwardRef<SVGLinearGradientElement, ChartFillProps>(\n ({ series, direction = 'down', className, ...others }, ref) => (\n <linearGradient\n x1=\"0\"\n x2=\"0\"\n y1={direction === 'down' ? '0' : '1'}\n y2={direction === 'down' ? '1' : '0'}\n {...others}\n ref={ref}\n className={classNames('roaster-chart__fill', seriesClass(series), className)}\n >\n <stop className=\"roaster-chart__stop\" offset=\"0\" />\n <stop className=\"roaster-chart__stop roaster-chart__stop--end\" offset=\"1\" />\n </linearGradient>\n )\n);\nChartFill.displayName = 'Chart.Fill';\n\n/** Every native `<path>` prop (`d`, ...) is accepted and forwarded to it. */\nexport interface ChartLineProps extends React.ComponentPropsWithoutRef<'path'>, ChartSeriesProps {\n /** A thicker line, such as a net change over bars. */\n bold?: boolean;\n}\n\n/** A series' line. Draw its path (`d`) by hand or with a library such as d3-shape. */\nconst ChartLine = React.forwardRef<SVGPathElement, ChartLineProps>(({ series, bold, className, ...others }, ref) => (\n <path\n {...others}\n ref={ref}\n className={classNames('roaster-chart__line', { 'roaster-chart__line--bold': bold }, seriesClass(series), className)}\n />\n));\nChartLine.displayName = 'Chart.Line';\n\n/** Every native `<path>` prop (`d`, `fill`, ...) is accepted and forwarded to it. */\nexport interface ChartAreaProps extends React.ComponentPropsWithoutRef<'path'>, ChartSeriesProps {}\n\n/** The area under a series' line: a flat tint, or the `Chart.Fill` named in its `fill`. */\nconst ChartArea = React.forwardRef<SVGPathElement, ChartAreaProps>(({ series, className, ...others }, ref) => (\n <path {...others} ref={ref} className={classNames('roaster-chart__area', seriesClass(series), className)} />\n));\nChartArea.displayName = 'Chart.Area';\n\n/** Every native `<rect>` prop (`x`, `y`, `width`, `height`, `fill`, ...) is accepted and forwarded to the bar. */\nexport interface ChartBarProps extends React.ComponentPropsWithoutRef<'rect'>, ChartSeriesProps {\n /**\n * A line along the bar's end, in the series' color: at its `top` (a bar above zero), at its `bottom` (below zero),\n * or none.\n * @defaultValue 'none'\n */\n edge?: 'top' | 'bottom' | 'none';\n /**\n * The edge's thickness, in the viewBox's units.\n * @defaultValue 1\n */\n edgeWidth?: number;\n}\n\n/** A bar: a flat tint, or the `Chart.Fill` named in its `fill`, with an optional edge at its end. */\nconst ChartBar = React.forwardRef<SVGRectElement, ChartBarProps>(\n ({ series, edge = 'none', edgeWidth = 1, className, ...others }, ref) => {\n const bar = (\n <rect\n {...others}\n ref={ref}\n className={classNames('roaster-chart__bar', edge === 'none' && seriesClass(series), className)}\n />\n );\n if (edge === 'none') return bar;\n const { x, y = 0, width, height = 0 } = others;\n const edgeY = edge === 'top' ? Number(y) : Number(y) + Number(height) - edgeWidth;\n return (\n <g className={seriesClass(series)}>\n {bar}\n <rect className=\"roaster-chart__edge\" x={x} y={edgeY} width={width} height={edgeWidth} />\n </g>\n );\n }\n);\nChartBar.displayName = 'Chart.Bar';\n\n/** Every native `<circle>` prop (`cx`, `cy`, `r`, ...) is accepted and forwarded to it. */\nexport interface ChartPointProps extends React.ComponentPropsWithoutRef<'circle'>, ChartSeriesProps {}\n\n/** A data point on a series' line. */\nconst ChartPoint = React.forwardRef<SVGCircleElement, ChartPointProps>(\n ({ series, r = 3, className, ...others }, ref) => (\n <circle\n {...others}\n r={r}\n ref={ref}\n className={classNames('roaster-chart__point', seriesClass(series), className)}\n />\n )\n);\nChartPoint.displayName = 'Chart.Point';\n\n/** Every native `<line>` prop (`x1`, `x2`, `y1`, `y2`, ...) is accepted and forwarded to it. */\nexport type ChartGridProps = React.ComponentPropsWithoutRef<'line'>;\n\n/** A dotted line of the grid. */\nconst ChartGrid = React.forwardRef<SVGLineElement, ChartGridProps>(({ className, ...others }, ref) => (\n <line {...others} ref={ref} className={classNames('roaster-chart__grid', className)} />\n));\nChartGrid.displayName = 'Chart.Grid';\n\n/** Every native `<line>` prop is accepted and forwarded to it. */\nexport type ChartBaselineProps = React.ComponentPropsWithoutRef<'line'>;\n\n/** The line at zero. */\nconst ChartBaseline = React.forwardRef<SVGLineElement, ChartBaselineProps>(({ className, ...others }, ref) => (\n <line {...others} ref={ref} className={classNames('roaster-chart__baseline', className)} />\n));\nChartBaseline.displayName = 'Chart.Baseline';\n\n/** Every native `<text>` prop (`x`, `y`, `textAnchor`, ...) is accepted and forwarded to it. */\nexport interface ChartLabelProps extends React.ComponentPropsWithoutRef<'text'> {\n /**\n * `strong` names the period, such as a month under its bars; `muted` is outside the selected range.\n * @defaultValue 'default'\n */\n variant?: 'default' | 'strong' | 'muted';\n}\n\n/** An axis label. */\nconst ChartLabel = React.forwardRef<SVGTextElement, ChartLabelProps>(\n ({ variant = 'default', className, ...others }, ref) => (\n <text\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-chart__label',\n { [`roaster-chart__label--${variant}`]: variant !== 'default' },\n className\n )}\n />\n )\n);\nChartLabel.displayName = 'Chart.Label';\n\n/** Every native `<line>` prop is accepted and forwarded to it. */\nexport type ChartTickProps = React.ComponentPropsWithoutRef<'line'>;\n\n/** A step on a time axis, such as a week; draw a month taller. */\nconst ChartTick = React.forwardRef<SVGLineElement, ChartTickProps>(({ className, ...others }, ref) => (\n <line {...others} ref={ref} className={classNames('roaster-chart__tick', className)} />\n));\nChartTick.displayName = 'Chart.Tick';\n\n/** Every native `<line>` prop is accepted and forwarded to it. */\nexport type ChartMarkerProps = React.ComponentPropsWithoutRef<'line'>;\n\n/** A moment on a time axis, such as today. */\nconst ChartMarker = React.forwardRef<SVGLineElement, ChartMarkerProps>(({ className, ...others }, ref) => (\n <line {...others} ref={ref} className={classNames('roaster-chart__marker', className)} />\n));\nChartMarker.displayName = 'Chart.Marker';\n\n/** Every native `<rect>` prop is accepted and forwarded to it. */\nexport type ChartRangeProps = React.ComponentPropsWithoutRef<'rect'>;\n\n/** The selected span of a time axis. */\nconst ChartRange = React.forwardRef<SVGRectElement, ChartRangeProps>(({ rx = 4, className, ...others }, ref) => (\n <rect {...others} rx={rx} ref={ref} className={classNames('roaster-chart__range', className)} />\n));\nChartRange.displayName = 'Chart.Range';\n\n/** Every native `<rect>` prop is accepted and forwarded to it. */\nexport type ChartHandleProps = React.ComponentPropsWithoutRef<'rect'>;\n\n/** A handle at one end of the selected span. */\nconst ChartHandle = React.forwardRef<SVGRectElement, ChartHandleProps>(({ rx = 2.5, className, ...others }, ref) => (\n <rect {...others} rx={rx} ref={ref} className={classNames('roaster-chart__handle', className)} />\n));\nChartHandle.displayName = 'Chart.Handle';\n\n/** Every native `<rect>` prop (its box) is accepted and forwarded to the label's background. */\nexport interface ChartRangeLabelProps extends Omit<React.ComponentPropsWithoutRef<'rect'>, 'children'> {\n /** The text, such as the dates of the span. */\n children: React.ReactNode;\n /** The text's start and baseline. */\n textX: number;\n textY: number;\n}\n\n/** The selected span's name, on a solid label over it. */\nconst ChartRangeLabel = React.forwardRef<SVGRectElement, ChartRangeLabelProps>(\n ({ children, textX, textY, rx = 2, className, ...others }, ref) => (\n <g>\n <rect {...others} rx={rx} ref={ref} className={classNames('roaster-chart__range-label', className)} />\n <text className=\"roaster-chart__range-text\" x={textX} y={textY}>\n {children}\n </text>\n </g>\n )\n);\nChartRangeLabel.displayName = 'Chart.RangeLabel';\n\n/** Every native `<ul>` prop is accepted and forwarded to it. */\nexport type ChartLegendProps = React.ComponentPropsWithoutRef<'ul'>;\n\n/** What the series are: `Chart.LegendItem`s, after the plot. The last one goes to the end, such as what's left. */\nconst ChartLegend = React.forwardRef<HTMLUListElement, ChartLegendProps>(({ className, ...others }, ref) => (\n <ul {...others} ref={ref} className={classNames('roaster-chart__legend', className)} />\n));\nChartLegend.displayName = 'Chart.Legend';\n\n/** Every native `<li>` prop is accepted and forwarded to it. */\nexport interface ChartLegendItemProps extends React.ComponentPropsWithoutRef<'li'>, ChartSeriesProps {\n /** The series' name, or a figure such as what's left. */\n children: React.ReactNode;\n /**\n * The series' color mark after the name. Turn it off for an item that is no series, such as what's left.\n * @defaultValue true\n */\n swatch?: boolean;\n}\n\n/** A series' name, with its color mark. */\nconst ChartLegendItem = React.forwardRef<HTMLLIElement, ChartLegendItemProps>(\n ({ children, series, swatch = true, ...others }, ref) => (\n <li {...others} ref={ref}>\n {children}\n {swatch && <span className={classNames('roaster-chart__key', seriesClass(series))} />}\n </li>\n )\n);\nChartLegendItem.displayName = 'Chart.LegendItem';\n\n/**\n * The look of a chart the app draws as SVG, by hand or with a library such as d3-shape: series as lines, areas, bars\n * and points, a dotted grid, axis labels, a time axis with a selected span, a header and a legend. Each part is the\n * SVG element it names, with its class; the app gives it its coordinates.\n */\nexport const Chart = Object.assign(ChartBase, {\n Header: ChartHeader,\n Plot: ChartPlot,\n Series: ChartSeriesGroup,\n Fill: ChartFill,\n Line: ChartLine,\n Area: ChartArea,\n Bar: ChartBar,\n Point: ChartPoint,\n Grid: ChartGrid,\n Baseline: ChartBaseline,\n Label: ChartLabel,\n Tick: ChartTick,\n Marker: ChartMarker,\n Range: ChartRange,\n Handle: ChartHandle,\n RangeLabel: ChartRangeLabel,\n Legend: ChartLegend,\n LegendItem: ChartLegendItem,\n});\n"],"names":[],"mappings":";;;;;AAIA,MAAM,WAAW,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAC5E,MAAM,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s, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
3
|
import * as React from 'react';
|
|
4
|
+
import { useMergeRefs } from '@floating-ui/react';
|
|
3
5
|
import { CheckboxGroup } from './CheckboxGroup/CheckboxGroup.js';
|
|
4
6
|
import { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.context.js';
|
|
7
|
+
import { leafValues, ChoiceText } from './ChoiceText.js';
|
|
5
8
|
import { useUid } from '../../utils/useUid/index.js';
|
|
9
|
+
import { useControllableState } from '../../utils/useControllableState/index.js';
|
|
6
10
|
import { classNames } from '../../utils/classNames/index.js';
|
|
7
11
|
|
|
8
|
-
const
|
|
12
|
+
const CheckboxBase = React.forwardRef((props, ref) => {
|
|
9
13
|
const {
|
|
10
14
|
id,
|
|
11
15
|
label,
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
description,
|
|
17
|
+
detail,
|
|
18
|
+
children,
|
|
14
19
|
value,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isRichSelector,
|
|
20
|
+
variant = "default",
|
|
21
|
+
indeterminate = false,
|
|
18
22
|
checked,
|
|
23
|
+
defaultChecked,
|
|
19
24
|
onChange,
|
|
25
|
+
onCheckedChange,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
20
28
|
...others
|
|
21
29
|
} = props;
|
|
22
30
|
const ctx = useCheckboxGroupContext();
|
|
23
31
|
const uid = useUid(id);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const [ownChecked, setOwnChecked] = useControllableState({
|
|
33
|
+
value: checked,
|
|
34
|
+
defaultValue: defaultChecked ?? false,
|
|
35
|
+
onChange: onCheckedChange
|
|
36
|
+
});
|
|
37
|
+
const inputRef = React.useRef(null);
|
|
38
|
+
const mergedRef = useMergeRefs([inputRef, ref]);
|
|
39
|
+
const nested = React.useMemo(() => children != null ? leafValues(children) : [], [children]);
|
|
40
|
+
const parent = ctx != null && nested.length > 0;
|
|
41
|
+
const nestedChecked = parent ? nested.filter((item) => ctx.value.includes(item)).length : 0;
|
|
42
|
+
const isIndeterminate = parent ? nestedChecked > 0 && nestedChecked < nested.length : indeterminate;
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;
|
|
45
|
+
}, [isIndeterminate]);
|
|
46
|
+
const isChecked = parent ? nestedChecked === nested.length : ctx ? ctx.value.includes(value) : ownChecked;
|
|
47
|
+
const handleChange = (event) => {
|
|
48
|
+
onChange?.(event);
|
|
49
|
+
if (parent) {
|
|
50
|
+
const others2 = ctx.value.filter((item) => !nested.includes(item));
|
|
51
|
+
ctx.setValue(event.target.checked ? [...others2, ...nested] : others2);
|
|
52
|
+
} else if (ctx) ctx.onChange(event);
|
|
53
|
+
else setOwnChecked(event.target.checked);
|
|
32
54
|
};
|
|
33
|
-
|
|
55
|
+
const choice = /* @__PURE__ */ jsxs(
|
|
34
56
|
"label",
|
|
35
57
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
className: classNames("roaster-choice", { "roaster-choice--card": variant === "card" }, className),
|
|
59
|
+
style,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
...others,
|
|
65
|
+
ref: mergedRef,
|
|
66
|
+
id: uid,
|
|
67
|
+
type: "checkbox",
|
|
68
|
+
value,
|
|
69
|
+
checked: isChecked,
|
|
70
|
+
onChange: handleChange,
|
|
71
|
+
className: "roaster-choice__input"
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: "roaster-choice__box" }),
|
|
75
|
+
/* @__PURE__ */ jsx(ChoiceText, { label, description, detail, labelId: `${uid}-label` })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
56
78
|
);
|
|
79
|
+
if (children == null) return choice;
|
|
80
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
+
choice,
|
|
82
|
+
/* @__PURE__ */ jsx("div", { className: "roaster-choice-group roaster-choice-group--nested", role: "group", "aria-labelledby": `${uid}-label`, children })
|
|
83
|
+
] });
|
|
57
84
|
});
|
|
58
|
-
|
|
59
|
-
Checkbox.Group
|
|
85
|
+
CheckboxBase.displayName = "Checkbox";
|
|
86
|
+
const Checkbox = Object.assign(CheckboxBase, { Group: CheckboxGroup });
|
|
60
87
|
|
|
61
88
|
export { Checkbox };
|
|
62
89
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMergeRefs } from '@floating-ui/react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.context';\nimport { ChoiceText, leafValues } from './ChoiceText';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `onChange`, `aria-*`, ...) is accepted and forwarded to the\n * checkbox, with the ref. `className` and `style` go to its label.\n */\nexport interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'value'> {\n /** The value submitted with the form when checked, and the value a `Checkbox.Group` holds. */\n value: string;\n /** The text next to the box. */\n label?: React.ReactNode;\n /** A line under the label, such as what the choice means. */\n description?: React.ReactNode;\n /** A short text at the end of the row, such as the kind of a name (\"Recipient\"). */\n detail?: React.ReactNode;\n /**\n * The checkboxes under this one, in a `Checkbox.Group`: checking it checks them all, and it is checked when they\n * all are, mixed when some are. Their values stand for its own.\n */\n children?: React.ReactNode;\n /** `card` draws the checkbox as a bordered card, highlighted while checked. */\n variant?: 'default' | 'card';\n /** The mixed state: some of the items this checkbox stands for are checked, not all. */\n indeterminate?: boolean;\n /** Called with the new checked state when the user toggles the checkbox. */\n onCheckedChange?(checked: boolean): void;\n}\n\nconst CheckboxBase = React.forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n const {\n id,\n label,\n description,\n detail,\n children,\n value,\n variant = 'default',\n indeterminate = false,\n checked,\n defaultChecked,\n onChange,\n onCheckedChange,\n className,\n style,\n ...others\n } = props;\n const ctx = useCheckboxGroupContext();\n const uid = useUid(id);\n // On its own, the checkbox follows `checked`, or keeps its own state from `defaultChecked`.\n const [ownChecked, setOwnChecked] = useControllableState({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n // `indeterminate` is a DOM property, not an attribute.\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n // With checkboxes under it, in a group, it stands for them.\n const nested = React.useMemo(() => (children != null ? leafValues(children) : []), [children]);\n const parent = ctx != null && nested.length > 0;\n const nestedChecked = parent ? nested.filter((item) => ctx.value.includes(item)).length : 0;\n const isIndeterminate = parent ? nestedChecked > 0 && nestedChecked < nested.length : indeterminate;\n React.useEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n const isChecked = parent ? nestedChecked === nested.length : ctx ? ctx.value.includes(value) : ownChecked;\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n if (parent) {\n const others = ctx.value.filter((item) => !nested.includes(item));\n ctx.setValue(event.target.checked ? [...others, ...nested] : others);\n } else if (ctx) ctx.onChange(event);\n else setOwnChecked(event.target.checked);\n };\n\n const choice = (\n <label\n className={classNames('roaster-choice', { 'roaster-choice--card': variant === 'card' }, className)}\n style={style}\n >\n <input\n {...others}\n ref={mergedRef}\n id={uid}\n type=\"checkbox\"\n value={value}\n checked={isChecked}\n onChange={handleChange}\n className=\"roaster-choice__input\"\n />\n <span className=\"roaster-choice__box\" />\n <ChoiceText label={label} description={description} detail={detail} labelId={`${uid}-label`} />\n </label>\n );\n if (children == null) return choice;\n return (\n <>\n {choice}\n <div className=\"roaster-choice-group roaster-choice-group--nested\" role=\"group\" aria-labelledby={`${uid}-label`}>\n {children}\n </div>\n </>\n );\n});\n\nCheckboxBase.displayName = 'Checkbox';\n\n/**\n * A checkbox with a label. Use Checkbox.Group to manage several values together, and `variant=\"card\"` for a\n * card-style option.\n */\nexport const Checkbox = Object.assign(CheckboxBase, { Group: CheckboxGroup });\n"],"names":[],"mappings":";;;;;;;;;;;AAQA,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,OAAO,GAAG,SAAS;AACvB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,OAAO;AACX,IAAI,cAAc;AAClB,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,GAAG,GAAG,uBAAuB,EAAE;AACvC,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,oBAAoB,CAAC;AAC3D,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,YAAY,EAAE,cAAc,IAAI,KAAK;AACzC,IAAI,QAAQ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KAAK,EAAE,EAAE,SAAS,EAAE,mDAAmD,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE;AAC7J,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.context.js","sources":["../../../../../src/components/Checkbox/CheckboxGroup/CheckboxGroup.context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface CheckboxGroupContextValue {\n value: string[];\n onChange(event: React.ChangeEvent<HTMLInputElement>): void;\n}\n\n/** `null` when a Checkbox is rendered outside of a `Checkbox.Group`. */\nconst CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null);\nexport const CheckboxGroupProvider = CheckboxGroupContext.Provider;\nexport const useCheckboxGroupContext = () => useContext(CheckboxGroupContext);\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.context.js","sources":["../../../../../src/components/Checkbox/CheckboxGroup/CheckboxGroup.context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface CheckboxGroupContextValue {\n value: string[];\n onChange(event: React.ChangeEvent<HTMLInputElement>): void;\n /** Replaces the checked values, such as when a checkbox with checkboxes under it is toggled. */\n setValue(value: string[]): void;\n}\n\n/** `null` when a Checkbox is rendered outside of a `Checkbox.Group`. */\nconst CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null);\nexport const CheckboxGroupProvider = CheckboxGroupContext.Provider;\nexport const useCheckboxGroupContext = () => useContext(CheckboxGroupContext);\n"],"names":[],"mappings":";;;AAEA,MAAM,oBAAoB,GAAG,aAAa,CAAC,IAAI,CAAC;AACpC,MAAC,qBAAqB,GAAG,oBAAoB,CAAC;AAC9C,MAAC,uBAAuB,GAAG,MAAM,UAAU,CAAC,oBAAoB;;"}
|