@burdenoff/fe-libs 2026.1115.3 → 2026.1115.4
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.
|
@@ -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 {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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__ */
|
|
55
|
+
children: /* @__PURE__ */ p(n, {
|
|
21
56
|
type: "button",
|
|
22
57
|
variant: "outline",
|
|
23
58
|
size: "icon",
|
|
24
|
-
"aria-label":
|
|
25
|
-
children: /* @__PURE__ */
|
|
59
|
+
"aria-label": f("common.moreActions", "More actions"),
|
|
60
|
+
children: /* @__PURE__ */ p(d, {})
|
|
26
61
|
})
|
|
27
|
-
}), /* @__PURE__ */
|
|
28
|
-
align:
|
|
29
|
-
children:
|
|
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
|
|
69
|
+
children: [t.icon, /* @__PURE__ */ p(g, { action: t })]
|
|
35
70
|
}, `${t.label}-${n}`))
|
|
36
71
|
})] }) : null]
|
|
37
72
|
});
|
|
38
73
|
}
|
|
39
|
-
|
|
40
|
-
export {
|
|
74
|
+
_.displayName = "CTAOverflowMenu";
|
|
75
|
+
export { g as CTAActionLabel, _ as CTAOverflowMenu };
|