@epam/ai-dial-ui-kit 0.14.0-dev.32 → 0.14.0-dev.34

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.
Files changed (36) hide show
  1. package/dist/CHANGELOG.md +9 -0
  2. package/dist/DateCellRenderer-B41xNX7a.cjs +1 -0
  3. package/dist/components/New/Dropdown/Dropdown.js +170 -189
  4. package/dist/components/New/Dropdown/DropdownSubMenuItem.js +62 -104
  5. package/dist/components/New/Dropdown/constants.js +19 -26
  6. package/dist/components/New/Dropdown/item-mark.js +6 -0
  7. package/dist/components/New/MenuItem/MenuItem.js +108 -0
  8. package/dist/components/New/MenuItem/constants.js +16 -0
  9. package/dist/components/New/SegmentedControl/constants.js +5 -5
  10. package/dist/components/New/Select/MultiSelectTags.js +15 -15
  11. package/dist/components/New/Select/Select.js +218 -229
  12. package/dist/components/New/Select/SelectSubMenuItem.js +54 -71
  13. package/dist/components/New/Select/constants.js +22 -37
  14. package/dist/components/New/constants/overlay.js +11 -7
  15. package/dist/components-manifest.json +143 -4
  16. package/dist/dial-ui-kit.cjs +2 -2
  17. package/dist/dial-ui-kit.js +247 -243
  18. package/dist/grid.cjs +1 -1
  19. package/dist/index.css +1 -1
  20. package/dist/src/components/New/Dropdown/Dropdown.d.ts +10 -0
  21. package/dist/src/components/New/Dropdown/constants.d.ts +5 -4
  22. package/dist/src/components/New/Dropdown/item-mark.d.ts +15 -0
  23. package/dist/src/components/New/MenuItem/MenuItem.d.ts +68 -0
  24. package/dist/src/components/New/MenuItem/constants.d.ts +5 -0
  25. package/dist/src/components/New/SegmentedControl/constants.d.ts +1 -1
  26. package/dist/src/components/New/Select/Select.d.ts +14 -2
  27. package/dist/src/components/New/Select/SelectSubMenuItem.d.ts +3 -0
  28. package/dist/src/components/New/Select/constants.d.ts +12 -5
  29. package/dist/src/components/New/constants/overlay.d.ts +7 -0
  30. package/dist/src/index.d.ts +3 -0
  31. package/dist/src/models/dropdown.d.ts +17 -1
  32. package/dist/src/models/select.d.ts +6 -0
  33. package/dist/src/types/menu-item.d.ts +21 -0
  34. package/dist/types/menu-item.js +4 -0
  35. package/package.json +1 -1
  36. package/dist/DateCellRenderer-CKFfW-Hf.cjs +0 -1
