@epam/ai-dial-starter-buttons 1.0.0-dev.531 → 1.0.0-dev.534

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 +1 @@
1
- {"version":3,"file":"StarterButtons.d.ts","sourceRoot":"","sources":["../../../src/components/StarterButtons/StarterButtons.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,uIAAuI;AACvI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA+IlD,CAAC"}
1
+ {"version":3,"file":"StarterButtons.d.ts","sourceRoot":"","sources":["../../../src/components/StarterButtons/StarterButtons.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,uIAAuI;AACvI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAoJlD,CAAC"}
package/index.js CHANGED
@@ -1,69 +1,70 @@
1
- import { DIAL_ICON_SIZE as e, DialDropdown as t, DialRoundedButton as n } from "@epam/ai-dial-ui-kit";
1
+ import { BASE_MD_ICON_PROPS as e } from "@epam/ai-dial-chat-shared";
2
+ import { DialDropdown as t, DialRoundedButton as n } from "@epam/ai-dial-ui-kit";
2
3
  import { IconDots as r, IconDotsVertical as i } from "@tabler/icons-react";
3
4
  import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
4
5
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
6
  //#region src/components/StarterButtons/StarterButtons.tsx
6
- var d = 4, f = 8, p = ({ starters: p, onSelect: m, isMobile: h, labels: g }) => {
7
- let _ = s(null), v = s([]), y = s([]), [b, x] = c(() => Math.min(p.length, d)), S = a((e) => {
8
- let t = _.current;
7
+ var d = 4, f = 8, p = ({ starters: p, onSelect: m, isMobile: h, labels: g, styles: _ }) => {
8
+ let v = s(null), y = s([]), b = s([]), [x, S] = c(() => Math.min(p.length, d)), C = a((e) => {
9
+ let t = v.current;
9
10
  if (!t) return;
10
11
  let n = t.getBoundingClientRect().width;
11
12
  if (n === 0) return;
12
13
  let r = Math.min(e, d);
13
- v.current.slice(0, r).every((e) => e != null) && (y.current = v.current.slice(0, r).map((e) => e?.getBoundingClientRect().width ?? 0));
14
- let i = (e) => y.current[e] ?? 120, a = 0, o = 0;
14
+ y.current.slice(0, r).every((e) => e != null) && (b.current = y.current.slice(0, r).map((e) => e?.getBoundingClientRect().width ?? 0));
15
+ let i = (e) => b.current[e] ?? 120, a = 0, o = 0;
15
16
  for (let t = 0; t < r; t++) {
16
17
  let r = i(t), s = e - (t + 1) > 0;
17
18
  if (a + (t > 0 ? f : 0) + r + (s ? 64 : 0) > n) break;
18
19
  a += (t > 0 ? f : 0) + r, o = t + 1;
19
20
  }
20
- x(Math.max(1, o));
21
+ S(Math.max(1, o));
21
22
  }, []);
22
23
  if (o(() => {
23
- y.current = [], x(Math.min(p.length, d));
24
+ b.current = [], S(Math.min(p.length, d));
24
25
  }, [p.length]), o(() => {
25
- let e = _.current;
26
+ let e = v.current;
26
27
  if (!e) return;
27
28
  let t = new ResizeObserver(() => {
28
- S(p.length);
29
+ C(p.length);
29
30
  });
30
31
  return t.observe(e), () => t.disconnect();
31
- }, [S, p.length]), o(() => {
32
- S(p.length);
32
+ }, [C, p.length]), o(() => {
33
+ C(p.length);
33
34
  }), p.length === 0) return null;
34
- let C = Math.min(b, d), w = p.slice(0, C), T = p.slice(C), E = T.map((e, t) => ({
35
+ let w = Math.min(x, d), T = p.slice(0, w), E = p.slice(w), D = E.map((e, t) => ({
35
36
  key: String(t),
36
37
  label: e.title,
37
38
  onClick: () => m(e)
38
39
  }));
39
40
  return /* @__PURE__ */ l("div", {
40
- ref: _,
41
+ ref: v,
41
42
  className: "mb-4 w-full",
42
43
  children: /* @__PURE__ */ u("div", {
43
44
  role: "list",
44
45
  "aria-label": g.list,
45
46
  className: "flex flex-wrap justify-center gap-2",
46
- children: [w.map((e, t) => /* @__PURE__ */ l("div", {
47
+ children: [T.map((e, t) => /* @__PURE__ */ l("div", {
47
48
  role: "listitem",
48
49
  ref: (e) => {
49
- v.current[t] = e;
50
+ y.current[t] = e;
50
51
  },
51
52
  children: /* @__PURE__ */ l(n, {
52
53
  label: e.title,
53
54
  onClick: () => m(e)
54
55
  })
55
- }, e.const)), T.length > 0 && /* @__PURE__ */ l("div", {
56
+ }, e.const)), E.length > 0 && /* @__PURE__ */ l("div", {
56
57
  role: "listitem",
57
58
  children: /* @__PURE__ */ l(t, {
58
- items: E,
59
+ items: D,
59
60
  placement: "bottom-end",
60
61
  matchReferenceWidth: !1,
61
62
  listClassName: "cp-dropdown-overlay",
62
63
  children: /* @__PURE__ */ l(n, {
63
64
  iconAfter: l(h ? r : i, {
64
- stroke: 1.5,
65
- size: e.MD,
66
- "aria-hidden": !0
65
+ ...e,
66
+ stroke: _?.iconStrokeWidth ?? e.stroke,
67
+ size: _?.iconSize ?? e.size
67
68
  }),
68
69
  "aria-label": g.overflow
69
70
  })
@@ -6,6 +6,12 @@ export interface StarterButtonsLabels {
6
6
  /** Label for the overflow menu that holds buttons that do not fit. */
7
7
  overflow: string;
8
8
  }
9
+ export interface StarterButtonsStyles {
10
+ /** Extra CSS class applied to the outer container div. */
11
+ iconSize?: number;
12
+ /** Stroke width of the search and clear icons. Defaults to the icon's own default. */
13
+ iconStrokeWidth?: number;
14
+ }
9
15
  /** Props for the StarterButtons component. */
10
16
  export interface StarterButtonsProps {
11
17
  /** Starter prompt options to display as buttons. */
@@ -16,5 +22,7 @@ export interface StarterButtonsProps {
16
22
  isMobile?: boolean;
17
23
  /** Localized labels used within the component. */
18
24
  labels: StarterButtonsLabels;
25
+ /** Optional style overrides. */
26
+ styles?: StarterButtonsStyles;
19
27
  }
20
28
  //# sourceMappingURL=starter-props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"starter-props.d.ts","sourceRoot":"","sources":["../../src/models/starter-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,MAAM,EAAE,oBAAoB,CAAC;CAC9B"}
1
+ {"version":3,"file":"starter-props.d.ts","sourceRoot":"","sources":["../../src/models/starter-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,MAAM,EAAE,oBAAoB,CAAC;IAC7B,gCAAgC;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-starter-buttons",
3
3
  "description": "Responsive starter prompt buttons that overflow into a dropdown when space is limited",
4
- "version": "1.0.0-dev.531",
4
+ "version": "1.0.0-dev.534",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -16,8 +16,8 @@
16
16
  }
17
17
  },
18
18
  "peerDependencies": {
19
- "@epam/ai-dial-chat-shared": "1.0.0-dev.531",
20
- "@epam/ai-dial-ui-kit": "0.12.0-dev.28",
19
+ "@epam/ai-dial-chat-shared": "1.0.0-dev.534",
20
+ "@epam/ai-dial-ui-kit": "0.12.0-dev.36",
21
21
  "@tabler/icons-react": "^3.44.0",
22
22
  "react": "^19.0.0"
23
23
  },