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

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 (153) hide show
  1. package/README.md +17 -5
  2. package/dist/Button-2b1peDFT.js +130 -0
  3. package/dist/ClickAwayListener-BSW-Nd-y.js +107 -0
  4. package/dist/Dialog.module-DFEmFdYT.js +30 -0
  5. package/dist/Popup-B6ZSGIEI.js +1248 -0
  6. package/dist/Portal-DIeBsWdL.js +73 -0
  7. package/dist/SelectButton-C8JQKaf4.js +61 -0
  8. package/dist/Tabs.module-jkH1Qjn7.js +22 -0
  9. package/dist/assets/Advice.css +1 -0
  10. package/dist/assets/Button.css +1 -0
  11. package/dist/assets/Checkbox.css +1 -0
  12. package/dist/assets/Chip.css +1 -0
  13. package/dist/assets/Dialog.css +1 -1
  14. package/dist/assets/IconButton.css +1 -0
  15. package/dist/assets/Input.css +1 -0
  16. package/dist/assets/InputSearch.css +1 -0
  17. package/dist/assets/LoadingSpinner.css +1 -1
  18. package/dist/assets/PageHeader.css +1 -0
  19. package/dist/assets/Pagination.css +1 -0
  20. package/dist/assets/SelectButton.css +1 -0
  21. package/dist/assets/Skeleton.css +1 -0
  22. package/dist/assets/Snackbar.css +1 -0
  23. package/dist/assets/SortTooltip.css +1 -0
  24. package/dist/assets/Stepper.css +1 -0
  25. package/dist/assets/Table.css +1 -0
  26. package/dist/assets/Tabs.css +1 -0
  27. package/dist/assets/TextDisplay.css +1 -0
  28. package/dist/assets/Toggle.css +1 -0
  29. package/dist/assets/Tooltip.css +1 -0
  30. package/dist/assets/Typography.css +1 -1
  31. package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
  32. package/dist/components/Advice/Advice.d.ts +28 -0
  33. package/dist/components/Advice/Advice.js +40 -0
  34. package/dist/components/Advice/Advice.stories.d.ts +16 -0
  35. package/dist/components/Button/Button.d.ts +32 -0
  36. package/dist/components/Button/Button.js +65 -0
  37. package/dist/components/Button/Button.stories.d.ts +62 -0
  38. package/dist/components/Checkbox/Checkbox.d.ts +34 -0
  39. package/dist/components/Checkbox/Checkbox.js +71 -0
  40. package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
  41. package/dist/components/Chip/Chip.d.ts +37 -0
  42. package/dist/components/Chip/Chip.js +113 -0
  43. package/dist/components/Chip/Chip.stories.d.ts +40 -0
  44. package/dist/components/Chip/chip.test.d.ts +1 -0
  45. package/dist/components/Dialog/Actions.js +1 -1
  46. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  47. package/dist/components/Dialog/Backdrop.js +2 -9
  48. package/dist/components/Dialog/CloseIconButton.js +11 -10
  49. package/dist/components/Dialog/Dialog.d.ts +6 -5
  50. package/dist/components/Dialog/Dialog.js +419 -20077
  51. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  52. package/dist/components/Dialog/{Title.d.ts → DialogTitle.d.ts} +3 -3
  53. package/dist/components/Dialog/DialogTitle.js +29 -0
  54. package/dist/components/Icon/Icon.d.ts +27 -0
  55. package/dist/components/Icon/Icon.js +122 -0
  56. package/dist/components/Icon/Icon.stories.d.ts +16 -0
  57. package/dist/components/IconButton/Icon.stories.d.ts +15 -0
  58. package/dist/components/IconButton/IconButton.d.ts +36 -0
  59. package/dist/components/IconButton/IconButton.js +40 -0
  60. package/dist/components/Input/Input.d.ts +44 -0
  61. package/dist/components/Input/Input.js +508 -0
  62. package/dist/components/Input/Input.stories.d.ts +43 -0
  63. package/dist/components/InputSearch/InputSearch.d.ts +9 -0
  64. package/dist/components/InputSearch/InputSearch.js +34 -0
  65. package/dist/components/InputSearch/InputSearch.stories.d.ts +39 -0
  66. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  67. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  68. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  69. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  70. package/dist/components/PageHeader/PageHeader.js +66 -0
  71. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  72. package/dist/components/Pagination/Pagination.d.ts +55 -0
  73. package/dist/components/Pagination/Pagination.js +236 -0
  74. package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
  75. package/dist/components/Select/Select.d.ts +26 -0
  76. package/dist/components/Select/Select.js +857 -0
  77. package/dist/components/Select/Select.stories.d.ts +22 -0
  78. package/dist/components/Select/SelectButton.d.ts +12 -0
  79. package/dist/components/Select/SelectButton.js +8 -0
  80. package/dist/components/Skeleton/Skeleton.d.ts +25 -0
  81. package/dist/components/Skeleton/Skeleton.js +23 -0
  82. package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
  83. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
  84. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
  85. package/dist/components/Snackbar/Snackbar.d.ts +25 -0
  86. package/dist/components/Snackbar/Snackbar.js +637 -0
  87. package/dist/components/Snackbar/Snackbar.stories.d.ts +318 -0
  88. package/dist/components/SortTooltip/SortTooltip.d.ts +28 -0
  89. package/dist/components/SortTooltip/SortTooltip.js +93 -0
  90. package/dist/components/Stepper/Stepper.d.ts +26 -0
  91. package/dist/components/Stepper/Stepper.js +48 -0
  92. package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
  93. package/dist/components/Table/Table.d.ts +56 -0
  94. package/dist/components/Table/Table.js +137 -0
  95. package/dist/components/Table/Table.stories.d.ts +29 -0
  96. package/dist/components/Table/TableContext.d.ts +19 -0
  97. package/dist/components/Table/TableContext.js +21 -0
  98. package/dist/components/Table/_Table.TBody.stories.d.ts +14 -0
  99. package/dist/components/Table/_Table.THead.stories.d.ts +14 -0
  100. package/dist/components/Table/_Table.Td.stories.d.ts +16 -0
  101. package/dist/components/Table/_Table.Th.stories.d.ts +15 -0
  102. package/dist/components/Table/_Table.Tr.stories.d.ts +15 -0
  103. package/dist/components/Tabs/Tab.d.ts +14 -0
  104. package/dist/components/Tabs/Tab.js +181 -0
  105. package/dist/components/Tabs/Tab.stories.d.ts +15 -0
  106. package/dist/components/Tabs/TabPanel.d.ts +12 -0
  107. package/dist/components/Tabs/TabPanel.js +118 -0
  108. package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
  109. package/dist/components/Tabs/Tabs.d.ts +15 -0
  110. package/dist/components/Tabs/Tabs.js +401 -0
  111. package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
  112. package/dist/components/TextDisplay/TextDisplay.d.ts +23 -0
  113. package/dist/components/TextDisplay/TextDisplay.js +37 -0
  114. package/dist/components/TextDisplay/TextDisplay.stories.d.ts +13 -0
  115. package/dist/components/TextDisplay/textDisplay.test.d.ts +1 -0
  116. package/dist/components/Toggle/Toggle.d.ts +11 -0
  117. package/dist/components/Toggle/Toggle.js +266 -0
  118. package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
  119. package/dist/components/Tooltip/Tooltip.d.ts +29 -0
  120. package/dist/components/Tooltip/Tooltip.js +139 -0
  121. package/dist/components/Tooltip/Tooltip.stories.d.ts +33 -0
  122. package/dist/components/Typography/Typography.d.ts +17 -6
  123. package/dist/components/Typography/Typography.js +56 -65
  124. package/dist/components/Typography/Typography.stories.d.ts +32 -0
  125. package/dist/components/Typography/typography.test.d.ts +1 -0
  126. package/dist/index-CH45lKw7.js +840 -0
  127. package/dist/index-CjW42-M-.js +19584 -0
  128. package/dist/main.d.ts +25 -3
  129. package/dist/main.js +67 -15
  130. package/dist/marola.css +1 -0
  131. package/dist/test-utils/assertStyles.d.ts +1 -0
  132. package/dist/test-utils/assertStyles.js +11 -0
  133. package/dist/types/helpers.d.ts +14 -7
  134. package/dist/useButton-DNk3wrQp.js +105 -0
  135. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  136. package/dist/useControlled-CCMYYdCM.js +31 -0
  137. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  138. package/dist/useEventCallback-xTG9piMa.js +45 -0
  139. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  140. package/dist/useList-B0hog_3-.js +436 -0
  141. package/dist/useTimeout-DxF9kiZL.js +36 -0
  142. package/dist/utils/styleStrings.d.ts +6 -0
  143. package/dist/utils/styleStrings.js +10 -0
  144. package/dist/utils/styleStrings.test.d.ts +1 -0
  145. package/package.json +51 -9
  146. package/dist/Button-REznN-RP.js +0 -1139
  147. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  148. package/dist/assets/CallToActionButton.css +0 -1
  149. package/dist/assets/main.css +0 -1
  150. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
  151. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  152. package/dist/components/Dialog/Title.js +0 -14
  153. package/src/playground/Playground.tsx +0 -58
