@pismo/marola 1.0.7 → 1.0.9

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.
@@ -17,5 +17,7 @@ export interface TabProps {
17
17
  icon?: IconName | ReactNode;
18
18
  /** Is the tab a chip */
19
19
  chip?: boolean;
20
+ /** Show a loading skeleton */
21
+ isLoading?: boolean;
20
22
  }
21
23
  export declare const Tab: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,125 +1,126 @@
1
- import { jsx as y, jsxs as w } from "react/jsx-runtime";
2
- import * as P from "react";
3
- import { forwardRef as H, useContext as U, useMemo as k } from "react";
4
- import { c as B } from "../../clsx-DB4S2d7J.js";
5
- import { Icon as D } from "../Icon/Icon.js";
6
- import { u as L, T as W, s as i } from "../../Tabs.module-DSjBjg0Z.js";
7
- import { g as $, a as q, u as I, f as z, b as m, _ as A, c as G, P as e, d as J, e as K } from "../../useSlotProps-C_I1kEHr.js";
8
- import { u as Q, c as X } from "../../combineHooksSlotProps-C-zYvfnF.js";
9
- import { u as Y } from "../../useId-BW-oWmul.js";
10
- import { u as Z } from "../../useButton-DcihopJG.js";
11
- import { u as ee } from "../../useCompoundItem-B7Eo_qZk.js";
12
- const O = "Tab";
13
- function te(o) {
14
- return $(O, o);
1
+ import { jsx as m, jsxs as j, Fragment as k } from "react/jsx-runtime";
2
+ import * as R from "react";
3
+ import { forwardRef as H, useContext as U, useMemo as B } from "react";
4
+ import { c as D } from "../../clsx-DB4S2d7J.js";
5
+ import { Icon as L } from "../Icon/Icon.js";
6
+ import { Skeleton as W } from "../Skeleton/Skeleton.js";
7
+ import { u as $, T as q, s as i } from "../../Tabs.module-DSjBjg0Z.js";
8
+ import { g as z, a as A, u as F, f as G, b as h, _ as J, c as K, P as e, d as Q, e as X } from "../../useSlotProps-C_I1kEHr.js";
9
+ import { u as Y, c as Z } from "../../combineHooksSlotProps-C-zYvfnF.js";
10
+ import { u as ee } from "../../useId-BW-oWmul.js";
11
+ import { u as te } from "../../useButton-DcihopJG.js";
12
+ import { u as oe } from "../../useCompoundItem-B7Eo_qZk.js";
13
+ const I = "Tab";
14
+ function se(s) {
15
+ return z(I, s);
15
16
  }
16
- q(O, ["root", "selected", "disabled"]);
17
- function se(o) {
18
- return o.size;
17
+ A(I, ["root", "selected", "disabled"]);
18
+ function ae(s) {
19
+ return s.size;
19
20
  }
20
- function oe(o) {
21
+ function ne(s) {
21
22
  const {
22
23
  value: t,
23
- rootRef: s,
24
+ rootRef: o,
24
25
  disabled: r = !1,
25
- id: u
26
- } = o, a = P.useRef(null), n = Y(u), {
27
- value: d,
28
- selectionFollowsFocus: l,
29
- getTabPanelId: b
30
- } = L(), R = P.useMemo(() => ({
26
+ id: d
27
+ } = s, a = R.useRef(null), n = ee(d), {
28
+ value: u,
29
+ selectionFollowsFocus: b,
30
+ getTabPanelId: l
31
+ } = $(), f = R.useMemo(() => ({
31
32
  disabled: r,
32
33
  ref: a,
33
34
  id: n
34
35
  }), [r, a, n]), {
35
36
  id: c,
36
37
  index: g,
37
- totalItemCount: h
38
- } = ee(t ?? se, R), {
39
- getRootProps: T,
40
- highlighted: _,
41
- selected: f
42
- } = Q({
38
+ totalItemCount: T
39
+ } = oe(t ?? ae, f), {
40
+ getRootProps: _,
41
+ highlighted: C,
42
+ selected: p
43
+ } = Y({
43
44
  item: c
44
45
  }), {
45
- getRootProps: C,
46
- rootRef: p,
46
+ getRootProps: y,
47
+ rootRef: P,
47
48
  active: v,
48
- focusVisible: F,
49
- setFocusVisible: V
50
- } = Z({
49
+ focusVisible: E,
50
+ setFocusVisible: S
51
+ } = te({
51
52
  disabled: r,
52
- focusableWhenDisabled: !l,
53
+ focusableWhenDisabled: !b,
53
54
  type: "button"
54
- }), x = I(a, s, p), M = c !== void 0 ? b(c) : void 0;
55
+ }), x = F(a, o, P), V = c !== void 0 ? l(c) : void 0;
55
56
  return {
56
57
  getRootProps: (N = {}) => {
57
- const S = z(N), j = X(T, C);
58
- return m({}, N, j(S), {
58
+ const w = G(N), M = Z(_, y);
59
+ return h({}, N, M(w), {
59
60
  role: "tab",
60
- "aria-controls": M,
61
- "aria-selected": f,
61
+ "aria-controls": V,
62
+ "aria-selected": p,
62
63
  id: n,
63
64
  ref: x
64
65
  });
65
66
  },
66
67
  active: v,
67
- focusVisible: F,
68
- highlighted: _,
68
+ focusVisible: E,
69
+ highlighted: C,
69
70
  index: g,
70
71
  rootRef: x,
71
72
  // the `selected` state isn't set on the server (it relies on effects to be calculated),
72
73
  // so we fall back to checking the `value` prop with the selectedValue from the TabsContext
73
- selected: f || c === d,
74
- setFocusVisible: V,
75
- totalTabsCount: h
74
+ selected: p || c === u,
75
+ setFocusVisible: S,
76
+ totalTabsCount: T
76
77
  };
77
78
  }
78
- const ae = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], ne = (o) => {
79
+ const re = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], le = (s) => {
79
80
  const {
80
81
  selected: t,
81
- disabled: s
82
- } = o;
83
- return J({
84
- root: ["root", t && "selected", s && "disabled"]
85
- }, K(te));
86
- }, E = /* @__PURE__ */ P.forwardRef(function(t, s) {
82
+ disabled: o
83
+ } = s;
84
+ return Q({
85
+ root: ["root", t && "selected", o && "disabled"]
86
+ }, X(se));
87
+ }, O = /* @__PURE__ */ R.forwardRef(function(t, o) {
87
88
  var r;
88
89
  const {
89
- children: u,
90
+ children: d,
90
91
  disabled: a = !1,
91
92
  slotProps: n = {},
92
- slots: d = {},
93
- value: l
94
- } = t, b = A(t, ae), R = P.useRef(), c = I(R, s), {
93
+ slots: u = {},
94
+ value: b
95
+ } = t, l = J(t, re), f = R.useRef(), c = F(f, o), {
95
96
  active: g,
96
- highlighted: h,
97
- selected: T,
98
- getRootProps: _
99
- } = oe(m({}, t, {
97
+ highlighted: T,
98
+ selected: _,
99
+ getRootProps: C
100
+ } = ne(h({}, t, {
100
101
  rootRef: c,
101
- value: l
102
- })), f = m({}, t, {
102
+ value: b
103
+ })), p = h({}, t, {
103
104
  active: g,
104
105
  disabled: a,
105
- highlighted: h,
106
- selected: T
107
- }), C = ne(f), p = (r = d.root) != null ? r : "button", v = G({
108
- elementType: p,
109
- getSlotProps: _,
106
+ highlighted: T,
107
+ selected: _
108
+ }), y = le(p), P = (r = u.root) != null ? r : "button", v = K({
109
+ elementType: P,
110
+ getSlotProps: C,
110
111
  externalSlotProps: n.root,
111
- externalForwardedProps: b,
112
+ externalForwardedProps: l,
112
113
  additionalProps: {
113
- ref: s
114
+ ref: o
114
115
  },
115
- ownerState: f,
116
- className: C.root
116
+ ownerState: p,
117
+ className: y.root
117
118
  });
118
- return /* @__PURE__ */ y(p, m({}, v, {
119
- children: u
119
+ return /* @__PURE__ */ m(P, h({}, v, {
120
+ children: d
120
121
  }));
121
122
  });
122
- process.env.NODE_ENV !== "production" && (E.propTypes = {
123
+ process.env.NODE_ENV !== "production" && (O.propTypes = {
123
124
  // ┌────────────────────────────── Warning ──────────────────────────────┐
124
125
  // │ These PropTypes are generated from the TypeScript type definitions. │
125
126
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
@@ -165,25 +166,25 @@ process.env.NODE_ENV !== "production" && (E.propTypes = {
165
166
  */
166
167
  value: e.oneOfType([e.number, e.string])
167
168
  });
168
- const Re = H(
169
- ({ children: o, value: t, disabled: s, className: r, "data-testid": u, icon: a, chip: n }, d) => {
170
- const l = U(W), b = k(
171
- () => B(
169
+ const Te = H(
170
+ ({ children: s, value: t, disabled: o, className: r, "data-testid": d, icon: a, chip: n, isLoading: u }, b) => {
171
+ const l = U(q), f = B(
172
+ () => D(
172
173
  i.tabs__tab,
173
174
  t === (l == null ? void 0 : l.value) && i["tabs__tab--selected"],
174
- s && !n && i["tabs__tab--disabled"],
175
+ o && !n && i["tabs__tab--disabled"],
175
176
  n && i["tabs__tab--chip"],
176
- n && s && i["tabs__tab--chip--disabled"],
177
+ n && o && i["tabs__tab--chip--disabled"],
177
178
  r
178
179
  ),
179
- [t, l, s, n]
180
+ [t, l, o, n]
180
181
  );
181
- return /* @__PURE__ */ w(E, { className: b, disabled: s, value: t, "data-testid": u, ref: d, children: [
182
- a && /* @__PURE__ */ y("span", { className: i["tabs__tab-icon"], children: typeof a == "string" ? /* @__PURE__ */ y(D, { icon: a }) : a }),
183
- o
184
- ] });
182
+ return /* @__PURE__ */ m(O, { className: f, disabled: o, value: t, "data-testid": d, ref: b, children: u ? /* @__PURE__ */ m(W, { style: { width: "50px" } }) : /* @__PURE__ */ j(k, { children: [
183
+ a && /* @__PURE__ */ m("span", { className: i["tabs__tab-icon"], children: typeof a == "string" ? /* @__PURE__ */ m(L, { icon: a }) : a }),
184
+ s
185
+ ] }) });
185
186
  }
186
187
  );
187
188
  export {
188
- Re as Tab
189
+ Te as Tab
189
190
  };
@@ -15,5 +15,6 @@ export declare const Simple: Story;
15
15
  export declare const Icon: Story;
16
16
  export declare const Chip: Story;
17
17
  export declare const IconChip: Story;
18
+ export declare const Loading: Story;
18
19
  export declare const Disabled: Story;
19
20
  export declare const DisabledChip: Story;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -91,7 +91,7 @@
91
91
  "typescript": "^5.2.2",
92
92
  "vite": "^5.2.0",
93
93
  "vite-plugin-dts": "^3.8.1",
94
- "vite-plugin-lib-inject-css": "^2.0.1",
94
+ "vite-plugin-lib-inject-css": "^2.1.1",
95
95
  "vite-plugin-svgr": "^4.2.0",
96
96
  "vitest": "^1.4.0",
97
97
  "vitest-preview": "^0.0.1"