@pismo/marola 0.0.1-alpha.6 → 0.0.1-alpha.7

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 (54) hide show
  1. package/dist/{Button-W6tM-_IT.js → Button-B1umG8kJ.js} +2 -2
  2. package/dist/ClickAwayListener-BKznXF1d.js +106 -0
  3. package/dist/Portal-BcdMtRGF.js +73 -0
  4. package/dist/assets/Input.css +1 -0
  5. package/dist/assets/Snackbar.css +1 -0
  6. package/dist/assets/Toggle.css +1 -0
  7. package/dist/components/Advice/Advice.d.ts +6 -3
  8. package/dist/components/Advice/Advice.js +15 -15
  9. package/dist/components/Button/Button.d.ts +8 -0
  10. package/dist/components/Button/Button.js +1 -1
  11. package/dist/components/Button/Button.stories.d.ts +60 -0
  12. package/dist/components/Button/Button.stories.js +40 -0
  13. package/dist/components/Dialog/CloseIconButton.js +9 -9
  14. package/dist/components/Dialog/Dialog.d.ts +3 -2
  15. package/dist/components/Dialog/Dialog.js +10 -9
  16. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  17. package/dist/components/Dialog/Dialog.stories.js +59 -0
  18. package/dist/components/Icon/Icon.d.ts +15 -4
  19. package/dist/components/Icon/Icon.js +92 -6
  20. package/dist/components/IconButton/IconButton.js +1 -1
  21. package/dist/components/Input/Input.d.ts +44 -0
  22. package/dist/components/Input/Input.js +497 -0
  23. package/dist/components/Input/Input.stories.d.ts +43 -0
  24. package/dist/components/Input/Input.stories.js +106 -0
  25. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  26. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  27. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +38 -0
  28. package/dist/components/Pagination/Pagination.d.ts +1 -1
  29. package/dist/components/Pagination/Pagination.js +10 -10
  30. package/dist/components/Snackbar/Snackbar.d.ts +13 -0
  31. package/dist/components/Snackbar/Snackbar.js +622 -0
  32. package/dist/components/SortTooltip/SortTooltip.d.ts +1 -1
  33. package/dist/components/SortTooltip/SortTooltip.js +8 -8
  34. package/dist/components/Table/Table.js +12 -12
  35. package/dist/components/Tabs/Tab.js +2 -2
  36. package/dist/components/Tabs/TabPanel.js +1 -1
  37. package/dist/components/Tabs/Tabs.js +1 -1
  38. package/dist/components/Toggle/Toggle.d.ts +14 -0
  39. package/dist/components/Toggle/Toggle.js +256 -0
  40. package/dist/components/Tooltip/Tooltip.js +558 -655
  41. package/dist/components/Typography/Typography.d.ts +5 -5
  42. package/dist/components/Typography/Typography.stories.d.ts +13 -0
  43. package/dist/components/Typography/Typography.stories.js +15 -15
  44. package/dist/components/Typography/typography.test.js +5 -8
  45. package/dist/{Portal-P3fPvS3-.js → index-BNWbc5Kh.js} +5709 -5776
  46. package/dist/{index-D2P7y2mE.js → index-CqjC7P5Y.js} +4 -3
  47. package/dist/main.d.ts +16 -8
  48. package/dist/main.js +47 -27
  49. package/dist/useButton-Bc8IAgyk.js +106 -0
  50. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  51. package/dist/useTimeout-DxF9kiZL.js +36 -0
  52. package/package.json +5 -4
  53. package/dist/react-CGNQ6M5x.js +0 -117
  54. package/dist/useButton-JpyBo5M4.js +0 -187
@@ -3,8 +3,8 @@ import { jsxs as w, jsx as r, Fragment as T } from "react/jsx-runtime";
3
3
  import * as c from "react";
4
4
  import { useState as u } from "react";
5
5
  import { c as h } from "../../clsx-DB4S2d7J.js";
6
- import { defaultTranslations as b, Pagination as q } from "../Pagination/Pagination.js";
7
- import { defaultTranslations as f, SortTooltip as g } from "../SortTooltip/SortTooltip.js";
6
+ import { paginationDefaultTranslations as b, Pagination as g } from "../Pagination/Pagination.js";
7
+ import { sortTooltipDefaultTranslations as f, SortTooltip as q } from "../SortTooltip/SortTooltip.js";
8
8
  import { TableProvider as N, useTable as C } from "./TableContext.js";
