@pismo/marola 1.0.0-beta.2 → 1.0.0-beta.21
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/{Button-2b1peDFT.js → Button-DiLqcAJG.js} +2 -2
- package/dist/{ClickAwayListener-BSW-Nd-y.js → ClickAwayListener-BaJ-OV_7.js} +4 -3
- package/dist/Dialog.module-D9e4RsKo.js +30 -0
- package/dist/Input.module-ZTRZRcNt.js +405 -0
- package/dist/{Popup-B6ZSGIEI.js → Popup-lLWZt2wk.js} +3 -3
- package/dist/{Portal-DIeBsWdL.js → Portal-B_Es6eUL.js} +2 -2
- package/dist/SelectButton-CoOT2txy.js +61 -0
- package/dist/Toggle-CRfZgFJp.js +181 -0
- package/dist/assets/Adornment.css +1 -0
- package/dist/assets/Advice.css +1 -1
- package/dist/assets/Autocomplete.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/PageHeader.css +1 -1
- package/dist/assets/Pagination.css +1 -1
- package/dist/assets/ResultWithChips.css +1 -0
- package/dist/assets/SelectButton.css +1 -1
- package/dist/assets/Snackbar.css +1 -1
- package/dist/assets/SortTooltip.css +1 -1
- package/dist/assets/Stepper.css +1 -1
- package/dist/assets/StepperNavigator.css +1 -0
- package/dist/assets/Table.css +1 -1
- package/dist/assets/TextDisplay.css +1 -1
- package/dist/assets/Toggle.css +1 -1
- package/dist/assets/Toggle2.css +1 -1
- package/dist/assets/Typography.css +1 -1
- package/dist/{combineHooksSlotProps-DVjg9PRh.js → combineHooksSlotProps-BtBYUV_B.js} +1 -1
- package/dist/components/Adornment/Adornment.d.ts +20 -0
- package/dist/components/Adornment/Adornment.js +13 -0
- package/dist/components/Adornment/Adornment.stories.d.ts +14 -0
- package/dist/components/Adornment/adornment.test.d.ts +1 -0
- package/dist/components/Advice/Advice.d.ts +32 -17
- package/dist/components/Advice/Advice.js +39 -40
- package/dist/components/Advice/Advice.stories.d.ts +4 -3
- package/dist/components/Autocomplete/Autocomplete.d.ts +51 -0
- package/dist/components/Autocomplete/Autocomplete.js +691 -0
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +22 -0
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.js +51 -49
- package/dist/components/Checkbox/Checkbox.js +52 -52
- package/dist/components/Chip/Chip.d.ts +6 -12
- package/dist/components/Chip/Chip.js +6 -5
- package/dist/components/Chip/Chip.stories.d.ts +5 -14
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.d.ts +3 -3
- package/dist/components/Dialog/Backdrop.js +8 -7
- package/dist/components/Dialog/CloseIconButton.d.ts +1 -2
- package/dist/components/Dialog/CloseIconButton.js +15 -18
- package/dist/components/Dialog/Dialog.d.ts +9 -6
- package/dist/components/Dialog/Dialog.js +139 -139
- package/dist/components/Dialog/Dialog.stories.d.ts +50 -46
- package/dist/components/Dialog/DialogTitle.js +1 -1
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +30 -17
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +2 -1
- package/dist/components/Icon/Icon.js +62 -34
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/IconButton/IconButton.js +42 -42
- package/dist/components/Input/Input.d.ts +4 -2
- package/dist/components/Input/Input.js +74 -471
- package/dist/components/Input/Input.stories.d.ts +1 -1
- package/dist/components/InputSearch/InputSearch.stories.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.js +57 -57
- package/dist/components/Pagination/Pagination.d.ts +7 -1
- package/dist/components/Pagination/Pagination.js +104 -182
- package/dist/components/Pagination/usePagination.d.ts +90 -0
- package/dist/components/Pagination/usePagination.js +79 -0
- package/dist/components/ResultWithChips/ResultWithChips.d.ts +12 -0
- package/dist/components/ResultWithChips/ResultWithChips.js +33 -0
- package/dist/components/RowItem/RowItem.d.ts +25 -0
- package/dist/components/RowItem/RowItem.js +19 -0
- package/dist/components/RowItem/RowItem.stories.d.ts +17 -0
- package/dist/components/RowItem/rowItem.test.d.ts +1 -0
- package/dist/components/Select/Select.js +9 -8
- package/dist/components/Select/SelectButton.js +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +3 -1
- package/dist/components/Skeleton/Skeleton.js +18 -12
- package/dist/components/Skeleton/SkeletonTable.stories.d.ts +1 -1
- package/dist/components/Snackbar/Snackbar.js +94 -94
- package/dist/components/Snackbar/Snackbar.stories.d.ts +3 -3
- package/dist/components/SortTooltip/SortTooltip.js +46 -46
- package/dist/components/Stepper/Stepper.js +35 -35
- package/dist/components/StepperNavigator/StepperNavigator.d.ts +43 -0
- package/dist/components/StepperNavigator/StepperNavigator.js +56 -0
- package/dist/components/StepperNavigator/StepperNavigator.stories.d.ts +16 -0
- package/dist/components/StepperNavigator/StepperNavigator.test.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +3 -1
- package/dist/components/Table/Table.js +88 -85
- package/dist/components/Table/Table.stories.d.ts +1 -1
- package/dist/components/Tabs/Tab.js +18 -17
- package/dist/components/Tabs/TabPanel.js +27 -26
- package/dist/components/Tabs/Tabs.js +25 -25
- package/dist/components/TextDisplay/TextDisplay.d.ts +3 -1
- package/dist/components/TextDisplay/TextDisplay.js +42 -28
- package/dist/components/TextDisplay/TextDisplay.stories.d.ts +2 -1
- package/dist/components/Toggle/Toggle.js +56 -56
- package/dist/components/ToggleGroup/Toggle.js +3 -3
- package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -0
- package/dist/components/Typography/Typography.js +47 -47
- package/dist/{index-CjW42-M-.js → index-D3Wj0eid.js} +1 -1
- package/dist/main.d.ts +5 -0
- package/dist/main.js +85 -76
- package/dist/ownerDocument-B61GUaFs.js +33 -0
- package/dist/{useButton-DNk3wrQp.js → useButton-Bn3MNH8I.js} +1 -1
- package/dist/useCompoundItem-B7Eo_qZk.js +68 -0
- package/dist/useEventCallback-BAQJJ3ye.js +14 -0
- package/dist/useId-BW-oWmul.js +19 -0
- package/dist/{useList-B0hog_3-.js → useList-BpJT77u3.js} +2 -2
- package/dist/{index-CH45lKw7.js → useSlotProps-kRhf7Gil.js} +93 -94
- package/package.json +8 -3
- package/dist/Dialog.module-DFEmFdYT.js +0 -30
- package/dist/SelectButton-C8JQKaf4.js +0 -61
- package/dist/Toggle-BCgIItCc.js +0 -142
- package/dist/useCompoundItem-D1iRfg8D.js +0 -84
- package/dist/useEventCallback-xTG9piMa.js +0 -45
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
import '../../assets/PageHeader.css';
|
|
2
|
-
import { jsx as a, jsxs as
|
|
2
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as L } from "react";
|
|
4
|
-
import { c as
|
|
4
|
+
import { c as h } from "../../clsx-DB4S2d7J.js";
|
|
5
5
|
import { Icon as B } from "../Icon/Icon.js";
|
|
6
6
|
import { IconButton as C } from "../IconButton/IconButton.js";
|
|
7
|
-
const j = "
|
|
8
|
-
"u-typography-h1": "_u-typography-
|
|
9
|
-
"u-typography-h2": "_u-typography-
|
|
10
|
-
"u-typography-h3": "_u-typography-
|
|
11
|
-
"u-typography-h4": "_u-typography-
|
|
12
|
-
"page-header__main-left-content": "_page-header__main-left-
|
|
7
|
+
const j = "_title_1qpkd_22", w = "_subtitle_1qpkd_43", e = {
|
|
8
|
+
"u-typography-h1": "_u-typography-h1_1qpkd_1",
|
|
9
|
+
"u-typography-h2": "_u-typography-h2_1qpkd_8",
|
|
10
|
+
"u-typography-h3": "_u-typography-h3_1qpkd_15",
|
|
11
|
+
"u-typography-h4": "_u-typography-h4_1qpkd_22",
|
|
12
|
+
"page-header__main-left-content": "_page-header__main-left-content_1qpkd_22",
|
|
13
13
|
title: j,
|
|
14
|
-
"u-typography-h5": "_u-typography-
|
|
15
|
-
"u-typography-h6": "_u-typography-
|
|
16
|
-
"u-typography-base": "_u-typography-
|
|
14
|
+
"u-typography-h5": "_u-typography-h5_1qpkd_29",
|
|
15
|
+
"u-typography-h6": "_u-typography-h6_1qpkd_36",
|
|
16
|
+
"u-typography-base": "_u-typography-base_1qpkd_43",
|
|
17
17
|
subtitle: w,
|
|
18
|
-
"u-typography-base--xxl": "_u-typography-base--
|
|
19
|
-
"u-typography-base--xl": "_u-typography-base--
|
|
20
|
-
"u-typography-base--lg": "_u-typography-base--
|
|
21
|
-
"u-typography-base--sm": "_u-typography-base--
|
|
22
|
-
"u-typography-base--bold": "_u-typography-base--
|
|
23
|
-
"u-typography-base--strikethrough": "_u-typography-base--
|
|
24
|
-
"u-typography-base--underlined": "_u-typography-base--
|
|
25
|
-
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-
|
|
26
|
-
"page-header": "_page-
|
|
27
|
-
"page-header__top-content": "_page-header__top-
|
|
28
|
-
"page-header__main-content": "_page-header__main-
|
|
29
|
-
"page-header__bottom-content": "_page-header__bottom-
|
|
30
|
-
"page-header__breadcrumb": "_page-
|
|
31
|
-
"page-header__breadcrumb__separator": "_page-
|
|
32
|
-
"page-header__main-right-content": "_page-header__main-right-
|
|
18
|
+
"u-typography-base--xxl": "_u-typography-base--xxl_1qpkd_49",
|
|
19
|
+
"u-typography-base--xl": "_u-typography-base--xl_1qpkd_53",
|
|
20
|
+
"u-typography-base--lg": "_u-typography-base--lg_1qpkd_57",
|
|
21
|
+
"u-typography-base--sm": "_u-typography-base--sm_1qpkd_61",
|
|
22
|
+
"u-typography-base--bold": "_u-typography-base--bold_1qpkd_65",
|
|
23
|
+
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_1qpkd_68",
|
|
24
|
+
"u-typography-base--underlined": "_u-typography-base--underlined_1qpkd_71",
|
|
25
|
+
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_1qpkd_74",
|
|
26
|
+
"page-header": "_page-header_1qpkd_22",
|
|
27
|
+
"page-header__top-content": "_page-header__top-content_1qpkd_87",
|
|
28
|
+
"page-header__main-content": "_page-header__main-content_1qpkd_90",
|
|
29
|
+
"page-header__bottom-content": "_page-header__bottom-content_1qpkd_90",
|
|
30
|
+
"page-header__breadcrumb": "_page-header__breadcrumb_1qpkd_104",
|
|
31
|
+
"page-header__breadcrumb__separator": "_page-header__breadcrumb__separator_1qpkd_109",
|
|
32
|
+
"page-header__main-right-content": "_page-header__main-right-content_1qpkd_132"
|
|
33
33
|
}, P = ({
|
|
34
|
-
title:
|
|
35
|
-
subtitle:
|
|
36
|
-
rightChildren:
|
|
37
|
-
bottomChildren:
|
|
38
|
-
classNameWrapper:
|
|
39
|
-
classNameTitle:
|
|
40
|
-
classNameSubtitle:
|
|
34
|
+
title: g,
|
|
35
|
+
subtitle: y,
|
|
36
|
+
rightChildren: n,
|
|
37
|
+
bottomChildren: c,
|
|
38
|
+
classNameWrapper: u,
|
|
39
|
+
classNameTitle: b,
|
|
40
|
+
classNameSubtitle: k,
|
|
41
41
|
"data-testid-wrapper": m,
|
|
42
|
-
"data-testid-title":
|
|
42
|
+
"data-testid-title": q,
|
|
43
43
|
"data-testid-subtitle": N,
|
|
44
44
|
...f
|
|
45
45
|
}) => {
|
|
46
46
|
const {
|
|
47
|
-
breadcrumb:
|
|
48
|
-
backLinkText:
|
|
49
|
-
onBackLinkClick:
|
|
50
|
-
classNameBackLink:
|
|
51
|
-
"data-testid-backLink":
|
|
47
|
+
breadcrumb: _,
|
|
48
|
+
backLinkText: r,
|
|
49
|
+
onBackLinkClick: d,
|
|
50
|
+
classNameBackLink: i,
|
|
51
|
+
"data-testid-backLink": l,
|
|
52
52
|
...x
|
|
53
53
|
} = f, v = L(() => {
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
label:
|
|
57
|
-
className:
|
|
58
|
-
"data-testid":
|
|
59
|
-
onClick:
|
|
60
|
-
}),
|
|
54
|
+
const p = [];
|
|
55
|
+
return r && d && p.push({
|
|
56
|
+
label: r,
|
|
57
|
+
className: i,
|
|
58
|
+
"data-testid": l,
|
|
59
|
+
onClick: d
|
|
60
|
+
}), _ && p.push(..._), /* @__PURE__ */ a("div", { className: e["page-header__top-content"], children: /* @__PURE__ */ a("div", { className: e["page-header__breadcrumb"], children: p.map((t, s) => /* @__PURE__ */ a(
|
|
61
61
|
C,
|
|
62
62
|
{
|
|
63
|
-
icon:
|
|
63
|
+
icon: s === 0 ? /* @__PURE__ */ a(B, { icon: "arrow-left" }) : /* @__PURE__ */ a("span", { className: e["page-header__breadcrumb__separator"], children: "/" }),
|
|
64
64
|
onClick: () => t.onClick && t.onClick(),
|
|
65
65
|
className: t.className,
|
|
66
66
|
"data-testid": t["data-testid"],
|
|
67
|
-
disabled:
|
|
67
|
+
disabled: p.length === 1 ? !1 : s === p.length - 1,
|
|
68
68
|
children: t.label
|
|
69
69
|
},
|
|
70
|
-
`${t.label}_${
|
|
70
|
+
`${t.label}_${s}`
|
|
71
71
|
)) }) });
|
|
72
|
-
}, [
|
|
73
|
-
return /* @__PURE__ */
|
|
72
|
+
}, [_, r, i, l, d]);
|
|
73
|
+
return /* @__PURE__ */ o("div", { className: h([e["page-header"], u]), "data-testid": m, ...x, children: [
|
|
74
74
|
v,
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */ a("h1", { className:
|
|
78
|
-
/* @__PURE__ */ a("h2", { className:
|
|
75
|
+
/* @__PURE__ */ o("div", { className: e["page-header__main-content"], children: [
|
|
76
|
+
/* @__PURE__ */ o("div", { className: e["page-header__main-left-content"], children: [
|
|
77
|
+
/* @__PURE__ */ a("h1", { className: h(e.title, b), "data-testid": q, children: g }),
|
|
78
|
+
/* @__PURE__ */ a("h2", { className: h(e.subtitle, k), "data-testid": N, children: y })
|
|
79
79
|
] }),
|
|
80
|
-
|
|
80
|
+
n && /* @__PURE__ */ a("div", { className: e["page-header__main-right-content"], children: n })
|
|
81
81
|
] }),
|
|
82
|
-
|
|
82
|
+
c && /* @__PURE__ */ a("div", { className: e["page-header__bottom-content"], children: c })
|
|
83
83
|
] });
|
|
84
84
|
};
|
|
85
85
|
export {
|
|
@@ -17,6 +17,8 @@ export type PaginationTranslations = {
|
|
|
17
17
|
previous: string;
|
|
18
18
|
/** Translation text for `next` */
|
|
19
19
|
next: string;
|
|
20
|
+
/** Translation text for `perPage` */
|
|
21
|
+
perPage: string;
|
|
20
22
|
};
|
|
21
23
|
type PaginationLanguages = 'pt' | 'en';
|
|
22
24
|
type PaginationCommonProps = {
|
|
@@ -24,12 +26,16 @@ type PaginationCommonProps = {
|
|
|
24
26
|
className?: string;
|
|
25
27
|
/** CSS classes to be applied on the per page element */
|
|
26
28
|
classNamePerPage?: string;
|
|
29
|
+
/** CSS classes to be applied on the pages info element */
|
|
30
|
+
classNamePagesInfo?: string;
|
|
27
31
|
/** CSS classes to be applied on the pages navigation element */
|
|
28
32
|
classNamePagesNav?: string;
|
|
29
33
|
/** Id to be applied as `data-testid` on the container element */
|
|
30
34
|
'data-testid'?: string;
|
|
31
35
|
/** Id to be applied as `data-testid` on per page element */
|
|
32
36
|
'data-testid-per-page'?: string;
|
|
37
|
+
/** Id to be applied as `data-testid` on the pages info element */
|
|
38
|
+
'data-testid-pages-info'?: string;
|
|
33
39
|
/** Id to be applied as `data-testid` on the pages navigation element */
|
|
34
40
|
'data-testid-pages-nav'?: string;
|
|
35
41
|
};
|
|
@@ -46,7 +52,7 @@ export type PaginationProps = {
|
|
|
46
52
|
/** Language to be used for texts. */
|
|
47
53
|
language?: PaginationLanguages;
|
|
48
54
|
/** Custom translation object to be used for texts. */
|
|
49
|
-
t?: PaginationTranslations
|
|
55
|
+
t?: Partial<PaginationTranslations>;
|
|
50
56
|
} & PaginationParams & PaginationCommonProps;
|
|
51
57
|
export declare const paginationDefaultTranslations: {
|
|
52
58
|
[key in PaginationLanguages]: PaginationTranslations;
|
|
@@ -1,228 +1,150 @@
|
|
|
1
1
|
import '../../assets/Pagination.css';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import { Select as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return Array.from({
|
|
32
|
-
length: F
|
|
33
|
-
}, (z, I) => a + I);
|
|
34
|
-
}, S = v(1, Math.min(n, s)), j = v(Math.max(s - n + 1, n + 1), s), P = Math.max(
|
|
35
|
-
Math.min(
|
|
36
|
-
// Natural start
|
|
37
|
-
o - h,
|
|
38
|
-
// Lower boundary when page is high
|
|
39
|
-
s - n - h * 2 - 1
|
|
40
|
-
),
|
|
41
|
-
// Greater than startPages
|
|
42
|
-
n + 2
|
|
43
|
-
), N = Math.min(
|
|
44
|
-
Math.max(
|
|
45
|
-
// Natural end
|
|
46
|
-
o + h,
|
|
47
|
-
// Upper boundary when page is low
|
|
48
|
-
n + h * 2 + 2
|
|
49
|
-
),
|
|
50
|
-
// Less than endPages
|
|
51
|
-
j.length > 0 ? j[0] - 2 : s - 1
|
|
52
|
-
), L = [
|
|
53
|
-
...r ? ["first"] : [],
|
|
54
|
-
..._ ? [] : ["previous"],
|
|
55
|
-
...S,
|
|
56
|
-
// Start ellipsis
|
|
57
|
-
// eslint-disable-next-line no-nested-ternary
|
|
58
|
-
...P > n + 2 ? ["start-ellipsis"] : n + 1 < s - n ? [n + 1] : [],
|
|
59
|
-
// Sibling pages
|
|
60
|
-
...v(P, N),
|
|
61
|
-
// End ellipsis
|
|
62
|
-
// eslint-disable-next-line no-nested-ternary
|
|
63
|
-
...N < s - n - 1 ? ["end-ellipsis"] : s - n > n ? [s - n] : [],
|
|
64
|
-
...j,
|
|
65
|
-
...x ? [] : ["next"],
|
|
66
|
-
...f ? ["last"] : []
|
|
67
|
-
], B = (a) => {
|
|
68
|
-
switch (a) {
|
|
69
|
-
case "first":
|
|
70
|
-
return 1;
|
|
71
|
-
case "previous":
|
|
72
|
-
return o - 1;
|
|
73
|
-
case "next":
|
|
74
|
-
return o + 1;
|
|
75
|
-
case "last":
|
|
76
|
-
return s;
|
|
77
|
-
default:
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
}, D = L.map((a) => typeof a == "number" ? {
|
|
81
|
-
onClick: (g) => {
|
|
82
|
-
C(g, a);
|
|
83
|
-
},
|
|
84
|
-
type: "page",
|
|
85
|
-
page: a,
|
|
86
|
-
selected: a === o,
|
|
87
|
-
disabled: c,
|
|
88
|
-
"aria-current": a === o ? "true" : void 0
|
|
89
|
-
} : {
|
|
90
|
-
onClick: (g) => {
|
|
91
|
-
C(g, B(a));
|
|
92
|
-
},
|
|
93
|
-
type: a,
|
|
94
|
-
page: B(a),
|
|
95
|
-
selected: !1,
|
|
96
|
-
disabled: c || a.indexOf("ellipsis") === -1 && (a === "next" || a === "last" ? o >= s : o <= 1)
|
|
97
|
-
});
|
|
98
|
-
return E({
|
|
99
|
-
items: D
|
|
100
|
-
}, d);
|
|
101
|
-
}
|
|
102
|
-
const W = "_pagination_19imj_43", u = {
|
|
103
|
-
"u-typography-h1": "_u-typography-h1_19imj_1",
|
|
104
|
-
"u-typography-h2": "_u-typography-h2_19imj_8",
|
|
105
|
-
"u-typography-h3": "_u-typography-h3_19imj_15",
|
|
106
|
-
"u-typography-h4": "_u-typography-h4_19imj_22",
|
|
107
|
-
"u-typography-h5": "_u-typography-h5_19imj_29",
|
|
108
|
-
"u-typography-h6": "_u-typography-h6_19imj_36",
|
|
109
|
-
"u-typography-base": "_u-typography-base_19imj_43",
|
|
110
|
-
pagination: W,
|
|
111
|
-
"per-page-container": "_per-page-container_19imj_43",
|
|
112
|
-
"u-typography-base--xxl": "_u-typography-base--xxl_19imj_48",
|
|
113
|
-
"u-typography-base--xl": "_u-typography-base--xl_19imj_52",
|
|
114
|
-
"u-typography-base--lg": "_u-typography-base--lg_19imj_56",
|
|
115
|
-
"u-typography-base--sm": "_u-typography-base--sm_19imj_60",
|
|
116
|
-
"u-typography-base--bold": "_u-typography-base--bold_19imj_64",
|
|
117
|
-
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_19imj_67",
|
|
118
|
-
"u-typography-base--underlined": "_u-typography-base--underlined_19imj_70",
|
|
119
|
-
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_19imj_73",
|
|
120
|
-
"per-page-container__select": "_per-page-container__select_19imj_90",
|
|
121
|
-
"pages-navigator-container": "_pages-navigator-container_19imj_97",
|
|
122
|
-
"page-item": "_page-item_19imj_114",
|
|
123
|
-
"page-number__btn": "_page-number__btn_19imj_114",
|
|
124
|
-
"pages-navigator-container__previous-next-btn": "_pages-navigator-container__previous-next-btn_19imj_133",
|
|
125
|
-
"page-number__btn--selected": "_page-number__btn--selected_19imj_158"
|
|
126
|
-
}, q = {
|
|
2
|
+
import { jsxs as s, Fragment as p, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { c as o } from "../../clsx-DB4S2d7J.js";
|
|
4
|
+
import { Select as d } from "../Select/Select.js";
|
|
5
|
+
import I from "./usePagination.js";
|
|
6
|
+
const C = "_pagination_2n0nk_43", a = {
|
|
7
|
+
"u-typography-h1": "_u-typography-h1_2n0nk_1",
|
|
8
|
+
"u-typography-h2": "_u-typography-h2_2n0nk_8",
|
|
9
|
+
"u-typography-h3": "_u-typography-h3_2n0nk_15",
|
|
10
|
+
"u-typography-h4": "_u-typography-h4_2n0nk_22",
|
|
11
|
+
"u-typography-h5": "_u-typography-h5_2n0nk_29",
|
|
12
|
+
"u-typography-h6": "_u-typography-h6_2n0nk_36",
|
|
13
|
+
"u-typography-base": "_u-typography-base_2n0nk_43",
|
|
14
|
+
pagination: C,
|
|
15
|
+
"per-page-container": "_per-page-container_2n0nk_43",
|
|
16
|
+
"u-typography-base--xxl": "_u-typography-base--xxl_2n0nk_49",
|
|
17
|
+
"u-typography-base--xl": "_u-typography-base--xl_2n0nk_53",
|
|
18
|
+
"u-typography-base--lg": "_u-typography-base--lg_2n0nk_57",
|
|
19
|
+
"u-typography-base--sm": "_u-typography-base--sm_2n0nk_61",
|
|
20
|
+
"u-typography-base--bold": "_u-typography-base--bold_2n0nk_65",
|
|
21
|
+
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_2n0nk_68",
|
|
22
|
+
"u-typography-base--underlined": "_u-typography-base--underlined_2n0nk_71",
|
|
23
|
+
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_2n0nk_74",
|
|
24
|
+
"per-page-container__select": "_per-page-container__select_2n0nk_91",
|
|
25
|
+
"pages-navigator-container": "_pages-navigator-container_2n0nk_98",
|
|
26
|
+
"page-item": "_page-item_2n0nk_115",
|
|
27
|
+
"page-number__btn": "_page-number__btn_2n0nk_115",
|
|
28
|
+
"pages-navigator-container__previous-next-btn": "_pages-navigator-container__previous-next-btn_2n0nk_134",
|
|
29
|
+
"page-number__btn--selected": "_page-number__btn--selected_2n0nk_159"
|
|
30
|
+
}, w = {
|
|
127
31
|
pt: {
|
|
128
32
|
showing: "Exibindo",
|
|
129
33
|
of: "de",
|
|
130
34
|
results: "resultados",
|
|
131
35
|
previous: "Anterior",
|
|
132
|
-
next: "Próximo"
|
|
36
|
+
next: "Próximo",
|
|
37
|
+
perPage: "Itens por página"
|
|
133
38
|
},
|
|
134
39
|
en: {
|
|
135
40
|
showing: "Showing",
|
|
136
41
|
of: "of",
|
|
137
42
|
results: "results",
|
|
138
43
|
previous: "Previous",
|
|
139
|
-
next: "Next"
|
|
44
|
+
next: "Next",
|
|
45
|
+
perPage: "Items per page"
|
|
140
46
|
}
|
|
141
|
-
},
|
|
142
|
-
const
|
|
143
|
-
count:
|
|
47
|
+
}, j = ({ perPageOptions: g = [5, 10, 25, 50, 100], language: y = "en", ...e }) => {
|
|
48
|
+
const l = Math.ceil(e.totalItems / e.perPage), b = e.currentPage <= 1, m = e.currentPage >= l, k = { ...w[y], ...e.t || {} }, i = (n) => k[n], { items: v } = I({
|
|
49
|
+
count: l,
|
|
144
50
|
hideNextButton: !0,
|
|
145
51
|
hidePrevButton: !0,
|
|
146
52
|
page: e.currentPage,
|
|
147
53
|
siblingCount: 1,
|
|
148
|
-
boundaryCount: 2
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
/* @__PURE__ */ i(
|
|
54
|
+
boundaryCount: 2
|
|
55
|
+
}), c = e.perPage * (e.currentPage - 1) + 1, u = c + e.perPage - 1, x = u > e.totalItems ? u - e.totalItems : 0, P = u - x;
|
|
56
|
+
return /* @__PURE__ */ s("div", { className: o(a.pagination, e.className), "data-testid": e["data-testid"], children: [
|
|
57
|
+
/* @__PURE__ */ s(
|
|
153
58
|
"div",
|
|
154
59
|
{
|
|
155
|
-
className:
|
|
60
|
+
className: o(a["per-page-container"], e.classNamePerPage),
|
|
156
61
|
"data-testid": e["data-testid-per-page"],
|
|
157
|
-
children:
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
62
|
+
children: [
|
|
63
|
+
g && /* @__PURE__ */ s(p, { children: [
|
|
64
|
+
/* @__PURE__ */ t("span", { children: i`perPage` }),
|
|
65
|
+
/* @__PURE__ */ t(
|
|
66
|
+
d,
|
|
67
|
+
{
|
|
68
|
+
className: a["per-page-container__select"],
|
|
69
|
+
value: String(e.perPage),
|
|
70
|
+
onChange: (n) => e.onRowsPerPageChange(Number(n)),
|
|
71
|
+
children: g == null ? void 0 : g.map((n) => {
|
|
72
|
+
const r = typeof n == "number";
|
|
73
|
+
return /* @__PURE__ */ t(
|
|
74
|
+
d.Option,
|
|
75
|
+
{
|
|
76
|
+
value: String(r ? n : n.value),
|
|
77
|
+
children: r ? n : n.label
|
|
78
|
+
},
|
|
79
|
+
`per-page__${r ? n : n.value}`
|
|
80
|
+
);
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ s(
|
|
86
|
+
"div",
|
|
161
87
|
{
|
|
162
|
-
className:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
88
|
+
className: o(a["page-infos"], e.classNamePagesInfo),
|
|
89
|
+
"data-testid": e["data-testid-pages-info"],
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ s("span", { children: [
|
|
92
|
+
c,
|
|
93
|
+
" - ",
|
|
94
|
+
P
|
|
95
|
+
] }),
|
|
96
|
+
" ",
|
|
97
|
+
/* @__PURE__ */ s("span", { children: [
|
|
98
|
+
i`of`,
|
|
99
|
+
" ",
|
|
100
|
+
/* @__PURE__ */ t("strong", { children: e.totalItems }),
|
|
101
|
+
" ",
|
|
102
|
+
i`results`
|
|
103
|
+
] })
|
|
104
|
+
]
|
|
176
105
|
}
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
_`of`,
|
|
180
|
-
" ",
|
|
181
|
-
/* @__PURE__ */ i("strong", { children: e.totalItems }),
|
|
182
|
-
" ",
|
|
183
|
-
_`results`
|
|
184
|
-
] })
|
|
185
|
-
] })
|
|
106
|
+
)
|
|
107
|
+
]
|
|
186
108
|
}
|
|
187
109
|
),
|
|
188
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ s(
|
|
189
111
|
"div",
|
|
190
112
|
{
|
|
191
|
-
className:
|
|
113
|
+
className: o(a["pages-navigator-container"], e.classNamePagesNav),
|
|
192
114
|
"data-testid": e["data-testid-pages-nav"],
|
|
193
115
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ t(
|
|
195
117
|
"button",
|
|
196
118
|
{
|
|
197
|
-
className:
|
|
119
|
+
className: a["pages-navigator-container__previous-next-btn"],
|
|
198
120
|
disabled: b,
|
|
199
121
|
onClick: () => e.onPageChange(e.currentPage - 1),
|
|
200
122
|
type: "button",
|
|
201
|
-
children:
|
|
123
|
+
children: i`previous`
|
|
202
124
|
},
|
|
203
125
|
"page__previous"
|
|
204
126
|
),
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
let
|
|
207
|
-
return r === "start-ellipsis" || r === "end-ellipsis" ?
|
|
127
|
+
/* @__PURE__ */ t("ul", { children: v.map(({ page: n, type: r, selected: N, ...f }, h) => {
|
|
128
|
+
let _ = /* @__PURE__ */ t(p, {});
|
|
129
|
+
return r === "start-ellipsis" || r === "end-ellipsis" ? _ = /* @__PURE__ */ t("span", { className: a["page-item"], children: "..." }) : r === "page" ? _ = /* @__PURE__ */ t(
|
|
208
130
|
"button",
|
|
209
131
|
{
|
|
210
|
-
className:
|
|
211
|
-
onClick: () => e.onPageChange(
|
|
132
|
+
className: o(a["page-number__btn"], N && a["page-number__btn--selected"]),
|
|
133
|
+
onClick: () => e.onPageChange(n || 0),
|
|
212
134
|
type: "button",
|
|
213
|
-
children:
|
|
135
|
+
children: n
|
|
214
136
|
},
|
|
215
|
-
`page__${
|
|
216
|
-
) :
|
|
137
|
+
`page__${h}`
|
|
138
|
+
) : _ = /* @__PURE__ */ t("button", { type: "button", ...f, children: r }), /* @__PURE__ */ t("li", { children: _ }, h);
|
|
217
139
|
}) }),
|
|
218
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ t(
|
|
219
141
|
"button",
|
|
220
142
|
{
|
|
221
|
-
className:
|
|
222
|
-
disabled:
|
|
143
|
+
className: a["pages-navigator-container__previous-next-btn"],
|
|
144
|
+
disabled: m,
|
|
223
145
|
onClick: () => e.onPageChange(e.currentPage + 1),
|
|
224
146
|
type: "button",
|
|
225
|
-
children:
|
|
147
|
+
children: i`next`
|
|
226
148
|
},
|
|
227
149
|
"page__next"
|
|
228
150
|
)
|
|
@@ -232,6 +154,6 @@ const W = "_pagination_19imj_43", u = {
|
|
|
232
154
|
] });
|
|
233
155
|
};
|
|
234
156
|
export {
|
|
235
|
-
|
|
236
|
-
|
|
157
|
+
j as Pagination,
|
|
158
|
+
w as paginationDefaultTranslations
|
|
237
159
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FOR WORKING WELL I NEEDED TO REMOVE ALL `useControlled` REFERENCES IN `usePagination.js` CODE.
|
|
3
|
+
* import useControlled from '@mui/utils/useControlled';
|
|
4
|
+
|
|
5
|
+
* TO AVOID THE CONSOLE ERROR:
|
|
6
|
+
|
|
7
|
+
MUI: A component is changing the uncontrolled page state of usePagination to be controlled.
|
|
8
|
+
Elements should not switch from uncontrolled to controlled (or vice versa).
|
|
9
|
+
Decide between using a controlled or uncontrolled usePagination element for the lifetime of the component.
|
|
10
|
+
The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.
|
|
11
|
+
More info: https://fb.me/react-controlled-components
|
|
12
|
+
|
|
13
|
+
* I WAS ABLE TO IDENTIFY THIS PROBLEM BUT I WAS NOT ABLE TO SOLVE IT.
|
|
14
|
+
* THIS BUG HAPPENS IN A SPECIFIC SITUATION THAT `usePagination` HOOK TRY TO USE CONTROLLED WAY, BUT IN THE WRONG WAY.
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
export interface UsePaginationProps {
|
|
19
|
+
/**
|
|
20
|
+
* Number of always visible pages at the beginning and end.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
boundaryCount?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the component where this hook is used.
|
|
26
|
+
*/
|
|
27
|
+
componentName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The total number of pages.
|
|
30
|
+
* @default 1
|
|
31
|
+
*/
|
|
32
|
+
count?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The page selected by default when the component is uncontrolled.
|
|
35
|
+
* @default 1
|
|
36
|
+
*/
|
|
37
|
+
defaultPage?: number;
|
|
38
|
+
/**
|
|
39
|
+
* If `true`, the component is disabled.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If `true`, hide the next-page button.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
hideNextButton?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If `true`, hide the previous-page button.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
hidePrevButton?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Callback fired when the page is changed.
|
|
55
|
+
*
|
|
56
|
+
* @param {React.ChangeEvent<unknown>} event The event source of the callback.
|
|
57
|
+
* @param {number} page The page selected.
|
|
58
|
+
*/
|
|
59
|
+
onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
|
|
60
|
+
/**
|
|
61
|
+
* The current page. Unlike `TablePagination`, which starts numbering from `0`, this pagination starts from `1`.
|
|
62
|
+
*/
|
|
63
|
+
page?: number;
|
|
64
|
+
/**
|
|
65
|
+
* If `true`, show the first-page button.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
showFirstButton?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If `true`, show the last-page button.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
showLastButton?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Number of always visible pages before and after the current page.
|
|
76
|
+
* @default 1
|
|
77
|
+
*/
|
|
78
|
+
siblingCount?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface UsePaginationItem {
|
|
81
|
+
onClick: React.ReactEventHandler;
|
|
82
|
+
type: 'page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis';
|
|
83
|
+
page: number | null;
|
|
84
|
+
selected: boolean;
|
|
85
|
+
disabled: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface UsePaginationResult {
|
|
88
|
+
items: UsePaginationItem[];
|
|
89
|
+
}
|
|
90
|
+
export default function usePagination(props?: UsePaginationProps): UsePaginationResult;
|