@epam/ai-dial-ui-kit 0.15.0-dev.36 → 0.15.0-dev.38

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.
@@ -6,13 +6,13 @@ import { Popup as A } from "../Popup/Popup.js";
6
6
  import { Spinner as _ } from "../../Spinner/Spinner.js";
7
7
  import { ConfirmationPopupVariant as D } from "../../../types/confirmation-popup.js";
8
8
  import { PopupSize as F } from "../../../types/popup.js";
9
- import { mergeClasses as s } from "../../../utils/merge-classes.js";
10
- import { actionsBaseClassName as K, defaultCancelLabel as L, defaultConfirmLabel as T, variantConfig as t, loaderContainerClassName as V, descriptionBaseClassName as q } from "./constants.js";
9
+ import { mergeClasses as f } from "../../../utils/merge-classes.js";
10
+ import { actionsBaseClassName as K, defaultCancelLabel as L, defaultConfirmLabel as T, variantConfig as s, loaderContainerClassName as V, descriptionBaseClassName as q } from "./constants.js";
11
11
  import { DIAL_KIT_CLASS as w } from "../../../constants/public-class-names.js";
12
12
  const X = ({
13
13
  header: p,
14
- description: e,
15
- descriptionClassName: l,
14
+ description: a,
15
+ descriptionClassName: m,
16
16
  open: u = !1,
17
17
  confirmLabel: c = T,
18
18
  cancelLabel: C = L,
@@ -20,13 +20,13 @@ const X = ({
20
20
  disableConfirmButton: d = !1,
21
21
  className: N,
22
22
  confirmClassName: b,
23
- onClose: n,
23
+ onClose: t,
24
24
  onConfirm: v,
25
- onCancel: i,
26
- children: a,
27
- variant: m = D.Info,
25
+ onCancel: l,
26
+ children: e,
27
+ variant: n = D.Info,
28
28
  size: P = F.Sm,
29
- footer: f,
29
+ footer: i,
30
30
  hideClose: S,
31
31
  ...B
32
32
  }) => {
@@ -35,45 +35,41 @@ const X = ({
35
35
  z,
36
36
  {
37
37
  label: C,
38
- onClick: () => i ? i() : n?.()
38
+ onClick: () => l ? l() : t?.()
39
39
  }
40
40
  ),
41
41
  /* @__PURE__ */ r(
42
42
  j,
43
43
  {
44
- variant: t[m].confirm.variant,
45
- appearance: t[m].confirm.appearance,
44
+ variant: s[n].confirm.variant,
45
+ appearance: s[n].confirm.appearance,
46
46
  className: b,
47
47
  label: c,
48
48
  disabled: d,
49
49
  onClick: v
50
50
  }
51
51
  )
52
- ] }), k = I(() => o ? /* @__PURE__ */ r("div", { className: V, children: /* @__PURE__ */ r(_, { size: 40 }) }) : a ?? (e ? /* @__PURE__ */ r(
52
+ ] }), k = I(() => o ? /* @__PURE__ */ r("div", { className: V, children: /* @__PURE__ */ r(_, { size: 40 }) }) : e ?? (a ? /* @__PURE__ */ r(
53
53
  "div",
54
54
  {
55
- className: s(
55
+ className: f(
56
56
  q,
57
- l
57
+ m
58
58
  ),
59
- children: e
59
+ children: a
60
60
  }
61
- ) : null), [a, e, o, l]);
61
+ ) : null), [e, a, o, m]);
62
62
  return /* @__PURE__ */ r(
63
63
  A,
64
64
  {
65
65
  ...B,
66
66
  open: u,
67
67
  header: p,
68
- className: s(
69
- t[m].container,
70
- N,
71
- w.confirmationPopup
72
- ),
73
- onClose: () => n?.(),
74
- footer: f ?? h,
68
+ className: f(N, w.confirmationPopup),
69
+ onClose: () => t?.(),
70
+ footer: i ?? h,
75
71
  size: P,
76
- hideClose: S ?? (!o && f === void 0),
72
+ hideClose: S ?? (!o && i === void 0),
77
73
  children: k()
78
74
  }
79
75
  );