@@ -1,127 +1,85 @@
1
- import { jsxs as s, Fragment as o, jsx as n } from "react/jsx-runtime";
2
- import { useCallback as y } from "react";
3
- import { DialIcon as u } from "../../Icon/Icon.js";
4
- import { mergeClasses as r } from "../../../utils/merge-classes.js";
5
- import { useSubMenuFloating as g, SubMenuPanel as C } from "../../../utils/sub-menu-floating.js";
6
- import { dropdownGap as I, submenuCaretIcon as k, dropdownItemDisabledClassName as b, dropdownItemBaseClassName as c, dropdownSubMenuClassName as F, dropdownItemDangerClassName as S } from "./constants.js";
7
- const v = ({
8
- item: e,
9
- onRootClose: d
1
+ import { jsxs as t, Fragment as d, jsx as a } from "react/jsx-runtime";
2
+ import { useCallback as g } from "react";
3
+ import { MenuItem as l } from "../MenuItem/MenuItem.js";
4
+ import { MenuItemMark as k } from "../../../types/menu-item.js";
5
+ import { useSubMenuFloating as M, SubMenuPanel as C } from "../../../utils/sub-menu-floating.js";
6
+ import { getItemRole as I, resolveItemMark as m } from "./item-mark.js";
7
+ import { dropdownGap as F, submenuCaretIcon as S, dropdownSubMenuClassName as y } from "./constants.js";
8
+ const R = ({
9
+ item: r,
10
+ onRootClose: o
10
11
  }) => {
11
12
  const {
12
- isOpen: t,
13
- refs: l,
14
- floatingStyles: m,
13
+ isOpen: s,
14
+ refs: u,
15
+ floatingStyles: b,
15
16
  context: p,
16
- getReferenceProps: i,
17
+ getReferenceProps: c,
17
18
  getFloatingProps: f
18
- } = g(I, "menu", !!e.disabled), x = y(
19
- (a) => (N) => {
20
- a.disabled || (a.onClick?.({ key: a.key, domEvent: N }), d());
19
+ } = M(F, "menu", !!r.disabled), i = g(
20
+ (e) => (n) => {
21
+ e.disabled || (e.onClick?.({ key: e.key, domEvent: n }), e.selectable || o());
21
22
  },
22
- [d]
23
+ [o]
23
24
  );
24
- return /* @__PURE__ */ s(o, { children: [
25
- /* @__PURE__ */ s(
26
- "button",
25
+ return /* @__PURE__ */ t(d, { children: [
26
+ /* @__PURE__ */ a(
27
+ l,
27
28
  {
28
- ref: l.setReference,
29
- type: "button",
29
+ ref: u.setReference,
30
30
  role: "menuitem",
31
31
  "aria-haspopup": "menu",
32
- "aria-expanded": t,
33
- "aria-disabled": !!e.disabled,
34
- disabled: e.disabled,
35
- className: r(
36
- c,
37
- e.disabled && b,
38
- e.className
39
- ),
40
- ...i(),
41
- children: [
42
- e.renderItem ? e.renderItem(e) : /* @__PURE__ */ s(o, { children: [
43
- e.icon && /* @__PURE__ */ n("span", { className: r(e.disabled && "text-secondary"), children: /* @__PURE__ */ n(u, { icon: e.icon }) }),
44
- /* @__PURE__ */ n(
45
- "span",
46
- {
47
- className: r(
48
- "flex-1 truncate text-start",
49
- e.disabled && "text-secondary"
50
- ),
51
- children: e.label
52
- }
53
- )
54
- ] }),
55
- /* @__PURE__ */ n(
56
- "span",
57
- {
58
- className: r(
59
- "ml-auto shrink-0",
60
- e.disabled && "text-secondary"
61
- ),
62
- children: k
63
- }
64
- )
65
- ]
32
+ "aria-expanded": s,
33
+ "aria-disabled": !!r.disabled,
34
+ disabled: r.disabled,
35
+ icon: r.icon,
36
+ label: r.label,
37
+ trailing: S,
38
+ className: r.className,
39
+ ...c(),
40
+ children: r.renderItem?.(r)
66
41
  }
67
42
  ),
68
- t && /* @__PURE__ */ n(
43
+ s && /* @__PURE__ */ a(
69
44
  C,
70
45
  {
71
- refs: l,
72
- floatingStyles: m,
46
+ refs: u,
47
+ floatingStyles: b,
73
48
  context: p,
74
49
  getFloatingProps: f,
75
50
  role: "menu",
76
- surfaceClassName: F,
77
- children: e.renderSubMenu ? e.renderSubMenu() : /* @__PURE__ */ s(o, { children: [
78
- e.menuHeader && (typeof e.menuHeader == "function" ? e.menuHeader() : e.menuHeader),
79
- e.children.map((a) => /* @__PURE__ */ n(
80
- "button",
81
- {
82
- role: "menuitem",
83
- type: "button",
84
- "aria-disabled": !!a.disabled,
85
- disabled: a.disabled,
86
- className: r(
87
- c,
88
- a.disabled && b,
89
- a.danger && S,
90
- a.className
91
- ),
92
- onClick: x(a),
93
- children: a.renderItem ? a.renderItem(a) : /* @__PURE__ */ s(o, { children: [
94
- a.icon && /* @__PURE__ */ n(
95
- "span",
96
- {
97
- className: r(
98
- a.danger && "text-error",
99
- a.disabled && "text-secondary"
100
- ),
101
- children: /* @__PURE__ */ n(u, { icon: a.icon })
102
- }
103
- ),
104
- /* @__PURE__ */ n(
105
- "span",
106
- {
107
- className: r(
108
- "flex-1 truncate text-start",
109
- a.danger && "text-error",
110
- a.disabled && "text-secondary"
111
- ),
112
- children: a.label
113
- }
114
- )
115
- ] })
116
- },
117
- a.key
118
- )),
119
- e.menuFooter && (typeof e.menuFooter == "function" ? e.menuFooter() : e.menuFooter)
51
+ surfaceClassName: y,
52
+ children: r.renderSubMenu ? r.renderSubMenu() : /* @__PURE__ */ t(d, { children: [
53
+ r.menuHeader && (typeof r.menuHeader == "function" ? r.menuHeader() : r.menuHeader),
54
+ r.children.map((e) => {
55
+ const n = I(e);
56
+ return /* @__PURE__ */ a(
57
+ l,
58
+ {
59
+ role: n,
60
+ "aria-checked": n === "menuitem" ? void 0 : !!e.checked,
61
+ "aria-current": m(e) === k.Highlight && e.checked ? !0 : void 0,
62
+ "aria-disabled": !!e.disabled,
63
+ disabled: e.disabled,
64
+ mark: m(e),
65
+ selected: !!e.checked,
66
+ danger: e.danger,
67
+ icon: e.icon,
68
+ label: e.label,
69
+ className: e.className,
70
+ rightControl: e.rightControl,
71
+ onClick: i(e),
72
+ children: e.renderItem?.(e)
73
+ },
74
+ e.key
75
+ );
76
+ }),
77
+ r.menuFooter && (typeof r.menuFooter == "function" ? r.menuFooter() : r.menuFooter)
120
78
  ] })
121
79
  }
122
80
  )
123
81
  ] });
124
82
  };
125
83
  export {
126
- v as DropdownSubMenuItem
84
+ R as DropdownSubMenuItem
127
85
  };
@@ -1,35 +1,28 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { IconChevronRight as s } from "@tabler/icons-react";
3
- import { overlayGap as r, overlayItemSelectedClassName as a, overlayItemClassName as t, overlaySubMenuClassName as m, overlayItemDisabledClassName as n, overlaySurfaceClassName as d } from "../constants/overlay.js";
4
- import { DIAL_KIT_ICON_STROKE as l } from "../constants/icon.js";
5
- import { DIAL_ICON_SIZE as i } from "../../../constants/icon.js";
6
- import { mergeClasses as e } from "../../../utils/merge-classes.js";
7
- const b = e(
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { IconChevronRight as e } from "@tabler/icons-react";
3
+ import { overlayGap as s, overlaySubMenuClassName as a, overlaySurfaceClassName as t } from "../constants/overlay.js";
4
+ import { DIAL_KIT_ICON_STROKE as n } from "../constants/icon.js";
5
+ import { DIAL_ICON_SIZE as m } from "../../../constants/icon.js";
6
+ import { mergeClasses as o } from "../../../utils/merge-classes.js";
7
+ const C = o(
8
8
  "flex items-center gap-2 align-middle",
9
9
  "h-auto px-0 bg-transparent border-0"
10
- ), w = e(
10
+ ), f = o(
11
11
  "z-[53] focus-visible:outline-none",
12
- d
13
- ), f = m, v = t, y = a, S = e(
14
- n,
15
- "!cursor-not-allowed"
16
- ), g = "text-error", D = "my-1 border-t border-tertiary", x = r, _ = /* @__PURE__ */ o(
17
- s,
12
+ t
13
+ ), b = a, I = "my-1 border-t border-tertiary", N = s, v = /* @__PURE__ */ r(
14
+ e,
18
15
  {
19
- size: i.SM,
20
- stroke: l,
16
+ size: m.SM,
17
+ stroke: n,
21
18
  "aria-hidden": "true"
22
19
  }
23
20
  );
24
21
  export {
25
- b as dropdownBaseClassName,
26
- D as dropdownDividerClassName,
27
- x as dropdownGap,
28
- v as dropdownItemBaseClassName,
29
- g as dropdownItemDangerClassName,
30
- S as dropdownItemDisabledClassName,
31
- y as dropdownItemSelectedClassName,
32
- w as dropdownListBaseClassName,
33
- f as dropdownSubMenuClassName,
34
- _ as submenuCaretIcon
22
+ C as dropdownBaseClassName,
23
+ I as dropdownDividerClassName,
24
+ N as dropdownGap,
25
+ f as dropdownListBaseClassName,
26
+ b as dropdownSubMenuClassName,
27
+ v as submenuCaretIcon
35
28
  };
@@ -0,0 +1,6 @@
1
+ import { MenuItemMark as t } from "../../../types/menu-item.js";
2
+ const r = (e) => e.mark ?? (e.selectable ? t.Checkbox : t.None), m = (e) => e.selectable ? "menuitemcheckbox" : r(e) === t.Check ? "menuitemradio" : "menuitem";
3
+ export {
4
+ m as getItemRole,
5
+ r as resolveItemMark
6
+ };
@@ -0,0 +1,108 @@
1
+ import { jsxs as i, Fragment as g, jsx as t } from "react/jsx-runtime";
2
+ import { DialIcon as k } from "../../Icon/Icon.js";
3
+ import { CheckboxBox as H } from "../Checkbox/CheckboxBox.js";
4
+ import { EllipsisTooltip as M } from "../EllipsisTooltip/EllipsisTooltip.js";
5
+ import { overlayItemDisabledClassName as T, overlayItemSelectedClassName as j, overlayItemHighlightClassName as D, overlayItemClassName as S } from "../constants/overlay.js";
6
+ import { MenuItemMark as s } from "../../../types/menu-item.js";
7
+ import { mergeClasses as e } from "../../../utils/merge-classes.js";
8
+ import { menuItemCheckIcon as B } from "./constants.js";
9
+ const L = ({
10
+ label: l,
11
+ icon: c,
12
+ description: f,
13
+ mark: o = s.None,
14
+ selected: r = !1,
15
+ danger: h = !1,
16
+ trailing: u,
17
+ rightControl: m,
18
+ ellipsisLabel: v = !1,
19
+ labelClassName: x,
20
+ children: d,
21
+ className: I,
22
+ disabled: a = !1,
23
+ type: C = "button",
24
+ ...w
25
+ }) => {
26
+ const y = r && o === s.Highlight, b = r && (o === s.Checkbox || o === s.Tint), n = e(
27
+ h && "text-error",
28
+ a && "text-control-disable-primary"
29
+ ), p = e(
30
+ S,
31
+ // A row that opens a panel stays tinted while that panel is up, so the
32
+ // trail back to it is visible once the pointer has moved into it.
33
+ "aria-expanded:bg-control-accent-alpha-hover",
34
+ y && D,
35
+ b && j,
36
+ a && T,
37
+ h && "text-error",
38
+ I
39
+ ), N = /* @__PURE__ */ i(
40
+ "button",
41
+ {
42
+ type: C,
43
+ disabled: a,
44
+ "data-menu-item-row": m ? "" : void 0,
45
+ className: m ? "flex h-full min-w-0 flex-1 items-center gap-2 truncate text-start focus-visible:outline-none" : p,
46
+ ...w,
47
+ children: [
48
+ d ?? /* @__PURE__ */ i(g, { children: [
49
+ o === s.Checkbox && /* @__PURE__ */ t(H, { isSelected: r, disabled: a }),
50
+ c && /* @__PURE__ */ t(k, { icon: c, className: n }),
51
+ v ? /* @__PURE__ */ t(
52
+ M,
53
+ {
54
+ text: l,
55
+ className: e(n, x)
56
+ }
57
+ ) : /* @__PURE__ */ t(
58
+ "span",
59
+ {
60
+ className: e(
61
+ "min-w-0 flex-1 truncate text-start",
62
+ n,
63
+ x
64
+ ),
65
+ children: l
66
+ }
67
+ ),
68
+ f && /* @__PURE__ */ t(
69
+ "span",
70
+ {
71
+ className: e(
72
+ "shrink-0 text-secondary dial-small-text",
73
+ a && "text-control-disable-primary"
74
+ ),
75
+ children: f
76
+ }
77
+ ),
78
+ r && o === s.Check && B
79
+ ] }),
80
+ u && /* @__PURE__ */ t("span", { className: e("ml-auto shrink-0", n), children: u })
81
+ ]
82
+ }
83
+ );
84
+ return m ? (
85
+ /*
86
+ `role="none"` so the wrapper does not come between a listbox and its
87
+ options: the row inside it keeps the role, the state and the click.
88
+ */
89
+ /* @__PURE__ */ i(
90
+ "div",
91
+ {
92
+ role: "none",
93
+ className: e(
94
+ p,
95
+ "has-[[data-menu-item-row]:focus-visible]:outline",
96
+ "has-[[data-menu-item-row]:focus-visible]:outline-focus"
97
+ ),
98
+ children: [
99
+ N,
100
+ m
101
+ ]
102
+ }
103
+ )
104
+ ) : N;
105
+ };
106
+ export {
107
+ L as MenuItem
108
+ };
@@ -0,0 +1,16 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { IconCheck as r } from "@tabler/icons-react";
3
+ import { DIAL_KIT_ICON_STROKE as m } from "../constants/icon.js";
4
+ import { DIAL_ICON_SIZE as e } from "../../../constants/icon.js";
5
+ const c = /* @__PURE__ */ o(
6
+ r,
7
+ {
8
+ size: e.SM,
9
+ stroke: m,
10
+ className: "shrink-0",
11
+ "aria-hidden": !0
12
+ }
13
+ );
14
+ export {
15
+ c as menuItemCheckIcon
16
+ };
@@ -5,15 +5,15 @@ const e = [
5
5
  "ArrowDown",
6
6
  "Home",
7
7
  "End"
8
- ], t = "inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]", n = "flex h-8 min-w-8 flex-1 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus", a = "bg-layer-raised text-accent shadow-xs", o = "bg-transparent text-secondary", s = "cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active", r = "cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active", c = "cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none", l = "cursor-not-allowed bg-transparent text-control-disable-primary";
8
+ ], t = "inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]", a = "flex h-8 min-w-8 grow shrink-0 basis-auto items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus", o = "bg-layer-raised text-accent shadow-xs", s = "bg-transparent text-secondary", n = "cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active", r = "cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active", c = "cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none", l = "cursor-not-allowed bg-transparent text-control-disable-primary";
9
9
  export {
10
10
  e as NAVIGATION_KEYS,
11
11
  t as containerClassName,
12
- n as segmentClassName,
12
+ a as segmentClassName,
13
13
  c as segmentDisabledSelectedClassName,
14
14
  l as segmentDisabledUnselectedClassName,
15
- a as segmentSelectedClassName,
16
- s as segmentSelectedInteractiveClassName,
17
- o as segmentUnselectedClassName,
15
+ o as segmentSelectedClassName,
16
+ n as segmentSelectedInteractiveClassName,
17
+ s as segmentUnselectedClassName,
18
18
  r as segmentUnselectedInteractiveClassName
19
19
  };
@@ -1,23 +1,23 @@
1
- import { jsx as t, Fragment as c } from "react/jsx-runtime";
2
- import { Tag as i } from "../Tag/Tag.js";
3
- const p = ({
4
- options: n,
5
- selectedValues: a,
1
+ import { jsx as l, Fragment as i } from "react/jsx-runtime";
2
+ import { Tag as c } from "../Tag/Tag.js";
3
+ const b = ({
4
+ options: a,
5
+ selectedValues: n,
6
6
  handleRemoveTag: e
7
- }) => /* @__PURE__ */ t(c, { children: a.map((o) => {
8
- const r = n.find((l) => l.value === o);
9
- return /* @__PURE__ */ t(
10
- i,
7
+ }) => /* @__PURE__ */ l(i, { children: n.map((r) => {
8
+ const t = a.find((o) => o.value === r);
9
+ return /* @__PURE__ */ l(
10
+ c,
11
11
  {
12
- label: r?.label ?? o,
12
+ label: t?.label ?? r,
13
13
  closable: !!e,
14
- onRemove: (l) => e?.(l, o),
15
- icon: r?.icon,
16
- className: "max-w-full"
14
+ onRemove: (o) => e?.(o, r),
15
+ icon: t?.icon,
16
+ className: "max-w-full border border-tertiary"
17
17
  },
18
- o
18
+ r
19
19
  );
20
20
  }) });
21
21
  export {
22
- p as MultiSelectTags
22
+ b as MultiSelectTags
23
23
  };