@ultraviolet/ui 3.0.0-beta.25 → 3.0.0-beta.27
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/styles.css.js +1 -0
- package/dist/components/Avatar/constants.d.ts +5 -5
- package/dist/components/Avatar/constants.js +1 -1
- package/dist/components/Avatar/styles.css.d.ts +24 -24
- package/dist/components/Avatar/styles.css.js +0 -1
- package/dist/components/BarChart/Tooltip.d.ts +3 -3
- package/dist/components/BarChart/Tooltip.js +2 -2
- package/dist/components/BarChart/index.d.ts +1 -1
- package/dist/components/BarChart/index.js +2 -2
- package/dist/components/Button/constants.d.ts +1 -0
- package/dist/components/Button/index.d.ts +0 -4
- package/dist/components/ExpandableCard/constants.d.ts +1 -0
- package/dist/components/ExpandableCard/index.d.ts +1 -1
- package/dist/components/ExpandableCard/styles.css.d.ts +1 -1
- package/dist/components/ExpandableCard/styles.css.js +2 -2
- package/dist/components/Key/constants.d.ts +8 -0
- package/dist/components/Key/constants.js +11 -0
- package/dist/components/Key/index.d.ts +0 -8
- package/dist/components/Key/index.js +1 -9
- package/dist/components/LineChart/helpers.js +2 -2
- package/dist/components/List/Row.js +1 -1
- package/dist/components/Loader/constants.d.ts +8 -0
- package/dist/components/Loader/constants.js +11 -0
- package/dist/components/Loader/index.d.ts +1 -8
- package/dist/components/Loader/index.js +5 -24
- package/dist/components/Loader/styles.css.d.ts +1 -0
- package/dist/components/Loader/styles.css.js +3 -1
- package/dist/components/Menu/MenuContent.js +7 -1
- package/dist/components/Menu/components/Item.d.ts +2 -2
- package/dist/components/Menu/components/Item.js +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Notification/Notification.d.ts +10 -0
- package/dist/components/Notification/{index.js → Notification.js} +2 -14
- package/dist/components/Notification/NotificationContainer.d.ts +30 -0
- package/dist/components/Notification/NotificationContainer.js +17 -0
- package/dist/components/Notification/index.d.ts +2 -37
- package/dist/components/PieChart/Legends.d.ts +2 -2
- package/dist/components/PieChart/Legends.js +2 -2
- package/dist/components/PieChart/Tooltip.d.ts +2 -2
- package/dist/components/PieChart/Tooltip.js +1 -1
- package/dist/components/PieChart/index.js +1 -1
- package/dist/components/Popup/index.js +8 -0
- package/dist/components/ProgressBar/styles.css.js +0 -1
- package/dist/components/ProgressBar/variables.css.js +1 -0
- package/dist/components/SelectInput/components/SearchBarDropdown.d.ts +1 -3
- package/dist/components/SelectInput/components/SearchBarDropdown.js +7 -4
- package/dist/components/SelectableCard/styles.css.js +0 -1
- package/dist/components/SelectableCard/variables.css.js +1 -0
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/TagList/index.js +1 -1
- package/dist/components/Text/constants.d.ts +9 -0
- package/dist/components/Text/index.d.ts +1 -4
- package/dist/components/Text/style.css.js +1 -0
- package/dist/components/Text/variables.css.js +0 -1
- package/dist/components/Toaster/Toaster.d.ts +7 -0
- package/dist/components/Toaster/Toaster.js +25 -0
- package/dist/components/Toaster/ToasterContainer.d.ts +38 -0
- package/dist/components/Toaster/ToasterContainer.js +18 -0
- package/dist/components/Toaster/components/CloseButton.d.ts +8 -0
- package/dist/components/Toaster/components/CloseButton.js +12 -0
- package/dist/components/Toaster/components/Content.d.ts +6 -0
- package/dist/components/Toaster/components/Content.js +10 -0
- package/dist/components/Toaster/constants.d.ts +1 -0
- package/dist/components/Toaster/constants.js +4 -0
- package/dist/components/Toaster/index.d.ts +3 -45
- package/dist/components/TreeMapChart/Tooltip.d.ts +6 -0
- package/dist/components/TreeMapChart/Tooltip.js +15 -0
- package/dist/components/TreeMapChart/index.d.ts +18 -0
- package/dist/components/TreeMapChart/index.js +68 -0
- package/dist/components/TreeMapChart/styles.css.d.ts +2 -0
- package/dist/components/TreeMapChart/styles.css.js +7 -0
- package/dist/components/TreeMapChart/types.d.ts +7 -0
- package/dist/components/VerificationCode/constants.d.ts +1 -0
- package/dist/components/VerificationCode/index.d.ts +0 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/helpers/legend.d.ts +2 -2
- package/dist/helpers/legend.js +1 -1
- package/dist/helpers/nivoTheme.d.ts +1 -1
- package/dist/helpers/treeMap.d.ts +90 -0
- package/dist/helpers/treeMap.js +42 -0
- package/dist/hooks/useIsOverflowing.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -9
- package/dist/ui.css +1 -1
- package/dist/utils/animations/animations.d.ts +27 -0
- package/dist/utils/animations/animations.js +271 -0
- package/dist/utils/animations/animationsVE.css.d.ts +27 -0
- package/dist/utils/animations/animationsVE.css.js +57 -0
- package/dist/utils/index.d.ts +2 -2
- package/package.json +6 -4
- package/dist/components/ActionBar/index.cjs +0 -22
- package/dist/components/ActionBar/styles.css.cjs +0 -10
- package/dist/components/Alert/index.cjs +0 -55
- package/dist/components/Alert/styles.css.cjs +0 -14
- package/dist/components/Avatar/constants.cjs +0 -19
- package/dist/components/Avatar/index.cjs +0 -66
- package/dist/components/Avatar/styles.css.cjs +0 -18
- package/dist/components/Avatar/variables.css.cjs +0 -8
- package/dist/components/Badge/constant.cjs +0 -8
- package/dist/components/Badge/index.cjs +0 -27
- package/dist/components/Badge/styles.css.cjs +0 -6
- package/dist/components/Banner/assets/default-image-small.svg.cjs +0 -3
- package/dist/components/Banner/assets/default-image.svg.cjs +0 -3
- package/dist/components/Banner/index.cjs +0 -74
- package/dist/components/Banner/styles.css.cjs +0 -10
- package/dist/components/BarChart/Tooltip.cjs +0 -22
- package/dist/components/BarChart/index.cjs +0 -60
- package/dist/components/BarChart/styles.css.cjs +0 -9
- package/dist/components/BarStack/index.cjs +0 -35
- package/dist/components/BarStack/styles.css.cjs +0 -11
- package/dist/components/Breadcrumbs/components/Item.cjs +0 -41
- package/dist/components/Breadcrumbs/components/styles.css.cjs +0 -18
- package/dist/components/Breadcrumbs/index.cjs +0 -14
- package/dist/components/Breadcrumbs/styles.css.cjs +0 -5
- package/dist/components/Bullet/index.cjs +0 -24
- package/dist/components/Bullet/styles.css.cjs +0 -6
- package/dist/components/Button/constants.cjs +0 -6
- package/dist/components/Button/index.cjs +0 -84
- package/dist/components/Button/styles.css.cjs +0 -6
- package/dist/components/Card/index.cjs +0 -28
- package/dist/components/Card/styles.css.cjs +0 -7
- package/dist/components/Carousel/index.cjs +0 -74
- package/dist/components/Carousel/styles.css.cjs +0 -15
- package/dist/components/Checkbox/index.cjs +0 -58
- package/dist/components/Checkbox/styles.css.cjs +0 -17
- package/dist/components/CheckboxGroup/index.cjs +0 -78
- package/dist/components/CheckboxGroup/styles.css.cjs +0 -7
- package/dist/components/Chip/ChipContext.cjs +0 -6
- package/dist/components/Chip/ChipIcon.cjs +0 -52
- package/dist/components/Chip/index.cjs +0 -60
- package/dist/components/Chip/styles.css.cjs +0 -7
- package/dist/components/CopyButton/index.cjs +0 -35
- package/dist/components/DateInput/Context.cjs +0 -23
- package/dist/components/DateInput/components/CalendarContent.cjs +0 -61
- package/dist/components/DateInput/components/CalendarDaily.cjs +0 -169
- package/dist/components/DateInput/components/CalendarMonthly.cjs +0 -105
- package/dist/components/DateInput/components/Popup.cjs +0 -28
- package/dist/components/DateInput/components/styles.css.cjs +0 -12
- package/dist/components/DateInput/constants.cjs +0 -6
- package/dist/components/DateInput/helpers.cjs +0 -69
- package/dist/components/DateInput/helpersLocale.cjs +0 -64
- package/dist/components/DateInput/index.cjs +0 -192
- package/dist/components/DateInput/styles.css.cjs +0 -8
- package/dist/components/Dialog/Context.cjs +0 -14
- package/dist/components/Dialog/components/Button.cjs +0 -17
- package/dist/components/Dialog/components/Buttons.cjs +0 -13
- package/dist/components/Dialog/components/CancelButton.cjs +0 -12
- package/dist/components/Dialog/components/Stack.cjs +0 -10
- package/dist/components/Dialog/components/Text.cjs +0 -10
- package/dist/components/Dialog/index.cjs +0 -60
- package/dist/components/Dialog/styles.css.cjs +0 -7
- package/dist/components/Drawer/index.cjs +0 -56
- package/dist/components/Drawer/styles.css.cjs +0 -17
- package/dist/components/EmptyState/index.cjs +0 -42
- package/dist/components/EmptyState/styles.css.cjs +0 -10
- package/dist/components/Expandable/index.cjs +0 -108
- package/dist/components/Expandable/styles.css.cjs +0 -7
- package/dist/components/ExpandableCard/components/Title.cjs +0 -13
- package/dist/components/ExpandableCard/index.cjs +0 -114
- package/dist/components/ExpandableCard/styles.css.cjs +0 -17
- package/dist/components/GlobalAlert/GlobalAlertLink.cjs +0 -25
- package/dist/components/GlobalAlert/index.cjs +0 -39
- package/dist/components/GlobalAlert/styles.css.cjs +0 -7
- package/dist/components/InfiniteScroll/index.cjs +0 -91
- package/dist/components/Key/index.cjs +0 -45
- package/dist/components/Key/styles.css.cjs +0 -6
- package/dist/components/Label/index.cjs +0 -52
- package/dist/components/Label/styles.css.cjs +0 -5
- package/dist/components/LineChart/CustomLegend.cjs +0 -64
- package/dist/components/LineChart/Tooltip.cjs +0 -19
- package/dist/components/LineChart/helpers.cjs +0 -57
- package/dist/components/LineChart/index.cjs +0 -92
- package/dist/components/LineChart/styles.css.cjs +0 -27
- package/dist/components/Link/index.cjs +0 -69
- package/dist/components/Link/styles.css.cjs +0 -14
- package/dist/components/List/Cell.cjs +0 -31
- package/dist/components/List/ColumnProvider.cjs +0 -28
- package/dist/components/List/HeaderCell.cjs +0 -49
- package/dist/components/List/HeaderRow.cjs +0 -26
- package/dist/components/List/ListContext.cjs +0 -210
- package/dist/components/List/Row.cjs +0 -107
- package/dist/components/List/SelectBar.cjs +0 -28
- package/dist/components/List/SkeletonRows.cjs +0 -31
- package/dist/components/List/index.cjs +0 -49
- package/dist/components/List/styles.css.cjs +0 -35
- package/dist/components/List/variables.css.cjs +0 -16
- package/dist/components/Loader/index.cjs +0 -66
- package/dist/components/Loader/styles.css.cjs +0 -7
- package/dist/components/Menu/MenuContent.cjs +0 -177
- package/dist/components/Menu/MenuProvider.cjs +0 -44
- package/dist/components/Menu/components/Group.cjs +0 -25
- package/dist/components/Menu/components/Item.cjs +0 -97
- package/dist/components/Menu/helpers.cjs +0 -48
- package/dist/components/Menu/index.cjs +0 -20
- package/dist/components/Menu/styles.css.cjs +0 -24
- package/dist/components/Meter/index.cjs +0 -34
- package/dist/components/Meter/styles.css.cjs +0 -11
- package/dist/components/Modal/ModalContent.cjs +0 -39
- package/dist/components/Modal/ModalProvider.cjs +0 -41
- package/dist/components/Modal/components/Dialog.cjs +0 -148
- package/dist/components/Modal/components/Disclosure.cjs +0 -42
- package/dist/components/Modal/index.cjs +0 -58
- package/dist/components/Modal/styles.css.cjs +0 -21
- package/dist/components/Notice/index.cjs +0 -17
- package/dist/components/Notice/styles.css.cjs +0 -5
- package/dist/components/Notification/index.cjs +0 -35
- package/dist/components/Notification/styles.css.cjs +0 -5
- package/dist/components/NumberInput/index.cjs +0 -145
- package/dist/components/NumberInput/styles.css.cjs +0 -14
- package/dist/components/Pagination/PaginationButtons.cjs +0 -49
- package/dist/components/Pagination/PerPage.cjs +0 -49
- package/dist/components/Pagination/getPageNumbers.cjs +0 -23
- package/dist/components/Pagination/index.cjs +0 -43
- package/dist/components/Pagination/styles.css.cjs +0 -9
- package/dist/components/PasswordCheck/index.cjs +0 -18
- package/dist/components/PasswordCheck/styles.css.cjs +0 -5
- package/dist/components/PieChart/Legends.cjs +0 -36
- package/dist/components/PieChart/Tooltip.cjs +0 -18
- package/dist/components/PieChart/index.cjs +0 -71
- package/dist/components/PieChart/styles.css.cjs +0 -36
- package/dist/components/Popover/index.cjs +0 -67
- package/dist/components/Popover/styles.css.cjs +0 -8
- package/dist/components/Popup/helpers.cjs +0 -264
- package/dist/components/Popup/index.cjs +0 -283
- package/dist/components/Popup/styles.css.cjs +0 -13
- package/dist/components/Popup/variables.css.cjs +0 -18
- package/dist/components/ProgressBar/index.cjs +0 -46
- package/dist/components/ProgressBar/styles.css.cjs +0 -12
- package/dist/components/ProgressBar/variables.css.cjs +0 -4
- package/dist/components/Radio/index.cjs +0 -69
- package/dist/components/Radio/styles.css.cjs +0 -21
- package/dist/components/RadioGroup/index.cjs +0 -73
- package/dist/components/RadioGroup/styles.css.cjs +0 -5
- package/dist/components/Row/index.cjs +0 -46
- package/dist/components/Row/styles.css.cjs +0 -17
- package/dist/components/Row/variables.css.cjs +0 -7
- package/dist/components/SearchInput/KeyGroup.cjs +0 -13
- package/dist/components/SearchInput/index.cjs +0 -186
- package/dist/components/SearchInput/styles.css.cjs +0 -10
- package/dist/components/SelectInput/SelectInputProvider.cjs +0 -203
- package/dist/components/SelectInput/components/Dropdown.cjs +0 -341
- package/dist/components/SelectInput/components/DropdownOption.cjs +0 -47
- package/dist/components/SelectInput/components/SearchBarDropdown.cjs +0 -117
- package/dist/components/SelectInput/components/SelectBar.cjs +0 -237
- package/dist/components/SelectInput/components/dropdown.css.cjs +0 -34
- package/dist/components/SelectInput/components/selectBar.css.cjs +0 -22
- package/dist/components/SelectInput/findOptionInOptions.cjs +0 -12
- package/dist/components/SelectInput/index.cjs +0 -68
- package/dist/components/SelectInput/styles.css.cjs +0 -7
- package/dist/components/SelectInput/types.cjs +0 -9
- package/dist/components/SelectableCard/index.cjs +0 -149
- package/dist/components/SelectableCard/styles.css.cjs +0 -21
- package/dist/components/SelectableCard/variables.css.cjs +0 -8
- package/dist/components/SelectableCardGroup/index.cjs +0 -75
- package/dist/components/SelectableCardGroup/styles.css.cjs +0 -5
- package/dist/components/SelectableCardOptionGroup/Provider.cjs +0 -24
- package/dist/components/SelectableCardOptionGroup/components/Image.cjs +0 -17
- package/dist/components/SelectableCardOptionGroup/components/Option.cjs +0 -60
- package/dist/components/SelectableCardOptionGroup/index.cjs +0 -51
- package/dist/components/SelectableCardOptionGroup/styles.css.cjs +0 -21
- package/dist/components/Separator/index.cjs +0 -40
- package/dist/components/Separator/styles.css.cjs +0 -10
- package/dist/components/Skeleton/Block.cjs +0 -17
- package/dist/components/Skeleton/Blocks.cjs +0 -20
- package/dist/components/Skeleton/BoxWithIcon.cjs +0 -20
- package/dist/components/Skeleton/Donut.cjs +0 -16
- package/dist/components/Skeleton/IconSkeleton.cjs +0 -7
- package/dist/components/Skeleton/Line.cjs +0 -12
- package/dist/components/Skeleton/List.cjs +0 -18
- package/dist/components/Skeleton/Slider.cjs +0 -14
- package/dist/components/Skeleton/Square.cjs +0 -7
- package/dist/components/Skeleton/index.cjs +0 -39
- package/dist/components/Skeleton/styles.css.cjs +0 -7
- package/dist/components/Skeleton/stylesVariants.css.cjs +0 -47
- package/dist/components/Slider/components/DoubleSlider.cjs +0 -236
- package/dist/components/Slider/components/Options.cjs +0 -35
- package/dist/components/Slider/components/SingleSlider.cjs +0 -153
- package/dist/components/Slider/constant.cjs +0 -4
- package/dist/components/Slider/index.cjs +0 -61
- package/dist/components/Slider/styles.css.cjs +0 -36
- package/dist/components/Snippet/index.cjs +0 -64
- package/dist/components/Snippet/styles.css.cjs +0 -26
- package/dist/components/Stack/index.cjs +0 -85
- package/dist/components/Stack/styles.css.cjs +0 -19
- package/dist/components/Stack/variables.css.cjs +0 -11
- package/dist/components/Status/index.cjs +0 -25
- package/dist/components/Status/styles.css.cjs +0 -11
- package/dist/components/StepList/index.cjs +0 -32
- package/dist/components/StepList/styles.css.cjs +0 -10
- package/dist/components/Stepper/Step.cjs +0 -72
- package/dist/components/Stepper/StepperProvider.cjs +0 -41
- package/dist/components/Stepper/index.cjs +0 -49
- package/dist/components/Stepper/styles.css.cjs +0 -20
- package/dist/components/SwitchButton/FocusOverlay.cjs +0 -16
- package/dist/components/SwitchButton/Option.cjs +0 -40
- package/dist/components/SwitchButton/SwitchButtonContext.cjs +0 -13
- package/dist/components/SwitchButton/constant.cjs +0 -4
- package/dist/components/SwitchButton/index.cjs +0 -110
- package/dist/components/SwitchButton/styles.css.cjs +0 -9
- package/dist/components/Table/Body.cjs +0 -8
- package/dist/components/Table/Cell.cjs +0 -35
- package/dist/components/Table/Header.cjs +0 -9
- package/dist/components/Table/HeaderCell.cjs +0 -55
- package/dist/components/Table/HeaderRow.cjs +0 -28
- package/dist/components/Table/Row.cjs +0 -88
- package/dist/components/Table/SelectBar.cjs +0 -28
- package/dist/components/Table/SkeletonRows.cjs +0 -24
- package/dist/components/Table/TableContext.cjs +0 -43
- package/dist/components/Table/constants.cjs +0 -4
- package/dist/components/Table/index.cjs +0 -56
- package/dist/components/Table/styles.css.cjs +0 -29
- package/dist/components/Table/variables.css.cjs +0 -14
- package/dist/components/Tabs/Tab.cjs +0 -52
- package/dist/components/Tabs/TabMenu.cjs +0 -32
- package/dist/components/Tabs/TabMenuItem.cjs +0 -27
- package/dist/components/Tabs/TabsContext.cjs +0 -7
- package/dist/components/Tabs/index.cjs +0 -74
- package/dist/components/Tabs/styles.css.cjs +0 -21
- package/dist/components/Tag/index.cjs +0 -63
- package/dist/components/Tag/styles.css.cjs +0 -10
- package/dist/components/TagInput/index.cjs +0 -163
- package/dist/components/TagInput/styles.css.cjs +0 -12
- package/dist/components/TagList/constant.cjs +0 -5
- package/dist/components/TagList/index.cjs +0 -163
- package/dist/components/TagList/styles.css.cjs +0 -14
- package/dist/components/Text/constant.d.ts +0 -6
- package/dist/components/Text/index.cjs +0 -53
- package/dist/components/Text/style.css.cjs +0 -6
- package/dist/components/Text/variables.css.cjs +0 -7
- package/dist/components/TextArea/index.cjs +0 -123
- package/dist/components/TextArea/styles.css.cjs +0 -12
- package/dist/components/TextInput/index.cjs +0 -119
- package/dist/components/TextInput/styles.css.cjs +0 -17
- package/dist/components/TimeInput/constants.cjs +0 -13
- package/dist/components/TimeInput/helpers.cjs +0 -66
- package/dist/components/TimeInput/index.cjs +0 -273
- package/dist/components/TimeInput/styles.css.cjs +0 -10
- package/dist/components/Toaster/index.cjs +0 -47
- package/dist/components/Toaster/index.js +0 -47
- package/dist/components/Toaster/styles.css.cjs +0 -7
- package/dist/components/Toggle/index.cjs +0 -50
- package/dist/components/Toggle/styles.css.cjs +0 -10
- package/dist/components/ToggleGroup/index.cjs +0 -72
- package/dist/components/ToggleGroup/styles.css.cjs +0 -5
- package/dist/components/Tooltip/index.cjs +0 -26
- package/dist/components/Tooltip/styles.css.cjs +0 -5
- package/dist/components/UnitInput/index.cjs +0 -111
- package/dist/components/UnitInput/styles.css.cjs +0 -18
- package/dist/components/VerificationCode/index.cjs +0 -148
- package/dist/components/VerificationCode/styles.css.cjs +0 -9
- package/dist/helpers/isClientSide.cjs +0 -4
- package/dist/helpers/legend.cjs +0 -14
- package/dist/helpers/nivoTheme.cjs +0 -22
- package/dist/helpers/recursivelyGetChildrenString.cjs +0 -17
- package/dist/hooks/useIsOverflowing.cjs +0 -23
- package/dist/index.cjs +0 -214
- package/dist/theme/ThemeProvider.cjs +0 -16
- package/dist/theme/index.cjs +0 -38
- package/dist/utils/animationVanillaExtract.css.cjs +0 -11
- package/dist/utils/animationVanillaExtract.css.d.ts +0 -4
- package/dist/utils/animationVanillaExtract.css.js +0 -11
- package/dist/utils/animations.cjs +0 -276
- package/dist/utils/animations.d.ts +0 -162
- package/dist/utils/animations.js +0 -276
- package/dist/utils/ids.cjs +0 -8
- package/dist/utils/normalize.cjs +0 -35
- package/dist/utils/responsive/Breakpoint.cjs +0 -15
- package/dist/utils/responsive/utilities.cjs +0 -17
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const index = require("../Stack/index.cjs");
|
|
7
|
-
const PaginationButtons = require("./PaginationButtons.cjs");
|
|
8
|
-
const PerPage = require("./PerPage.cjs");
|
|
9
|
-
const Pagination = ({
|
|
10
|
-
disabled = false,
|
|
11
|
-
page,
|
|
12
|
-
pageCount,
|
|
13
|
-
onChange,
|
|
14
|
-
pageTabCount = 5,
|
|
15
|
-
className,
|
|
16
|
-
perPage,
|
|
17
|
-
onChangePerPage,
|
|
18
|
-
perPageText,
|
|
19
|
-
numberOfItemsText,
|
|
20
|
-
numberOfItems,
|
|
21
|
-
"data-testid": dataTestId,
|
|
22
|
-
style
|
|
23
|
-
}) => {
|
|
24
|
-
const [perPageComputed, setPerPage] = react.useState(perPage ?? 10);
|
|
25
|
-
react.useEffect(() => {
|
|
26
|
-
if (page < 1) {
|
|
27
|
-
onChange(1);
|
|
28
|
-
}
|
|
29
|
-
if (page > pageCount) {
|
|
30
|
-
onChange(pageCount);
|
|
31
|
-
}
|
|
32
|
-
}, [page, pageCount, onChange]);
|
|
33
|
-
react.useEffect(() => {
|
|
34
|
-
if (perPage) {
|
|
35
|
-
setPerPage(perPage);
|
|
36
|
-
}
|
|
37
|
-
}, [perPage]);
|
|
38
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(index.Stack, { direction: "row", justifyContent: "space-between", style, children: [
|
|
39
|
-
perPage ? /* @__PURE__ */ jsxRuntime.jsx(PerPage.PerPage, { numberOfItems, numberOfItemsText, onChangePerPage, page, perPage: perPageComputed, perPageText, setPerPage }) : null,
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.jsx(PaginationButtons.PaginationButtons, { className, "data-testid": dataTestId, disabled, onChange, page, pageCount, pageTabCount, perPage: !!perPage })
|
|
41
|
-
] });
|
|
42
|
-
};
|
|
43
|
-
exports.Pagination = Pagination;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
;/* empty css */
|
|
4
|
-
var pageNumbersContainer = "uv_a0295u0";
|
|
5
|
-
var pageButton = { small: "uv_a0295u1", medium: "uv_a0295u2" };
|
|
6
|
-
var ellipsisClass = { small: "uv_a0295u4 uv_a0295u3", medium: "uv_a0295u5 uv_a0295u3" };
|
|
7
|
-
exports.ellipsisClass = ellipsisClass;
|
|
8
|
-
exports.pageButton = pageButton;
|
|
9
|
-
exports.pageNumbersContainer = pageNumbersContainer;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const Icon = require("@ultraviolet/icons");
|
|
6
|
-
const index = require("../Stack/index.cjs");
|
|
7
|
-
const index$1 = require("../Text/index.cjs");
|
|
8
|
-
const styles_css = require("./styles.css.cjs");
|
|
9
|
-
const PasswordCheck = ({
|
|
10
|
-
rules,
|
|
11
|
-
className,
|
|
12
|
-
"data-testid": dataTestId,
|
|
13
|
-
style
|
|
14
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className ? `${className} ` : ""}${styles_css.passwordCheckContainer}`, "data-testid": dataTestId, style, children: rules.map((rule) => /* @__PURE__ */ jsxRuntime.jsxs(index.Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
15
|
-
rule.valid ? /* @__PURE__ */ jsxRuntime.jsx(Icon.CheckCircleOutlineIcon, { prominence: "weak", sentiment: "success", size: "large" }) : /* @__PURE__ */ jsxRuntime.jsx(Icon.CloseCircleOutlineIcon, { prominence: "weak", sentiment: "neutral", size: "large" }),
|
|
16
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { as: "p", variant: "bodySmall", children: rule.text })
|
|
17
|
-
] }, rule.name)) });
|
|
18
|
-
exports.PasswordCheck = PasswordCheck;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const dynamic = require("@vanilla-extract/dynamic");
|
|
5
|
-
const index = require("../Tooltip/index.cjs");
|
|
6
|
-
const styles_css = require("./styles.css.cjs");
|
|
7
|
-
const Tooltip = require("./Tooltip.cjs");
|
|
8
|
-
const Legends = ({
|
|
9
|
-
focused,
|
|
10
|
-
data,
|
|
11
|
-
onFocusChange,
|
|
12
|
-
colors
|
|
13
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: styles_css.listPie, children: data?.map((item, index$1) => {
|
|
14
|
-
const isSegmentFocused = focused !== void 0 && item.id === focused;
|
|
15
|
-
const id = `chart-legend-${item.id}`;
|
|
16
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { id, text: /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { data: item }), visible: isSegmentFocused, children: /* @__PURE__ */ jsxRuntime.jsxs("li", { className: styles_css.listItemPie({
|
|
17
|
-
isFocused: isSegmentFocused
|
|
18
|
-
}), children: [
|
|
19
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.toggleBoxPie, "data-testid": id, onBlur: () => onFocusChange(), onFocus: () => onFocusChange(item.id), onMouseOut: () => onFocusChange(), onMouseOver: () => onFocusChange(item.id) }),
|
|
20
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.bulletPie({
|
|
21
|
-
isFocused: isSegmentFocused
|
|
22
|
-
}), color: colors[index$1], id: `chart-legend-${item.id}`, style: dynamic.assignInlineVars({
|
|
23
|
-
[styles_css.colorBullet]: colors[index$1]
|
|
24
|
-
}) }),
|
|
25
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_css.labelPie, children: [
|
|
26
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_css.textPie({
|
|
27
|
-
isFocused: isSegmentFocused
|
|
28
|
-
}), children: item.name }),
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_css.linePie, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_css.progressiveLinePie({
|
|
30
|
-
isFocused: isSegmentFocused
|
|
31
|
-
}) }) })
|
|
32
|
-
] }),
|
|
33
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.valuePie[isSegmentFocused ? "isFocused" : "default"], children: item.value })
|
|
34
|
-
] }) }, item.id);
|
|
35
|
-
}) });
|
|
36
|
-
module.exports = Legends;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const index = require("../Text/index.cjs");
|
|
5
|
-
const styles_css = require("./styles.css.cjs");
|
|
6
|
-
const Tooltip = ({
|
|
7
|
-
data
|
|
8
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tooltip", tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: styles_css.listTooltipPie, children: [
|
|
9
|
-
/* @__PURE__ */ jsxRuntime.jsxs("li", { className: styles_css.itemTooltipPie, children: [
|
|
10
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Text, { as: "p", prominence: "stronger", variant: "body", children: data.name }),
|
|
11
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Text, { as: "p", prominence: "stronger", variant: "body", children: data.value })
|
|
12
|
-
] }),
|
|
13
|
-
data.details?.map((detail) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: styles_css.itemTooltipPie, children: [
|
|
14
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Text, { as: "p", prominence: "stronger", variant: "bodySmall", children: detail.name }),
|
|
15
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Text, { as: "p", prominence: "stronger", variant: "bodySmall", children: detail.value })
|
|
16
|
-
] }, detail.name))
|
|
17
|
-
] }) });
|
|
18
|
-
module.exports = Tooltip;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const pie = require("@nivo/pie");
|
|
6
|
-
const themes = require("@ultraviolet/themes");
|
|
7
|
-
const dynamic = require("@vanilla-extract/dynamic");
|
|
8
|
-
const react = require("react");
|
|
9
|
-
const legend = require("../../helpers/legend.cjs");
|
|
10
|
-
const nivoTheme = require("../../helpers/nivoTheme.cjs");
|
|
11
|
-
const index = require("../Text/index.cjs");
|
|
12
|
-
const Legends = require("./Legends.cjs");
|
|
13
|
-
const styles_css = require("./styles.css.cjs");
|
|
14
|
-
const DEFAULT_CHARTPROPS = {};
|
|
15
|
-
const DEFAULT_MARGIN = {
|
|
16
|
-
bottom: 10,
|
|
17
|
-
left: 10,
|
|
18
|
-
right: 10,
|
|
19
|
-
top: 10
|
|
20
|
-
};
|
|
21
|
-
const PieChart = ({
|
|
22
|
-
height = 206,
|
|
23
|
-
width = 206,
|
|
24
|
-
data = void 0,
|
|
25
|
-
emptyLegend,
|
|
26
|
-
content,
|
|
27
|
-
withLegend = false,
|
|
28
|
-
margin = DEFAULT_MARGIN,
|
|
29
|
-
chartProps = DEFAULT_CHARTPROPS,
|
|
30
|
-
style
|
|
31
|
-
}) => {
|
|
32
|
-
const theme = themes.useTheme();
|
|
33
|
-
const [currentFocusIndex, setCurrentFocusIndex] = react.useState();
|
|
34
|
-
const emptyTooltip = react.useCallback(() => /* @__PURE__ */ jsxRuntime.jsx("span", {}), []);
|
|
35
|
-
const isEmpty = !data || data.length === 0;
|
|
36
|
-
const EmptyLegendDisplayed = react.useCallback(() => emptyLegend ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.emptyLegendPie, children: /* @__PURE__ */ jsxRuntime.jsx(index.Text, { as: "p", variant: "body", children: emptyLegend }) }) : null, [emptyLegend]);
|
|
37
|
-
const localColors = legend.getLegendColor(theme);
|
|
38
|
-
const LegendDisplayer = react.useCallback(() => isEmpty ? /* @__PURE__ */ jsxRuntime.jsx(EmptyLegendDisplayed, {}) : /* @__PURE__ */ jsxRuntime.jsx(Legends, { colors: localColors, data, focused: currentFocusIndex, onFocusChange: setCurrentFocusIndex }), [isEmpty, currentFocusIndex, data, EmptyLegendDisplayed, localColors]);
|
|
39
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_css.containerPie, style: {
|
|
40
|
-
...dynamic.assignInlineVars({
|
|
41
|
-
[styles_css.heightContainerPie]: height ? `${height}px` : ""
|
|
42
|
-
}),
|
|
43
|
-
...style
|
|
44
|
-
}, children: [
|
|
45
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
|
|
46
|
-
position: "relative"
|
|
47
|
-
}, children: [
|
|
48
|
-
/* @__PURE__ */ jsxRuntime.jsx(pie.Pie, { activeOuterRadiusOffset: !isEmpty ? 4 : 0, colors: localColors, cornerRadius: 0, data: !isEmpty ? data : [{
|
|
49
|
-
id: "empty",
|
|
50
|
-
percent: 100
|
|
51
|
-
}], defs: [{
|
|
52
|
-
background: "inherit",
|
|
53
|
-
color: theme.colors.neutral.textStrong,
|
|
54
|
-
id: "lines",
|
|
55
|
-
lineWidth: 2,
|
|
56
|
-
rotation: 0,
|
|
57
|
-
spacing: 5,
|
|
58
|
-
type: "patternLines"
|
|
59
|
-
}], enableArcLabels: false, enableArcLinkLabels: false, height, innerRadius: 0.8, margin, onMouseEnter: (datum, event) => {
|
|
60
|
-
if (!isEmpty) {
|
|
61
|
-
const pie2 = event.currentTarget;
|
|
62
|
-
pie2.style.cursor = "pointer";
|
|
63
|
-
setCurrentFocusIndex(datum.id.toString());
|
|
64
|
-
}
|
|
65
|
-
}, onMouseLeave: () => setCurrentFocusIndex(void 0), padAngle: 1, theme: nivoTheme.getNivoTheme(theme), tooltip: emptyTooltip, value: "percent", width, ...chartProps }),
|
|
66
|
-
content ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.contentPie, children: content }) : null
|
|
67
|
-
] }),
|
|
68
|
-
withLegend ? /* @__PURE__ */ jsxRuntime.jsx(LegendDisplayer, {}) : null
|
|
69
|
-
] });
|
|
70
|
-
};
|
|
71
|
-
exports.PieChart = PieChart;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
;/* empty css */
|
|
4
|
-
const createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
5
|
-
var heightContainerPie = "var(--uv_6tpqrj0)";
|
|
6
|
-
var colorBullet = "var(--uv_6tpqrj1)";
|
|
7
|
-
var containerPie = "uv_6tpqrj3";
|
|
8
|
-
var emptyLegendPie = "uv_6tpqrj4";
|
|
9
|
-
var contentPie = "uv_6tpqrj5";
|
|
10
|
-
var listPie = "uv_6tpqrj6";
|
|
11
|
-
var listItemPie = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_6tpqrj7", variantClassNames: { isFocused: { true: "uv_6tpqrj8", false: "uv_6tpqrj9" } }, defaultVariants: {}, compoundVariants: [] });
|
|
12
|
-
var bulletPie = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_6tpqrja", variantClassNames: { isFocused: { true: "uv_6tpqrjb" } }, defaultVariants: {}, compoundVariants: [] });
|
|
13
|
-
var labelPie = "uv_6tpqrjc";
|
|
14
|
-
var valuePie = { "default": "uv_6tpqrjd", isFocused: "uv_6tpqrje" };
|
|
15
|
-
var textPie = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_6tpqrjf", variantClassNames: { isFocused: { true: "uv_6tpqrjg", false: "uv_6tpqrjh" } }, defaultVariants: {}, compoundVariants: [] });
|
|
16
|
-
var toggleBoxPie = "uv_6tpqrji";
|
|
17
|
-
var linePie = "uv_6tpqrjj";
|
|
18
|
-
var progressiveLinePie = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_6tpqrjk", variantClassNames: { isFocused: { true: "uv_6tpqrjl", false: "uv_6tpqrjm" } }, defaultVariants: {}, compoundVariants: [] });
|
|
19
|
-
var listTooltipPie = "uv_6tpqrjn";
|
|
20
|
-
var itemTooltipPie = "uv_6tpqrjo";
|
|
21
|
-
exports.bulletPie = bulletPie;
|
|
22
|
-
exports.colorBullet = colorBullet;
|
|
23
|
-
exports.containerPie = containerPie;
|
|
24
|
-
exports.contentPie = contentPie;
|
|
25
|
-
exports.emptyLegendPie = emptyLegendPie;
|
|
26
|
-
exports.heightContainerPie = heightContainerPie;
|
|
27
|
-
exports.itemTooltipPie = itemTooltipPie;
|
|
28
|
-
exports.labelPie = labelPie;
|
|
29
|
-
exports.linePie = linePie;
|
|
30
|
-
exports.listItemPie = listItemPie;
|
|
31
|
-
exports.listPie = listPie;
|
|
32
|
-
exports.listTooltipPie = listTooltipPie;
|
|
33
|
-
exports.progressiveLinePie = progressiveLinePie;
|
|
34
|
-
exports.textPie = textPie;
|
|
35
|
-
exports.toggleBoxPie = toggleBoxPie;
|
|
36
|
-
exports.valuePie = valuePie;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const Icon = require("@ultraviolet/icons");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const index$3 = require("../Button/index.cjs");
|
|
8
|
-
const ModalProvider = require("../Modal/ModalProvider.cjs");
|
|
9
|
-
const index = require("../Popup/index.cjs");
|
|
10
|
-
const index$1 = require("../Stack/index.cjs");
|
|
11
|
-
const index$2 = require("../Text/index.cjs");
|
|
12
|
-
const styles_css = require("./styles.css.cjs");
|
|
13
|
-
const ContentWrapper = ({
|
|
14
|
-
title,
|
|
15
|
-
onClose,
|
|
16
|
-
children,
|
|
17
|
-
sentiment
|
|
18
|
-
}) => /* @__PURE__ */ jsxRuntime.jsxs(index$1.Stack, { className: styles_css.stackPopover, gap: 1, children: [
|
|
19
|
-
/* @__PURE__ */ jsxRuntime.jsxs(index$1.Stack, { direction: "row", justifyContent: "space-between", children: [
|
|
20
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$2.Text, { as: "h3", prominence: sentiment === "neutral" ? "strong" : "stronger", sentiment: sentiment === "neutral" ? "neutral" : "white", variant: "bodyStrong", children: title }),
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$3.Button, { "aria-label": "close", onClick: onClose, sentiment: sentiment === "neutral" ? "neutral" : "primary", size: "small", variant: sentiment === "neutral" ? "ghost" : "filled", children: /* @__PURE__ */ jsxRuntime.jsx(Icon.CloseIcon, {}) })
|
|
22
|
-
] }),
|
|
23
|
-
typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$2.Text, { as: "p", prominence: sentiment === "neutral" ? "strong" : "stronger", sentiment: sentiment === "neutral" ? "neutral" : "white", variant: "bodySmall", children }) : children
|
|
24
|
-
] });
|
|
25
|
-
const Popover = react.forwardRef(({
|
|
26
|
-
visible = false,
|
|
27
|
-
children,
|
|
28
|
-
placement,
|
|
29
|
-
content,
|
|
30
|
-
title,
|
|
31
|
-
sentiment = "neutral",
|
|
32
|
-
size = "medium",
|
|
33
|
-
onClose,
|
|
34
|
-
className,
|
|
35
|
-
maxWidth,
|
|
36
|
-
maxHeight,
|
|
37
|
-
"data-testid": dataTestId,
|
|
38
|
-
portalTarget,
|
|
39
|
-
dynamicDomRendering,
|
|
40
|
-
align,
|
|
41
|
-
style
|
|
42
|
-
}, ref) => {
|
|
43
|
-
const innerRef = react.useRef(null);
|
|
44
|
-
const isInsideModal = react.useContext(ModalProvider.ModalContext);
|
|
45
|
-
const [localVisible, setLocalVisible] = react.useState(visible);
|
|
46
|
-
react.useEffect(() => {
|
|
47
|
-
setLocalVisible(visible);
|
|
48
|
-
}, [visible]);
|
|
49
|
-
const localOnClose = react.useCallback(() => {
|
|
50
|
-
setLocalVisible(false);
|
|
51
|
-
onClose?.();
|
|
52
|
-
}, [onClose]);
|
|
53
|
-
const smartPortalTarget = react.useMemo(() => {
|
|
54
|
-
if (!portalTarget && isInsideModal) {
|
|
55
|
-
return void 0;
|
|
56
|
-
}
|
|
57
|
-
if (!portalTarget && !isInsideModal) {
|
|
58
|
-
return document.body;
|
|
59
|
-
}
|
|
60
|
-
return portalTarget;
|
|
61
|
-
}, [isInsideModal, portalTarget]);
|
|
62
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index.Popup, { align, className: `${className ? `${className} ` : ""}${styles_css.popover({
|
|
63
|
-
sentiment,
|
|
64
|
-
size
|
|
65
|
-
})}`, "data-testid": dataTestId, debounceDelay: 0, dynamicDomRendering, hideOnClickOutside: true, innerRef, maxHeight, maxWidth, onClose: localOnClose, placement, portalTarget: smartPortalTarget, ref, role: "dialog", style, tabIndex: -1, text: /* @__PURE__ */ jsxRuntime.jsx(ContentWrapper, { onClose: localOnClose, sentiment, title, children: content }), visible: localVisible, children });
|
|
66
|
-
});
|
|
67
|
-
exports.Popover = Popover;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
;/* empty css */
|
|
4
|
-
const createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
5
|
-
var popover = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_1awdzfa0", variantClassNames: { sentiment: { neutral: "uv_1awdzfa1", primary: "uv_1awdzfa2" }, size: { large: "uv_1awdzfa3", medium: "uv_1awdzfa4", small: "uv_1awdzfa5" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6
|
-
var stackPopover = "uv_1awdzfa6";
|
|
7
|
-
exports.popover = popover;
|
|
8
|
-
exports.stackPopover = stackPopover;
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const DEFAULT_ARROW_WIDTH = 8;
|
|
4
|
-
const SPACE = 4;
|
|
5
|
-
const TOTAL_USED_SPACE = 0;
|
|
6
|
-
const DEFAULT_POSITIONS = {
|
|
7
|
-
arrowLeft: 0,
|
|
8
|
-
arrowTop: 0,
|
|
9
|
-
arrowTransform: "translate(-50%, -50)",
|
|
10
|
-
placement: "top",
|
|
11
|
-
popupInitialPosition: "translate3d(0px, 0px, 0)",
|
|
12
|
-
popupPosition: "translate3d(0px, 0px, 0)",
|
|
13
|
-
rotate: 135
|
|
14
|
-
};
|
|
15
|
-
const computePlacement = ({
|
|
16
|
-
childrenStructuredRef,
|
|
17
|
-
popupStructuredRef,
|
|
18
|
-
offsetParentRect,
|
|
19
|
-
offsetParent,
|
|
20
|
-
popupPortalTarget,
|
|
21
|
-
isNestedMenu
|
|
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 (isNestedMenu) {
|
|
42
|
-
if (overloadedChildrenRight + popupWidth + TOTAL_USED_SPACE > window.innerWidth) {
|
|
43
|
-
return "left";
|
|
44
|
-
}
|
|
45
|
-
return "right";
|
|
46
|
-
}
|
|
47
|
-
if (overloadedChildrenTop - popupHeight - TOTAL_USED_SPACE < 0) {
|
|
48
|
-
return "bottom";
|
|
49
|
-
}
|
|
50
|
-
if (overloadedChildrenLeft - popupWidth - TOTAL_USED_SPACE < 0) {
|
|
51
|
-
return "right";
|
|
52
|
-
}
|
|
53
|
-
if (overloadedChildrenRight + popupWidth + TOTAL_USED_SPACE > window.innerWidth) {
|
|
54
|
-
return "left";
|
|
55
|
-
}
|
|
56
|
-
return "top";
|
|
57
|
-
};
|
|
58
|
-
const findOffsetParent = (element) => {
|
|
59
|
-
const offsetParent = element?.current?.offsetParent;
|
|
60
|
-
if (offsetParent && !["TH", "TD", "TABLE"].includes(offsetParent.tagName)) {
|
|
61
|
-
return offsetParent;
|
|
62
|
-
}
|
|
63
|
-
let currentElement = element?.current;
|
|
64
|
-
while (currentElement && currentElement.tagName !== "BODY") {
|
|
65
|
-
const {
|
|
66
|
-
position
|
|
67
|
-
} = window.getComputedStyle(currentElement);
|
|
68
|
-
if (position !== "static") {
|
|
69
|
-
return currentElement;
|
|
70
|
-
}
|
|
71
|
-
currentElement = currentElement.parentElement;
|
|
72
|
-
}
|
|
73
|
-
return document.body;
|
|
74
|
-
};
|
|
75
|
-
const getPopupOverflowFromParent = (position, offsetParentRect, childrenRect, popupStructuredRef, arrowWidth) => {
|
|
76
|
-
const {
|
|
77
|
-
top: parentTop,
|
|
78
|
-
left: parentLeft,
|
|
79
|
-
right: parentRight
|
|
80
|
-
} = offsetParentRect;
|
|
81
|
-
const {
|
|
82
|
-
top: childrenTop,
|
|
83
|
-
bottom: childrenBottom,
|
|
84
|
-
left: childrenLeft,
|
|
85
|
-
right: childrenRight,
|
|
86
|
-
width: childrenWidth
|
|
87
|
-
} = childrenRect;
|
|
88
|
-
const {
|
|
89
|
-
width: popupWidth,
|
|
90
|
-
height: popupHeight
|
|
91
|
-
} = popupStructuredRef;
|
|
92
|
-
const popupHalfWidthWithArrow = popupWidth / 2 - arrowWidth - 1;
|
|
93
|
-
const popupHalfHeightWithArrow = popupHeight / 2 - arrowWidth - 1;
|
|
94
|
-
if (position === "top" || position === "bottom") {
|
|
95
|
-
const popupOverflowRight = childrenRight - childrenWidth / 2 + popupWidth / 2;
|
|
96
|
-
const popupOverflowLeft = childrenLeft + childrenWidth / 2 - parentLeft - popupWidth / 2;
|
|
97
|
-
if (popupOverflowRight > parentRight) {
|
|
98
|
-
if (Math.abs(popupOverflowRight - parentRight) > popupHalfWidthWithArrow) {
|
|
99
|
-
return -popupHalfWidthWithArrow;
|
|
100
|
-
}
|
|
101
|
-
return parentRight - popupOverflowRight;
|
|
102
|
-
}
|
|
103
|
-
if (popupOverflowLeft < 0) {
|
|
104
|
-
if (Math.abs(popupOverflowLeft) > popupHalfWidthWithArrow) {
|
|
105
|
-
return popupHalfWidthWithArrow;
|
|
106
|
-
}
|
|
107
|
-
return Math.abs(popupOverflowLeft);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (position === "left" || position === "right") {
|
|
111
|
-
const popupOverflowTop = childrenTop - parentTop - popupHeight / 2;
|
|
112
|
-
if (popupOverflowTop < 0) {
|
|
113
|
-
if (Math.abs(childrenTop - parentTop - popupHalfHeightWithArrow) > popupHalfHeightWithArrow) {
|
|
114
|
-
return popupHalfHeightWithArrow;
|
|
115
|
-
}
|
|
116
|
-
return Math.abs(popupOverflowTop);
|
|
117
|
-
}
|
|
118
|
-
if (childrenBottom + popupHeight > window.innerHeight) {
|
|
119
|
-
return -popupHalfHeightWithArrow;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return 0;
|
|
123
|
-
};
|
|
124
|
-
const computePositions = ({
|
|
125
|
-
placement,
|
|
126
|
-
childrenRef,
|
|
127
|
-
popupRef,
|
|
128
|
-
popupPortalTarget,
|
|
129
|
-
hasArrow,
|
|
130
|
-
align
|
|
131
|
-
}) => {
|
|
132
|
-
const arrowWidth = hasArrow ? DEFAULT_ARROW_WIDTH : 0;
|
|
133
|
-
const childrenRect = childrenRef.current.getBoundingClientRect();
|
|
134
|
-
const offsetParent = findOffsetParent(childrenRef);
|
|
135
|
-
const offsetParentRect = offsetParent?.getBoundingClientRect() ?? {
|
|
136
|
-
left: 0,
|
|
137
|
-
right: window?.innerWidth ?? 0,
|
|
138
|
-
top: 0
|
|
139
|
-
};
|
|
140
|
-
const popupStructuredRef = popupRef.current.getBoundingClientRect();
|
|
141
|
-
const placementBasedOnWindowSize = placement === "auto" ? computePlacement({
|
|
142
|
-
childrenStructuredRef: childrenRect,
|
|
143
|
-
offsetParent,
|
|
144
|
-
offsetParentRect,
|
|
145
|
-
popupPortalTarget,
|
|
146
|
-
popupStructuredRef
|
|
147
|
-
}) : placement;
|
|
148
|
-
const {
|
|
149
|
-
top: childrenTop,
|
|
150
|
-
left: childrenLeft,
|
|
151
|
-
right: childrenRight,
|
|
152
|
-
width: childrenWidth,
|
|
153
|
-
height: childrenHeight
|
|
154
|
-
} = childrenRect;
|
|
155
|
-
const {
|
|
156
|
-
top: parentTop,
|
|
157
|
-
left: parentLeft
|
|
158
|
-
} = offsetParentRect;
|
|
159
|
-
const {
|
|
160
|
-
width: popupWidth,
|
|
161
|
-
height: popupHeight
|
|
162
|
-
} = popupStructuredRef;
|
|
163
|
-
const isPopupPortalTargetBody = popupPortalTarget === document.body || offsetParent === document.body;
|
|
164
|
-
const scrollTopValue = isPopupPortalTargetBody ? document.documentElement.scrollTop : offsetParent.scrollTop;
|
|
165
|
-
const overloadedChildrenLeft = isPopupPortalTargetBody ? childrenLeft : childrenLeft - parentLeft;
|
|
166
|
-
const overloadedChildrenTop = isPopupPortalTargetBody ? childrenTop : childrenTop - parentTop;
|
|
167
|
-
const overloadedChildrenRight = isPopupPortalTargetBody ? childrenRight : childrenLeft - parentLeft + childrenWidth;
|
|
168
|
-
const popupOverflow = getPopupOverflowFromParent(placementBasedOnWindowSize, offsetParentRect, childrenRect, popupStructuredRef, arrowWidth);
|
|
169
|
-
const isAligned = align === "start";
|
|
170
|
-
switch (placementBasedOnWindowSize) {
|
|
171
|
-
case "bottom": {
|
|
172
|
-
const positionX = isAligned ? overloadedChildrenLeft : overloadedChildrenLeft + childrenWidth / 2 - popupWidth / 2;
|
|
173
|
-
const positionY = overloadedChildrenTop + scrollTopValue + childrenHeight + arrowWidth + SPACE;
|
|
174
|
-
const computedPositionX = !isAligned ? positionX + popupOverflow : positionX;
|
|
175
|
-
const finalPositionX = isPopupPortalTargetBody ? Math.max(computedPositionX, 0) : computedPositionX;
|
|
176
|
-
return {
|
|
177
|
-
arrowLeft: isAligned ? childrenWidth / 2 - arrowWidth : popupWidth / 2 + popupOverflow * -1,
|
|
178
|
-
arrowTop: -arrowWidth - 5,
|
|
179
|
-
arrowTransform: "",
|
|
180
|
-
placement: "bottom",
|
|
181
|
-
popupInitialPosition: `translate3d(${finalPositionX}px, ${positionY - TOTAL_USED_SPACE}px, 0)`,
|
|
182
|
-
popupPosition: `translate3d(${finalPositionX}px, ${positionY}px, 0)`,
|
|
183
|
-
rotate: 180
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
case "left": {
|
|
187
|
-
const positionX = overloadedChildrenLeft - popupWidth - arrowWidth - SPACE * 2;
|
|
188
|
-
const positionY = isAligned ? overloadedChildrenTop + scrollTopValue : overloadedChildrenTop + scrollTopValue - popupHeight / 2 + childrenHeight / 2;
|
|
189
|
-
return {
|
|
190
|
-
arrowLeft: popupWidth + arrowWidth + 5,
|
|
191
|
-
arrowTop: isAligned ? childrenHeight / 2 - arrowWidth : popupHeight / 2 + popupOverflow * -1,
|
|
192
|
-
arrowTransform: "translate(-50%, -50%)",
|
|
193
|
-
placement: "left",
|
|
194
|
-
popupInitialPosition: `translate3d(${positionX + TOTAL_USED_SPACE}px, ${positionY + popupOverflow}px, 0)`,
|
|
195
|
-
popupPosition: `translate3d(${positionX}px, ${positionY + popupOverflow}px, 0)`,
|
|
196
|
-
rotate: -90
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
case "right": {
|
|
200
|
-
const positionX = overloadedChildrenRight + arrowWidth + SPACE * 2;
|
|
201
|
-
const positionY = isAligned ? overloadedChildrenTop + scrollTopValue : overloadedChildrenTop + scrollTopValue - popupHeight / 2 + childrenHeight / 2;
|
|
202
|
-
return {
|
|
203
|
-
arrowLeft: -arrowWidth - 5,
|
|
204
|
-
arrowTop: isAligned ? childrenHeight / 2 - arrowWidth : popupHeight / 2 + popupOverflow * -1,
|
|
205
|
-
arrowTransform: "translate(50%, -50%)",
|
|
206
|
-
placement: "right",
|
|
207
|
-
popupInitialPosition: `translate3d(${positionX - TOTAL_USED_SPACE}px, ${positionY + popupOverflow}px, 0)`,
|
|
208
|
-
popupPosition: `translate3d(${positionX}px, ${positionY + popupOverflow}px, 0)`,
|
|
209
|
-
rotate: 90
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
case "nested-menu": {
|
|
213
|
-
if (computePlacement({
|
|
214
|
-
childrenStructuredRef: childrenRect,
|
|
215
|
-
isNestedMenu: true,
|
|
216
|
-
offsetParent,
|
|
217
|
-
offsetParentRect,
|
|
218
|
-
popupPortalTarget,
|
|
219
|
-
popupStructuredRef
|
|
220
|
-
}) === "right") {
|
|
221
|
-
const positionX2 = overloadedChildrenRight + arrowWidth + SPACE * 2;
|
|
222
|
-
const positionY2 = isAligned ? overloadedChildrenTop + scrollTopValue : overloadedChildrenTop + scrollTopValue - popupHeight / 8;
|
|
223
|
-
return {
|
|
224
|
-
arrowLeft: -arrowWidth - 5,
|
|
225
|
-
arrowTop: isAligned ? childrenHeight / 2 - arrowWidth : popupHeight / 2 + popupOverflow * -1,
|
|
226
|
-
arrowTransform: "translate(50%, -50%)",
|
|
227
|
-
placement: "right",
|
|
228
|
-
popupInitialPosition: `translate3d(${positionX2 - TOTAL_USED_SPACE}px, ${positionY2 + popupOverflow}px, 0)`,
|
|
229
|
-
popupPosition: `translate3d(${positionX2}px, ${positionY2 + popupOverflow}px, 0)`,
|
|
230
|
-
rotate: 90
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
const positionX = overloadedChildrenLeft - popupWidth - arrowWidth - SPACE * 2;
|
|
234
|
-
const positionY = isAligned ? overloadedChildrenTop + scrollTopValue : overloadedChildrenTop + scrollTopValue - popupHeight / 2 + childrenHeight / 2;
|
|
235
|
-
return {
|
|
236
|
-
arrowLeft: popupWidth + arrowWidth + 5,
|
|
237
|
-
arrowTop: isAligned ? childrenHeight / 2 - arrowWidth : popupHeight / 2 + popupOverflow * -1,
|
|
238
|
-
arrowTransform: "translate(-50%, -50%)",
|
|
239
|
-
placement: "left",
|
|
240
|
-
popupInitialPosition: `translate3d(${positionX + TOTAL_USED_SPACE}px, ${positionY + popupOverflow}px, 0)`,
|
|
241
|
-
popupPosition: `translate3d(${positionX}px, ${positionY + popupOverflow}px, 0)`,
|
|
242
|
-
rotate: -90
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
default: {
|
|
246
|
-
const positionX = isAligned ? overloadedChildrenLeft : overloadedChildrenLeft + childrenWidth / 2 - popupWidth / 2;
|
|
247
|
-
const positionY = overloadedChildrenTop + scrollTopValue - popupHeight - arrowWidth - SPACE;
|
|
248
|
-
const computedPositionX = !isAligned ? positionX + popupOverflow : positionX;
|
|
249
|
-
const finalPositionX = isPopupPortalTargetBody ? Math.max(computedPositionX, 0) : computedPositionX;
|
|
250
|
-
return {
|
|
251
|
-
arrowLeft: isAligned ? childrenWidth / 2 - arrowWidth : popupWidth / 2 + popupOverflow * -1,
|
|
252
|
-
arrowTop: popupHeight - 1,
|
|
253
|
-
arrowTransform: "",
|
|
254
|
-
placement: "top",
|
|
255
|
-
popupInitialPosition: `translate3d(${finalPositionX}px, ${positionY + TOTAL_USED_SPACE}px, 0)`,
|
|
256
|
-
popupPosition: `translate3d(${finalPositionX}px, ${positionY}px, 0)`,
|
|
257
|
-
rotate: 0
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
exports.DEFAULT_ARROW_WIDTH = DEFAULT_ARROW_WIDTH;
|
|
263
|
-
exports.DEFAULT_POSITIONS = DEFAULT_POSITIONS;
|
|
264
|
-
exports.computePositions = computePositions;
|