@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,137 @@
1
+ import '../../assets/Table.css';
2
+ import { jsxs as b, jsx as a } from "react/jsx-runtime";
3
+ import * as h from "react";
4
+ import { useState as w } from "react";
5
+ import { c as g } from "../../clsx-DB4S2d7J.js";
6
+ import { paginationDefaultTranslations as y, Pagination as T } from "../Pagination/Pagination.js";
7
+ import { sortTooltipDefaultTranslations as u, SortTooltip as f } from "../SortTooltip/SortTooltip.js";
8
+ import { TableProvider as N, useTable as x } from "./TableContext.js";
9
+ const C = (p) => /* @__PURE__ */ h.createElement("svg", { width: 7, height: 10, viewBox: "0 0 7 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...p }, /* @__PURE__ */ h.createElement("g", { clipPath: "url(#clip0_2291_2457)" }, /* @__PURE__ */ h.createElement("path", { d: "M6.41658 3.93794C6.26731 3.93794 6.11798 3.88301 6.00423 3.77314L3.49991 1.35923L0.995768 3.77271C0.767904 3.99243 0.398763 3.99243 0.170898 3.77271C-0.0569661 3.55298 -0.0569661 3.19702 0.170898 2.97729L3.08756 0.164795C3.31543 -0.0549316 3.68457 -0.0549316 3.91243 0.164795L6.8291 2.97729C7.05697 3.19702 7.05697 3.55298 6.8291 3.77271C6.71553 3.88345 6.56605 3.93794 6.41658 3.93794Z", fill: "#1897F3" }), /* @__PURE__ */ h.createElement("path", { opacity: 0.4, d: "M6.41663 5.38022C6.26737 5.38022 6.11804 5.43516 6.00429 5.54502L3.49997 7.95894L0.99528 5.5437C0.767415 5.32397 0.398275 5.32397 0.17041 5.5437C-0.0574544 5.76343 -0.0574544 6.11938 0.17041 6.33911L3.08708 9.15161C3.31494 9.37134 3.68408 9.37134 3.91195 9.15161L6.82861 6.33911C7.05648 6.11938 7.05648 5.76343 6.82861 5.5437C6.71559 5.43472 6.56611 5.38022 6.41663 5.38022Z", fill: "#1897F3" })), /* @__PURE__ */ h.createElement("defs", null, /* @__PURE__ */ h.createElement("clipPath", { id: "clip0_2291_2457" }, /* @__PURE__ */ h.createElement("rect", { width: 7, height: 10, fill: "white" })))), L = "_table_1gspp_43", E = "_th__wrapper_1gspp_114", k = "_tr_1gspp_130", v = "_td_1gspp_134", t = {
10
+ "u-typography-h1": "_u-typography-h1_1gspp_1",
11
+ "u-typography-h2": "_u-typography-h2_1gspp_8",
12
+ "u-typography-h3": "_u-typography-h3_1gspp_15",
13
+ "u-typography-h4": "_u-typography-h4_1gspp_22",
14
+ "u-typography-h5": "_u-typography-h5_1gspp_29",
15
+ "u-typography-h6": "_u-typography-h6_1gspp_36",
16
+ "u-typography-base": "_u-typography-base_1gspp_43",
17
+ table: L,
18
+ "u-typography-base--xxl": "_u-typography-base--xxl_1gspp_48",
19
+ "u-typography-base--xl": "_u-typography-base--xl_1gspp_52",
20
+ "u-typography-base--lg": "_u-typography-base--lg_1gspp_56",
21
+ "u-typography-base--sm": "_u-typography-base--sm_1gspp_60",
22
+ "u-typography-base--bold": "_u-typography-base--bold_1gspp_64",
23
+ "u-typography-base--strikethrough": "_u-typography-base--strikethrough_1gspp_67",
24
+ "u-typography-base--underlined": "_u-typography-base--underlined_1gspp_70",
25
+ "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_1gspp_73",
26
+ "table--full-width": "_table--full-width_1gspp_81",
27
+ "table--white-theme": "_table--white-theme_1gspp_84",
28
+ "table--transparent-theme": "_table--transparent-theme_1gspp_87",
29
+ "cell--left-alignment": "_cell--left-alignment_1gspp_90",
30
+ "cell--center-alignment": "_cell--center-alignment_1gspp_94",
31
+ "cell--right-alignment": "_cell--right-alignment_1gspp_98",
32
+ th__wrapper: E,
33
+ "th__wrapper--pressed": "_th__wrapper--pressed_1gspp_117",
34
+ "th__wrapper--clickable": "_th__wrapper--clickable_1gspp_121",
35
+ "th__sort-icon-container": "_th__sort-icon-container_1gspp_124",
36
+ "tr__row-or-cell--disabled": "_tr__row-or-cell--disabled_1gspp_130",
37
+ tr: k,
38
+ td: v,
39
+ "tr__row-or-cell--clickable": "_tr__row-or-cell--clickable_1gspp_139",
40
+ "td__row-or-cell--clickable": "_td__row-or-cell--clickable_1gspp_140",
41
+ "td__row-or-cell--disabled": "_td__row-or-cell--disabled_1gspp_144",
42
+ "td-wrapper": "_td-wrapper_1gspp_148"
43
+ }, B = {
44
+ pt: {
45
+ ...y.pt,
46
+ ...u.pt
47
+ },
48
+ en: {
49
+ ...y.en,
50
+ ...u.en
51
+ },
52
+ // example to add a new language translation
53
+ es: {
54
+ asc: "Orden ascendente",
55
+ desc: "Orden descendiente",
56
+ next: "Próximo",
57
+ previous: "Anterior",
58
+ showing: "Mostrando",
59
+ of: "de",
60
+ results: "resultados"
61
+ }
62
+ }, l = ({
63
+ children: p,
64
+ theme: e = "white",
65
+ fullWidth: r = !0,
66
+ className: o,
67
+ paginationProps: s,
68
+ language: _,
69
+ translations: n,
70
+ ...d
71
+ }) => {
72
+ const c = g(
73
+ t.table,
74
+ r ? t["table--full-width"] : "",
75
+ t[`table--${e}-theme`],
76
+ o
77
+ ), i = _ && B[_] || n;
78
+ return /* @__PURE__ */ b(N, { initialTranslations: i, children: [
79
+ /* @__PURE__ */ a("table", { ...d, className: c, children: p }),
80
+ s && /* @__PURE__ */ a(T, { ...s, t: i })
81
+ ] });
82
+ }, H = ({ children: p, ...e }) => /* @__PURE__ */ a("thead", { ...e, children: p }), P = ({ children: p, ...e }) => /* @__PURE__ */ a("tbody", { ...e, children: p }), D = ({ children: p, onClick: e, disabled: r, className: o, ...s }) => {
83
+ const _ = g(
84
+ t.tr,
85
+ e && !r ? t["tr__row-or-cell--clickable"] : r ? t["tr__row-or-cell--disabled"] : "",
86
+ o
87
+ );
88
+ return /* @__PURE__ */ a("tr", { ...s, className: _, onClick: () => !r && (e == null ? void 0 : e()), children: p });
89
+ }, M = ({ children: p, onClick: e, disabled: r, className: o, align: s = "left", ..._ }) => {
90
+ const n = g(
91
+ t.td,
92
+ e && !r ? t["td__row-or-cell--clickable"] : r ? t["td__row-or-cell--disabled"] : "",
93
+ t[`cell--${s}-alignment`],
94
+ o
95
+ );
96
+ return /* @__PURE__ */ a("td", { ..._, className: n, onClick: () => !r && (e == null ? void 0 : e()), children: /* @__PURE__ */ a("span", { className: t["td-wrapper"], children: p }) });
97
+ }, O = ({ children: p, onSort: e, sortType: r, className: o, classNameTooltip: s, align: _ = "left", ...n }) => {
98
+ const { translations: d } = x(), [c, i] = w(!1), m = g(
99
+ t.th__wrapper,
100
+ c ? t["th__wrapper--pressed"] : "",
101
+ e ? t["th__wrapper--clickable"] : "",
102
+ o
103
+ );
104
+ return /* @__PURE__ */ a("th", { ...n, className: t[`cell--${_}-alignment`], children: /* @__PURE__ */ a("span", { className: m, onClick: e && (() => i(!c)), children: e ? /* @__PURE__ */ b(
105
+ f,
106
+ {
107
+ onClose: () => i(!1),
108
+ onSort: e,
109
+ show: c,
110
+ sortType: r,
111
+ className: s,
112
+ t: d,
113
+ children: [
114
+ /* @__PURE__ */ a("span", { children: p }),
115
+ /* @__PURE__ */ a("span", { className: t["th__sort-icon-container"], children: /* @__PURE__ */ a(C, {}) })
116
+ ]
117
+ }
118
+ ) : /* @__PURE__ */ a("span", { children: p }) }) });
119
+ };
120
+ l.THead = H;
121
+ l.THead.displayName = "Table.THead";
122
+ l.TBody = P;
123
+ l.TBody.displayName = "Table.TBody";
124
+ l.Tr = D;
125
+ l.Tr.displayName = "Table.Tr";
126
+ l.Td = M;
127
+ l.Td.displayName = "Table.Td";
128
+ l.Th = O;
129
+ l.Th.displayName = "Table.Th";
130
+ export {
131
+ P as TBody,
132
+ H as THead,
133
+ l as Table,
134
+ M as Td,
135
+ O as Th,
136
+ D as Tr
137
+ };
@@ -0,0 +1,29 @@
1
+ import { StoryObj } from '@storybook/react';
2
+
3
+ declare const meta: {
4
+ title: string;
5
+ component: {
6
+ ({ children, theme, fullWidth, className, paginationProps, language, translations, ...rest }: import('./Table').TableProps): import("react/jsx-runtime").JSX.Element;
7
+ THead: import('react').FunctionComponent<import('./Table').ChildrenProps>;
8
+ TBody: import('react').FunctionComponent<import('./Table').ChildrenProps>;
9
+ Tr: import('react').FunctionComponent<import('./Table').TrProps>;
10
+ Td: import('react').FunctionComponent<import('./Table').TdProps>;
11
+ Th: import('react').FunctionComponent<import('./Table').ThProps>;
12
+ };
13
+ tags: string[];
14
+ parameters: {
15
+ layout: string;
16
+ };
17
+ subcomponents: {
18
+ 'Table.THead': import('react').FunctionComponent<unknown>;
19
+ 'Table.TBody': import('react').FunctionComponent<unknown>;
20
+ 'Table.Tr': import('react').FunctionComponent<unknown>;
21
+ 'Table.Th': import('react').FunctionComponent<unknown>;
22
+ 'Table.Td': import('react').FunctionComponent<unknown>;
23
+ };
24
+ };
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+ export declare const Default: Story;
28
+ export declare const WithPagination: Story;
29
+ export declare const WithLanguage: Story;
@@ -0,0 +1,19 @@
1
+ import { SortTranslationsByKeys } from '../SortTooltip/SortTooltip';
2
+ import { PaginationTranslations } from '../Pagination/Pagination';
3
+ import { ReactNode } from 'react';
4
+
5
+ export type TableTranslationsKeys = keyof PaginationTranslations | keyof SortTranslationsByKeys;
6
+ export type TableTranslations = {
7
+ [key in TableTranslationsKeys]?: string;
8
+ };
9
+ type ITableContext = {
10
+ translations?: TableTranslations;
11
+ setTranslations: (translation: TableTranslations) => void;
12
+ };
13
+ type TableProviderProps = {
14
+ initialTranslations?: TableTranslations;
15
+ children: ReactNode;
16
+ };
17
+ declare const TableProvider: ({ initialTranslations, children }: TableProviderProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const useTable: () => Partial<ITableContext>;
19
+ export { TableProvider };
@@ -0,0 +1,21 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { createContext as n, useState as u, useEffect as x, useContext as a } from "react";
3
+ const o = n({}), b = ({ initialTranslations: e, children: r }) => {
4
+ const [s, t] = u(e);
5
+ return x(() => {
6
+ t(e);
7
+ }, [e]), /* @__PURE__ */ c(
8
+ o.Provider,
9
+ {
10
+ value: {
11
+ translations: s,
12
+ setTranslations: t
13
+ },
14
+ children: r
15
+ }
16
+ );
17
+ }, p = () => a(o);
18
+ export {
19
+ b as TableProvider,
20
+ p as useTable
21
+ };
@@ -0,0 +1,14 @@
1
+ import { ChildrenProps } from './Table';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ children, ...rest }: ChildrenProps) => 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 Default: Story;
@@ -0,0 +1,14 @@
1
+ import { ChildrenProps } from './Table';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ children, ...rest }: ChildrenProps) => 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 Default: Story;
@@ -0,0 +1,16 @@
1
+ import { TdProps } from './Table';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ children, onClick, disabled, className, align, ...rest }: TdProps) => 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 Default: Story;
15
+ export declare const WithAlign: Story;
16
+ export declare const Disabled: Story;
@@ -0,0 +1,15 @@
1
+ import { ThProps } from './Table';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ children, onSort, sortType, className, classNameTooltip, align, ...rest }: ThProps) => 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 Default: Story;
15
+ export declare const WithAlign: Story;
@@ -0,0 +1,15 @@
1
+ import { TrProps } from './Table';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ children, onClick, disabled, className, ...rest }: TrProps) => 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 Default: Story;
15
+ export declare const Disabled: Story;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface TabProps {
4
+ /** The value to be showing in the tab */
5
+ children: ReactNode;
6
+ /** The value that corresponds to the panel to show.
7
+ * e.g. value="1" when this tab is clicked it will show the panel which also has value="1! */
8
+ value: string | number;
9
+ /** Disable clicking the tab */
10
+ disabled?: boolean;
11
+ /** data test id */
12
+ dataTestId?: string;
13
+ }
14
+ export declare const Tab: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,181 @@
1
+ import { jsx as N } from "react/jsx-runtime";
2
+ import * as b from "react";
3
+ import { forwardRef as H, useContext as U, useMemo as j } from "react";
4
+ import { c as k } from "../../clsx-DB4S2d7J.js";
5
+ import { u as B, T as D, s as y } from "../../Tabs.module-jkH1Qjn7.js";
6
+ import { g as L, a as W, u as O, f as $, b as d, _ as q, c as z, P as e, d as A, e as G } from "../../index-CH45lKw7.js";
7
+ import { u as J, c as K } from "../../combineHooksSlotProps-DVjg9PRh.js";
8
+ import { u as Q, a as X } from "../../useCompoundItem-D1iRfg8D.js";
9
+ import { u as Y } from "../../useButton-DNk3wrQp.js";
10
+ const E = "Tab";
11
+ function Z(o) {
12
+ return L(E, o);
13
+ }
14
+ W(E, ["root", "selected", "disabled"]);
15
+ function ee(o) {
16
+ return o.size;
17
+ }
18
+ function te(o) {
19
+ const {
20
+ value: t,
21
+ rootRef: s,
22
+ disabled: n = !1,
23
+ id: c
24
+ } = o, a = b.useRef(null), r = Q(c), {
25
+ value: f,
26
+ selectionFollowsFocus: p,
27
+ getTabPanelId: m
28
+ } = B(), P = b.useMemo(() => ({
29
+ disabled: n,
30
+ ref: a,
31
+ id: r
32
+ }), [n, a, r]), {
33
+ id: l,
34
+ index: R,
35
+ totalItemCount: g
36
+ } = X(t ?? ee, P), {
37
+ getRootProps: h,
38
+ highlighted: T,
39
+ selected: i
40
+ } = J({
41
+ item: l
42
+ }), {
43
+ getRootProps: C,
44
+ rootRef: u,
45
+ active: v,
46
+ focusVisible: I,
47
+ setFocusVisible: V
48
+ } = Y({
49
+ disabled: n,
50
+ focusableWhenDisabled: !p,
51
+ type: "button"
52
+ }), _ = O(a, s, u), M = l !== void 0 ? m(l) : void 0;
53
+ return {
54
+ getRootProps: (x = {}) => {
55
+ const S = $(x), w = K(h, C);
56
+ return d({}, x, w(S), {
57
+ role: "tab",
58
+ "aria-controls": M,
59
+ "aria-selected": i,
60
+ id: r,
61
+ ref: _
62
+ });
63
+ },
64
+ active: v,
65
+ focusVisible: I,
66
+ highlighted: T,
67
+ index: R,
68
+ rootRef: _,
69
+ // the `selected` state isn't set on the server (it relies on effects to be calculated),
70
+ // so we fall back to checking the `value` prop with the selectedValue from the TabsContext
71
+ selected: i || l === f,
72
+ setFocusVisible: V,
73
+ totalTabsCount: g
74
+ };
75
+ }
76
+ const oe = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], se = (o) => {
77
+ const {
78
+ selected: t,
79
+ disabled: s
80
+ } = o;
81
+ return A({
82
+ root: ["root", t && "selected", s && "disabled"]
83
+ }, G(Z));
84
+ }, F = /* @__PURE__ */ b.forwardRef(function(t, s) {
85
+ var n;
86
+ const {
87
+ children: c,
88
+ disabled: a = !1,
89
+ slotProps: r = {},
90
+ slots: f = {},
91
+ value: p
92
+ } = t, m = q(t, oe), P = b.useRef(), l = O(P, s), {
93
+ active: R,
94
+ highlighted: g,
95
+ selected: h,
96
+ getRootProps: T
97
+ } = te(d({}, t, {
98
+ rootRef: l,
99
+ value: p
100
+ })), i = d({}, t, {
101
+ active: R,
102
+ disabled: a,
103
+ highlighted: g,
104
+ selected: h
105
+ }), C = se(i), u = (n = f.root) != null ? n : "button", v = z({
106
+ elementType: u,
107
+ getSlotProps: T,
108
+ externalSlotProps: r.root,
109
+ externalForwardedProps: m,
110
+ additionalProps: {
111
+ ref: s
112
+ },
113
+ ownerState: i,
114
+ className: C.root
115
+ });
116
+ return /* @__PURE__ */ N(u, d({}, v, {
117
+ children: c
118
+ }));
119
+ });
120
+ process.env.NODE_ENV !== "production" && (F.propTypes = {
121
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
122
+ // │ These PropTypes are generated from the TypeScript type definitions. │
123
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
124
+ // └─────────────────────────────────────────────────────────────────────┘
125
+ /**
126
+ * A ref for imperative actions. It currently only supports `focusVisible()` action.
127
+ */
128
+ action: e.oneOfType([e.func, e.shape({
129
+ current: e.shape({
130
+ focusVisible: e.func.isRequired
131
+ })
132
+ })]),
133
+ /**
134
+ * @ignore
135
+ */
136
+ children: e.node,
137
+ /**
138
+ * If `true`, the component is disabled.
139
+ * @default false
140
+ */
141
+ disabled: e.bool,
142
+ /**
143
+ * Callback invoked when new value is being set.
144
+ */
145
+ onChange: e.func,
146
+ /**
147
+ * The props used for each slot inside the Tab.
148
+ * @default {}
149
+ */
150
+ slotProps: e.shape({
151
+ root: e.oneOfType([e.func, e.object])
152
+ }),
153
+ /**
154
+ * The components used for each slot inside the Tab.
155
+ * Either a string to use a HTML element or a component.
156
+ * @default {}
157
+ */
158
+ slots: e.shape({
159
+ root: e.elementType
160
+ }),
161
+ /**
162
+ * You can provide your own value. Otherwise, it falls back to the child position index.
163
+ */
164
+ value: e.oneOfType([e.number, e.string])
165
+ });
166
+ const fe = H(
167
+ ({ children: o, value: t, disabled: s, dataTestId: n }, c) => {
168
+ const a = U(D), r = j(
169
+ () => k(
170
+ y.tabs__tab,
171
+ t === (a == null ? void 0 : a.value) && y["tabs__tab--selected"],
172
+ s && y["tabs__tab--disabled"]
173
+ ),
174
+ [t, a, s]
175
+ );
176
+ return /* @__PURE__ */ N(F, { className: r, disabled: s, value: t, "data-testid": n, ref: c, children: o });
177
+ }
178
+ );
179
+ export {
180
+ fe as Tab
181
+ };
@@ -0,0 +1,15 @@
1
+ import { TabProps } from './Tabs.tsx';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
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 Disabled: Story;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface TabPanelProps {
4
+ /** The content to be displayed when the corresponding tab is selected */
5
+ children: ReactNode;
6
+ /** The value that identifies which tab is selected.
7
+ * e.g. value="1" when the tab button with the value="1" is selected this content will show */
8
+ value: string | number;
9
+ /** Test id */
10
+ dataTestId?: string;
11
+ }
12
+ export declare const TabPanel: import('react').ForwardRefExoticComponent<TabPanelProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,118 @@
1
+ import { jsx as T } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { forwardRef as v } from "react";
4
+ import { u as y, s as x } from "../../Tabs.module-jkH1Qjn7.js";
5
+ import { g as C, a as N, u as _, b, _ as w, c as O, P as o, d as E, e as I } from "../../index-CH45lKw7.js";
6
+ import { u as S, a as U } from "../../useCompoundItem-D1iRfg8D.js";
7
+ const h = "TabPanel";
8
+ function j(t) {
9
+ return C(h, t);
10
+ }
11
+ N(h, ["root", "hidden"]);
12
+ function M(t) {
13
+ return t.size;
14
+ }
15
+ function V(t) {
16
+ const {
17
+ value: e,
18
+ id: s,
19
+ rootRef: n
20
+ } = t, i = y();
21
+ if (i === null)
22
+ throw new Error("No TabContext provided");
23
+ const {
24
+ value: f,
25
+ getTabId: P
26
+ } = i, a = S(s), r = m.useRef(null), c = _(r, n), u = m.useMemo(() => ({
27
+ id: a,
28
+ ref: r
29
+ }), [a]), {
30
+ id: l
31
+ } = U(e ?? M, u), d = l !== f, p = l !== void 0 ? P(l) : void 0;
32
+ return {
33
+ hidden: d,
34
+ getRootProps: (g = {}) => b({
35
+ "aria-labelledby": p ?? void 0,
36
+ hidden: d,
37
+ id: a ?? void 0
38
+ }, g, {
39
+ ref: c
40
+ }),
41
+ rootRef: c
42
+ };
43
+ }
44
+ const F = ["children", "value", "slotProps", "slots"], $ = (t) => {
45
+ const {
46
+ hidden: e
47
+ } = t;
48
+ return E({
49
+ root: ["root", e && "hidden"]
50
+ }, I(j));
51
+ }, R = /* @__PURE__ */ m.forwardRef(function(e, s) {
52
+ var n;
53
+ const {
54
+ children: i,
55
+ slotProps: f = {},
56
+ slots: P = {}
57
+ } = e, a = w(e, F), {
58
+ hidden: r,
59
+ getRootProps: c
60
+ } = V(e), u = b({}, e, {
61
+ hidden: r
62
+ }), l = $(u), d = (n = P.root) != null ? n : "div", p = O({
63
+ elementType: d,
64
+ getSlotProps: c,
65
+ externalSlotProps: f.root,
66
+ externalForwardedProps: a,
67
+ additionalProps: {
68
+ role: "tabpanel",
69
+ ref: s
70
+ },
71
+ ownerState: u,
72
+ className: l.root
73
+ });
74
+ return /* @__PURE__ */ T(d, b({}, p, {
75
+ children: !r && i
76
+ }));
77
+ });
78
+ process.env.NODE_ENV !== "production" && (R.propTypes = {
79
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
80
+ // │ These PropTypes are generated from the TypeScript type definitions. │
81
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
82
+ // └─────────────────────────────────────────────────────────────────────┘
83
+ /**
84
+ * The content of the component.
85
+ */
86
+ children: o.node,
87
+ /**
88
+ * @ignore
89
+ */
90
+ className: o.string,
91
+ /**
92
+ * The props used for each slot inside the TabPanel.
93
+ * @default {}
94
+ */
95
+ slotProps: o.shape({
96
+ root: o.oneOfType([o.func, o.object])
97
+ }),
98
+ /**
99
+ * The components used for each slot inside the TabPanel.
100
+ * Either a string to use a HTML element or a component.
101
+ * @default {}
102
+ */
103
+ slots: o.shape({
104
+ root: o.elementType
105
+ }),
106
+ /**
107
+ * The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
108
+ * If not provided, it will fall back to the index of the panel.
109
+ * It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
110
+ */
111
+ value: o.oneOfType([o.number, o.string])
112
+ });
113
+ const W = v(
114
+ ({ children: t, value: e, dataTestId: s }, n) => /* @__PURE__ */ T(R, { className: x["tabs__tab-panel"], value: e, "data-testid": s, ref: n, children: t })
115
+ );
116
+ export {
117
+ W as TabPanel
118
+ };
@@ -0,0 +1,14 @@
1
+ import { TabPanelProps } from './Tabs.tsx';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: import('react').ForwardRefExoticComponent<TabPanelProps & import('react').RefAttributes<HTMLDivElement>>;
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;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface TabsProps {
4
+ /** Should contain `Tab` and `TabPanel` components to be rendered */
5
+ children?: ReactNode;
6
+ /** Selected tab */
7
+ value?: number | string;
8
+ /** Callback triggered when the user has selected a tab */
9
+ onChange?: (tabValue: number | string | null, event?: React.SyntheticEvent<Element, Event> | null) => void;
10
+ /** Test id */
11
+ dataTestId?: string;
12
+ }
13
+ export declare const Tabs: import('react').ForwardRefExoticComponent<TabsProps & import('react').RefAttributes<HTMLDivElement>>;
14
+ export * from './Tab';
15
+ export * from './TabPanel';