@epam/ai-dial-ui-kit 0.15.0-dev.6 → 0.15.0-dev.7
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/README.md +139 -0
- package/dist/CHANGELOG.md +10 -0
- package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-4iMidqal.cjs} +26 -26
- package/dist/DateCellRenderer-CTTAnQjB.cjs +1 -0
- package/dist/JsonEditor-D2jSlRFi.cjs +1 -0
- package/dist/{MarkdownEditor-jQ8nDJfx.cjs → MarkdownEditor-BzEbdj7R.cjs} +1 -1
- package/dist/{MarkdownEditor-DHn2pYOJ.cjs → MarkdownEditor-C9-ZMRVi.cjs} +1 -1
- package/dist/MarkdownEditorContainer-BvwJjkiZ.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.js +70 -65
- package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
- package/dist/components/Dropdown/constants.js +14 -12
- package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
- package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +18 -16
- package/dist/components/New/Accordion/Accordion.js +39 -37
- package/dist/components/New/ButtonDropdown/ButtonDropdown.js +7 -6
- package/dist/components/New/Calendar/Calendar.js +253 -222
- package/dist/components/New/CaptionText/CaptionText.js +18 -15
- package/dist/components/New/CardShell/CardShell.js +4 -2
- package/dist/components/New/Checkbox/Checkbox.js +67 -56
- package/dist/components/New/Checkbox/CheckboxBox.js +4 -2
- package/dist/components/New/CloseButton/CloseButton.js +18 -16
- package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +39 -34
- package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +44 -39
- package/dist/components/New/Dropdown/Dropdown.js +101 -95
- package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +19 -17
- package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
- package/dist/components/New/FolderPath/FolderPath.js +29 -28
- package/dist/components/New/Highlight/Highlight.js +23 -30
- package/dist/components/New/InfoButton/InfoButton.js +12 -10
- package/dist/components/New/InlineSelect/InlineSelect.js +43 -41
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +40 -38
- package/dist/components/New/Label/Label.js +13 -8
- package/dist/components/New/MenuItem/MenuItem.js +29 -27
- package/dist/components/New/MenuItem/constants.js +9 -8
- package/dist/components/New/NoDataContent/NoDataContent.js +20 -18
- package/dist/components/New/Notification/Notification.js +18 -16
- package/dist/components/New/NumberInput/NumberInput.js +42 -33
- package/dist/components/New/PasswordInput/PasswordInput.js +41 -35
- package/dist/components/New/Popup/Popup.js +45 -43
- package/dist/components/New/Radio/Radio.js +75 -64
- package/dist/components/New/RadioGroup/RadioGroup.js +76 -65
- package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +117 -106
- package/dist/components/New/ResizableContainer/ResizableContainer.js +42 -40
- package/dist/components/New/Search/Search.js +28 -26
- package/dist/components/New/SegmentedControl/SegmentedControl.js +29 -23
- package/dist/components/New/Select/Select.js +120 -109
- package/dist/components/New/Switch/Switch.js +69 -58
- package/dist/components/New/Tabs/Tabs.js +28 -22
- package/dist/components/New/Tag/Tag.js +42 -40
- package/dist/components/New/TagInput/TagInput.js +44 -42
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +25 -23
- package/dist/components/New/Tooltip/TooltipContent.js +10 -8
- package/dist/components/ProgressBar/ProgressBar.js +45 -31
- package/dist/components/Skeleton/Skeleton.js +25 -19
- package/dist/components/Spinner/Spinner.js +6 -4
- package/dist/components-manifest.json +7 -2
- package/dist/constants/public-class-names.js +152 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +203 -201
- package/dist/editor-_174x-qy.cjs +1 -0
- package/dist/editors.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/lazy-DM-7dL0Y.cjs +1 -0
- package/dist/src/constants/public-class-names.d.ts +143 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/use-file-manager-tabs-DKmWaOlC.cjs +3 -0
- package/package.json +1 -1
- package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
- package/dist/JsonEditor-qv1Z0dLX.cjs +0 -1
- package/dist/MarkdownEditorContainer-Bzcnoemw.cjs +0 -1
- package/dist/lazy-tfN4sKhq.cjs +0 -1
- package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as v, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as k, useCallback as A } from "react";
|
|
3
3
|
import { mergeClasses as u } from "../../../utils/merge-classes.js";
|
|
4
|
-
import { resolveAccessibleName as
|
|
5
|
-
import { NAVIGATION_KEYS as
|
|
4
|
+
import { resolveAccessibleName as S } from "../../../utils/accessible-name.js";
|
|
5
|
+
import { NAVIGATION_KEYS as w, segmentDisabledSelectedClassName as D, segmentDisabledUnselectedClassName as h, segmentSelectedInteractiveClassName as y, segmentUnselectedInteractiveClassName as K, segmentSelectedClassName as U, segmentUnselectedClassName as L, segmentClassName as R, containerClassName as _ } from "./constants.js";
|
|
6
|
+
import { DIAL_KIT_CLASS as f } from "../../../constants/public-class-names.js";
|
|
6
7
|
const M = ({
|
|
7
8
|
items: l,
|
|
8
9
|
value: r,
|
|
9
10
|
onChange: c,
|
|
10
11
|
disabled: o,
|
|
11
|
-
className:
|
|
12
|
-
segmentClassName:
|
|
13
|
-
"aria-label":
|
|
12
|
+
className: g,
|
|
13
|
+
segmentClassName: p,
|
|
14
|
+
"aria-label": C
|
|
14
15
|
}) => {
|
|
15
|
-
const
|
|
16
|
+
const b = k({}), d = l.find((e) => e.value === r), I = d && !d.disabled ? d.value : l.find((e) => !e.disabled)?.value, N = A(
|
|
16
17
|
(e) => {
|
|
17
|
-
if (o || !
|
|
18
|
-
const a = l.filter((
|
|
18
|
+
if (o || !w.includes(e.key)) return;
|
|
19
|
+
const a = l.filter((m) => !m.disabled);
|
|
19
20
|
if (a.length === 0) return;
|
|
20
21
|
const s = Math.max(
|
|
21
|
-
a.findIndex((
|
|
22
|
+
a.findIndex((m) => m.value === r),
|
|
22
23
|
0
|
|
23
24
|
), t = a.length - 1;
|
|
24
25
|
let n = s;
|
|
@@ -40,41 +41,46 @@ const M = ({
|
|
|
40
41
|
}
|
|
41
42
|
e.preventDefault();
|
|
42
43
|
const i = a[n];
|
|
43
|
-
|
|
44
|
+
b.current[i.value]?.focus(), i.value !== r && c(i.value);
|
|
44
45
|
},
|
|
45
46
|
[o, l, r, c]
|
|
46
47
|
);
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ v(
|
|
48
49
|
"div",
|
|
49
50
|
{
|
|
50
51
|
role: "radiogroup",
|
|
51
|
-
"aria-label":
|
|
52
|
+
"aria-label": C,
|
|
52
53
|
"aria-disabled": o || void 0,
|
|
53
|
-
onKeyDown:
|
|
54
|
-
className: u(
|
|
54
|
+
onKeyDown: N,
|
|
55
|
+
className: u(
|
|
56
|
+
f.segmentedControl,
|
|
57
|
+
_,
|
|
58
|
+
g
|
|
59
|
+
),
|
|
55
60
|
children: l.map((e) => {
|
|
56
61
|
const a = e.value === r, s = o || e.disabled;
|
|
57
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ x(
|
|
58
63
|
"button",
|
|
59
64
|
{
|
|
60
65
|
ref: (t) => {
|
|
61
|
-
|
|
66
|
+
b.current[e.value] = t;
|
|
62
67
|
},
|
|
63
68
|
type: "button",
|
|
64
69
|
role: "radio",
|
|
65
70
|
"aria-checked": a,
|
|
66
|
-
"aria-label":
|
|
71
|
+
"aria-label": S(
|
|
67
72
|
e["aria-label"],
|
|
68
73
|
typeof e.label == "string" ? e.label : void 0
|
|
69
74
|
),
|
|
70
|
-
tabIndex: e.value ===
|
|
75
|
+
tabIndex: e.value === I ? 0 : -1,
|
|
71
76
|
disabled: s,
|
|
72
77
|
onClick: () => c(e.value),
|
|
73
78
|
className: u(
|
|
79
|
+
f.segmentedControlItem,
|
|
74
80
|
R,
|
|
75
|
-
a ? U :
|
|
76
|
-
s ? a ?
|
|
77
|
-
|
|
81
|
+
a ? U : L,
|
|
82
|
+
s ? a ? D : h : a ? y : K,
|
|
83
|
+
p
|
|
78
84
|
),
|
|
79
85
|
children: [
|
|
80
86
|
e.icon,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { IconChevronDown as
|
|
3
|
-
import { useId as
|
|
1
|
+
import { jsx as l, jsxs as S, Fragment as _e } from "react/jsx-runtime";
|
|
2
|
+
import { IconChevronDown as Be } from "@tabler/icons-react";
|
|
3
|
+
import { useId as Ke, useState as K, useCallback as f, useMemo as m, useEffect as je, useImperativeHandle as ze, Fragment as Ue } from "react";
|
|
4
4
|
import { Checkbox as Ve } from "../Checkbox/Checkbox.js";
|
|
5
5
|
import { Dropdown as qe } from "../Dropdown/Dropdown.js";
|
|
6
6
|
import { EllipsisTooltip as Ge } from "../EllipsisTooltip/EllipsisTooltip.js";
|
|
@@ -13,73 +13,74 @@ import { DialNoDataContent as Je } from "../../NoDataContent/NoDataContent.js";
|
|
|
13
13
|
import { DIAL_KIT_ICON_STROKE as Xe } from "../constants/icon.js";
|
|
14
14
|
import { DIAL_ICON_SIZE as re } from "../../../constants/icon.js";
|
|
15
15
|
import { MenuItem as ae } from "../MenuItem/MenuItem.js";
|
|
16
|
-
import { MenuItemMark as
|
|
17
|
-
import { ElementSize as
|
|
16
|
+
import { MenuItemMark as j } from "../../../types/menu-item.js";
|
|
17
|
+
import { ElementSize as k } from "../../../types/size.js";
|
|
18
18
|
import { resolveAccessibleName as ie } from "../../../utils/accessible-name.js";
|
|
19
19
|
import { mergeClasses as p } from "../../../utils/merge-classes.js";
|
|
20
20
|
import { MultiSelectTags as Ye } from "./MultiSelectTags.js";
|
|
21
21
|
import { SelectSubMenuItem as Pe } from "./SelectSubMenuItem.js";
|
|
22
22
|
import { selectFieldIconClassName as el, selectListWidthClassName as ll, selectOverlayBaseClassName as tl, selectSearchThreshold as nl, selectSearchIcon as rl, selectCloseIcon as al, selectOptionBaseClassName as il, selectOptionsScrollClassName as ol, selectEmptyStateIcon as sl } from "./constants.js";
|
|
23
|
-
|
|
23
|
+
import { DIAL_KIT_CLASS as cl } from "../../../constants/public-class-names.js";
|
|
24
|
+
const El = ({
|
|
24
25
|
options: a,
|
|
25
26
|
multiple: n = !1,
|
|
26
27
|
id: oe,
|
|
27
|
-
value:
|
|
28
|
+
value: O,
|
|
28
29
|
defaultValue: se,
|
|
29
|
-
size: z =
|
|
30
|
+
size: z = k.Standard,
|
|
30
31
|
prefix: U,
|
|
31
32
|
customSelectedValue: V,
|
|
32
33
|
placeholder: ce = "Select...",
|
|
33
|
-
labelProps:
|
|
34
|
+
labelProps: g,
|
|
34
35
|
error: q,
|
|
35
36
|
caption: de,
|
|
36
37
|
ariaLabel: G,
|
|
37
38
|
searchable: H = !1,
|
|
38
|
-
searchSize: fe =
|
|
39
|
+
searchSize: fe = k.Standard,
|
|
39
40
|
searchPlaceholder: Q,
|
|
40
41
|
selectAll: me = !1,
|
|
41
42
|
invalid: ue,
|
|
42
43
|
selectAllLabel: he = "Select all",
|
|
43
|
-
selectedOptionMark: R =
|
|
44
|
+
selectedOptionMark: R = j.Tint,
|
|
44
45
|
emptyStateTitle: pe = "No options available",
|
|
45
46
|
emptyStateDescription: ve,
|
|
46
47
|
emptyStateIcon: be,
|
|
47
48
|
disabled: v = !1,
|
|
48
49
|
className: Ce,
|
|
49
50
|
fieldClassName: Ne,
|
|
50
|
-
listClassName:
|
|
51
|
+
listClassName: Se,
|
|
51
52
|
closable: D = !1,
|
|
52
|
-
header:
|
|
53
|
-
footer:
|
|
53
|
+
header: I,
|
|
54
|
+
footer: x,
|
|
54
55
|
onClose: W,
|
|
55
56
|
onChange: Z,
|
|
56
|
-
dismissRef:
|
|
57
|
+
dismissRef: ge,
|
|
57
58
|
onFooterClick: J,
|
|
58
59
|
open: X,
|
|
59
60
|
onOpenChange: Y,
|
|
60
61
|
onSearchQueryChange: P,
|
|
61
62
|
customMultiSelectTagsRenderer: ee
|
|
62
63
|
}) => {
|
|
63
|
-
const
|
|
64
|
+
const Ie = Ke(), u = oe || Ie, le = `list-${u}`, te = z === k.Small, [xe, we] = K(!1), F = X !== void 0, d = F ? !!X : xe, c = f(
|
|
64
65
|
(e) => {
|
|
65
66
|
F || we(e), Y?.(e);
|
|
66
67
|
},
|
|
67
68
|
[F, Y]
|
|
68
|
-
), [h, ye] =
|
|
69
|
+
), [h, ye] = K(""), L = f(
|
|
69
70
|
(e) => {
|
|
70
71
|
e !== h && (ye(e || ""), P?.(e || ""));
|
|
71
72
|
},
|
|
72
73
|
[P, h]
|
|
73
|
-
), E =
|
|
74
|
+
), E = O !== void 0, [Te, Ae] = K(se), b = E ? O : Te, r = m(() => n ? Array.isArray(b) ? b : [] : typeof b == "string" ? [b] : [], [b, n]), w = m(() => {
|
|
74
75
|
const e = h.trim().toLowerCase();
|
|
75
76
|
return e ? a.filter((t) => t.label.toLowerCase().includes(e)) : a;
|
|
76
77
|
}, [a, h]);
|
|
77
|
-
|
|
78
|
+
je(() => {
|
|
78
79
|
d || L("");
|
|
79
80
|
}, [d, L]);
|
|
80
81
|
const s = f(
|
|
81
82
|
(e) => {
|
|
82
|
-
E ||
|
|
83
|
+
E || Ae(e), Z?.(e);
|
|
83
84
|
},
|
|
84
85
|
[E, Z]
|
|
85
86
|
), $ = f(
|
|
@@ -98,25 +99,25 @@ const Fl = ({
|
|
|
98
99
|
s("");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
-
s(
|
|
102
|
+
const A = r.filter((Me) => Me !== t);
|
|
103
|
+
s(A);
|
|
103
104
|
},
|
|
104
105
|
[n, r, s]
|
|
105
106
|
), o = m(
|
|
106
107
|
() => w.filter((e) => !e.disabled),
|
|
107
108
|
[w]
|
|
108
|
-
),
|
|
109
|
+
), _ = m(
|
|
109
110
|
() => o.filter((e) => r.includes(e.value)).length,
|
|
110
111
|
[o, r]
|
|
111
|
-
), { allSelectedInFiltered:
|
|
112
|
-
const e = o.length > 0 &&
|
|
112
|
+
), { allSelectedInFiltered: B, someSelectedInFiltered: ke } = m(() => {
|
|
113
|
+
const e = o.length > 0 && _ === o.length;
|
|
113
114
|
return {
|
|
114
115
|
allSelectedInFiltered: e,
|
|
115
|
-
someSelectedInFiltered:
|
|
116
|
+
someSelectedInFiltered: _ > 0 && !e
|
|
116
117
|
};
|
|
117
|
-
}, [o,
|
|
118
|
+
}, [o, _]), Oe = f(() => {
|
|
118
119
|
if (!(!n || o.length === 0))
|
|
119
|
-
if (
|
|
120
|
+
if (B) {
|
|
120
121
|
const e = new Set(o.map((t) => t.value));
|
|
121
122
|
s(r.filter((t) => !e.has(t)));
|
|
122
123
|
} else {
|
|
@@ -124,7 +125,7 @@ const Fl = ({
|
|
|
124
125
|
o.forEach((t) => e.add(t.value)), s(Array.from(e));
|
|
125
126
|
}
|
|
126
127
|
}, [
|
|
127
|
-
|
|
128
|
+
B,
|
|
128
129
|
n,
|
|
129
130
|
o,
|
|
130
131
|
r,
|
|
@@ -143,7 +144,7 @@ const Fl = ({
|
|
|
143
144
|
selectedValues: r,
|
|
144
145
|
handleRemoveTag: M
|
|
145
146
|
}
|
|
146
|
-
) }) : null : !i || !i.labelNode && !i.description ? null : /* @__PURE__ */
|
|
147
|
+
) }) : null : !i || !i.labelNode && !i.description ? null : /* @__PURE__ */ S("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
147
148
|
/* @__PURE__ */ l(
|
|
148
149
|
Ge,
|
|
149
150
|
{
|
|
@@ -160,11 +161,11 @@ const Fl = ({
|
|
|
160
161
|
C,
|
|
161
162
|
r,
|
|
162
163
|
i
|
|
163
|
-
]), De = n || N ? "" : C || (V &&
|
|
164
|
+
]), De = n || N ? "" : C || (V && O ? V : ""), Fe = typeof g?.label == "string" ? g.label : void 0, Le = N ? [
|
|
164
165
|
ie(G, Fe),
|
|
165
166
|
n ? r.map((e) => a.find((t) => t.value === e)?.label ?? e).join(", ") : C
|
|
166
167
|
].filter(Boolean).join(", ") || void 0 : ie(G);
|
|
167
|
-
ze(
|
|
168
|
+
ze(ge, () => ({
|
|
168
169
|
dismiss: () => {
|
|
169
170
|
c(!1);
|
|
170
171
|
}
|
|
@@ -174,7 +175,7 @@ const Fl = ({
|
|
|
174
175
|
v || (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), d || c(!0));
|
|
175
176
|
},
|
|
176
177
|
[v, d, c]
|
|
177
|
-
), $e = () => /* @__PURE__ */
|
|
178
|
+
), $e = () => /* @__PURE__ */ S(
|
|
178
179
|
"div",
|
|
179
180
|
{
|
|
180
181
|
id: le,
|
|
@@ -182,8 +183,8 @@ const Fl = ({
|
|
|
182
183
|
"aria-multiselectable": n || void 0,
|
|
183
184
|
className: tl,
|
|
184
185
|
children: [
|
|
185
|
-
|
|
186
|
-
(H || D) && (a.length > nl || !!h) && /* @__PURE__ */
|
|
186
|
+
I && /* @__PURE__ */ l(_e, { children: typeof I == "function" ? I() : I }),
|
|
187
|
+
(H || D) && (a.length > nl || !!h) && /* @__PURE__ */ S("div", { className: "flex items-center gap-2 px-2 pt-2", children: [
|
|
187
188
|
H && /* @__PURE__ */ l(
|
|
188
189
|
ne,
|
|
189
190
|
{
|
|
@@ -202,7 +203,7 @@ const Fl = ({
|
|
|
202
203
|
{
|
|
203
204
|
"aria-label": "Close select",
|
|
204
205
|
className: "shrink-0",
|
|
205
|
-
size:
|
|
206
|
+
size: k.Small,
|
|
206
207
|
icon: al,
|
|
207
208
|
onClick: (e) => {
|
|
208
209
|
W?.(e), c(!1);
|
|
@@ -215,9 +216,9 @@ const Fl = ({
|
|
|
215
216
|
{
|
|
216
217
|
id: `${u}-selectAll`,
|
|
217
218
|
labelProps: { label: he },
|
|
218
|
-
isSelected:
|
|
219
|
-
isIndeterminate:
|
|
220
|
-
onChange:
|
|
219
|
+
isSelected: B,
|
|
220
|
+
isIndeterminate: ke,
|
|
221
|
+
onChange: Oe
|
|
221
222
|
}
|
|
222
223
|
) }),
|
|
223
224
|
/* @__PURE__ */ l("div", { role: "none", className: ol, children: w.length === 0 ? /* @__PURE__ */ l("div", { className: "px-2 py-3", children: /* @__PURE__ */ l(
|
|
@@ -235,12 +236,12 @@ const Fl = ({
|
|
|
235
236
|
{
|
|
236
237
|
opt: e,
|
|
237
238
|
selectedValues: r,
|
|
238
|
-
mark: n ?
|
|
239
|
+
mark: n ? j.Checkbox : R,
|
|
239
240
|
onSelect: $
|
|
240
241
|
},
|
|
241
242
|
e.value
|
|
242
243
|
);
|
|
243
|
-
const
|
|
244
|
+
const A = n ? (
|
|
244
245
|
/*
|
|
245
246
|
The row itself is the control: one `option` whose state rides on
|
|
246
247
|
`aria-selected`, with a decorative box drawing the check. A real
|
|
@@ -256,7 +257,7 @@ const Fl = ({
|
|
|
256
257
|
"aria-selected": t,
|
|
257
258
|
"aria-disabled": !!e.disabled,
|
|
258
259
|
disabled: e.disabled,
|
|
259
|
-
mark:
|
|
260
|
+
mark: j.Checkbox,
|
|
260
261
|
selected: t,
|
|
261
262
|
icon: e.icon,
|
|
262
263
|
label: e.labelNode ?? e.label,
|
|
@@ -289,91 +290,101 @@ const Fl = ({
|
|
|
289
290
|
placement: e.interactiveTooltip.placement,
|
|
290
291
|
content: e.interactiveTooltip.content,
|
|
291
292
|
contentClassName: e.interactiveTooltip.contentClassName,
|
|
292
|
-
children:
|
|
293
|
+
children: A
|
|
293
294
|
}
|
|
294
|
-
) :
|
|
295
|
+
) : A }, e.value);
|
|
295
296
|
}) }),
|
|
296
|
-
|
|
297
|
+
x && /* @__PURE__ */ l(
|
|
297
298
|
"div",
|
|
298
299
|
{
|
|
299
300
|
onClick: (e) => {
|
|
300
301
|
J?.(e), J && c(!1);
|
|
301
302
|
},
|
|
302
|
-
children: typeof
|
|
303
|
+
children: typeof x == "function" ? x() : x
|
|
303
304
|
}
|
|
304
305
|
)
|
|
305
306
|
]
|
|
306
307
|
}
|
|
307
308
|
);
|
|
308
|
-
return /* @__PURE__ */
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
listClassName: p(ll, ge),
|
|
322
|
-
className: "w-full",
|
|
323
|
-
renderOverlay: $e,
|
|
324
|
-
children: /* @__PURE__ */ l(
|
|
325
|
-
ne,
|
|
309
|
+
return /* @__PURE__ */ S(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
className: p(
|
|
313
|
+
cl.select,
|
|
314
|
+
"flex w-full flex-col gap-2",
|
|
315
|
+
Ce
|
|
316
|
+
),
|
|
317
|
+
children: [
|
|
318
|
+
g && /* @__PURE__ */ l(Ze, { ...g, htmlFor: u }),
|
|
319
|
+
/* @__PURE__ */ S("div", { className: "flex flex-col gap-1", children: [
|
|
320
|
+
/* @__PURE__ */ l(
|
|
321
|
+
qe,
|
|
326
322
|
{
|
|
327
|
-
|
|
328
|
-
|
|
323
|
+
open: d,
|
|
324
|
+
onOpenChange: c,
|
|
329
325
|
disabled: v,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
326
|
+
closable: D,
|
|
327
|
+
onClose: W,
|
|
328
|
+
placement: "bottom-start",
|
|
329
|
+
allowedPlacements: ["bottom-start", "top-start"],
|
|
330
|
+
listClassName: p(ll, Se),
|
|
331
|
+
className: "w-full",
|
|
332
|
+
renderOverlay: $e,
|
|
333
|
+
children: /* @__PURE__ */ l(
|
|
334
|
+
ne,
|
|
337
335
|
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
id: u,
|
|
337
|
+
size: z,
|
|
338
|
+
disabled: v,
|
|
339
|
+
invalid: ue,
|
|
340
|
+
value: De,
|
|
341
|
+
placeholder: N ? void 0 : ce,
|
|
342
|
+
readOnly: !0,
|
|
343
|
+
iconBefore: n ? void 0 : i?.icon,
|
|
344
|
+
iconAfter: /* @__PURE__ */ l(
|
|
345
|
+
Be,
|
|
346
|
+
{
|
|
347
|
+
size: te ? re.SM : re.MD,
|
|
348
|
+
stroke: Xe,
|
|
349
|
+
"aria-hidden": "true",
|
|
350
|
+
className: p(
|
|
351
|
+
el,
|
|
352
|
+
d && "rotate-180"
|
|
353
|
+
)
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
role: "combobox",
|
|
357
|
+
"aria-haspopup": "listbox",
|
|
358
|
+
"aria-expanded": d,
|
|
359
|
+
"aria-controls": le,
|
|
360
|
+
"aria-autocomplete": "none",
|
|
361
|
+
"aria-label": Le,
|
|
362
|
+
containerClassName: "w-full",
|
|
363
|
+
wrapperClassName: p(
|
|
364
|
+
!v && "cursor-pointer",
|
|
365
|
+
n && y && [
|
|
366
|
+
"!h-auto flex-wrap py-1.5",
|
|
367
|
+
te ? "min-h-[24px]" : "min-h-[40px]"
|
|
368
|
+
],
|
|
369
|
+
Ne
|
|
370
|
+
),
|
|
341
371
|
className: p(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
)
|
|
372
|
+
"cursor-pointer",
|
|
373
|
+
N && "w-0 min-w-0 flex-none p-0"
|
|
374
|
+
),
|
|
375
|
+
onKeyDown: Ee,
|
|
376
|
+
children: N
|
|
345
377
|
}
|
|
346
|
-
)
|
|
347
|
-
role: "combobox",
|
|
348
|
-
"aria-haspopup": "listbox",
|
|
349
|
-
"aria-expanded": d,
|
|
350
|
-
"aria-controls": le,
|
|
351
|
-
"aria-autocomplete": "none",
|
|
352
|
-
"aria-label": Le,
|
|
353
|
-
containerClassName: "w-full",
|
|
354
|
-
wrapperClassName: p(
|
|
355
|
-
!v && "cursor-pointer",
|
|
356
|
-
n && y && [
|
|
357
|
-
"!h-auto flex-wrap py-1.5",
|
|
358
|
-
te ? "min-h-[24px]" : "min-h-[40px]"
|
|
359
|
-
],
|
|
360
|
-
Ne
|
|
361
|
-
),
|
|
362
|
-
className: p(
|
|
363
|
-
"cursor-pointer",
|
|
364
|
-
N && "w-0 min-w-0 flex-none p-0"
|
|
365
|
-
),
|
|
366
|
-
onKeyDown: Ee,
|
|
367
|
-
children: N
|
|
378
|
+
)
|
|
368
379
|
}
|
|
369
|
-
)
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
),
|
|
381
|
+
/* @__PURE__ */ l(Qe, { text: q }),
|
|
382
|
+
!q && /* @__PURE__ */ l(Re, { text: de })
|
|
383
|
+
] })
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
);
|
|
376
387
|
};
|
|
377
388
|
export {
|
|
378
|
-
|
|
389
|
+
El as Select
|
|
379
390
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useId as b, useCallback as g } from "react";
|
|
3
3
|
import { ElementSize as x } from "../../../types/size.js";
|
|
4
4
|
import { mergeClasses as r } from "../../../utils/merge-classes.js";
|
|
5
5
|
import { resolveAccessibleName as y } from "../../../utils/accessible-name.js";
|
|
6
6
|
import { Label as v } from "../Label/Label.js";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { DIAL_KIT_CLASS as N } from "../../../constants/public-class-names.js";
|
|
8
|
+
const C = ({
|
|
9
|
+
id: d,
|
|
9
10
|
labelProps: o,
|
|
10
11
|
isOn: t = !1,
|
|
11
12
|
disabled: l,
|
|
@@ -14,72 +15,82 @@ const S = ({
|
|
|
14
15
|
className: u,
|
|
15
16
|
...i
|
|
16
17
|
}) => {
|
|
17
|
-
const p = b(), s =
|
|
18
|
+
const p = b(), s = d ?? p, n = c ? `${s}-caption` : void 0, f = g(
|
|
18
19
|
(h) => {
|
|
19
20
|
a?.(h.target.checked);
|
|
20
21
|
},
|
|
21
22
|
[a]
|
|
22
23
|
);
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
return /* @__PURE__ */ m("div", { className: "flex flex-col gap-1", children: [
|
|
25
|
+
/* @__PURE__ */ m(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: r(
|
|
29
|
+
N.switch,
|
|
30
|
+
"flex items-center gap-2",
|
|
31
|
+
u
|
|
32
|
+
),
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"input",
|
|
36
|
+
{
|
|
37
|
+
...i,
|
|
38
|
+
type: "checkbox",
|
|
39
|
+
role: "switch",
|
|
40
|
+
id: s,
|
|
41
|
+
checked: t,
|
|
42
|
+
"aria-checked": t,
|
|
43
|
+
disabled: l,
|
|
44
|
+
onChange: f,
|
|
45
|
+
"aria-label": y(
|
|
46
|
+
typeof o?.label != "string" ? i["aria-label"] : void 0
|
|
47
|
+
),
|
|
48
|
+
"aria-describedby": n,
|
|
49
|
+
className: "peer sr-only"
|
|
50
|
+
}
|
|
38
51
|
),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
"label",
|
|
54
|
+
{
|
|
55
|
+
htmlFor: s,
|
|
56
|
+
className: r(
|
|
57
|
+
"flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200",
|
|
58
|
+
"peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",
|
|
59
|
+
t ? "justify-end" : "justify-start",
|
|
60
|
+
l ? "cursor-not-allowed bg-control-disable-primary" : r(
|
|
61
|
+
"cursor-pointer",
|
|
62
|
+
t ? "bg-control-accent hover:bg-control-accent-hover" : "bg-control-neutral-default hover:bg-control-neutral-hover-strong"
|
|
63
|
+
)
|
|
64
|
+
),
|
|
65
|
+
children: /* @__PURE__ */ e(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
className: r(
|
|
69
|
+
"size-3.5 shrink-0 rounded-full",
|
|
70
|
+
l ? "bg-control-disable-secondary" : "bg-control-neutral"
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
55
75
|
),
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
o && /* @__PURE__ */ e(
|
|
77
|
+
v,
|
|
58
78
|
{
|
|
79
|
+
size: x.Standard,
|
|
80
|
+
...o,
|
|
81
|
+
htmlFor: s,
|
|
59
82
|
className: r(
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
// `Label` defaults to the secondary colour; the switch's own label
|
|
84
|
+
// has always been primary while the control is usable.
|
|
85
|
+
"py-[1px]",
|
|
86
|
+
l ? "cursor-not-allowed text-control-disable-primary" : "cursor-pointer text-primary",
|
|
87
|
+
o.className
|
|
62
88
|
)
|
|
63
89
|
}
|
|
64
90
|
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
v,
|
|
69
|
-
{
|
|
70
|
-
size: x.Standard,
|
|
71
|
-
...o,
|
|
72
|
-
htmlFor: s,
|
|
73
|
-
className: r(
|
|
74
|
-
// `Label` defaults to the secondary colour; the switch's own label
|
|
75
|
-
// has always been primary while the control is usable.
|
|
76
|
-
"py-[1px]",
|
|
77
|
-
l ? "cursor-not-allowed text-control-disable-primary" : "cursor-pointer text-primary",
|
|
78
|
-
o.className
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
] }),
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
),
|
|
83
94
|
c && /* @__PURE__ */ e(
|
|
84
95
|
"span",
|
|
85
96
|
{
|
|
@@ -91,5 +102,5 @@ const S = ({
|
|
|
91
102
|
] });
|
|
92
103
|
};
|
|
93
104
|
export {
|
|
94
|
-
|
|
105
|
+
C as Switch
|
|
95
106
|
};
|