@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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import _styled from '@emotion/styled/base';
|
|
2
|
-
import { Text } from '../Text/index.js';
|
|
3
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
6
|
-
const StyledList = /*#__PURE__*/_styled("ul", {
|
|
7
|
-
target: "e44jccr1"
|
|
8
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
9
|
-
name: "1vatjen",
|
|
10
|
-
styles: "padding:0 8px 8px 8px;margin:0;width:100%"
|
|
11
|
-
} : {
|
|
12
|
-
name: "1vatjen",
|
|
13
|
-
styles: "padding:0 8px 8px 8px;margin:0;width:100%",
|
|
14
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
15
|
-
});
|
|
16
|
-
const StyledItem = /*#__PURE__*/_styled("li", {
|
|
17
|
-
target: "e44jccr0"
|
|
18
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
19
|
-
name: "1duinrf",
|
|
20
|
-
styles: "display:flex;margin-top:6px;width:100%;justify-content:space-between;text-align:left;gap:8px"
|
|
21
|
-
} : {
|
|
22
|
-
name: "1duinrf",
|
|
23
|
-
styles: "display:flex;margin-top:6px;width:100%;justify-content:space-between;text-align:left;gap:8px",
|
|
24
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
-
});
|
|
26
|
-
const Tooltip = ({
|
|
27
|
-
data
|
|
28
|
-
}) => jsx("div", {
|
|
29
|
-
tabIndex: -1,
|
|
30
|
-
role: "tooltip",
|
|
31
|
-
children: jsxs(StyledList, {
|
|
32
|
-
children: [jsxs(StyledItem, {
|
|
33
|
-
children: [jsx(Text, {
|
|
34
|
-
as: "p",
|
|
35
|
-
variant: "body",
|
|
36
|
-
prominence: "stronger",
|
|
37
|
-
children: data.name
|
|
38
|
-
}), jsx(Text, {
|
|
39
|
-
as: "p",
|
|
40
|
-
variant: "body",
|
|
41
|
-
prominence: "stronger",
|
|
42
|
-
children: data.value
|
|
43
|
-
})]
|
|
44
|
-
}), data.details?.map(detail => jsxs(StyledItem, {
|
|
45
|
-
children: [jsx(Text, {
|
|
46
|
-
as: "p",
|
|
47
|
-
variant: "bodySmall",
|
|
48
|
-
prominence: "stronger",
|
|
49
|
-
children: detail.name
|
|
50
|
-
}), jsx(Text, {
|
|
51
|
-
as: "p",
|
|
52
|
-
variant: "bodySmall",
|
|
53
|
-
prominence: "stronger",
|
|
54
|
-
children: detail.value
|
|
55
|
-
})]
|
|
56
|
-
}, detail.name))]
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
var TooltipContainer = Tooltip;
|
|
60
|
-
|
|
61
|
-
export { TooltipContainer as default };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import _styled from '@emotion/styled/base';
|
|
2
|
-
import { useTheme } from '@emotion/react';
|
|
3
|
-
import { Pie } from '@nivo/pie';
|
|
4
|
-
import { useState, useCallback } from 'react';
|
|
5
|
-
import { getLegendColor } from '../../helpers/legend.js';
|
|
6
|
-
import { Text } from '../Text/index.js';
|
|
7
|
-
import Legends from './Legends.js';
|
|
8
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11
|
-
const Container = /*#__PURE__*/_styled("div", {
|
|
12
|
-
target: "epjfe5p2"
|
|
13
|
-
})("display:flex;align-items:center;height:", ({
|
|
14
|
-
height
|
|
15
|
-
}) => `${height}px`, ";");
|
|
16
|
-
const EmptyLegend = /*#__PURE__*/_styled("div", {
|
|
17
|
-
target: "epjfe5p1"
|
|
18
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
19
|
-
name: "dwqz7h",
|
|
20
|
-
styles: "display:flex;align-items:center;margin-left:20px"
|
|
21
|
-
} : {
|
|
22
|
-
name: "dwqz7h",
|
|
23
|
-
styles: "display:flex;align-items:center;margin-left:20px",
|
|
24
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
-
});
|
|
26
|
-
const StyledContent = /*#__PURE__*/_styled("div", {
|
|
27
|
-
target: "epjfe5p0"
|
|
28
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
29
|
-
name: "qcd8cv",
|
|
30
|
-
styles: "display:inline-block;position:absolute;bottom:0;left:0;right:0;top:0;font-size:25px;line-height:100px;height:100px;width:100px;margin:auto;text-align:center;vertical-align:middle"
|
|
31
|
-
} : {
|
|
32
|
-
name: "qcd8cv",
|
|
33
|
-
styles: "display:inline-block;position:absolute;bottom:0;left:0;right:0;top:0;font-size:25px;line-height:100px;height:100px;width:100px;margin:auto;text-align:center;vertical-align:middle",
|
|
34
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
35
|
-
});
|
|
36
|
-
const DEFAULT_CHARTPROPS = {};
|
|
37
|
-
const DEFAULT_MARGIN = {
|
|
38
|
-
bottom: 10,
|
|
39
|
-
left: 10,
|
|
40
|
-
right: 10,
|
|
41
|
-
top: 10
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* PieChart component is a wrapper around the Nivo Pie component to display a pie chart.
|
|
46
|
-
* See https://nivo.rocks/pie/ for more information.
|
|
47
|
-
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
48
|
-
*/
|
|
49
|
-
const PieChart = ({
|
|
50
|
-
height = 206,
|
|
51
|
-
width = 206,
|
|
52
|
-
data = undefined,
|
|
53
|
-
emptyLegend,
|
|
54
|
-
content,
|
|
55
|
-
withLegend = false,
|
|
56
|
-
margin = DEFAULT_MARGIN,
|
|
57
|
-
chartProps = DEFAULT_CHARTPROPS
|
|
58
|
-
}) => {
|
|
59
|
-
const theme = useTheme();
|
|
60
|
-
const [currentFocusIndex, setCurrentFocusIndex] = useState();
|
|
61
|
-
const emptyTooltip = useCallback(() => jsx("span", {}), []);
|
|
62
|
-
const isEmpty = !data || data.length === 0;
|
|
63
|
-
const EmptyLegendDisplayed = useCallback(() => emptyLegend ? jsx(EmptyLegend, {
|
|
64
|
-
children: jsx(Text, {
|
|
65
|
-
variant: "body",
|
|
66
|
-
as: "p",
|
|
67
|
-
children: emptyLegend
|
|
68
|
-
})
|
|
69
|
-
}) : null, [emptyLegend]);
|
|
70
|
-
const localColors = getLegendColor(theme);
|
|
71
|
-
const LegendDisplayer = useCallback(() => isEmpty ? jsx(EmptyLegendDisplayed, {}) : jsx(Legends, {
|
|
72
|
-
focused: currentFocusIndex,
|
|
73
|
-
data: data,
|
|
74
|
-
onFocusChange: setCurrentFocusIndex,
|
|
75
|
-
colors: localColors
|
|
76
|
-
}), [isEmpty, currentFocusIndex, data, EmptyLegendDisplayed, localColors]);
|
|
77
|
-
return jsxs(Container, {
|
|
78
|
-
height: height,
|
|
79
|
-
children: [jsxs("div", {
|
|
80
|
-
style: {
|
|
81
|
-
position: 'relative'
|
|
82
|
-
},
|
|
83
|
-
children: [jsx(Pie, {
|
|
84
|
-
colors: localColors,
|
|
85
|
-
height: height,
|
|
86
|
-
width: width,
|
|
87
|
-
value: "percent",
|
|
88
|
-
enableArcLabels: false,
|
|
89
|
-
enableArcLinkLabels: false,
|
|
90
|
-
data: !isEmpty ? data : [{
|
|
91
|
-
id: 'empty',
|
|
92
|
-
percent: 100
|
|
93
|
-
}],
|
|
94
|
-
defs: [{
|
|
95
|
-
background: 'inherit',
|
|
96
|
-
color: theme.colors.neutral.textStrong,
|
|
97
|
-
id: 'lines',
|
|
98
|
-
lineWidth: 2,
|
|
99
|
-
rotation: 0,
|
|
100
|
-
spacing: 5,
|
|
101
|
-
type: 'patternLines'
|
|
102
|
-
}],
|
|
103
|
-
margin: margin,
|
|
104
|
-
innerRadius: 0.8,
|
|
105
|
-
cornerRadius: 0,
|
|
106
|
-
padAngle: 1,
|
|
107
|
-
activeOuterRadiusOffset: !isEmpty ? 4 : 0,
|
|
108
|
-
tooltip: emptyTooltip,
|
|
109
|
-
onMouseEnter: (datum, event) => {
|
|
110
|
-
if (!isEmpty) {
|
|
111
|
-
const pie = event.currentTarget;
|
|
112
|
-
pie.style.cursor = 'pointer';
|
|
113
|
-
setCurrentFocusIndex(datum.id.toString());
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
onMouseLeave: () => setCurrentFocusIndex(undefined),
|
|
117
|
-
...chartProps
|
|
118
|
-
}), content ? jsx(StyledContent, {
|
|
119
|
-
children: content
|
|
120
|
-
}) : null]
|
|
121
|
-
}), withLegend ? jsx(LegendDisplayer, {}) : null]
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export { PieChart };
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import _styled from '@emotion/styled/base';
|
|
2
|
-
import { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
-
import { Button } from '../Button/index.js';
|
|
4
|
-
import { Popup } from '../Popup/index.js';
|
|
5
|
-
import { Stack } from '../Stack/index.js';
|
|
6
|
-
import { Text } from '../Text/index.js';
|
|
7
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
const SIZES_WIDTH = {
|
|
10
|
-
small: 320,
|
|
11
|
-
medium: 420,
|
|
12
|
-
large: 520
|
|
13
|
-
};
|
|
14
|
-
const StyledPopup = /*#__PURE__*/_styled(Popup, {
|
|
15
|
-
shouldForwardProp: prop => !['sentiment', 'size'].includes(prop),
|
|
16
|
-
target: "ejpxv5a1"
|
|
17
|
-
})("padding:", ({
|
|
18
|
-
theme
|
|
19
|
-
}) => theme.space['2'], ";width:", ({
|
|
20
|
-
size
|
|
21
|
-
}) => SIZES_WIDTH[size], "px;max-width:", ({
|
|
22
|
-
size
|
|
23
|
-
}) => SIZES_WIDTH[size], "px;text-align:initial;", ({
|
|
24
|
-
theme,
|
|
25
|
-
sentiment
|
|
26
|
-
}) => {
|
|
27
|
-
if (sentiment === 'neutral') {
|
|
28
|
-
return `
|
|
29
|
-
background: ${theme.colors.neutral.background};
|
|
30
|
-
box-shadow: ${theme.shadows.popover};
|
|
31
|
-
&[data-has-arrow='true'] {
|
|
32
|
-
&::after {
|
|
33
|
-
border-color: ${theme.colors.neutral.background} transparent transparent transparent;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
}
|
|
38
|
-
return `
|
|
39
|
-
background: ${theme.colors.primary.backgroundStrong};
|
|
40
|
-
box-shadow: ${theme.shadows.popover};
|
|
41
|
-
&[data-has-arrow='true'] {
|
|
42
|
-
&::after {
|
|
43
|
-
border-color: ${theme.colors.primary.backgroundStrong} transparent transparent transparent;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
}, ";");
|
|
48
|
-
|
|
49
|
-
// This is to avoid having text inherit color from popup (which is white on white background)
|
|
50
|
-
const StyledStack = /*#__PURE__*/_styled(Stack, {
|
|
51
|
-
target: "ejpxv5a0"
|
|
52
|
-
})("color:", ({
|
|
53
|
-
theme
|
|
54
|
-
}) => theme.colors.neutral.text, ";");
|
|
55
|
-
const ContentWrapper = ({
|
|
56
|
-
title,
|
|
57
|
-
onClose,
|
|
58
|
-
children,
|
|
59
|
-
sentiment
|
|
60
|
-
}) => jsxs(StyledStack, {
|
|
61
|
-
gap: 1,
|
|
62
|
-
children: [jsxs(Stack, {
|
|
63
|
-
direction: "row",
|
|
64
|
-
justifyContent: "space-between",
|
|
65
|
-
children: [jsx(Text, {
|
|
66
|
-
variant: "bodyStrong",
|
|
67
|
-
as: "h3",
|
|
68
|
-
sentiment: "neutral",
|
|
69
|
-
prominence: sentiment === 'neutral' ? 'strong' : 'stronger',
|
|
70
|
-
children: title
|
|
71
|
-
}), jsx(Button, {
|
|
72
|
-
variant: sentiment === 'neutral' ? 'ghost' : 'filled',
|
|
73
|
-
sentiment: sentiment === 'neutral' ? 'neutral' : 'primary',
|
|
74
|
-
onClick: onClose,
|
|
75
|
-
size: "small",
|
|
76
|
-
icon: "close",
|
|
77
|
-
"aria-label": "close"
|
|
78
|
-
})]
|
|
79
|
-
}), typeof children === 'string' ? jsx(Text, {
|
|
80
|
-
variant: "bodySmall",
|
|
81
|
-
as: "p",
|
|
82
|
-
sentiment: "neutral",
|
|
83
|
-
prominence: sentiment === 'neutral' ? 'strong' : 'stronger',
|
|
84
|
-
children: children
|
|
85
|
-
}) : children]
|
|
86
|
-
});
|
|
87
|
-
/**
|
|
88
|
-
* Popover component is used to display additional information or actions on top of the main content of the page.
|
|
89
|
-
* It is usually triggered by clicking on a button. It includes a title, a close button and a content area.
|
|
90
|
-
*/
|
|
91
|
-
const Popover = /*#__PURE__*/forwardRef(({
|
|
92
|
-
visible = false,
|
|
93
|
-
children,
|
|
94
|
-
placement,
|
|
95
|
-
content,
|
|
96
|
-
title,
|
|
97
|
-
sentiment = 'neutral',
|
|
98
|
-
size = 'medium',
|
|
99
|
-
onClose,
|
|
100
|
-
className,
|
|
101
|
-
maxWidth,
|
|
102
|
-
maxHeight,
|
|
103
|
-
'data-testid': dataTestId,
|
|
104
|
-
portalTarget
|
|
105
|
-
}, ref) => {
|
|
106
|
-
const innerRef = useRef(null);
|
|
107
|
-
const [localVisible, setLocalVisible] = useState(visible);
|
|
108
|
-
|
|
109
|
-
// We change local value if visible prop changes
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
setLocalVisible(visible);
|
|
112
|
-
}, [visible]);
|
|
113
|
-
const localOnClose = useCallback(() => {
|
|
114
|
-
setLocalVisible(false);
|
|
115
|
-
onClose?.();
|
|
116
|
-
}, [onClose]);
|
|
117
|
-
return jsx(StyledPopup, {
|
|
118
|
-
hideOnClickOutside: true,
|
|
119
|
-
debounceDelay: 0,
|
|
120
|
-
visible: localVisible,
|
|
121
|
-
placement: placement,
|
|
122
|
-
text: jsx(ContentWrapper, {
|
|
123
|
-
title: title,
|
|
124
|
-
onClose: localOnClose,
|
|
125
|
-
sentiment: sentiment,
|
|
126
|
-
children: content
|
|
127
|
-
}),
|
|
128
|
-
className: className,
|
|
129
|
-
sentiment: sentiment,
|
|
130
|
-
"data-testid": dataTestId,
|
|
131
|
-
size: size,
|
|
132
|
-
role: "dialog",
|
|
133
|
-
ref: ref,
|
|
134
|
-
tabIndex: -1,
|
|
135
|
-
innerRef: innerRef,
|
|
136
|
-
onClose: localOnClose,
|
|
137
|
-
maxWidth: maxWidth,
|
|
138
|
-
maxHeight: maxHeight,
|
|
139
|
-
portalTarget: portalTarget,
|
|
140
|
-
children: children
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
export { Popover };
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
const ARROW_WIDTH = 8; // in px
|
|
2
|
-
const SPACE = 4; // in px
|
|
3
|
-
const TOTAL_USED_SPACE = 0; // in px
|
|
4
|
-
const DEFAULT_POSITIONS = {
|
|
5
|
-
arrowLeft: -999,
|
|
6
|
-
arrowTop: -999,
|
|
7
|
-
arrowTransform: 'translate(-50%, -50)',
|
|
8
|
-
placement: 'top',
|
|
9
|
-
rotate: 135,
|
|
10
|
-
popupInitialPosition: 'translate3d(-999px, -999px, 0)',
|
|
11
|
-
popupPosition: 'translate3d(-999px, -999px, 0)'
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* This function will find the best placement in a window for popup based on children position and popup size
|
|
15
|
-
*/
|
|
16
|
-
const computePlacement = ({
|
|
17
|
-
childrenStructuredRef,
|
|
18
|
-
popupStructuredRef,
|
|
19
|
-
offsetParentRect,
|
|
20
|
-
offsetParent,
|
|
21
|
-
popupPortalTarget
|
|
22
|
-
}) => {
|
|
23
|
-
const {
|
|
24
|
-
top: childrenTop,
|
|
25
|
-
left: childrenLeft,
|
|
26
|
-
right: childrenRight,
|
|
27
|
-
width: childrenWidth
|
|
28
|
-
} = childrenStructuredRef;
|
|
29
|
-
const {
|
|
30
|
-
top: parentTop,
|
|
31
|
-
left: parentLeft
|
|
32
|
-
} = offsetParentRect;
|
|
33
|
-
const isPopupPortalTargetBody = popupPortalTarget === document.body || offsetParent === document.body;
|
|
34
|
-
const overloadedChildrenLeft = isPopupPortalTargetBody ? childrenLeft : childrenLeft - parentLeft;
|
|
35
|
-
const overloadedChildrenTop = isPopupPortalTargetBody ? childrenTop : childrenTop - parentTop;
|
|
36
|
-
const overloadedChildrenRight = isPopupPortalTargetBody ? childrenRight : childrenLeft - parentLeft + childrenWidth;
|
|
37
|
-
const {
|
|
38
|
-
width: popupWidth,
|
|
39
|
-
height: popupHeight
|
|
40
|
-
} = popupStructuredRef;
|
|
41
|
-
if (overloadedChildrenTop - popupHeight - TOTAL_USED_SPACE < 0) {
|
|
42
|
-
return 'bottom';
|
|
43
|
-
}
|
|
44
|
-
if (overloadedChildrenLeft - popupWidth - TOTAL_USED_SPACE < 0) {
|
|
45
|
-
return 'right';
|
|
46
|
-
}
|
|
47
|
-
if (overloadedChildrenRight + popupWidth + TOTAL_USED_SPACE > window.innerWidth) {
|
|
48
|
-
return 'left';
|
|
49
|
-
}
|
|
50
|
-
return 'top';
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* This function will check if the offset parent is usable for popup positioning
|
|
55
|
-
* If not it will loop and search for a compatible parent until document.body is reached
|
|
56
|
-
*/
|
|
57
|
-
const findOffsetParent = element => {
|
|
58
|
-
const offsetParent = element?.current?.offsetParent;
|
|
59
|
-
|
|
60
|
-
// We need to check if offsetParent is a table cell or a table because they are not suitable for positioning
|
|
61
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
62
|
-
if (offsetParent && !['TH', 'TD', 'TABLE'].includes(offsetParent.tagName)) {
|
|
63
|
-
return offsetParent;
|
|
64
|
-
}
|
|
65
|
-
let currentElement = element?.current;
|
|
66
|
-
while (currentElement && currentElement.tagName !== 'BODY') {
|
|
67
|
-
const {
|
|
68
|
-
position
|
|
69
|
-
} = window.getComputedStyle(currentElement);
|
|
70
|
-
|
|
71
|
-
// Check if the current element is a potential offset parent
|
|
72
|
-
if (position !== 'static') {
|
|
73
|
-
return currentElement;
|
|
74
|
-
}
|
|
75
|
-
currentElement = currentElement.parentElement;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// If no suitable offset parent is found, return the body element
|
|
79
|
-
return document.body;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* This function will check if there is an overflow of the popup compared to the parent it is set in.
|
|
84
|
-
* Depending on the position, for top and bottom the overflow will be on X axis and for left and right
|
|
85
|
-
* the overflow will be Y axis. The function return the number of pixels the popup is overflowing.
|
|
86
|
-
* @param position the position of the popup
|
|
87
|
-
* @param offsetParentRect the rect of the parent element where the children is located in
|
|
88
|
-
* @param childrenRect the rect of the children element, the children element is the one that will trigger the popup
|
|
89
|
-
* @param popupStructuredRef the rect of the popup, the popup itself
|
|
90
|
-
*/
|
|
91
|
-
const getPopupOverflowFromParent = (position, offsetParentRect, childrenRect, popupStructuredRef) => {
|
|
92
|
-
const {
|
|
93
|
-
top: parentTop,
|
|
94
|
-
left: parentLeft,
|
|
95
|
-
right: parentRight
|
|
96
|
-
} = offsetParentRect;
|
|
97
|
-
const {
|
|
98
|
-
top: childrenTop,
|
|
99
|
-
bottom: childrenBottom,
|
|
100
|
-
left: childrenLeft,
|
|
101
|
-
right: childrenRight,
|
|
102
|
-
width: childrenWidth
|
|
103
|
-
} = childrenRect;
|
|
104
|
-
const {
|
|
105
|
-
width: popupWidth,
|
|
106
|
-
height: popupHeight
|
|
107
|
-
} = popupStructuredRef;
|
|
108
|
-
const popupHalfWidthWithArrow = popupWidth / 2 - ARROW_WIDTH;
|
|
109
|
-
const popupHalfHeightWithArrow = popupHeight / 2 - ARROW_WIDTH;
|
|
110
|
-
if (position === 'top' || position === 'bottom') {
|
|
111
|
-
const popupOverflowRight = childrenRight - childrenWidth / 2 + popupWidth / 2;
|
|
112
|
-
const popupOverflowLeft = childrenLeft + childrenWidth / 2 - parentLeft - popupWidth / 2;
|
|
113
|
-
if (popupOverflowRight > parentRight) {
|
|
114
|
-
if (Math.abs(popupOverflowRight - parentRight) > popupHalfWidthWithArrow) {
|
|
115
|
-
return -popupHalfWidthWithArrow;
|
|
116
|
-
}
|
|
117
|
-
return parentRight - popupOverflowRight;
|
|
118
|
-
}
|
|
119
|
-
if (popupOverflowLeft < 0) {
|
|
120
|
-
if (Math.abs(popupOverflowLeft) > popupHalfWidthWithArrow) {
|
|
121
|
-
return popupHalfWidthWithArrow;
|
|
122
|
-
}
|
|
123
|
-
return Math.abs(popupOverflowLeft);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (position === 'left' || position === 'right') {
|
|
127
|
-
const popupOverflowTop = childrenTop - parentTop - popupHeight / 2;
|
|
128
|
-
if (popupOverflowTop < 0) {
|
|
129
|
-
if (Math.abs(childrenTop - parentTop - popupHalfHeightWithArrow) > popupHalfHeightWithArrow) {
|
|
130
|
-
return popupHalfHeightWithArrow;
|
|
131
|
-
}
|
|
132
|
-
return Math.abs(popupOverflowTop);
|
|
133
|
-
}
|
|
134
|
-
if (childrenBottom + popupHeight > window.innerHeight) {
|
|
135
|
-
return -popupHalfHeightWithArrow;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return 0;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* This function will compute the positions of popup and arrow based on children position and popup size
|
|
142
|
-
*/
|
|
143
|
-
const computePositions = ({
|
|
144
|
-
placement,
|
|
145
|
-
childrenRef,
|
|
146
|
-
popupRef,
|
|
147
|
-
popupPortalTarget
|
|
148
|
-
}) => {
|
|
149
|
-
const childrenRect = childrenRef.current.getBoundingClientRect();
|
|
150
|
-
const offsetParent = findOffsetParent(childrenRef);
|
|
151
|
-
const offsetParentRect = offsetParent?.getBoundingClientRect() ?? {
|
|
152
|
-
top: 0,
|
|
153
|
-
left: 0,
|
|
154
|
-
right: 0
|
|
155
|
-
};
|
|
156
|
-
const popupStructuredRef = popupRef.current.getBoundingClientRect();
|
|
157
|
-
const placementBasedOnWindowSize = placement === 'auto' ? computePlacement({
|
|
158
|
-
childrenStructuredRef: childrenRect,
|
|
159
|
-
popupStructuredRef,
|
|
160
|
-
offsetParentRect,
|
|
161
|
-
popupPortalTarget,
|
|
162
|
-
offsetParent
|
|
163
|
-
}) : placement;
|
|
164
|
-
const {
|
|
165
|
-
top: childrenTop,
|
|
166
|
-
left: childrenLeft,
|
|
167
|
-
right: childrenRight,
|
|
168
|
-
width: childrenWidth,
|
|
169
|
-
height: childrenHeight
|
|
170
|
-
} = childrenRect;
|
|
171
|
-
const {
|
|
172
|
-
top: parentTop,
|
|
173
|
-
left: parentLeft
|
|
174
|
-
} = offsetParentRect;
|
|
175
|
-
const {
|
|
176
|
-
width: popupWidth,
|
|
177
|
-
height: popupHeight
|
|
178
|
-
} = popupStructuredRef;
|
|
179
|
-
|
|
180
|
-
// offSetParent is the closest positioned ancestor. If the element is not positioned, the nearest table cell or root element is used.
|
|
181
|
-
const isPopupPortalTargetBody = popupPortalTarget === document.body || offsetParent === document.body;
|
|
182
|
-
|
|
183
|
-
// It will get how much scroll is done on the page to compute the position of the popup
|
|
184
|
-
const scrollTopValue = isPopupPortalTargetBody ? document.documentElement.scrollTop : offsetParent.scrollTop;
|
|
185
|
-
|
|
186
|
-
// We need to compute the position of the popup based on the parent element in the case the popup is not in the body
|
|
187
|
-
const overloadedChildrenLeft = isPopupPortalTargetBody ? childrenLeft : childrenLeft - parentLeft;
|
|
188
|
-
const overloadedChildrenTop = isPopupPortalTargetBody ? childrenTop : childrenTop - parentTop;
|
|
189
|
-
const overloadedChildrenRight = isPopupPortalTargetBody ? childrenRight : childrenLeft - parentLeft + childrenWidth;
|
|
190
|
-
const popupOverflow = getPopupOverflowFromParent(placementBasedOnWindowSize, offsetParentRect, childrenRect, popupStructuredRef);
|
|
191
|
-
switch (placementBasedOnWindowSize) {
|
|
192
|
-
case 'bottom':
|
|
193
|
-
{
|
|
194
|
-
const positionX = overloadedChildrenLeft + childrenWidth / 2 - popupWidth / 2;
|
|
195
|
-
const positionY = overloadedChildrenTop + scrollTopValue + childrenHeight + ARROW_WIDTH + SPACE;
|
|
196
|
-
return {
|
|
197
|
-
arrowLeft: popupWidth / 2 + popupOverflow * -1,
|
|
198
|
-
arrowTop: -ARROW_WIDTH - 5,
|
|
199
|
-
arrowTransform: '',
|
|
200
|
-
placement: 'bottom',
|
|
201
|
-
rotate: 180,
|
|
202
|
-
popupInitialPosition: `translate3d(${positionX + popupOverflow}px, ${positionY - TOTAL_USED_SPACE}px, 0)`,
|
|
203
|
-
popupPosition: `translate3d(${positionX + popupOverflow}px, ${positionY}px, 0)`
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
case 'left':
|
|
207
|
-
{
|
|
208
|
-
const positionX = overloadedChildrenLeft - popupWidth - ARROW_WIDTH - SPACE * 2;
|
|
209
|
-
const positionY = overloadedChildrenTop + scrollTopValue - popupHeight / 2 + childrenHeight / 2;
|
|
210
|
-
return {
|
|
211
|
-
arrowLeft: popupWidth + ARROW_WIDTH + 5,
|
|
212
|
-
arrowTop: popupHeight / 2 + popupOverflow * -1,
|
|
213
|
-
arrowTransform: 'translate(-50%, -50%)',
|
|
214
|
-
placement: 'left',
|
|
215
|
-
rotate: -90,
|
|
216
|
-
popupInitialPosition: `translate3d(${positionX + TOTAL_USED_SPACE}px, ${positionY + popupOverflow}px, 0)`,
|
|
217
|
-
popupPosition: `translate3d(${positionX}px, ${positionY + popupOverflow}px, 0)`
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
case 'right':
|
|
221
|
-
{
|
|
222
|
-
const positionX = overloadedChildrenRight + ARROW_WIDTH + SPACE * 2;
|
|
223
|
-
const positionY = overloadedChildrenTop + scrollTopValue - popupHeight / 2 + childrenHeight / 2;
|
|
224
|
-
return {
|
|
225
|
-
arrowLeft: -ARROW_WIDTH - 5,
|
|
226
|
-
arrowTop: popupHeight / 2 + popupOverflow * -1,
|
|
227
|
-
arrowTransform: 'translate(50%, -50%)',
|
|
228
|
-
placement: 'right',
|
|
229
|
-
rotate: 90,
|
|
230
|
-
popupInitialPosition: `translate3d(${positionX - TOTAL_USED_SPACE}px, ${positionY + popupOverflow}px, 0)`,
|
|
231
|
-
popupPosition: `translate3d(${positionX}px, ${positionY + popupOverflow}px, 0)`
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
default:
|
|
235
|
-
{
|
|
236
|
-
// top placement is default value
|
|
237
|
-
const positionX = overloadedChildrenLeft + childrenWidth / 2 - popupWidth / 2;
|
|
238
|
-
const positionY = overloadedChildrenTop + scrollTopValue - popupHeight - ARROW_WIDTH - SPACE;
|
|
239
|
-
return {
|
|
240
|
-
arrowLeft: popupWidth / 2 + popupOverflow * -1,
|
|
241
|
-
arrowTop: popupHeight - 1,
|
|
242
|
-
arrowTransform: '',
|
|
243
|
-
placement: 'top',
|
|
244
|
-
rotate: 0,
|
|
245
|
-
popupInitialPosition: `translate3d(${positionX + popupOverflow}px, ${positionY + TOTAL_USED_SPACE}px, 0)`,
|
|
246
|
-
popupPosition: `translate3d(${positionX + popupOverflow}px, ${positionY}px, 0)`
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export { ARROW_WIDTH, DEFAULT_POSITIONS, computePositions };
|