@epam/ai-dial-ui-kit 0.15.0-dev.51 → 0.15.0-dev.53

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.
@@ -1,159 +1,166 @@
1
- import { jsxs as le, Fragment as se, jsx as l } from "react/jsx-runtime";
2
- import { useFloating as ne, autoUpdate as ie, offset as ce, flip as me, size as pe, FloatingPortal as de } from "@floating-ui/react";
3
- import { useId as fe, useState as f, useMemo as ue, useCallback as he } from "react";
4
- import { Input as ge } from "../Input/Input.js";
5
- import { MenuItem as we } from "../MenuItem/MenuItem.js";
6
- import { selectTagClassName as ve } from "../Select/MultiSelectTags.js";
7
- import { Tag as Ie } from "../Tag/Tag.js";
8
- import { useThemeScope as xe } from "../ThemeScope/ThemeScope.js";
9
- import { overlayGap as T, overlayListClassName as Te, overlaySurfaceClassName as Se } from "../constants/overlay.js";
10
- import { DIAL_KIT_CLASS as be } from "../../../constants/public-class-names.js";
11
- import { MenuItemMark as ye } from "../../../types/menu-item.js";
12
- import { ElementSize as U } from "../../../types/size.js";
13
- import { mergeClasses as i } from "../../../utils/merge-classes.js";
14
- import { filterAutocompleteSuggestions as De } from "./utils.js";
15
- const Ce = 5, Re = ({
16
- id: z,
17
- value: S,
18
- defaultValue: _,
19
- suggestions: b,
20
- maxSuggestions: y = Ce,
21
- size: D = U.Standard,
22
- labelProps: $,
23
- placeholder: B,
24
- caption: G,
25
- error: K,
26
- invalid: C = !1,
27
- disabled: u = !1,
28
- readOnly: h = !1,
29
- ariaLabel: R,
30
- tagListLabel: M = "Tags",
31
- getRemoveTagLabel: j,
32
- className: H,
33
- fieldClassName: O,
34
- tagClassName: V,
35
- listClassName: P,
36
- onChange: A
1
+ import { jsxs as ce, Fragment as me, jsx as c } from "react/jsx-runtime";
2
+ import { useFloating as pe, autoUpdate as fe, offset as de, flip as ue, size as he, FloatingPortal as ge } from "@floating-ui/react";
3
+ import { useId as we, useState as h, useMemo as ve, useCallback as xe } from "react";
4
+ import { Input as Ie } from "../Input/Input.js";
5
+ import { MenuItem as Te } from "../MenuItem/MenuItem.js";
6
+ import { selectTagClassName as Se } from "../Select/MultiSelectTags.js";
7
+ import { Tag as be } from "../Tag/Tag.js";
8
+ import { useThemeScope as ye } from "../ThemeScope/ThemeScope.js";
9
+ import { overlayGap as y, overlayListClassName as Ce, overlaySurfaceClassName as De } from "../constants/overlay.js";
10
+ import { DIAL_KIT_CLASS as Me } from "../../../constants/public-class-names.js";
11
+ import { MenuItemMark as Ae } from "../../../types/menu-item.js";
12
+ import { ElementSize as F } from "../../../types/size.js";
13
+ import { mergeClasses as f } from "../../../utils/merge-classes.js";
14
+ import { filterAutocompleteSuggestions as Ne } from "./utils.js";
15
+ const ke = 5, Pe = ({
16
+ id: G,
17
+ value: C,
18
+ defaultValue: K,
19
+ suggestions: g,
20
+ maxSuggestions: D = ke,
21
+ openOnFocus: m = !1,
22
+ size: M = F.Standard,
23
+ labelProps: R,
24
+ placeholder: j,
25
+ caption: H,
26
+ error: V,
27
+ invalid: A = !1,
28
+ disabled: w = !1,
29
+ readOnly: v = !1,
30
+ ariaLabel: P,
31
+ tagListLabel: N = "Tags",
32
+ getRemoveTagLabel: X,
33
+ className: q,
34
+ fieldClassName: J,
35
+ tagClassName: Q,
36
+ listClassName: W,
37
+ onChange: k
37
38
  }) => {
38
- const X = fe(), N = z || X, g = `${N}-listbox`, q = xe(), J = D === U.Small, w = S !== void 0, [Q, W] = f(
39
- _ ?? []
40
- ), a = w ? S : Q, c = a.length > 0, m = !h && !u, [s, E] = f(""), [Y, v] = f(!1), [Z, p] = f(0), r = ue(
41
- () => De(
42
- b,
39
+ const Y = we(), E = G || Y, x = `${E}-listbox`, Z = ye(), O = M === F.Small, I = C !== void 0, [ee, te] = h(
40
+ K ?? []
41
+ ), a = I ? C : ee, d = a.length > 0, p = !v && !w, [s, L] = h(""), [oe, u] = h(!1), [ae, l] = h(0), T = !s.trim(), n = ve(
42
+ () => Ne(
43
+ g,
43
44
  s,
44
45
  a,
45
- y
46
+ // The list opened on focus is meant to show every choice.
47
+ m && T ? g.length : D
46
48
  ),
47
- [s, y, b, a]
48
- ), o = Y && m && r.length > 0, d = Math.min(Z, r.length - 1), k = (e) => `${g}-option-${e}`, { refs: F, floatingStyles: ee } = ne({
49
- open: o,
49
+ [s, T, D, m, g, a]
50
+ ), r = oe && p && n.length > 0, i = Math.min(ae, n.length - 1), U = r && i >= 0, z = (e) => `${x}-option-${e}`, { refs: B, floatingStyles: re } = pe({
51
+ open: r,
50
52
  placement: "bottom-start",
51
- whileElementsMounted: ie,
53
+ whileElementsMounted: fe,
52
54
  middleware: [
53
- ce(T),
54
- me({ padding: T }),
55
- pe({
56
- padding: T,
57
- apply({ rects: e, availableHeight: t, elements: n }) {
58
- n.floating.style.width = `${Math.round(e.reference.width)}px`, n.floating.style.maxHeight = `${Math.floor(t)}px`;
55
+ de(y),
56
+ ue({ padding: y }),
57
+ he({
58
+ padding: y,
59
+ apply({ rects: e, availableHeight: t, elements: o }) {
60
+ o.floating.style.width = `${Math.round(e.reference.width)}px`, o.floating.style.maxHeight = `${Math.floor(t)}px`;
59
61
  }
60
62
  })
61
63
  ]
62
- }), I = he(
64
+ }), S = xe(
63
65
  (e) => {
64
- w || W(e), A?.(e);
66
+ I || te(e), k?.(e);
65
67
  },
66
- [w, A]
67
- ), x = () => {
68
- v(!1), p(0);
69
- }, L = (e) => {
68
+ [I, k]
69
+ ), b = () => {
70
+ u(!1), l(0);
71
+ }, _ = () => {
72
+ !m || !p || (u(!0), l(T ? -1 : 0));
73
+ }, $ = (e) => {
70
74
  const t = e.trim();
71
- t && !a.includes(t) && I([...a, t]), E(""), x();
72
- }, te = (e) => I(a.filter((t) => t !== e)), oe = (e) => {
73
- const t = e ?? "";
74
- E(t), v(!!t.trim()), p(0);
75
- }, ae = (e) => {
76
- if (m)
75
+ t && !a.includes(t) && S([...a, t]), L(""), m ? l(-1) : b();
76
+ }, le = (e) => S(a.filter((t) => t !== e)), se = (e) => {
77
+ const t = e ?? "", o = !!t.trim();
78
+ L(t), u(o || m), l(o ? 0 : -1);
79
+ }, ne = (e) => {
80
+ if (p)
77
81
  switch (e.key) {
78
82
  case "ArrowDown":
79
83
  case "ArrowUp": {
80
- if (e.preventDefault(), v(!0), !o) return;
81
- const t = e.key === "ArrowDown" ? 1 : -1;
82
- p(
83
- (d + t + r.length) % r.length
84
- );
84
+ if (e.preventDefault(), !r) {
85
+ u(!0), l(0);
86
+ return;
87
+ }
88
+ const t = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? Math.min(-t, 0) : i;
89
+ l((o + t + n.length) % n.length);
85
90
  return;
86
91
  }
87
92
  case "Enter":
88
93
  case ",":
89
- e.preventDefault(), L(o ? r[d].value : s);
94
+ e.preventDefault(), $(U ? n[i].value : s);
90
95
  return;
91
96
  case "Escape":
92
- o && e.preventDefault(), x();
97
+ r && e.preventDefault(), b();
93
98
  return;
94
99
  case "Backspace":
95
- !s && c && (e.preventDefault(), I(a.slice(0, -1)));
100
+ !s && d && (e.preventDefault(), S(a.slice(0, -1)));
96
101
  return;
97
102
  }
98
- }, re = (e) => e.preventDefault();
99
- return /* @__PURE__ */ le(se, { children: [
100
- /* @__PURE__ */ l(
101
- ge,
103
+ }, ie = (e) => e.preventDefault();
104
+ return /* @__PURE__ */ ce(me, { children: [
105
+ /* @__PURE__ */ c(
106
+ Ie,
102
107
  {
103
- id: N,
108
+ id: E,
104
109
  role: "combobox",
105
110
  "aria-autocomplete": "list",
106
- "aria-expanded": o,
107
- "aria-controls": g,
108
- "aria-activedescendant": o ? k(d) : void 0,
109
- "aria-invalid": C || void 0,
110
- "aria-label": R,
111
- size: D,
112
- labelProps: $,
113
- caption: G,
114
- error: K,
115
- invalid: C,
116
- disabled: u,
117
- readOnly: h,
111
+ "aria-expanded": r,
112
+ "aria-controls": x,
113
+ "aria-activedescendant": U ? z(i) : void 0,
114
+ "aria-invalid": A || void 0,
115
+ "aria-label": P,
116
+ size: M,
117
+ labelProps: R,
118
+ caption: H,
119
+ error: V,
120
+ invalid: A,
121
+ disabled: w,
122
+ readOnly: v,
118
123
  value: s,
119
- placeholder: c ? void 0 : B,
120
- wrapperRef: F.setReference,
121
- onChange: oe,
122
- onKeyDown: ae,
123
- onBlur: x,
124
- containerClassName: i("w-full", H),
125
- wrapperClassName: i(
126
- c && [
124
+ placeholder: d ? void 0 : j,
125
+ wrapperRef: B.setReference,
126
+ onChange: se,
127
+ onKeyDown: ne,
128
+ onFocus: _,
129
+ onClick: _,
130
+ onBlur: b,
131
+ containerClassName: f("w-full", q),
132
+ wrapperClassName: f(
133
+ d && [
127
134
  "!h-auto flex-wrap gap-1 py-2",
128
- J ? "min-h-[24px]" : "min-h-[40px]"
135
+ O ? "min-h-[24px]" : "min-h-[40px]"
129
136
  ],
130
- O,
131
- be.autocompleteTagInput
137
+ J,
138
+ Me.autocompleteTagInput
132
139
  ),
133
- className: i(
140
+ className: f(
134
141
  "w-auto min-w-[100px] flex-1",
135
- h && "cursor-default"
142
+ v && "cursor-default"
136
143
  ),
137
- children: c && /* @__PURE__ */ l(
144
+ children: d && /* @__PURE__ */ c(
138
145
  "span",
139
146
  {
140
147
  role: "list",
141
- "aria-label": M,
148
+ "aria-label": N,
142
149
  className: "flex min-w-0 flex-wrap items-center gap-1",
143
- children: a.map((e) => /* @__PURE__ */ l(
144
- Ie,
150
+ children: a.map((e) => /* @__PURE__ */ c(
151
+ be,
145
152
  {
146
153
  role: "listitem",
147
154
  label: e,
148
- className: i(
149
- ve,
155
+ className: f(
156
+ Se,
150
157
  "min-w-0",
151
- V
158
+ Q
152
159
  ),
153
- disabled: u,
154
- closable: m,
155
- removeLabel: j?.(e),
156
- onRemove: m ? () => te(e) : void 0
160
+ disabled: w,
161
+ closable: p,
162
+ removeLabel: X?.(e),
163
+ onRemove: p ? () => le(e) : void 0
157
164
  },
158
165
  e
159
166
  ))
@@ -161,39 +168,39 @@ const Ce = 5, Re = ({
161
168
  )
162
169
  }
163
170
  ),
164
- /* @__PURE__ */ l(de, { children: /* @__PURE__ */ l(
171
+ /* @__PURE__ */ c(ge, { children: /* @__PURE__ */ c(
165
172
  "div",
166
173
  {
167
- ref: F.setFloating,
168
- id: g,
174
+ ref: B.setFloating,
175
+ id: x,
169
176
  role: "listbox",
170
- "aria-label": M,
171
- hidden: !o,
172
- style: ee,
173
- className: i(
177
+ "aria-label": N,
178
+ hidden: !r,
179
+ style: re,
180
+ className: f(
174
181
  "z-floating overflow-y-auto",
175
- Se,
176
- Te,
177
- !o && "hidden",
178
- q,
179
- P
182
+ De,
183
+ Ce,
184
+ !r && "hidden",
185
+ Z,
186
+ W
180
187
  ),
181
- children: o && r.map((e, t) => {
182
- const n = t === d;
183
- return /* @__PURE__ */ l(
184
- we,
188
+ children: r && n.map((e, t) => {
189
+ const o = t === i;
190
+ return /* @__PURE__ */ c(
191
+ Te,
185
192
  {
186
- id: k(t),
193
+ id: z(t),
187
194
  role: "option",
188
- "aria-selected": n,
195
+ "aria-selected": o,
189
196
  tabIndex: -1,
190
197
  label: e.label,
191
198
  description: e.description,
192
- mark: ye.Tint,
193
- selected: n,
194
- onMouseDown: re,
195
- onMouseEnter: () => p(t),
196
- onClick: () => L(e.value)
199
+ mark: Ae.Tint,
200
+ selected: o,
201
+ onMouseDown: ie,
202
+ onMouseEnter: () => l(t),
203
+ onClick: () => $(e.value)
197
204
  },
198
205
  e.value
199
206
  );
@@ -203,5 +210,5 @@ const Ce = 5, Re = ({
203
210
  ] });
204
211
  };
205
212
  export {
206
- Re as AutocompleteTagInput
213
+ Pe as AutocompleteTagInput
207
214
  };
@@ -1,9 +1,9 @@
1
- const a = "dial-kit-grid", t = "dial-kit-grid-with-selection", d = "dial-kit-grid-without-header-borders", i = "dial-kit-grid-row-select", l = "dial-kit-grid-header-select", n = "dial-kit-grid-selection-visible", c = "dial-kit-grid-align-right", C = 40, o = "0.5px solid var(--stroke-tertiary, #E0E6F0)", E = {
1
+ const a = "dial-kit-grid", t = "dial-kit-grid-with-selection", d = "dial-kit-grid-without-header-borders", i = "dial-kit-grid-row-select", l = "dial-kit-grid-header-select", n = "dial-kit-grid-selection-visible", c = "dial-kit-grid-align-right", C = 40, o = "0.5px solid var(--stroke-tertiary, #E0E6F0)", s = {
2
2
  accentColor: "var(--bg-control-accent, #1D4ED8)",
3
3
  backgroundColor: "var(--bg-layer-raised, #FCFCFC)",
4
4
  oddRowBackgroundColor: "var(--bg-layer-sunken, #EEF1F7)",
5
- selectedRowBackgroundColor: "var(--bg-control-accent-alpha, #2764D90F)",
6
- rowHoverColor: "var(--bg-control-accent-alpha-hover, #2764D924)",
5
+ selectedRowBackgroundColor: "var(--bg-control-accent-alpha-active-subtle, #2764D914)",
6
+ rowHoverColor: "var(--bg-control-accent-alpha-hover-subtle, #2764D90A)",
7
7
  borderColor: "var(--stroke-tertiary, #E0E6F0)",
8
8
  // Dividers inside the table sit on the thin stroke (0.5px) rather than the
9
9
  // 1px main stroke that controls and standalone dividers use, so a dense grid
@@ -13,9 +13,16 @@ const a = "dial-kit-grid", t = "dial-kit-grid-with-selection", d = "dial-kit-gri
13
13
  // by the theme: those frame the table and separate its regions rather than
14
14
  // dividing rows and columns.
15
15
  rowBorder: o,
16
- headerRowBorder: o,
16
+ // Off: ag-Grid draws this one both under the header and between the title
17
+ // row and the filter row, and the design has no line between those two. The
18
+ // line under the header is drawn at 1px in `styles/grid.scss`.
19
+ headerRowBorder: !1,
17
20
  headerColumnBorder: o,
21
+ // The design's header divider is a short 12px mark centred in the cell, not
22
+ // the 20px (half the row) ag-Grid draws by default.
23
+ headerColumnBorderHeight: 12,
18
24
  chromeBackgroundColor: "var(--bg-layer-base, #F5F7FA)",
25
+ headerBackgroundColor: "var(--bg-layer-raised, #FCFCFC)",
19
26
  foregroundColor: "var(--text-primary, #161B2D)",
20
27
  headerTextColor: "var(--text-secondary, #57647A)",
21
28
  // 1.0 asked the browser for dark native widgets while painting a light
@@ -27,6 +34,8 @@ const a = "dial-kit-grid", t = "dial-kit-grid-with-selection", d = "dial-kit-gri
27
34
  fontFamily: "var(--theme-font, var(--font-inter))",
28
35
  spacing: 4,
29
36
  borderRadius: 4,
37
+ // Search fields in the header and filter popups: `rounded-lg`.
38
+ inputBorderRadius: 8,
30
39
  wrapperBorderRadius: 8
31
40
  };
32
41
  var e = /* @__PURE__ */ ((r) => (r.API = "api", r.ROW_DATA_CHANGED = "rowDataChanged", r.CHECKBOX_SELECTED = "checkboxSelected", r))(e || {});
@@ -36,7 +45,7 @@ export {
36
45
  a as GRID_ROOT_CLASS,
37
46
  i as GRID_ROW_SELECT_CLASS,
38
47
  n as GRID_SELECTION_VISIBLE_CLASS,
39
- E as GRID_THEME_PARAMS,
48
+ s as GRID_THEME_PARAMS,
40
49
  d as GRID_WITHOUT_HEADER_BORDERS_CLASS,
41
50
  t as GRID_WITH_SELECTION_CLASS,
42
51
  C as ROW_HEIGHT,