@burdenoff/fe-libs 2026.1115.3 → 2026.1115.5

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.
@@ -114,6 +114,13 @@ export interface I18nProviderProps {
114
114
  * before it. 0 (the default) never holds.
115
115
  */
116
116
  firstPaintHoldMs?: number;
117
+ /**
118
+ * For a non-English locale with `persistence` and NO cached dictionary (a first visit or an
119
+ * evicted cache), keep holding the first paint until the downloaded dictionary arrives, capped
120
+ * at this long, then fall back to English (BOFF-9536). 0 (the default) releases the hold as
121
+ * soon as the cache turns out empty, so English shows until the download lands.
122
+ */
123
+ coldCacheHoldMs?: number;
117
124
  /** Text direction handling. Default `off`: the document stays LTR. */
118
125
  directionMode?: DirectionMode;
119
126
  /**
@@ -127,6 +134,14 @@ export interface I18nProviderProps {
127
134
  */
128
135
  loadingComponent?: ReactNode;
129
136
  }
137
+ /** The global localStorage key for the chosen locale, used when no `storageKey` is passed. */
138
+ export declare const DEFAULT_LOCALE_STORAGE_KEY = "burdenoff-locale";
139
+ /**
140
+ * Read the best locale: profile-scoped first, then global key, then default.
141
+ * Exported so the bridge can name its loading state in the stored locale
142
+ * before the provider has mounted (BOFF-9536).
143
+ */
144
+ export declare function resolveInitialLocale(profileId: string | null | undefined, storageKey: string, defaultLocale: Locale): Locale;
130
145
  /**
131
146
  * Deep merge translation dictionaries.
132
147
  *
@@ -139,7 +154,7 @@ export interface I18nProviderProps {
139
154
  export declare function mergeTranslationDictionaries(base: TranslationDictionary | undefined, override: TranslationDictionary | undefined): TranslationDictionary;
140
155
  /** Whether `code`'s locale is `loading` in a status map (primary-tag match). */
141
156
  export declare function isLocaleLoadingIn(status: Readonly<Partial<Record<Locale, LocaleLoadStatus>>>, code: string): boolean;
142
- export declare function I18nProvider({ children, defaultLocale, translations: staticTranslations, storageKey, profileId, fetchTranslations, loadTranslations, cacheScope, persistence, firstPaintHoldMs, directionMode, showChildrenWhileLoading, loadingComponent, }: I18nProviderProps): import('react').JSX.Element;
157
+ export declare function I18nProvider({ children, defaultLocale, translations: staticTranslations, storageKey, profileId, fetchTranslations, loadTranslations, cacheScope, persistence, firstPaintHoldMs, coldCacheHoldMs, directionMode, showChildrenWhileLoading, loadingComponent, }: I18nProviderProps): import('react').JSX.Element;
143
158
  export declare function useI18n(): I18nContextValue;
