@cfx-dev/ui-components 4.5.4 → 4.5.5
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.
|
@@ -12,11 +12,23 @@ export interface TabularItem {
|
|
|
12
12
|
ariaControls?: string;
|
|
13
13
|
hasNotification?: boolean;
|
|
14
14
|
}
|
|
15
|
+
export interface TabularItemComponentProps {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
type: HTMLButtonElement['type'];
|
|
18
|
+
role: HTMLButtonElement['role'];
|
|
19
|
+
className?: string;
|
|
20
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
'aria-controls'?: string;
|
|
23
|
+
'data-text'?: React.ReactNode;
|
|
24
|
+
'aria-selected'?: boolean;
|
|
25
|
+
}
|
|
15
26
|
export interface TabularProps {
|
|
16
27
|
items: TabularItem[];
|
|
17
28
|
activeItem?: string;
|
|
18
29
|
onActivate?: (id: string) => void;
|
|
19
30
|
itemClassName?: string;
|
|
31
|
+
ItemComponent?: React.ElementType<TabularItemComponentProps>;
|
|
20
32
|
className?: string;
|
|
21
33
|
ariaLabel?: string;
|
|
22
34
|
tabIndex?: number;
|
|
@@ -32,17 +44,6 @@ export declare namespace Tabular {
|
|
|
32
44
|
export interface TabularRootProps extends React.PropsWithChildren, Pick<TabularProps, 'className' | 'ariaLabel' | 'tabIndex' | 'theme' | 'role' | 'size'> {
|
|
33
45
|
style?: React.CSSProperties;
|
|
34
46
|
}
|
|
35
|
-
export interface TabularItemComponentProps {
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
type: HTMLButtonElement['type'];
|
|
38
|
-
role: HTMLButtonElement['role'];
|
|
39
|
-
className?: string;
|
|
40
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
41
|
-
'aria-label'?: string;
|
|
42
|
-
'aria-controls'?: string;
|
|
43
|
-
'data-text'?: React.ReactNode;
|
|
44
|
-
'aria-selected'?: boolean;
|
|
45
|
-
}
|
|
46
47
|
export interface TabularItemProps extends TabularItem {
|
|
47
48
|
active: boolean;
|
|
48
49
|
onClick: (id: string) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as b, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import x, { createElement as p } from "react";
|
|
3
3
|
import { Dot as C } from "../Dot/Dot.js";
|
|
4
|
-
import { clsx as
|
|
4
|
+
import { clsx as d } from "../../utils/clsx.js";
|
|
5
5
|
import { ui as v } from "../../utils/ui/ui.js";
|
|
6
|
-
const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I = "cfxui__Tabular__root__0ff05", y = "cfxui__Tabular__active__1ae95", j = "cfxui__Tabular__hasNotification__c372f", A = "cfxui__Tabular__content__3a95a",
|
|
6
|
+
const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I = "cfxui__Tabular__root__0ff05", y = "cfxui__Tabular__active__1ae95", j = "cfxui__Tabular__hasNotification__c372f", A = "cfxui__Tabular__content__3a95a", a = {
|
|
7
7
|
reset: k,
|
|
8
8
|
"tabular-size-initial-large": "cfxui__Tabular__tabular-size-initial-large__9451f",
|
|
9
9
|
item: R,
|
|
@@ -27,98 +27,101 @@ const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I =
|
|
|
27
27
|
hasNotification: j,
|
|
28
28
|
content: A
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function n(f) {
|
|
31
31
|
const {
|
|
32
32
|
items: s,
|
|
33
|
-
activeItem:
|
|
34
|
-
onActivate:
|
|
35
|
-
itemClassName:
|
|
33
|
+
activeItem: i,
|
|
34
|
+
onActivate: e,
|
|
35
|
+
itemClassName: _,
|
|
36
36
|
size: u = "medium",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
e
|
|
42
|
-
|
|
37
|
+
className: c,
|
|
38
|
+
ItemComponent: m,
|
|
39
|
+
...r
|
|
40
|
+
} = f, l = x.useCallback((t) => {
|
|
41
|
+
e && e(t);
|
|
42
|
+
}, [e]), o = d(
|
|
43
|
+
a.root,
|
|
44
|
+
c
|
|
43
45
|
);
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
46
|
+
return /* @__PURE__ */ b(n.Root, { ...r, className: o, children: s.map((t) => /* @__PURE__ */ p(
|
|
47
|
+
n.Item,
|
|
46
48
|
{
|
|
47
|
-
...
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
...t,
|
|
50
|
+
Component: m,
|
|
51
|
+
className: _,
|
|
52
|
+
key: t.id,
|
|
53
|
+
active: t.id === i,
|
|
54
|
+
onClick: l,
|
|
52
55
|
size: u
|
|
53
56
|
}
|
|
54
57
|
)) });
|
|
55
58
|
}
|
|
56
|
-
|
|
59
|
+
n.Root = function(s) {
|
|
57
60
|
const {
|
|
58
|
-
children:
|
|
59
|
-
className:
|
|
60
|
-
ariaLabel:
|
|
61
|
+
children: i,
|
|
62
|
+
className: e,
|
|
63
|
+
ariaLabel: _,
|
|
61
64
|
tabIndex: u,
|
|
62
|
-
theme:
|
|
63
|
-
role:
|
|
65
|
+
theme: c = "dark",
|
|
66
|
+
role: m = "tablist",
|
|
64
67
|
style: r
|
|
65
|
-
} = s,
|
|
66
|
-
return /* @__PURE__ */
|
|
68
|
+
} = s, l = d(a.root, a[`theme-${c}`], e);
|
|
69
|
+
return /* @__PURE__ */ b(
|
|
67
70
|
"div",
|
|
68
71
|
{
|
|
69
|
-
role:
|
|
70
|
-
"aria-label":
|
|
72
|
+
role: m,
|
|
73
|
+
"aria-label": _,
|
|
71
74
|
tabIndex: u,
|
|
72
|
-
className:
|
|
75
|
+
className: l,
|
|
73
76
|
style: r,
|
|
74
|
-
children:
|
|
77
|
+
children: i
|
|
75
78
|
}
|
|
76
79
|
);
|
|
77
80
|
};
|
|
78
|
-
|
|
81
|
+
n.Item = function(s) {
|
|
79
82
|
const {
|
|
80
|
-
id:
|
|
81
|
-
label:
|
|
82
|
-
onClick:
|
|
83
|
+
id: i,
|
|
84
|
+
label: e,
|
|
85
|
+
onClick: _,
|
|
83
86
|
ariaLabel: u,
|
|
84
|
-
ariaControls:
|
|
85
|
-
className:
|
|
87
|
+
ariaControls: c,
|
|
88
|
+
className: m,
|
|
86
89
|
active: r = !1,
|
|
87
|
-
disabled:
|
|
88
|
-
hasNotification:
|
|
89
|
-
size:
|
|
90
|
+
disabled: l = !1,
|
|
91
|
+
hasNotification: o = !1,
|
|
92
|
+
size: t,
|
|
90
93
|
Component: z
|
|
91
|
-
} = s, g =
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
v.getResponsiveFlatClassnames("tabular-size",
|
|
94
|
+
} = s, g = x.useCallback(() => {
|
|
95
|
+
l || _(i);
|
|
96
|
+
}, [l, _, i]), T = d(
|
|
97
|
+
a.reset,
|
|
98
|
+
a.item,
|
|
99
|
+
m,
|
|
100
|
+
v.getResponsiveFlatClassnames("tabular-size", t).map((h) => a[h]),
|
|
98
101
|
{
|
|
99
|
-
[
|
|
100
|
-
[
|
|
102
|
+
[a.active]: r,
|
|
103
|
+
[a.hasNotification]: o
|
|
101
104
|
}
|
|
102
105
|
);
|
|
103
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ b(
|
|
104
107
|
z || "button",
|
|
105
108
|
{
|
|
106
|
-
disabled:
|
|
109
|
+
disabled: l,
|
|
107
110
|
type: "button",
|
|
108
111
|
role: "tab",
|
|
109
112
|
className: T,
|
|
110
113
|
onClick: g,
|
|
111
114
|
"aria-label": u,
|
|
112
|
-
"aria-controls":
|
|
113
|
-
"data-text":
|
|
115
|
+
"aria-controls": c,
|
|
116
|
+
"data-text": e,
|
|
114
117
|
"aria-selected": r,
|
|
115
|
-
children: /* @__PURE__ */ N("span", { className:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
children: /* @__PURE__ */ N("span", { className: a.content, children: [
|
|
119
|
+
e,
|
|
120
|
+
o && /* @__PURE__ */ b(C, { color: "green", className: a.notification })
|
|
118
121
|
] })
|
|
119
122
|
}
|
|
120
123
|
);
|
|
121
124
|
};
|
|
122
125
|
export {
|
|
123
|
-
|
|
126
|
+
n as Tabular
|
|
124
127
|
};
|