9
9
  const L = (l) => /* @__PURE__ */ c.createElement("svg", { width: 7, height: 10, viewBox: "0 0 7 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...l }, /* @__PURE__ */ c.createElement("g", { clipPath: "url(#clip0_2291_2457)" }, /* @__PURE__ */ c.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__ */ c.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__ */ c.createElement("defs", null, /* @__PURE__ */ c.createElement("clipPath", { id: "clip0_2291_2457" }, /* @__PURE__ */ c.createElement("rect", { width: 7, height: 10, fill: "white" })))), E = "_table_xe8qp_1", v = "_th__wrapper_xe8qp_40", y = "_tr_xe8qp_58", P = "_td_xe8qp_62", t = {
10
10
  table: E,
@@ -25,7 +25,7 @@ const L = (l) => /* @__PURE__ */ c.createElement("svg", { width: 7, height: 10,
25
25
  "td__row-or-cell--clickable": "_td__row-or-cell--clickable_xe8qp_68",
26
26
  "td__row-or-cell--disabled": "_td__row-or-cell--disabled_xe8qp_72",
27
27
  "td-wrapper": "_td-wrapper_xe8qp_76"
28
- }, $ = {
28
+ }, B = {
29
29
  pt: {
30
30
  ...b.pt,
31
31
  ...f.pt
@@ -59,19 +59,19 @@ const L = (l) => /* @__PURE__ */ c.createElement("svg", { width: 7, height: 10,
59
59
  a ? t["table--full-width"] : "",
60
60
  t[`table--${e}-theme`],
61
61
  n
62
- ), i = s && $[s] || o;
62
+ ), i = s && B[s] || o;
63
63
  return /* @__PURE__ */ w(N, { initialTranslations: i, children: [
64
64
  /* @__PURE__ */ r("table", { ...m, className: p, children: l }),
65
- _ && /* @__PURE__ */ r(q, { ..._, t: i })
65
+ _ && /* @__PURE__ */ r(g, { ..._, t: i })
66
66
  ] });
67
- }, B = ({ children: l, ...e }) => /* @__PURE__ */ r("thead", { ...e, children: l }), F = ({ children: l, ...e }) => /* @__PURE__ */ r("tbody", { ...e, children: l }), M = ({ children: l, onClick: e, disabled: a, className: n, ..._ }) => {
67
+ }, F = ({ children: l, ...e }) => /* @__PURE__ */ r("thead", { ...e, children: l }), M = ({ children: l, ...e }) => /* @__PURE__ */ r("tbody", { ...e, children: l }), O = ({ children: l, onClick: e, disabled: a, className: n, ..._ }) => {
68
68
  const s = h(
69
69
  t.tr,
70
70
  e && !a ? t["tr__row-or-cell--clickable"] : a ? t["tr__row-or-cell--disabled"] : "",
71
71
  n
72
72
  );
73
73
  return /* @__PURE__ */ r("tr", { ..._, className: s, onClick: () => !a && (e == null ? void 0 : e()), children: l });
74
- }, O = ({ children: l, onClick: e, disabled: a, className: n, align: _ = "left", ...s }) => {
74
+ }, $ = ({ children: l, onClick: e, disabled: a, className: n, align: _ = "left", ...s }) => {
75
75
  const o = h(
76
76
  t.td,
77
77
  e && !a ? t["td__row-or-cell--clickable"] : a ? t["td__row-or-cell--disabled"] : "",
@@ -99,7 +99,7 @@ const L = (l) => /* @__PURE__ */ c.createElement("svg", { width: 7, height: 10,
99
99
  e && /* @__PURE__ */ w(T, { children: [
100
100
  /* @__PURE__ */ r("span", { className: t["th__sort-icon-container"], children: /* @__PURE__ */ r(L, {}) }),
101
101
  /* @__PURE__ */ r(
102
- g,
102
+ q,
103
103
  {
104
104
  onClose: () => i(!1),
105
105
  onSort: e,
@@ -112,10 +112,10 @@ const L = (l) => /* @__PURE__ */ c.createElement("svg", { width: 7, height: 10,
112
112
  ] })
113
113
  ] }) });
114
114
  };
115
- d.THead = B;
116
- d.TBody = F;
117
- d.Tr = M;
118
- d.Td = O;
115
+ d.THead = F;
116
+ d.TBody = M;
117
+ d.Tr = O;
118
+ d.Td = $;
119
119
  d.Th = j;
120
120
  export {
121
121
  d as default
@@ -4,10 +4,10 @@ import { forwardRef as S, useContext as U, useMemo as j } from "react";
4
4
  import { c as D } from "../../clsx-DB4S2d7J.js";
5
5
  import { u as $, T as A, s as y } from "../../Tabs.module-BA-PC7fA.js";
6
6
  import { a as p, _ as B } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
7
- import { e as O, g as W, a as q, d as N, u as z, P as o, c as G, b as J } from "../../index-D2P7y2mE.js";
7
+ import { e as O, g as W, a as q, u as N, b as z, P as o, c as G, d as J } from "../../index-CqjC7P5Y.js";
8
8
  import { u as K, a as Q } from "../../useCompoundItem-CTYi5M_E.js";
9
9
  import { L as X, a as E } from "../../ListContext-Dj2Va7Iv.js";
10
- import { u as Y } from "../../useButton-JpyBo5M4.js";
10
+ import { u as Y } from "../../useButton-Bc8IAgyk.js";
11
11
  function Z(n) {
12
12
  const {
13
13
  handlePointerOverEvents: t = !1,
@@ -3,7 +3,7 @@ import * as P from "react";
3
3
  import { forwardRef as v } from "react";
4
4
  import { u as y, s as x } from "../../Tabs.module-BA-PC7fA.js";
5
5
  import { a as b, _ as C } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
6
- import { g as N, a as _, d as w, u as O, P as o, c as E, b as I } from "../../index-D2P7y2mE.js";
6
+ import { g as N, a as _, u as w, b as O, P as o, c as E, d as I } from "../../index-CqjC7P5Y.js";
7
7
  import { u as S, a as U } from "../../useCompoundItem-CTYi5M_E.js";
8
8
  const h = "TabPanel";
9
9
  function j(t) {
@@ -3,7 +3,7 @@ import * as i from "react";
3
3
  import { forwardRef as xe, useState as Ve } from "react";
4
4
  import { a as Q, C as Z, T as Te, u as Ie, s as Se } from "../../Tabs.module-BA-PC7fA.js";
5
5
  import { a as b, _ as ee } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
6
- import { d as Re, e as we, g as te, a as ne, u as oe, P as v, c as le, b as se } from "../../index-D2P7y2mE.js";
6
+ import { u as Re, e as we, g as te, a as ne, b as oe, P as v, c as le, d as se } from "../../index-CqjC7P5Y.js";
7
7
  import { u as Pe } from "../../useControlled-CCMYYdCM.js";
8
8
  import { a as S, L as ye } from "../../ListContext-Dj2Va7Iv.js";
9
9
  function J(t, e, l = (n, o) => n === o) {
@@ -0,0 +1,14 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+
3
+ type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
4
+ label: string;
5
+ disabled?: boolean;
6
+ checked?: boolean;
7
+ 'data-testid'?: string;
8
+ classNameWrapper?: string;
9
+ classNameLabel?: string;
10
+ classNameInput?: string;
11
+ autoFocus?: boolean;
12
+ };
13
+ export declare const Toggle: ({ onChange, label, disabled, checked, autoFocus, classNameWrapper, classNameLabel, classNameInput, "data-testid": dataTestId, }: ToggleProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,256 @@
1
+ import '../../assets/Toggle.css';
2
+ import { jsxs as I, jsx as O } from "react/jsx-runtime";
3
+ import { c as N } from "../../clsx-DB4S2d7J.js";
4
+ import { a as y, _ as v } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
5
+ import * as S from "react";
6
+ import { u as U, g as q, a as H, b as V, P as e, c as M, d as A } from "../../index-CqjC7P5Y.js";
7
+ import { u as D } from "../../useControlled-CCMYYdCM.js";
8
+ import { u as L } from "../../useIsFocusVisible-BH4IAdcw.js";
9
+ function W(l) {
10
+ const {
11
+ checked: o,
12
+ defaultChecked: d,
13
+ disabled: c,
14
+ onBlur: r,
15
+ onChange: p,
16
+ onFocus: g,
17
+ onFocusVisible: a,
18
+ readOnly: n,
19
+ required: P
20
+ } = l, [u, x] = D({
21
+ controlled: o,
22
+ default: !!d,
23
+ name: "Switch",
24
+ state: "checked"
25
+ }), B = (t) => (s) => {
26
+ var h;
27
+ s.nativeEvent.defaultPrevented || (x(s.target.checked), p == null || p(s), (h = t.onChange) == null || h.call(t, s));
28
+ }, {
29
+ isFocusVisibleRef: m,
30
+ onBlur: w,
31
+ onFocus: f,
32
+ ref: _
33
+ } = L(), [b, T] = S.useState(!1);
34
+ c && b && T(!1), S.useEffect(() => {
35
+ m.current = b;
36
+ }, [b, m]);
37
+ const k = S.useRef(null), R = (t) => (s) => {
38
+ var h;
39
+ k.current || (k.current = s.currentTarget), f(s), m.current === !0 && (T(!0), a == null || a(s)), g == null || g(s), (h = t.onFocus) == null || h.call(t, s);
40
+ }, C = (t) => (s) => {
41
+ var h;
42
+ w(s), m.current === !1 && T(!1), r == null || r(s), (h = t.onBlur) == null || h.call(t, s);
43
+ }, F = U(_, k);
44
+ return {
45
+ checked: u,
46
+ disabled: !!c,
47
+ focusVisible: b,
48
+ getInputProps: (t = {}) => y({
49
+ checked: o,
50
+ defaultChecked: d,
51
+ disabled: c,
52
+ readOnly: n,
53
+ ref: F,
54
+ required: P,
55
+ type: "checkbox",
56
+ role: "switch",
57
+ "aria-checked": o
58
+ }, t, {
59
+ onChange: B(t),
60
+ onFocus: R(t),
61
+ onBlur: C(t)
62
+ }),
63
+ inputRef: F,
64
+ readOnly: !!n
65
+ };
66
+ }
67
+ const $ = "Switch";
68
+ function z(l) {
69
+ return q($, l);
70
+ }
71
+ H($, ["root", "input", "track", "thumb", "checked", "disabled", "focusVisible", "readOnly"]);
72
+ const G = ["checked", "defaultChecked", "disabled", "onBlur", "onChange", "onFocus", "onFocusVisible", "readOnly", "required", "slotProps", "slots"], J = (l) => {
73
+ const {
74
+ checked: o,
75
+ disabled: d,
76
+ focusVisible: c,
77
+ readOnly: r
78
+ } = l;
79
+ return M({
80
+ root: ["root", o && "checked", d && "disabled", c && "focusVisible", r && "readOnly"],
81
+ thumb: ["thumb"],
82
+ input: ["input"],
83
+ track: ["track"]
84
+ }, A(z));
85
+ }, E = /* @__PURE__ */ S.forwardRef(function(o, d) {
86
+ var c, r, p, g;
87
+ const {
88
+ slotProps: a = {},
89
+ slots: n = {}
90
+ } = o, P = v(o, G), {
91
+ getInputProps: u,
92
+ checked: x,
93
+ disabled: B,
94
+ focusVisible: m,
95
+ readOnly: w
96
+ } = W(o), f = y({}, o, {
97
+ checked: x,
98
+ disabled: B,
99
+ focusVisible: m,
100
+ readOnly: w
101
+ }), _ = J(f), b = (c = n.root) != null ? c : "span", T = V({
102
+ elementType: b,
103
+ externalSlotProps: a.root,
104
+ externalForwardedProps: P,
105
+ additionalProps: {
106
+ ref: d
107
+ },
108
+ ownerState: f,
109
+ className: _.root
110
+ }), k = (r = n.thumb) != null ? r : "span", R = V({
111
+ elementType: k,
112
+ externalSlotProps: a.thumb,
113
+ ownerState: f,
114
+ className: _.thumb
115
+ }), C = (p = n.input) != null ? p : "input", F = V({
116
+ elementType: C,
117
+ getSlotProps: u,
118
+ externalSlotProps: a.input,
119
+ ownerState: f,
120
+ className: _.input
121
+ }), j = n.track === null ? () => null : (g = n.track) != null ? g : "span", t = V({
122
+ elementType: j,
123
+ externalSlotProps: a.track,
124
+ ownerState: f,
125
+ className: _.track
126
+ });
127
+ return /* @__PURE__ */ I(b, y({}, T, {
128
+ children: [/* @__PURE__ */ O(j, y({}, t)), /* @__PURE__ */ O(k, y({}, R)), /* @__PURE__ */ O(C, y({}, F))]
129
+ }));
130
+ });
131
+ process.env.NODE_ENV !== "production" && (E.propTypes = {
132
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
133
+ // │ These PropTypes are generated from the TypeScript type definitions. │
134
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
135
+ // └─────────────────────────────────────────────────────────────────────┘
136
+ /**
137
+ * If `true`, the component is checked.
138
+ */
139
+ checked: e.bool,
140
+ /**
141
+ * Class name applied to the root element.
142
+ */
143
+ className: e.string,
144
+ /**
145
+ * The default checked state. Use when the component is not controlled.
146
+ */
147
+ defaultChecked: e.bool,
148
+ /**
149
+ * If `true`, the component is disabled.
150
+ */
151
+ disabled: e.bool,
152
+ /**
153
+ * @ignore
154
+ */
155
+ onBlur: e.func,
156
+ /**
157
+ * Callback fired when the state is changed.
158
+ *
159
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
160
+ * You can pull out the new value by accessing `event.target.value` (string).
161
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
162
+ */
163
+ onChange: e.func,
164
+ /**
165
+ * @ignore
166
+ */
167
+ onFocus: e.func,
168
+ /**
169
+ * @ignore
170
+ */
171
+ onFocusVisible: e.func,
172
+ /**
173
+ * If `true`, the component is read only.
174
+ */
175
+ readOnly: e.bool,
176
+ /**
177
+ * If `true`, the `input` element is required.
178
+ */
179
+ required: e.bool,
180
+ /**
181
+ * The props used for each slot inside the Switch.
182
+ * @default {}
183
+ */
184
+ slotProps: e.shape({
185
+ input: e.oneOfType([e.func, e.object]),
186
+ root: e.oneOfType([e.func, e.object]),
187
+ thumb: e.oneOfType([e.func, e.object]),
188
+ track: e.oneOfType([e.func, e.object])
189
+ }),
190
+ /**
191
+ * The components used for each slot inside the Switch.
192
+ * Either a string to use a HTML element or a component.
193
+ * @default {}
194
+ */
195
+ slots: e.shape({
196
+ input: e.elementType,
197
+ root: e.elementType,
198
+ thumb: e.elementType,
199
+ track: e.oneOfType([e.elementType, e.oneOf([null])])
200
+ })
201
+ });
202
+ const K = "_toggle_r6ihm_1", Q = "_input_r6ihm_15", X = "_thumb_r6ihm_26", Y = "_track_r6ihm_40", Z = "_toggle__label_r6ihm_64", i = {
203
+ toggle: K,
204
+ "toggle__toggle-el-wrapper": "_toggle__toggle-el-wrapper_r6ihm_11",
205
+ input: Q,
206
+ thumb: X,
207
+ track: Y,
208
+ "toggle--focus-visible": "_toggle--focus-visible_r6ihm_50",
209
+ "toggle--checked": "_toggle--checked_r6ihm_54",
210
+ toggle__label: Z,
211
+ "toggle--disabled": "_toggle--disabled_r6ihm_69"
212
+ }, ne = ({
213
+ onChange: l,
214
+ label: o,
215
+ disabled: d,
216
+ checked: c = !1,
217
+ autoFocus: r,
218
+ classNameWrapper: p,
219
+ classNameLabel: g,
220
+ classNameInput: a,
221
+ "data-testid": n
222
+ }) => {
223
+ const P = (u) => {
224
+ l == null || l(u);
225
+ };
226
+ return /* @__PURE__ */ I("div", { className: N(i.toggle, p), "data-testid": n, children: [
227
+ /* @__PURE__ */ O(
228
+ E,
229
+ {
230
+ disabled: d,
231
+ checked: c,
232
+ autoFocus: r,
233
+ onChange: P,
234
+ "aria-label": o,
235
+ slotProps: {
236
+ root: (u) => ({
237
+ className: N(i["toggle__toggle-el-wrapper"], {
238
+ [i["toggle--disabled"]]: u.disabled,
239
+ [i["toggle--focus-visible"]]: u.focusVisible,
240
+ [i["toggle--checked"]]: u.checked
241
+ })
242
+ }),
243
+ input: {
244
+ className: N(i.input, a)
245
+ },
246
+ thumb: { className: i.thumb },
247
+ track: { className: i.track }
248
+ }
249
+ }
250
+ ),
251
+ o && /* @__PURE__ */ O("label", { className: N(i.toggle__label, g), children: o })
252
+ ] });
253
+ };
254
+ export {
255
+ ne as Toggle
256
+ };