@pismo/marola 1.0.0-beta.23 → 1.0.0-beta.25

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.
@@ -4,11 +4,13 @@ export interface TabProps {
4
4
  /** The value to be showing in the tab */
5
5
  children: ReactNode;
6
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! */
7
+ * e.g. value="1" when this tab is clicked it will show the panel which also has value="1" */
8
8
  value: string | number;
9
9
  /** Disable clicking the tab */
10
10
  disabled?: boolean;
11
- /** data test id */
12
- dataTestId?: string;
11
+ /** CSS classes to be applied on the container element */
12
+ className?: string;
13
+ /** Id to be applied as `data-testid` on the container element */
14
+ 'data-testid'?: string;
13
15
  }
14
16
  export declare const Tab: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,9 +1,9 @@
1
1
  import { jsx as N } from "react/jsx-runtime";
2
- import * as f from "react";
2
+ import * as b from "react";
3
3
  import { forwardRef as H, useContext as U, useMemo as j } from "react";
4
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 "../../useSlotProps-C_I1kEHr.js";
5
+ import { u as B, T as D, s as y } from "../../Tabs.module-BGGTkDc5.js";
6
+ import { g as L, a as W, u as O, f as $, b as f, _ as q, c as z, P as e, d as A, e as G } from "../../useSlotProps-C_I1kEHr.js";
7
7
  import { u as J, c as K } from "../../combineHooksSlotProps-C-zYvfnF.js";
8
8
  import { u as Q } from "../../useId-BW-oWmul.js";
9
9
  import { u as X } from "../../useButton-DcihopJG.js";
