@pismo/marola 1.1.22 → 1.2.0
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.
- package/dist/Tabs.module-CF9eCJzU.js +28 -0
- package/dist/assets/Tabs.css +1 -1
- package/dist/components/Tabs/Tab.d.ts +3 -0
- package/dist/components/Tabs/Tab.js +100 -98
- package/dist/components/Tabs/Tab.stories.d.ts +2 -0
- package/dist/components/Tabs/TabPanel.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.stories.d.ts +1 -0
- package/package.json +1 -1
- package/dist/Tabs.module-ia-imLti.js +0 -25
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as _ from "react";
|
|
2
|
+
import './assets/Tabs.css';const a = /* @__PURE__ */ _.createContext(null);
|
|
3
|
+
process.env.NODE_ENV !== "production" && (a.displayName = "TabsContext");
|
|
4
|
+
function e() {
|
|
5
|
+
const t = _.useContext(a);
|
|
6
|
+
if (t == null)
|
|
7
|
+
throw new Error("No TabsContext provided");
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
const s = "_tabs_1ve9u_1", b = "_tabs__tab_1ve9u_5", i = {
|
|
11
|
+
tabs: s,
|
|
12
|
+
tabs__tab: b,
|
|
13
|
+
"tabs__tab--disabled": "_tabs__tab--disabled_1ve9u_23",
|
|
14
|
+
"tabs__tab--selected": "_tabs__tab--selected_1ve9u_32",
|
|
15
|
+
"tabs__tab--chip": "_tabs__tab--chip_1ve9u_36",
|
|
16
|
+
"tabs__tab--chip--disabled": "_tabs__tab--chip--disabled_1ve9u_64",
|
|
17
|
+
"tabs__tab-panel": "_tabs__tab-panel_1ve9u_74",
|
|
18
|
+
"tabs__tab-icon": "_tabs__tab-icon_1ve9u_78",
|
|
19
|
+
"tabs__tab-indicative": "_tabs__tab-indicative_1ve9u_83",
|
|
20
|
+
"tabs__tab-indicative--empty": "_tabs__tab-indicative--empty_1ve9u_86",
|
|
21
|
+
"tabs__tab-indicative--success": "_tabs__tab-indicative--success_1ve9u_101",
|
|
22
|
+
"tabs__tab-content": "_tabs__tab-content_1ve9u_115"
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
a as T,
|
|
26
|
+
i as s,
|
|
27
|
+
e as u
|
|
28
|
+
};
|
package/dist/assets/Tabs.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._tabs_1ve9u_1{gap:8px;width:100%}._tabs__tab_1ve9u_5{min-width:94px;height:48px;padding:0 4px;color:var(--gray-75);cursor:pointer;background-color:transparent;border:none;border-bottom:2px solid transparent}._tabs__tab_1ve9u_5:hover{color:var(--hover);border-bottom:2px solid var(--hover)}._tabs__tab_1ve9u_5:active{color:var(--active);border-bottom:2px solid var(--active)}._tabs__tab--disabled_1ve9u_23{color:#00000040;cursor:default;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--disabled_1ve9u_23:focus,._tabs__tab--disabled_1ve9u_23:active,._tabs__tab--disabled_1ve9u_23:hover{color:#00000040;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--selected_1ve9u_32{color:var(--accent);border-bottom:2px solid var(--accent)}._tabs__tab--selected_1ve9u_32._tabs__tab--chip_1ve9u_36{color:var(--accent);border-color:var(--accent)}._tabs__tab--chip_1ve9u_36{display:flex;align-items:center;justify-content:center;min-width:auto;height:32px;padding:0 15px;font-size:.875rem;font-weight:var(--base-bold);line-height:22px;color:var(--gray-95);background-color:transparent;border:1px solid var(--border);border-radius:var(--border-radius)}._tabs__tab--chip_1ve9u_36:hover{color:var(--hover);border-color:var(--hover);border-bottom:1px solid var(--hover)}._tabs__tab--chip_1ve9u_36:active{color:var(--active);border-color:var(--active)}._tabs__tab--chip--disabled_1ve9u_64{color:#00000040;cursor:default;border:1px solid rgba(0,0,0,.25)}._tabs__tab--chip--disabled_1ve9u_64:focus,._tabs__tab--chip--disabled_1ve9u_64:active,._tabs__tab--chip--disabled_1ve9u_64:hover{color:#00000040;background-color:transparent;border:1px solid rgba(0,0,0,.25)}._tabs__tab-panel_1ve9u_74{width:100%;margin-top:16px}._tabs__tab-icon_1ve9u_78{width:16px;height:16px;margin-right:4px}._tabs__tab-indicative_1ve9u_83{margin-right:.5rem}._tabs__tab-indicative--empty_1ve9u_86{width:.5rem;height:.5rem;display:inline-flex;position:relative;margin-right:.6rem}._tabs__tab-indicative--empty_1ve9u_86>*{transform:scale(1.2);position:absolute;left:0;top:0;width:100%;height:100%}._tabs__tab-indicative--success_1ve9u_101{display:inline-flex;align-items:center;width:.5rem;height:.5rem}._tabs__tab-indicative--success_1ve9u_101:before{content:" ";display:inline-flex;background-color:var(--green-6);border-radius:100%;width:.5rem;height:.5rem}._tabs__tab-content_1ve9u_115{display:flex;align-items:center;justify-content:center;width:100%}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconName } from '../Icon/types.ts';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
export type IndicativeType = 'empty' | 'success';
|
|
4
5
|
export interface TabProps {
|
|
5
6
|
/** The value to be showing in the tab */
|
|
6
7
|
children: ReactNode;
|
|
@@ -15,6 +16,8 @@ export interface TabProps {
|
|
|
15
16
|
'data-testid'?: string;
|
|
16
17
|
/** Icon to be displayed in the tab */
|
|
17
18
|
icon?: IconName | ReactNode;
|
|
19
|
+
/** Ref to be passed to the container element */
|
|
20
|
+
indicative?: IndicativeType;
|
|
18
21
|
/** Is the tab a chip */
|
|
19
22
|
chip?: boolean;
|
|
20
23
|
/** Show a loading skeleton */
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Skeleton as
|
|
7
|
-
import { u as
|
|
8
|
-
import { g as
|
|
1
|
+
import { jsx as u, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import * as P from "react";
|
|
3
|
+
import { forwardRef as U, useContext as z, useMemo as B } from "react";
|
|
4
|
+
import { c as x } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import { Icon as O } from "../Icon/Icon.js";
|
|
6
|
+
import { Skeleton as D } from "../Skeleton/Skeleton.js";
|
|
7
|
+
import { u as L, T as W, s as o } from "../../Tabs.module-CF9eCJzU.js";
|
|
8
|
+
import { g as $, a as q, u as E, f as A, b as h, _ as G, c as J, P as e, d as K, e as Q } from "../../useSlotProps-C_I1kEHr.js";
|
|
9
9
|
import { u as X, c as Y } from "../../combineHooksSlotProps-C-zYvfnF.js";
|
|
10
10
|
import { u as Z } from "../../useId-BW-oWmul.js";
|
|
11
11
|
import { u as ee } from "../../useButton-DcihopJG.js";
|
|
12
12
|
import { u as te } from "../../useCompoundItem-B7Eo_qZk.js";
|
|
13
|
-
const
|
|
14
|
-
function se(
|
|
15
|
-
return
|
|
13
|
+
const F = "Tab";
|
|
14
|
+
function se(a) {
|
|
15
|
+
return $(F, a);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
function oe(
|
|
19
|
-
return
|
|
17
|
+
q(F, ["root", "selected", "disabled"]);
|
|
18
|
+
function oe(a) {
|
|
19
|
+
return a.size;
|
|
20
20
|
}
|
|
21
|
-
function ae(
|
|
21
|
+
function ae(a) {
|
|
22
22
|
const {
|
|
23
23
|
value: t,
|
|
24
24
|
rootRef: s,
|
|
25
|
-
disabled:
|
|
26
|
-
id:
|
|
27
|
-
} =
|
|
28
|
-
value:
|
|
29
|
-
selectionFollowsFocus:
|
|
30
|
-
getTabPanelId:
|
|
31
|
-
} =
|
|
32
|
-
disabled:
|
|
33
|
-
ref:
|
|
34
|
-
id:
|
|
35
|
-
}), [
|
|
36
|
-
id:
|
|
25
|
+
disabled: l = !1,
|
|
26
|
+
id: b
|
|
27
|
+
} = a, n = P.useRef(null), r = Z(b), {
|
|
28
|
+
value: p,
|
|
29
|
+
selectionFollowsFocus: c,
|
|
30
|
+
getTabPanelId: f
|
|
31
|
+
} = L(), i = P.useMemo(() => ({
|
|
32
|
+
disabled: l,
|
|
33
|
+
ref: n,
|
|
34
|
+
id: r
|
|
35
|
+
}), [l, n, r]), {
|
|
36
|
+
id: d,
|
|
37
37
|
index: g,
|
|
38
|
-
totalItemCount:
|
|
39
|
-
} = te(t ?? oe,
|
|
40
|
-
getRootProps:
|
|
41
|
-
highlighted:
|
|
42
|
-
selected:
|
|
38
|
+
totalItemCount: R
|
|
39
|
+
} = te(t ?? oe, i), {
|
|
40
|
+
getRootProps: T,
|
|
41
|
+
highlighted: y,
|
|
42
|
+
selected: m
|
|
43
43
|
} = X({
|
|
44
|
-
item:
|
|
44
|
+
item: d
|
|
45
45
|
}), {
|
|
46
|
-
getRootProps:
|
|
47
|
-
rootRef:
|
|
48
|
-
active:
|
|
49
|
-
focusVisible:
|
|
50
|
-
setFocusVisible:
|
|
46
|
+
getRootProps: C,
|
|
47
|
+
rootRef: _,
|
|
48
|
+
active: v,
|
|
49
|
+
focusVisible: V,
|
|
50
|
+
setFocusVisible: w
|
|
51
51
|
} = ee({
|
|
52
|
-
disabled:
|
|
53
|
-
focusableWhenDisabled: !
|
|
52
|
+
disabled: l,
|
|
53
|
+
focusableWhenDisabled: !c,
|
|
54
54
|
type: "button"
|
|
55
|
-
}),
|
|
55
|
+
}), N = E(n, s, _), M = d !== void 0 ? f(d) : void 0;
|
|
56
56
|
return {
|
|
57
|
-
getRootProps: (
|
|
58
|
-
const
|
|
59
|
-
return h({},
|
|
57
|
+
getRootProps: (I = {}) => {
|
|
58
|
+
const j = A(I), k = Y(T, C);
|
|
59
|
+
return h({}, I, k(j), {
|
|
60
60
|
role: "tab",
|
|
61
|
-
"aria-controls":
|
|
62
|
-
"aria-selected":
|
|
63
|
-
id:
|
|
64
|
-
ref:
|
|
61
|
+
"aria-controls": M,
|
|
62
|
+
"aria-selected": m,
|
|
63
|
+
id: r,
|
|
64
|
+
ref: N
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
|
-
active:
|
|
68
|
-
focusVisible:
|
|
69
|
-
highlighted:
|
|
67
|
+
active: v,
|
|
68
|
+
focusVisible: V,
|
|
69
|
+
highlighted: y,
|
|
70
70
|
index: g,
|
|
71
|
-
rootRef:
|
|
71
|
+
rootRef: N,
|
|
72
72
|
// the `selected` state isn't set on the server (it relies on effects to be calculated),
|
|
73
73
|
// so we fall back to checking the `value` prop with the selectedValue from the TabsContext
|
|
74
|
-
selected:
|
|
75
|
-
setFocusVisible:
|
|
76
|
-
totalTabsCount:
|
|
74
|
+
selected: m || d === p,
|
|
75
|
+
setFocusVisible: w,
|
|
76
|
+
totalTabsCount: R
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
const ne = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], re = (
|
|
79
|
+
const ne = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], re = (a) => {
|
|
80
80
|
const {
|
|
81
81
|
selected: t,
|
|
82
82
|
disabled: s
|
|
83
|
-
} =
|
|
83
|
+
} = a;
|
|
84
84
|
return K({
|
|
85
85
|
root: ["root", t && "selected", s && "disabled"]
|
|
86
86
|
}, Q(se));
|
|
87
|
-
},
|
|
88
|
-
var
|
|
87
|
+
}, S = /* @__PURE__ */ P.forwardRef(function(t, s) {
|
|
88
|
+
var l;
|
|
89
89
|
const {
|
|
90
|
-
children:
|
|
91
|
-
disabled:
|
|
92
|
-
slotProps:
|
|
93
|
-
slots:
|
|
94
|
-
value:
|
|
95
|
-
} = t,
|
|
90
|
+
children: b,
|
|
91
|
+
disabled: n = !1,
|
|
92
|
+
slotProps: r = {},
|
|
93
|
+
slots: p = {},
|
|
94
|
+
value: c
|
|
95
|
+
} = t, f = G(t, ne), i = P.useRef(), d = E(i, s), {
|
|
96
96
|
active: g,
|
|
97
|
-
highlighted:
|
|
98
|
-
selected:
|
|
99
|
-
getRootProps:
|
|
97
|
+
highlighted: R,
|
|
98
|
+
selected: T,
|
|
99
|
+
getRootProps: y
|
|
100
100
|
} = ae(h({}, t, {
|
|
101
|
-
rootRef:
|
|
102
|
-
value:
|
|
103
|
-
})),
|
|
101
|
+
rootRef: d,
|
|
102
|
+
value: c
|
|
103
|
+
})), m = h({}, t, {
|
|
104
104
|
active: g,
|
|
105
|
-
disabled:
|
|
106
|
-
highlighted:
|
|
107
|
-
selected:
|
|
108
|
-
}),
|
|
109
|
-
elementType:
|
|
110
|
-
getSlotProps:
|
|
111
|
-
externalSlotProps:
|
|
112
|
-
externalForwardedProps:
|
|
105
|
+
disabled: n,
|
|
106
|
+
highlighted: R,
|
|
107
|
+
selected: T
|
|
108
|
+
}), C = re(m), _ = (l = p.root) != null ? l : "button", v = J({
|
|
109
|
+
elementType: _,
|
|
110
|
+
getSlotProps: y,
|
|
111
|
+
externalSlotProps: r.root,
|
|
112
|
+
externalForwardedProps: f,
|
|
113
113
|
additionalProps: {
|
|
114
114
|
ref: s
|
|
115
115
|
},
|
|
116
|
-
ownerState:
|
|
117
|
-
className:
|
|
116
|
+
ownerState: m,
|
|
117
|
+
className: C.root
|
|
118
118
|
});
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
children:
|
|
119
|
+
return /* @__PURE__ */ u(_, h({}, v, {
|
|
120
|
+
children: b
|
|
121
121
|
}));
|
|
122
122
|
});
|
|
123
|
-
process.env.NODE_ENV !== "production" && (
|
|
123
|
+
process.env.NODE_ENV !== "production" && (S.propTypes = {
|
|
124
124
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
125
125
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
126
126
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
@@ -166,22 +166,24 @@ process.env.NODE_ENV !== "production" && (E.propTypes = {
|
|
|
166
166
|
*/
|
|
167
167
|
value: e.oneOfType([e.number, e.string])
|
|
168
168
|
});
|
|
169
|
-
const ge =
|
|
170
|
-
({ children:
|
|
171
|
-
const
|
|
172
|
-
() =>
|
|
173
|
-
|
|
174
|
-
t === (
|
|
175
|
-
s && !
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
const ge = U(
|
|
170
|
+
({ children: a, value: t, disabled: s, className: l, "data-testid": b, icon: n, chip: r, isLoading: p, indicative: c }, f) => {
|
|
171
|
+
const i = z(W), d = B(
|
|
172
|
+
() => x(
|
|
173
|
+
o.tabs__tab,
|
|
174
|
+
t === (i == null ? void 0 : i.value) && o["tabs__tab--selected"],
|
|
175
|
+
s && !r && o["tabs__tab--disabled"],
|
|
176
|
+
r && o["tabs__tab--chip"],
|
|
177
|
+
r && s && o["tabs__tab--chip--disabled"],
|
|
178
|
+
l
|
|
179
179
|
),
|
|
180
|
-
[t,
|
|
180
|
+
[t, i, s, r]
|
|
181
181
|
);
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
|
|
184
|
-
o
|
|
182
|
+
return /* @__PURE__ */ u(S, { className: d, disabled: s, value: t, "data-testid": b, ref: f, children: p ? /* @__PURE__ */ u(D, { style: { width: "50px", margin: "auto" } }) : /* @__PURE__ */ H("div", { className: o["tabs__tab-content"], children: [
|
|
183
|
+
c && c === "empty" && /* @__PURE__ */ u("span", { className: x(o["tabs__tab-indicative"], o["tabs__tab-indicative--empty"]), children: /* @__PURE__ */ u(O, { icon: "empty-set", size: 10, color: "var(--orange-6)" }) }),
|
|
184
|
+
c && c === "success" && /* @__PURE__ */ u("span", { className: x(o["tabs__tab-indicative"], o["tabs__tab-indicative--success"]) }),
|
|
185
|
+
n && /* @__PURE__ */ u("span", { className: o["tabs__tab-icon"], children: typeof n == "string" ? /* @__PURE__ */ u(O, { icon: n }) : n }),
|
|
186
|
+
a
|
|
185
187
|
] }) });
|
|
186
188
|
}
|
|
187
189
|
);
|
|
@@ -2,7 +2,7 @@ import { jsx as T } from "react/jsx-runtime";
|
|
|
2
2
|
import * as P from "react";
|
|
3
3
|
import { forwardRef as v } from "react";
|
|
4
4
|
import { c as y } from "../../clsx-DB4S2d7J.js";
|
|
5
|
-
import { u as x, s as C } from "../../Tabs.module-
|
|
5
|
+
import { u as x, s as C } from "../../Tabs.module-CF9eCJzU.js";
|
|
6
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
7
|
import { u as U } from "../../useId-BW-oWmul.js";
|
|
8
8
|
import { u as j } from "../../useCompoundItem-B7Eo_qZk.js";
|
|
@@ -2,7 +2,7 @@ import { jsx as T } from "react/jsx-runtime";
|
|
|
2
2
|
import * as r from "react";
|
|
3
3
|
import { forwardRef as q } from "react";
|
|
4
4
|
import { c as B } from "../../clsx-DB4S2d7J.js";
|
|
5
|
-
import { T as G, u as J, s as Q } from "../../Tabs.module-
|
|
5
|
+
import { T as G, u as J, s as Q } from "../../Tabs.module-CF9eCJzU.js";
|
|
6
6
|
import { Tab as Ie } from "./Tab.js";
|
|
7
7
|
import { TabPanel as Fe } from "./TabPanel.js";
|
|
8
8
|
import { g as I, a as _, b as C, _ as F, c as $, P as t, d as N, e as w } from "../../useSlotProps-C_I1kEHr.js";
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as _ from "react";
|
|
2
|
-
import './assets/Tabs.css';const a = /* @__PURE__ */ _.createContext(null);
|
|
3
|
-
process.env.NODE_ENV !== "production" && (a.displayName = "TabsContext");
|
|
4
|
-
function e() {
|
|
5
|
-
const t = _.useContext(a);
|
|
6
|
-
if (t == null)
|
|
7
|
-
throw new Error("No TabsContext provided");
|
|
8
|
-
return t;
|
|
9
|
-
}
|
|
10
|
-
const s = "_tabs_1ldid_1", b = "_tabs__tab_1ldid_5", d = {
|
|
11
|
-
tabs: s,
|
|
12
|
-
tabs__tab: b,
|
|
13
|
-
"tabs__tab--disabled": "_tabs__tab--disabled_1ldid_23",
|
|
14
|
-
"tabs__tab--selected": "_tabs__tab--selected_1ldid_32",
|
|
15
|
-
"tabs__tab--chip": "_tabs__tab--chip_1ldid_36",
|
|
16
|
-
"tabs__tab--chip--disabled": "_tabs__tab--chip--disabled_1ldid_64",
|
|
17
|
-
"tabs__tab-panel": "_tabs__tab-panel_1ldid_74",
|
|
18
|
-
"tabs__tab-icon": "_tabs__tab-icon_1ldid_78",
|
|
19
|
-
"tabs__tab-content": "_tabs__tab-content_1ldid_83"
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
a as T,
|
|
23
|
-
d as s,
|
|
24
|
-
e as u
|
|
25
|
-
};
|