@alfadocs/ui-kit-debug 0.82.0 → 0.84.0

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 (156) hide show
  1. package/dist/_chunks/{actions-cell-renderer-DLrcSTK_.js → actions-cell-renderer-DaL80uqL.js} +2 -2
  2. package/dist/_chunks/{actions-cell-renderer-DLrcSTK_.js.map → actions-cell-renderer-DaL80uqL.js.map} +1 -1
  3. package/dist/_chunks/chart-GFLv4cXm.js +609 -0
  4. package/dist/_chunks/chart-GFLv4cXm.js.map +1 -0
  5. package/dist/_chunks/dashboard-grid-D2dm0IRN.js +691 -0
  6. package/dist/_chunks/dashboard-grid-D2dm0IRN.js.map +1 -0
  7. package/dist/_chunks/{editable-currency-cell-renderer-GwfA9tTR.js → editable-currency-cell-renderer-Dus_sBvX.js} +2 -2
  8. package/dist/_chunks/{editable-currency-cell-renderer-GwfA9tTR.js.map → editable-currency-cell-renderer-Dus_sBvX.js.map} +1 -1
  9. package/dist/_chunks/{face-scheme-C0rk21gg.js → face-scheme-CjQAHvSP.js} +2 -2
  10. package/dist/_chunks/{face-scheme-C0rk21gg.js.map → face-scheme-CjQAHvSP.js.map} +1 -1
  11. package/dist/_chunks/{file-manager-DfTG7bxx.js → file-manager-DLJlinIO.js} +3 -3
  12. package/dist/_chunks/{file-manager-DfTG7bxx.js.map → file-manager-DLJlinIO.js.map} +1 -1
  13. package/dist/_chunks/{header-settings-DMfdx0Vq.js → header-settings-CLwFqMHI.js} +2 -2
  14. package/dist/_chunks/{header-settings-DMfdx0Vq.js.map → header-settings-CLwFqMHI.js.map} +1 -1
  15. package/dist/_chunks/{icon-button-group-C_lqXTAj.js → icon-button-group-BLHPN6jg.js} +178 -163
  16. package/dist/_chunks/icon-button-group-BLHPN6jg.js.map +1 -0
  17. package/dist/_chunks/{marketplace-app-shell-Bxq1PYAj.js → marketplace-app-shell-Br2yebEK.js} +2 -2
  18. package/dist/_chunks/{marketplace-app-shell-Bxq1PYAj.js.map → marketplace-app-shell-Br2yebEK.js.map} +1 -1
  19. package/dist/_chunks/{patient-table-DweKjiXg.js → patient-table-BHzmUbzu.js} +2 -2
  20. package/dist/_chunks/{patient-table-DweKjiXg.js.map → patient-table-BHzmUbzu.js.map} +1 -1
  21. package/dist/_chunks/{theme-toggle-BJCz_UOi.js → theme-toggle-B4mOrQX1.js} +2 -2
  22. package/dist/_chunks/{theme-toggle-BJCz_UOi.js.map → theme-toggle-B4mOrQX1.js.map} +1 -1
  23. package/dist/_chunks/widget-picker-DEmTVuFL.js +193 -0
  24. package/dist/_chunks/widget-picker-DEmTVuFL.js.map +1 -0
  25. package/dist/agent-catalog.json +238 -4
  26. package/dist/agent-i18n/en.json +27 -1
  27. package/dist/components/chart/chart.agent.d.ts.map +1 -1
  28. package/dist/components/chart/chart.d.ts +36 -1
  29. package/dist/components/chart/chart.d.ts.map +1 -1
  30. package/dist/components/chart/index.js +1 -1
  31. package/dist/components/dashboard-grid/dashboard-grid-engine.d.ts +37 -0
  32. package/dist/components/dashboard-grid/dashboard-grid-engine.d.ts.map +1 -0
  33. package/dist/components/dashboard-grid/dashboard-grid.agent.d.ts +4 -0
  34. package/dist/components/dashboard-grid/dashboard-grid.agent.d.ts.map +1 -0
  35. package/dist/components/dashboard-grid/dashboard-grid.d.ts +74 -0
  36. package/dist/components/dashboard-grid/dashboard-grid.d.ts.map +1 -0
  37. package/dist/components/dashboard-grid/index.d.ts +3 -0
  38. package/dist/components/dashboard-grid/index.d.ts.map +1 -0
  39. package/dist/components/dashboard-grid/index.js +6 -0
  40. package/dist/components/dashboard-grid/index.js.map +1 -0
  41. package/dist/components/data-table/index.js +2 -2
  42. package/dist/components/face-scheme/index.js +1 -1
  43. package/dist/components/file-manager/index.js +1 -1
  44. package/dist/components/header-settings/index.js +1 -1
  45. package/dist/components/icon-button-group/icon-button-group.d.ts.map +1 -1
  46. package/dist/components/icon-button-group/index.js +1 -1
  47. package/dist/components/index.d.ts +2 -0
  48. package/dist/components/index.d.ts.map +1 -1
  49. package/dist/components/patient-table/index.js +1 -1
  50. package/dist/components/theme-toggle/index.js +1 -1
  51. package/dist/components/widget-picker/index.d.ts +3 -0
  52. package/dist/components/widget-picker/index.d.ts.map +1 -0
  53. package/dist/components/widget-picker/index.js +6 -0
  54. package/dist/components/widget-picker/index.js.map +1 -0
  55. package/dist/components/widget-picker/widget-picker.agent.d.ts +4 -0
  56. package/dist/components/widget-picker/widget-picker.agent.d.ts.map +1 -0
  57. package/dist/components/widget-picker/widget-picker.d.ts +49 -0
  58. package/dist/components/widget-picker/widget-picker.d.ts.map +1 -0
  59. package/dist/i18n/locales/ar.d.ts +29 -0
  60. package/dist/i18n/locales/ar.d.ts.map +1 -1
  61. package/dist/i18n/locales/ar.js +29 -0
  62. package/dist/i18n/locales/ar.js.map +1 -1
  63. package/dist/i18n/locales/de.d.ts +29 -0
  64. package/dist/i18n/locales/de.d.ts.map +1 -1
  65. package/dist/i18n/locales/de.js +29 -0
  66. package/dist/i18n/locales/de.js.map +1 -1
  67. package/dist/i18n/locales/el.d.ts +29 -0
  68. package/dist/i18n/locales/el.d.ts.map +1 -1
  69. package/dist/i18n/locales/el.js +29 -0
  70. package/dist/i18n/locales/el.js.map +1 -1
  71. package/dist/i18n/locales/en.d.ts +29 -0
  72. package/dist/i18n/locales/en.d.ts.map +1 -1
  73. package/dist/i18n/locales/en.js +29 -0
  74. package/dist/i18n/locales/en.js.map +1 -1
  75. package/dist/i18n/locales/es.d.ts +29 -0
  76. package/dist/i18n/locales/es.d.ts.map +1 -1
  77. package/dist/i18n/locales/es.js +29 -0
  78. package/dist/i18n/locales/es.js.map +1 -1
  79. package/dist/i18n/locales/fr.d.ts +29 -0
  80. package/dist/i18n/locales/fr.d.ts.map +1 -1
  81. package/dist/i18n/locales/fr.js +29 -0
  82. package/dist/i18n/locales/fr.js.map +1 -1
  83. package/dist/i18n/locales/hi.d.ts +29 -0
  84. package/dist/i18n/locales/hi.d.ts.map +1 -1
  85. package/dist/i18n/locales/hi.js +29 -0
  86. package/dist/i18n/locales/hi.js.map +1 -1
  87. package/dist/i18n/locales/it.d.ts +29 -0
  88. package/dist/i18n/locales/it.d.ts.map +1 -1
  89. package/dist/i18n/locales/it.js +29 -0
  90. package/dist/i18n/locales/it.js.map +1 -1
  91. package/dist/i18n/locales/ja.d.ts +29 -0
  92. package/dist/i18n/locales/ja.d.ts.map +1 -1
  93. package/dist/i18n/locales/ja.js +29 -0
  94. package/dist/i18n/locales/ja.js.map +1 -1
  95. package/dist/i18n/locales/nl.d.ts +29 -0
  96. package/dist/i18n/locales/nl.d.ts.map +1 -1
  97. package/dist/i18n/locales/nl.js +29 -0
  98. package/dist/i18n/locales/nl.js.map +1 -1
  99. package/dist/i18n/locales/pl.d.ts +29 -0
  100. package/dist/i18n/locales/pl.d.ts.map +1 -1
  101. package/dist/i18n/locales/pl.js +29 -0
  102. package/dist/i18n/locales/pl.js.map +1 -1
  103. package/dist/i18n/locales/pt.d.ts +29 -0
  104. package/dist/i18n/locales/pt.d.ts.map +1 -1
  105. package/dist/i18n/locales/pt.js +29 -0
  106. package/dist/i18n/locales/pt.js.map +1 -1
  107. package/dist/i18n/locales/ro.d.ts +29 -0
  108. package/dist/i18n/locales/ro.d.ts.map +1 -1
  109. package/dist/i18n/locales/ro.js +29 -0
  110. package/dist/i18n/locales/ro.js.map +1 -1
  111. package/dist/i18n/locales/ru.d.ts +29 -0
  112. package/dist/i18n/locales/ru.d.ts.map +1 -1
  113. package/dist/i18n/locales/ru.js +29 -0
  114. package/dist/i18n/locales/ru.js.map +1 -1
  115. package/dist/i18n/locales/sq.d.ts +29 -0
  116. package/dist/i18n/locales/sq.d.ts.map +1 -1
  117. package/dist/i18n/locales/sq.js +29 -0
  118. package/dist/i18n/locales/sq.js.map +1 -1
  119. package/dist/i18n/locales/sv.d.ts +29 -0
  120. package/dist/i18n/locales/sv.d.ts.map +1 -1
  121. package/dist/i18n/locales/sv.js +29 -0
  122. package/dist/i18n/locales/sv.js.map +1 -1
  123. package/dist/i18n/locales/tr.d.ts +29 -0
  124. package/dist/i18n/locales/tr.d.ts.map +1 -1
  125. package/dist/i18n/locales/tr.js +29 -0
  126. package/dist/i18n/locales/tr.js.map +1 -1
  127. package/dist/i18n/locales/zh.d.ts +29 -0
  128. package/dist/i18n/locales/zh.d.ts.map +1 -1
  129. package/dist/i18n/locales/zh.js +29 -0
  130. package/dist/i18n/locales/zh.js.map +1 -1
  131. package/dist/index.js +82 -76
  132. package/dist/index.js.map +1 -1
  133. package/dist/locales/ar.json +29 -0
  134. package/dist/locales/de.json +29 -0
  135. package/dist/locales/el.json +29 -0
  136. package/dist/locales/en.json +29 -0
  137. package/dist/locales/es.json +29 -0
  138. package/dist/locales/fr.json +29 -0
  139. package/dist/locales/hi.json +29 -0
  140. package/dist/locales/it.json +29 -0
  141. package/dist/locales/ja.json +29 -0
  142. package/dist/locales/nl.json +29 -0
  143. package/dist/locales/pl.json +29 -0
  144. package/dist/locales/pt.json +29 -0
  145. package/dist/locales/ro.json +29 -0
  146. package/dist/locales/ru.json +29 -0
  147. package/dist/locales/sq.json +29 -0
  148. package/dist/locales/sv.json +29 -0
  149. package/dist/locales/tr.json +29 -0
  150. package/dist/locales/zh.json +29 -0
  151. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  152. package/dist/tokens.css +1 -1
  153. package/package.json +9 -1
  154. package/dist/_chunks/chart-CpkpA74k.js +0 -374
  155. package/dist/_chunks/chart-CpkpA74k.js.map +0 -1
  156. package/dist/_chunks/icon-button-group-C_lqXTAj.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { jsx as a, jsxs as _ } from "react/jsx-runtime";