144
159
  /**
145
160
  * The i18n context, or null outside an `I18nProvider`.
@@ -46,7 +46,8 @@ function v(e, t) {
46
46
  function y(e) {
47
47
  return !!e && Object.keys(e).length > 0;
48
48
  }
49
- function b(e, t, n) {
49
+ var b = "burdenoff-locale";
50
+ function x(e, t, n) {
50
51
  if (typeof window > "u") return n;
51
52
  if (e) {
52
53
  let t = localStorage.getItem(`bf-p-${e}-locale`);
@@ -54,140 +55,141 @@ function b(e, t, n) {
54
55
  }
55
56
  return localStorage.getItem(t) || n;
56
57
  }
57
- function x(e) {
58
+ function S(e) {
58
59
  return typeof e == "object" && !!e;
59
60
  }
60
- function S(e, t) {
61
+ function C(e, t) {
61
62
  if (!e && !t) return {};
62
63
  if (!e) return { ...t ?? {} };
63
64
  if (!t) return { ...e };
64
65
  let n = { ...e };
65
66
  for (let [e, r] of Object.entries(t)) {
66
67
  let t = n[e];
67
- n[e] = typeof r == "string" ? r : S(x(t) ? t : void 0, r);
68
+ n[e] = typeof r == "string" ? r : C(S(t) ? t : void 0, r);
68
69
  }
69
70
  return n;
70
71
  }
71
- function C(e, t) {
72
+ function w(e, t) {
72
73
  let n = p(t);
73
74
  return Object.entries(e).some(([e, t]) => t === "loading" && p(e) === n);
74
75
  }
75
- function w({ children: r, defaultLocale: i = "en", translations: f = ee, storageKey: m = "burdenoff-locale", profileId: x, fetchTranslations: w, loadTranslations: T, cacheScope: E = "", persistence: D = null, firstPaintHoldMs: O = 0, directionMode: k = "off", showChildrenWhileLoading: A = !0, loadingComponent: j }) {
76
- let [M, N] = l(() => b(x, m, i)), P = s(() => {
77
- if (T) return T;
78
- if (w) return async (e) => {
79
- let t = await w(e);
76
+ function T({ children: r, defaultLocale: i = "en", translations: f = ee, storageKey: m = b, profileId: S, fetchTranslations: T, loadTranslations: E, cacheScope: D = "", persistence: O = null, firstPaintHoldMs: k = 0, coldCacheHoldMs: A = 0, directionMode: j = "off", showChildrenWhileLoading: te = !0, loadingComponent: M }) {
77
+ let [N, P] = l(() => x(S, m, i)), F = s(() => {
78
+ if (E) return E;
79
+ if (T) return async (e) => {
80
+ let t = await T(e);
80
81
  return {
81
82
  translations: t ?? {},
82
83
  complete: y(t)
83
84
  };
84
85
  };
85
- }, [T, w]), [F, I] = l(() => {
86
- let e = _.translations.get(v(E, M));
87
- return e ? { [M]: e.translations } : {};
88
- }), [L, te] = l(() => {
89
- if (!P) return {};
90
- let e = _.translations.has(v(E, M));
91
- return { [M]: e ? "ready" : "loading" };
92
- }), [R, z] = l(null), [B, V] = l(() => typeof window < "u" && !!P && !!D && O > 0 && p(M) !== "en" && !_.translations.has(v(E, M)));
86
+ }, [E, T]), [I, ne] = l(() => {
87
+ let e = _.translations.get(v(D, N));
88
+ return e ? { [N]: e.translations } : {};
89
+ }), [L, re] = l(() => {
90
+ if (!F) return {};
91
+ let e = _.translations.has(v(D, N));
92
+ return { [N]: e ? "ready" : "loading" };
93
+ }), [ie, R] = l(null), z = Math.max(k, A), [B, V] = l(() => typeof window < "u" && !!F && !!O && z > 0 && p(N) !== "en" && !_.translations.has(v(D, N)));
93
94
  o(() => {
94
95
  if (!B) return;
95
- let e = setTimeout(() => V(!1), O);
96
+ let e = setTimeout(() => V(!1), z);
96
97
  return () => clearTimeout(e);
97
- }, [B, O]);
98
+ }, [B, z]);
98
99
  let H = c(/* @__PURE__ */ new Map()), U = c(/* @__PURE__ */ new Set()), W = c(_.version), G = a((e, t) => {
99
- te((n) => n[e] === t ? n : {
100
+ re((n) => n[e] === t ? n : {
100
101
  ...n,
101
102
  [e]: t
102
103
  });
103
104
  }, []), K = a((e, t, n) => {
104
- H.current.set(e, n), I((n) => n[e] === t ? n : {
105
+ H.current.set(e, n), ne((n) => n[e] === t ? n : {
105
106
  ...n,
106
107
  [e]: t
107
108
  });
108
109
  }, []), q = s(() => {
109
110
  let e = { ...f };
110
- for (let [t, n] of Object.entries(F)) if (n && Object.keys(n).length > 0) {
111
+ for (let [t, n] of Object.entries(I)) if (n && Object.keys(n).length > 0) {
111
112
  let r = t;
112
- e[r] = S(f[r], n);
113
+ e[r] = C(f[r], n);
113
114
  }
114
115
  return e;
115
- }, [f, F]), J = a(async (e) => {
116
- if (!P) return;
116
+ }, [f, I]), J = a(async (e) => {
117
+ if (!F) return;
117
118
  W.current !== _.version && (U.current.clear(), H.current.clear(), W.current = _.version);
118
- let t = v(E, e), r = _.translations.get(t);
119
+ let t = v(D, e), r = _.translations.get(t);
119
120
  if (r) {
120
121
  H.current.get(e) !== r.hash && K(e, r.translations, r.hash), G(e, "ready"), V(!1);
121
122
  return;
122
123
  }
123
124
  if (U.current.has(t)) return;
124
- U.current.add(t), G(e, "loading"), z(null);
125
- let i = !1, a = !1, o = !1, s = D ? D.read(E, e).catch(() => null) : Promise.resolve(null);
125
+ U.current.add(t), G(e, "loading"), R(null);
126
+ let i = !1, a = !1, o = !1, s = O ? O.read(D, e).catch(() => null) : Promise.resolve(null);
126
127
  s.then((t) => {
127
- i || !t || !y(t.translations) || (o = !0, K(e, t.translations, t.hash), a && G(e, "ready")), V(!1);
128
+ i || !t || !y(t.translations) ? (i || a || A <= 0) && V(!1) : (o = !0, K(e, t.translations, t.hash), a && G(e, "ready"), V(!1));
128
129
  });
129
130
  try {
130
- let r = await P(e);
131
+ let r = await F(e);
131
132
  if (a = !0, r.complete && y(r.translations) || await s, r.complete && y(r.translations)) {
132
133
  let a = n(r.translations);
133
134
  if (_.attempted.add(t), _.translations.set(t, {
134
135
  translations: r.translations,
135
136
  hash: a
136
- }), i = !0, H.current.get(e) !== a && K(e, r.translations, a), G(e, "ready"), D) {
137
+ }), i = !0, H.current.get(e) !== a && K(e, r.translations, a), G(e, "ready"), O) {
137
138
  let t = await s;
138
- t && t.hash === a || D.write(E, e, {
139
+ t && t.hash === a || O.write(D, e, {
139
140
  translations: r.translations,
140
141
  hash: a
141
142
  });
142
143
  }
143
144
  } else o ? G(e, "ready") : y(r.translations) ? (K(e, r.translations, n(r.translations)), G(e, "ready")) : G(e, "failed");
144
145
  } catch (t) {
145
- a = !0, console.error(`[I18nProvider] Failed to fetch translations for ${e}:`, t), z(t instanceof Error ? t.message : "Failed to fetch translations"), await s, G(e, o ? "ready" : "failed");
146
+ a = !0, console.error(`[I18nProvider] Failed to fetch translations for ${e}:`, t), R(t instanceof Error ? t.message : "Failed to fetch translations"), await s, G(e, o ? "ready" : "failed");
146
147
  } finally {
147
148
  U.current.delete(t), V(!1);
148
149
  }
149
150
  }, [
150
151
  K,
151
- E,
152
- P,
152
+ D,
153
+ A,
154
+ F,
153
155
  G,
154
- D
156
+ O
155
157
  ]);
156
158
  o(() => {
157
- P && J(M);
159
+ F && J(N);
158
160
  }, [
159
- P,
160
- M,
161
+ F,
162
+ N,
161
163
  J
162
164
  ]), o(() => {
163
- let e = b(x, m, i);
164
- N(e), document.documentElement.setAttribute("lang", e);
165
+ let e = x(S, m, i);
166
+ P(e), document.documentElement.setAttribute("lang", e);
165
167
  }, [
166
- x,
168
+ S,
167
169
  m,
168
170
  i
169
171
  ]);
170
172
  let Y = a((e) => {
171
- if (N(e), P) {
172
- let t = _.translations.get(v(E, e));
173
+ if (P(e), F) {
174
+ let t = _.translations.get(v(D, e));
173
175
  t ? (H.current.get(e) !== t.hash && K(e, t.translations, t.hash), G(e, "ready")) : G(e, "loading");
174
176
  }
175
- localStorage.setItem(m, e), x && localStorage.setItem(`bf-p-${x}-locale`, e), document.documentElement.setAttribute("lang", e);
177
+ localStorage.setItem(m, e), S && localStorage.setItem(`bf-p-${S}-locale`, e), document.documentElement.setAttribute("lang", e);
176
178
  }, [
177
179
  K,
178
- E,
179
- P,
180
+ D,
181
+ F,
180
182
  G,
181
183
  m,
182
- x
183
- ]), X = h(k, M);
184
+ S
185
+ ]), X = h(j, N);
184
186
  o(() => {
185
- if (k === "off" || typeof document > "u") return;
187
+ if (j === "off" || typeof document > "u") return;
186
188
  let e = document.documentElement, t = e.getAttribute("dir");
187
189
  return e.setAttribute("dir", X), () => {
188
190
  t === null ? e.removeAttribute("dir") : e.setAttribute("dir", t);
189
191
  };
190
- }, [k, X]);
192
+ }, [j, X]);
191
193
  let Z = a((n, r, a) => {
192
194
  let o, s;
193
195
  if (typeof r == "string") o = r, s = a;
@@ -195,50 +197,50 @@ function w({ children: r, defaultLocale: i = "en", translations: f = ee, storage
195
197
  let { defaultValue: e, ...t } = r;
196
198
  typeof e == "string" ? o = e : typeof e == "number" && (o = String(e)), s = t;
197
199
  }
198
- let c = t(q[M], n) ?? (M === i ? void 0 : t(q[i], n)) ?? (i === "en" ? void 0 : t(q.en, n)) ?? o ?? n;
200
+ let c = t(q[N], n) ?? (N === i ? void 0 : t(q[i], n)) ?? (i === "en" ? void 0 : t(q.en, n)) ?? o ?? n;
199
201
  return s ? e(c, s) : c;
200
202
  }, [
201
- M,
203
+ N,
202
204
  q,
203
205
  i
204
- ]), Q = Object.values(L).includes("loading"), $ = a((e) => C(L, e), [L]), ne = s(() => ({
205
- locale: M,
206
- translations: q[M] || {},
206
+ ]), Q = Object.values(L).includes("loading"), $ = a((e) => w(L, e), [L]), ae = s(() => ({
207
+ locale: N,
208
+ translations: q[N] || {},
207
209
  setLocale: Y,
208
210
  t: Z,
209
211
  isLoading: Q,
210
- error: R,
212
+ error: ie,
211
213
  localeStatus: L,
212
214
  isLocaleLoading: $,
213
215
  dir: X
214
216
  }), [
215
- M,
217
+ N,
216
218
  q,
217
219
  Y,
218
220
  Z,
219
221
  Q,
220
- R,
222
+ ie,
221
223
  L,
222
224
  $,
223
225
  X
224
226
  ]);
225
- return B ? /* @__PURE__ */ d(u, { children: j ?? null }) : $(M) && !A && j && !y(F[M]) ? /* @__PURE__ */ d(u, { children: j }) : /* @__PURE__ */ d(g.Provider, {
226
- value: ne,
227
+ return B ? /* @__PURE__ */ d(u, { children: M ?? null }) : $(N) && !te && M && !y(I[N]) ? /* @__PURE__ */ d(u, { children: M }) : /* @__PURE__ */ d(g.Provider, {
228
+ value: ae,
227
229
  children: r
228
230
  });
229
231
  }
230
- function T() {
232
+ function E() {
231
233
  let e = i(g);
232
234
  if (!e) throw Error("useI18n must be used within an I18nProvider");
233
235
  return e;
234
236
  }
235
- function E() {
237
+ function D() {
236
238
  return i(g);
237
239
  }
238
- function D() {
240
+ function O() {
239
241
  _.clear();
240
242
  }
241
- function O(e, t = "") {
243
+ function k(e, t = "") {
242
244
  return _.attempted.has(v(t, e));
243
245
  }
244
- export { w as I18nProvider, f as LOCALE_DIRECTION, D as clearTranslationCache, h as directionFor, C as isLocaleLoadingIn, O as isTranslationAttempted, m as localeDirection, S as mergeTranslationDictionaries, T as useI18n, E as useOptionalI18n };
246
+ export { b as DEFAULT_LOCALE_STORAGE_KEY, T as I18nProvider, f as LOCALE_DIRECTION, O as clearTranslationCache, h as directionFor, w as isLocaleLoadingIn, k as isTranslationAttempted, m as localeDirection, C as mergeTranslationDictionaries, x as resolveInitialLocale, E as useI18n, D as useOptionalI18n };
@@ -2,6 +2,13 @@ import { ReactNode } from 'react';
2
2
  import { DirectionMode, Locale, TranslationDictionary } from './I18nProvider';
3
3
  /** How long a returning non-English visitor's first paint waits for the cached dictionary. */
4
4
  export declare const FIRST_PAINT_HOLD_MS = 150;
5
+ /**
6
+ * How long a non-English visitor with NO cached dictionary (first visit, evicted cache) is held
7
+ * on the splash while the dictionary downloads, before falling back to English (BOFF-9536,
8
+ * decision (a): cap about 2 s).
9
+ */
10
+ export declare const COLD_CACHE_HOLD_MS = 2000;
11
+ export declare function dictionaryLoadingLabel(locale: string): string;
5
12
  export interface ProfileI18nBridgeProps {
6
13
  children: ReactNode;
7
14
  /** Product ID for translations in the i18n service (created during DB seeding) */
@@ -1,19 +1,34 @@
1
1
  import { useAuth as e } from "./AuthProvider.js";
2
- import { I18nProvider as t, useI18n as n } from "./I18nProvider.js";
3
- import { graphqlFetch as r } from "../../graphql/fetch.js";
4
- import { DEFAULT_PLATFORM_I18N_PRODUCT_ID as i, createLayeredTranslationLoader as a, effectivePlatformId as o, translationCacheScope as s } from "./translationLayers.js";
5
- import { getDefaultTranslationPersistence as c } from "./translationStore.js";
2
+ import { DEFAULT_LOCALE_STORAGE_KEY as t, I18nProvider as n, resolveInitialLocale as r, useI18n as i } from "./I18nProvider.js";
3
+ import { graphqlFetch as a } from "../../graphql/fetch.js";
4
+ import { DEFAULT_PLATFORM_I18N_PRODUCT_ID as o, createLayeredTranslationLoader as s, effectivePlatformId as c, translationCacheScope as l } from "./translationLayers.js";
5
+ import { getDefaultTranslationPersistence as u } from "./translationStore.js";
6
6
  import "../../../shared-graphql.js";
7
- import { useCallback as l, useMemo as u } from "react";
8
- import { jsx as d } from "react/jsx-runtime";
9
- import { DirectionProvider as f } from "@radix-ui/react-direction";
7
+ import { BrandedSplash as d } from "../../../ui/branded-splash.js";
8
+ import { useCallback as f, useMemo as p } from "react";
9
+ import { jsx as m } from "react/jsx-runtime";
10
+ import { DirectionProvider as h } from "@radix-ui/react-direction";
10
11
  // src/shared/providers/shell/ProfileI18nBridge.tsx
11
- var p = "\n query ExportTranslations($productId: String!, $languageCode: String!, $format: ImportJobFormat!) {\n exportTranslations(productId: $productId, languageCode: $languageCode, format: $format) {\n format\n url\n }\n }\n";
12
- async function m(e, t) {
13
- let n = await r({
12
+ var g = "\n query ExportTranslations($productId: String!, $languageCode: String!, $format: ImportJobFormat!) {\n exportTranslations(productId: $productId, languageCode: $languageCode, format: $format) {\n format\n url\n }\n }\n", _ = 2e3, v = {
13
+ en: "Loading…",
14
+ es: "Cargando…",
15
+ fr: "Chargement…",
16
+ de: "Wird geladen…",
17
+ ja: "読み込み中…",
18
+ zh: "加载中…",
19
+ ta: "ஏற்றுகிறது…",
20
+ hi: "लोड हो रहा है…",
21
+ ar: "جارٍ التحميل…"
22
+ };
23
+ function y(e) {
24
+ return v[e.toLowerCase().split(/[-_]/)[0] ?? "en"] ?? v.en;
25
+ }
26
+ async function b(e, t) {
27
+ let n = await a({
14
28
  gateway: "global",
15
- query: p,
29
+ query: g,
16
30
  operationName: "ExportTranslations",
31
+ batch: !1,
17
32
  variables: {
18
33
  productId: e,
19
34
  languageCode: t,
@@ -25,27 +40,27 @@ async function m(e, t) {
25
40
  }
26
41
  });
27
42
  if (n.errors?.length || !n.data?.exportTranslations?.url) return null;
28
- let i = n.data.exportTranslations.url, a = decodeURIComponent(i.replace("data:application/json;charset=utf-8,", ""));
29
- return JSON.parse(a);
43
+ let r = n.data.exportTranslations.url, i = decodeURIComponent(r.replace("data:application/json;charset=utf-8,", ""));
44
+ return JSON.parse(i);
30
45
  }
31
- function h({ children: e }) {
32
- let { dir: t } = n();
33
- return /* @__PURE__ */ d(f, {
46
+ function x({ children: e }) {
47
+ let { dir: t } = i();
48
+ return /* @__PURE__ */ m(h, {
34
49
  dir: t,
35
50
  children: e
36
51
  });
37
52
  }
38
- function g({ children: n, i18nProductId: r, platformI18nProductId: f = i, defaultLocale: p = "en", fallbackTranslations: g, disableDynamicFetch: _ = !1, persistTranslations: v = !0, directionMode: y = "off" }) {
39
- let { user: b } = e(), x = b?.id ?? null, S = !_, C = o(r, f), w = l((e) => g?.[e] ?? {}, [g]), T = u(() => a({
40
- productId: r,
41
- platformId: C,
42
- fallback: w,
43
- fetchDictionary: m
53
+ function S({ children: i, i18nProductId: a, platformI18nProductId: h = o, defaultLocale: g = "en", fallbackTranslations: v, disableDynamicFetch: S = !1, persistTranslations: C = !0, directionMode: w = "off" }) {
54
+ let { user: T } = e(), E = T?.id ?? null, D = !S, O = c(a, h), k = f((e) => v?.[e] ?? {}, [v]), A = p(() => s({
55
+ productId: a,
56
+ platformId: O,
57
+ fallback: k,
58
+ fetchDictionary: b
44
59
  }), [
45
- w,
46
- r,
47
- C
48
- ]), E = u(() => S && v ? c() : null, [v, S]), D = u(() => g ?? {
60
+ k,
61
+ a,
62
+ O
63
+ ]), j = p(() => D && C ? u() : null, [C, D]), M = p(() => /* @__PURE__ */ m(d, { label: y(r(E, t, g)) }), [g, E]), N = p(() => v ?? {
49
64
  en: {},
50
65
  es: {},
51
66
  fr: {},
@@ -55,18 +70,20 @@ function g({ children: n, i18nProductId: r, platformI18nProductId: f = i, defaul
55
70
  ta: {},
56
71
  hi: {},
57
72
  ar: {}
58
- }, [g]);
59
- return /* @__PURE__ */ d(t, {
60
- defaultLocale: p,
61
- translations: D,
62
- loadTranslations: S ? T : void 0,
63
- cacheScope: s(r, C),
64
- persistence: E,
65
- firstPaintHoldMs: E ? 150 : 0,
66
- directionMode: y,
67
- profileId: x,
73
+ }, [v]);
74
+ return /* @__PURE__ */ m(n, {
75
+ defaultLocale: g,
76
+ translations: N,
77
+ loadTranslations: D ? A : void 0,
78
+ cacheScope: l(a, O),
79
+ persistence: j,
80
+ firstPaintHoldMs: j ? 150 : 0,
81
+ coldCacheHoldMs: j ? _ : 0,
82
+ loadingComponent: M,
83
+ directionMode: w,
84
+ profileId: E,
68
85
  showChildrenWhileLoading: !0,
69
- children: /* @__PURE__ */ d(h, { children: n })
86
+ children: /* @__PURE__ */ m(x, { children: i })
70
87
  });
71
88
  }
72
- export { g as ProfileI18nBridge };
89
+ export { _ as COLD_CACHE_HOLD_MS, S as ProfileI18nBridge, y as dictionaryLoadingLabel };
@@ -5,6 +5,11 @@ export type CTAAction = {
5
5
  intent?: 'default' | 'destructive';
6
6
  icon?: ReactNode;
7
7
  disabled?: boolean;
8
+ /**
9
+ * Why the action is disabled, for example "You don't have permission to create tags."
10
+ * Shown under the item's label while `disabled` is true (BOFF-10611). Pass translated text.
11
+ */
12
+ disabledReason?: string;
8
13
  /** Optional product-tour anchor, since collapsed menu items render no DOM node to target otherwise. */
9
14
  dataTour?: string;
10
15
  };
@@ -12,6 +17,12 @@ export type CTAPrimaryAction = {
12
17
  label: string;
13
18
  onSelect: () => void;
14
19
  disabled?: boolean;
20
+ /**
21
+ * Why the action is disabled, for example "You don't have permission to create tags."
22
+ * While `disabled` is true it shows in a tooltip on hover and keyboard focus, and is the
23
+ * button's accessible description (BOFF-10611). Pass translated text.
24
+ */
25
+ disabledReason?: string;
15
26
  icon?: ReactNode;
16
27
  };
17
28
  export type CTAOverflowMenuProps = {
@@ -24,6 +35,14 @@ export type CTAOverflowMenuProps = {
24
35
  /** Optional className for the wrapping flex row. */
25
36
  className?: string;
26
37
  };
38
+ /**
39
+ * An overflow item's label. While the item is disabled and has a reason, the reason sits under
40
+ * the label in muted text, so a menu item explains itself without a hover (BOFF-10611).
41
+ * Exported for tests only; not part of the package's public `ui` entry.
42
+ */
43
+ export declare function CTAActionLabel({ action, }: {
44
+ action: Pick<CTAAction, 'label' | 'disabled' | 'disabledReason'>;
45
+ }): import('react').JSX.Element;
27
46
  /**
28
47
  * CTAOverflowMenu — Boff UI 2.0 action-group primitive that enforces the
29
48
  * "one primary CTA, everything else in a menu" rule. The primary action is a
@@ -2,39 +2,74 @@ import { cn as e } from "../shared-utils.js";
2
2
  import { useShellLabel as t } from "../shared/providers/shell/useShellLabel.js";
3
3
  import { Button as n } from "./button.js";
4
4
  import { DropdownMenu as r, DropdownMenuContent as i, DropdownMenuItem as a, DropdownMenuTrigger as o } from "./dropdown-menu.js";
5
- import { MoreHorizontal as s } from "lucide-react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
+ import { Tooltip as s, TooltipContent as c, TooltipTrigger as l } from "./tooltip.js";
6
+ import { useId as u } from "react";
7
+ import { MoreHorizontal as d } from "lucide-react";
8
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
9
  // src/ui/cta-overflow-menu.tsx
8
- function u({ primary: u, actions: d, align: f = "end", className: p }) {
9
- let m = t();
10
- return /* @__PURE__ */ l("div", {
11
- className: e("flex items-center gap-2", p),
12
- children: [u ? /* @__PURE__ */ l(n, {
13
- type: "button",
14
- variant: "default",
15
- onClick: u.onSelect,
16
- disabled: u.disabled,
17
- children: [u.icon, u.label]
18
- }) : null, d.length > 0 ? /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(o, {
10
+ function h({ primary: e }) {
11
+ let t = u(), r = e.disabled ? e.disabledReason?.trim() : void 0, i = /* @__PURE__ */ m(n, {
12
+ type: "button",
13
+ variant: "default",
14
+ onClick: e.onSelect,
15
+ disabled: e.disabled,
16
+ "aria-describedby": r ? t : void 0,
17
+ children: [e.icon, e.label]
18
+ });
19
+ return r ? /* @__PURE__ */ m(s, { children: [
20
+ /* @__PURE__ */ p(l, {
21
+ asChild: !0,
22
+ children: /* @__PURE__ */ p("span", {
23
+ "data-slot": "cta-primary-disabled",
24
+ tabIndex: 0,
25
+ "aria-describedby": t,
26
+ className: "inline-flex cursor-not-allowed rounded-button focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus)] focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]",
27
+ children: i
28
+ })
29
+ }),
30
+ /* @__PURE__ */ p(c, { children: r }),
31
+ /* @__PURE__ */ p("span", {
32
+ id: t,
33
+ className: "sr-only",
34
+ children: r
35
+ })
36
+ ] }) : i;
37
+ }
38
+ function g({ action: e }) {
39
+ let t = e.disabled ? e.disabledReason?.trim() : void 0;
40
+ return t ? /* @__PURE__ */ m("span", {
41
+ className: "flex flex-col",
42
+ children: [/* @__PURE__ */ p("span", { children: e.label }), /* @__PURE__ */ p("span", {
43
+ "data-slot": "cta-action-disabled-reason",
44
+ className: "text-xs text-text-muted",
45
+ children: t
46
+ })]
47
+ }) : /* @__PURE__ */ p(f, { children: e.label });
48
+ }
49
+ function _({ primary: s, actions: c, align: l = "end", className: u }) {
50
+ let f = t();
51
+ return /* @__PURE__ */ m("div", {
52
+ className: e("flex items-center gap-2", u),
53
+ children: [s ? /* @__PURE__ */ p(h, { primary: s }) : null, c.length > 0 ? /* @__PURE__ */ m(r, { children: [/* @__PURE__ */ p(o, {
19
54
  asChild: !0,
20
- children: /* @__PURE__ */ c(n, {
55
+ children: /* @__PURE__ */ p(n, {
21
56
  type: "button",
22
57
  variant: "outline",
23
58
  size: "icon",
24
- "aria-label": m("common.moreActions", "More actions"),
25
- children: /* @__PURE__ */ c(s, {})
59
+ "aria-label": f("common.moreActions", "More actions"),
60
+ children: /* @__PURE__ */ p(d, {})
26
61
  })
27
- }), /* @__PURE__ */ c(i, {
28
- align: f,
29
- children: d.map((t, n) => /* @__PURE__ */ l(a, {
62
+ }), /* @__PURE__ */ p(i, {
63
+ align: l,
64
+ children: c.map((t, n) => /* @__PURE__ */ m(a, {
30
65
  "data-tour": t.dataTour,
31
66
  disabled: t.disabled,
32
67
  onSelect: t.onSelect,
33
68
  className: e("gap-2", t.intent === "destructive" && "text-status-error-text focus:text-status-error-text focus:bg-status-error-bg-subtle"),
34
- children: [t.icon, t.label]
69
+ children: [t.icon, /* @__PURE__ */ p(g, { action: t })]
35
70
  }, `${t.label}-${n}`))
36
71
  })] }) : null]
37
72
  });
38
73
  }
39
- u.displayName = "CTAOverflowMenu";
40
- export { u as CTAOverflowMenu };
74
+ _.displayName = "CTAOverflowMenu";
75
+ export { g as CTAActionLabel, _ as CTAOverflowMenu };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1115.3",
3
+ "version": "2026.1115.5",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "repository": {
6
6
  "type": "git",