@@ -0,0 +1,34 @@
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
+ };
@@ -0,0 +1,39 @@
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,5 +1,7 @@
1
1
  export interface LoadingSpinnerProps {
2
+ /** Whether to invert colours or not */
2
3
  invert?: boolean;
4
+ /** Space separated list of CSS classes to apply */
3
5
  classNames?: string;
4
6
  }
5
7
  export declare const LoadingSpinner: ({ invert, classNames }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,16 @@
1
1
  import '../../assets/LoadingSpinner.css';
2
- import { jsxs as o, jsx as s } from "react/jsx-runtime";
3
- import { useMemo as e } from "react";
2
+ import { jsxs as e, jsx as s } from "react/jsx-runtime";
3
+ import { useMemo as o } from "react";
4
4
  import { c as t } from "../../clsx-DB4S2d7J.js";
5
5
  const n = {
6
- "ls-ring": "_ls-ring_19dsy_1",
7
- "ls-ring--invert": "_ls-ring--invert_19dsy_34"
8
- }, c = ({ invert: i = !1, classNames: r }) => {
9
- const l = e(() => t(
10
- [n["ls-ring"]],
11
- { [n["ls-ring--invert"]]: i },
12
- r
13
- ), [r, i]);
14
- return /* @__PURE__ */ o("div", { className: l, children: [
6
+ "ls-ring": "_ls-ring_elvjz_1",
7
+ "ls-ring--invert": "_ls-ring--invert_elvjz_34"
8
+ }, a = ({ invert: i = !1, classNames: r }) => {
9
+ const l = o(
10
+ () => t([n["ls-ring"]], { [n["ls-ring--invert"]]: i }, r),
11
+ [r, i]
12
+ );
13
+ return /* @__PURE__ */ e("div", { className: l, children: [
15
14
  /* @__PURE__ */ s("div", {}),
16
15
  /* @__PURE__ */ s("div", {}),
17
16
  /* @__PURE__ */ s("div", {}),
@@ -19,6 +18,6 @@ const n = {
19
18
  ] });
20
19
  };
21
20
  export {
22
- c as LoadingSpinner,
23
- c as default
21
+ a as LoadingSpinner,
22
+ a as default
24
23
  };
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,36 @@
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 {};
@@ -0,0 +1,66 @@
1
+ import '../../assets/PageHeader.css';
2
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
3
+ import { c as _ } from "../../clsx-DB4S2d7J.js";
4
+ import * as g from "react";
5
+ const j = (r) => /* @__PURE__ */ g.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
+ }, ...r }, /* @__PURE__ */ g.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" })), f = "_subtitle_8gwjb_43", v = "_title_8gwjb_48", e = {
11
+ "u-typography-h1": "_u-typography-h1_8gwjb_1",
12
+ "u-typography-h2": "_u-typography-h2_8gwjb_8",
13
+ "u-typography-h3": "_u-typography-h3_8gwjb_15",
14
+ "u-typography-h4": "_u-typography-h4_8gwjb_22",
15
+ "u-typography-h5": "_u-typography-h5_8gwjb_29",
16
+ "u-typography-h6": "_u-typography-h6_8gwjb_36",
17
+ "u-typography-base": "_u-typography-base_8gwjb_43",
18
+ "page-header__main-left-content": "_page-header__main-left-content_8gwjb_43",
19
+ subtitle: f,
20
+ "page-header__top-content": "_page-header__top-content_8gwjb_43",
21
+ "u-typography-base--xxl": "_u-typography-base--xxl_8gwjb_48",
22
+ title: v,
23
+ "u-typography-base--xl": "_u-typography-base--xl_8gwjb_52",
24
+ "u-typography-base--lg": "_u-typography-base--lg_8gwjb_56",
25
+ "u-typography-base--sm": "_u-typography-base--sm_8gwjb_60",
26
+ "u-typography-base--bold": "_u-typography-base--bold_8gwjb_64",
27
+ "u-typography-base--strikethrough": "_u-typography-base--strikethrough_8gwjb_67",
28
+ "u-typography-base--underlined": "_u-typography-base--underlined_8gwjb_70",
29
+ "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_8gwjb_73",
30
+ "page-header": "_page-header_8gwjb_43",
31
+ "page-header__main-content": "_page-header__main-content_8gwjb_89",
32
+ "page-header__bottom-content": "_page-header__bottom-content_8gwjb_89",
33
+ "page-header__main-right-content": "_page-header__main-right-content_8gwjb_128"
34
+ }, k = ({
35
+ title: r,
36
+ subtitle: s,
37
+ backLinkText: o,
38
+ onBackLinkClick: n,
39
+ rightChildren: p,
40
+ bottomChildren: h,
41
+ classNameWrapper: i,
42
+ classNameBackLink: d,
43
+ classNameTitle: l,
44
+ classNameSubtitle: y,
45
+ "data-testid-wrapper": c,
46
+ "data-testid-backLink": b,
47
+ "data-testid-title": u,
48
+ "data-testid-subtitle": m,
49
+ ...w
50
+ }) => /* @__PURE__ */ a("div", { className: _([e["page-header"], i]), "data-testid": c, ...w, children: [
51
+ o && /* @__PURE__ */ t("div", { className: e["page-header__top-content"], children: /* @__PURE__ */ a("button", { type: "button", onClick: n, className: d, "data-testid": b, children: [
52
+ /* @__PURE__ */ t(j, { fontSize: 16 }),
53
+ o
54
+ ] }) }),
55
+ /* @__PURE__ */ a("div", { className: e["page-header__main-content"], children: [
56
+ /* @__PURE__ */ a("div", { className: e["page-header__main-left-content"], children: [
57
+ /* @__PURE__ */ t("h1", { className: _(e.title, l), "data-testid": u, children: r }),
58
+ /* @__PURE__ */ t("h2", { className: _(e.subtitle, y), "data-testid": m, children: s })
59
+ ] }),
60
+ p && /* @__PURE__ */ t("div", { className: e["page-header__main-right-content"], children: p })
61
+ ] }),
62
+ h && /* @__PURE__ */ t("div", { className: e["page-header__bottom-content"], children: h })
63
+ ] });
64
+ export {
65
+ k as PageHeader
66
+ };
@@ -0,0 +1,43 @@
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;
@@ -0,0 +1,55 @@
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 {};
@@ -0,0 +1,236 @@
1
+ import '../../assets/Pagination.css';
2
+ import { jsxs as b, jsx as r, 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 I, b as A } from "../../index-CH45lKw7.js";
6
+ import { u as E } from "../../useControlled-CCMYYdCM.js";
7
+ const $ = ["boundaryCount", "componentName", "count", "defaultPage", "disabled", "hideNextButton", "hidePrevButton", "onChange", "page", "showFirstButton", "showLastButton", "siblingCount"];
8
+ function R(g = {}) {
9
+ const {
10
+ boundaryCount: a = 1,
11
+ componentName: e = "usePagination",
12
+ count: o = 1,
13
+ defaultPage: m = 1,
14
+ disabled: h = !1,
15
+ hideNextButton: v = !1,
16
+ hidePrevButton: d = !1,
17
+ onChange: c,
18
+ page: t,
19
+ showFirstButton: i = !1,
20
+ showLastButton: x = !1,
21
+ siblingCount: _ = 1
22
+ } = g, p = I(g, $), [s, M] = E({
23
+ controlled: t,
24
+ default: m,
25
+ name: e,
26
+ state: "page"
27
+ }), P = (n, l) => {
28
+ t || M(l), c && c(n, l);
29
+ }, f = (n, l) => {
30
+ const D = l - n + 1;
31
+ return Array.from({
32
+ length: D
33
+ }, (q, F) => n + F);
34
+ }, S = f(1, Math.min(a, o)), C = f(Math.max(o - a + 1, a + 1), o), z = Math.max(
35
+ Math.min(
36
+ // Natural start
37
+ s - _,
38
+ // Lower boundary when page is high
39
+ o - a - _ * 2 - 1
40
+ ),
41
+ // Greater than startPages
42
+ a + 2
43
+ ), N = Math.min(
44
+ Math.max(
45
+ // Natural end
46
+ s + _,
47
+ // Upper boundary when page is low
48
+ a + _ * 2 + 2
49
+ ),
50
+ // Less than endPages
51
+ C.length > 0 ? C[0] - 2 : o - 1
52
+ ), L = [
53
+ ...i ? ["first"] : [],
54
+ ...d ? [] : ["previous"],
55
+ ...S,
56
+ // Start ellipsis
57
+ // eslint-disable-next-line no-nested-ternary
58
+ ...z > a + 2 ? ["start-ellipsis"] : a + 1 < o - a ? [a + 1] : [],
59
+ // Sibling pages
60
+ ...f(z, N),
61
+ // End ellipsis
62
+ // eslint-disable-next-line no-nested-ternary
63
+ ...N < o - a - 1 ? ["end-ellipsis"] : o - a > a ? [o - a] : [],
64
+ ...C,
65
+ ...v ? [] : ["next"],
66
+ ...x ? ["last"] : []
67
+ ], B = (n) => {
68
+ switch (n) {
69
+ case "first":
70
+ return 1;
71
+ case "previous":
72
+ return s - 1;
73
+ case "next":
74
+ return s + 1;
75
+ case "last":
76
+ return o;
77
+ default:
78
+ return null;
79
+ }
80
+ }, j = L.map((n) => typeof n == "number" ? {
81
+ onClick: (l) => {
82
+ P(l, n);
83
+ },
84
+ type: "page",
85
+ page: n,
86
+ selected: n === s,
87
+ disabled: h,
88
+ "aria-current": n === s ? "true" : void 0
89
+ } : {
90
+ onClick: (l) => {
91
+ P(l, B(n));
92
+ },
93
+ type: n,
94
+ page: B(n),
95
+ selected: !1,
96
+ disabled: h || n.indexOf("ellipsis") === -1 && (n === "next" || n === "last" ? s >= o : s <= 1)
97
+ });
98
+ return A({
99
+ items: j
100
+ }, p);
101
+ }
102
+ const T = "_pagination_ondmz_43", u = {
103
+ "u-typography-h1": "_u-typography-h1_ondmz_1",
104
+ "u-typography-h2": "_u-typography-h2_ondmz_8",
105
+ "u-typography-h3": "_u-typography-h3_ondmz_15",
106
+ "u-typography-h4": "_u-typography-h4_ondmz_22",
107
+ "u-typography-h5": "_u-typography-h5_ondmz_29",
108
+ "u-typography-h6": "_u-typography-h6_ondmz_36",
109
+ "u-typography-base": "_u-typography-base_ondmz_43",
110
+ pagination: T,
111
+ "per-page-container": "_per-page-container_ondmz_43",
112
+ "u-typography-base--xxl": "_u-typography-base--xxl_ondmz_48",
113
+ "u-typography-base--xl": "_u-typography-base--xl_ondmz_52",
114
+ "u-typography-base--lg": "_u-typography-base--lg_ondmz_56",
115
+ "u-typography-base--sm": "_u-typography-base--sm_ondmz_60",
116
+ "u-typography-base--bold": "_u-typography-base--bold_ondmz_64",
117
+ "u-typography-base--strikethrough": "_u-typography-base--strikethrough_ondmz_67",
118
+ "u-typography-base--underlined": "_u-typography-base--underlined_ondmz_70",
119
+ "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_ondmz_73",
120
+ "pages-navigator-container": "_pages-navigator-container_ondmz_96",
121
+ "pages-navigator-container__label": "_pages-navigator-container__label_ondmz_107",
122
+ "page-number__btn": "_page-number__btn_ondmz_107",
123
+ "pages-navigator-container__previous-next-btn": "_pages-navigator-container__previous-next-btn_ondmz_120",
124
+ "page-number__btn--selected": "_page-number__btn--selected_ondmz_145"
125
+ }, W = {
126
+ pt: {
127
+ showing: "Exibindo",
128
+ of: "de",
129
+ results: "resultados",
130
+ previous: "Anterior",
131
+ next: "Próximo"
132
+ },
133
+ en: {
134
+ showing: "Showing",
135
+ of: "of",
136
+ results: "results",
137
+ previous: "Previous",
138
+ next: "Next"
139
+ }
140
+ }, U = ({ perPageOptions: g = [5, 10, 25, 50, 100], language: a = "en", ...e }) => {
141
+ const o = Math.ceil(e.totalItems / e.perPage), m = e.currentPage <= 1, h = e.currentPage >= o, v = e.t || W[a], d = (t) => v[t], { items: c } = R({
142
+ count: o,
143
+ hideNextButton: !0,
144
+ hidePrevButton: !0,
145
+ page: e.currentPage,
146
+ siblingCount: 1,
147
+ boundaryCount: 2,
148
+ onChange: (t, i) => e.onPageChange(i)
149
+ });
150
+ return /* @__PURE__ */ b("div", { className: y(u.pagination, e.className), "data-testid": e["data-testid"], children: [
151
+ /* @__PURE__ */ r(
152
+ "div",
153
+ {
154
+ className: y(u["per-page-container"], e.classNamePerPage),
155
+ "data-testid": e["data-testid-per-page"],
156
+ children: g && /* @__PURE__ */ b(k, { children: [
157
+ /* @__PURE__ */ r("span", { children: d`showing` }),
158
+ /* @__PURE__ */ r(
159
+ w,
160
+ {
161
+ className: u["per-page-container__select"],
162
+ value: String(e.perPage),
163
+ onChange: (t) => e.onRowsPerPageChange(Number(t)),
164
+ children: g == null ? void 0 : g.map((t) => {
165
+ const i = typeof t == "number";
166
+ return /* @__PURE__ */ r(
167
+ w.Option,
168
+ {
169
+ value: String(i ? t : t.value),
170
+ children: i ? t : t.label
171
+ },
172
+ `per-page__${i ? t : t.value}`
173
+ );
174
+ })
175
+ }
176
+ ),
177
+ /* @__PURE__ */ b("span", { children: [
178
+ d`of`,
179
+ " ",
180
+ /* @__PURE__ */ r("strong", { children: e.totalItems }),
181
+ " ",
182
+ d`results`
183
+ ] })
184
+ ] })
185
+ }
186
+ ),
187
+ /* @__PURE__ */ b(
188
+ "div",
189
+ {
190
+ className: y(u["pages-navigator-container"], e.classNamePagesNav),
191
+ "data-testid": e["data-testid-pages-nav"],
192
+ children: [
193
+ /* @__PURE__ */ r(
194
+ "button",
195
+ {
196
+ className: u["pages-navigator-container__previous-next-btn"],
197
+ disabled: m,
198
+ onClick: () => e.onPageChange(e.currentPage - 1),
199
+ type: "button",
200
+ children: d`previous`
201
+ },
202
+ "page__previous"
203
+ ),
204
+ /* @__PURE__ */ r("ul", { children: c.map(({ page: t, type: i, selected: x, ..._ }, p) => {
205
+ let s = /* @__PURE__ */ r(k, {});
206
+ return i === "start-ellipsis" || i === "end-ellipsis" ? s = /* @__PURE__ */ r("span", { className: u["pages-navigator-container__label"], children: "..." }) : i === "page" ? s = /* @__PURE__ */ r(
207
+ "button",
208
+ {
209
+ className: y(u["page-number__btn"], x && u["page-number__btn--selected"]),
210
+ onClick: () => e.onPageChange(t || 0),
211
+ type: "button",
212
+ children: t
213
+ },
214
+ `page__${p}`
215
+ ) : s = /* @__PURE__ */ r("button", { type: "button", ..._, children: i }), /* @__PURE__ */ r("li", { children: s }, p);
216
+ }) }),
217
+ /* @__PURE__ */ r(
218
+ "button",
219
+ {
220
+ className: u["pages-navigator-container__previous-next-btn"],
221
+ disabled: h,
222
+ onClick: () => e.onPageChange(e.currentPage + 1),
223
+ type: "button",
224
+ children: d`next`
225
+ },
226
+ "page__next"
227
+ )
228
+ ]
229
+ }
230
+ )
231
+ ] });
232
+ };
233
+ export {
234
+ U as Pagination,
235
+ W as paginationDefaultTranslations
236
+ };
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,26 @@
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 };