@epam/ai-dial-ui-kit 0.15.0-dev.4 → 0.15.0-dev.42
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 +191 -0
- package/dist/CHANGELOG.md +75 -0
- package/dist/DateCellRenderer-ChqbDlQ2.cjs +1 -0
- package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-Cl_mNbi1.cjs} +31 -31
- package/dist/IconButton-DHOFapLo.cjs +1 -0
- package/dist/JsonEditor-CpSpVa0v.cjs +1 -0
- package/dist/{MarkdownEditor-jQ8nDJfx.cjs → MarkdownEditor-CPzMv3lE.cjs} +1 -1
- package/dist/{MarkdownEditor-DHn2pYOJ.cjs → MarkdownEditor-NYMcKLJy.cjs} +1 -1
- package/dist/MarkdownEditorContainer-DVPRplYf.cjs +1 -0
- package/dist/{Switch-CUKClcEz.cjs → Switch-DE6MrcqJ.cjs} +1 -1
- package/dist/components/Button/constants.js +9 -8
- package/dist/components/Dropdown/Dropdown.js +70 -65
- package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
- package/dist/components/Dropdown/constants.js +16 -14
- package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
- package/dist/components/FileManager/FileManager.js +373 -372
- package/dist/components/FileManager/FileManagerProvider.js +266 -264
- package/dist/components/FileManager/hooks/use-grid-context-menu.js +59 -59
- package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +18 -16
- package/dist/components/New/Accordion/Accordion.js +87 -71
- package/dist/components/New/AutocompleteTagInput/AutocompleteTagInput.js +206 -0
- package/dist/components/New/AutocompleteTagInput/utils.js +11 -0
- package/dist/components/New/Avatar/Avatar.js +70 -0
- package/dist/components/New/Badge/Badge.js +45 -0
- package/dist/components/New/BottomSheet/BottomSheet.js +128 -0
- package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
- package/dist/components/New/Breadcrumbs/constants.js +41 -0
- package/dist/components/New/Button/Button.js +32 -32
- package/dist/components/New/Button/ButtonWrappers.js +93 -37
- package/dist/components/New/Button/constants.js +3 -0
- package/dist/components/New/Button/utils.js +18 -8
- package/dist/components/New/ButtonDropdown/ButtonDropdown.js +26 -16
- package/dist/components/New/Calendar/Calendar.js +301 -265
- package/dist/components/New/Calendar/constants.js +5 -5
- 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 +38 -37
- package/dist/components/New/ConfirmationPopup/constants.js +8 -11
- package/dist/components/New/Dropdown/Dropdown.js +112 -105
- package/dist/components/New/Dropdown/DropdownSubMenuItem.js +17 -17
- package/dist/components/New/Dropdown/constants.js +22 -17
- package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +20 -18
- package/dist/components/New/EntityIdentity/EntityIdentity.js +135 -0
- package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
- package/dist/components/New/FileIcon/FileIcon.js +55 -0
- package/dist/components/New/FileIcon/constants.js +134 -0
- package/dist/components/New/FileIcon/icons/FileGlyph.js +150 -0
- package/dist/components/New/FileIcon/icons/FolderGlyph.js +50 -0
- package/dist/components/New/FileName/FileName.js +78 -0
- package/dist/components/New/FilterChips/FilterChips.js +43 -0
- package/dist/components/New/FilterChips/constants.js +5 -0
- package/dist/components/New/FolderName/FolderName.js +16 -0
- package/dist/components/New/FolderPath/FolderPath.js +29 -28
- package/dist/components/New/Highlight/Highlight.js +23 -30
- package/dist/components/New/IconButton/IconButton.js +30 -28
- package/dist/components/New/InfoButton/InfoButton.js +13 -11
- package/dist/components/New/InlineSelect/InlineSelect.js +74 -56
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +41 -39
- package/dist/components/New/InteractiveTooltip/constants.js +2 -2
- 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 +33 -29
- 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 +46 -44
- package/dist/components/New/Popup/constants.js +3 -3
- 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/CollapsedSelectTags.js +127 -0
- package/dist/components/New/Select/MultiSelectTags.js +18 -15
- package/dist/components/New/Select/Select.js +219 -197
- package/dist/components/New/Select/constants.js +23 -20
- package/dist/components/New/SharedEntityIndicator/SharedEntityIndicator.js +34 -0
- package/dist/components/New/SideDrawer/SideDrawer.js +148 -0
- 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 +48 -44
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +26 -24
- package/dist/components/New/Tooltip/TooltipContent.js +11 -9
- package/dist/components/New/Tooltip/constants.js +1 -1
- package/dist/components/New/TransferQueue/TransferQueue.js +124 -0
- package/dist/components/New/TransferQueue/TransferQueueHeader.js +71 -0
- package/dist/components/New/TransferQueue/TransferQueueRow.js +119 -0
- package/dist/components/New/TransferQueue/constants.js +24 -0
- package/dist/components/New/constants/overlay.js +17 -9
- package/dist/components/Popup/constants.js +8 -8
- package/dist/components/ProgressBar/ProgressBar.js +45 -33
- package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
- package/dist/components/SchemaRenderer/components/SchemaField.js +19 -19
- package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +18 -18
- package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
- package/dist/components/SchemaRenderer/types.js +19 -8
- package/dist/components/SchemaRenderer/utils.js +122 -95
- package/dist/components/Skeleton/Skeleton.js +25 -19
- package/dist/components/Spinner/Spinner.js +7 -5
- package/dist/components/Tooltip/TooltipContent.js +11 -11
- package/dist/components-manifest.json +1653 -71
- package/dist/constants/public-class-names.js +210 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +346 -299
- package/dist/editor-Bc9xzKuR.cjs +1 -0
- package/dist/editors.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/index.css +2 -2
- package/dist/lazy-Cy9WobJf.cjs +1 -0
- package/dist/merge-classes-BEJXjzkx.cjs +1 -0
- package/dist/migration-guides/0.15.0/legacy-theme-variable-fallbacks-removal.md +69 -0
- package/dist/migration-guides/README.md +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +419 -399
- package/dist/src/components/FileManager/FileManager.d.ts +2 -0
- package/dist/src/components/FileManager/FileManagerContext.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +2 -1
- package/dist/src/components/New/Accordion/Accordion.d.ts +6 -1
- package/dist/src/components/New/AutocompleteTagInput/AutocompleteTagInput.d.ts +97 -0
- package/dist/src/components/New/AutocompleteTagInput/utils.d.ts +17 -0
- package/dist/src/components/New/AutocompleteTagInput/utils.spec.d.ts +1 -0
- package/dist/src/components/New/Avatar/Avatar.d.ts +55 -0
- package/dist/src/components/New/Badge/Badge.d.ts +47 -0
- package/dist/src/components/New/BottomSheet/BottomSheet.d.ts +84 -0
- 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/Button/Button.d.ts +4 -1
- package/dist/src/components/New/Button/ButtonWrappers.d.ts +20 -0
- package/dist/src/components/New/Button/utils.d.ts +15 -0
- package/dist/src/components/New/ButtonDropdown/ButtonDropdown.d.ts +4 -0
- package/dist/src/components/New/Calendar/Calendar.d.ts +7 -1
- package/dist/src/components/New/Calendar/constants.d.ts +1 -1
- package/dist/src/components/New/ConfirmationPopup/constants.d.ts +0 -1
- package/dist/src/components/New/Dropdown/Dropdown.d.ts +9 -1
- package/dist/src/components/New/Dropdown/constants.d.ts +3 -0
- package/dist/src/components/New/EntityIdentity/EntityIdentity.d.ts +85 -0
- package/dist/src/components/New/FileIcon/FileIcon.d.ts +61 -0
- package/dist/src/components/New/FileIcon/constants.d.ts +16 -0
- package/dist/src/components/New/FileIcon/icons/FileGlyph.d.ts +18 -0
- package/dist/src/components/New/FileIcon/icons/FolderGlyph.d.ts +17 -0
- package/dist/src/components/New/FileName/FileName.d.ts +79 -0
- 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/FolderName/FolderName.d.ts +37 -0
- package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +16 -1
- package/dist/src/components/New/InteractiveTooltip/constants.d.ts +5 -4
- package/dist/src/components/New/Notification/Notification.d.ts +18 -0
- package/dist/src/components/New/Popup/constants.d.ts +1 -1
- package/dist/src/components/New/Select/CollapsedSelectTags.d.ts +22 -0
- package/dist/src/components/New/Select/MultiSelectTags.d.ts +5 -0
- package/dist/src/components/New/Select/Select.d.ts +9 -0
- package/dist/src/components/New/Select/constants.d.ts +3 -2
- package/dist/src/components/New/SharedEntityIndicator/SharedEntityIndicator.d.ts +35 -0
- package/dist/src/components/New/SideDrawer/SideDrawer.d.ts +100 -0
- package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
- package/dist/src/components/New/Tooltip/constants.d.ts +5 -3
- package/dist/src/components/New/TransferQueue/TransferQueue.d.ts +139 -0
- package/dist/src/components/New/TransferQueue/TransferQueueHeader.d.ts +16 -0
- package/dist/src/components/New/TransferQueue/TransferQueueRow.d.ts +10 -0
- package/dist/src/components/New/TransferQueue/constants.d.ts +6 -0
- package/dist/src/components/New/constants/overlay.d.ts +13 -0
- package/dist/src/components/Popup/constants.d.ts +1 -1
- package/dist/src/components/SchemaRenderer/types.d.ts +11 -0
- package/dist/src/components/SchemaRenderer/utils.d.ts +10 -1
- package/dist/src/constants/public-class-names.d.ts +201 -0
- package/dist/src/index.d.ts +36 -1
- package/dist/src/types/accordion.d.ts +7 -0
- package/dist/src/types/avatar.d.ts +7 -0
- package/dist/src/types/badge.d.ts +16 -0
- package/dist/src/types/breadcrumbs.d.ts +9 -0
- package/dist/src/types/button.d.ts +1 -0
- package/dist/src/types/entity-type.d.ts +9 -0
- package/dist/src/types/transfer-queue.d.ts +10 -0
- package/dist/src/utils/__tests__/avatar.spec.d.ts +1 -0
- package/dist/src/utils/avatar.d.ts +12 -0
- package/dist/src/utils/sub-menu-floating.d.ts +7 -4
- package/dist/types/accordion.js +4 -0
- package/dist/types/avatar.js +4 -0
- package/dist/types/badge.js +5 -0
- package/dist/types/breadcrumbs.js +4 -0
- package/dist/types/button.js +3 -3
- package/dist/types/entity-type.js +4 -0
- package/dist/types/transfer-queue.js +4 -0
- package/dist/use-file-manager-tabs-C-dMqEFy.cjs +3 -0
- package/dist/utils/avatar.js +22 -0
- package/dist/utils/merge-classes.js +12 -5
- package/dist/utils/sub-menu-floating.js +99 -54
- package/package.json +4 -7
- package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
- package/dist/IconButton-DWqoaBWf.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/merge-classes-Dipy1Ih1.cjs +0 -1
- package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { IconArrowUpRight as a } from "@tabler/icons-react";
|
|
3
|
+
import { DIAL_KIT_ICON_STROKE as m } from "../constants/icon.js";
|
|
4
|
+
import { Tooltip as d } from "../Tooltip/Tooltip.js";
|
|
5
|
+
import { DIAL_KIT_CLASS as s } from "../../../constants/public-class-names.js";
|
|
6
|
+
import { mergeClasses as n } from "../../../utils/merge-classes.js";
|
|
7
|
+
const S = ({
|
|
8
|
+
label: o = "Shared",
|
|
9
|
+
tooltip: t,
|
|
10
|
+
size: e = 12,
|
|
11
|
+
className: i
|
|
12
|
+
}) => /* @__PURE__ */ r(d, { tooltip: t || "Shared", asChild: !0, children: /* @__PURE__ */ r(
|
|
13
|
+
"span",
|
|
14
|
+
{
|
|
15
|
+
role: "img",
|
|
16
|
+
"aria-label": o,
|
|
17
|
+
className: n(
|
|
18
|
+
"flex shrink-0 rounded-sm bg-layer-raised text-accent",
|
|
19
|
+
i,
|
|
20
|
+
s.sharedEntityIndicator
|
|
21
|
+
),
|
|
22
|
+
children: /* @__PURE__ */ r(
|
|
23
|
+
a,
|
|
24
|
+
{
|
|
25
|
+
size: e,
|
|
26
|
+
stroke: m,
|
|
27
|
+
"aria-hidden": "true"
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
export {
|
|
33
|
+
S as SharedEntityIndicator
|
|
34
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as A, useRole as E, useDismiss as K, useInteractions as P, FloatingPortal as j, FloatingOverlay as M, FloatingFocusManager as R } from "@floating-ui/react";
|
|
3
|
+
import { IconChevronLeft as B } from "@tabler/icons-react";
|
|
4
|
+
import { useId as G } from "react";
|
|
5
|
+
import { CloseButton as H } from "../CloseButton/CloseButton.js";
|
|
6
|
+
import { DIAL_KIT_ICON_STROKE as Z } from "../constants/icon.js";
|
|
7
|
+
import { GhostIconButton as $ } from "../IconButton/IconButtonWrappers.js";
|
|
8
|
+
import { useThemeScope as q } from "../ThemeScope/ThemeScope.js";
|
|
9
|
+
import { DIAL_ICON_SIZE as J } from "../../../constants/icon.js";
|
|
10
|
+
import { DIAL_KIT_CLASS as Q } from "../../../constants/public-class-names.js";
|
|
11
|
+
import { ElementSize as U } from "../../../types/size.js";
|
|
12
|
+
import { mergeClasses as r } from "../../../utils/merge-classes.js";
|
|
13
|
+
const ne = ({
|
|
14
|
+
open: t,
|
|
15
|
+
onClose: l,
|
|
16
|
+
header: o,
|
|
17
|
+
ariaLabel: f,
|
|
18
|
+
headerActions: p,
|
|
19
|
+
onBack: i,
|
|
20
|
+
backAriaLabel: u = "Back",
|
|
21
|
+
backDisabled: x = !1,
|
|
22
|
+
closeAriaLabel: g = "Close",
|
|
23
|
+
closeDisabled: b = !1,
|
|
24
|
+
hideClose: n = !1,
|
|
25
|
+
closeOnOutsideClick: h = !0,
|
|
26
|
+
children: y,
|
|
27
|
+
className: I,
|
|
28
|
+
overlayClassName: v,
|
|
29
|
+
headerClassName: S,
|
|
30
|
+
style: w,
|
|
31
|
+
overlayStyle: N,
|
|
32
|
+
bodyClassName: k,
|
|
33
|
+
titleClassName: F,
|
|
34
|
+
portalId: C
|
|
35
|
+
}) => {
|
|
36
|
+
const D = q(), d = `side-drawer-title-${G()}`, s = typeof o == "string", { refs: m, context: a } = A({
|
|
37
|
+
open: t,
|
|
38
|
+
onOpenChange: (z) => {
|
|
39
|
+
z || l();
|
|
40
|
+
}
|
|
41
|
+
}), _ = E(a, { role: "dialog" }), L = K(a, { outsidePress: h }), { getFloatingProps: T } = P([_, L]), O = o != null || i != null || !n;
|
|
42
|
+
return /* @__PURE__ */ e(j, { id: C, children: /* @__PURE__ */ e(
|
|
43
|
+
M,
|
|
44
|
+
{
|
|
45
|
+
lockScroll: t,
|
|
46
|
+
style: N,
|
|
47
|
+
className: r(
|
|
48
|
+
"z-popup bg-backdrop transition-opacity duration-300 motion-reduce:transition-none",
|
|
49
|
+
t ? "opacity-100" : "pointer-events-none opacity-0",
|
|
50
|
+
D,
|
|
51
|
+
v
|
|
52
|
+
),
|
|
53
|
+
children: /* @__PURE__ */ e(
|
|
54
|
+
R,
|
|
55
|
+
{
|
|
56
|
+
context: a,
|
|
57
|
+
disabled: !t,
|
|
58
|
+
initialFocus: m.floating,
|
|
59
|
+
children: /* @__PURE__ */ c(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: m.setFloating,
|
|
63
|
+
...T(),
|
|
64
|
+
role: "dialog",
|
|
65
|
+
"aria-modal": "true",
|
|
66
|
+
"aria-labelledby": s ? d : void 0,
|
|
67
|
+
"aria-label": s ? void 0 : f,
|
|
68
|
+
inert: !t,
|
|
69
|
+
style: w,
|
|
70
|
+
className: r(
|
|
71
|
+
"fixed inset-y-0 end-0 flex w-full flex-col overflow-hidden bg-layer-raised outline-none",
|
|
72
|
+
"desktop:w-[540px] desktop:rounded-s-xl desktop:border-s desktop:border-secondary",
|
|
73
|
+
"transition-transform duration-300 motion-reduce:transition-none",
|
|
74
|
+
t ? "translate-x-0" : "translate-x-full rtl:-translate-x-full",
|
|
75
|
+
I,
|
|
76
|
+
Q.sideDrawer
|
|
77
|
+
),
|
|
78
|
+
children: [
|
|
79
|
+
O && /* @__PURE__ */ c(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: r(
|
|
83
|
+
"flex shrink-0 items-center gap-2 border-b border-tertiary px-6 py-3",
|
|
84
|
+
S
|
|
85
|
+
),
|
|
86
|
+
children: [
|
|
87
|
+
i && /* @__PURE__ */ e(
|
|
88
|
+
$,
|
|
89
|
+
{
|
|
90
|
+
"aria-label": u,
|
|
91
|
+
disabled: x,
|
|
92
|
+
onClick: i,
|
|
93
|
+
icon: /* @__PURE__ */ e(
|
|
94
|
+
B,
|
|
95
|
+
{
|
|
96
|
+
size: J.MD,
|
|
97
|
+
stroke: Z,
|
|
98
|
+
className: "rtl:-scale-x-100",
|
|
99
|
+
"aria-hidden": "true"
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
s ? /* @__PURE__ */ e(
|
|
105
|
+
"h2",
|
|
106
|
+
{
|
|
107
|
+
id: d,
|
|
108
|
+
className: r(
|
|
109
|
+
"min-w-0 flex-1 truncate text-primary",
|
|
110
|
+
F ?? "dial-h2-text"
|
|
111
|
+
),
|
|
112
|
+
children: o
|
|
113
|
+
}
|
|
114
|
+
) : /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: o }),
|
|
115
|
+
p,
|
|
116
|
+
!n && /* @__PURE__ */ e(
|
|
117
|
+
H,
|
|
118
|
+
{
|
|
119
|
+
ariaLabel: g,
|
|
120
|
+
onClose: l,
|
|
121
|
+
disabled: b,
|
|
122
|
+
size: U.Standard
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ e(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: r(
|
|
132
|
+
"min-h-0 flex-1 overflow-y-auto",
|
|
133
|
+
k
|
|
134
|
+
),
|
|
135
|
+
children: y
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
) });
|
|
145
|
+
};
|
|
146
|
+
export {
|
|
147
|
+
ne as SideDrawer
|
|
148
|
+
};
|
|
@@ -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
|
+
"flex items-center gap-2",
|
|
30
|
+
u,
|
|
31
|
+
N.switch
|
|
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
|
};
|
|
@@ -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
|
};
|