@epam/ai-dial-usage-dashboard 1.3.0-dev.309 → 1.3.0-dev.311

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 (2) hide show
  1. package/index.js +65 -53
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -41820,12 +41820,14 @@ var LR = ({ ariaLabel: e = "Close", className: t, size: n = pR.Small, onClose: r
41820
41820
  let r = e === "ArrowDown" ? 1 : -1;
41821
41821
  return t === -1 ? r === 1 ? 0 : n - 1 : (t + r + n) % n;
41822
41822
  };
41823
- function Oz(e, t = "menu", n = !1, r) {
41824
- let [i, a] = M(!1), o = xI(), { refs: s, elements: c, floatingStyles: l, context: u } = vL({
41825
- nodeId: o,
41826
- placement: "right-start",
41827
- open: i,
41828
- onOpenChange: a,
41823
+ function Oz(e, t = "menu", n = !1, r, i) {
41824
+ let [a, o] = M(!1), s = i?.open ?? a, c = i?.onOpenChange, l = i?.open, u = w((e) => {
41825
+ l === void 0 && o(e), c?.(e);
41826
+ }, [l, c]), [d, f] = M(!1), p = xI(), { refs: m, elements: h, floatingStyles: g, context: _ } = vL({
41827
+ nodeId: p,
41828
+ placement: d ? "left-start" : "right-start",
41829
+ open: s,
41830
+ onOpenChange: u,
41829
41831
  whileElementsMounted: kF,
41830
41832
  middleware: [
41831
41833
  WF({
@@ -41835,39 +41837,43 @@ function Oz(e, t = "menu", n = !1, r) {
41835
41837
  KF({ padding: e }),
41836
41838
  GF({ padding: e })
41837
41839
  ]
41838
- }), { getReferenceProps: d, getFloatingProps: f } = SL([
41839
- kI(u, {
41840
+ });
41841
+ E(() => {
41842
+ h.domReference && f(Cz(h.domReference));
41843
+ }, [h.domReference, s]);
41844
+ let { getReferenceProps: v, getFloatingProps: y } = SL([
41845
+ kI(_, {
41840
41846
  enabled: !n,
41841
- move: !1,
41847
+ move: r?.move ?? !1,
41842
41848
  handleClose: OL(),
41843
- delay: {
41849
+ delay: r?.delay ?? {
41844
41850
  open: 80,
41845
41851
  close: 80
41846
41852
  }
41847
41853
  }),
41848
- fL(u, { enabled: !n }),
41849
- gL(u, {
41854
+ fL(_, { enabled: !n }),
41855
+ gL(_, {
41850
41856
  ancestorScroll: !0,
41851
41857
  bubbles: {
41852
41858
  escapeKey: !1,
41853
41859
  outsidePress: !0
41854
41860
  }
41855
41861
  }),
41856
- wL(u, { role: t })
41857
- ]), [p, m] = M(!1), h = c.floating;
41862
+ wL(_, { role: t })
41863
+ ]), [b, x] = M(!1), S = h.floating;
41858
41864
  E(() => {
41859
- !i || !p || h == null || (Sz(h)[0]?.focus(), m(!1));
41865
+ !s || !b || S == null || (Sz(S)[0]?.focus(), x(!1));
41860
41866
  }, [
41861
- i,
41862
- p,
41863
- h
41867
+ s,
41868
+ b,
41869
+ S
41864
41870
  ]);
41865
- let g = w((e) => {
41866
- n || e.key !== wz(e.currentTarget) && e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.stopPropagation(), a(!0), m(!0));
41867
- }, [n]), _ = w((e) => {
41871
+ let C = w((e) => {
41872
+ n || e.key !== wz(e.currentTarget) && e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.stopPropagation(), u(!0), x(!0));
41873
+ }, [n, u]), T = w((e) => {
41868
41874
  if (e.defaultPrevented || Ez(e.target)) return;
41869
41875
  if (e.key === Tz(e.currentTarget)) {
41870
- e.preventDefault(), e.stopPropagation(), a(!1), s.domReference.current?.focus();
41876
+ e.preventDefault(), e.stopPropagation(), u(!1), m.domReference.current?.focus();
41871
41877
  return;
41872
41878
  }
41873
41879
  if (!xz.includes(e.key)) return;
@@ -41876,73 +41882,77 @@ function Oz(e, t = "menu", n = !1, r) {
41876
41882
  if (t.length === 0) return;
41877
41883
  let n = e.currentTarget.ownerDocument.activeElement, r = t.findIndex((e) => e === n);
41878
41884
  t[Dz(e.key, r, t.length)]?.focus();
41879
- }, [s.domReference]);
41885
+ }, [m.domReference, u]);
41880
41886
  return {
41881
- isOpen: i,
41882
- nodeId: o,
41883
- refs: s,
41884
- floatingStyles: l,
41885
- context: u,
41886
- getReferenceProps: w((e) => d({
41887
+ isOpen: s,
41888
+ nodeId: p,
41889
+ refs: m,
41890
+ floatingStyles: g,
41891
+ context: _,
41892
+ getReferenceProps: w((e) => v({
41887
41893
  ...e,
41888
- onKeyDown: g
41889
- }), [d, g]),
41890
- getFloatingProps: w((e) => f({
41894
+ onKeyDown: C
41895
+ }), [v, C]),
41896
+ getFloatingProps: w((e) => y({
41891
41897
  ...e,
41892
- onKeyDown: _
41893
- }), [f, _])
41898
+ onKeyDown: T
41899
+ }), [y, T])
41894
41900
  };
41895
41901
  }
41896
- var kz = "rounded bg-layer-0 shadow", Az = ({ refs: e, floatingStyles: t, context: n, getFloatingProps: r, role: i, surfaceClassName: a, className: o, children: s }) => {
41897
- let c = AL();
41902
+ var kz = "rounded bg-layer-0 shadow", Az = ({ refs: e, floatingStyles: t, context: n, getFloatingProps: r, role: i, surfaceClassName: a, className: o, initialFocus: s = -1, children: c }) => {
41903
+ let l = AL();
41898
41904
  return /* @__PURE__ */ d(ZI, { children: /* @__PURE__ */ d(cL, {
41899
41905
  context: n,
41900
41906
  modal: !1,
41901
- initialFocus: -1,
41907
+ initialFocus: s,
41902
41908
  returnFocus: !0,
41903
41909
  children: /* @__PURE__ */ d("div", {
41904
41910
  ref: e.setFloating,
41905
41911
  style: t,
41906
41912
  role: i,
41907
- className: (0, EM.default)("z-floating overflow-auto text-primary focus-visible:outline-hidden", a ?? kz, c, o),
41913
+ className: (0, EM.default)("z-floating overflow-auto text-primary focus-visible:outline-hidden", a ?? kz, l, o),
41908
41914
  ...r(),
41909
- children: s
41915
+ children: c
41910
41916
  })
41911
41917
  }) });
41912
41918
  }, jz = (e) => e.mark ?? (e.selectable ? FL.Checkbox : FL.None), Mz = (e) => e.selectable ? "menuitemcheckbox" : jz(e) === FL.Check ? "menuitemradio" : "menuitem", Nz = ({ item: e, onRootClose: t }) => {
41913
- let { isOpen: n, nodeId: r, refs: i, floatingStyles: a, context: o, getReferenceProps: s, getFloatingProps: c } = Oz(dR, "menu", !!e.disabled), l = w((e) => (n) => {
41919
+ let n = j(e.subMenuOpen ? 0 : -1), { isOpen: r, nodeId: i, refs: a, floatingStyles: o, context: s, getReferenceProps: c, getFloatingProps: l } = Oz(dR, "menu", !!e.disabled, e.subMenuHoverOptions, {
41920
+ open: e.subMenuOpen,
41921
+ onOpenChange: e.onSubMenuOpenChange
41922
+ }), p = w((e) => (n) => {
41914
41923
  e.disabled || (e.onClick?.({
41915
41924
  key: e.key,
41916
41925
  domEvent: n
41917
41926
  }), e.selectable || t());
41918
- }, [t]), p = /* @__PURE__ */ d(ez, {
41919
- ref: i.setReference,
41927
+ }, [t]), m = /* @__PURE__ */ d(ez, {
41928
+ ref: a.setReference,
41920
41929
  role: "menuitem",
41921
41930
  "aria-haspopup": "menu",
41922
- "aria-expanded": n,
41931
+ "aria-expanded": r,
41923
41932
  "aria-disabled": !!e.disabled,
41924
41933
  disabled: e.disabled,
41925
41934
  icon: e.icon,
41926
41935
  label: e.label,
41927
41936
  trailing: fR,
41928
41937
  className: e.className,
41929
- ...s(),
41938
+ ...c(),
41930
41939
  children: e.renderItem?.(e)
41931
41940
  });
41932
41941
  return /* @__PURE__ */ f(SI, {
41933
- id: r,
41942
+ id: i,
41934
41943
  children: [e.interactiveTooltip ? /* @__PURE__ */ d(PL, {
41935
41944
  asChild: !0,
41936
41945
  placement: e.interactiveTooltip.placement,
41937
41946
  content: e.interactiveTooltip.content,
41938
41947
  contentClassName: e.interactiveTooltip.contentClassName,
41939
- children: p
41940
- }) : p, n && /* @__PURE__ */ d(Az, {
41941
- refs: i,
41942
- floatingStyles: a,
41943
- context: o,
41944
- getFloatingProps: c,
41948
+ children: m
41949
+ }) : m, r && /* @__PURE__ */ d(Az, {
41950
+ refs: a,
41951
+ floatingStyles: o,
41952
+ context: s,
41953
+ getFloatingProps: l,
41945
41954
  role: "menu",
41955
+ initialFocus: n.current,
41946
41956
  surfaceClassName: e.renderSubMenu ? rR : iR,
41947
41957
  children: e.renderSubMenu ? e.renderSubMenu() : /* @__PURE__ */ f(u, { children: [
41948
41958
  e.menuHeader && (typeof e.menuHeader == "function" ? e.menuHeader() : e.menuHeader),
@@ -41957,10 +41967,11 @@ var kz = "rounded bg-layer-0 shadow", Az = ({ refs: e, floatingStyles: t, contex
41957
41967
  selected: !!e.checked,
41958
41968
  danger: e.danger,
41959
41969
  icon: e.icon,
41970
+ trailing: e.iconAfter,
41960
41971
  label: e.label,
41961
41972
  className: e.className,
41962
41973
  rightControl: e.rightControl,
41963
- onClick: l(e),
41974
+ onClick: p(e),
41964
41975
  children: e.renderItem?.(e)
41965
41976
  });
41966
41977
  return /* @__PURE__ */ d(g, { children: e.interactiveTooltip ? /* @__PURE__ */ d(PL, {
@@ -42198,7 +42209,7 @@ var kz = "rounded bg-layer-0 shadow", Az = ({ refs: e, floatingStyles: t, contex
42198
42209
  className: $("px-3 py-2 text-secondary dial-caption-text", e.className),
42199
42210
  children: e.label
42200
42211
  }, e.key);
42201
- if (e.children?.length) return /* @__PURE__ */ d(Nz, {
42212
+ if (e.children?.length || e.renderSubMenu) return /* @__PURE__ */ d(Nz, {
42202
42213
  item: e,
42203
42214
  onRootClose: () => xe(!1)
42204
42215
  }, e.key);
@@ -42212,6 +42223,7 @@ var kz = "rounded bg-layer-0 shadow", Az = ({ refs: e, floatingStyles: t, contex
42212
42223
  selected: !!e.checked,
42213
42224
  danger: e.danger,
42214
42225
  icon: e.icon,
42226
+ trailing: e.iconAfter,
42215
42227
  label: e.label,
42216
42228
  className: e.className,
42217
42229
  rightControl: e.rightControl,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-usage-dashboard",
3
3
  "description": "Presentational aggregate cost-limit cards for the Usage settings dashboard",
4
- "version": "1.3.0-dev.309",
4
+ "version": "1.3.0-dev.311",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -20,8 +20,8 @@
20
20
  "@tabler/icons-react": "^3.50.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@epam/ai-dial-chat-shared": "1.3.0-dev.309",
24
- "@epam/ai-dial-ui-kit": "^0.16.0-dev.69",
23
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.311",
24
+ "@epam/ai-dial-ui-kit": "^0.16.0-dev.71",
25
25
  "react": "^19.2.8"
26
26
  },
27
27
  "repository": {