@pismo/marola 0.0.1-alpha.18 → 0.0.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +5 -17
  2. package/dist/Button-REznN-RP.js +1139 -0
  3. package/dist/Dialog.module-BO0mdB7d.js +15 -0
  4. package/dist/assets/CallToActionButton.css +1 -0
  5. package/dist/assets/Dialog.css +1 -1
  6. package/dist/assets/LoadingSpinner.css +1 -1
  7. package/dist/assets/Typography.css +1 -1
  8. package/dist/assets/main.css +1 -0
  9. package/dist/components/CallToActionButton/CallToActionButton.d.ts +23 -0
  10. package/dist/components/CallToActionButton/CallToActionButton.js +57 -0
  11. package/dist/components/Dialog/Actions.js +1 -1
  12. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  13. package/dist/components/Dialog/Backdrop.js +9 -2
  14. package/dist/components/Dialog/CloseIconButton.js +10 -11
  15. package/dist/components/Dialog/Dialog.d.ts +4 -5
  16. package/dist/components/Dialog/Dialog.js +20103 -445
  17. package/dist/components/Dialog/Title.js +7 -22
  18. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +0 -2
  19. package/dist/components/LoadingSpinner/LoadingSpinner.js +13 -12
  20. package/dist/components/Typography/Typography.d.ts +6 -17
  21. package/dist/components/Typography/Typography.js +64 -85
  22. package/dist/main.d.ts +3 -25
  23. package/dist/main.js +15 -62
  24. package/dist/types/helpers.d.ts +7 -14
  25. package/package.json +9 -51
  26. package/src/playground/Playground.tsx +58 -0
  27. package/dist/Button-2b1peDFT.js +0 -130
  28. package/dist/ClickAwayListener-BSW-Nd-y.js +0 -107
  29. package/dist/Dialog.module-B8COssqi.js +0 -15
  30. package/dist/Popup-B6ZSGIEI.js +0 -1248
  31. package/dist/Portal-DIeBsWdL.js +0 -73
  32. package/dist/SelectButton-pciwIWcj.js +0 -46
  33. package/dist/Tabs.module-jkH1Qjn7.js +0 -22
  34. package/dist/assets/Advice.css +0 -1
  35. package/dist/assets/Button.css +0 -1
  36. package/dist/assets/Checkbox.css +0 -1
  37. package/dist/assets/Chip.css +0 -1
  38. package/dist/assets/IconButton.css +0 -1
  39. package/dist/assets/Input.css +0 -1
  40. package/dist/assets/InputSearch.css +0 -1
  41. package/dist/assets/PageHeader.css +0 -1
  42. package/dist/assets/Pagination.css +0 -1
  43. package/dist/assets/SelectButton.css +0 -1
  44. package/dist/assets/Skeleton.css +0 -1
  45. package/dist/assets/Snackbar.css +0 -1
  46. package/dist/assets/SortTooltip.css +0 -1
  47. package/dist/assets/Stepper.css +0 -1
  48. package/dist/assets/Table.css +0 -1
  49. package/dist/assets/Tabs.css +0 -1
  50. package/dist/assets/TextDisplay.css +0 -1
  51. package/dist/assets/Toggle.css +0 -1
  52. package/dist/assets/Tooltip.css +0 -1
  53. package/dist/combineHooksSlotProps-DVjg9PRh.js +0 -80
  54. package/dist/components/Advice/Advice.d.ts +0 -28
  55. package/dist/components/Advice/Advice.js +0 -25
  56. package/dist/components/Advice/Advice.stories.d.ts +0 -16
  57. package/dist/components/Button/Button.d.ts +0 -32
  58. package/dist/components/Button/Button.js +0 -94
  59. package/dist/components/Button/Button.stories.d.ts +0 -62
  60. package/dist/components/Checkbox/Checkbox.d.ts +0 -34
  61. package/dist/components/Checkbox/Checkbox.js +0 -56
  62. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -31
  63. package/dist/components/Chip/Chip.d.ts +0 -37
  64. package/dist/components/Chip/Chip.js +0 -143
  65. package/dist/components/Chip/Chip.stories.d.ts +0 -40
  66. package/dist/components/Chip/chip.test.d.ts +0 -1
  67. package/dist/components/Dialog/Dialog.stories.d.ts +0 -343
  68. package/dist/components/Icon/Icon.d.ts +0 -27
  69. package/dist/components/Icon/Icon.js +0 -116
  70. package/dist/components/Icon/Icon.stories.d.ts +0 -16
  71. package/dist/components/IconButton/Icon.stories.d.ts +0 -15
  72. package/dist/components/IconButton/IconButton.d.ts +0 -36
  73. package/dist/components/IconButton/IconButton.js +0 -70
  74. package/dist/components/Input/Input.d.ts +0 -44
  75. package/dist/components/Input/Input.js +0 -496
  76. package/dist/components/Input/Input.stories.d.ts +0 -43
  77. package/dist/components/InputSearch/InputSearch.d.ts +0 -9
  78. package/dist/components/InputSearch/InputSearch.js +0 -34
  79. package/dist/components/InputSearch/InputSearch.stories.d.ts +0 -39
  80. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +0 -14
  81. package/dist/components/PageHeader/PageHeader.d.ts +0 -36
  82. package/dist/components/PageHeader/PageHeader.js +0 -51
  83. package/dist/components/PageHeader/PageHeader.stories.d.ts +0 -43
  84. package/dist/components/Pagination/Pagination.d.ts +0 -55
  85. package/dist/components/Pagination/Pagination.js +0 -222
  86. package/dist/components/Pagination/Pagination.stories.d.ts +0 -17
  87. package/dist/components/Select/Select.d.ts +0 -26
  88. package/dist/components/Select/Select.js +0 -857
  89. package/dist/components/Select/Select.stories.d.ts +0 -22
  90. package/dist/components/Select/SelectButton.d.ts +0 -12
  91. package/dist/components/Select/SelectButton.js +0 -8
  92. package/dist/components/Skeleton/Skeleton.d.ts +0 -25
  93. package/dist/components/Skeleton/Skeleton.js +0 -23
  94. package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -14
  95. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +0 -14
  96. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +0 -16
  97. package/dist/components/Snackbar/Snackbar.d.ts +0 -25
  98. package/dist/components/Snackbar/Snackbar.js +0 -622
  99. package/dist/components/Snackbar/Snackbar.stories.d.ts +0 -318
  100. package/dist/components/SortTooltip/SortTooltip.d.ts +0 -28
  101. package/dist/components/SortTooltip/SortTooltip.js +0 -78
  102. package/dist/components/Stepper/Stepper.d.ts +0 -26
  103. package/dist/components/Stepper/Stepper.js +0 -33
  104. package/dist/components/Stepper/Stepper.stories.d.ts +0 -16
  105. package/dist/components/Table/Table.d.ts +0 -39
  106. package/dist/components/Table/Table.js +0 -120
  107. package/dist/components/Table/TableContext.d.ts +0 -19
  108. package/dist/components/Table/TableContext.js +0 -21
  109. package/dist/components/Tabs/Tab.d.ts +0 -14
  110. package/dist/components/Tabs/Tab.js +0 -181
  111. package/dist/components/Tabs/Tab.stories.d.ts +0 -15
  112. package/dist/components/Tabs/TabPanel.d.ts +0 -12
  113. package/dist/components/Tabs/TabPanel.js +0 -118
  114. package/dist/components/Tabs/TabPanel.stories.d.ts +0 -14
  115. package/dist/components/Tabs/Tabs.d.ts +0 -15
  116. package/dist/components/Tabs/Tabs.js +0 -401
  117. package/dist/components/Tabs/Tabs.stories.d.ts +0 -14
  118. package/dist/components/TextDisplay/TextDisplay.d.ts +0 -23
  119. package/dist/components/TextDisplay/TextDisplay.js +0 -37
  120. package/dist/components/TextDisplay/TextDisplay.stories.d.ts +0 -13
  121. package/dist/components/TextDisplay/textDisplay.test.d.ts +0 -1
  122. package/dist/components/Toggle/Toggle.d.ts +0 -11
  123. package/dist/components/Toggle/Toggle.js +0 -251
  124. package/dist/components/Toggle/Toggle.stories.d.ts +0 -21
  125. package/dist/components/Tooltip/Tooltip.d.ts +0 -29
  126. package/dist/components/Tooltip/Tooltip.js +0 -139
  127. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -33
  128. package/dist/components/Typography/Typography.stories.d.ts +0 -32
  129. package/dist/components/Typography/typography.test.d.ts +0 -1
  130. package/dist/index-CH45lKw7.js +0 -840
  131. package/dist/index-CjW42-M-.js +0 -19584
  132. package/dist/marola.css +0 -1
  133. package/dist/test-utils/assertStyles.d.ts +0 -1
  134. package/dist/test-utils/assertStyles.js +0 -11
  135. package/dist/useButton-DNk3wrQp.js +0 -105
  136. package/dist/useCompoundItem-D1iRfg8D.js +0 -84
  137. package/dist/useControlled-CCMYYdCM.js +0 -31
  138. package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
  139. package/dist/useEventCallback-xTG9piMa.js +0 -45
  140. package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
  141. package/dist/useList-B0hog_3-.js +0 -436
  142. package/dist/useTimeout-DxF9kiZL.js +0 -36
  143. package/dist/utils/styleStrings.d.ts +0 -6
  144. package/dist/utils/styleStrings.js +0 -10
  145. package/dist/utils/styleStrings.test.d.ts +0 -1