@@ -22,27 +22,27 @@ function te(o) {
22
22
  rootRef: s,
23
23
  disabled: n = !1,
24
24
  id: c
25
- } = o, a = f.useRef(null), r = Q(c), {
26
- value: b,
25
+ } = o, r = b.useRef(null), a = Q(c), {
26
+ value: i,
27
27
  selectionFollowsFocus: p,
28
28
  getTabPanelId: m
29
- } = B(), P = f.useMemo(() => ({
29
+ } = B(), P = b.useMemo(() => ({
30
30
  disabled: n,
31
- ref: a,
32
- id: r
33
- }), [n, a, r]), {
31
+ ref: r,
32
+ id: a
33
+ }), [n, r, a]), {
34
34
  id: l,
35
35
  index: R,
36
36
  totalItemCount: g
37
37
  } = Y(t ?? ee, P), {
38
38
  getRootProps: h,
39
39
  highlighted: T,
40
- selected: i
40
+ selected: u
41
41
  } = J({
42
42
  item: l
43
43
  }), {
44
44
  getRootProps: C,
45
- rootRef: u,
45
+ rootRef: d,
46
46
  active: v,
47
47
  focusVisible: I,
48
48
  setFocusVisible: V
@@ -50,15 +50,15 @@ function te(o) {
50
50
  disabled: n,
51
51
  focusableWhenDisabled: !p,
52
52
  type: "button"
53
- }), _ = O(a, s, u), M = l !== void 0 ? m(l) : void 0;
53
+ }), _ = O(r, s, d), M = l !== void 0 ? m(l) : void 0;
54
54
  return {
55
55
  getRootProps: (x = {}) => {
56
56
  const S = $(x), w = K(h, C);
57
- return d({}, x, w(S), {
57
+ return f({}, x, w(S), {
58
58
  role: "tab",
59
59
  "aria-controls": M,
60
- "aria-selected": i,
61
- id: r,
60
+ "aria-selected": u,
61
+ id: a,
62
62
  ref: _
63
63
  });
64
64
  },
@@ -69,7 +69,7 @@ function te(o) {
69
69
  rootRef: _,
70
70
  // the `selected` state isn't set on the server (it relies on effects to be calculated),
71
71
  // so we fall back to checking the `value` prop with the selectedValue from the TabsContext
72
- selected: i || l === b,
72
+ selected: u || l === i,
73
73
  setFocusVisible: V,
74
74
  totalTabsCount: g
75
75
  };
@@ -82,39 +82,39 @@ const oe = ["action", "children", "disabled", "onChange", "onClick", "onFocus",
82
82
  return A({
83
83
  root: ["root", t && "selected", s && "disabled"]
84
84
  }, G(Z));
85
- }, F = /* @__PURE__ */ f.forwardRef(function(t, s) {
85
+ }, F = /* @__PURE__ */ b.forwardRef(function(t, s) {
86
86
  var n;
87
87
  const {
88
88
  children: c,
89
- disabled: a = !1,
90
- slotProps: r = {},
91
- slots: b = {},
89
+ disabled: r = !1,
90
+ slotProps: a = {},
91
+ slots: i = {},
92
92
  value: p
93
- } = t, m = q(t, oe), P = f.useRef(), l = O(P, s), {
93
+ } = t, m = q(t, oe), P = b.useRef(), l = O(P, s), {
94
94
  active: R,
95
95
  highlighted: g,
96
96
  selected: h,
97
97
  getRootProps: T
98
- } = te(d({}, t, {
98
+ } = te(f({}, t, {
99
99
  rootRef: l,
100
100
  value: p
101
- })), i = d({}, t, {
101
+ })), u = f({}, t, {
102
102
  active: R,
103
- disabled: a,
103
+ disabled: r,
104
104
  highlighted: g,
105
105
  selected: h
106
- }), C = se(i), u = (n = b.root) != null ? n : "button", v = z({
107
- elementType: u,
106
+ }), C = se(u), d = (n = i.root) != null ? n : "button", v = z({
107
+ elementType: d,
108
108
  getSlotProps: T,
109
- externalSlotProps: r.root,
109
+ externalSlotProps: a.root,
110
110
  externalForwardedProps: m,
111
111
  additionalProps: {
112
112
  ref: s
113
113
  },
114
- ownerState: i,
114
+ ownerState: u,
115
115
  className: C.root
116
116
  });
117
- return /* @__PURE__ */ N(u, d({}, v, {
117
+ return /* @__PURE__ */ N(d, f({}, v, {
118
118
  children: c
119
119
  }));
120
120
  });
@@ -165,16 +165,17 @@ process.env.NODE_ENV !== "production" && (F.propTypes = {
165
165
  value: e.oneOfType([e.number, e.string])
166
166
  });
167
167
  const pe = H(
168
- ({ children: o, value: t, disabled: s, dataTestId: n }, c) => {
169
- const a = U(D), r = j(
168
+ ({ children: o, value: t, disabled: s, className: n, "data-testid": c }, r) => {
169
+ const a = U(D), i = j(
170
170
  () => k(
171
171
  y.tabs__tab,
172
172
  t === (a == null ? void 0 : a.value) && y["tabs__tab--selected"],
173
- s && y["tabs__tab--disabled"]
173
+ s && y["tabs__tab--disabled"],
174
+ n
174
175
  ),
175
176
  [t, a, s]
176
177
  );
177
- return /* @__PURE__ */ N(F, { className: r, disabled: s, value: t, "data-testid": n, ref: c, children: o });
178
+ return /* @__PURE__ */ N(F, { className: i, disabled: s, value: t, "data-testid": c, ref: r, children: o });
178
179
  }
179
180
  );
180
181
  export {
@@ -6,7 +6,9 @@ export interface TabPanelProps {
6
6
  /** The value that identifies which tab is selected.
7
7
  * e.g. value="1" when the tab button with the value="1" is selected this content will show */
8
8
  value: string | number;
9
- /** Test id */
10
- dataTestId?: string;
9
+ /** CSS classes to be applied on the container element */
10
+ className?: string;
11
+ /** Id to be applied as `data-testid` on the container element */
12
+ 'data-testid'?: string;
11
13
  }
12
14
  export declare const TabPanel: import('react').ForwardRefExoticComponent<TabPanelProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,79 +1,80 @@
1
1
  import { jsx as T } from "react/jsx-runtime";
2
2
  import * as P from "react";
3
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 "../../useSlotProps-C_I1kEHr.js";
6
- import { u as S } from "../../useId-BW-oWmul.js";
7
- import { u as U } from "../../useCompoundItem-B7Eo_qZk.js";
4
+ import { c as y } from "../../clsx-DB4S2d7J.js";
5
+ import { u as x, s as C } from "../../Tabs.module-BGGTkDc5.js";
6
+ import { g as N, a as _, u as w, b, _ as O, c as E, P as o, d as I, e as S } from "../../useSlotProps-C_I1kEHr.js";
7
+ import { u as U } from "../../useId-BW-oWmul.js";
8
+ import { u as j } from "../../useCompoundItem-B7Eo_qZk.js";
8
9
  const h = "TabPanel";
9
- function j(t) {
10
- return C(h, t);
11
- }
12
- N(h, ["root", "hidden"]);
13
10
  function M(t) {
14
- return t.size;
11
+ return N(h, t);
15
12
  }
13
+ _(h, ["root", "hidden"]);
16
14
  function V(t) {
15
+ return t.size;
16
+ }
17
+ function F(t) {
17
18
  const {
18
19
  value: e,
19
20
  id: s,
20
21
  rootRef: n
21
- } = t, i = y();
22
- if (i === null)
22
+ } = t, a = x();
23
+ if (a === null)
23
24
  throw new Error("No TabContext provided");
24
25
  const {
25
26
  value: f,
26
27
  getTabId: m
27
- } = i, r = S(s), a = P.useRef(null), u = _(a, n), c = P.useMemo(() => ({
28
+ } = a, r = U(s), l = P.useRef(null), c = w(l, n), u = P.useMemo(() => ({
28
29
  id: r,
29
- ref: a
30
+ ref: l
30
31
  }), [r]), {
31
- id: l
32
- } = U(e ?? M, c), d = l !== f, p = l !== void 0 ? m(l) : void 0;
32
+ id: d
33
+ } = j(e ?? V, u), i = d !== f, p = d !== void 0 ? m(d) : void 0;
33
34
  return {
34
- hidden: d,
35
+ hidden: i,
35
36
  getRootProps: (g = {}) => b({
36
37
  "aria-labelledby": p ?? void 0,
37
- hidden: d,
38
+ hidden: i,
38
39
  id: r ?? void 0
39
40
  }, g, {
40
- ref: u
41
+ ref: c
41
42
  }),
42
- rootRef: u
43
+ rootRef: c
43
44
  };
44
45
  }
45
- const F = ["children", "value", "slotProps", "slots"], $ = (t) => {
46
+ const $ = ["children", "value", "slotProps", "slots"], k = (t) => {
46
47
  const {
47
48
  hidden: e
48
49
  } = t;
49
- return E({
50
+ return I({
50
51
  root: ["root", e && "hidden"]
51
- }, I(j));
52
+ }, S(M));
52
53
  }, R = /* @__PURE__ */ P.forwardRef(function(e, s) {
53
54
  var n;
54
55
  const {
55
- children: i,
56
+ children: a,
56
57
  slotProps: f = {},
57
58
  slots: m = {}
58
- } = e, r = w(e, F), {
59
- hidden: a,
60
- getRootProps: u
61
- } = V(e), c = b({}, e, {
62
- hidden: a
63
- }), l = $(c), d = (n = m.root) != null ? n : "div", p = O({
64
- elementType: d,
65
- getSlotProps: u,
59
+ } = e, r = O(e, $), {
60
+ hidden: l,
61
+ getRootProps: c
62
+ } = F(e), u = b({}, e, {
63
+ hidden: l
64
+ }), d = k(u), i = (n = m.root) != null ? n : "div", p = E({
65
+ elementType: i,
66
+ getSlotProps: c,
66
67
  externalSlotProps: f.root,
67
68
  externalForwardedProps: r,
68
69
  additionalProps: {
69
70
  role: "tabpanel",
70
71
  ref: s
71
72
  },
72
- ownerState: c,
73
- className: l.root
73
+ ownerState: u,
74
+ className: d.root
74
75
  });
75
- return /* @__PURE__ */ T(d, b({}, p, {
76
- children: !a && i
76
+ return /* @__PURE__ */ T(i, b({}, p, {
77
+ children: !l && a
77
78
  }));
78
79
  });
79
80
  process.env.NODE_ENV !== "production" && (R.propTypes = {
@@ -111,9 +112,18 @@ process.env.NODE_ENV !== "production" && (R.propTypes = {
111
112
  */
112
113
  value: o.oneOfType([o.number, o.string])
113
114
  });
114
- const q = v(
115
- ({ 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
+ const H = v(
116
+ ({ children: t, value: e, className: s, "data-testid": n }, a) => /* @__PURE__ */ T(
117
+ R,
118
+ {
119
+ className: y(C["tabs__tab-panel"], s),
120
+ value: e,
121
+ "data-testid": n,
122
+ ref: a,
123
+ children: t
124
+ }
125
+ )
116
126
  );
117
127
  export {
118
- q as TabPanel
128
+ H as TabPanel
119
129
  };
@@ -4,11 +4,13 @@ export interface TabsProps {
4
4
  /** Should contain `Tab` and `TabPanel` components to be rendered */
5
5
  children?: ReactNode;
6
6
  /** Selected tab */
7
- value?: number | string;
7
+ value?: string | number | null;
8
+ /** CSS classes to be applied on the container element */
9
+ className?: string;
10
+ /** Id to be applied as `data-testid` on the container element */
11
+ 'data-testid'?: string;
8
12
  /** 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;
13
+ onChange?: (tabValue: string | number | null, event?: React.SyntheticEvent<Element, Event> | null) => void;
12
14
  }
13
15
  export declare const Tabs: import('react').ForwardRefExoticComponent<TabsProps & import('react').RefAttributes<HTMLDivElement>>;
14
16
  export * from './Tab';