@epam/ai-dial-ui-kit 0.15.0-dev.1 → 0.15.0-dev.11
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 +147 -0
- package/dist/CHANGELOG.md +17 -0
- package/dist/DateCellRenderer-Ba9tlNbk.cjs +1 -0
- package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-S5QJV-Wp.cjs} +26 -26
- package/dist/components/Dropdown/Dropdown.js +70 -65
- package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
- package/dist/components/Dropdown/constants.js +15 -13
- package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
- package/dist/components/New/Accordion/Accordion.js +40 -38
- package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
- package/dist/components/New/Breadcrumbs/constants.js +41 -0
- package/dist/components/New/ButtonDropdown/ButtonDropdown.js +7 -6
- package/dist/components/New/Calendar/Calendar.js +337 -289
- package/dist/components/New/CaptionText/CaptionText.js +18 -15
- package/dist/components/New/CardShell/CardShell.js +5 -3
- package/dist/components/New/Checkbox/Checkbox.js +67 -56
- package/dist/components/New/Checkbox/CheckboxBox.js +5 -3
- 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 +20 -18
- package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
- package/dist/components/New/FilterChips/FilterChips.js +43 -0
- package/dist/components/New/FilterChips/constants.js +5 -0
- 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 +13 -11
- package/dist/components/New/InlineSelect/InlineSelect.js +43 -41
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +41 -39
- 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 +21 -19
- package/dist/components/New/Notification/Notification.js +29 -27
- package/dist/components/New/NumberInput/NumberInput.js +42 -33
- package/dist/components/New/PasswordInput/PasswordInput.js +41 -34
- package/dist/components/New/Popup/Popup.js +46 -44
- 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 +29 -27
- 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 +125 -61
- package/dist/components/New/Tag/Tag.js +42 -40
- package/dist/components/New/TagInput/TagInput.js +45 -43
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +26 -24
- package/dist/components/New/Tooltip/TooltipContent.js +11 -9
- package/dist/components/ProgressBar/ProgressBar.js +45 -33
- package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
- package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
- package/dist/components/SchemaRenderer/types.js +19 -8
- package/dist/components/SchemaRenderer/utils.js +121 -96
- package/dist/components/Skeleton/Skeleton.js +25 -19
- package/dist/components/Spinner/Spinner.js +7 -5
- package/dist/components-manifest.json +248 -6
- package/dist/constants/public-class-names.js +182 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +227 -217
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/src/components/New/Breadcrumbs/Breadcrumbs.d.ts +94 -0
- package/dist/src/components/New/Breadcrumbs/constants.d.ts +60 -0
- package/dist/src/components/New/Calendar/Calendar.d.ts +14 -1
- package/dist/src/components/New/FilterChips/FilterChips.d.ts +69 -0
- package/dist/src/components/New/FilterChips/constants.d.ts +13 -0
- package/dist/src/components/New/PasswordInput/PasswordInput.d.ts +4 -1
- package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
- package/dist/src/components/SchemaRenderer/types.d.ts +11 -0
- package/dist/src/components/SchemaRenderer/utils.d.ts +5 -1
- package/dist/src/constants/public-class-names.d.ts +173 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/types/breadcrumbs.d.ts +9 -0
- package/dist/src/utils/__tests__/timezone.spec.d.ts +1 -0
- package/dist/src/utils/timezone.d.ts +24 -0
- package/dist/types/breadcrumbs.js +4 -0
- package/dist/use-file-manager-tabs-Ff6KIQOF.cjs +3 -0
- package/dist/utils/timezone.js +19 -0
- package/package.json +2 -2
- package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
- package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
|
@@ -1,83 +1,113 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { mergeClasses as
|
|
4
|
-
|
|
1
|
+
import { jsx as s, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as j, useId as R, useCallback as _ } from "react";
|
|
3
|
+
import { mergeClasses as l } from "../../../utils/merge-classes.js";
|
|
4
|
+
import { DIAL_KIT_CLASS as a } from "../../../constants/public-class-names.js";
|
|
5
|
+
import { TabOrientation as u } from "../../../types/tab.js";
|
|
6
|
+
const z = {
|
|
7
|
+
[u.Horizontal]: { next: "ArrowRight", previous: "ArrowLeft" },
|
|
8
|
+
[u.Vertical]: { next: "ArrowDown", previous: "ArrowUp" }
|
|
9
|
+
}, M = ({
|
|
5
10
|
tabs: n,
|
|
6
|
-
activeTabId:
|
|
7
|
-
onTabChange:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
activeTabId: c,
|
|
12
|
+
onTabChange: f,
|
|
13
|
+
orientation: m = u.Horizontal,
|
|
14
|
+
sectionLabel: d,
|
|
15
|
+
ariaLabel: k,
|
|
16
|
+
className: v,
|
|
17
|
+
tabListClassName: D,
|
|
18
|
+
tabClassName: S,
|
|
19
|
+
sectionLabelClassName: H
|
|
11
20
|
}) => {
|
|
12
|
-
const
|
|
21
|
+
const w = j({}), A = R(), i = m === u.Vertical, h = n.find((e) => e.id === c), K = h && !h.disabled ? h.id : n.find((e) => !e.disabled)?.id, V = _(
|
|
13
22
|
(e) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
23
|
+
const { next: t, previous: r } = z[m];
|
|
24
|
+
if (![t, r, "Home", "End"].includes(e.key) || n.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
const o = n.filter((g) => !g.disabled);
|
|
27
|
+
if (o.length === 0) return;
|
|
28
|
+
const p = Math.max(
|
|
29
|
+
o.findIndex((g) => g.id === c),
|
|
19
30
|
0
|
|
20
|
-
),
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
break;
|
|
26
|
-
case "ArrowLeft":
|
|
27
|
-
l = t === 0 ? s : t - 1;
|
|
28
|
-
break;
|
|
29
|
-
case "Home":
|
|
30
|
-
l = 0;
|
|
31
|
-
break;
|
|
32
|
-
case "End":
|
|
33
|
-
l = s;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
const d = r[l];
|
|
38
|
-
p.current[d.id]?.focus(), d.id !== i && o(d.id);
|
|
31
|
+
), b = o.length - 1;
|
|
32
|
+
let x = p;
|
|
33
|
+
e.key === t ? x = p === b ? 0 : p + 1 : e.key === r ? x = p === 0 ? b : p - 1 : e.key === "Home" ? x = 0 : x = b, e.preventDefault();
|
|
34
|
+
const y = o[x];
|
|
35
|
+
w.current[y.id]?.focus(), y.id !== c && f(y.id);
|
|
39
36
|
},
|
|
40
|
-
[n,
|
|
41
|
-
)
|
|
42
|
-
return /* @__PURE__ */ u(
|
|
37
|
+
[n, c, f, m]
|
|
38
|
+
), N = /* @__PURE__ */ s(
|
|
43
39
|
"div",
|
|
44
40
|
{
|
|
45
41
|
role: "tablist",
|
|
46
|
-
"aria-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
"aria-orientation": i ? "vertical" : void 0,
|
|
43
|
+
"aria-label": k,
|
|
44
|
+
"aria-labelledby": !k && d ? A : void 0,
|
|
45
|
+
onKeyDown: V,
|
|
46
|
+
className: l(
|
|
47
|
+
i ? "flex flex-col gap-1 px-2" : "flex justify-start gap-1",
|
|
48
|
+
// Without a heading the list is the root, so it takes the caller's
|
|
49
|
+
// classes — and the root kit class below — itself.
|
|
50
|
+
!d && v,
|
|
51
|
+
D,
|
|
52
|
+
a.tabList,
|
|
53
|
+
!d && a.tabs
|
|
54
|
+
),
|
|
49
55
|
children: n.map((e) => {
|
|
50
|
-
const
|
|
51
|
-
return /* @__PURE__ */
|
|
56
|
+
const t = c === e.id, r = !!e.disabled;
|
|
57
|
+
return /* @__PURE__ */ I(
|
|
52
58
|
"button",
|
|
53
59
|
{
|
|
54
|
-
ref: (
|
|
55
|
-
|
|
60
|
+
ref: (o) => {
|
|
61
|
+
w.current[e.id] = o;
|
|
56
62
|
},
|
|
57
63
|
type: "button",
|
|
58
64
|
role: "tab",
|
|
59
|
-
"aria-selected":
|
|
60
|
-
disabled:
|
|
61
|
-
tabIndex: e.id ===
|
|
62
|
-
onClick: () =>
|
|
63
|
-
className:
|
|
64
|
-
"dial-
|
|
65
|
-
"border-b-2 border-transparent flex items-center gap-2 px-3 py-2 text-start",
|
|
65
|
+
"aria-selected": t,
|
|
66
|
+
disabled: r,
|
|
67
|
+
tabIndex: e.id === K ? 0 : -1,
|
|
68
|
+
onClick: () => f(e.id),
|
|
69
|
+
className: l(
|
|
70
|
+
"dial-kit-enhanced-target flex items-center gap-2 text-start",
|
|
66
71
|
"transition-colors motion-reduce:transition-none",
|
|
67
|
-
"focus-visible:outline focus-visible:outline-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
"focus-visible:outline focus-visible:outline-focus",
|
|
73
|
+
i ? [
|
|
74
|
+
"h-11 w-full rounded-lg px-3 desktop:h-10",
|
|
75
|
+
"focus-visible:-outline-offset-1",
|
|
76
|
+
t ? "dial-small-semi-text" : "dial-small-text text-secondary"
|
|
77
|
+
] : [
|
|
78
|
+
"dial-small-paragraph-semi-text border-b-2 border-transparent px-3 py-2",
|
|
79
|
+
"focus-visible:outline-offset-2"
|
|
80
|
+
],
|
|
81
|
+
r && (i ? "cursor-not-allowed text-control-disable-primary" : "cursor-not-allowed border-control-disable-primary text-control-disable-primary"),
|
|
82
|
+
!r && (i ? t ? "bg-control-accent-alpha text-accent hover:bg-control-accent-alpha-hover" : "hover:bg-control-accent-alpha-hover" : t ? "dial-kit-tab-selected-underline text-primary" : "border-transparent text-secondary"),
|
|
83
|
+
S,
|
|
84
|
+
a.tab,
|
|
85
|
+
t && a.tabSelected
|
|
71
86
|
),
|
|
72
87
|
children: [
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
e.icon && // The label names the tab, so the icon beside it is decorative —
|
|
89
|
+
// and a Tabler icon is a bare `<svg>` that would otherwise be
|
|
90
|
+
// announced as an unnamed graphic.
|
|
91
|
+
/* @__PURE__ */ s("span", { "aria-hidden": "true", className: "flex shrink-0", children: e.icon }),
|
|
92
|
+
/* @__PURE__ */ s(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: l(
|
|
96
|
+
i && !t && !r && "text-primary"
|
|
97
|
+
),
|
|
98
|
+
children: e.label
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
e.count != null && /* @__PURE__ */ s(
|
|
75
102
|
"span",
|
|
76
103
|
{
|
|
77
|
-
className:
|
|
104
|
+
className: l(
|
|
78
105
|
"dial-tiny-semi-text rounded-full px-1.5 py-0.5",
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
// In a rail the badge belongs at the far end of the row, not
|
|
107
|
+
// hanging off the label.
|
|
108
|
+
i && "ms-auto",
|
|
109
|
+
r && "bg-layer-sunken text-control-disable-primary",
|
|
110
|
+
!r && (t ? "bg-control-accent-alpha text-accent" : "bg-layer-sunken text-secondary")
|
|
81
111
|
),
|
|
82
112
|
children: e.count
|
|
83
113
|
}
|
|
@@ -89,7 +119,41 @@ const A = ["ArrowRight", "ArrowLeft", "Home", "End"], R = ({
|
|
|
89
119
|
})
|
|
90
120
|
}
|
|
91
121
|
);
|
|
122
|
+
return d ? /* @__PURE__ */ I(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: l(
|
|
126
|
+
"flex flex-col gap-3",
|
|
127
|
+
v,
|
|
128
|
+
a.tabs
|
|
129
|
+
),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ s(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: l(
|
|
135
|
+
"flex h-16 shrink-0 items-center",
|
|
136
|
+
i ? "px-4" : "px-3"
|
|
137
|
+
),
|
|
138
|
+
children: /* @__PURE__ */ s(
|
|
139
|
+
"span",
|
|
140
|
+
{
|
|
141
|
+
id: A,
|
|
142
|
+
className: l(
|
|
143
|
+
"dial-h1-text text-primary",
|
|
144
|
+
H,
|
|
145
|
+
a.tabsSectionLabel
|
|
146
|
+
),
|
|
147
|
+
children: d
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
N
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
) : N;
|
|
92
156
|
};
|
|
93
157
|
export {
|
|
94
|
-
|
|
158
|
+
M as Tabs
|
|
95
159
|
};
|
|
@@ -1,64 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { IconX as
|
|
3
|
-
import { DIAL_KIT_ICON_STROKE as
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { ElementSize as
|
|
1
|
+
import { jsxs as x, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { IconX as C } from "@tabler/icons-react";
|
|
3
|
+
import { DIAL_KIT_ICON_STROKE as _ } from "../constants/icon.js";
|
|
4
|
+
import { DIAL_ICON_SIZE as y } from "../../../constants/icon.js";
|
|
5
|
+
import { ElementSize as D } from "../../../types/size.js";
|
|
6
6
|
import { TagAppearance as d } from "../../../types/tag.js";
|
|
7
|
-
import { mergeClasses as
|
|
8
|
-
import { GhostIconButton as
|
|
9
|
-
import { tagInteractiveClassName as
|
|
10
|
-
|
|
7
|
+
import { mergeClasses as T } from "../../../utils/merge-classes.js";
|
|
8
|
+
import { GhostIconButton as A } from "../IconButton/IconButtonWrappers.js";
|
|
9
|
+
import { tagInteractiveClassName as K, tagHoverClassName as L, tagStateClassNames as w, tagBaseClassName as z } from "./constants.js";
|
|
10
|
+
import { DIAL_KIT_CLASS as E } from "../../../constants/public-class-names.js";
|
|
11
|
+
const X = ({
|
|
11
12
|
label: o,
|
|
12
|
-
icon:
|
|
13
|
-
appearance:
|
|
14
|
-
selected:
|
|
13
|
+
icon: m,
|
|
14
|
+
appearance: l = d.Outlined,
|
|
15
|
+
selected: i = !1,
|
|
15
16
|
disabled: t = !1,
|
|
16
17
|
closable: p = !1,
|
|
17
18
|
removeLabel: u,
|
|
18
|
-
className:
|
|
19
|
-
title:
|
|
20
|
-
onClick:
|
|
19
|
+
className: I,
|
|
20
|
+
title: g,
|
|
21
|
+
onClick: n,
|
|
21
22
|
onRemove: c,
|
|
22
|
-
onKeyDown:
|
|
23
|
-
...
|
|
23
|
+
onKeyDown: h,
|
|
24
|
+
...s
|
|
24
25
|
}) => {
|
|
25
|
-
const f =
|
|
26
|
-
|
|
26
|
+
const f = l === d.Selectable, a = !!n && !t, N = p && !!c && !t, S = f && i, k = (e) => {
|
|
27
|
+
h?.(e), !(!a || e.defaultPrevented) && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.click());
|
|
27
28
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ x(
|
|
29
30
|
"span",
|
|
30
31
|
{
|
|
31
|
-
...
|
|
32
|
-
role: a ? "button" :
|
|
33
|
-
tabIndex: a ? 0 :
|
|
32
|
+
...s,
|
|
33
|
+
role: a ? "button" : s.role,
|
|
34
|
+
tabIndex: a ? 0 : s.tabIndex,
|
|
34
35
|
"aria-disabled": t || void 0,
|
|
35
|
-
"aria-pressed": f && a ?
|
|
36
|
-
onClick: t ? void 0 :
|
|
37
|
-
onKeyDown:
|
|
38
|
-
className:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
"aria-pressed": f && a ? i : void 0,
|
|
37
|
+
onClick: t ? void 0 : n,
|
|
38
|
+
onKeyDown: k,
|
|
39
|
+
className: T(
|
|
40
|
+
z,
|
|
41
|
+
S ? "dial-tiny-semi-text" : "dial-tiny-text",
|
|
42
|
+
w[l][i ? "selected" : "default"],
|
|
42
43
|
// The design defines no disabled tag, so a disabled one keeps its
|
|
43
44
|
// colours and only stops responding.
|
|
44
45
|
t && "cursor-not-allowed",
|
|
45
|
-
a && [
|
|
46
|
-
|
|
46
|
+
a && [K, L],
|
|
47
|
+
I,
|
|
48
|
+
E.tag
|
|
47
49
|
),
|
|
48
50
|
children: [
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ r("span", { className: "truncate", title:
|
|
51
|
+
m && /* @__PURE__ */ r("span", { className: "flex shrink-0 items-center", "aria-hidden": "true", children: m }),
|
|
52
|
+
/* @__PURE__ */ r("span", { className: "truncate", title: g ?? o, children: o }),
|
|
51
53
|
N && /* @__PURE__ */ r(
|
|
52
|
-
|
|
54
|
+
A,
|
|
53
55
|
{
|
|
54
56
|
className: "size-[16px] shrink-0 dial-kit-minimum-target",
|
|
55
|
-
size:
|
|
57
|
+
size: D.Small,
|
|
56
58
|
"aria-label": u ?? `Remove ${o}`,
|
|
57
59
|
icon: /* @__PURE__ */ r(
|
|
58
|
-
|
|
60
|
+
C,
|
|
59
61
|
{
|
|
60
|
-
size:
|
|
61
|
-
stroke:
|
|
62
|
+
size: y.SM,
|
|
63
|
+
stroke: _,
|
|
62
64
|
"aria-hidden": "true"
|
|
63
65
|
}
|
|
64
66
|
),
|
|
@@ -72,5 +74,5 @@ const H = ({
|
|
|
72
74
|
);
|
|
73
75
|
};
|
|
74
76
|
export {
|
|
75
|
-
|
|
77
|
+
X as Tag
|
|
76
78
|
};
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { jsxs as D, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useId as oe, useRef as
|
|
3
|
-
import { ElementSize as
|
|
2
|
+
import { useId as oe, useRef as T, useState as I, useCallback as R, useEffect as ae } from "react";
|
|
3
|
+
import { ElementSize as V } from "../../../types/size.js";
|
|
4
4
|
import { mergeClasses as c } from "../../../utils/merge-classes.js";
|
|
5
5
|
import { Input as le } from "../Input/Input.js";
|
|
6
6
|
import { Tag as d } from "../Tag/Tag.js";
|
|
7
7
|
import { getVisibleTagCount as ce } from "./utils.js";
|
|
8
|
-
|
|
8
|
+
import { DIAL_KIT_CLASS as me } from "../../../constants/public-class-names.js";
|
|
9
|
+
const pe = 4, ue = 24, A = (r) => parseFloat(r) || 0, fe = (r) => {
|
|
9
10
|
let o = r.length;
|
|
10
11
|
for (; o > 0 && r[o - 1] === ","; ) o--;
|
|
11
12
|
return r.slice(0, o);
|
|
12
|
-
},
|
|
13
|
-
},
|
|
13
|
+
}, de = () => {
|
|
14
|
+
}, ve = ({
|
|
14
15
|
id: r,
|
|
15
16
|
value: o,
|
|
16
|
-
defaultValue:
|
|
17
|
-
size:
|
|
18
|
-
labelProps:
|
|
19
|
-
placeholder:
|
|
17
|
+
defaultValue: P,
|
|
18
|
+
size: v = V.Standard,
|
|
19
|
+
labelProps: y,
|
|
20
|
+
placeholder: j,
|
|
20
21
|
caption: B,
|
|
21
|
-
error:
|
|
22
|
-
invalid:
|
|
22
|
+
error: K,
|
|
23
|
+
invalid: M,
|
|
23
24
|
disabled: m = !1,
|
|
24
25
|
readOnly: p = !1,
|
|
25
26
|
collapseTagOverflow: s = !1,
|
|
26
|
-
ariaLabel:
|
|
27
|
+
ariaLabel: G,
|
|
27
28
|
tagListLabel: U = "Tags",
|
|
28
29
|
className: X,
|
|
29
30
|
fieldClassName: $,
|
|
30
31
|
tagClassName: u,
|
|
31
|
-
onChange:
|
|
32
|
+
onChange: N
|
|
32
33
|
}) => {
|
|
33
|
-
const z = oe(), F = r || z, q =
|
|
34
|
-
|
|
35
|
-
), n = g ? o : H, i = n.length, [f,
|
|
34
|
+
const z = oe(), F = r || z, q = v === V.Small, h = T(null), S = T([]), _ = T(null), g = o !== void 0, [H, J] = I(
|
|
35
|
+
P ?? []
|
|
36
|
+
), n = g ? o : H, i = n.length, [f, k] = I(""), [E, b] = I(i), l = !p && !m, w = R(
|
|
36
37
|
(e) => {
|
|
37
|
-
g || J(e),
|
|
38
|
+
g || J(e), N?.(e);
|
|
38
39
|
},
|
|
39
|
-
[g,
|
|
40
|
-
), Q =
|
|
40
|
+
[g, N]
|
|
41
|
+
), Q = R(
|
|
41
42
|
(e) => (t) => {
|
|
42
43
|
S.current[e] = t;
|
|
43
44
|
},
|
|
44
45
|
[]
|
|
45
|
-
), x =
|
|
46
|
+
), x = R(() => {
|
|
46
47
|
const e = h.current;
|
|
47
48
|
if (!e || e.clientWidth === 0) {
|
|
48
49
|
b(n.length);
|
|
@@ -51,12 +52,12 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
51
52
|
const { paddingLeft: t, paddingRight: ie } = getComputedStyle(e);
|
|
52
53
|
b(
|
|
53
54
|
ce({
|
|
54
|
-
availableWidth: e.clientWidth -
|
|
55
|
+
availableWidth: e.clientWidth - A(t) - A(ie) - (p ? 0 : ue),
|
|
55
56
|
tagWidths: n.map(
|
|
56
|
-
(
|
|
57
|
+
(he, re) => S.current[re]?.offsetWidth ?? 0
|
|
57
58
|
),
|
|
58
|
-
overflowChipWidth:
|
|
59
|
-
gap:
|
|
59
|
+
overflowChipWidth: _.current?.offsetWidth ?? 0,
|
|
60
|
+
gap: pe
|
|
60
61
|
})
|
|
61
62
|
);
|
|
62
63
|
}, [p, n]);
|
|
@@ -76,23 +77,23 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
76
77
|
s ? "shrink-0" : "min-w-0",
|
|
77
78
|
u
|
|
78
79
|
), Z = (e) => {
|
|
79
|
-
const t =
|
|
80
|
+
const t = fe(e.trim()).trim();
|
|
80
81
|
!t || n.includes(t) || w([...n, t]);
|
|
81
82
|
}, O = (e) => {
|
|
82
83
|
w(n.filter((t) => t !== e));
|
|
83
|
-
},
|
|
84
|
-
Z(f),
|
|
84
|
+
}, L = () => {
|
|
85
|
+
Z(f), k("");
|
|
85
86
|
}, ee = (e) => {
|
|
86
87
|
if (l) {
|
|
87
88
|
if (e.key === "Enter" || e.key === ",") {
|
|
88
|
-
e.preventDefault(),
|
|
89
|
+
e.preventDefault(), L();
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
92
|
e.key === "Backspace" && !f && i > 0 && (e.preventDefault(), w(n.slice(0, -1)));
|
|
92
93
|
}
|
|
93
94
|
}, te = () => {
|
|
94
|
-
l && f.trim() &&
|
|
95
|
-
}, ne = s ? n.slice(0,
|
|
95
|
+
l && f.trim() && L();
|
|
96
|
+
}, ne = s ? n.slice(0, E) : n, C = s ? n.slice(E) : [], W = C.join(", "), se = i > 0 && /* @__PURE__ */ D(
|
|
96
97
|
"span",
|
|
97
98
|
{
|
|
98
99
|
role: "list",
|
|
@@ -119,8 +120,8 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
119
120
|
{
|
|
120
121
|
role: "listitem",
|
|
121
122
|
label: `+${C.length}`,
|
|
122
|
-
"aria-label":
|
|
123
|
-
title:
|
|
123
|
+
"aria-label": W,
|
|
124
|
+
title: W,
|
|
124
125
|
className: c("shrink-0", u),
|
|
125
126
|
disabled: m
|
|
126
127
|
}
|
|
@@ -143,13 +144,13 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
143
144
|
className: u,
|
|
144
145
|
disabled: m,
|
|
145
146
|
closable: l,
|
|
146
|
-
onRemove: l ?
|
|
147
|
+
onRemove: l ? de : void 0
|
|
147
148
|
}
|
|
148
149
|
)
|
|
149
150
|
},
|
|
150
151
|
e
|
|
151
152
|
)),
|
|
152
|
-
/* @__PURE__ */ a("span", { ref:
|
|
153
|
+
/* @__PURE__ */ a("span", { ref: _, className: "inline-flex", children: /* @__PURE__ */ a(d, { label: `+${i}`, className: u }) })
|
|
153
154
|
]
|
|
154
155
|
}
|
|
155
156
|
)
|
|
@@ -160,18 +161,18 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
160
161
|
le,
|
|
161
162
|
{
|
|
162
163
|
id: F,
|
|
163
|
-
size:
|
|
164
|
-
labelProps:
|
|
164
|
+
size: v,
|
|
165
|
+
labelProps: y,
|
|
165
166
|
caption: B,
|
|
166
|
-
error:
|
|
167
|
-
invalid:
|
|
167
|
+
error: K,
|
|
168
|
+
invalid: M,
|
|
168
169
|
disabled: m,
|
|
169
170
|
readOnly: p,
|
|
170
171
|
value: f,
|
|
171
|
-
placeholder: i > 0 ? void 0 :
|
|
172
|
-
"aria-label":
|
|
172
|
+
placeholder: i > 0 ? void 0 : j,
|
|
173
|
+
"aria-label": G,
|
|
173
174
|
wrapperRef: h,
|
|
174
|
-
onChange: (e) =>
|
|
175
|
+
onChange: (e) => k(e ?? ""),
|
|
175
176
|
onKeyDown: ee,
|
|
176
177
|
onBlur: te,
|
|
177
178
|
containerClassName: c("w-full", X),
|
|
@@ -181,7 +182,8 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
181
182
|
q ? "min-h-[24px] py-0.5" : "min-h-[40px] py-1.5",
|
|
182
183
|
s ? "flex-nowrap overflow-hidden" : "flex-wrap"
|
|
183
184
|
],
|
|
184
|
-
|
|
185
|
+
$,
|
|
186
|
+
me.tagInput
|
|
185
187
|
),
|
|
186
188
|
className: c(
|
|
187
189
|
"w-auto flex-1",
|
|
@@ -193,5 +195,5 @@ const me = 4, pe = 24, P = (r) => parseFloat(r) || 0, ue = (r) => {
|
|
|
193
195
|
);
|
|
194
196
|
};
|
|
195
197
|
export {
|
|
196
|
-
|
|
198
|
+
ve as TagInput
|
|
197
199
|
};
|
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as f } from "react";
|
|
3
|
-
import { ButtonAppearance as
|
|
3
|
+
import { ButtonAppearance as B, ButtonVariant as b } from "../../../types/button.js";
|
|
4
4
|
import { ElementSize as C } from "../../../types/size.js";
|
|
5
|
-
import { mergeClasses as
|
|
6
|
-
import { resolveAccessibleName as
|
|
7
|
-
import { IconButton as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { mergeClasses as I } from "../../../utils/merge-classes.js";
|
|
6
|
+
import { resolveAccessibleName as g } from "../../../utils/accessible-name.js";
|
|
7
|
+
import { IconButton as A } from "../IconButton/IconButton.js";
|
|
8
|
+
import { Tooltip as h } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { DIAL_KIT_CLASS as v } from "../../../constants/public-class-names.js";
|
|
10
|
+
const y = ({
|
|
11
|
+
icon: t,
|
|
11
12
|
selectedIcon: l,
|
|
12
|
-
isSelected:
|
|
13
|
-
onToggle:
|
|
13
|
+
isSelected: o = !1,
|
|
14
|
+
onToggle: a,
|
|
14
15
|
onClick: m,
|
|
15
|
-
tooltipProps:
|
|
16
|
+
tooltipProps: r,
|
|
16
17
|
size: s = C.Small,
|
|
17
18
|
className: c,
|
|
18
19
|
...n
|
|
19
20
|
}) => {
|
|
20
21
|
const p = f(
|
|
21
22
|
(u) => {
|
|
22
|
-
m?.(u),
|
|
23
|
+
m?.(u), a?.(!o);
|
|
23
24
|
},
|
|
24
|
-
[m,
|
|
25
|
+
[m, a, o]
|
|
25
26
|
), e = /* @__PURE__ */ i(
|
|
26
|
-
|
|
27
|
+
A,
|
|
27
28
|
{
|
|
28
29
|
...n,
|
|
29
30
|
size: s,
|
|
30
|
-
variant:
|
|
31
|
-
appearance:
|
|
32
|
-
icon:
|
|
33
|
-
"aria-pressed":
|
|
34
|
-
"aria-label":
|
|
31
|
+
variant: b.Primary,
|
|
32
|
+
appearance: B.Ghost,
|
|
33
|
+
icon: o ? l ?? t : t,
|
|
34
|
+
"aria-pressed": o,
|
|
35
|
+
"aria-label": g(
|
|
35
36
|
n["aria-label"],
|
|
36
|
-
|
|
37
|
+
r?.tooltip
|
|
37
38
|
),
|
|
38
39
|
onClick: p,
|
|
39
|
-
className:
|
|
40
|
+
className: I(
|
|
40
41
|
"!rounded",
|
|
41
42
|
// The glyph stays 16px at every size tier — only the tint square grows.
|
|
42
43
|
// CSS outranks the width/height attributes Tabler renders, so callers
|
|
43
44
|
// need not pass a size and the two icons can never disagree.
|
|
44
45
|
"[&_svg]:size-4",
|
|
45
|
-
|
|
46
|
-
c
|
|
46
|
+
o && "!text-accent",
|
|
47
|
+
c,
|
|
48
|
+
v.toggleIconButton
|
|
47
49
|
)
|
|
48
50
|
}
|
|
49
51
|
);
|
|
50
|
-
return
|
|
52
|
+
return r ? /* @__PURE__ */ i(h, { asChild: !0, ...r, children: e }) : e;
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
y as ToggleIconButton
|
|
54
56
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useMergeRefs as i, FloatingPortal as
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMergeRefs as i, FloatingPortal as p, FloatingArrow as c } from "@floating-ui/react";
|
|
3
3
|
import f from "classnames";
|
|
4
4
|
import { useRef as g } from "react";
|
|
5
5
|
import { useThemeScope as u } from "../ThemeScope/ThemeScope.js";
|
|
6
6
|
import { useHasHover as x } from "../../../hooks/use-has-hover.js";
|
|
7
7
|
import { arrowClassName as d, tooltipClassName as h } from "./constants.js";
|
|
8
8
|
import { useTooltipContext as N } from "./TooltipContext.js";
|
|
9
|
-
|
|
9
|
+
import { DIAL_KIT_CLASS as C } from "../../../constants/public-class-names.js";
|
|
10
|
+
const j = ({
|
|
10
11
|
style: r,
|
|
11
12
|
...t
|
|
12
13
|
}) => {
|
|
13
|
-
const o = N(), s = x(), l = u(), a = g(null),
|
|
14
|
-
return !o.open || !s ? null : /* @__PURE__ */ e(
|
|
14
|
+
const o = N(), s = x(), l = u(), a = g(null), m = i([o.refs.setFloating, a]);
|
|
15
|
+
return !o.open || !s ? null : /* @__PURE__ */ e(p, { id: "tooltip-portal", children: /* @__PURE__ */ n(
|
|
15
16
|
"div",
|
|
16
17
|
{
|
|
17
|
-
ref:
|
|
18
|
+
ref: m,
|
|
18
19
|
"data-placement": o.placement,
|
|
19
20
|
style: {
|
|
20
21
|
...o.floatingStyles,
|
|
@@ -24,12 +25,13 @@ const T = ({
|
|
|
24
25
|
className: f(
|
|
25
26
|
h,
|
|
26
27
|
l,
|
|
27
|
-
o.getFloatingProps(t).className
|
|
28
|
+
o.getFloatingProps(t).className,
|
|
29
|
+
C.tooltip
|
|
28
30
|
),
|
|
29
31
|
children: [
|
|
30
32
|
t.children,
|
|
31
33
|
/* @__PURE__ */ e(
|
|
32
|
-
|
|
34
|
+
c,
|
|
33
35
|
{
|
|
34
36
|
ref: o.arrowRef,
|
|
35
37
|
context: o.context,
|
|
@@ -41,5 +43,5 @@ const T = ({
|
|
|
41
43
|
) });
|
|
42
44
|
};
|
|
43
45
|
export {
|
|
44
|
-
|
|
46
|
+
j as TooltipContent
|
|
45
47
|
};
|