@@ -1,34 +0,0 @@
1
- import '../../assets/InputSearch.css';
2
- import { jsx as e } from "react/jsx-runtime";
3
- import { c as m } from "../../clsx-DB4S2d7J.js";
4
- import { Icon as p } from "../Icon/Icon.js";
5
- import { Input as u } from "../Input/Input.js";
6
- const l = "_inputSearch_114e1_1", h = {
7
- inputSearch: l
8
- };
9
- let n;
10
- const d = ({
11
- classNameWrapper: r,
12
- triggerDelay: o = 500,
13
- value: c,
14
- onChange: i = () => {
15
- },
16
- ...a
17
- }) => {
18
- const s = (t) => {
19
- n && clearTimeout(n), n = setTimeout(() => i(t), o);
20
- };
21
- return /* @__PURE__ */ e("div", { className: m(h.inputSearch, r), children: /* @__PURE__ */ e(
22
- u,
23
- {
24
- type: "search",
25
- ...a,
26
- leftIcon: /* @__PURE__ */ e(p, { icon: "magnifying-glass" }),
27
- defaultValue: c,
28
- onChange: (t) => s(t)
29
- }
30
- ) });
31
- };
32
- export {
33
- d as InputSearch
34
- };
@@ -1,39 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
-
3
- declare const meta: {
4
- title: string;
5
- component: ({ classNameWrapper, triggerDelay, value, onChange, ...rest }: {
6
- triggerDelay?: number | undefined;
7
- } & import('react').InputHTMLAttributes<HTMLInputElement> & {
8
- label?: string | undefined;
9
- infoMessage?: string | undefined;
10
- errorMessage?: string | undefined;
11
- leftIcon?: import('react').ReactNode;
12
- rightIcon?: import('react').ReactNode;
13
- type?: "search" | "text" | "password" | undefined;
14
- hideCharsCounter?: boolean | undefined;
15
- classNameWrapper?: string | undefined;
16
- classNameLabel?: string | undefined;
17
- classNameInput?: string | undefined;
18
- classNameInfoMessage?: string | undefined;
19
- classNameErrorMessage?: string | undefined;
20
- classNameCharsCounter?: string | undefined;
21
- 'data-testid-wrapper'?: string | undefined;
22
- 'data-testid-label'?: string | undefined;
23
- 'data-testid-input'?: string | undefined;
24
- 'data-testid-infoMessage'?: string | undefined;
25
- 'data-testid-errorMessage'?: string | undefined;
26
- 'data-testid-charsCounter'?: string | undefined;
27
- }) => import("react/jsx-runtime").JSX.Element;
28
- tags: string[];
29
- parameters: {
30
- layout: string;
31
- };
32
- };
33
- export default meta;
34
- type Story = StoryObj<typeof meta>;
35
- export declare const Simple: Story;
36
- export declare const WithLabel: Story;
37
- export declare const WithCustomDelay: Story;
38
- export declare const WithPlaceholder: Story;
39
- export declare const Disabled: Story;
@@ -1,14 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
-
3
- declare const meta: {
4
- title: string;
5
- component: ({ invert, classNames }: import('./LoadingSpinner').LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
6
- tags: string[];
7
- decorators: ((Story: import('@storybook/types').PartialStoryFn<import('@storybook/react').ReactRenderer, {
8
- invert?: boolean | undefined;
9
- classNames?: string | undefined;
10
- }>) => import("react/jsx-runtime").JSX.Element)[];
11
- };
12
- export default meta;
13
- type Story = StoryObj<typeof meta>;
14
- export declare const Simple: Story;
@@ -1,36 +0,0 @@
1
- import { RequireAllOrNone } from '../../types/helpers';
2
- import { ReactNode } from 'react';
3
-
4
- type PageHeaderCommonProps = {
5
- /** Title text */
6
- title: string;
7
- /** Subtitle text */
8
- subtitle?: string;
9
- /** Back link text */
10
- backLinkText?: string;
11
- /** Callback called when `back link` is clicked */
12
- onBackLinkClick?: () => void;
13
- /** Element to be rendered on the right slot of the component */
14
- rightChildren?: ReactNode;
15
- /** Element to be rendered on the bottom slot of the component */
16
- bottomChildren?: ReactNode;
17
- /** CSS classes to be applied on the container element */
18
- classNameWrapper?: string;
19
- /** CSS classes to be applied on the back link element */
20
- classNameBackLink?: string;
21
- /** CSS classes to be applied on the title element */
22
- classNameTitle?: string;
23
- /** CSS classes to be applied on the subtitle element */
24
- classNameSubtitle?: string;
25
- /** Id to be applied as `data-testid` on the container element */
26
- 'data-testid-wrapper'?: string;
27
- /** Id to be applied as `data-testid` on the back link element */
28
- 'data-testid-backLink'?: string;
29
- /** Id to be applied as `data-testid` on the title element */
30
- 'data-testid-title'?: string;
31
- /** Id to be applied as `data-testid` on the subtitle element */
32
- 'data-testid-subtitle'?: string;
33
- };
34
- type PageHeaderProps = RequireAllOrNone<PageHeaderCommonProps, 'backLinkText' | 'onBackLinkClick'>;
35
- export declare const PageHeader: ({ title, subtitle, backLinkText, onBackLinkClick, rightChildren, bottomChildren, classNameWrapper, classNameBackLink, classNameTitle, classNameSubtitle, "data-testid-wrapper": wrapperTestId, "data-testid-backLink": backLinkTestId, "data-testid-title": titleTestId, "data-testid-subtitle": subtitleTestId, ...rest }: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
36
- export {};
@@ -1,51 +0,0 @@
1
- import '../../assets/PageHeader.css';
2
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
3
- import { c as n } from "../../clsx-DB4S2d7J.js";
4
- import * as _ from "react";
5
- const w = (c) => /* @__PURE__ */ _.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", "data-waves-icon": "fa/solid/arrow-left", fill: "currentColor", color: "currentColor", width: "1em", height: "1em", style: {
6
- fill: "currentcolor",
7
- color: "currentcolor",
8
- width: "1em",
9
- height: "1em"
10
- }, ...c }, /* @__PURE__ */ _.createElement("path", { d: "M447.1 256C447.1 273.7 433.7 288 416 288H109.3l105.4 105.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448s-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L109.3 224H416C433.7 224 447.1 238.3 447.1 256z" })), b = "_title_fxc86_47", N = "_subtitle_fxc86_48", e = {
11
- "page-header": "_page-header_fxc86_1",
12
- "page-header__top-content": "_page-header__top-content_fxc86_10",
13
- "page-header__main-content": "_page-header__main-content_fxc86_13",
14
- "page-header__bottom-content": "_page-header__bottom-content_fxc86_13",
15
- "page-header__main-left-content": "_page-header__main-left-content_fxc86_41",
16
- title: b,
17
- subtitle: N,
18
- "page-header__main-right-content": "_page-header__main-right-content_fxc86_65"
19
- }, H = ({
20
- title: c,
21
- subtitle: d,
22
- backLinkText: r,
23
- onBackLinkClick: s,
24
- rightChildren: i,
25
- bottomChildren: o,
26
- classNameWrapper: l,
27
- classNameBackLink: h,
28
- classNameTitle: m,
29
- classNameSubtitle: p,
30
- "data-testid-wrapper": g,
31
- "data-testid-backLink": f,
32
- "data-testid-title": x,
33
- "data-testid-subtitle": u,
34
- ...v
35
- }) => /* @__PURE__ */ a("div", { className: n([e["page-header"], l]), "data-testid": g, ...v, children: [
36
- r && /* @__PURE__ */ t("div", { className: e["page-header__top-content"], children: /* @__PURE__ */ a("button", { type: "button", onClick: s, className: h, "data-testid": f, children: [
37
- /* @__PURE__ */ t(w, { fontSize: 16 }),
38
- r
39
- ] }) }),
40
- /* @__PURE__ */ a("div", { className: e["page-header__main-content"], children: [
41
- /* @__PURE__ */ a("div", { className: e["page-header__main-left-content"], children: [
42
- /* @__PURE__ */ t("h1", { className: n(e.title, m), "data-testid": x, children: c }),
43
- /* @__PURE__ */ t("h2", { className: n(e.subtitle, p), "data-testid": u, children: d })
44
- ] }),
45
- i && /* @__PURE__ */ t("div", { className: e["page-header__main-right-content"], children: i })
46
- ] }),
47
- o && /* @__PURE__ */ t("div", { className: e["page-header__bottom-content"], children: o })
48
- ] });
49
- export {
50
- H as PageHeader
51
- };
@@ -1,43 +0,0 @@
1
- import { StoryObj } from '@storybook/react';
2
-
3
- declare const meta: {
4
- title: string;
5
- component: ({ title, subtitle, backLinkText, onBackLinkClick, rightChildren, bottomChildren, classNameWrapper, classNameBackLink, classNameTitle, classNameSubtitle, "data-testid-wrapper": wrapperTestId, "data-testid-backLink": backLinkTestId, "data-testid-title": titleTestId, "data-testid-subtitle": subtitleTestId, ...rest }: (Required<Pick<{
6
- title: string;
7
- subtitle?: string | undefined;
8
- backLinkText?: string | undefined;
9
- onBackLinkClick?: (() => void) | undefined;
10
- rightChildren?: import('react').ReactNode;
11
- bottomChildren?: import('react').ReactNode;
12
- classNameWrapper?: string | undefined;
13
- classNameBackLink?: string | undefined;
14
- classNameTitle?: string | undefined;
15
- classNameSubtitle?: string | undefined;
16
- 'data-testid-wrapper'?: string | undefined;
17
- 'data-testid-backLink'?: string | undefined;
18
- 'data-testid-title'?: string | undefined;
19
- 'data-testid-subtitle'?: string | undefined;
20
- }, "backLinkText" | "onBackLinkClick">> | Partial<Record<"backLinkText" | "onBackLinkClick", never>>) & Omit<{
21
- title: string;
22
- subtitle?: string | undefined;
23
- backLinkText?: string | undefined;
24
- onBackLinkClick?: (() => void) | undefined;
25
- rightChildren?: import('react').ReactNode;
26
- bottomChildren?: import('react').ReactNode;
27
- classNameWrapper?: string | undefined;
28
- classNameBackLink?: string | undefined;
29
- classNameTitle?: string | undefined;
30
- classNameSubtitle?: string | undefined;
31
- 'data-testid-wrapper'?: string | undefined;
32
- 'data-testid-backLink'?: string | undefined;
33
- 'data-testid-title'?: string | undefined;
34
- 'data-testid-subtitle'?: string | undefined;
35
- }, "backLinkText" | "onBackLinkClick">) => import("react/jsx-runtime").JSX.Element;
36
- tags: string[];
37
- };
38
- export default meta;
39
- type Story = StoryObj<typeof meta>;
40
- export declare const Simple: Story;
41
- export declare const WithBackLink: Story;
42
- export declare const WithRightChildren: Story;
43
- 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,222 +0,0 @@
1
- import '../../assets/Pagination.css';
2
- import { jsxs as m, jsx as o, Fragment as M } from "react/jsx-runtime";
3
- import { c as p } from "../../clsx-DB4S2d7J.js";
4
- import { Select as k } 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(g = {}) {
9
- const {
10
- boundaryCount: a = 1,
11
- componentName: e = "usePagination",
12
- count: s = 1,
13
- defaultPage: v = 1,
14
- disabled: _ = !1,
15
- hideNextButton: f = !1,
16
- hidePrevButton: u = !1,
17
- onChange: h,
18
- page: n,
19
- showFirstButton: r = !1,
20
- showLastButton: x = !1,
21
- siblingCount: d = 1
22
- } = g, b = A(g, R), [i, S] = $({
23
- controlled: n,
24
- default: v,
25
- name: e,
26
- state: "page"
27
- }), N = (t, c) => {
28
- n || S(c), h && h(t, c);
29
- }, C = (t, c) => {
30
- const F = c - t + 1;
31
- return Array.from({
32
- length: F
33
- }, (z, I) => t + I);
34
- }, L = C(1, Math.min(a, s)), P = C(Math.max(s - a + 1, a + 1), s), y = Math.max(
35
- Math.min(
36
- // Natural start
37
- i - d,
38
- // Lower boundary when page is high
39
- s - a - d * 2 - 1
40
- ),
41
- // Greater than startPages
42
- a + 2
43
- ), B = Math.min(
44
- Math.max(
45
- // Natural end
46
- i + d,
47
- // Upper boundary when page is low
48
- a + d * 2 + 2
49
- ),
50
- // Less than endPages
51
- P.length > 0 ? P[0] - 2 : s - 1
52
- ), j = [
53
- ...r ? ["first"] : [],
54
- ...u ? [] : ["previous"],
55
- ...L,
56
- // Start ellipsis
57
- // eslint-disable-next-line no-nested-ternary
58
- ...y > a + 2 ? ["start-ellipsis"] : a + 1 < s - a ? [a + 1] : [],
59
- // Sibling pages
60
- ...C(y, B),
61
- // End ellipsis
62
- // eslint-disable-next-line no-nested-ternary
63
- ...B < s - a - 1 ? ["end-ellipsis"] : s - a > a ? [s - a] : [],
64
- ...P,
65
- ...f ? [] : ["next"],
66
- ...x ? ["last"] : []
67
- ], w = (t) => {
68
- switch (t) {
69
- case "first":
70
- return 1;
71
- case "previous":
72
- return i - 1;
73
- case "next":
74
- return i + 1;
75
- case "last":
76
- return s;
77
- default:
78
- return null;
79
- }
80
- }, D = j.map((t) => typeof t == "number" ? {
81
- onClick: (c) => {
82
- N(c, t);
83
- },
84
- type: "page",
85
- page: t,
86
- selected: t === i,
87
- disabled: _,
88
- "aria-current": t === i ? "true" : void 0
89
- } : {
90
- onClick: (c) => {
91
- N(c, w(t));
92
- },
93
- type: t,
94
- page: w(t),
95
- selected: !1,
96
- disabled: _ || t.indexOf("ellipsis") === -1 && (t === "next" || t === "last" ? i >= s : i <= 1)
97
- });
98
- return E({
99
- items: D
100
- }, b);
101
- }
102
- const W = "_pagination_n3y7g_1", l = {
103
- pagination: W,
104
- "per-page-container": "_per-page-container_n3y7g_8",
105
- "per-page-container__select": "_per-page-container__select_n3y7g_17",
106
- "pages-navigator-container": "_pages-navigator-container_n3y7g_22",
107
- "pages-navigator-container__label": "_pages-navigator-container__label_n3y7g_37",
108
- "page-number__btn": "_page-number__btn_n3y7g_37",
109
- "pages-navigator-container__previous-next-btn": "_pages-navigator-container__previous-next-btn_n3y7g_50",
110
- "page-number__btn--selected": "_page-number__btn--selected_n3y7g_75"
111
- }, q = {
112
- pt: {
113
- showing: "Exibindo",
114
- of: "de",
115
- results: "resultados",
116
- previous: "Anterior",
117
- next: "Próximo"
118
- },
119
- en: {
120
- showing: "Showing",
121
- of: "of",
122
- results: "results",
123
- previous: "Previous",
124
- next: "Next"
125
- }
126
- }, U = ({ perPageOptions: g = [5, 10, 25, 50, 100], language: a = "en", ...e }) => {
127
- const s = Math.ceil(e.totalItems / e.perPage), v = e.currentPage <= 1, _ = e.currentPage >= s, f = e.t || q[a], u = (n) => f[n], { items: h } = T({
128
- count: s,
129
- hideNextButton: !0,
130
- hidePrevButton: !0,
131
- page: e.currentPage,
132
- siblingCount: 1,
133
- boundaryCount: 2,
134
- onChange: (n, r) => e.onPageChange(r)
135
- });
136
- return /* @__PURE__ */ m("div", { className: p(l.pagination, e.className), "data-testid": e["data-testid"], children: [
137
- /* @__PURE__ */ o(
138
- "div",
139
- {
140
- className: p(l["per-page-container"], e.classNamePerPage),
141
- "data-testid": e["data-testid-per-page"],
142
- children: g && /* @__PURE__ */ m(M, { children: [
143
- /* @__PURE__ */ o("span", { children: u`showing` }),
144
- /* @__PURE__ */ o(
145
- k,
146
- {
147
- className: l["per-page-container__select"],
148
- value: String(e.perPage),
149
- onChange: (n) => e.onRowsPerPageChange(Number(n)),
150
- children: g == null ? void 0 : g.map((n) => {
151
- const r = typeof n == "number";
152
- return /* @__PURE__ */ o(
153
- k.Option,
154
- {
155
- value: String(r ? n : n.value),
156
- children: r ? n : n.label
157
- },
158
- `per-page__${r ? n : n.value}`
159
- );
160
- })
161
- }
162
- ),
163
- /* @__PURE__ */ m("span", { children: [
164
- u`of`,
165
- " ",
166
- /* @__PURE__ */ o("strong", { children: e.totalItems }),
167
- " ",
168
- u`results`
169
- ] })
170
- ] })
171
- }
172
- ),
173
- /* @__PURE__ */ m(
174
- "div",
175
- {
176
- className: p(l["pages-navigator-container"], e.classNamePagesNav),
177
- "data-testid": e["data-testid-pages-nav"],
178
- children: [
179
- /* @__PURE__ */ o(
180
- "button",
181
- {
182
- className: l["pages-navigator-container__previous-next-btn"],
183
- disabled: v,
184
- onClick: () => e.onPageChange(e.currentPage - 1),
185
- type: "button",
186
- children: u`previous`
187
- },
188
- "page__previous"
189
- ),
190
- /* @__PURE__ */ o("ul", { children: h.map(({ page: n, type: r, selected: x, ...d }, b) => {
191
- let i = /* @__PURE__ */ o(M, {});
192
- return r === "start-ellipsis" || r === "end-ellipsis" ? i = /* @__PURE__ */ o("span", { className: l["pages-navigator-container__label"], children: "..." }) : r === "page" ? i = /* @__PURE__ */ o(
193
- "button",
194
- {
195
- className: p(l["page-number__btn"], x && l["page-number__btn--selected"]),
196
- onClick: () => e.onPageChange(n || 0),
197
- type: "button",
198
- children: n
199
- },
200
- `page__${b}`
201
- ) : i = /* @__PURE__ */ o("button", { type: "button", ...d, children: r }), /* @__PURE__ */ o("li", { children: i }, b);
202
- }) }),
203
- /* @__PURE__ */ o(
204
- "button",
205
- {
206
- className: l["pages-navigator-container__previous-next-btn"],
207
- disabled: _,
208
- onClick: () => e.onPageChange(e.currentPage + 1),
209
- type: "button",
210
- children: u`next`
211
- },
212
- "page__next"
213
- )
214
- ]
215
- }
216
- )
217
- ] });
218
- };
219
- export {
220
- U as Pagination,
221
- q as paginationDefaultTranslations
222
- };
@@ -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 };