@pismo/marola 0.0.1-alpha.31 → 0.0.1-alpha.4
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 +5 -17
- package/dist/{Button-2b1peDFT.js → Button-C3Qm852g.js} +23 -23
- package/dist/Dialog.module-BO0mdB7d.js +15 -0
- package/dist/ListContext-D6-YwtZn.js +18 -0
- package/dist/Tabs.module-_kSbSyth.js +66 -0
- package/dist/assets/CallToActionButton.css +1 -0
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/LoadingSpinner.css +1 -1
- package/dist/assets/Tabs.css +1 -1
- package/dist/assets/Typography.css +1 -1
- package/dist/assets/main.css +1 -0
- package/dist/components/CallToActionButton/CallToActionButton.d.ts +21 -0
- package/dist/components/CallToActionButton/CallToActionButton.js +57 -0
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.d.ts +1 -1
- package/dist/components/Dialog/Backdrop.js +9 -2
- package/dist/components/Dialog/CloseIconButton.js +124 -12
- package/dist/components/Dialog/Dialog.d.ts +5 -6
- package/dist/components/Dialog/Dialog.js +20103 -445
- package/dist/components/Dialog/{DialogTitle.d.ts → Title.d.ts} +3 -3
- package/dist/components/Dialog/Title.js +14 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +0 -2
- package/dist/components/LoadingSpinner/LoadingSpinner.js +13 -12
- package/dist/components/Tabs/Tab.d.ts +1 -6
- package/dist/components/Tabs/Tab.js +173 -118
- package/dist/components/Tabs/TabPanel.d.ts +1 -5
- package/dist/components/Tabs/TabPanel.js +10 -8
- package/dist/components/Tabs/Tabs.d.ts +2 -8
- package/dist/components/Tabs/Tabs.js +701 -250
- package/dist/components/Typography/Typography.d.ts +6 -17
- package/dist/components/Typography/Typography.js +64 -55
- package/dist/{index-CH45lKw7.js → index-BZ1lkM_M.js} +159 -162
- package/dist/main.d.ts +5 -27
- package/dist/main.js +21 -76
- package/dist/types/helpers.d.ts +7 -14
- package/dist/useButton-CbmjmH5z.js +186 -0
- package/dist/useCompoundItem-B7wfGDHQ.js +41 -0
- package/package.json +10 -51
- package/src/playground/Playground.tsx +20 -0
- package/dist/ClickAwayListener-BSW-Nd-y.js +0 -107
- package/dist/Dialog.module-DFEmFdYT.js +0 -30
- package/dist/Group-B3p31ftp.js +0 -26
- package/dist/Popup-B6ZSGIEI.js +0 -1248
- package/dist/Portal-DIeBsWdL.js +0 -73
- package/dist/SelectButton-C8JQKaf4.js +0 -61
- package/dist/Tabs.module-jkH1Qjn7.js +0 -22
- package/dist/Toggle-BXcLAMNy.js +0 -142
- package/dist/assets/Advice.css +0 -1
- package/dist/assets/Button.css +0 -1
- package/dist/assets/Checkbox.css +0 -1
- package/dist/assets/EllipsisTooltip.css +0 -1
- package/dist/assets/Group.css +0 -1
- package/dist/assets/IconButton.css +0 -1
- package/dist/assets/Input.css +0 -1
- package/dist/assets/InputSearch.css +0 -1
- package/dist/assets/PageHeader.css +0 -1
- package/dist/assets/Pagination.css +0 -1
- package/dist/assets/SelectButton.css +0 -1
- package/dist/assets/Skeleton.css +0 -1
- package/dist/assets/Snackbar.css +0 -1
- package/dist/assets/SortTooltip.css +0 -1
- package/dist/assets/Stepper.css +0 -1
- package/dist/assets/Table.css +0 -1
- package/dist/assets/TextDisplay.css +0 -1
- package/dist/assets/Toggle.css +0 -1
- package/dist/assets/Toggle2.css +0 -1
- package/dist/assets/Tooltip.css +0 -1
- package/dist/combineHooksSlotProps-DVjg9PRh.js +0 -80
- package/dist/components/Advice/Advice.d.ts +0 -30
- package/dist/components/Advice/Advice.js +0 -48
- package/dist/components/Advice/Advice.stories.d.ts +0 -18
- package/dist/components/Button/Button.d.ts +0 -32
- package/dist/components/Button/Button.js +0 -65
- package/dist/components/Button/Button.stories.d.ts +0 -62
- package/dist/components/Checkbox/Checkbox.d.ts +0 -34
- package/dist/components/Checkbox/Checkbox.js +0 -71
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -31
- package/dist/components/Chip/Chip.d.ts +0 -39
- package/dist/components/Chip/Chip.js +0 -19
- package/dist/components/Chip/Chip.stories.d.ts +0 -42
- package/dist/components/Chip/chip.test.d.ts +0 -1
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -343
- package/dist/components/Dialog/DialogTitle.js +0 -29
- package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +0 -7
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +0 -23
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +0 -31
- package/dist/components/Icon/Icon.d.ts +0 -27
- package/dist/components/Icon/Icon.js +0 -136
- package/dist/components/Icon/Icon.stories.d.ts +0 -16
- package/dist/components/IconButton/Icon.stories.d.ts +0 -15
- package/dist/components/IconButton/IconButton.d.ts +0 -38
- package/dist/components/IconButton/IconButton.js +0 -63
- package/dist/components/Input/Input.d.ts +0 -44
- package/dist/components/Input/Input.js +0 -508
- package/dist/components/Input/Input.stories.d.ts +0 -43
- package/dist/components/InputSearch/InputSearch.d.ts +0 -9
- package/dist/components/InputSearch/InputSearch.js +0 -34
- package/dist/components/InputSearch/InputSearch.stories.d.ts +0 -39
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +0 -14
- package/dist/components/PageHeader/PageHeader.d.ts +0 -66
- package/dist/components/PageHeader/PageHeader.js +0 -87
- package/dist/components/PageHeader/PageHeader.stories.d.ts +0 -14
- package/dist/components/Pagination/Pagination.d.ts +0 -55
- package/dist/components/Pagination/Pagination.js +0 -237
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -17
- package/dist/components/Select/Select.d.ts +0 -26
- package/dist/components/Select/Select.js +0 -857
- package/dist/components/Select/Select.stories.d.ts +0 -22
- package/dist/components/Select/SelectButton.d.ts +0 -12
- package/dist/components/Select/SelectButton.js +0 -8
- package/dist/components/Skeleton/Skeleton.d.ts +0 -25
- package/dist/components/Skeleton/Skeleton.js +0 -23
- package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -14
- package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +0 -14
- package/dist/components/Skeleton/SkeletonTable.stories.d.ts +0 -16
- package/dist/components/Snackbar/Snackbar.d.ts +0 -27
- package/dist/components/Snackbar/Snackbar.js +0 -639
- package/dist/components/Snackbar/Snackbar.stories.d.ts +0 -319
- package/dist/components/SortTooltip/SortTooltip.d.ts +0 -28
- package/dist/components/SortTooltip/SortTooltip.js +0 -93
- package/dist/components/Stepper/Stepper.d.ts +0 -26
- package/dist/components/Stepper/Stepper.js +0 -48
- package/dist/components/Stepper/Stepper.stories.d.ts +0 -16
- package/dist/components/Table/Table.d.ts +0 -56
- package/dist/components/Table/Table.js +0 -137
- package/dist/components/Table/Table.stories.d.ts +0 -29
- package/dist/components/Table/TableContext.d.ts +0 -19
- package/dist/components/Table/TableContext.js +0 -21
- package/dist/components/Table/_Table.TBody.stories.d.ts +0 -14
- package/dist/components/Table/_Table.THead.stories.d.ts +0 -14
- package/dist/components/Table/_Table.Td.stories.d.ts +0 -16
- package/dist/components/Table/_Table.Th.stories.d.ts +0 -15
- package/dist/components/Table/_Table.Tr.stories.d.ts +0 -15
- package/dist/components/Tabs/Tab.stories.d.ts +0 -15
- package/dist/components/Tabs/TabPanel.stories.d.ts +0 -14
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -14
- package/dist/components/TextDisplay/TextDisplay.d.ts +0 -23
- package/dist/components/TextDisplay/TextDisplay.js +0 -37
- package/dist/components/TextDisplay/TextDisplay.stories.d.ts +0 -13
- package/dist/components/TextDisplay/textDisplay.test.d.ts +0 -1
- package/dist/components/Toggle/Toggle.d.ts +0 -11
- package/dist/components/Toggle/Toggle.js +0 -266
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -21
- package/dist/components/ToggleGroup/Group.d.ts +0 -18
- package/dist/components/ToggleGroup/Group.js +0 -7
- package/dist/components/ToggleGroup/Group.test.d.ts +0 -1
- package/dist/components/ToggleGroup/Toggle.d.ts +0 -15
- package/dist/components/ToggleGroup/Toggle.js +0 -16
- package/dist/components/ToggleGroup/Toggle.test.d.ts +0 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +0 -2
- package/dist/components/ToggleGroup/ToggleGroup.js +0 -6
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +0 -25
- package/dist/components/Tooltip/Tooltip.d.ts +0 -33
- package/dist/components/Tooltip/Tooltip.js +0 -141
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -35
- package/dist/components/Typography/Typography.stories.d.ts +0 -32
- package/dist/components/Typography/typography.test.d.ts +0 -1
- package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +0 -11
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +0 -50
- package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +0 -21
- package/dist/index-CjW42-M-.js +0 -19584
- package/dist/marola.css +0 -1
- package/dist/test-utils/assertStyles.d.ts +0 -1
- package/dist/test-utils/assertStyles.js +0 -11
- package/dist/useButton-DNk3wrQp.js +0 -105
- package/dist/useCompoundItem-D1iRfg8D.js +0 -84
- package/dist/useControlled-CCMYYdCM.js +0 -31
- package/dist/useEventCallback-xTG9piMa.js +0 -45
- package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
- package/dist/useList-B0hog_3-.js +0 -436
- package/dist/useTimeout-DxF9kiZL.js +0 -36
- package/dist/utils/styleStrings.d.ts +0 -6
- package/dist/utils/styleStrings.js +0 -10
- package/dist/utils/styleStrings.test.d.ts +0 -1
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { RequireAllOrNone } from '../../types/helpers';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type BreadcrumbItem = {
|
|
5
|
-
/** Breadcrumb item label */
|
|
6
|
-
label: string;
|
|
7
|
-
/** Id to be applied as `data-testid` on the breadcrumb item */
|
|
8
|
-
'data-testid'?: string;
|
|
9
|
-
/** CSS classes to be applied on the breadcrumb item */
|
|
10
|
-
className?: string;
|
|
11
|
-
/** Callback called when the breadcrumb item is clicked */
|
|
12
|
-
onClick: () => void;
|
|
13
|
-
};
|
|
14
|
-
type LastBreadcrumbItem = Omit<BreadcrumbItem, 'onClick'> & {
|
|
15
|
-
/** Callback called when the breadcrumb item is clicked */
|
|
16
|
-
onClick?: () => void;
|
|
17
|
-
};
|
|
18
|
-
type PageHeaderCommonProps = {
|
|
19
|
-
/** Title text */
|
|
20
|
-
title: string;
|
|
21
|
-
/** Subtitle text */
|
|
22
|
-
subtitle?: string;
|
|
23
|
-
/** Back link text
|
|
24
|
-
* @deprecated Use breadcrumb prop instead.
|
|
25
|
-
*/
|
|
26
|
-
backLinkText?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Callback called when `back link` is clicked
|
|
29
|
-
* @deprecated Use breadcrumb prop instead.
|
|
30
|
-
* */
|
|
31
|
-
onBackLinkClick?: () => void;
|
|
32
|
-
/** Element to be rendered on the right slot of the component */
|
|
33
|
-
rightChildren?: ReactNode;
|
|
34
|
-
/** Element to be rendered on the bottom slot of the component */
|
|
35
|
-
bottomChildren?: ReactNode;
|
|
36
|
-
/** CSS classes to be applied on the container element */
|
|
37
|
-
classNameWrapper?: string;
|
|
38
|
-
/**
|
|
39
|
-
* CSS classes to be applied on the back link element
|
|
40
|
-
* @deprecated Use breadcrumb prop instead.
|
|
41
|
-
* */
|
|
42
|
-
classNameBackLink?: string;
|
|
43
|
-
/** CSS classes to be applied on the title element */
|
|
44
|
-
classNameTitle?: string;
|
|
45
|
-
/** CSS classes to be applied on the subtitle element */
|
|
46
|
-
classNameSubtitle?: string;
|
|
47
|
-
/** Id to be applied as `data-testid` on the container element */
|
|
48
|
-
'data-testid-wrapper'?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Id to be applied as `data-testid` on the back link element
|
|
51
|
-
* @deprecated Use breadcrumb prop instead.
|
|
52
|
-
* */
|
|
53
|
-
'data-testid-backLink'?: string;
|
|
54
|
-
/** Id to be applied as `data-testid` on the title element */
|
|
55
|
-
'data-testid-title'?: string;
|
|
56
|
-
/** Id to be applied as `data-testid` on the subtitle element */
|
|
57
|
-
'data-testid-subtitle'?: string;
|
|
58
|
-
breadcrumb?: never;
|
|
59
|
-
};
|
|
60
|
-
type PageHeaderWithBreadcrumb = Omit<PageHeaderCommonProps, 'backLinkText' | 'onBackLinkClick' | 'classNameBackLink' | 'data-testid-backLink' | 'breadcrumb'> & {
|
|
61
|
-
/** List of breadcrumbs to be rendered at the top of the title */
|
|
62
|
-
breadcrumb?: [...BreadcrumbItem[], LastBreadcrumbItem];
|
|
63
|
-
};
|
|
64
|
-
export type PageHeaderProps = RequireAllOrNone<PageHeaderCommonProps, 'backLinkText' | 'onBackLinkClick'> | PageHeaderWithBreadcrumb;
|
|
65
|
-
export declare const PageHeader: ({ title, subtitle, rightChildren, bottomChildren, classNameWrapper, classNameTitle, classNameSubtitle, "data-testid-wrapper": wrapperTestId, "data-testid-title": titleTestId, "data-testid-subtitle": subtitleTestId, ...props }: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
66
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import '../../assets/PageHeader.css';
|
|
2
|
-
import { jsx as a, jsxs as h } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as L } from "react";
|
|
4
|
-
import { c as n } from "../../clsx-DB4S2d7J.js";
|
|
5
|
-
import { Icon as B } from "../Icon/Icon.js";
|
|
6
|
-
import { IconButton as C } from "../IconButton/IconButton.js";
|
|
7
|
-
const j = "_title_z7ezb_22", w = "_subtitle_z7ezb_43", e = {
|
|
8
|
-
"u-typography-h1": "_u-typography-h1_z7ezb_1",
|
|
9
|
-
"u-typography-h2": "_u-typography-h2_z7ezb_8",
|
|
10
|
-
"u-typography-h3": "_u-typography-h3_z7ezb_15",
|
|
11
|
-
"u-typography-h4": "_u-typography-h4_z7ezb_22",
|
|
12
|
-
"page-header__main-left-content": "_page-header__main-left-content_z7ezb_22",
|
|
13
|
-
title: j,
|
|
14
|
-
"u-typography-h5": "_u-typography-h5_z7ezb_29",
|
|
15
|
-
"u-typography-h6": "_u-typography-h6_z7ezb_36",
|
|
16
|
-
"u-typography-base": "_u-typography-base_z7ezb_43",
|
|
17
|
-
subtitle: w,
|
|
18
|
-
"u-typography-base--xxl": "_u-typography-base--xxl_z7ezb_48",
|
|
19
|
-
"u-typography-base--xl": "_u-typography-base--xl_z7ezb_52",
|
|
20
|
-
"u-typography-base--lg": "_u-typography-base--lg_z7ezb_56",
|
|
21
|
-
"u-typography-base--sm": "_u-typography-base--sm_z7ezb_60",
|
|
22
|
-
"u-typography-base--bold": "_u-typography-base--bold_z7ezb_64",
|
|
23
|
-
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_z7ezb_67",
|
|
24
|
-
"u-typography-base--underlined": "_u-typography-base--underlined_z7ezb_70",
|
|
25
|
-
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_z7ezb_73",
|
|
26
|
-
"page-header": "_page-header_z7ezb_22",
|
|
27
|
-
"page-header__top-content": "_page-header__top-content_z7ezb_86",
|
|
28
|
-
"page-header__main-content": "_page-header__main-content_z7ezb_89",
|
|
29
|
-
"page-header__bottom-content": "_page-header__bottom-content_z7ezb_89",
|
|
30
|
-
"page-header__breadcrumb": "_page-header__breadcrumb_z7ezb_103",
|
|
31
|
-
"page-header__breadcrumb__separator": "_page-header__breadcrumb__separator_z7ezb_108",
|
|
32
|
-
"page-header__main-right-content": "_page-header__main-right-content_z7ezb_131"
|
|
33
|
-
}, P = ({
|
|
34
|
-
title: l,
|
|
35
|
-
subtitle: g,
|
|
36
|
-
rightChildren: d,
|
|
37
|
-
bottomChildren: b,
|
|
38
|
-
classNameWrapper: y,
|
|
39
|
-
classNameTitle: u,
|
|
40
|
-
classNameSubtitle: z,
|
|
41
|
-
"data-testid-wrapper": m,
|
|
42
|
-
"data-testid-title": k,
|
|
43
|
-
"data-testid-subtitle": N,
|
|
44
|
-
...f
|
|
45
|
-
}) => {
|
|
46
|
-
const {
|
|
47
|
-
breadcrumb: r,
|
|
48
|
-
backLinkText: p,
|
|
49
|
-
onBackLinkClick: s,
|
|
50
|
-
classNameBackLink: c,
|
|
51
|
-
"data-testid-backLink": i,
|
|
52
|
-
...x
|
|
53
|
-
} = f, v = L(() => {
|
|
54
|
-
const _ = [];
|
|
55
|
-
return p && s && _.push({
|
|
56
|
-
label: p,
|
|
57
|
-
className: c,
|
|
58
|
-
"data-testid": i,
|
|
59
|
-
onClick: s
|
|
60
|
-
}), r && _.push(...r), /* @__PURE__ */ a("div", { className: e["page-header__top-content"], children: /* @__PURE__ */ a("div", { className: e["page-header__breadcrumb"], children: _.map((t, o) => /* @__PURE__ */ a(
|
|
61
|
-
C,
|
|
62
|
-
{
|
|
63
|
-
icon: o === 0 ? /* @__PURE__ */ a(B, { icon: "arrow-left" }) : /* @__PURE__ */ a("span", { className: e["page-header__breadcrumb__separator"], children: "/" }),
|
|
64
|
-
onClick: () => t.onClick && t.onClick(),
|
|
65
|
-
className: t.className,
|
|
66
|
-
"data-testid": t["data-testid"],
|
|
67
|
-
disabled: _.length === 1 ? !1 : o === _.length - 1,
|
|
68
|
-
children: t.label
|
|
69
|
-
},
|
|
70
|
-
`${t.label}_${o}`
|
|
71
|
-
)) }) });
|
|
72
|
-
}, [r, p, c, i, s]);
|
|
73
|
-
return /* @__PURE__ */ h("div", { className: n([e["page-header"], y]), "data-testid": m, ...x, children: [
|
|
74
|
-
v,
|
|
75
|
-
/* @__PURE__ */ h("div", { className: e["page-header__main-content"], children: [
|
|
76
|
-
/* @__PURE__ */ h("div", { className: e["page-header__main-left-content"], children: [
|
|
77
|
-
/* @__PURE__ */ a("h1", { className: n(e.title, u), "data-testid": k, children: l }),
|
|
78
|
-
/* @__PURE__ */ a("h2", { className: n(e.subtitle, z), "data-testid": N, children: g })
|
|
79
|
-
] }),
|
|
80
|
-
d && /* @__PURE__ */ a("div", { className: e["page-header__main-right-content"], children: d })
|
|
81
|
-
] }),
|
|
82
|
-
b && /* @__PURE__ */ a("div", { className: e["page-header__bottom-content"], children: b })
|
|
83
|
-
] });
|
|
84
|
-
};
|
|
85
|
-
export {
|
|
86
|
-
P as PageHeader
|
|
87
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ title, subtitle, rightChildren, bottomChildren, classNameWrapper, classNameTitle, classNameSubtitle, "data-testid-wrapper": wrapperTestId, "data-testid-title": titleTestId, "data-testid-subtitle": subtitleTestId, ...props }: import('./PageHeader').PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
tags: string[];
|
|
7
|
-
};
|
|
8
|
-
export default meta;
|
|
9
|
-
type Story = StoryObj<typeof meta>;
|
|
10
|
-
export declare const Simple: Story;
|
|
11
|
-
export declare const WithBackLink: Story;
|
|
12
|
-
export declare const WithBreadcrumb: Story;
|
|
13
|
-
export declare const WithRightChildren: Story;
|
|
14
|
-
export declare const WithBottomChildren: Story;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export type PaginationParams = {
|
|
2
|
-
/** Total number of items to paginate */
|
|
3
|
-
totalItems: number;
|
|
4
|
-
/** Number of items to show per page */
|
|
5
|
-
perPage: number;
|
|
6
|
-
/** Current page */
|
|
7
|
-
currentPage: number;
|
|
8
|
-
};
|
|
9
|
-
export type PaginationTranslations = {
|
|
10
|
-
/** Translation text for `showing` */
|
|
11
|
-
showing: string;
|
|
12
|
-
/** Translation text for `of` */
|
|
13
|
-
of: string;
|
|
14
|
-
/** Translation text for `result` */
|
|
15
|
-
results: string;
|
|
16
|
-
/** Translation text for `previous` */
|
|
17
|
-
previous: string;
|
|
18
|
-
/** Translation text for `next` */
|
|
19
|
-
next: string;
|
|
20
|
-
};
|
|
21
|
-
type PaginationLanguages = 'pt' | 'en';
|
|
22
|
-
type PaginationCommonProps = {
|
|
23
|
-
/** CSS classes to be applied on the container element */
|
|
24
|
-
className?: string;
|
|
25
|
-
/** CSS classes to be applied on the per page element */
|
|
26
|
-
classNamePerPage?: string;
|
|
27
|
-
/** CSS classes to be applied on the pages navigation element */
|
|
28
|
-
classNamePagesNav?: string;
|
|
29
|
-
/** Id to be applied as `data-testid` on the container element */
|
|
30
|
-
'data-testid'?: string;
|
|
31
|
-
/** Id to be applied as `data-testid` on per page element */
|
|
32
|
-
'data-testid-per-page'?: string;
|
|
33
|
-
/** Id to be applied as `data-testid` on the pages navigation element */
|
|
34
|
-
'data-testid-pages-nav'?: string;
|
|
35
|
-
};
|
|
36
|
-
export type PaginationProps = {
|
|
37
|
-
/** Array of options to be rendered as per page options. */
|
|
38
|
-
perPageOptions?: (number | {
|
|
39
|
-
value: number;
|
|
40
|
-
label: string;
|
|
41
|
-
})[] | undefined;
|
|
42
|
-
/** Callback called when page changes. */
|
|
43
|
-
onPageChange: (page: number) => void;
|
|
44
|
-
/** Callback called when items per page changes. */
|
|
45
|
-
onRowsPerPageChange: (perPage: number) => void;
|
|
46
|
-
/** Language to be used for texts. */
|
|
47
|
-
language?: PaginationLanguages;
|
|
48
|
-
/** Custom translation object to be used for texts. */
|
|
49
|
-
t?: PaginationTranslations;
|
|
50
|
-
} & PaginationParams & PaginationCommonProps;
|
|
51
|
-
export declare const paginationDefaultTranslations: {
|
|
52
|
-
[key in PaginationLanguages]: PaginationTranslations;
|
|
53
|
-
};
|
|
54
|
-
export declare const Pagination: ({ perPageOptions, language, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
export {};
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import '../../assets/Pagination.css';
|
|
2
|
-
import { jsxs as m, jsx as i, Fragment as k } from "react/jsx-runtime";
|
|
3
|
-
import { c as y } from "../../clsx-DB4S2d7J.js";
|
|
4
|
-
import { Select as w } from "../Select/Select.js";
|
|
5
|
-
import { _ as A, b as E } from "../../index-CH45lKw7.js";
|
|
6
|
-
import { u as $ } from "../../useControlled-CCMYYdCM.js";
|
|
7
|
-
const R = ["boundaryCount", "componentName", "count", "defaultPage", "disabled", "hideNextButton", "hidePrevButton", "onChange", "page", "showFirstButton", "showLastButton", "siblingCount"];
|
|
8
|
-
function T(l = {}) {
|
|
9
|
-
const {
|
|
10
|
-
boundaryCount: n = 1,
|
|
11
|
-
componentName: e = "usePagination",
|
|
12
|
-
count: s = 1,
|
|
13
|
-
defaultPage: b = 1,
|
|
14
|
-
disabled: c = !1,
|
|
15
|
-
hideNextButton: x = !1,
|
|
16
|
-
hidePrevButton: _ = !1,
|
|
17
|
-
onChange: p,
|
|
18
|
-
page: t,
|
|
19
|
-
showFirstButton: r = !1,
|
|
20
|
-
showLastButton: f = !1,
|
|
21
|
-
siblingCount: h = 1
|
|
22
|
-
} = l, d = A(l, R), [o, M] = $({
|
|
23
|
-
controlled: t,
|
|
24
|
-
default: b,
|
|
25
|
-
name: e,
|
|
26
|
-
state: "page"
|
|
27
|
-
}), C = (a, g) => {
|
|
28
|
-
t || M(g), p && p(a, g);
|
|
29
|
-
}, v = (a, g) => {
|
|
30
|
-
const F = g - a + 1;
|
|
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 = {
|
|
127
|
-
pt: {
|
|
128
|
-
showing: "Exibindo",
|
|
129
|
-
of: "de",
|
|
130
|
-
results: "resultados",
|
|
131
|
-
previous: "Anterior",
|
|
132
|
-
next: "Próximo"
|
|
133
|
-
},
|
|
134
|
-
en: {
|
|
135
|
-
showing: "Showing",
|
|
136
|
-
of: "of",
|
|
137
|
-
results: "results",
|
|
138
|
-
previous: "Previous",
|
|
139
|
-
next: "Next"
|
|
140
|
-
}
|
|
141
|
-
}, U = ({ perPageOptions: l = [5, 10, 25, 50, 100], language: n = "en", ...e }) => {
|
|
142
|
-
const s = Math.ceil(e.totalItems / e.perPage), b = e.currentPage <= 1, c = e.currentPage >= s, x = e.t || q[n], _ = (t) => x[t], { items: p } = T({
|
|
143
|
-
count: s,
|
|
144
|
-
hideNextButton: !0,
|
|
145
|
-
hidePrevButton: !0,
|
|
146
|
-
page: e.currentPage,
|
|
147
|
-
siblingCount: 1,
|
|
148
|
-
boundaryCount: 2,
|
|
149
|
-
onChange: (t, r) => e.onPageChange(r)
|
|
150
|
-
});
|
|
151
|
-
return /* @__PURE__ */ m("div", { className: y(u.pagination, e.className), "data-testid": e["data-testid"], children: [
|
|
152
|
-
/* @__PURE__ */ i(
|
|
153
|
-
"div",
|
|
154
|
-
{
|
|
155
|
-
className: y(u["per-page-container"], e.classNamePerPage),
|
|
156
|
-
"data-testid": e["data-testid-per-page"],
|
|
157
|
-
children: l && /* @__PURE__ */ m(k, { children: [
|
|
158
|
-
/* @__PURE__ */ i("span", { children: _`showing` }),
|
|
159
|
-
/* @__PURE__ */ i(
|
|
160
|
-
w,
|
|
161
|
-
{
|
|
162
|
-
className: u["per-page-container__select"],
|
|
163
|
-
value: String(e.perPage),
|
|
164
|
-
onChange: (t) => e.onRowsPerPageChange(Number(t)),
|
|
165
|
-
children: l == null ? void 0 : l.map((t) => {
|
|
166
|
-
const r = typeof t == "number";
|
|
167
|
-
return /* @__PURE__ */ i(
|
|
168
|
-
w.Option,
|
|
169
|
-
{
|
|
170
|
-
value: String(r ? t : t.value),
|
|
171
|
-
children: r ? t : t.label
|
|
172
|
-
},
|
|
173
|
-
`per-page__${r ? t : t.value}`
|
|
174
|
-
);
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
/* @__PURE__ */ m("span", { children: [
|
|
179
|
-
_`of`,
|
|
180
|
-
" ",
|
|
181
|
-
/* @__PURE__ */ i("strong", { children: e.totalItems }),
|
|
182
|
-
" ",
|
|
183
|
-
_`results`
|
|
184
|
-
] })
|
|
185
|
-
] })
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ m(
|
|
189
|
-
"div",
|
|
190
|
-
{
|
|
191
|
-
className: y(u["pages-navigator-container"], e.classNamePagesNav),
|
|
192
|
-
"data-testid": e["data-testid-pages-nav"],
|
|
193
|
-
children: [
|
|
194
|
-
/* @__PURE__ */ i(
|
|
195
|
-
"button",
|
|
196
|
-
{
|
|
197
|
-
className: u["pages-navigator-container__previous-next-btn"],
|
|
198
|
-
disabled: b,
|
|
199
|
-
onClick: () => e.onPageChange(e.currentPage - 1),
|
|
200
|
-
type: "button",
|
|
201
|
-
children: _`previous`
|
|
202
|
-
},
|
|
203
|
-
"page__previous"
|
|
204
|
-
),
|
|
205
|
-
/* @__PURE__ */ i("ul", { children: p.map(({ page: t, type: r, selected: f, ...h }, d) => {
|
|
206
|
-
let o = /* @__PURE__ */ i(k, {});
|
|
207
|
-
return r === "start-ellipsis" || r === "end-ellipsis" ? o = /* @__PURE__ */ i("span", { className: u["page-item"], children: "..." }) : r === "page" ? o = /* @__PURE__ */ i(
|
|
208
|
-
"button",
|
|
209
|
-
{
|
|
210
|
-
className: y(u["page-number__btn"], f && u["page-number__btn--selected"]),
|
|
211
|
-
onClick: () => e.onPageChange(t || 0),
|
|
212
|
-
type: "button",
|
|
213
|
-
children: t
|
|
214
|
-
},
|
|
215
|
-
`page__${d}`
|
|
216
|
-
) : o = /* @__PURE__ */ i("button", { type: "button", ...h, children: r }), /* @__PURE__ */ i("li", { children: o }, d);
|
|
217
|
-
}) }),
|
|
218
|
-
/* @__PURE__ */ i(
|
|
219
|
-
"button",
|
|
220
|
-
{
|
|
221
|
-
className: u["pages-navigator-container__previous-next-btn"],
|
|
222
|
-
disabled: c,
|
|
223
|
-
onClick: () => e.onPageChange(e.currentPage + 1),
|
|
224
|
-
type: "button",
|
|
225
|
-
children: _`next`
|
|
226
|
-
},
|
|
227
|
-
"page__next"
|
|
228
|
-
)
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
)
|
|
232
|
-
] });
|
|
233
|
-
};
|
|
234
|
-
export {
|
|
235
|
-
U as Pagination,
|
|
236
|
-
q as paginationDefaultTranslations
|
|
237
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PaginationProps } from '../../main';
|
|
2
|
-
import { StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
declare const meta: {
|
|
5
|
-
title: string;
|
|
6
|
-
component: ({ perPageOptions, language, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
tags: string[];
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof meta>;
|
|
14
|
-
export declare const Simple: Story;
|
|
15
|
-
export declare const WithCustomPerPageOptions: Story;
|
|
16
|
-
export declare const WithLanguage: Story;
|
|
17
|
-
export declare const WithCustomTexts: Story;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
export type SelectOptionProps = {
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
value: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
className?: string;
|
|
9
|
-
'data-testid'?: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const SelectOption: (props: SelectOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export type SelectProps = {
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
prefix?: string;
|
|
17
|
-
className?: string;
|
|
18
|
-
value?: string;
|
|
19
|
-
'data-testid'?: string;
|
|
20
|
-
onChange?: (value: string | null, event?: React.SyntheticEvent<Element, Event> | null) => void;
|
|
21
|
-
};
|
|
22
|
-
declare const Select: {
|
|
23
|
-
(props: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
Option: (props: SelectOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
};
|
|
26
|
-
export { Select };
|