@iress-oss/ids-components 6.0.0-alpha.34 → 6.0.0-alpha.35
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/components/TabSet/TabSet.js +33 -32
- package/dist/components/TabSet/TabSet.styles.d.ts +0 -6
- package/dist/components/TabSet/TabSet.styles.js +0 -6
- package/dist/components/TabSet/TabSetProvider.js +75 -65
- package/dist/patterns/Shadow/Shadow.js +24 -18899
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as v, Fragment as q } from "react/jsx-runtime";
|
|
2
2
|
import { C as z } from "../../floating-ui.react-B0nDXRN6.js";
|
|
3
3
|
import { propagateTestid as H } from "../../helpers/utility/propagateTestid.js";
|
|
4
4
|
import { TabSetProvider as R, TabSetContext as O } from "./TabSetProvider.js";
|
|
5
|
-
import { useState as
|
|
6
|
-
import { s as
|
|
5
|
+
import { useState as d, useRef as W, useEffect as h, useContext as $ } from "react";
|
|
6
|
+
import { s as p } from "../../factory-CcYfm2kB.js";
|
|
7
7
|
import { tabSet as k } from "./TabSet.styles.js";
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as u } from "../../cx-DN21T1EH.js";
|
|
9
9
|
import { GlobalCSSClass as A } from "../../enums.js";
|
|
10
10
|
const F = (r) => {
|
|
11
11
|
const a = W({}), s = $(O);
|
|
@@ -23,22 +23,23 @@ const F = (r) => {
|
|
|
23
23
|
...a.current,
|
|
24
24
|
opacity: 0
|
|
25
25
|
};
|
|
26
|
-
return
|
|
26
|
+
return h(() => {
|
|
27
27
|
s?.hover && (a.current = e);
|
|
28
28
|
}, [s?.hover, e]), /* @__PURE__ */ t("div", { ...r, style: e });
|
|
29
29
|
}, G = (r) => {
|
|
30
|
-
const [a, s] =
|
|
31
|
-
return
|
|
32
|
-
const i = setTimeout(() => {
|
|
33
|
-
if (
|
|
34
|
-
const { offsetLeft:
|
|
30
|
+
const [a, s] = d({}), e = $(O);
|
|
31
|
+
return h(() => {
|
|
32
|
+
const i = e?.active, l = setTimeout(() => {
|
|
33
|
+
if (i) {
|
|
34
|
+
const { offsetLeft: f, scrollWidth: n } = i;
|
|
35
35
|
s({
|
|
36
|
-
left: `${
|
|
37
|
-
width: `${
|
|
36
|
+
left: `${f}px`,
|
|
37
|
+
width: `${n}px`
|
|
38
38
|
});
|
|
39
|
-
}
|
|
39
|
+
} else
|
|
40
|
+
s({});
|
|
40
41
|
}, 150);
|
|
41
|
-
return () => clearTimeout(
|
|
42
|
+
return () => clearTimeout(l);
|
|
42
43
|
}, [e?.active, e?.layoutVersion]), /* @__PURE__ */ t("div", { ...r, style: a });
|
|
43
44
|
}, P = ({
|
|
44
45
|
children: r,
|
|
@@ -47,22 +48,22 @@ const F = (r) => {
|
|
|
47
48
|
layout: e = "top-left",
|
|
48
49
|
onChange: i,
|
|
49
50
|
panelStyle: l,
|
|
50
|
-
selected:
|
|
51
|
-
tabHolderStyle:
|
|
51
|
+
selected: f,
|
|
52
|
+
tabHolderStyle: n,
|
|
52
53
|
type: w,
|
|
53
54
|
...S
|
|
54
55
|
}) => {
|
|
55
|
-
const [g, j] =
|
|
56
|
-
return
|
|
56
|
+
const [g, j] = d(null), [b, N] = d(!1), [x, E] = d(!1), m = W(null), o = k({ layout: e, overflowStart: b, overflowEnd: x, type: w });
|
|
57
|
+
return h(() => {
|
|
57
58
|
const c = () => {
|
|
58
|
-
const y =
|
|
59
|
+
const y = m.current?.querySelector('[role="tablist"]');
|
|
59
60
|
if (y) {
|
|
60
61
|
const { scrollWidth: I, clientWidth: L, scrollLeft: C } = y;
|
|
61
62
|
I > L ? (N(C > 1), E(C < I - L - 1)) : (N(!1), E(!1));
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
c();
|
|
65
|
-
const T =
|
|
66
|
+
const T = m.current?.querySelector('[role="tablist"]');
|
|
66
67
|
return T?.addEventListener("scroll", c), window.addEventListener("resize", c), () => {
|
|
67
68
|
T?.removeEventListener("scroll", c), window.removeEventListener("resize", c);
|
|
68
69
|
};
|
|
@@ -72,24 +73,24 @@ const F = (r) => {
|
|
|
72
73
|
defaultSelected: s,
|
|
73
74
|
onChange: i,
|
|
74
75
|
panel: g,
|
|
75
|
-
selected:
|
|
76
|
+
selected: f,
|
|
76
77
|
type: w,
|
|
77
78
|
children: /* @__PURE__ */ t(
|
|
78
|
-
|
|
79
|
+
p.div,
|
|
79
80
|
{
|
|
80
|
-
className:
|
|
81
|
+
className: u(a, o.root, A.TabSet),
|
|
81
82
|
...S,
|
|
82
|
-
children: r && /* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
83
|
+
children: r && /* @__PURE__ */ v(q, { children: [
|
|
84
|
+
/* @__PURE__ */ v(
|
|
85
|
+
p.div,
|
|
85
86
|
{
|
|
86
|
-
...
|
|
87
|
-
ref:
|
|
88
|
-
className:
|
|
87
|
+
...n,
|
|
88
|
+
ref: m,
|
|
89
|
+
className: u(o.listHolder, n?.className),
|
|
89
90
|
children: [
|
|
90
91
|
b && /* @__PURE__ */ t("div", { className: o.overflowStartIndicator }),
|
|
91
92
|
x && /* @__PURE__ */ t("div", { className: o.overflowEndIndicator }),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ v(
|
|
93
94
|
z,
|
|
94
95
|
{
|
|
95
96
|
render: /* @__PURE__ */ t("div", { className: o.list, role: "tablist" }),
|
|
@@ -105,10 +106,10 @@ const F = (r) => {
|
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
108
|
/* @__PURE__ */ t(
|
|
108
|
-
|
|
109
|
+
p.div,
|
|
109
110
|
{
|
|
110
111
|
...l,
|
|
111
|
-
className:
|
|
112
|
+
className: u(o.panel, l?.className),
|
|
112
113
|
"data-testid": l?.["data-testid"] ?? H(S["data-testid"], "panel"),
|
|
113
114
|
ref: j
|
|
114
115
|
}
|
|
@@ -9,17 +9,11 @@ export declare const tabSet: import('../../styled-system/types').SlotRecipeRunti
|
|
|
9
9
|
list: {
|
|
10
10
|
justifyContent: "center";
|
|
11
11
|
};
|
|
12
|
-
activeIndicator: {
|
|
13
|
-
left: "[50%]";
|
|
14
|
-
};
|
|
15
12
|
};
|
|
16
13
|
'top-right': {
|
|
17
14
|
list: {
|
|
18
15
|
justifyContent: "flex-end";
|
|
19
16
|
};
|
|
20
|
-
activeIndicator: {
|
|
21
|
-
left: "[100%]";
|
|
22
|
-
};
|
|
23
17
|
};
|
|
24
18
|
};
|
|
25
19
|
overflowEnd: {
|
|
@@ -102,17 +102,11 @@ const e = t({
|
|
|
102
102
|
"top-center": {
|
|
103
103
|
list: {
|
|
104
104
|
justifyContent: "center"
|
|
105
|
-
},
|
|
106
|
-
activeIndicator: {
|
|
107
|
-
left: "[50%]"
|
|
108
105
|
}
|
|
109
106
|
},
|
|
110
107
|
"top-right": {
|
|
111
108
|
list: {
|
|
112
109
|
justifyContent: "flex-end"
|
|
113
|
-
},
|
|
114
|
-
activeIndicator: {
|
|
115
|
-
left: "[100%]"
|
|
116
110
|
}
|
|
117
111
|
}
|
|
118
112
|
},
|
|
@@ -1,91 +1,101 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useControlledState as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as k, useState as l, useMemo as T, useCallback as h, useEffect as z } from "react";
|
|
3
|
+
import { useControlledState as A } from "../../hooks/useControlledState.js";
|
|
4
|
+
const E = k(
|
|
5
5
|
void 0
|
|
6
|
-
),
|
|
6
|
+
), H = ({
|
|
7
7
|
children: C,
|
|
8
|
-
defaultSelected:
|
|
9
|
-
onChange:
|
|
10
|
-
panel:
|
|
11
|
-
selected:
|
|
12
|
-
type:
|
|
8
|
+
defaultSelected: N,
|
|
9
|
+
onChange: x,
|
|
10
|
+
panel: m,
|
|
11
|
+
selected: P,
|
|
12
|
+
type: v
|
|
13
13
|
}) => {
|
|
14
|
-
const [S,
|
|
14
|
+
const [S, V] = l(), [o, b] = l(() => /* @__PURE__ */ new Set()), [n, f] = l(
|
|
15
15
|
() => /* @__PURE__ */ new Map()
|
|
16
|
-
), [
|
|
16
|
+
), [p, M] = l(0), { value: c, setValue: d } = A({
|
|
17
17
|
component: "IressTabSet",
|
|
18
|
-
defaultValue:
|
|
18
|
+
defaultValue: N,
|
|
19
19
|
propName: "selected",
|
|
20
|
-
value:
|
|
21
|
-
}),
|
|
22
|
-
() => [...
|
|
23
|
-
(
|
|
20
|
+
value: P
|
|
21
|
+
}), w = T(
|
|
22
|
+
() => [...o].find(
|
|
23
|
+
(t, e) => n.has(e) && n.get(e) === c || e === c
|
|
24
24
|
),
|
|
25
|
-
[
|
|
26
|
-
),
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
[o, c, n]
|
|
26
|
+
), g = h(
|
|
27
|
+
(t, e) => {
|
|
28
|
+
b((s) => {
|
|
29
|
+
if (s.has(t)) {
|
|
30
|
+
if (e !== void 0) {
|
|
31
|
+
const r = [...s].indexOf(t);
|
|
32
|
+
f((u) => {
|
|
33
|
+
const O = new Map(u);
|
|
34
|
+
return O.set(r, e), O;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return s;
|
|
38
|
+
}
|
|
39
|
+
const a = new Set(s).add(t), i = [...a].indexOf(t);
|
|
40
|
+
return e !== void 0 && f((r) => {
|
|
41
|
+
const u = new Map(r);
|
|
42
|
+
return u.set(i, e), u;
|
|
35
43
|
}), a;
|
|
36
|
-
});
|
|
44
|
+
}), M((s) => s + 1);
|
|
37
45
|
},
|
|
38
46
|
[]
|
|
39
|
-
),
|
|
40
|
-
|
|
41
|
-
const s = new Set(
|
|
42
|
-
return s.delete(
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
return
|
|
47
|
+
), I = h((t) => {
|
|
48
|
+
b((e) => {
|
|
49
|
+
const s = new Set(e), a = [...s].indexOf(t);
|
|
50
|
+
return s.delete(t), f((i) => {
|
|
51
|
+
if (!i.has(a)) return i;
|
|
52
|
+
const r = new Map(i);
|
|
53
|
+
return r.delete(a), r;
|
|
46
54
|
}), s;
|
|
47
|
-
})
|
|
55
|
+
}), M((e) => e + 1), V(
|
|
56
|
+
(e) => e === t ? void 0 : e
|
|
57
|
+
);
|
|
48
58
|
}, []);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
59
|
+
z(() => {
|
|
60
|
+
c === void 0 && o.size && d(n.get(0) ?? 0);
|
|
61
|
+
}, [o, c, d, n]);
|
|
62
|
+
const y = T(
|
|
53
63
|
() => ({
|
|
54
|
-
active:
|
|
55
|
-
activate(
|
|
56
|
-
if (!
|
|
57
|
-
const
|
|
58
|
-
|
|
64
|
+
active: w,
|
|
65
|
+
activate(t) {
|
|
66
|
+
if (!t) return;
|
|
67
|
+
const e = [...o].indexOf(t), s = n.get(e);
|
|
68
|
+
x?.({ index: e, value: s }), d(s ?? e);
|
|
59
69
|
},
|
|
60
|
-
isActive: (
|
|
70
|
+
isActive: (t) => t ? w === t : !1,
|
|
61
71
|
hover: S,
|
|
62
|
-
layoutVersion:
|
|
63
|
-
panel:
|
|
64
|
-
register:
|
|
65
|
-
setHover: (
|
|
66
|
-
|
|
72
|
+
layoutVersion: p,
|
|
73
|
+
panel: m,
|
|
74
|
+
register: g,
|
|
75
|
+
setHover: (t) => {
|
|
76
|
+
V(t);
|
|
67
77
|
},
|
|
68
|
-
unregister:
|
|
69
|
-
type:
|
|
78
|
+
unregister: I,
|
|
79
|
+
type: v
|
|
70
80
|
}),
|
|
71
81
|
[
|
|
72
|
-
|
|
82
|
+
w,
|
|
73
83
|
S,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
V,
|
|
84
|
+
p,
|
|
85
|
+
m,
|
|
77
86
|
g,
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
I,
|
|
88
|
+
v,
|
|
89
|
+
o,
|
|
80
90
|
n,
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
x,
|
|
92
|
+
d
|
|
83
93
|
]
|
|
84
94
|
);
|
|
85
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ j(E.Provider, { value: y, children: C });
|
|
86
96
|
};
|
|
87
|
-
|
|
97
|
+
H.displayName = "TabSetProvider";
|
|
88
98
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
E as TabSetContext,
|
|
100
|
+
H as TabSetProvider
|
|
91
101
|
};
|