@ultraviolet/ui 3.0.0-beta.27 → 3.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -18
- package/dist/components/ActionBar/index.js +19 -7
- package/dist/components/Alert/index.d.ts +2 -1
- package/dist/components/Alert/index.js +98 -20
- package/dist/components/Alert/styles.css.d.ts +10 -1
- package/dist/components/Alert/styles.css.js +7 -5
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Avatar/index.js +46 -36
- package/dist/components/Avatar/styles.css.js +0 -1
- package/dist/components/Avatar/variables.css.js +1 -0
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +19 -8
- package/dist/components/Banner/index.d.ts +1 -1
- package/dist/components/Banner/index.js +87 -28
- package/dist/components/BarChart/Tooltip.d.ts +1 -1
- package/dist/components/BarChart/Tooltip.js +23 -10
- package/dist/components/BarChart/index.d.ts +1 -1
- package/dist/components/BarChart/index.js +51 -31
- package/dist/components/BarStack/index.d.ts +1 -1
- package/dist/components/BarStack/index.js +64 -19
- package/dist/components/Breadcrumbs/components/Item.d.ts +1 -1
- package/dist/components/Breadcrumbs/components/Item.js +48 -12
- package/dist/components/Breadcrumbs/index.js +11 -2
- package/dist/components/Bullet/index.d.ts +1 -1
- package/dist/components/Bullet/index.js +10 -7
- package/dist/components/Button/index.js +122 -72
- package/dist/components/Card/index.js +80 -20
- package/dist/components/Carousel/index.d.ts +3 -3
- package/dist/components/Carousel/index.js +72 -26
- package/dist/components/Checkbox/index.js +139 -43
- package/dist/components/CheckboxGroup/index.d.ts +3 -3
- package/dist/components/CheckboxGroup/index.js +77 -24
- package/dist/components/Chip/ChipIcon.d.ts +1 -1
- package/dist/components/Chip/ChipIcon.js +46 -12
- package/dist/components/Chip/index.d.ts +3 -3
- package/dist/components/Chip/index.js +36 -11
- package/dist/components/CopyButton/index.d.ts +1 -1
- package/dist/components/CopyButton/index.js +23 -8
- package/dist/components/DateInput/components/CalendarContent.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarContent.js +61 -26
- package/dist/components/DateInput/components/CalendarDaily.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarDaily.js +105 -62
- package/dist/components/DateInput/components/CalendarMonthly.d.ts +1 -1
- package/dist/components/DateInput/components/CalendarMonthly.js +62 -39
- package/dist/components/DateInput/components/Popup.d.ts +1 -1
- package/dist/components/DateInput/components/Popup.js +29 -6
- package/dist/components/DateInput/helpers.js +9 -2
- package/dist/components/DateInput/helpersLocale.js +3 -9
- package/dist/components/DateInput/index.d.ts +1 -1
- package/dist/components/DateInput/index.js +193 -62
- package/dist/components/Dialog/Context.js +3 -1
- package/dist/components/Dialog/components/Button.d.ts +1 -1
- package/dist/components/Dialog/components/Button.js +12 -2
- package/dist/components/Dialog/components/Buttons.d.ts +1 -1
- package/dist/components/Dialog/components/Buttons.js +1 -1
- package/dist/components/Dialog/components/CancelButton.d.ts +1 -1
- package/dist/components/Dialog/components/CancelButton.js +12 -2
- package/dist/components/Dialog/components/Stack.d.ts +1 -1
- package/dist/components/Dialog/components/Stack.js +2 -5
- package/dist/components/Dialog/components/Text.d.ts +1 -1
- package/dist/components/Dialog/components/Text.js +2 -5
- package/dist/components/Dialog/index.d.ts +7 -7
- package/dist/components/Dialog/index.js +43 -12
- package/dist/components/Drawer/index.d.ts +4 -4
- package/dist/components/Drawer/index.js +53 -15
- package/dist/components/EmptyState/index.d.ts +1 -1
- package/dist/components/EmptyState/index.js +63 -21
- package/dist/components/Expandable/index.d.ts +2 -2
- package/dist/components/Expandable/index.js +52 -15
- package/dist/components/ExpandableCard/components/Title.d.ts +1 -1
- package/dist/components/ExpandableCard/components/Title.js +12 -2
- package/dist/components/ExpandableCard/index.d.ts +1 -1
- package/dist/components/ExpandableCard/index.js +197 -96
- package/dist/components/GlobalAlert/GlobalAlertLink.d.ts +1 -1
- package/dist/components/GlobalAlert/GlobalAlertLink.js +21 -5
- package/dist/components/GlobalAlert/index.d.ts +2 -2
- package/dist/components/GlobalAlert/index.js +51 -11
- package/dist/components/InfiniteScroll/index.d.ts +1 -1
- package/dist/components/InfiniteScroll/index.js +40 -33
- package/dist/components/Key/index.d.ts +1 -1
- package/dist/components/Key/index.js +29 -8
- package/dist/components/Label/index.d.ts +1 -1
- package/dist/components/Label/index.js +67 -6
- package/dist/components/LineChart/CustomLegend.d.ts +1 -1
- package/dist/components/LineChart/CustomLegend.js +69 -45
- package/dist/components/LineChart/Tooltip.d.ts +1 -1
- package/dist/components/LineChart/Tooltip.js +31 -9
- package/dist/components/LineChart/helpers.js +13 -12
- package/dist/components/LineChart/index.d.ts +1 -1
- package/dist/components/LineChart/index.js +56 -40
- package/dist/components/Link/index.js +74 -57
- package/dist/components/List/Cell.js +24 -22
- package/dist/components/List/ColumnProvider.d.ts +1 -1
- package/dist/components/List/ColumnProvider.js +12 -6
- package/dist/components/List/HeaderCell.d.ts +1 -1
- package/dist/components/List/HeaderCell.js +36 -19
- package/dist/components/List/HeaderRow.d.ts +1 -1
- package/dist/components/List/HeaderRow.js +14 -12
- package/dist/components/List/ListContext.d.ts +1 -1
- package/dist/components/List/ListContext.js +128 -78
- package/dist/components/List/Row.js +166 -90
- package/dist/components/List/SelectBar.d.ts +1 -1
- package/dist/components/List/SelectBar.js +20 -10
- package/dist/components/List/SkeletonRows.d.ts +1 -1
- package/dist/components/List/SkeletonRows.js +26 -16
- package/dist/components/List/index.d.ts +1 -1
- package/dist/components/List/index.js +60 -22
- package/dist/components/Loader/index.d.ts +1 -1
- package/dist/components/Loader/index.js +47 -23
- package/dist/components/Menu/MenuContent.d.ts +1 -1
- package/dist/components/Menu/MenuContent.js +216 -162
- package/dist/components/Menu/MenuProvider.d.ts +1 -1
- package/dist/components/Menu/MenuProvider.js +26 -13
- package/dist/components/Menu/components/Group.d.ts +1 -1
- package/dist/components/Menu/components/Group.js +11 -2
- package/dist/components/Menu/components/Item.js +144 -82
- package/dist/components/Menu/helpers.js +3 -1
- package/dist/components/Menu/index.d.ts +2 -2
- package/dist/components/Menu/index.js +5 -11
- package/dist/components/Menu/types.d.ts +2 -2
- package/dist/components/Meter/index.d.ts +1 -1
- package/dist/components/Meter/index.js +43 -12
- package/dist/components/Modal/ModalContent.d.ts +1 -1
- package/dist/components/Modal/ModalContent.js +41 -11
- package/dist/components/Modal/ModalProvider.d.ts +1 -1
- package/dist/components/Modal/ModalProvider.js +14 -11
- package/dist/components/Modal/components/Dialog.js +91 -47
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.js +60 -3
- package/dist/components/Notice/index.d.ts +1 -1
- package/dist/components/Notice/index.js +24 -5
- package/dist/components/Notification/Notification.js +12 -2
- package/dist/components/Notification/NotificationContainer.d.ts +1 -1
- package/dist/components/Notification/NotificationContainer.js +18 -2
- package/dist/components/NumberInput/index.d.ts +1 -1
- package/dist/components/NumberInput/index.js +239 -130
- package/dist/components/Pagination/PaginationButtons.d.ts +1 -1
- package/dist/components/Pagination/PaginationButtons.js +75 -10
- package/dist/components/Pagination/PerPage.d.ts +1 -1
- package/dist/components/Pagination/PerPage.js +32 -17
- package/dist/components/Pagination/getPageNumbers.js +12 -13
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/Pagination/index.js +26 -3
- package/dist/components/PasswordCheck/index.d.ts +1 -1
- package/dist/components/PasswordCheck/index.js +27 -5
- package/dist/components/PieChart/Legends.d.ts +1 -1
- package/dist/components/PieChart/Legends.js +52 -20
- package/dist/components/PieChart/Tooltip.d.ts +1 -1
- package/dist/components/PieChart/Tooltip.js +2 -4
- package/dist/components/PieChart/index.d.ts +1 -1
- package/dist/components/PieChart/index.js +80 -40
- package/dist/components/Popover/index.js +104 -46
- package/dist/components/Popup/helpers.d.ts +5 -1
- package/dist/components/Popup/helpers.js +49 -35
- package/dist/components/Popup/index.d.ts +2 -1
- package/dist/components/Popup/index.js +373 -255
- package/dist/components/Popup/styles.css.js +0 -1
- package/dist/components/Popup/variables.css.js +1 -0
- package/dist/components/ProgressBar/index.d.ts +1 -1
- package/dist/components/ProgressBar/index.js +74 -20
- package/dist/components/Radio/index.js +83 -51
- package/dist/components/RadioGroup/index.d.ts +2 -2
- package/dist/components/RadioGroup/index.js +74 -20
- package/dist/components/Row/index.d.ts +1 -1
- package/dist/components/Row/index.js +38 -27
- package/dist/components/Row/styles.css.d.ts +11 -0
- package/dist/components/Row/styles.css.js +2 -2
- package/dist/components/SearchInput/KeyGroup.d.ts +1 -1
- package/dist/components/SearchInput/KeyGroup.js +2 -6
- package/dist/components/SearchInput/index.js +232 -164
- package/dist/components/SelectInput/SelectInputProvider.d.ts +1 -1
- package/dist/components/SelectInput/SelectInputProvider.js +91 -55
- package/dist/components/SelectInput/components/Dropdown.d.ts +1 -1
- package/dist/components/SelectInput/components/Dropdown.js +442 -101
- package/dist/components/SelectInput/components/DropdownOption.d.ts +1 -1
- package/dist/components/SelectInput/components/DropdownOption.js +176 -27
- package/dist/components/SelectInput/components/SearchBarDropdown.d.ts +1 -1
- package/dist/components/SelectInput/components/SearchBarDropdown.js +40 -14
- package/dist/components/SelectInput/components/SelectBar.d.ts +1 -1
- package/dist/components/SelectInput/components/SelectBar.js +252 -97
- package/dist/components/SelectInput/index.d.ts +1 -1
- package/dist/components/SelectInput/index.js +102 -10
- package/dist/components/SelectableCard/index.js +200 -114
- package/dist/components/SelectableCardGroup/index.d.ts +2 -2
- package/dist/components/SelectableCardGroup/index.js +67 -25
- package/dist/components/SelectableCardOptionGroup/Provider.js +3 -1
- package/dist/components/SelectableCardOptionGroup/components/Image.d.ts +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Image.js +12 -8
- package/dist/components/SelectableCardOptionGroup/components/Option.d.ts +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Option.js +96 -19
- package/dist/components/SelectableCardOptionGroup/index.d.ts +2 -2
- package/dist/components/SelectableCardOptionGroup/index.js +53 -17
- package/dist/components/Separator/index.d.ts +1 -1
- package/dist/components/Separator/index.js +43 -26
- package/dist/components/Skeleton/Block.d.ts +1 -1
- package/dist/components/Skeleton/Block.js +2 -6
- package/dist/components/Skeleton/Blocks.d.ts +1 -1
- package/dist/components/Skeleton/Blocks.js +14 -9
- package/dist/components/Skeleton/BoxWithIcon.d.ts +1 -1
- package/dist/components/Skeleton/BoxWithIcon.js +14 -9
- package/dist/components/Skeleton/Donut.d.ts +1 -1
- package/dist/components/Skeleton/Donut.js +10 -2
- package/dist/components/Skeleton/IconSkeleton.d.ts +1 -1
- package/dist/components/Skeleton/IconSkeleton.js +1 -1
- package/dist/components/Skeleton/Line.d.ts +1 -1
- package/dist/components/Skeleton/Line.js +10 -4
- package/dist/components/Skeleton/List.d.ts +1 -1
- package/dist/components/Skeleton/List.js +3 -9
- package/dist/components/Skeleton/Slider.d.ts +1 -1
- package/dist/components/Skeleton/Slider.js +11 -8
- package/dist/components/Skeleton/Square.d.ts +1 -1
- package/dist/components/Skeleton/Square.js +1 -1
- package/dist/components/Skeleton/index.d.ts +9 -9
- package/dist/components/Skeleton/index.js +16 -5
- package/dist/components/Slider/components/DoubleSlider.d.ts +1 -1
- package/dist/components/Slider/components/DoubleSlider.js +191 -88
- package/dist/components/Slider/components/Options.d.ts +1 -1
- package/dist/components/Slider/components/Options.js +44 -28
- package/dist/components/Slider/components/SingleSlider.d.ts +1 -1
- package/dist/components/Slider/components/SingleSlider.js +133 -53
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +82 -12
- package/dist/components/Snippet/index.d.ts +1 -1
- package/dist/components/Snippet/index.js +103 -19
- package/dist/components/Stack/index.d.ts +1 -1
- package/dist/components/Stack/index.js +20 -24
- package/dist/components/Stack/styles.css.js +2 -2
- package/dist/components/Status/index.d.ts +1 -1
- package/dist/components/Status/index.js +13 -11
- package/dist/components/StepList/index.d.ts +2 -2
- package/dist/components/StepList/index.js +31 -10
- package/dist/components/Stepper/Step.d.ts +1 -1
- package/dist/components/Stepper/Step.js +65 -30
- package/dist/components/Stepper/StepperProvider.d.ts +1 -1
- package/dist/components/Stepper/StepperProvider.js +13 -10
- package/dist/components/Stepper/index.d.ts +2 -2
- package/dist/components/Stepper/index.js +46 -26
- package/dist/components/SwitchButton/FocusOverlay.d.ts +1 -1
- package/dist/components/SwitchButton/FocusOverlay.js +11 -5
- package/dist/components/SwitchButton/Option.d.ts +1 -1
- package/dist/components/SwitchButton/Option.js +20 -2
- package/dist/components/SwitchButton/index.d.ts +2 -2
- package/dist/components/SwitchButton/index.js +95 -48
- package/dist/components/Table/Body.d.ts +1 -1
- package/dist/components/Table/Body.js +2 -4
- package/dist/components/Table/Cell.d.ts +1 -1
- package/dist/components/Table/Cell.js +20 -17
- package/dist/components/Table/Header.d.ts +1 -1
- package/dist/components/Table/Header.js +2 -4
- package/dist/components/Table/HeaderCell.d.ts +1 -1
- package/dist/components/Table/HeaderCell.js +46 -22
- package/dist/components/Table/HeaderRow.d.ts +1 -1
- package/dist/components/Table/HeaderRow.js +21 -12
- package/dist/components/Table/Row.d.ts +1 -1
- package/dist/components/Table/Row.js +70 -14
- package/dist/components/Table/SelectBar.d.ts +1 -1
- package/dist/components/Table/SelectBar.js +20 -10
- package/dist/components/Table/SkeletonRows.d.ts +1 -1
- package/dist/components/Table/SkeletonRows.js +17 -16
- package/dist/components/Table/TableContext.d.ts +1 -1
- package/dist/components/Table/TableContext.js +22 -13
- package/dist/components/Table/index.d.ts +6 -6
- package/dist/components/Table/index.js +64 -23
- package/dist/components/Tabs/Tab.js +79 -41
- package/dist/components/Tabs/TabMenu.js +39 -23
- package/dist/components/Tabs/TabMenuItem.d.ts +1 -1
- package/dist/components/Tabs/TabMenuItem.js +20 -11
- package/dist/components/Tabs/TabsContext.js +3 -1
- package/dist/components/Tabs/index.d.ts +3 -3
- package/dist/components/Tabs/index.js +34 -14
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Tag/index.js +45 -12
- package/dist/components/TagInput/index.d.ts +1 -1
- package/dist/components/TagInput/index.js +131 -52
- package/dist/components/TagInput/styles.css.d.ts +3 -0
- package/dist/components/TagList/index.d.ts +1 -1
- package/dist/components/TagList/index.js +132 -59
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/Text/index.js +21 -17
- package/dist/components/TextArea/index.js +178 -103
- package/dist/components/TextInput/index.d.ts +1 -1
- package/dist/components/TextInput/index.js +286 -106
- package/dist/components/TimeInput/constants.js +1 -5
- package/dist/components/TimeInput/index.d.ts +1 -1
- package/dist/components/TimeInput/index.js +207 -118
- package/dist/components/Toaster/Toaster.js +1 -1
- package/dist/components/Toaster/ToasterContainer.d.ts +1 -1
- package/dist/components/Toaster/ToasterContainer.js +21 -2
- package/dist/components/Toaster/components/Button.d.ts +1 -1
- package/dist/components/Toaster/components/CloseButton.d.ts +1 -1
- package/dist/components/Toaster/components/CloseButton.js +12 -2
- package/dist/components/Toaster/components/Content.d.ts +1 -1
- package/dist/components/Toaster/components/Content.js +2 -4
- package/dist/components/Toaster/components/Link.d.ts +1 -1
- package/dist/components/Toaster/index.d.ts +2 -2
- package/dist/components/Toggle/index.js +101 -40
- package/dist/components/ToggleGroup/index.d.ts +3 -3
- package/dist/components/ToggleGroup/index.js +61 -22
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.js +42 -19
- package/dist/components/TreeMapChart/Tooltip.d.ts +1 -1
- package/dist/components/TreeMapChart/Tooltip.js +1 -1
- package/dist/components/TreeMapChart/index.d.ts +1 -1
- package/dist/components/TreeMapChart/index.js +33 -27
- package/dist/components/UnitInput/index.d.ts +1 -1
- package/dist/components/UnitInput/index.js +110 -29
- package/dist/components/VerificationCode/index.d.ts +1 -1
- package/dist/components/VerificationCode/index.js +80 -21
- package/dist/helpers/legend.js +4 -4
- package/dist/helpers/treeMap.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.js +4 -2
- package/dist/theme/index.js +1 -8
- package/dist/ui.css +1 -1
- package/dist/utils/ids.js +1 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/responsive/index.d.ts +0 -1
- package/dist/utils/responsive/style.css.d.ts +3 -0
- package/package.json +5 -10
- package/dist/utils/responsive/Breakpoint.d.ts +0 -9
- package/dist/utils/responsive/Breakpoint.js +0 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { MinusIcon, PlusIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { forwardRef, useRef, useImperativeHandle, useId, useMemo, useCallback } from "react";
|
|
5
5
|
import { Button } from "../Button/index.js";
|
|
@@ -9,137 +9,246 @@ import { Stack } from "../Stack/index.js";
|
|
|
9
9
|
import { Text } from "../Text/index.js";
|
|
10
10
|
import { Tooltip } from "../Tooltip/index.js";
|
|
11
11
|
import { numberinputContainer, numberinputSideContainer, inputContainer, numberinput, unit } from "./styles.css.js";
|
|
12
|
-
const NumberInput = forwardRef(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
12
|
+
const NumberInput = forwardRef(
|
|
13
|
+
({
|
|
14
|
+
disabled = false,
|
|
15
|
+
max = Number.MAX_SAFE_INTEGER,
|
|
16
|
+
min = 0,
|
|
17
|
+
name,
|
|
18
|
+
onChange,
|
|
19
|
+
onFocus,
|
|
20
|
+
onBlur,
|
|
21
|
+
size = "large",
|
|
22
|
+
step,
|
|
23
|
+
unit: unit$1,
|
|
24
|
+
value,
|
|
25
|
+
tooltip,
|
|
26
|
+
className,
|
|
27
|
+
label,
|
|
28
|
+
labelDescription,
|
|
29
|
+
id,
|
|
30
|
+
controls = true,
|
|
31
|
+
placeholder = "",
|
|
32
|
+
error,
|
|
33
|
+
success,
|
|
34
|
+
helper,
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
|
+
"data-testid": dataTestId,
|
|
37
|
+
required,
|
|
38
|
+
autoFocus,
|
|
39
|
+
readOnly,
|
|
40
|
+
style
|
|
41
|
+
}, ref) => {
|
|
42
|
+
const localRef = useRef(null);
|
|
43
|
+
useImperativeHandle(ref, () => localRef.current);
|
|
44
|
+
const uniqueId = useId();
|
|
45
|
+
const localId = id ?? uniqueId;
|
|
46
|
+
const computedState = useMemo(() => {
|
|
47
|
+
if (disabled) {
|
|
48
|
+
return "disabled";
|
|
49
|
+
}
|
|
50
|
+
if (readOnly) {
|
|
51
|
+
return "readOnly";
|
|
52
|
+
}
|
|
53
|
+
if (error) {
|
|
54
|
+
return "error";
|
|
55
|
+
}
|
|
56
|
+
if (success) {
|
|
57
|
+
return "success";
|
|
58
|
+
}
|
|
59
|
+
return "default";
|
|
60
|
+
}, [error, success, disabled, readOnly]);
|
|
61
|
+
const onClickSideButton = useCallback(
|
|
62
|
+
(direction) => () => {
|
|
63
|
+
if (direction === "up") {
|
|
64
|
+
localRef.current?.stepUp();
|
|
65
|
+
} else if (direction === "down") {
|
|
66
|
+
localRef.current?.stepDown();
|
|
67
|
+
}
|
|
68
|
+
onChange?.(Number.parseFloat(localRef.current?.value ?? "") ?? min);
|
|
69
|
+
},
|
|
70
|
+
[localRef, min, onChange]
|
|
71
|
+
);
|
|
72
|
+
const isMinusDisabled = useCallback(() => {
|
|
73
|
+
if (!localRef?.current?.value || localRef?.current?.value === "") {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const numericValue = Number(localRef?.current?.value);
|
|
77
|
+
if (Number.isNaN(numericValue)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const minValue = typeof min === "number" ? min : Number(min);
|
|
81
|
+
return Number.isNaN(numericValue) || numericValue <= minValue;
|
|
82
|
+
}, [localRef?.current?.value, min]);
|
|
83
|
+
const isPlusDisabled = useCallback(() => {
|
|
84
|
+
if (!localRef?.current?.value || localRef?.current?.value === "") {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const numericValue = Number(localRef?.current?.value);
|
|
88
|
+
if (Number.isNaN(numericValue)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const maxValue = typeof max === "number" ? max : Number(max);
|
|
92
|
+
return numericValue >= maxValue;
|
|
93
|
+
}, [localRef?.current?.value, max]);
|
|
94
|
+
const helperSentiment = useMemo(() => {
|
|
95
|
+
if (error) {
|
|
96
|
+
return "danger";
|
|
97
|
+
}
|
|
98
|
+
if (success) {
|
|
99
|
+
return "success";
|
|
100
|
+
}
|
|
101
|
+
return "neutral";
|
|
102
|
+
}, [error, success]);
|
|
103
|
+
let inputValue;
|
|
104
|
+
if (value !== void 0) {
|
|
105
|
+
inputValue = value !== null && typeof value === "number" ? value.toString() : "";
|
|
106
|
+
if (localRef.current) {
|
|
107
|
+
localRef.current.value = inputValue;
|
|
108
|
+
}
|
|
104
109
|
}
|
|
110
|
+
return /* @__PURE__ */ jsxs(Stack, { className, gap: "0.5", children: [
|
|
111
|
+
label || labelDescription ? /* @__PURE__ */ jsx(
|
|
112
|
+
Label,
|
|
113
|
+
{
|
|
114
|
+
htmlFor: id ?? localId,
|
|
115
|
+
labelDescription,
|
|
116
|
+
required,
|
|
117
|
+
size,
|
|
118
|
+
children: label
|
|
119
|
+
}
|
|
120
|
+
) : null,
|
|
121
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tooltip, { text: tooltip, children: /* @__PURE__ */ jsxs(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: numberinputContainer({ size, state: computedState }),
|
|
125
|
+
"data-controls": controls,
|
|
126
|
+
"data-disabled": disabled,
|
|
127
|
+
"data-error": !!error,
|
|
128
|
+
"data-readonly": readOnly,
|
|
129
|
+
"data-size": size,
|
|
130
|
+
"data-success": !!success,
|
|
131
|
+
"data-unit": !!unit$1,
|
|
132
|
+
children: [
|
|
133
|
+
controls ? /* @__PURE__ */ jsx(
|
|
134
|
+
Stack,
|
|
135
|
+
{
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
className: numberinputSideContainer[size],
|
|
138
|
+
"data-size": size,
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
children: /* @__PURE__ */ jsx(
|
|
141
|
+
Button,
|
|
142
|
+
{
|
|
143
|
+
"aria-label": "minus",
|
|
144
|
+
disabled: disabled || readOnly || isMinusDisabled(),
|
|
145
|
+
onClick: onClickSideButton("down"),
|
|
146
|
+
sentiment: "neutral",
|
|
147
|
+
size: size === "small" ? "xsmall" : "small",
|
|
148
|
+
variant: "ghost",
|
|
149
|
+
children: /* @__PURE__ */ jsx(MinusIcon, { size: size === "large" ? "small" : "small" })
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
) : null,
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
Row,
|
|
156
|
+
{
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
className: inputContainer({ controls }),
|
|
159
|
+
justifyContent: "space-between",
|
|
160
|
+
templateColumns: "1fr auto",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
"input",
|
|
164
|
+
{
|
|
165
|
+
"aria-label": ariaLabel,
|
|
166
|
+
autoFocus,
|
|
167
|
+
className: numberinput({ controls, hasUnit: !!unit$1, size }),
|
|
168
|
+
"data-testid": dataTestId,
|
|
169
|
+
disabled,
|
|
170
|
+
id: localId,
|
|
171
|
+
max,
|
|
172
|
+
min,
|
|
173
|
+
name,
|
|
174
|
+
onBlur: (event) => {
|
|
175
|
+
if (value && value > max) {
|
|
176
|
+
onChange?.(max);
|
|
177
|
+
} else if (value && value < min) {
|
|
178
|
+
onChange?.(min);
|
|
179
|
+
}
|
|
180
|
+
onBlur?.(event);
|
|
181
|
+
},
|
|
182
|
+
onChange: onChange ? (event) => {
|
|
183
|
+
const newNumber = Number.parseFloat(
|
|
184
|
+
event.target.value
|
|
185
|
+
);
|
|
186
|
+
onChange(Number.isNaN(newNumber) ? null : newNumber);
|
|
187
|
+
} : void 0,
|
|
188
|
+
onFocus,
|
|
189
|
+
placeholder,
|
|
190
|
+
readOnly,
|
|
191
|
+
ref: localRef,
|
|
192
|
+
required,
|
|
193
|
+
step,
|
|
194
|
+
style,
|
|
195
|
+
type: "number",
|
|
196
|
+
value: inputValue
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
unit$1 ? /* @__PURE__ */ jsx(
|
|
200
|
+
Text,
|
|
201
|
+
{
|
|
202
|
+
as: "span",
|
|
203
|
+
className: unit({ disabled, readOnly, size }),
|
|
204
|
+
disabled,
|
|
205
|
+
sentiment: "neutral",
|
|
206
|
+
variant: "body",
|
|
207
|
+
children: unit$1
|
|
208
|
+
}
|
|
209
|
+
) : null
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
controls ? /* @__PURE__ */ jsx(
|
|
214
|
+
Stack,
|
|
215
|
+
{
|
|
216
|
+
alignItems: "center",
|
|
217
|
+
className: numberinputSideContainer[size],
|
|
218
|
+
"data-size": size,
|
|
219
|
+
justifyContent: "center",
|
|
220
|
+
children: /* @__PURE__ */ jsx(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
"aria-label": "plus",
|
|
224
|
+
disabled: disabled || readOnly || isPlusDisabled(),
|
|
225
|
+
onClick: onClickSideButton("up"),
|
|
226
|
+
sentiment: "neutral",
|
|
227
|
+
size: size === "small" ? "xsmall" : "small",
|
|
228
|
+
variant: "ghost",
|
|
229
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { size: size === "large" ? "small" : "small" })
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
) : null
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
) }) }),
|
|
237
|
+
error || typeof success === "string" || typeof helper === "string" ? /* @__PURE__ */ jsx(
|
|
238
|
+
Text,
|
|
239
|
+
{
|
|
240
|
+
as: "span",
|
|
241
|
+
disabled: disabled || readOnly,
|
|
242
|
+
prominence: !error && !success ? "weak" : "default",
|
|
243
|
+
sentiment: helperSentiment,
|
|
244
|
+
variant: "caption",
|
|
245
|
+
children: error || success || helper
|
|
246
|
+
}
|
|
247
|
+
) : null,
|
|
248
|
+
!error && !success && typeof helper !== "string" && helper ? helper : null
|
|
249
|
+
] });
|
|
105
250
|
}
|
|
106
|
-
|
|
107
|
-
label || labelDescription ? /* @__PURE__ */ jsx(Label, { htmlFor: id ?? localId, labelDescription, required, size, children: label }) : null,
|
|
108
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tooltip, { text: tooltip, children: /* @__PURE__ */ jsxs("div", { className: numberinputContainer({
|
|
109
|
-
size,
|
|
110
|
-
state: computedState
|
|
111
|
-
}), "data-controls": controls, "data-disabled": disabled, "data-error": !!error, "data-readonly": readOnly, "data-size": size, "data-success": !!success, "data-unit": !!unit$1, children: [
|
|
112
|
-
controls ? /* @__PURE__ */ jsx(Stack, { alignItems: "center", className: numberinputSideContainer[size], "data-size": size, justifyContent: "center", children: /* @__PURE__ */ jsx(Button, { "aria-label": "minus", disabled: disabled || readOnly || isMinusDisabled(), onClick: onClickSideButton("down"), sentiment: "neutral", size: size === "small" ? "xsmall" : "small", variant: "ghost", children: /* @__PURE__ */ jsx(MinusIcon, { size: size === "large" ? "small" : "small" }) }) }) : null,
|
|
113
|
-
/* @__PURE__ */ jsxs(Row, { alignItems: "center", className: inputContainer({
|
|
114
|
-
controls
|
|
115
|
-
}), justifyContent: "space-between", templateColumns: "1fr auto", children: [
|
|
116
|
-
/* @__PURE__ */ jsx("input", { "aria-label": ariaLabel, autoFocus, className: numberinput({
|
|
117
|
-
controls,
|
|
118
|
-
hasUnit: !!unit$1,
|
|
119
|
-
size
|
|
120
|
-
}), "data-testid": dataTestId, disabled, id: localId, max, min, name, onBlur: (event) => {
|
|
121
|
-
if (value && value > max) {
|
|
122
|
-
onChange?.(max);
|
|
123
|
-
} else if (value && value < min) {
|
|
124
|
-
onChange?.(min);
|
|
125
|
-
}
|
|
126
|
-
onBlur?.(event);
|
|
127
|
-
}, onChange: onChange ? (event) => {
|
|
128
|
-
const newNumber = Number.parseFloat(event.target.value);
|
|
129
|
-
onChange(Number.isNaN(newNumber) ? null : newNumber);
|
|
130
|
-
} : void 0, onFocus, placeholder, readOnly, ref: localRef, required, step, style, type: "number", value: inputValue }),
|
|
131
|
-
unit$1 ? /* @__PURE__ */ jsx(Text, { as: "span", className: unit({
|
|
132
|
-
disabled,
|
|
133
|
-
readOnly,
|
|
134
|
-
size
|
|
135
|
-
}), disabled, sentiment: "neutral", variant: "body", children: unit$1 }) : null
|
|
136
|
-
] }),
|
|
137
|
-
controls ? /* @__PURE__ */ jsx(Stack, { alignItems: "center", className: numberinputSideContainer[size], "data-size": size, justifyContent: "center", children: /* @__PURE__ */ jsx(Button, { "aria-label": "plus", disabled: disabled || readOnly || isPlusDisabled(), onClick: onClickSideButton("up"), sentiment: "neutral", size: size === "small" ? "xsmall" : "small", variant: "ghost", children: /* @__PURE__ */ jsx(PlusIcon, { size: size === "large" ? "small" : "small" }) }) }) : null
|
|
138
|
-
] }) }) }),
|
|
139
|
-
error || typeof success === "string" || typeof helper === "string" ? /* @__PURE__ */ jsx(Text, { as: "span", disabled: disabled || readOnly, prominence: !error && !success ? "weak" : "default", sentiment: helperSentiment, variant: "caption", children: error || success || helper }) : null,
|
|
140
|
-
!error && !success && typeof helper !== "string" && helper ? helper : null
|
|
141
|
-
] });
|
|
142
|
-
});
|
|
251
|
+
);
|
|
143
252
|
export {
|
|
144
253
|
NumberInput
|
|
145
254
|
};
|
|
@@ -8,5 +8,5 @@ type PaginationButtonsProps = {
|
|
|
8
8
|
'data-testid'?: string;
|
|
9
9
|
perPage: boolean;
|
|
10
10
|
};
|
|
11
|
-
export declare const PaginationButtons: ({ page, disabled, onChange, pageCount, pageTabCount, "data-testid": dataTestId, className, perPage, }: PaginationButtonsProps) => import("
|
|
11
|
+
export declare const PaginationButtons: ({ page, disabled, onChange, pageCount, pageTabCount, "data-testid": dataTestId, className, perPage, }: PaginationButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx, Fragment } from "
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowLeftIcon, ArrowRightIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { useCallback, useMemo } from "react";
|
|
5
5
|
import { Button } from "../Button/index.js";
|
|
@@ -15,8 +15,34 @@ const MakeButton = ({
|
|
|
15
15
|
handlePageClick,
|
|
16
16
|
perPage
|
|
17
17
|
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
-
hasEllipsisBefore ? /* @__PURE__ */ jsx(
|
|
19
|
-
|
|
18
|
+
hasEllipsisBefore ? /* @__PURE__ */ jsx(
|
|
19
|
+
Text,
|
|
20
|
+
{
|
|
21
|
+
"aria-label": "ellipsis",
|
|
22
|
+
as: "span",
|
|
23
|
+
className: ellipsisClass[perPage ? "small" : "medium"],
|
|
24
|
+
disabled,
|
|
25
|
+
placement: "center",
|
|
26
|
+
prominence: "default",
|
|
27
|
+
sentiment: "neutral",
|
|
28
|
+
variant: "body",
|
|
29
|
+
children: "..."
|
|
30
|
+
}
|
|
31
|
+
) : null,
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
Button,
|
|
34
|
+
{
|
|
35
|
+
"aria-current": pageNumber === page,
|
|
36
|
+
className: pageButton[perPage ? "small" : "medium"],
|
|
37
|
+
disabled,
|
|
38
|
+
onClick: handlePageClick(pageNumber),
|
|
39
|
+
sentiment: pageNumber === page ? "primary" : "neutral",
|
|
40
|
+
size: perPage ? "small" : "medium",
|
|
41
|
+
type: "button",
|
|
42
|
+
variant: pageNumber === page ? "filled" : "outlined",
|
|
43
|
+
children: pageNumber
|
|
44
|
+
}
|
|
45
|
+
)
|
|
20
46
|
] });
|
|
21
47
|
const PaginationButtons = ({
|
|
22
48
|
page,
|
|
@@ -34,14 +60,53 @@ const PaginationButtons = ({
|
|
|
34
60
|
const goToPreviousPage = useCallback(() => {
|
|
35
61
|
onChange(page - 1);
|
|
36
62
|
}, [onChange, page]);
|
|
37
|
-
const pageNumbersToDisplay = useMemo(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
const pageNumbersToDisplay = useMemo(
|
|
64
|
+
() => pageCount > 1 ? getPageNumbers(page, pageCount, pageTabCount) : [1],
|
|
65
|
+
[page, pageCount, pageTabCount]
|
|
66
|
+
);
|
|
67
|
+
const handlePageClick = useCallback(
|
|
68
|
+
(pageNumber) => () => {
|
|
69
|
+
onChange(pageNumber);
|
|
70
|
+
},
|
|
71
|
+
[onChange]
|
|
72
|
+
);
|
|
41
73
|
return /* @__PURE__ */ jsxs(Stack, { className, "data-testid": dataTestId, direction: "row", children: [
|
|
42
|
-
/* @__PURE__ */ jsx(Stack, { gap: 1, children: /* @__PURE__ */ jsx(
|
|
43
|
-
|
|
44
|
-
|
|
74
|
+
/* @__PURE__ */ jsx(Stack, { gap: 1, children: /* @__PURE__ */ jsx(
|
|
75
|
+
Button,
|
|
76
|
+
{
|
|
77
|
+
"aria-label": "Back",
|
|
78
|
+
disabled: page <= 1 || disabled,
|
|
79
|
+
onClick: goToPreviousPage,
|
|
80
|
+
sentiment: "primary",
|
|
81
|
+
size: perPage ? "small" : "medium",
|
|
82
|
+
variant: "outlined",
|
|
83
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
84
|
+
}
|
|
85
|
+
) }),
|
|
86
|
+
/* @__PURE__ */ jsx(Stack, { className: pageNumbersContainer, direction: "row", gap: 1, children: pageNumbersToDisplay.map((pageNumber, index) => /* @__PURE__ */ jsx(
|
|
87
|
+
MakeButton,
|
|
88
|
+
{
|
|
89
|
+
disabled,
|
|
90
|
+
handlePageClick,
|
|
91
|
+
hasEllipsisBefore: !(index === 0 || pageNumbersToDisplay[index - 1] === pageNumber - 1),
|
|
92
|
+
page,
|
|
93
|
+
pageNumber,
|
|
94
|
+
perPage
|
|
95
|
+
},
|
|
96
|
+
pageNumber
|
|
97
|
+
)) }),
|
|
98
|
+
/* @__PURE__ */ jsx(Stack, { gap: 1, children: /* @__PURE__ */ jsx(
|
|
99
|
+
Button,
|
|
100
|
+
{
|
|
101
|
+
"aria-label": "Next",
|
|
102
|
+
disabled: page >= pageCount || disabled,
|
|
103
|
+
onClick: goToNextPage,
|
|
104
|
+
sentiment: "primary",
|
|
105
|
+
size: perPage ? "small" : "medium",
|
|
106
|
+
variant: "outlined",
|
|
107
|
+
children: /* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
108
|
+
}
|
|
109
|
+
) })
|
|
45
110
|
] });
|
|
46
111
|
};
|
|
47
112
|
export {
|
|
@@ -8,5 +8,5 @@ type PerPageProps = {
|
|
|
8
8
|
page: number;
|
|
9
9
|
numberOfItems: number;
|
|
10
10
|
};
|
|
11
|
-
export declare const PerPage: ({ perPage, onChangePerPage, perPageText, setPerPage, numberOfItemsText, page, numberOfItems, }: PerPageProps) => import("
|
|
11
|
+
export declare const PerPage: ({ perPage, onChangePerPage, perPageText, setPerPage, numberOfItemsText, page, numberOfItems, }: PerPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { SelectInput } from "../SelectInput/index.js";
|
|
4
4
|
import { Stack } from "../Stack/index.js";
|
|
5
5
|
import { Text } from "../Text/index.js";
|
|
6
|
-
const optionsItemsPerPage = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
6
|
+
const optionsItemsPerPage = [
|
|
7
|
+
{
|
|
8
|
+
label: "10",
|
|
9
|
+
value: "10"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "25",
|
|
13
|
+
value: "25"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "50",
|
|
17
|
+
value: "50"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "100",
|
|
21
|
+
value: "100"
|
|
22
|
+
}
|
|
23
|
+
];
|
|
19
24
|
const PerPage = ({
|
|
20
25
|
perPage,
|
|
21
26
|
onChangePerPage,
|
|
@@ -32,9 +37,19 @@ const PerPage = ({
|
|
|
32
37
|
};
|
|
33
38
|
return /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: "2", children: [
|
|
34
39
|
/* @__PURE__ */ jsx(Text, { as: "span", prominence: "weak", sentiment: "neutral", variant: "body", children: perPageText ?? "Items per page" }),
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
SelectInput,
|
|
42
|
+
{
|
|
43
|
+
name: "select-items-per-page",
|
|
44
|
+
onChange: handleChange,
|
|
45
|
+
options: optionsItemsPerPage,
|
|
46
|
+
size: "small",
|
|
47
|
+
style: {
|
|
48
|
+
width: "fit-content"
|
|
49
|
+
},
|
|
50
|
+
value: perPage.toString()
|
|
51
|
+
}
|
|
52
|
+
),
|
|
38
53
|
/* @__PURE__ */ jsxs(Text, { as: "span", prominence: "weak", sentiment: "neutral", variant: "body", children: [
|
|
39
54
|
(page - 1) * perPage + 1,
|
|
40
55
|
"-",
|
|
@@ -3,20 +3,19 @@ const getPageNumbers = (currentPage, pageCount, range = 5) => {
|
|
|
3
3
|
const truncationBefore = currentPage >= range;
|
|
4
4
|
const truncationAfter = currentPage <= pageCount - range + 1 || currentPage < range;
|
|
5
5
|
if (pageCount <= range) {
|
|
6
|
-
return Array.from({
|
|
7
|
-
length: pageCount
|
|
8
|
-
}, (_, index) => index + 1);
|
|
6
|
+
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
9
7
|
}
|
|
10
|
-
const pagesToShowBeforeTruncation = truncationBefore ? [1] : Array.from({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
const pagesToShowBeforeTruncation = truncationBefore ? [1] : Array.from({ length: range }, (_, index) => index + 1);
|
|
9
|
+
const pagesToShowAfterTruncation = truncationAfter ? [pageCount] : Array.from({ length: range }, (_, index) => index + pageCount - range + 1);
|
|
10
|
+
const pagesToShowBetweenTruncation = truncationBefore && truncationAfter ? Array.from(
|
|
11
|
+
{ length: NUMBER_OF_BUTTONS_IN_BETWEEN },
|
|
12
|
+
(_, index) => currentPage + index - 1
|
|
13
|
+
) : [];
|
|
14
|
+
return [
|
|
15
|
+
...pagesToShowBeforeTruncation,
|
|
16
|
+
...pagesToShowBetweenTruncation,
|
|
17
|
+
...pagesToShowAfterTruncation
|
|
18
|
+
];
|
|
20
19
|
};
|
|
21
20
|
export {
|
|
22
21
|
getPageNumbers
|
|
@@ -55,5 +55,5 @@ type PaginationProps = {
|
|
|
55
55
|
* Pagination is a component to navigate between pages, it is composed of 2 buttons to go to the previous and next page,
|
|
56
56
|
* and a list of buttons to go to a specific page.
|
|
57
57
|
*/
|
|
58
|
-
export declare const Pagination: ({ disabled, page, pageCount, onChange, pageTabCount, className, perPage, onChangePerPage, perPageText, numberOfItemsText, numberOfItems, "data-testid": dataTestId, style, }: PaginationProps) => import("
|
|
58
|
+
export declare const Pagination: ({ disabled, page, pageCount, onChange, pageTabCount, className, perPage, onChangePerPage, perPageText, numberOfItemsText, numberOfItems, "data-testid": dataTestId, style, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
59
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { Stack } from "../Stack/index.js";
|
|
5
5
|
import { PaginationButtons } from "./PaginationButtons.js";
|
|
@@ -34,8 +34,31 @@ const Pagination = ({
|
|
|
34
34
|
}
|
|
35
35
|
}, [perPage]);
|
|
36
36
|
return /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", style, children: [
|
|
37
|
-
perPage ? /* @__PURE__ */ jsx(
|
|
38
|
-
|
|
37
|
+
perPage ? /* @__PURE__ */ jsx(
|
|
38
|
+
PerPage,
|
|
39
|
+
{
|
|
40
|
+
numberOfItems,
|
|
41
|
+
numberOfItemsText,
|
|
42
|
+
onChangePerPage,
|
|
43
|
+
page,
|
|
44
|
+
perPage: perPageComputed,
|
|
45
|
+
perPageText,
|
|
46
|
+
setPerPage
|
|
47
|
+
}
|
|
48
|
+
) : null,
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
PaginationButtons,
|
|
51
|
+
{
|
|
52
|
+
className,
|
|
53
|
+
"data-testid": dataTestId,
|
|
54
|
+
disabled,
|
|
55
|
+
onChange,
|
|
56
|
+
page,
|
|
57
|
+
pageCount,
|
|
58
|
+
pageTabCount,
|
|
59
|
+
perPage: !!perPage
|
|
60
|
+
}
|
|
61
|
+
)
|
|
39
62
|
] });
|
|
40
63
|
};
|
|
41
64
|
export {
|
|
@@ -18,5 +18,5 @@ type PasswordCheckProps = {
|
|
|
18
18
|
* PasswordCheck is a component that display a list of password rules with a check or a cross depending on the validity
|
|
19
19
|
* of the rule.
|
|
20
20
|
*/
|
|
21
|
-
export declare const PasswordCheck: ({ rules, className, "data-testid": dataTestId, style, }: PasswordCheckProps) => import("
|
|
21
|
+
export declare const PasswordCheck: ({ rules, className, "data-testid": dataTestId, style, }: PasswordCheckProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export {};
|