@@ -1,24 +1,21 @@
1
- import { ButtonAppearance as a, ButtonVariant as r } from "../../../types/button.js";
2
- import { ConfirmationPopupVariant as e } from "../../../types/confirmation-popup.js";
3
- const t = "flex justify-end gap-2 px-6 py-4 border-t border-tertiary", i = "text-secondary dial-small-paragraph-text px-6 pb-4", p = "px-6 py-4 h-[120px]", s = "Cancel", c = "Ok", l = {
4
- [e.Info]: {
1
+ import { ButtonAppearance as a, ButtonVariant as n } from "../../../types/button.js";
2
+ import { ConfirmationPopupVariant as r } from "../../../types/confirmation-popup.js";
3
+ const o = "flex justify-end gap-2 px-6 py-4 border-t border-tertiary", i = "text-secondary dial-small-paragraph-text px-6 pb-4", p = "px-6 py-4 h-[120px]", s = "Cancel", c = "Ok", l = {
4
+ [r.Info]: {
5
5
  confirm: {
6
- variant: r.Primary,
6
+ variant: n.Primary,
7
7
  appearance: a.Solid
8
8
  }
9
9
  },
10
- [e.Danger]: {
11
- // Utilities rather than the legacy `.dial-danger-popup` SCSS rule, which is
12
- // scoped as `div .dial-danger-popup` and only lands by accident of nesting.
13
- container: "border-t-4 border-error",
10
+ [r.Danger]: {
14
11
  confirm: {
15
- variant: r.Danger,
12
+ variant: n.Danger,
16
13
  appearance: a.Solid
17
14
  }
18
15
  }
19
16
  };
20
17
  export {
21
- t as actionsBaseClassName,
18
+ o as actionsBaseClassName,
22
19
  s as defaultCancelLabel,
23
20
  c as defaultConfirmLabel,
24
21
  i as descriptionBaseClassName,
@@ -0,0 +1,127 @@
1
+ import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as h, useState as P, useCallback as T, useLayoutEffect as d } from "react";
3
+ import { getVisibleTagCount as y } from "../TagInput/utils.js";
4
+ import { InteractiveTooltip as W } from "../InteractiveTooltip/InteractiveTooltip.js";
5
+ import { Tag as g } from "../Tag/Tag.js";
6
+ import { TooltipPlacement as S } from "../../../types/tooltip.js";
7
+ import { observeElementSize as $ } from "../../../utils/element-size-observer.js";
8
+ import { mergeClasses as b } from "../../../utils/merge-classes.js";
9
+ import { MultiSelectTags as c, selectTagClassName as w } from "./MultiSelectTags.js";
10
+ const j = 8, A = (e) => e.stopPropagation(), E = (e) => {
11
+ e.key !== "Escape" && e.stopPropagation();
12
+ }, V = ({
13
+ options: e,
14
+ selectedValues: r,
15
+ handleRemoveTag: a
16
+ }) => {
17
+ const n = h(null), m = h(null), [v, C] = P(null), l = T(() => {
18
+ const t = n.current, s = m.current;
19
+ if (!t || !s) return;
20
+ const f = Array.from(
21
+ s.children,
22
+ (k) => k.offsetWidth
23
+ ), N = f.pop() ?? 0;
24
+ C(
25
+ y({
26
+ tagWidths: f,
27
+ overflowChipWidth: N,
28
+ availableWidth: t.clientWidth,
29
+ gap: j
30
+ })
31
+ );
32
+ }, []);
33
+ d(() => {
34
+ l();
35
+ }, [l, e, r]), d(() => {
36
+ const t = n.current;
37
+ return t ? $(t, l) : void 0;
38
+ }, [l]);
39
+ const p = v ?? r.length, x = r.slice(0, p), i = r.slice(p);
40
+ return /* @__PURE__ */ u(
41
+ "div",
42
+ {
43
+ ref: n,
44
+ className: "relative flex min-w-0 flex-1 items-center gap-2 overflow-hidden",
45
+ children: [
46
+ /* @__PURE__ */ o(
47
+ c,
48
+ {
49
+ options: e,
50
+ selectedValues: x,
51
+ handleRemoveTag: a,
52
+ tagClassName: "min-w-0"
53
+ }
54
+ ),
55
+ i.length > 0 && /* @__PURE__ */ o(
56
+ W,
57
+ {
58
+ asChild: !0,
59
+ placement: S.Bottom,
60
+ content: (
61
+ // The panel is portalled but still a React child of the field, so
62
+ // its clicks and keys would otherwise reach the dropdown trigger.
63
+ /* @__PURE__ */ o(
64
+ "div",
65
+ {
66
+ className: "flex flex-wrap gap-2",
67
+ onClick: A,
68
+ onKeyDown: E,
69
+ children: /* @__PURE__ */ o(
70
+ c,
71
+ {
72
+ options: e,
73
+ selectedValues: i,
74
+ handleRemoveTag: a
75
+ }
76
+ )
77
+ }
78
+ )
79
+ ),
80
+ children: /* @__PURE__ */ o(
81
+ g,
82
+ {
83
+ label: `+${i.length}`,
84
+ role: "button",
85
+ tabIndex: 0,
86
+ "aria-haspopup": "true",
87
+ "aria-label": `${i.length} more selected: ${i.map((t) => e.find((s) => s.value === t)?.label ?? t).join(", ")}`,
88
+ title: "",
89
+ className: b(w, "shrink-0")
90
+ }
91
+ )
92
+ }
93
+ ),
94
+ /* @__PURE__ */ u(
95
+ "div",
96
+ {
97
+ ref: m,
98
+ "aria-hidden": "true",
99
+ inert: !0,
100
+ className: "pointer-events-none invisible absolute left-0 top-0 flex h-0 w-max gap-2 overflow-hidden",
101
+ children: [
102
+ /* @__PURE__ */ o(
103
+ c,
104
+ {
105
+ options: e,
106
+ selectedValues: r,
107
+ handleRemoveTag: a,
108
+ tagClassName: "shrink-0"
109
+ }
110
+ ),
111
+ /* @__PURE__ */ o(
112
+ g,
113
+ {
114
+ label: `+${r.length}`,
115
+ className: b(w, "shrink-0")
116
+ }
117
+ )
118
+ ]
119
+ }
120
+ )
121
+ ]
122
+ }
123
+ );
124
+ };
125
+ export {
126
+ V as CollapsedSelectTags
127
+ };
@@ -1,23 +1,26 @@
1
- import { jsx as l, Fragment as i } from "react/jsx-runtime";
2
- import { Tag as c } from "../Tag/Tag.js";
3
- const b = ({
1
+ import { jsx as s, Fragment as m } from "react/jsx-runtime";
2
+ import { mergeClasses as c } from "../../../utils/merge-classes.js";
3
+ import { Tag as i } from "../Tag/Tag.js";
4
+ const p = "h-[24px] max-w-full rounded-md border border-secondary bg-layer-sunken px-2", f = ({
4
5
  options: a,
5
6
  selectedValues: n,
6
- handleRemoveTag: e
7
- }) => /* @__PURE__ */ l(i, { children: n.map((r) => {
8
- const t = a.find((o) => o.value === r);
9
- return /* @__PURE__ */ l(
10
- c,
7
+ handleRemoveTag: o,
8
+ tagClassName: t
9
+ }) => /* @__PURE__ */ s(m, { children: n.map((e) => {
10
+ const l = a.find((r) => r.value === e);
11
+ return /* @__PURE__ */ s(
12
+ i,
11
13
  {
12
- label: t?.label ?? r,
13
- closable: !!e,
14
- onRemove: (o) => e?.(o, r),
15
- icon: t?.icon,
16
- className: "max-w-full border border-tertiary"
14
+ label: l?.label ?? e,
15
+ closable: !!o,
16
+ onRemove: (r) => o?.(r, e),
17
+ icon: l?.icon,
18
+ className: c(p, t)
17
19
  },
18
- r
20
+ e
19
21
  );
20
22
  }) });
21
23
  export {
22
- b as MultiSelectTags
24
+ f as MultiSelectTags,
25
+ p as selectTagClassName
23
26
  };