2
- import { forwardRef as Le, useState as E, useCallback as U, useRef as L, Children as ce, isValidElement as fe, useEffect as Ne, cloneElement as pe } from "react";
3
- import { c as je } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ze } from "react-i18next";
5
- import { I as ge } from "./icon-button-C_kbcd7I.js";
6
- import { D as h } from "./dropdown-menu-DU-Hrf33.js";
7
- import { u as Se } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
8
- import { u as Be } from "./use-priority-overflow-c9SjxZkZ.js";
9
- import { E as me } from "./ellipsis-dRo9ouSU.js";
10
- const be = je(
2
+ import { forwardRef as je, useState as U, useCallback as W, useRef as z, Children as pe, isValidElement as H, useEffect as ge, cloneElement as me } from "react";
3
+ import { c as ze } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Se } from "react-i18next";
5
+ import { I as be } from "./icon-button-C_kbcd7I.js";
6
+ import { D as w } from "./dropdown-menu-DU-Hrf33.js";
7
+ import { u as Be } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
8
+ import { u as Ke } from "./use-priority-overflow-c9SjxZkZ.js";
9
+ import { E as ve } from "./ellipsis-dRo9ouSU.js";
10
+ const ye = ze(
11
11
  [
12
12
  "ds:inline-flex ds:isolate",
13
13
  // Hairline border around the group unifies the children into one
@@ -52,224 +52,239 @@ const be = je(
52
52
  orientation: "horizontal"
53
53
  }
54
54
  }
55
- ), ve = "ds:absolute ds:start-0 ds:top-0 ds:invisible ds:pointer-events-none", Ke = Le(
56
- (d, b) => {
55
+ ), he = "ds:absolute ds:start-0 ds:top-0 ds:invisible ds:pointer-events-none", Pe = je(
56
+ (d, v) => {
57
57
  const {
58
- size: g,
58
+ size: m,
59
59
  orientation: u = "horizontal",
60
60
  role: i = "group",
61
61
  mode: n = "momentary",
62
- disabled: W = !1,
63
- intent: N = "outline",
64
- overflow: ye = "none",
65
- className: H,
66
- children: q,
67
- "aria-label": J,
68
- "aria-labelledby": Q,
62
+ disabled: q = !1,
63
+ intent: S = "outline",
64
+ overflow: we = "none",
65
+ className: J,
66
+ children: Q,
67
+ "aria-label": X,
68
+ "aria-labelledby": Y,
69
69
  // Controlled-value props are consumed via `props as …` below; strip them
70
70
  // here so they never spread onto the root <div> (React would warn that
71
71
  // `onValueChange` is an unknown DOM event handler).
72
- value: Te,
73
- defaultValue: _e,
74
- onValueChange: Fe,
75
- ...X
76
- } = d, { t: he } = ze(), v = ye === "menu" && u !== "vertical", [Y, Z] = E(
72
+ value: _e,
73
+ defaultValue: Fe,
74
+ onValueChange: Ge,
75
+ ...Z
76
+ } = d, { t: ke } = Se(), y = we === "menu" && u !== "vertical", [ee, oe] = U(
77
77
  () => n === "toggle-single" ? d.defaultValue ?? "" : n === "toggle-multi" ? d.defaultValue ?? [] : ""
78
- ), w = (() => {
78
+ ), g = (() => {
79
79
  if (n === "toggle-single") {
80
80
  const e = d;
81
- return e.value !== void 0 ? e.value : Y;
81
+ return e.value !== void 0 ? e.value : ee;
82
82
  }
83
83
  if (n === "toggle-multi") {
84
84
  const e = d;
85
- return e.value !== void 0 ? e.value : Y;
85
+ return e.value !== void 0 ? e.value : ee;
86
86
  }
87
87
  return "";
88
- })(), k = U(
88
+ })(), k = W(
89
89
  (e) => {
90
90
  var o, r;
91
91
  if (n === "toggle-single") {
92
92
  const t = d;
93
- t.value === void 0 && Z(e), (o = t.onValueChange) == null || o.call(t, e);
93
+ t.value === void 0 && oe(e), (o = t.onValueChange) == null || o.call(t, e);
94
94
  } else if (n === "toggle-multi") {
95
95
  const t = d;
96
- t.value === void 0 && Z(e), (r = t.onValueChange) == null || r.call(t, e);
96
+ t.value === void 0 && oe(e), (r = t.onValueChange) == null || r.call(t, e);
97
97
  }
98
98
  },
99
99
  [n, d]
100
- ), m = i === "toolbar" || i === "radiogroup", R = L([]), [y, j] = E(0), ee = U(
100
+ ), b = i === "toolbar" || i === "radiogroup", R = z([]), [h, I] = U(0), te = W(
101
101
  (e, o) => {
102
102
  R.current[e] = o;
103
103
  },
104
104
  []
105
- ), oe = L(null), [F, we] = E(!1);
106
- Se(() => {
105
+ ), re = z(null), [F, Ce] = U(!1);
106
+ Be(() => {
107
107
  if (typeof window > "u") return;
108
- const e = oe.current;
108
+ const e = re.current;
109
109
  if (!e) return;
110
110
  const o = window.getComputedStyle(e).direction;
111
- we(o === "rtl");
111
+ Ce(o === "rtl");
112
112
  }, []);
113
- const G = U(
113
+ const G = W(
114
114
  (e) => {
115
- var P;
116
- if (!m) return;
115
+ var T;
116
+ if (!b) return;
117
117
  const o = R.current.filter(Boolean).length;
118
118
  if (o === 0) return;
119
119
  const r = u === "vertical" ? "ArrowDown" : F ? "ArrowLeft" : "ArrowRight", t = u === "vertical" ? "ArrowUp" : F ? "ArrowRight" : "ArrowLeft";
120
120
  let s = null;
121
- if (e.key === r ? s = (y + 1) % o : e.key === t ? s = (y - 1 + o) % o : e.key === "Home" ? s = 0 : e.key === "End" && (s = o - 1), s === null) return;
122
- const V = o;
121
+ if (e.key === r ? s = (h + 1) % o : e.key === t ? s = (h - 1 + o) % o : e.key === "Home" ? s = 0 : e.key === "End" && (s = o - 1), s === null) return;
122
+ const L = o;
123
123
  let C = 0, c = s;
124
- for (; C < V; ) {
124
+ for (; C < L; ) {
125
125
  const f = R.current[c];
126
126
  if (f && f.getAttribute("aria-disabled") !== "true" && !f.disabled)
127
127
  break;
128
128
  c = e.key === t || e.key === "End" ? (c - 1 + o) % o : (c + 1) % o, C += 1;
129
129
  }
130
- if (e.preventDefault(), j(c), (P = R.current[c]) == null || P.focus(), i === "radiogroup" && n === "toggle-single") {
131
- const f = ne.current[c];
130
+ if (e.preventDefault(), I(c), (T = R.current[c]) == null || T.focus(), i === "radiogroup" && n === "toggle-single") {
131
+ const f = se.current[c];
132
132
  if (f && typeof f == "object" && "props" in f) {
133
- const T = f.props.value;
134
- T && k(T);
133
+ const N = f.props.value;
134
+ N && N !== g && k(N);
135
135
  }
136
136
  }
137
137
  },
138
- [m, u, F, y, i, n, k]
139
- ), I = v ? ce.toArray(q).filter(fe) : [], z = (e) => {
138
+ [
139
+ b,
140
+ u,
141
+ F,
142
+ h,
143
+ i,
144
+ n,
145
+ k,
146
+ g
147
+ ]
148
+ ), x = y ? pe.toArray(Q).filter(H) : [], B = (e) => {
140
149
  const o = e.props["aria-label"];
141
150
  return typeof o == "string" ? o : typeof e.props.tooltip == "string" ? e.props.tooltip : null;
142
151
  };
143
- L(!1);
144
- const ke = I.map((e) => {
145
- const o = e.props["data-overflow-pin"] !== void 0, r = z(e) !== null;
152
+ z(!1);
153
+ const Re = x.map((e) => {
154
+ const o = e.props["data-overflow-pin"] !== void 0, r = B(e) !== null;
146
155
  return o || !r;
147
- }), { containerRef: Ce, fullRowRef: Re, triggerProbeRef: Ie, visible: te, overflowing: S } = Be({
148
- enabled: v,
149
- count: I.length,
150
- pinned: ke
151
- }), re = L(null), B = v ? I.filter((e, o) => te[o]) : ce.toArray(q);
152
- v && (R.current.length = B.length + (S ? 1 : 0));
153
- const ne = L([]);
154
- ne.current = B;
155
- const x = B.length;
156
- Ne(() => {
156
+ }), { containerRef: Ie, fullRowRef: xe, triggerProbeRef: Ae, visible: ne, overflowing: K } = Ke({
157
+ enabled: y,
158
+ count: x.length,
159
+ pinned: Re
160
+ }), ie = z(null), A = y ? x.filter((e, o) => ne[o]) : pe.toArray(Q);
161
+ y && (R.current.length = A.length + (K ? 1 : 0));
162
+ const se = z([]);
163
+ se.current = A;
164
+ const M = i === "radiogroup" && n === "toggle-single" ? A.findIndex(
165
+ (e) => H(e) && e.props.value === g
166
+ ) : -1;
167
+ ge(() => {
168
+ M >= 0 && I(M);
169
+ }, [M]);
170
+ const V = A.length;
171
+ ge(() => {
157
172
  var o;
158
- if (!m || !v) return;
159
- const e = x + (S ? 1 : 0);
160
- e > 0 && y >= e && (j(e - 1), document.activeElement === document.body && ((o = re.current) == null || o.focus()));
173
+ if (!b || !y) return;
174
+ const e = V + (K ? 1 : 0);
175
+ e > 0 && h >= e && (I(e - 1), document.activeElement === document.body && ((o = ie.current) == null || o.focus()));
161
176
  }, [
162
- m,
163
- v,
164
- x,
165
- S,
166
- y
177
+ b,
178
+ y,
179
+ V,
180
+ K,
181
+ h
167
182
  ]);
168
- const ie = B.map((e, o) => {
169
- if (!fe(e))
183
+ const ae = A.map((e, o) => {
184
+ if (!H(e))
170
185
  return e;
171
- const r = e, t = r.props.value, { ariaPressed: s, ariaChecked: V } = Pe(
186
+ const r = e, t = r.props.value, { ariaPressed: s, ariaChecked: L } = Te(
172
187
  n,
173
188
  i,
174
189
  t,
175
- w
176
- ), C = W === !0, c = r.props.disabled === !0, P = (p) => {
177
- var l, D;
190
+ g
191
+ ), C = q === !0, c = r.props.disabled === !0, T = (p) => {
192
+ var l, j;
178
193
  if (C) {
179
194
  p.preventDefault(), p.stopPropagation();
180
195
  return;
181
196
  }
182
- if ((D = (l = r.props).onClick) == null || D.call(l, p), !p.defaultPrevented && t) {
197
+ if ((j = (l = r.props).onClick) == null || j.call(l, p), !p.defaultPrevented && t) {
183
198
  if (n === "toggle-single") {
184
- if (w === t) return;
199
+ if (g === t) return;
185
200
  k(t);
186
201
  } else if (n === "toggle-multi") {
187
- const $ = w, Ve = $.includes(t) ? $.filter((De) => De !== t) : [...$, t];
188
- k(Ve);
202
+ const E = g, Le = E.includes(t) ? E.filter((Ne) => Ne !== t) : [...E, t];
203
+ k(Le);
189
204
  }
190
205
  }
191
206
  }, f = (p) => {
192
- ee(o, p);
207
+ te(o, p);
193
208
  const l = r.ref;
194
209
  typeof l == "function" ? l(p) : l != null && typeof l == "object" && (l.current = p);
195
- }, T = C && !c ? !0 : void 0, xe = n !== "momentary" || C, Ae = {
196
- intent: r.props.intent ?? N,
197
- size: r.props.size ?? g,
210
+ }, N = C && !c ? !0 : void 0, Ve = n !== "momentary" || C, De = {
211
+ intent: r.props.intent ?? S,
212
+ size: r.props.size ?? m,
198
213
  disabled: c,
199
- "aria-disabled": T,
200
- onClick: xe ? P : r.props.onClick,
214
+ "aria-disabled": N,
215
+ onClick: Ve ? T : r.props.onClick,
201
216
  "aria-pressed": s,
202
- "aria-checked": V,
217
+ "aria-checked": L,
203
218
  // When the group is a radiogroup, children must be `role="radio"`
204
219
  // so screen readers announce them as radio buttons and so
205
220
  // `getByRole('radio')` works in tests. The button element is
206
221
  // re-purposed as a radio; `aria-checked` above carries the state.
207
222
  role: i === "radiogroup" ? "radio" : void 0,
208
- tabIndex: m ? o === y ? 0 : -1 : void 0,
223
+ tabIndex: b ? o === h ? 0 : -1 : void 0,
209
224
  onFocus: (p) => {
210
- var l, D;
211
- m && j(o), (D = (l = r.props).onFocus) == null || D.call(l, p);
225
+ var l, j;
226
+ b && I(o), (j = (l = r.props).onFocus) == null || j.call(l, p);
212
227
  },
213
228
  ref: f
214
229
  };
215
- return pe(r, Ae);
216
- }), se = (e) => {
217
- oe.current = e, typeof b == "function" ? b(e) : b && typeof b == "object" && (b.current = e);
230
+ return me(r, De);
231
+ }), le = (e) => {
232
+ re.current = e, typeof v == "function" ? v(e) : v && typeof v == "object" && (v.current = e);
218
233
  };
219
- if (!v)
234
+ if (!y)
220
235
  return /* @__PURE__ */ a(
221
236
  "div",
222
237
  {
223
- ref: se,
238
+ ref: le,
224
239
  role: i,
225
- "aria-label": J,
226
- "aria-labelledby": Q,
240
+ "aria-label": X,
241
+ "aria-labelledby": Y,
227
242
  "aria-orientation": i === "toolbar" ? u : void 0,
228
243
  onKeyDown: G,
229
- className: be({ orientation: u, className: H }),
244
+ className: ye({ orientation: u, className: J }),
230
245
  "data-component": "icon-button-group",
231
- ...X,
232
- children: ie
246
+ ...Z,
247
+ children: ae
233
248
  }
234
249
  );
235
- const ae = he("buttonGroup.more", "More options"), A = W === !0, M = I.map((e, o) => ({ childEl: e, i: o })).filter(({ i: e }) => !te[e]);
236
- let K = null;
237
- n === "toggle-single" ? K = /* @__PURE__ */ a(
238
- h.RadioGroup,
250
+ const de = ke("buttonGroup.more", "More options"), D = q === !0, O = x.map((e, o) => ({ childEl: e, i: o })).filter(({ i: e }) => !ne[e]);
251
+ let P = null;
252
+ n === "toggle-single" ? P = /* @__PURE__ */ a(
253
+ w.RadioGroup,
239
254
  {
240
- value: w,
255
+ value: g,
241
256
  onValueChange: (e) => {
242
- !A && e !== w && k(e);
257
+ !D && e !== g && k(e);
243
258
  },
244
- children: M.map(({ childEl: e, i: o }) => /* @__PURE__ */ a(
245
- h.RadioItem,
259
+ children: O.map(({ childEl: e, i: o }) => /* @__PURE__ */ a(
260
+ w.RadioItem,
246
261
  {
247
262
  value: e.props.value ?? "",
248
- disabled: A || e.props.disabled === !0,
249
- children: z(e)
263
+ disabled: D || e.props.disabled === !0,
264
+ children: B(e)
250
265
  },
251
266
  e.key ?? o
252
267
  ))
253
268
  }
254
- ) : n === "toggle-multi" ? K = M.map(({ childEl: e, i: o }) => {
255
- const r = e.props.value, t = w, s = r ? t.includes(r) : !1;
269
+ ) : n === "toggle-multi" ? P = O.map(({ childEl: e, i: o }) => {
270
+ const r = e.props.value, t = g, s = r ? t.includes(r) : !1;
256
271
  return /* @__PURE__ */ a(
257
- h.CheckboxItem,
272
+ w.CheckboxItem,
258
273
  {
259
274
  checked: s,
260
- disabled: A || e.props.disabled === !0,
275
+ disabled: D || e.props.disabled === !0,
261
276
  onCheckedChange: () => {
262
- A || !r || k(s ? t.filter((V) => V !== r) : [...t, r]);
277
+ D || !r || k(s ? t.filter((L) => L !== r) : [...t, r]);
263
278
  },
264
- children: z(e)
279
+ children: B(e)
265
280
  },
266
281
  e.key ?? o
267
282
  );
268
- }) : K = M.map(({ childEl: e, i: o }) => /* @__PURE__ */ a(
269
- h.Item,
283
+ }) : P = O.map(({ childEl: e, i: o }) => /* @__PURE__ */ a(
284
+ w.Item,
270
285
  {
271
286
  startIcon: e.props.icon,
272
- disabled: A || e.props.disabled === !0,
287
+ disabled: D || e.props.disabled === !0,
273
288
  onSelect: (r) => {
274
289
  var t, s;
275
290
  (s = (t = e.props).onClick) == null || s.call(
@@ -277,64 +292,64 @@ const be = je(
277
292
  r
278
293
  );
279
294
  },
280
- children: z(e)
295
+ children: B(e)
281
296
  },
282
297
  e.key ?? o
283
298
  ));
284
- const le = S ? /* @__PURE__ */ _(h.Root, { children: [
285
- /* @__PURE__ */ a(h.Trigger, { asChild: !0, children: /* @__PURE__ */ a(
286
- ge,
299
+ const ue = K ? /* @__PURE__ */ _(w.Root, { children: [
300
+ /* @__PURE__ */ a(w.Trigger, { asChild: !0, children: /* @__PURE__ */ a(
301
+ be,
287
302
  {
288
- icon: /* @__PURE__ */ a(me, {}),
289
- intent: N,
290
- size: g,
291
- "aria-label": ae,
303
+ icon: /* @__PURE__ */ a(ve, {}),
304
+ intent: S,
305
+ size: m,
306
+ "aria-label": de,
292
307
  ref: (e) => {
293
- re.current = e, ee(x, e);
308
+ ie.current = e, te(V, e);
294
309
  },
295
- tabIndex: m ? y === x ? 0 : -1 : void 0,
296
- onFocus: m ? () => j(x) : void 0
310
+ tabIndex: b ? h === V ? 0 : -1 : void 0,
311
+ onFocus: b ? () => I(V) : void 0
297
312
  }
298
313
  ) }),
299
- /* @__PURE__ */ a(h.Content, { align: "end", children: K })
300
- ] }) : null, de = be({ orientation: u }), O = i !== "radiogroup", ue = /* @__PURE__ */ _(
314
+ /* @__PURE__ */ a(w.Content, { align: "end", children: P })
315
+ ] }) : null, ce = ye({ orientation: u }), $ = i !== "radiogroup", fe = /* @__PURE__ */ _(
301
316
  "div",
302
317
  {
303
318
  role: i,
304
- "aria-label": J,
305
- "aria-labelledby": Q,
319
+ "aria-label": X,
320
+ "aria-labelledby": Y,
306
321
  "aria-orientation": i === "toolbar" ? u : void 0,
307
- onKeyDown: O ? G : void 0,
308
- className: `${de} ds:max-w-full`,
322
+ onKeyDown: $ ? G : void 0,
323
+ className: `${ce} ds:max-w-full`,
309
324
  children: [
310
- ie,
311
- O ? le : null
325
+ ae,
326
+ $ ? ue : null
312
327
  ]
313
328
  }
314
329
  );
315
330
  return /* @__PURE__ */ a(
316
331
  "div",
317
332
  {
318
- ref: se,
333
+ ref: le,
319
334
  "data-component": "icon-button-group",
320
335
  className: [
321
336
  "ds:relative ds:block ds:w-full ds:min-w-0 ds:overflow-x-clip",
322
- H ?? ""
337
+ J ?? ""
323
338
  ].join(" ").trim(),
324
- ...X,
325
- children: /* @__PURE__ */ _("div", { ref: Ce, className: "ds:block ds:w-full ds:min-w-0", children: [
339
+ ...Z,
340
+ children: /* @__PURE__ */ _("div", { ref: Ie, className: "ds:block ds:w-full ds:min-w-0", children: [
326
341
  /* @__PURE__ */ a(
327
342
  "div",
328
343
  {
329
- ref: Re,
344
+ ref: xe,
330
345
  "aria-hidden": "true",
331
346
  inert: !0,
332
- className: `${ve} ${de}`,
333
- children: I.map(
334
- (e, o) => pe(e, {
347
+ className: `${he} ${ce}`,
348
+ children: x.map(
349
+ (e, o) => me(e, {
335
350
  key: e.key ?? o,
336
- intent: e.props.intent ?? N,
337
- size: e.props.size ?? g,
351
+ intent: e.props.intent ?? S,
352
+ size: e.props.size ?? m,
338
353
  tabIndex: -1,
339
354
  ref: null
340
355
  })
@@ -344,23 +359,23 @@ const be = je(
344
359
  /* @__PURE__ */ a(
345
360
  "span",
346
361
  {
347
- ref: Ie,
362
+ ref: Ae,
348
363
  "aria-hidden": "true",
349
364
  inert: !0,
350
- className: ve,
365
+ className: he,
351
366
  children: /* @__PURE__ */ a(
352
- ge,
367
+ be,
353
368
  {
354
- icon: /* @__PURE__ */ a(me, {}),
355
- intent: N,
356
- size: g,
357
- "aria-label": ae,
369
+ icon: /* @__PURE__ */ a(ve, {}),
370
+ intent: S,
371
+ size: m,
372
+ "aria-label": de,
358
373
  tabIndex: -1
359
374
  }
360
375
  )
361
376
  }
362
377
  ),
363
- O ? ue : (
378
+ $ ? fe : (
364
379
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- non-focusable wrapper; arrow-key roving bubbles up from the focusable IconButtons in the strip and the overflow trigger
365
380
  /* @__PURE__ */ _(
366
381
  "div",
@@ -368,8 +383,8 @@ const be = je(
368
383
  className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
369
384
  onKeyDown: G,
370
385
  children: [
371
- ue,
372
- le
386
+ fe,
387
+ ue
373
388
  ]
374
389
  }
375
390
  )
@@ -379,13 +394,13 @@ const be = je(
379
394
  );
380
395
  }
381
396
  );
382
- Ke.displayName = "IconButtonGroup";
383
- function Pe(d, b, g, u) {
384
- if (d === "momentary" || !g) return {};
385
- const i = d === "toggle-multi" ? u.includes(g) : u === g;
386
- return b === "radiogroup" ? { ariaChecked: i } : { ariaPressed: i };
397
+ Pe.displayName = "IconButtonGroup";
398
+ function Te(d, v, m, u) {
399
+ if (d === "momentary" || !m) return {};
400
+ const i = d === "toggle-multi" ? u.includes(m) : u === m;
401
+ return v === "radiogroup" ? { ariaChecked: i } : { ariaPressed: i };
387
402
  }
388
403
  export {
389
- Ke as I
404
+ Pe as I
390
405
  };
391
- //# sourceMappingURL=icon-button-group-C_lqXTAj.js.map
406
+ //# sourceMappingURL=icon-button-group-BLHPN6jg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-button-group-BLHPN6jg.js","sources":["../../src/components/icon-button-group/icon-button-group.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Ellipsis } from 'lucide-react';\nimport { IconButton, type IconButtonProps } from '../button/icon-button';\nimport type { ButtonProps } from '../button/button';\nimport { DropdownMenu } from '../dropdown-menu';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { usePriorityOverflow } from '../../hooks/use-priority-overflow';\n\ntype ButtonIntent = NonNullable<ButtonProps['intent']>;\n\n// Intentionally does NOT compose `@radix-ui/react-toggle-group`. Radix\n// ToggleGroup's render shape makes it hard to layer shared-border chrome\n// across children (first-child / last-child / internal-divider CSS), and\n// the three-mode + three-role matrix (group / toolbar / radiogroup × momentary\n// / toggle-single / toggle-multi) is broader than Radix's single / multi\n// contract. The roving-tabindex implementation below mirrors Radix's pattern\n// so keyboard semantics stay consistent. See 05-accessibility.mdx for the\n// WAI-ARIA toolbar / radiogroup references.\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst iconButtonGroupVariants = cva(\n [\n 'ds:inline-flex ds:isolate',\n // Hairline border around the group unifies the children into one\n // visual unit. Internal child dividers are drawn via the per-child\n // class list below.\n 'ds:border ds:border-border',\n 'ds:rounded-[var(--radius-md)]',\n // Ensure the focus ring of a pressed child sits above its siblings.\n 'ds:[&>*]:relative ds:[&>*:focus-visible]:z-10',\n ].join(' '),\n {\n variants: {\n orientation: {\n horizontal: [\n 'ds:flex-row',\n // Flatten internal corners on children so the outer radius owns\n // the rounded edges.\n 'ds:[&>*:not(:first-child)]:rounded-s-none',\n 'ds:[&>*:not(:last-child)]:rounded-e-none',\n // Internal divider — logical so it flips in RTL.\n 'ds:[&>*:not(:first-child)]:border-s',\n 'ds:[&>*:not(:first-child)]:border-border',\n // The children already own an outer border (from IconButton's\n // own border in secondary/outline variants). Collapse the doubled\n // border so we don't get a 2px seam.\n 'ds:[&>*]:border-0',\n ].join(' '),\n vertical: [\n 'ds:flex-col',\n // Vertical groups flow block-wise. Reading direction doesn't\n // invert vertical stacks in any locale this DS targets, so the\n // physical `rounded-t/b` is intentional.\n 'ds:[&>*:not(:first-child)]:rounded-t-none',\n 'ds:[&>*:not(:last-child)]:rounded-b-none',\n 'ds:[&>*:not(:first-child)]:border-t',\n 'ds:[&>*:not(:first-child)]:border-border',\n 'ds:[&>*]:border-0',\n ].join(' '),\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n },\n);\n\n// Hidden measurement rows: laid out (so widths are real) but invisible,\n// non-interactive and out of the a11y tree. Never display:none.\nconst MEASURE_ROW_CLASSES =\n 'ds:absolute ds:start-0 ds:top-0 ds:invisible ds:pointer-events-none';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type IconButtonGroupRole = 'group' | 'toolbar' | 'radiogroup';\nexport type IconButtonGroupMode =\n | 'momentary'\n | 'toggle-single'\n | 'toggle-multi';\n\ntype SharedPropsBase = {\n /** Forwarded to every child that does not set its own `size`. */\n size?: 'sm' | 'md' | 'lg';\n orientation?: 'horizontal' | 'vertical';\n /** Disables every child. Uses `aria-disabled` on children (not the HTML\n * attribute) so each child still takes focus — matches WAI-ARIA toolbar\n * guidance. Visual disabled styling picks up the `aria-disabled:*`\n * variant declared on the Button base class. */\n disabled?: boolean;\n /** Intent applied to every child that does not set its own `intent`.\n * Defaults to `outline` — grouped icon buttons are peers, not a row\n * of solid-primary CTAs. */\n intent?: ButtonIntent;\n /** `'menu'` keeps the strip on one line whatever the container width:\n * children that stop fitting move into a dropdown behind an ellipsis\n * trigger, preserving toggle semantics (radio / checkbox items). The\n * group then fills its container's inline size. Horizontal only.\n * Children set `data-overflow-pin` to always stay in the strip. */\n overflow?: 'none' | 'menu';\n children: ReactNode;\n};\n\n// At least one of `aria-label` / `aria-labelledby` must be present. This\n// discriminated pair makes the TypeScript compiler reject a group with\n// neither — see the a11y acceptance criteria in the user story.\ntype AccessibleNameProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string };\n\ntype SharedProps = SharedPropsBase & AccessibleNameProps;\n\n// Role + mode combinations are not all valid. Encoded via a discriminated\n// union so the compiler rejects nonsensical pairings (e.g. a multi-select\n// radiogroup).\ntype GroupRoleProps =\n | { role?: 'group'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'toolbar'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'radiogroup'; mode: 'toggle-single' };\n\ntype MomentaryProps = SharedProps & {\n mode?: 'momentary';\n value?: never;\n defaultValue?: never;\n onValueChange?: never;\n};\n\ntype ToggleSingleProps = SharedProps & {\n mode: 'toggle-single';\n value?: string;\n defaultValue?: string;\n onValueChange?: (next: string) => void;\n};\n\ntype ToggleMultiProps = SharedProps & {\n mode: 'toggle-multi';\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (next: string[]) => void;\n};\n\nexport type IconButtonGroupProps = (\n | MomentaryProps\n | ToggleSingleProps\n | ToggleMultiProps\n) &\n GroupRoleProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'onChange' | 'children'> &\n VariantProps<typeof iconButtonGroupVariants>;\n\n/* ------------------------------------------------------------------ */\n/* IconButtonGroup */\n/* ------------------------------------------------------------------ */\n\nexport const IconButtonGroup = forwardRef<HTMLDivElement, IconButtonGroupProps>(\n (props, ref) => {\n const {\n size,\n orientation = 'horizontal',\n role = 'group',\n mode = 'momentary',\n disabled = false,\n intent = 'outline',\n overflow = 'none',\n className,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n // Controlled-value props are consumed via `props as …` below; strip them\n // here so they never spread onto the root <div> (React would warn that\n // `onValueChange` is an unknown DOM event handler).\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n ...rest\n } = props as IconButtonGroupProps & { className?: string };\n const { t } = useTranslation();\n\n if (import.meta.env.DEV && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'IconButtonGroup: `aria-label` or `aria-labelledby` is required for accessibility.',\n );\n }\n if (\n import.meta.env.DEV &&\n overflow === 'menu' &&\n orientation === 'vertical'\n ) {\n console.warn(\n 'IconButtonGroup: overflow=\"menu\" is horizontal-only; falling back to overflow=\"none\".',\n );\n }\n const overflowEnabled = overflow === 'menu' && orientation !== 'vertical';\n\n /* ---- Controlled / uncontrolled value for toggle modes --------- */\n const [internalValue, setInternalValue] = useState<string | string[]>(\n () => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.defaultValue ?? '';\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.defaultValue ?? [];\n }\n return '';\n },\n );\n\n const resolvedValue: string | string[] = (() => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n return '';\n })();\n\n const commitValue = useCallback(\n (next: string | string[]) => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n if (p.value === undefined) setInternalValue(next as string);\n p.onValueChange?.(next as string);\n } else if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n if (p.value === undefined) setInternalValue(next as string[]);\n p.onValueChange?.(next as string[]);\n }\n },\n [mode, props],\n );\n\n /* ---- Roving tabindex state — only active in toolbar / radiogroup - */\n const rovingTabindex = role === 'toolbar' || role === 'radiogroup';\n const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const [focusIndex, setFocusIndex] = useState(0);\n\n const registerIndex = useCallback(\n (index: number, el: HTMLButtonElement | null) => {\n buttonsRef.current[index] = el;\n },\n [],\n );\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [isRTL, setIsRTL] = useState(false);\n // `useLayoutEffect` so the direction is correct BEFORE the first paint\n // (otherwise a user pressing an arrow key on the first frame after mount\n // would hit the default-LTR mapping even in an RTL document).\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return;\n const node = rootRef.current;\n if (!node) return;\n // Read the computed direction from the group's own wrapper so a\n // scoped `dir='rtl'` on any ancestor (not just <html>) flips arrow\n // navigation. `getComputedStyle` walks up automatically.\n const dir = window.getComputedStyle(node).direction;\n setIsRTL(dir === 'rtl');\n }, []);\n\n /* ---- Arrow-key navigation for roving tabindex ----------------- */\n const handleRootKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (!rovingTabindex) return;\n const count = buttonsRef.current.filter(Boolean).length;\n if (count === 0) return;\n\n const forwardKey =\n orientation === 'vertical'\n ? 'ArrowDown'\n : isRTL\n ? 'ArrowLeft'\n : 'ArrowRight';\n const backwardKey =\n orientation === 'vertical'\n ? 'ArrowUp'\n : isRTL\n ? 'ArrowRight'\n : 'ArrowLeft';\n\n let next: number | null = null;\n if (event.key === forwardKey) next = (focusIndex + 1) % count;\n else if (event.key === backwardKey)\n next = (focusIndex - 1 + count) % count;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = count - 1;\n\n if (next === null) return;\n // Skip over disabled children.\n const maxAttempts = count;\n let attempts = 0;\n let candidate = next;\n while (attempts < maxAttempts) {\n const el = buttonsRef.current[candidate];\n if (\n el &&\n el.getAttribute('aria-disabled') !== 'true' &&\n !el.disabled\n ) {\n break;\n }\n candidate =\n event.key === backwardKey || event.key === 'End'\n ? (candidate - 1 + count) % count\n : (candidate + 1) % count;\n attempts += 1;\n }\n event.preventDefault();\n setFocusIndex(candidate);\n buttonsRef.current[candidate]?.focus();\n // WAI-ARIA radiogroup pattern: arrow keys MOVE focus AND CHANGE\n // the selected radio in one action. toolbar pattern (and plain\n // group) only moves focus.\n if (role === 'radiogroup' && mode === 'toggle-single') {\n const child = childArrayRef.current[candidate];\n if (child && typeof child === 'object' && 'props' in child) {\n const cValue = (child as ReactElement<{ value?: string }>).props\n .value;\n // Same guard as the click path: re-committing the already\n // selected value is a no-op, so Home/End on the selected radio\n // never fires a spurious onValueChange.\n if (cValue && cValue !== resolvedValue) commitValue(cValue);\n }\n }\n },\n [\n rovingTabindex,\n orientation,\n isRTL,\n focusIndex,\n role,\n mode,\n commitValue,\n resolvedValue,\n ],\n );\n\n /* ---- Overflow bookkeeping (menu mode only) --------------------- */\n type OverflowChildProps = IconButtonProps & {\n value?: string;\n 'data-overflow-pin'?: boolean | 'true' | '';\n };\n const allElements = overflowEnabled\n ? (Children.toArray(children).filter(isValidElement) as Array<\n ReactElement<OverflowChildProps>\n >)\n : [];\n const mirrorLabel = (child: ReactElement<OverflowChildProps>) => {\n const aria = child.props['aria-label'];\n if (typeof aria === 'string') return aria;\n return typeof child.props.tooltip === 'string'\n ? child.props.tooltip\n : null;\n };\n const warnedRef = useRef(false);\n const pinnedFlags = allElements.map((child) => {\n const explicit = child.props['data-overflow-pin'] !== undefined;\n const mirrorable = mirrorLabel(child) !== null;\n if (\n import.meta.env.DEV &&\n !explicit &&\n !mirrorable &&\n !warnedRef.current\n ) {\n warnedRef.current = true;\n console.warn(\n 'IconButtonGroup: a child without aria-label / tooltip cannot move into the overflow menu — it stays pinned in the strip.',\n );\n }\n return explicit || !mirrorable;\n });\n\n const { containerRef, fullRowRef, triggerProbeRef, visible, overflowing } =\n usePriorityOverflow({\n enabled: overflowEnabled,\n count: allElements.length,\n pinned: pinnedFlags,\n });\n\n const triggerNodeRef = useRef<HTMLButtonElement | null>(null);\n\n /* ---- Build enhanced children ---------------------------------- */\n const childArray = overflowEnabled\n ? allElements.filter((_, i) => visible[i])\n : Children.toArray(children);\n if (overflowEnabled) {\n buttonsRef.current.length = childArray.length + (overflowing ? 1 : 0);\n }\n // Mirror into a ref so the keydown handler (referenced from Memo deps)\n // can read the latest child list without inflating the dep array.\n const childArrayRef = useRef<ReturnType<typeof Children.toArray>>([]);\n childArrayRef.current = childArray;\n\n // APG radiogroup pattern: Tab must land on the CHECKED radio, not the\n // first one. Keep the roving tab stop pinned to the selected child —\n // covers initial mount (checked child not first) and controlled value\n // changes. Arrow/click interactions already align focusIndex with the\n // selection, so this effect is a no-op for them.\n const checkedIndex =\n role === 'radiogroup' && mode === 'toggle-single'\n ? childArray.findIndex(\n (child) =>\n isValidElement(child) &&\n (child as ReactElement<{ value?: string }>).props.value ===\n resolvedValue,\n )\n : -1;\n useEffect(() => {\n if (checkedIndex >= 0) setFocusIndex(checkedIndex);\n }, [checkedIndex]);\n\n const visibleCount = childArray.length;\n // Clamp the roving focus when items move into the menu; hand real focus\n // to the trigger only when the focused node was the one that left.\n useEffect(() => {\n if (!rovingTabindex || !overflowEnabled) return;\n const total = visibleCount + (overflowing ? 1 : 0);\n if (total > 0 && focusIndex >= total) {\n setFocusIndex(total - 1);\n if (document.activeElement === document.body) {\n triggerNodeRef.current?.focus();\n }\n }\n }, [\n rovingTabindex,\n overflowEnabled,\n visibleCount,\n overflowing,\n focusIndex,\n ]);\n\n const enhanced = childArray.map((child, index) => {\n if (!isValidElement(child)) {\n if (import.meta.env.DEV) {\n console.warn(\n 'IconButtonGroup: children should be <IconButton> elements.',\n );\n }\n return child;\n }\n\n const childEl = child as ReactElement<\n IconButtonProps & {\n value?: string;\n asChild?: boolean;\n children?: ReactNode;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n }\n >;\n\n // DEV-time sanity: warn if we got something that isn't an IconButton.\n // `React.cloneElement` would still work, but IconButton-specific\n // props (::before target size, forwarded tooltip) wouldn't apply.\n // `asChild` wrappers (e.g. DropdownMenu.Trigger) are fine when they\n // Slot-merge the cloned props onto their own IconButton child, as are\n // components that declare a static `rendersIconButton` marker (the\n // DataTable toolbar leaves — each renders one IconButton trigger and\n // forwards ref/tabIndex/onFocus to it).\n if (import.meta.env.DEV && childEl.type !== IconButton) {\n const slotChild =\n childEl.props.asChild === true ? childEl.props.children : null;\n const wrapsIconButton =\n isValidElement(slotChild) && slotChild.type === IconButton;\n const rendersIconButton =\n (childEl.type as { rendersIconButton?: boolean })\n .rendersIconButton === true;\n if (!wrapsIconButton && !rendersIconButton) {\n console.warn(\n 'IconButtonGroup: each child should be a DS <IconButton>. Other elements break target-size + focus-ring contracts.',\n );\n }\n }\n\n const childValue = childEl.props.value;\n\n // Compute aria-pressed / aria-checked for toggle modes.\n const { ariaPressed, ariaChecked } = computeToggleAria(\n mode,\n role,\n childValue,\n resolvedValue,\n );\n\n const groupDisabled = disabled === true;\n const childDisabled = childEl.props.disabled === true;\n\n // Click handling — wrap so aria-disabled (group-level) blocks\n // activation, then forward to the child's own onClick.\n const wrappedOnClick: React.MouseEventHandler<HTMLButtonElement> = (\n event,\n ) => {\n // aria-disabled is advisory; the native click still fires. Block\n // it explicitly when the GROUP (not the child) is disabled.\n if (groupDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n // Forward to the child's own handler first so consumers can run\n // analytics / preventDefault.\n childEl.props.onClick?.(event);\n if (event.defaultPrevented) return;\n if (!childValue) return;\n if (mode === 'toggle-single') {\n // Contract: exactly one pressed. Clicking the pressed one is a\n // no-op. This matches Radix ToggleGroup type='single' and the\n // radiogroup pattern.\n if (resolvedValue === childValue) return;\n commitValue(childValue);\n } else if (mode === 'toggle-multi') {\n const list = resolvedValue as string[];\n const next = list.includes(childValue)\n ? list.filter((v) => v !== childValue)\n : [...list, childValue];\n commitValue(next);\n }\n };\n\n // cloneElement's typed overload rejects `ref` as a prop, so we\n // build the override bag as `unknown` and cast to the element's\n // prop type. React at runtime routes `ref` via its usual channel.\n const setMergedRef = (node: HTMLButtonElement | null) => {\n registerIndex(index, node);\n const originalRef = (\n childEl as unknown as { ref?: React.Ref<HTMLButtonElement> }\n ).ref;\n if (typeof originalRef === 'function') originalRef(node);\n else if (\n originalRef !== null &&\n originalRef !== undefined &&\n typeof originalRef === 'object'\n ) {\n (\n originalRef as React.MutableRefObject<HTMLButtonElement | null>\n ).current = node;\n }\n };\n\n // Per the user story: group-level disabled injects `aria-disabled`\n // so the child stays focusable; child-level `disabled` still uses\n // the HTML attribute (child's own contract). When both are true\n // we leave the HTML disabled in place (strictest cue wins).\n const ariaDisabled = groupDisabled && !childDisabled ? true : undefined;\n\n // If the group is disabled OR we are in a toggle mode, we need the\n // wrapped click handler. In pure momentary mode with no group\n // disable, the child's own onClick is passed through unchanged.\n const needsWrappedClick = mode !== 'momentary' || groupDisabled;\n\n const overrides = {\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n disabled: childDisabled,\n 'aria-disabled': ariaDisabled,\n onClick: needsWrappedClick ? wrappedOnClick : childEl.props.onClick,\n 'aria-pressed': ariaPressed,\n 'aria-checked': ariaChecked,\n // When the group is a radiogroup, children must be `role=\"radio\"`\n // so screen readers announce them as radio buttons and so\n // `getByRole('radio')` works in tests. The button element is\n // re-purposed as a radio; `aria-checked` above carries the state.\n role: role === 'radiogroup' ? 'radio' : undefined,\n tabIndex: rovingTabindex ? (index === focusIndex ? 0 : -1) : undefined,\n onFocus: (ev: React.FocusEvent<HTMLButtonElement>) => {\n if (rovingTabindex) setFocusIndex(index);\n childEl.props.onFocus?.(ev);\n },\n ref: setMergedRef,\n } as unknown as Partial<IconButtonProps>;\n\n return cloneElement(childEl, overrides);\n });\n\n const mergedRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref && typeof ref === 'object') {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n if (!overflowEnabled) {\n return (\n <div\n ref={mergedRootRef}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={handleRootKeyDown}\n className={iconButtonGroupVariants({ orientation, className })}\n data-component=\"icon-button-group\"\n {...rest}\n >\n {enhanced}\n </div>\n );\n }\n\n /* ---- Menu path: measurement rows + strip + ellipsis trigger ---- */\n const moreLabel = t('buttonGroup.more', 'More options');\n const groupDisabled = disabled === true;\n const overflowItems = allElements\n .map((childEl, i) => ({ childEl, i }))\n .filter(({ i }) => !visible[i]);\n\n let menuContent: ReactNode = null;\n if (mode === 'toggle-single') {\n menuContent = (\n <DropdownMenu.RadioGroup\n value={resolvedValue as string}\n onValueChange={(v) => {\n if (!groupDisabled && v !== resolvedValue) commitValue(v);\n }}\n >\n {overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.RadioItem\n key={childEl.key ?? i}\n value={childEl.props.value ?? ''}\n disabled={groupDisabled || childEl.props.disabled === true}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.RadioItem>\n ))}\n </DropdownMenu.RadioGroup>\n );\n } else if (mode === 'toggle-multi') {\n menuContent = overflowItems.map(({ childEl, i }) => {\n const v = childEl.props.value;\n const list = resolvedValue as string[];\n const checked = v ? list.includes(v) : false;\n return (\n <DropdownMenu.CheckboxItem\n key={childEl.key ?? i}\n checked={checked}\n disabled={groupDisabled || childEl.props.disabled === true}\n onCheckedChange={() => {\n if (groupDisabled || !v) return;\n commitValue(checked ? list.filter((x) => x !== v) : [...list, v]);\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.CheckboxItem>\n );\n });\n } else {\n menuContent = overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.Item\n key={childEl.key ?? i}\n startIcon={childEl.props.icon}\n disabled={groupDisabled || childEl.props.disabled === true}\n onSelect={(event) => {\n childEl.props.onClick?.(\n event as unknown as React.MouseEvent<HTMLButtonElement>,\n );\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.Item>\n ));\n }\n\n const trigger = overflowing ? (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n ref={(node: HTMLButtonElement | null) => {\n triggerNodeRef.current = node;\n registerIndex(visibleCount, node);\n }}\n tabIndex={\n rovingTabindex\n ? focusIndex === visibleCount\n ? 0\n : -1\n : undefined\n }\n onFocus={\n rovingTabindex ? () => setFocusIndex(visibleCount) : undefined\n }\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">{menuContent}</DropdownMenu.Content>\n </DropdownMenu.Root>\n ) : null;\n\n const stripClasses = iconButtonGroupVariants({ orientation });\n // A radiogroup may own only radios, so its trigger sits beside the strip;\n // toolbar / group keep the trigger inside as the last joined control.\n const triggerInside = role !== 'radiogroup';\n const stripDiv = (\n <div\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={triggerInside ? handleRootKeyDown : undefined}\n className={`${stripClasses} ds:max-w-full`}\n >\n {enhanced}\n {triggerInside ? trigger : null}\n </div>\n );\n\n return (\n <div\n ref={mergedRootRef}\n data-component=\"icon-button-group\"\n className={[\n 'ds:relative ds:block ds:w-full ds:min-w-0 ds:overflow-x-clip',\n className ?? '',\n ]\n .join(' ')\n .trim()}\n {...rest}\n >\n <div ref={containerRef} className=\"ds:block ds:w-full ds:min-w-0\">\n <div\n ref={fullRowRef}\n aria-hidden=\"true\"\n inert\n className={`${MEASURE_ROW_CLASSES} ${stripClasses}`}\n >\n {allElements.map((childEl, i) =>\n cloneElement(childEl, {\n key: childEl.key ?? i,\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n tabIndex: -1,\n ref: null,\n } as Partial<OverflowChildProps>),\n )}\n </div>\n <span\n ref={triggerProbeRef}\n aria-hidden=\"true\"\n inert\n className={MEASURE_ROW_CLASSES}\n >\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n tabIndex={-1}\n />\n </span>\n {triggerInside ? (\n stripDiv\n ) : (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- non-focusable wrapper; arrow-key roving bubbles up from the focusable IconButtons in the strip and the overflow trigger\n <div\n className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\"\n onKeyDown={handleRootKeyDown}\n >\n {stripDiv}\n {trigger}\n </div>\n )}\n </div>\n </div>\n );\n },\n);\n\nIconButtonGroup.displayName = 'IconButtonGroup';\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction computeToggleAria(\n mode: IconButtonGroupMode,\n role: IconButtonGroupRole,\n childValue: string | undefined,\n resolvedValue: string | string[],\n): { ariaPressed?: boolean; ariaChecked?: boolean } {\n if (mode === 'momentary' || !childValue) return {};\n\n const isActive =\n mode === 'toggle-multi'\n ? (resolvedValue as string[]).includes(childValue)\n : resolvedValue === childValue;\n\n // radiogroup uses aria-checked; toolbar/group use aria-pressed.\n if (role === 'radiogroup') {\n return { ariaChecked: isActive };\n }\n return { ariaPressed: isActive };\n}\n"],"names":["iconButtonGroupVariants","cva","MEASURE_ROW_CLASSES","IconButtonGroup","forwardRef","props","ref","size","orientation","role","mode","disabled","intent","overflow","className","children","ariaLabel","ariaLabelledBy","_value","_defaultValue","_onValueChange","rest","t","useTranslation","overflowEnabled","internalValue","setInternalValue","useState","resolvedValue","p","commitValue","useCallback","next","_a","_b","rovingTabindex","buttonsRef","useRef","focusIndex","setFocusIndex","registerIndex","index","el","rootRef","isRTL","setIsRTL","useIsomorphicLayoutEffect","node","dir","handleRootKeyDown","event","count","forwardKey","backwardKey","maxAttempts","attempts","candidate","child","childArrayRef","cValue","allElements","Children","isValidElement","mirrorLabel","aria","pinnedFlags","explicit","mirrorable","containerRef","fullRowRef","triggerProbeRef","visible","overflowing","usePriorityOverflow","triggerNodeRef","childArray","_","i","checkedIndex","useEffect","visibleCount","total","enhanced","childEl","childValue","ariaPressed","ariaChecked","computeToggleAria","groupDisabled","childDisabled","wrappedOnClick","list","v","setMergedRef","originalRef","ariaDisabled","needsWrappedClick","overrides","ev","cloneElement","mergedRootRef","jsx","moreLabel","overflowItems","menuContent","DropdownMenu","checked","x","trigger","jsxs","IconButton","Ellipsis","stripClasses","triggerInside","stripDiv","isActive"],"mappings":";;;;;;;;;AAsCA,MAAMA,KAA0BC;AAAA,EAC9B;AAAA,IACE;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,YAAY;AAAA,UACV;AAAA;AAAA;AAAA,UAGA;AAAA,UACA;AAAA;AAAA,UAEA;AAAA,UACA;AAAA;AAAA;AAAA;AAAA,UAIA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,UAAU;AAAA,UACR;AAAA;AAAA;AAAA;AAAA,UAIA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,MAAA;AAAA,IACZ;AAAA,IAEF,iBAAiB;AAAA,MACf,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAIMC,KACJ,uEAqFWC,KAAkBC;AAAA,EAC7B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,MAAAC;AAAA,MACA,aAAAC,IAAc;AAAA,MACd,MAAAC,IAAO;AA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