@ultraviolet/ui 1.51.0 → 1.51.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionBar/index.d.ts +20 -0
- package/dist/components/ActionBar/index.js +40 -0
- package/dist/components/Alert/index.d.ts +27 -0
- package/dist/components/Alert/index.js +126 -0
- package/dist/components/Avatar/index.d.ts +43 -0
- package/dist/components/Avatar/index.js +54 -0
- package/dist/components/Badge/index.d.ts +31 -0
- package/dist/components/Badge/index.js +115 -0
- package/dist/components/Banner/assets/default-image-small.svg.js +4 -0
- package/dist/components/Banner/assets/default-image.svg.js +4 -0
- package/dist/components/Banner/index.d.ts +24 -0
- package/dist/components/Banner/index.js +191 -0
- package/dist/components/BarChart/Tooltip.d.ts +9 -0
- package/dist/components/BarChart/Tooltip.js +36 -0
- package/dist/components/BarChart/index.d.ts +27 -0
- package/dist/components/BarChart/index.js +82 -0
- package/dist/components/BarStack/index.d.ts +36 -0
- package/dist/components/BarStack/index.js +188 -0
- package/dist/components/Breadcrumbs/index.d.ts +30 -0
- package/dist/components/Breadcrumbs/index.js +76 -0
- package/dist/components/Bullet/index.d.ts +39 -0
- package/dist/components/Bullet/index.js +88 -0
- package/dist/components/Button/index.d.ts +120 -0
- package/dist/components/Button/index.js +291 -0
- package/dist/components/Card/index.d.ts +20 -0
- package/dist/components/Card/index.js +59 -0
- package/dist/components/Carousel/index.d.ts +19 -0
- package/dist/components/Carousel/index.js +147 -0
- package/dist/components/Checkbox/index.d.ts +36 -0
- package/dist/components/Checkbox/index.js +359 -0
- package/dist/components/CheckboxGroup/index.d.ts +24 -0
- package/dist/components/CheckboxGroup/index.js +112 -0
- package/dist/components/CopyButton/index.d.ts +19 -0
- package/dist/components/CopyButton/index.js +37 -0
- package/dist/components/DateInput/datepicker.css.js +4 -0
- package/dist/components/DateInput/index.d.ts +38 -0
- package/dist/components/DateInput/index.js +301 -0
- package/dist/components/Dialog/Context.d.ts +7 -0
- package/dist/components/Dialog/Context.js +15 -0
- package/dist/components/Dialog/constants.d.ts +2 -0
- package/dist/components/Dialog/index.d.ts +87 -0
- package/dist/components/Dialog/index.js +87 -0
- package/dist/components/Dialog/subComponents/Button.d.ts +7 -0
- package/dist/components/Dialog/subComponents/Button.js +24 -0
- package/dist/components/Dialog/subComponents/Buttons.d.ts +7 -0
- package/dist/components/Dialog/subComponents/Buttons.js +12 -0
- package/dist/components/Dialog/subComponents/CancelButton.d.ts +8 -0
- package/dist/components/Dialog/subComponents/CancelButton.js +9 -0
- package/dist/components/Dialog/subComponents/Stack.d.ts +6 -0
- package/dist/components/Dialog/subComponents/Stack.js +6 -0
- package/dist/components/Dialog/subComponents/Text.d.ts +6 -0
- package/dist/components/Dialog/subComponents/Text.js +6 -0
- package/dist/components/EmptyState/index.d.ts +38 -0
- package/dist/components/EmptyState/index.js +82 -0
- package/dist/components/Expandable/index.d.ts +33 -0
- package/dist/components/Expandable/index.js +79 -0
- package/dist/components/GlobalAlert/GlobalAlertLink.d.ts +3 -0
- package/dist/components/GlobalAlert/GlobalAlertLink.js +39 -0
- package/dist/components/GlobalAlert/index.d.ts +40 -0
- package/dist/components/GlobalAlert/index.js +112 -0
- package/dist/components/LineChart/CustomLegend.d.ts +13 -0
- package/dist/components/LineChart/CustomLegend.js +109 -0
- package/dist/components/LineChart/Tooltip.d.ts +6 -0
- package/dist/components/LineChart/Tooltip.js +46 -0
- package/dist/components/LineChart/helpers.d.ts +8 -0
- package/dist/components/LineChart/helpers.js +50 -0
- package/dist/components/LineChart/index.d.ts +25 -0
- package/dist/components/LineChart/index.js +118 -0
- package/dist/components/Link/index.d.ts +33 -0
- package/dist/components/Link/index.js +167 -0
- package/dist/components/List/Body.d.ts +6 -0
- package/dist/components/List/Body.js +11 -0
- package/dist/components/List/Cell.d.ts +12 -0
- package/dist/components/List/Cell.js +38 -0
- package/dist/components/List/HeaderCell.d.ts +11 -0
- package/dist/components/List/HeaderCell.js +96 -0
- package/dist/components/List/HeaderRow.d.ts +7 -0
- package/dist/components/List/HeaderRow.js +38 -0
- package/dist/components/List/ListContext.d.ts +34 -0
- package/dist/components/List/ListContext.js +155 -0
- package/dist/components/List/Row.d.ts +23 -0
- package/dist/components/List/Row.js +194 -0
- package/dist/components/List/SelectBar.d.ts +15 -0
- package/dist/components/List/SelectBar.js +35 -0
- package/dist/components/List/SkeletonRows.d.ts +7 -0
- package/dist/components/List/SkeletonRows.js +36 -0
- package/dist/components/List/constants.d.ts +2 -0
- package/dist/{src/components → components}/List/constants.js +4 -2
- package/dist/components/List/index.d.ts +68 -0
- package/dist/components/List/index.js +80 -0
- package/dist/components/Loader/index.d.ts +22 -0
- package/dist/components/Loader/index.js +98 -0
- package/dist/components/Menu/Item.d.ts +15 -0
- package/dist/components/Menu/Item.js +101 -0
- package/dist/components/Menu/index.d.ts +49 -0
- package/dist/components/Menu/index.js +182 -0
- package/dist/components/MenuV2/Group.d.ts +7 -0
- package/dist/components/MenuV2/Group.js +23 -0
- package/dist/components/MenuV2/Item.d.ts +16 -0
- package/dist/components/MenuV2/Item.js +120 -0
- package/dist/components/MenuV2/index.d.ts +90 -0
- package/dist/components/MenuV2/index.js +124 -0
- package/dist/components/Meter/index.d.ts +26 -0
- package/dist/components/Meter/index.js +76 -0
- package/dist/components/Modal/Dialog.d.ts +3 -0
- package/dist/components/Modal/Dialog.js +197 -0
- package/dist/components/Modal/Disclosure.d.ts +3 -0
- package/dist/{src/components → components}/Modal/Disclosure.js +12 -12
- package/dist/components/Modal/constants.d.ts +3 -0
- package/dist/{src/components → components}/Modal/constants.js +8 -6
- package/dist/components/Modal/index.d.ts +42 -0
- package/dist/components/Modal/index.js +114 -0
- package/dist/components/Modal/types.d.ts +48 -0
- package/dist/components/Notice/index.d.ts +11 -0
- package/dist/components/Notice/index.js +39 -0
- package/dist/components/Notification/index.d.ts +36 -0
- package/dist/components/Notification/index.js +88 -0
- package/dist/components/Notification/react-toastify.css.js +4 -0
- package/dist/components/NumberInput/helpers.d.ts +4 -0
- package/dist/{src/components → components}/NumberInput/helpers.js +6 -2
- package/dist/components/NumberInput/index.d.ts +41 -0
- package/dist/components/NumberInput/index.js +349 -0
- package/dist/components/NumberInputV2/index.d.ts +27 -0
- package/dist/components/NumberInputV2/index.js +370 -0
- package/dist/components/Pagination/getPageNumbers.d.ts +8 -0
- package/dist/{src/components → components}/Pagination/getPageNumbers.js +4 -12
- package/dist/components/Pagination/index.d.ts +30 -0
- package/dist/components/Pagination/index.js +124 -0
- package/dist/components/PasswordCheck/index.d.ts +20 -0
- package/dist/components/PasswordCheck/index.js +29 -0
- package/dist/components/PasswordStrengthMeter/index.d.ts +39 -0
- package/dist/components/PasswordStrengthMeter/index.js +98 -0
- package/dist/components/PieChart/Legends.d.ts +9 -0
- package/dist/components/PieChart/Legends.js +120 -0
- package/dist/components/PieChart/Tooltip.d.ts +12 -0
- package/dist/components/PieChart/Tooltip.js +29 -0
- package/dist/components/PieChart/index.d.ts +20 -0
- package/dist/components/PieChart/index.js +120 -0
- package/dist/components/PieChart/types.d.ts +7 -0
- package/dist/components/Popover/index.d.ts +55 -0
- package/dist/components/Popover/index.js +149 -0
- package/dist/components/Popup/animations.d.ts +11 -0
- package/dist/{src/components → components}/Popup/animations.js +7 -6
- package/dist/components/Popup/helpers.d.ts +31 -0
- package/dist/components/Popup/helpers.js +204 -0
- package/dist/components/Popup/index.d.ts +72 -0
- package/dist/components/Popup/index.js +385 -0
- package/dist/components/ProgressBar/index.d.ts +14 -0
- package/dist/components/ProgressBar/index.js +71 -0
- package/dist/components/Radio/index.d.ts +21 -0
- package/dist/components/Radio/index.js +202 -0
- package/dist/components/RadioGroup/index.d.ts +25 -0
- package/dist/components/RadioGroup/index.js +104 -0
- package/dist/components/Row/index.d.ts +22 -0
- package/dist/components/Row/index.js +43 -0
- package/dist/components/SelectInput/index.d.ts +75 -0
- package/dist/components/SelectInput/index.js +563 -0
- package/dist/components/SelectInputV2/Dropdown.d.ts +23 -0
- package/dist/components/SelectInputV2/Dropdown.js +669 -0
- package/dist/components/SelectInputV2/DropdownOption.d.ts +8 -0
- package/dist/components/SelectInputV2/DropdownOption.js +133 -0
- package/dist/components/SelectInputV2/SearchBarDropdown.d.ts +9 -0
- package/dist/components/SelectInputV2/SearchBarDropdown.js +123 -0
- package/dist/components/SelectInputV2/SelectBar.d.ts +14 -0
- package/dist/components/SelectInputV2/SelectBar.js +327 -0
- package/dist/components/SelectInputV2/SelectInputProvider.d.ts +41 -0
- package/dist/components/SelectInputV2/SelectInputProvider.js +203 -0
- package/dist/components/SelectInputV2/findOptionInOptions.d.ts +2 -0
- package/dist/components/SelectInputV2/findOptionInOptions.js +12 -0
- package/dist/components/SelectInputV2/index.d.ts +115 -0
- package/dist/components/SelectInputV2/index.js +146 -0
- package/dist/components/SelectInputV2/types.d.ts +38 -0
- package/dist/{src/components → components}/SelectInputV2/types.js +4 -2
- package/dist/components/SelectableCard/index.d.ts +25 -0
- package/dist/components/SelectableCard/index.js +193 -0
- package/dist/components/SelectableCardGroup/index.d.ts +23 -0
- package/dist/components/SelectableCardGroup/index.js +112 -0
- package/dist/components/Separator/index.d.ts +17 -0
- package/dist/components/Separator/index.js +76 -0
- package/dist/components/Skeleton/Block.d.ts +3 -0
- package/dist/components/Skeleton/Block.js +30 -0
- package/dist/components/Skeleton/Blocks.d.ts +4 -0
- package/dist/components/Skeleton/Blocks.js +28 -0
- package/dist/components/Skeleton/BoxWithIcon.d.ts +4 -0
- package/dist/components/Skeleton/BoxWithIcon.js +29 -0
- package/dist/components/Skeleton/Donut.d.ts +1 -0
- package/dist/components/Skeleton/Donut.js +36 -0
- package/dist/components/Skeleton/IconSkeleton.d.ts +5 -0
- package/dist/components/Skeleton/IconSkeleton.js +12 -0
- package/dist/components/Skeleton/Line.d.ts +5 -0
- package/dist/components/Skeleton/Line.js +13 -0
- package/dist/components/Skeleton/List.d.ts +4 -0
- package/dist/components/Skeleton/List.js +29 -0
- package/dist/components/Skeleton/Slider.d.ts +3 -0
- package/dist/components/Skeleton/Slider.js +26 -0
- package/dist/components/Skeleton/Square.d.ts +5 -0
- package/dist/components/Skeleton/Square.js +10 -0
- package/dist/components/Skeleton/index.d.ts +47 -0
- package/dist/components/Skeleton/index.js +86 -0
- package/dist/components/Snippet/index.d.ts +23 -0
- package/dist/components/Snippet/index.js +171 -0
- package/dist/components/Stack/index.d.ts +23 -0
- package/dist/components/Stack/index.js +36 -0
- package/dist/components/Status/index.d.ts +32 -0
- package/dist/components/Status/index.js +57 -0
- package/dist/components/StepList/index.d.ts +33 -0
- package/dist/components/StepList/index.js +69 -0
- package/dist/components/Stepper/index.d.ts +15 -0
- package/dist/components/Stepper/index.js +153 -0
- package/dist/components/SwitchButton/FocusOverlay.d.ts +8 -0
- package/dist/components/SwitchButton/FocusOverlay.js +47 -0
- package/dist/components/SwitchButton/index.d.ts +26 -0
- package/dist/components/SwitchButton/index.js +140 -0
- package/dist/components/Table/Body.d.ts +6 -0
- package/dist/components/Table/Body.js +5 -0
- package/dist/components/Table/Cell.d.ts +9 -0
- package/dist/components/Table/Cell.js +10 -0
- package/dist/components/Table/Header.d.ts +6 -0
- package/dist/components/Table/Header.js +9 -0
- package/dist/components/Table/HeaderCell.d.ts +14 -0
- package/dist/components/Table/HeaderCell.js +123 -0
- package/dist/components/Table/HeaderRow.d.ts +7 -0
- package/dist/components/Table/HeaderRow.js +25 -0
- package/dist/components/Table/Row.d.ts +14 -0
- package/dist/components/Table/Row.js +85 -0
- package/dist/components/Table/SelectBar.d.ts +15 -0
- package/dist/components/Table/SelectBar.js +35 -0
- package/dist/components/Table/SkeletonRows.d.ts +7 -0
- package/dist/components/Table/SkeletonRows.js +22 -0
- package/dist/components/Table/TableContext.d.ts +27 -0
- package/dist/components/Table/TableContext.js +103 -0
- package/dist/components/Table/index.d.ts +60 -0
- package/dist/components/Table/index.js +81 -0
- package/dist/components/Tabs/Tab.d.ts +20 -0
- package/dist/components/Tabs/Tab.js +170 -0
- package/dist/components/Tabs/TabMenu.d.ts +8 -0
- package/dist/components/Tabs/TabMenu.js +63 -0
- package/dist/components/Tabs/TabMenuItem.d.ts +20 -0
- package/dist/components/Tabs/TabMenuItem.js +39 -0
- package/dist/components/Tabs/TabsContext.d.ts +8 -0
- package/dist/components/Tabs/TabsContext.js +9 -0
- package/dist/components/Tabs/index.d.ts +50 -0
- package/dist/components/Tabs/index.js +137 -0
- package/dist/components/Tag/index.d.ts +26 -0
- package/dist/components/Tag/index.js +153 -0
- package/dist/components/TagInput/index.d.ts +55 -0
- package/dist/components/TagInput/index.js +316 -0
- package/dist/components/TagList/index.d.ts +37 -0
- package/dist/components/TagList/index.js +103 -0
- package/dist/components/Text/index.d.ts +40 -0
- package/dist/components/Text/index.js +107 -0
- package/dist/components/TextArea/index.d.ts +50 -0
- package/dist/components/TextArea/index.js +226 -0
- package/dist/components/TextInput/index.d.ts +75 -0
- package/dist/components/TextInput/index.js +472 -0
- package/dist/components/TextInputV2/index.d.ts +30 -0
- package/dist/components/TextInputV2/index.js +314 -0
- package/dist/components/TimeInput/index.d.ts +25 -0
- package/dist/components/TimeInput/index.js +199 -0
- package/dist/components/Toaster/index.d.ts +46 -0
- package/dist/components/Toaster/index.js +131 -0
- package/dist/components/Toaster/react-toastify.css.js +4 -0
- package/dist/components/Toggle/index.d.ts +34 -0
- package/dist/components/Toggle/index.js +196 -0
- package/dist/components/ToggleGroup/index.d.ts +24 -0
- package/dist/components/ToggleGroup/index.js +87 -0
- package/dist/components/Tooltip/index.d.ts +9 -0
- package/dist/components/Tooltip/index.js +47 -0
- package/dist/components/VerificationCode/index.d.ts +36 -0
- package/dist/components/VerificationCode/index.js +222 -0
- package/dist/components/index.d.ts +75 -0
- package/dist/helpers/isJSON.d.ts +2 -0
- package/dist/{src/helpers → helpers}/isJSON.js +4 -3
- package/dist/helpers/jestMockMatchMedia.d.ts +6 -0
- package/dist/helpers/keycode.d.ts +3 -0
- package/dist/helpers/legend.d.ts +2 -0
- package/dist/helpers/legend.js +14 -0
- package/dist/helpers/numbers.d.ts +2 -0
- package/dist/helpers/recursivelyGetChildrenString.d.ts +3 -0
- package/dist/helpers/recursivelyGetChildrenString.js +15 -0
- package/dist/hooks/useIsOverflowing.d.ts +5 -0
- package/dist/hooks/useIsOverflowing.js +23 -0
- package/dist/index.d.ts +4 -3693
- package/dist/index.js +187 -0
- package/dist/mocks/list.d.ts +12 -0
- package/dist/theme/index.d.ts +1573 -0
- package/dist/theme/index.js +30 -0
- package/dist/types.d.ts +6 -0
- package/dist/utils/animations.d.ts +27 -0
- package/dist/{src/utils → utils}/animations.js +30 -4
- package/dist/utils/capitalize.d.ts +2 -0
- package/dist/utils/capitalize.js +4 -0
- package/dist/utils/ids.d.ts +1 -0
- package/dist/utils/ids.js +6 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/normalize.d.ts +2 -0
- package/dist/{src/utils → utils}/normalize.js +4 -3
- package/dist/utils/orderBy.d.ts +2 -0
- package/dist/utils/responsive/Breakpoint.d.ts +9 -0
- package/dist/utils/responsive/Breakpoint.js +13 -0
- package/dist/utils/responsive/index.d.ts +2 -0
- package/dist/utils/responsive/utilities.d.ts +3 -0
- package/dist/{src/utils → utils}/responsive/utilities.js +9 -6
- package/package.json +23 -13
- package/dist/react-datepicker/dist/react-datepicker.min.css.js +0 -3
- package/dist/react-toastify/dist/ReactToastify.min.css.js +0 -3
- package/dist/src/components/ActionBar/index.js +0 -40
- package/dist/src/components/Alert/index.js +0 -133
- package/dist/src/components/Avatar/index.js +0 -74
- package/dist/src/components/Badge/index.js +0 -116
- package/dist/src/components/Banner/assets/default-image-small.svg.js +0 -5
- package/dist/src/components/Banner/assets/default-image.svg.js +0 -5
- package/dist/src/components/Banner/index.js +0 -159
- package/dist/src/components/BarChart/Tooltip.js +0 -48
- package/dist/src/components/BarChart/index.js +0 -95
- package/dist/src/components/BarStack/index.js +0 -136
- package/dist/src/components/Breadcrumbs/index.js +0 -82
- package/dist/src/components/Bullet/index.js +0 -98
- package/dist/src/components/Button/index.js +0 -311
- package/dist/src/components/Card/index.js +0 -67
- package/dist/src/components/Carousel/index.js +0 -128
- package/dist/src/components/Checkbox/index.js +0 -316
- package/dist/src/components/CheckboxGroup/index.js +0 -143
- package/dist/src/components/CopyButton/index.js +0 -37
- package/dist/src/components/DateInput/index.js +0 -242
- package/dist/src/components/Dialog/Context.js +0 -12
- package/dist/src/components/Dialog/index.js +0 -88
- package/dist/src/components/Dialog/subComponents/Button.js +0 -21
- package/dist/src/components/Dialog/subComponents/Buttons.js +0 -14
- package/dist/src/components/Dialog/subComponents/CancelButton.js +0 -14
- package/dist/src/components/Dialog/subComponents/Stack.js +0 -11
- package/dist/src/components/Dialog/subComponents/Text.js +0 -12
- package/dist/src/components/EmptyState/index.js +0 -112
- package/dist/src/components/Expandable/index.js +0 -96
- package/dist/src/components/GlobalAlert/GlobalAlertLink.js +0 -38
- package/dist/src/components/GlobalAlert/index.js +0 -82
- package/dist/src/components/LineChart/CustomLegend.js +0 -138
- package/dist/src/components/LineChart/Tooltip.js +0 -43
- package/dist/src/components/LineChart/helpers.js +0 -40
- package/dist/src/components/LineChart/index.js +0 -131
- package/dist/src/components/Link/index.js +0 -147
- package/dist/src/components/List/Body.js +0 -16
- package/dist/src/components/List/Cell.js +0 -43
- package/dist/src/components/List/HeaderCell.js +0 -90
- package/dist/src/components/List/HeaderRow.js +0 -43
- package/dist/src/components/List/ListContext.js +0 -138
- package/dist/src/components/List/Row.js +0 -185
- package/dist/src/components/List/SelectBar.js +0 -48
- package/dist/src/components/List/SkeletonRows.js +0 -53
- package/dist/src/components/List/index.js +0 -75
- package/dist/src/components/Loader/index.js +0 -100
- package/dist/src/components/Menu/Item.js +0 -112
- package/dist/src/components/Menu/index.js +0 -129
- package/dist/src/components/MenuV2/Group.js +0 -25
- package/dist/src/components/MenuV2/Item.js +0 -139
- package/dist/src/components/MenuV2/index.js +0 -116
- package/dist/src/components/Meter/index.js +0 -76
- package/dist/src/components/Modal/Dialog.js +0 -182
- package/dist/src/components/Modal/index.js +0 -113
- package/dist/src/components/Notice/index.js +0 -34
- package/dist/src/components/Notification/index.js +0 -77
- package/dist/src/components/NumberInput/index.js +0 -299
- package/dist/src/components/NumberInputV2/index.js +0 -284
- package/dist/src/components/Pagination/index.js +0 -117
- package/dist/src/components/PasswordCheck/index.js +0 -41
- package/dist/src/components/PasswordStrengthMeter/index.js +0 -102
- package/dist/src/components/PieChart/Legends.js +0 -138
- package/dist/src/components/PieChart/Tooltip.js +0 -61
- package/dist/src/components/PieChart/index.js +0 -125
- package/dist/src/components/Popover/index.js +0 -144
- package/dist/src/components/Popup/helpers.js +0 -252
- package/dist/src/components/Popup/index.js +0 -363
- package/dist/src/components/ProgressBar/index.js +0 -57
- package/dist/src/components/Radio/index.js +0 -157
- package/dist/src/components/RadioGroup/index.js +0 -131
- package/dist/src/components/Row/index.js +0 -41
- package/dist/src/components/SelectInput/index.js +0 -610
- package/dist/src/components/SelectInputV2/Dropdown.js +0 -594
- package/dist/src/components/SelectInputV2/DropdownOption.js +0 -130
- package/dist/src/components/SelectInputV2/SearchBarDropdown.js +0 -128
- package/dist/src/components/SelectInputV2/SelectBar.js +0 -282
- package/dist/src/components/SelectInputV2/SelectInputProvider.js +0 -169
- package/dist/src/components/SelectInputV2/findOptionInOptions.js +0 -11
- package/dist/src/components/SelectInputV2/index.js +0 -137
- package/dist/src/components/SelectableCard/index.js +0 -175
- package/dist/src/components/SelectableCardGroup/index.js +0 -141
- package/dist/src/components/Separator/index.js +0 -73
- package/dist/src/components/Skeleton/Block.js +0 -35
- package/dist/src/components/Skeleton/Blocks.js +0 -34
- package/dist/src/components/Skeleton/BoxWithIcon.js +0 -32
- package/dist/src/components/Skeleton/Donut.js +0 -55
- package/dist/src/components/Skeleton/IconSkeleton.js +0 -19
- package/dist/src/components/Skeleton/Line.js +0 -13
- package/dist/src/components/Skeleton/List.js +0 -51
- package/dist/src/components/Skeleton/Slider.js +0 -36
- package/dist/src/components/Skeleton/Square.js +0 -9
- package/dist/src/components/Skeleton/index.js +0 -82
- package/dist/src/components/Snippet/index.js +0 -200
- package/dist/src/components/Stack/index.js +0 -29
- package/dist/src/components/Status/index.js +0 -74
- package/dist/src/components/StepList/index.js +0 -69
- package/dist/src/components/Stepper/index.js +0 -150
- package/dist/src/components/SwitchButton/FocusOverlay.js +0 -37
- package/dist/src/components/SwitchButton/index.js +0 -108
- package/dist/src/components/Table/Body.js +0 -9
- package/dist/src/components/Table/Cell.js +0 -21
- package/dist/src/components/Table/Header.js +0 -15
- package/dist/src/components/Table/HeaderCell.js +0 -103
- package/dist/src/components/Table/HeaderRow.js +0 -32
- package/dist/src/components/Table/Row.js +0 -89
- package/dist/src/components/Table/SelectBar.js +0 -48
- package/dist/src/components/Table/SkeletonRows.js +0 -51
- package/dist/src/components/Table/TableContext.js +0 -90
- package/dist/src/components/Table/index.js +0 -82
- package/dist/src/components/Tabs/Tab.js +0 -138
- package/dist/src/components/Tabs/TabMenu.js +0 -59
- package/dist/src/components/Tabs/TabMenuItem.js +0 -36
- package/dist/src/components/Tabs/TabsContext.js +0 -6
- package/dist/src/components/Tabs/index.js +0 -117
- package/dist/src/components/Tag/index.js +0 -169
- package/dist/src/components/TagInput/index.js +0 -309
- package/dist/src/components/TagList/index.js +0 -106
- package/dist/src/components/Text/index.js +0 -107
- package/dist/src/components/TextArea/index.js +0 -210
- package/dist/src/components/TextInput/index.js +0 -451
- package/dist/src/components/TextInputV2/index.js +0 -289
- package/dist/src/components/TimeInput/index.js +0 -37
- package/dist/src/components/Toaster/index.js +0 -131
- package/dist/src/components/Toggle/index.js +0 -160
- package/dist/src/components/ToggleGroup/index.js +0 -122
- package/dist/src/components/Tooltip/index.js +0 -55
- package/dist/src/components/VerificationCode/index.js +0 -222
- package/dist/src/helpers/legend.js +0 -13
- package/dist/src/helpers/recursivelyGetChildrenString.js +0 -11
- package/dist/src/hooks/useIsOverflowing.js +0 -34
- package/dist/src/index.js +0 -77
- package/dist/src/theme/index.js +0 -29
- package/dist/src/utils/capitalize.js +0 -3
- package/dist/src/utils/ids.js +0 -7
- package/dist/src/utils/responsive/Breakpoint.js +0 -12
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentProps, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import type { Checkbox } from '../Checkbox';
|
|
3
|
+
type RowState = Record<string, boolean>;
|
|
4
|
+
type ListContextValue = {
|
|
5
|
+
/**
|
|
6
|
+
* @returns an unregister function
|
|
7
|
+
* */
|
|
8
|
+
registerExpandableRow: (rowId: string) => () => void;
|
|
9
|
+
expandedRowIds: RowState;
|
|
10
|
+
expandRow: (rowId: string) => void;
|
|
11
|
+
collapseRow: (rowId: string) => void;
|
|
12
|
+
expandButton: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @returns an unregister function
|
|
15
|
+
* */
|
|
16
|
+
registerSelectableRow: (rowId: string) => () => void;
|
|
17
|
+
selectedRowIds: RowState;
|
|
18
|
+
selectRow: (rowId: string) => void;
|
|
19
|
+
unselectRow: (rowId: string) => void;
|
|
20
|
+
selectable: boolean;
|
|
21
|
+
allRowSelectValue: ComponentProps<typeof Checkbox>['checked'];
|
|
22
|
+
selectAll: () => void;
|
|
23
|
+
unselectAll: () => void;
|
|
24
|
+
};
|
|
25
|
+
type ListProviderProps = {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
autoCollapse: boolean;
|
|
28
|
+
selectable: boolean;
|
|
29
|
+
expandButton: boolean;
|
|
30
|
+
onSelectedChange?: Dispatch<SetStateAction<string[]>>;
|
|
31
|
+
};
|
|
32
|
+
export declare const ListProvider: ({ children, autoCollapse, selectable, expandButton, onSelectedChange, }: ListProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const useListContext: () => ListContextValue;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createContext, useState, useCallback, useMemo, useContext } from "react";
|
|
3
|
+
const ListContext = createContext(void 0);
|
|
4
|
+
const ListProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
autoCollapse,
|
|
7
|
+
selectable,
|
|
8
|
+
expandButton,
|
|
9
|
+
onSelectedChange
|
|
10
|
+
}) => {
|
|
11
|
+
const [expandedRowIds, setExpandedRowIds] = useState({});
|
|
12
|
+
const [selectedRowIds, setSelectedRowIds] = useState({});
|
|
13
|
+
const registerExpandableRow = useCallback((rowId) => {
|
|
14
|
+
setExpandedRowIds((current) => ({ ...current, [rowId]: false }));
|
|
15
|
+
return () => {
|
|
16
|
+
setExpandedRowIds((current) => {
|
|
17
|
+
const { [rowId]: relatedId, ...otherIds } = current;
|
|
18
|
+
return otherIds;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
const registerSelectableRow = useCallback((rowId) => {
|
|
23
|
+
setSelectedRowIds((current) => ({ ...current, [rowId]: false }));
|
|
24
|
+
return () => {
|
|
25
|
+
setSelectedRowIds((current) => {
|
|
26
|
+
const { [rowId]: relatedId, ...otherIds } = current;
|
|
27
|
+
return otherIds;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
const expandRow = useCallback(
|
|
32
|
+
(rowId) => {
|
|
33
|
+
setExpandedRowIds((current) => ({
|
|
34
|
+
...autoCollapse ? {} : current,
|
|
35
|
+
[rowId]: true
|
|
36
|
+
}));
|
|
37
|
+
},
|
|
38
|
+
[autoCollapse]
|
|
39
|
+
);
|
|
40
|
+
const collapseRow = useCallback((rowId) => {
|
|
41
|
+
setExpandedRowIds((current) => ({
|
|
42
|
+
...current,
|
|
43
|
+
[rowId]: false
|
|
44
|
+
}));
|
|
45
|
+
}, []);
|
|
46
|
+
const allRowSelectValue = useMemo(() => {
|
|
47
|
+
const selectableRowCount = Object.keys(selectedRowIds).length;
|
|
48
|
+
if (!selectableRowCount) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const selectedRowCount = Object.values(selectedRowIds).reduce(
|
|
52
|
+
(acc, isSelected) => acc + (isSelected ? 1 : 0),
|
|
53
|
+
0
|
|
54
|
+
);
|
|
55
|
+
if (selectedRowCount === 0) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (selectableRowCount === selectedRowCount) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return "indeterminate";
|
|
62
|
+
}, [selectedRowIds]);
|
|
63
|
+
const selectAll = useCallback(() => {
|
|
64
|
+
const newSelectedRowIds = Object.keys(selectedRowIds).reduce((acc, rowId) => ({ ...acc, [rowId]: true }), {});
|
|
65
|
+
setSelectedRowIds(newSelectedRowIds);
|
|
66
|
+
if (onSelectedChange) {
|
|
67
|
+
onSelectedChange(
|
|
68
|
+
Object.keys(newSelectedRowIds).filter((row) => newSelectedRowIds[row])
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}, [onSelectedChange, selectedRowIds]);
|
|
72
|
+
const unselectAll = useCallback(() => {
|
|
73
|
+
const newSelectedRowIds = Object.keys(selectedRowIds).reduce((acc, rowId) => ({ ...acc, [rowId]: false }), {});
|
|
74
|
+
setSelectedRowIds(newSelectedRowIds);
|
|
75
|
+
if (onSelectedChange) {
|
|
76
|
+
onSelectedChange(
|
|
77
|
+
Object.keys(newSelectedRowIds).filter((row) => newSelectedRowIds[row])
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}, [onSelectedChange, selectedRowIds]);
|
|
81
|
+
const selectRow = useCallback(
|
|
82
|
+
(rowId) => {
|
|
83
|
+
const newSelectedRowIds = {
|
|
84
|
+
...selectedRowIds,
|
|
85
|
+
[rowId]: true
|
|
86
|
+
};
|
|
87
|
+
setSelectedRowIds(newSelectedRowIds);
|
|
88
|
+
if (onSelectedChange) {
|
|
89
|
+
onSelectedChange(
|
|
90
|
+
Object.keys(newSelectedRowIds).filter((row) => newSelectedRowIds[row])
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[onSelectedChange, selectedRowIds]
|
|
95
|
+
);
|
|
96
|
+
const unselectRow = useCallback(
|
|
97
|
+
(rowId) => {
|
|
98
|
+
const newSelectedRowIds = {
|
|
99
|
+
...selectedRowIds,
|
|
100
|
+
[rowId]: false
|
|
101
|
+
};
|
|
102
|
+
setSelectedRowIds(newSelectedRowIds);
|
|
103
|
+
if (onSelectedChange) {
|
|
104
|
+
onSelectedChange(
|
|
105
|
+
Object.keys(newSelectedRowIds).filter((row) => newSelectedRowIds[row])
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[onSelectedChange, selectedRowIds]
|
|
110
|
+
);
|
|
111
|
+
const value = useMemo(
|
|
112
|
+
() => ({
|
|
113
|
+
registerExpandableRow,
|
|
114
|
+
expandedRowIds,
|
|
115
|
+
expandRow,
|
|
116
|
+
collapseRow,
|
|
117
|
+
registerSelectableRow,
|
|
118
|
+
selectedRowIds,
|
|
119
|
+
selectRow,
|
|
120
|
+
unselectRow,
|
|
121
|
+
selectable,
|
|
122
|
+
selectAll,
|
|
123
|
+
unselectAll,
|
|
124
|
+
allRowSelectValue,
|
|
125
|
+
expandButton
|
|
126
|
+
}),
|
|
127
|
+
[
|
|
128
|
+
registerExpandableRow,
|
|
129
|
+
expandedRowIds,
|
|
130
|
+
expandRow,
|
|
131
|
+
collapseRow,
|
|
132
|
+
registerSelectableRow,
|
|
133
|
+
selectedRowIds,
|
|
134
|
+
selectRow,
|
|
135
|
+
unselectRow,
|
|
136
|
+
selectable,
|
|
137
|
+
selectAll,
|
|
138
|
+
unselectAll,
|
|
139
|
+
allRowSelectValue,
|
|
140
|
+
expandButton
|
|
141
|
+
]
|
|
142
|
+
);
|
|
143
|
+
return /* @__PURE__ */ jsx(ListContext.Provider, { value, children });
|
|
144
|
+
};
|
|
145
|
+
const useListContext = () => {
|
|
146
|
+
const context = useContext(ListContext);
|
|
147
|
+
if (!context) {
|
|
148
|
+
throw new Error("useListContext should be used inside a List component");
|
|
149
|
+
}
|
|
150
|
+
return context;
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
ListProvider,
|
|
154
|
+
useListContext
|
|
155
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SENTIMENTS } from '../../theme';
|
|
3
|
+
export declare const StyledRow: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
sentiment: (typeof SENTIMENTS)[number];
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
type RowProps = {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
id: string;
|
|
12
|
+
expandable?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Row cannot be selected if this prop is provided. boolean true disabled selection, a string disable selection and a tooltip will be displayed on checkbox hover.
|
|
15
|
+
* */
|
|
16
|
+
selectDisabled?: boolean | string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
sentiment?: (typeof SENTIMENTS)[number];
|
|
19
|
+
className?: string;
|
|
20
|
+
'data-testid'?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { forwardRef, useEffect } from "react";
|
|
4
|
+
import { Button } from "../Button/index.js";
|
|
5
|
+
import { Checkbox } from "../Checkbox/index.js";
|
|
6
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
7
|
+
import { Cell } from "./Cell.js";
|
|
8
|
+
import { useListContext } from "./ListContext.js";
|
|
9
|
+
const ExpandableWrapper = styled.div`
|
|
10
|
+
grid-column: 1 / -1;
|
|
11
|
+
grid-column-start: 1;
|
|
12
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral.border};
|
|
13
|
+
margin: 0 -${({ theme }) => theme.space["2"]};
|
|
14
|
+
padding: ${({ theme }) => theme.space["2"]};
|
|
15
|
+
cursor: auto;
|
|
16
|
+
background: ${({ theme }) => theme.colors.neutral.backgroundWeak};
|
|
17
|
+
border-radius: 0 0 ${({ theme }) => theme.radii.default}
|
|
18
|
+
${({ theme }) => theme.radii.default};
|
|
19
|
+
`;
|
|
20
|
+
const StyledRow = styled("div", {
|
|
21
|
+
shouldForwardProp: (prop) => !["sentiment"].includes(prop)
|
|
22
|
+
})`
|
|
23
|
+
/* List itself also apply style about common templating between HeaderRow and other Rows */
|
|
24
|
+
|
|
25
|
+
position: relative;
|
|
26
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral.border};
|
|
27
|
+
border-radius: ${({ theme }) => theme.radii.default};
|
|
28
|
+
transition:
|
|
29
|
+
box-shadow 200ms ease,
|
|
30
|
+
border-color 200ms ease;
|
|
31
|
+
box-shadow: none;
|
|
32
|
+
background-color: ${({ theme }) => theme.colors.neutral.background};
|
|
33
|
+
font-size: ${({ theme }) => theme.typography.bodySmall.fontSize};
|
|
34
|
+
column-gap: ${({ theme }) => theme.space["2"]};
|
|
35
|
+
padding: 0 ${({ theme }) => theme.space["2"]};
|
|
36
|
+
|
|
37
|
+
&[role='button row'] {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${({ theme, sentiment }) => `
|
|
42
|
+
color: ${theme.colors[sentiment].text};
|
|
43
|
+
border-color: ${theme.colors[sentiment].border};
|
|
44
|
+
background-color: ${theme.colors[sentiment].background};
|
|
45
|
+
& [data-expandable-content] {
|
|
46
|
+
border-color: ${theme.colors[sentiment].border};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${sentiment === "neutral" ? `&:hover {
|
|
50
|
+
border-color: ${theme.colors.primary.border};
|
|
51
|
+
box-shadow: ${theme.shadows.hoverPrimary};
|
|
52
|
+
}
|
|
53
|
+
` : ""}
|
|
54
|
+
`}
|
|
55
|
+
|
|
56
|
+
&[data-highlight='true'] {
|
|
57
|
+
border-color: ${({ theme }) => theme.colors.primary.border};
|
|
58
|
+
box-shadow: ${({ theme }) => theme.shadows.hoverPrimary};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&[aria-disabled='true'] {
|
|
62
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral.borderDisabled};
|
|
63
|
+
background-color: ${({ theme }) => theme.colors.neutral.backgroundDisabled};
|
|
64
|
+
color: ${({ theme }) => theme.colors.neutral.textDisabled};
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const StyledCheckboxContainer = styled.div`
|
|
69
|
+
display: flex;
|
|
70
|
+
`;
|
|
71
|
+
const Row = forwardRef(
|
|
72
|
+
({
|
|
73
|
+
children,
|
|
74
|
+
id,
|
|
75
|
+
expandable,
|
|
76
|
+
disabled,
|
|
77
|
+
selectDisabled,
|
|
78
|
+
sentiment = "neutral",
|
|
79
|
+
className,
|
|
80
|
+
"data-testid": dataTestid
|
|
81
|
+
}, ref) => {
|
|
82
|
+
const {
|
|
83
|
+
selectable,
|
|
84
|
+
registerExpandableRow,
|
|
85
|
+
expandedRowIds,
|
|
86
|
+
expandRow,
|
|
87
|
+
collapseRow,
|
|
88
|
+
registerSelectableRow,
|
|
89
|
+
selectedRowIds,
|
|
90
|
+
selectRow,
|
|
91
|
+
unselectRow,
|
|
92
|
+
expandButton
|
|
93
|
+
} = useListContext();
|
|
94
|
+
const isSelectDisabled = disabled || selectDisabled !== void 0 && selectDisabled !== false;
|
|
95
|
+
const hasExpandable = !!expandable;
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (hasExpandable) {
|
|
98
|
+
const unregisterCallback = registerExpandableRow(id);
|
|
99
|
+
return unregisterCallback;
|
|
100
|
+
}
|
|
101
|
+
return void 0;
|
|
102
|
+
}, [id, hasExpandable, registerExpandableRow]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!isSelectDisabled) {
|
|
105
|
+
const unregisterCallback = registerSelectableRow(id);
|
|
106
|
+
return unregisterCallback;
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
}, [id, registerSelectableRow, isSelectDisabled]);
|
|
110
|
+
const toggleRowExpand = () => {
|
|
111
|
+
if (expandedRowIds[id]) {
|
|
112
|
+
collapseRow(id);
|
|
113
|
+
} else {
|
|
114
|
+
expandRow(id);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const canClickRowToExpand = !disabled && !!expandable && !expandButton;
|
|
118
|
+
return /* @__PURE__ */ jsxs(
|
|
119
|
+
StyledRow,
|
|
120
|
+
{
|
|
121
|
+
className,
|
|
122
|
+
ref,
|
|
123
|
+
role: canClickRowToExpand ? "button row" : "row",
|
|
124
|
+
onClick: canClickRowToExpand ? toggleRowExpand : void 0,
|
|
125
|
+
onKeyDown: canClickRowToExpand ? (event) => {
|
|
126
|
+
if (event.key === " ") {
|
|
127
|
+
toggleRowExpand();
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
}
|
|
130
|
+
} : void 0,
|
|
131
|
+
tabIndex: canClickRowToExpand ? 0 : -1,
|
|
132
|
+
sentiment,
|
|
133
|
+
"aria-disabled": disabled,
|
|
134
|
+
"aria-expanded": expandable ? expandedRowIds[id] : void 0,
|
|
135
|
+
"data-highlight": !!selectedRowIds[id],
|
|
136
|
+
"data-testid": dataTestid,
|
|
137
|
+
children: [
|
|
138
|
+
selectable ? /* @__PURE__ */ jsx(Cell, { preventClick: canClickRowToExpand, children: /* @__PURE__ */ jsx(StyledCheckboxContainer, { children: /* @__PURE__ */ jsx(
|
|
139
|
+
Tooltip,
|
|
140
|
+
{
|
|
141
|
+
text: typeof selectDisabled === "string" ? selectDisabled : void 0,
|
|
142
|
+
children: /* @__PURE__ */ jsx(
|
|
143
|
+
Checkbox,
|
|
144
|
+
{
|
|
145
|
+
name: "list-select-checkbox",
|
|
146
|
+
"aria-label": "select",
|
|
147
|
+
checked: selectedRowIds[id],
|
|
148
|
+
value: id,
|
|
149
|
+
onChange: () => {
|
|
150
|
+
if (selectedRowIds[id]) {
|
|
151
|
+
unselectRow(id);
|
|
152
|
+
} else {
|
|
153
|
+
selectRow(id);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
disabled: isSelectDisabled
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
) }) }) : null,
|
|
161
|
+
expandButton ? /* @__PURE__ */ jsx(Cell, { preventClick: true, children: /* @__PURE__ */ jsx(
|
|
162
|
+
Button,
|
|
163
|
+
{
|
|
164
|
+
disabled: disabled || !expandable,
|
|
165
|
+
icon: expandedRowIds[id] ? "arrow-up" : "arrow-down",
|
|
166
|
+
onClick: toggleRowExpand,
|
|
167
|
+
size: "small",
|
|
168
|
+
sentiment: "neutral",
|
|
169
|
+
variant: "ghost"
|
|
170
|
+
}
|
|
171
|
+
) }) : null,
|
|
172
|
+
children,
|
|
173
|
+
expandable && expandedRowIds[id] ? /* @__PURE__ */ jsx(
|
|
174
|
+
ExpandableWrapper,
|
|
175
|
+
{
|
|
176
|
+
"data-expandable-content": true,
|
|
177
|
+
onClick: canClickRowToExpand ? (e) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
} : void 0,
|
|
180
|
+
onKeyDown: canClickRowToExpand ? (e) => {
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
} : void 0,
|
|
183
|
+
children: expandable
|
|
184
|
+
}
|
|
185
|
+
) : null
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
export {
|
|
192
|
+
Row,
|
|
193
|
+
StyledRow
|
|
194
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type SelectBarProps<T> = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: (p: {
|
|
5
|
+
selectedItems: T[];
|
|
6
|
+
unselectAll: () => void;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
data: T[];
|
|
9
|
+
/**
|
|
10
|
+
* The idKey of each data entry
|
|
11
|
+
* */
|
|
12
|
+
idKey: keyof T;
|
|
13
|
+
};
|
|
14
|
+
export declare function SelectBar<T>({ children, data, idKey, className, }: SelectBarProps<T>): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { ActionBar } from "../ActionBar/index.js";
|
|
5
|
+
import { useListContext } from "./ListContext.js";
|
|
6
|
+
const StyledActionBar = styled(ActionBar)`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
padding: 0 ${({ theme }) => theme.space["1"]};
|
|
10
|
+
`;
|
|
11
|
+
const FlexDiv = styled.div`
|
|
12
|
+
flex: 1;
|
|
13
|
+
`;
|
|
14
|
+
function SelectBar({
|
|
15
|
+
children,
|
|
16
|
+
data,
|
|
17
|
+
idKey,
|
|
18
|
+
className
|
|
19
|
+
}) {
|
|
20
|
+
const { selectedRowIds, unselectAll } = useListContext();
|
|
21
|
+
const selectedItems = useMemo(
|
|
22
|
+
() => data.filter((item) => selectedRowIds[item[idKey]]),
|
|
23
|
+
[data, idKey, selectedRowIds]
|
|
24
|
+
);
|
|
25
|
+
if (selectedItems.length === 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(StyledActionBar, { className, children: /* @__PURE__ */ jsx(FlexDiv, { children: children({
|
|
29
|
+
selectedItems,
|
|
30
|
+
unselectAll
|
|
31
|
+
}) }) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
SelectBar
|
|
35
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { Skeleton } from "../Skeleton/index.js";
|
|
4
|
+
import { Cell } from "./Cell.js";
|
|
5
|
+
import { StyledRow } from "./Row.js";
|
|
6
|
+
const StyledLoadingRow = styled(StyledRow)`
|
|
7
|
+
cursor: progress;
|
|
8
|
+
`;
|
|
9
|
+
const StyledSkeleton = styled(Skeleton)`
|
|
10
|
+
width: 80%;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
`;
|
|
13
|
+
const SkeletonRows = ({
|
|
14
|
+
selectable,
|
|
15
|
+
rows,
|
|
16
|
+
cols
|
|
17
|
+
}) => {
|
|
18
|
+
const rowArray = Array.from({ length: rows }, (_, index) => index);
|
|
19
|
+
const colArray = Array.from({ length: cols }, (_, index) => index);
|
|
20
|
+
return /* @__PURE__ */ jsx(Fragment, { children: rowArray.map((index) => /* @__PURE__ */ jsxs(
|
|
21
|
+
StyledLoadingRow,
|
|
22
|
+
{
|
|
23
|
+
sentiment: "neutral",
|
|
24
|
+
role: "row",
|
|
25
|
+
id: `skeleton-${index}`,
|
|
26
|
+
children: [
|
|
27
|
+
selectable ? /* @__PURE__ */ jsx("div", {}) : null,
|
|
28
|
+
colArray.map((columnIndex) => /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(StyledSkeleton, { variant: "line" }) }, columnIndex))
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
index
|
|
32
|
+
)) });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
SkeletonRows
|
|
36
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ComponentProps, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import { HeaderCell } from './HeaderCell';
|
|
3
|
+
import { SelectBar } from './SelectBar';
|
|
4
|
+
type ColumnProps = Pick<ComponentProps<typeof HeaderCell>, 'isOrdered' | 'onOrder' | 'orderDirection'> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
info?: string;
|
|
8
|
+
};
|
|
9
|
+
type ListProps = {
|
|
10
|
+
expandable?: boolean;
|
|
11
|
+
selectable?: boolean;
|
|
12
|
+
columns: ColumnProps[];
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Set it to true if you want to display a placeholder during loading
|
|
16
|
+
* */
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Auto collapse is collapsing expandable row when another is expanding
|
|
20
|
+
* */
|
|
21
|
+
autoCollapse?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Action when selection changes (get the list of selected rows)
|
|
24
|
+
*/
|
|
25
|
+
onSelectedChange?: Dispatch<SetStateAction<string[]>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* List is a component that displays a list of items based on the columns you provide and the data you pass.
|
|
29
|
+
*/
|
|
30
|
+
export declare const List: import("react").ForwardRefExoticComponent<ListProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
31
|
+
Row: import("react").ForwardRefExoticComponent<{
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
id: string;
|
|
34
|
+
expandable?: ReactNode;
|
|
35
|
+
selectDisabled?: string | boolean | undefined;
|
|
36
|
+
disabled?: boolean | undefined;
|
|
37
|
+
sentiment?: "primary" | "secondary" | "neutral" | "success" | "danger" | "warning" | "info" | undefined;
|
|
38
|
+
className?: string | undefined;
|
|
39
|
+
'data-testid'?: string | undefined;
|
|
40
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
|
+
Cell: import("react").ForwardRefExoticComponent<{
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
className?: string | undefined;
|
|
44
|
+
preventClick?: boolean | undefined;
|
|
45
|
+
'data-testid'?: string | undefined;
|
|
46
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
SelectBar: typeof SelectBar;
|
|
48
|
+
useListContext: () => {
|
|
49
|
+
registerExpandableRow: (rowId: string) => () => void;
|
|
50
|
+
expandedRowIds: {
|
|
51
|
+
[x: string]: boolean;
|
|
52
|
+
};
|
|
53
|
+
expandRow: (rowId: string) => void;
|
|
54
|
+
collapseRow: (rowId: string) => void;
|
|
55
|
+
expandButton: boolean;
|
|
56
|
+
registerSelectableRow: (rowId: string) => () => void;
|
|
57
|
+
selectedRowIds: {
|
|
58
|
+
[x: string]: boolean;
|
|
59
|
+
};
|
|
60
|
+
selectRow: (rowId: string) => void;
|
|
61
|
+
unselectRow: (rowId: string) => void;
|
|
62
|
+
selectable: boolean;
|
|
63
|
+
allRowSelectValue: boolean | "indeterminate" | undefined;
|
|
64
|
+
selectAll: () => void;
|
|
65
|
+
unselectAll: () => void;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Body } from "./Body.js";
|
|
5
|
+
import { Cell } from "./Cell.js";
|
|
6
|
+
import { HeaderCell } from "./HeaderCell.js";
|
|
7
|
+
import { HeaderRow } from "./HeaderRow.js";
|
|
8
|
+
import { ListProvider, useListContext } from "./ListContext.js";
|
|
9
|
+
import { Row } from "./Row.js";
|
|
10
|
+
import { SelectBar } from "./SelectBar.js";
|
|
11
|
+
import { SkeletonRows } from "./SkeletonRows.js";
|
|
12
|
+
import { SELECTABLE_CHECKBOX_SIZE, EXPANDABLE_COLUMN_SIZE } from "./constants.js";
|
|
13
|
+
const StyledList = styled("div", {
|
|
14
|
+
shouldForwardProp: (prop) => !["template"].includes(prop)
|
|
15
|
+
})`
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-flow: column nowrap;
|
|
18
|
+
width: 100%;
|
|
19
|
+
gap: ${({ theme }) => theme.space["1"]};
|
|
20
|
+
|
|
21
|
+
[role='row'],
|
|
22
|
+
[role='button row'] {
|
|
23
|
+
display: grid;
|
|
24
|
+
width: 100%;
|
|
25
|
+
grid-template-columns: ${({ template }) => template};
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
const BaseList = forwardRef(
|
|
30
|
+
({
|
|
31
|
+
expandable = false,
|
|
32
|
+
selectable = false,
|
|
33
|
+
columns,
|
|
34
|
+
children,
|
|
35
|
+
loading,
|
|
36
|
+
autoCollapse = false,
|
|
37
|
+
onSelectedChange
|
|
38
|
+
}, ref) => {
|
|
39
|
+
const computeTemplate = `${selectable ? `${SELECTABLE_CHECKBOX_SIZE}px ` : ""}${expandable ? `${EXPANDABLE_COLUMN_SIZE}px ` : ""}${columns.map(({ width }) => width ?? "minmax(0, 1fr)").join(" ")}`;
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
ListProvider,
|
|
42
|
+
{
|
|
43
|
+
selectable,
|
|
44
|
+
expandButton: expandable,
|
|
45
|
+
autoCollapse,
|
|
46
|
+
onSelectedChange,
|
|
47
|
+
children: /* @__PURE__ */ jsxs(StyledList, { ref, role: "grid", template: computeTemplate, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(HeaderRow, { hasSelectAllColumn: selectable, children: columns.map((column, index) => /* @__PURE__ */ jsx(
|
|
49
|
+
HeaderCell,
|
|
50
|
+
{
|
|
51
|
+
isOrdered: column.isOrdered,
|
|
52
|
+
orderDirection: column.orderDirection,
|
|
53
|
+
onOrder: column.onOrder,
|
|
54
|
+
info: column.info,
|
|
55
|
+
children: column.label
|
|
56
|
+
},
|
|
57
|
+
`header-column-${index}`
|
|
58
|
+
)) }),
|
|
59
|
+
/* @__PURE__ */ jsx(Body, { children: loading ? /* @__PURE__ */ jsx(
|
|
60
|
+
SkeletonRows,
|
|
61
|
+
{
|
|
62
|
+
selectable,
|
|
63
|
+
rows: 5,
|
|
64
|
+
cols: columns.length
|
|
65
|
+
}
|
|
66
|
+
) : children })
|
|
67
|
+
] })
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
const List = Object.assign(BaseList, {
|
|
73
|
+
Row,
|
|
74
|
+
Cell,
|
|
75
|
+
SelectBar,
|
|
76
|
+
useListContext
|
|
77
|
+
});
|
|
78
|
+
export {
|
|
79
|
+
List
|
|
80
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Color } from '../../theme';
|
|
2
|
+
type LoaderProps = {
|
|
3
|
+
active?: boolean;
|
|
4
|
+
color?: Color | string;
|
|
5
|
+
percentage?: number;
|
|
6
|
+
size?: number | string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Text is placed in center of ProgressCircle.
|
|
10
|
+
*/
|
|
11
|
+
text?: string;
|
|
12
|
+
trailColor?: Color | string;
|
|
13
|
+
/**
|
|
14
|
+
* Label should be defined for accessibility, to indicate what is loading
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Loader is a circular progress indicator that can be used to indicate that an action is being performed.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Loader: ({ percentage, text, size, strokeWidth, color, trailColor, active, label, }: LoaderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|