@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
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as H, useContext as U, useMemo as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as Y } from "../../
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
A(I, ["root", "selected", "disabled"]);
|
|
18
|
+
function ae(s) {
|
|
19
|
+
return s.size;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function ne(s) {
|
|
21
22
|
const {
|
|
22
23
|
value: t,
|
|
23
|
-
rootRef:
|
|
24
|
+
rootRef: o,
|
|
24
25
|
disabled: r = !1,
|
|
25
|
-
id:
|
|
26
|
-
} =
|
|
27
|
-
value:
|
|
28
|
-
selectionFollowsFocus:
|
|
29
|
-
getTabPanelId:
|
|
30
|
-
} =
|
|
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:
|
|
38
|
-
} =
|
|
39
|
-
getRootProps:
|
|
40
|
-
highlighted:
|
|
41
|
-
selected:
|
|
42
|
-
} =
|
|
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:
|
|
46
|
-
rootRef:
|
|
46
|
+
getRootProps: y,
|
|
47
|
+
rootRef: P,
|
|
47
48
|
active: v,
|
|
48
|
-
focusVisible:
|
|
49
|
-
setFocusVisible:
|
|
50
|
-
} =
|
|
49
|
+
focusVisible: E,
|
|
50
|
+
setFocusVisible: S
|
|
51
|
+
} = te({
|
|
51
52
|
disabled: r,
|
|
52
|
-
focusableWhenDisabled: !
|
|
53
|
+
focusableWhenDisabled: !b,
|
|
53
54
|
type: "button"
|
|
54
|
-
}), x =
|
|
55
|
+
}), x = F(a, o, P), V = c !== void 0 ? l(c) : void 0;
|
|
55
56
|
return {
|
|
56
57
|
getRootProps: (N = {}) => {
|
|
57
|
-
const
|
|
58
|
-
return
|
|
58
|
+
const w = G(N), M = Z(_, y);
|
|
59
|
+
return h({}, N, M(w), {
|
|
59
60
|
role: "tab",
|
|
60
|
-
"aria-controls":
|
|
61
|
-
"aria-selected":
|
|
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:
|
|
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:
|
|
74
|
-
setFocusVisible:
|
|
75
|
-
totalTabsCount:
|
|
74
|
+
selected: p || c === u,
|
|
75
|
+
setFocusVisible: S,
|
|
76
|
+
totalTabsCount: T
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
|
-
const
|
|
79
|
+
const re = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], le = (s) => {
|
|
79
80
|
const {
|
|
80
81
|
selected: t,
|
|
81
|
-
disabled:
|
|
82
|
-
} =
|
|
83
|
-
return
|
|
84
|
-
root: ["root", t && "selected",
|
|
85
|
-
},
|
|
86
|
-
},
|
|
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:
|
|
90
|
+
children: d,
|
|
90
91
|
disabled: a = !1,
|
|
91
92
|
slotProps: n = {},
|
|
92
|
-
slots:
|
|
93
|
-
value:
|
|
94
|
-
} = t,
|
|
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:
|
|
97
|
-
selected:
|
|
98
|
-
getRootProps:
|
|
99
|
-
} =
|
|
97
|
+
highlighted: T,
|
|
98
|
+
selected: _,
|
|
99
|
+
getRootProps: C
|
|
100
|
+
} = ne(h({}, t, {
|
|
100
101
|
rootRef: c,
|
|
101
|
-
value:
|
|
102
|
-
})),
|
|
102
|
+
value: b
|
|
103
|
+
})), p = h({}, t, {
|
|
103
104
|
active: g,
|
|
104
105
|
disabled: a,
|
|
105
|
-
highlighted:
|
|
106
|
-
selected:
|
|
107
|
-
}),
|
|
108
|
-
elementType:
|
|
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:
|
|
112
|
+
externalForwardedProps: l,
|
|
112
113
|
additionalProps: {
|
|
113
|
-
ref:
|
|
114
|
+
ref: o
|
|
114
115
|
},
|
|
115
|
-
ownerState:
|
|
116
|
-
className:
|
|
116
|
+
ownerState: p,
|
|
117
|
+
className: y.root
|
|
117
118
|
});
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
children:
|
|
119
|
+
return /* @__PURE__ */ m(P, h({}, v, {
|
|
120
|
+
children: d
|
|
120
121
|
}));
|
|
121
122
|
});
|
|
122
|
-
process.env.NODE_ENV !== "production" && (
|
|
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
|
|
169
|
-
({ children:
|
|
170
|
-
const l = U(
|
|
171
|
-
() =>
|
|
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
|
-
|
|
175
|
+
o && !n && i["tabs__tab--disabled"],
|
|
175
176
|
n && i["tabs__tab--chip"],
|
|
176
|
-
n &&
|
|
177
|
+
n && o && i["tabs__tab--chip--disabled"],
|
|
177
178
|
r
|
|
178
179
|
),
|
|
179
|
-
[t, l,
|
|
180
|
+
[t, l, o, n]
|
|
180
181
|
);
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
a && /* @__PURE__ */
|
|
183
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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"
|