jenosize-ui 0.1.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.
- package/LICENSE +28 -0
- package/README.md +100 -0
- package/THIRD-PARTY-NOTICES.md +163 -0
- package/dist/Button-Bt7pzM4R.d.ts +82 -0
- package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
- package/dist/Select-CVbEQ2Ep.d.ts +118 -0
- package/dist/TagInput-CTJYOB4J.d.ts +90 -0
- package/dist/avatar.d.ts +161 -0
- package/dist/avatar.js +11 -0
- package/dist/badge.d.ts +109 -0
- package/dist/badge.js +10 -0
- package/dist/breadcrumb.d.ts +58 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +14 -0
- package/dist/calendar.d.ts +368 -0
- package/dist/calendar.js +21 -0
- package/dist/callout.d.ts +70 -0
- package/dist/callout.js +16 -0
- package/dist/card-nWicloNi.d.ts +80 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +133 -0
- package/dist/checkbox.js +11 -0
- package/dist/chunk-24TO7E32.js +42 -0
- package/dist/chunk-3Y5X7B5C.js +146 -0
- package/dist/chunk-4OLULPQG.js +202 -0
- package/dist/chunk-4P2NBLBW.js +103 -0
- package/dist/chunk-52IFGFTL.js +11 -0
- package/dist/chunk-5FATN5YD.js +115 -0
- package/dist/chunk-5NOBSXJN.js +297 -0
- package/dist/chunk-5RAPA22E.js +106 -0
- package/dist/chunk-7EUAMHMU.js +16 -0
- package/dist/chunk-7EWQKTNQ.js +1336 -0
- package/dist/chunk-7HOIZ3UO.js +110 -0
- package/dist/chunk-7IU5TMFL.js +452 -0
- package/dist/chunk-7JBNLEJ7.js +29 -0
- package/dist/chunk-7S2TBALK.js +23 -0
- package/dist/chunk-BJUZVYQC.js +188 -0
- package/dist/chunk-BVJWBYIG.js +66 -0
- package/dist/chunk-CME4DIML.js +65 -0
- package/dist/chunk-CYPPEUX5.js +73 -0
- package/dist/chunk-D5BTFSL7.js +71 -0
- package/dist/chunk-D6TPWNRK.js +387 -0
- package/dist/chunk-DJSXIAFH.js +66 -0
- package/dist/chunk-DRZCJCBO.js +46 -0
- package/dist/chunk-DWKILXHE.js +17 -0
- package/dist/chunk-E7ZSWBAK.js +70 -0
- package/dist/chunk-EDSK6FEH.js +8 -0
- package/dist/chunk-F2K7VJUV.js +114 -0
- package/dist/chunk-F6NLE6XJ.js +40 -0
- package/dist/chunk-FHHAPGCR.js +32 -0
- package/dist/chunk-FXIBGTS5.js +14 -0
- package/dist/chunk-GCVA3OIV.js +72 -0
- package/dist/chunk-GFOAJVW5.js +336 -0
- package/dist/chunk-GRLSUQQE.js +136 -0
- package/dist/chunk-GTHJWR3Q.js +77 -0
- package/dist/chunk-HMUZE6EK.js +67 -0
- package/dist/chunk-I7WU4GTY.js +503 -0
- package/dist/chunk-J2BCKBHC.js +151 -0
- package/dist/chunk-J36M3KRX.js +1315 -0
- package/dist/chunk-J7ZQQFPT.js +113 -0
- package/dist/chunk-JP26LPCY.js +234 -0
- package/dist/chunk-JTNFJLIY.js +1046 -0
- package/dist/chunk-JVJRHBTD.js +50 -0
- package/dist/chunk-JYGR44ZC.js +133 -0
- package/dist/chunk-KDLPXXD2.js +173 -0
- package/dist/chunk-KMSYEE23.js +224 -0
- package/dist/chunk-KNYKWUYX.js +52 -0
- package/dist/chunk-LME57Z6J.js +138 -0
- package/dist/chunk-MFJP5FA7.js +20 -0
- package/dist/chunk-MKC5HNA7.js +1692 -0
- package/dist/chunk-MQGD2OUF.js +39 -0
- package/dist/chunk-MUFHLP4S.js +566 -0
- package/dist/chunk-O2LG3PNI.js +74 -0
- package/dist/chunk-O4GRKO3I.js +66 -0
- package/dist/chunk-OHUFNYGN.js +791 -0
- package/dist/chunk-PWKWNDBS.js +243 -0
- package/dist/chunk-QA74ITR4.js +103 -0
- package/dist/chunk-R6RGJF4L.js +170 -0
- package/dist/chunk-S7NNXWIN.js +7 -0
- package/dist/chunk-SV56BSUQ.js +162 -0
- package/dist/chunk-T7FCG7XV.js +435 -0
- package/dist/chunk-THC2ISYP.js +57 -0
- package/dist/chunk-VWC72TR3.js +115 -0
- package/dist/chunk-W46K56XU.js +216 -0
- package/dist/chunk-W5GGOUUI.js +75 -0
- package/dist/chunk-WEUJYDCV.js +269 -0
- package/dist/chunk-WFY7DKQD.js +279 -0
- package/dist/chunk-WZQFC7ZN.js +448 -0
- package/dist/chunk-Z3ETJN5G.js +136 -0
- package/dist/chunk-ZOOX3TUB.js +192 -0
- package/dist/chunk-ZSNJ6UA3.js +42 -0
- package/dist/chunk-ZZA2LUTL.js +130 -0
- package/dist/chunk-ZZT2E5VT.js +24 -0
- package/dist/color-CtSxc1Rh.d.ts +6 -0
- package/dist/combobox.d.ts +184 -0
- package/dist/combobox.js +21 -0
- package/dist/date-input.d.ts +83 -0
- package/dist/date-input.js +16 -0
- package/dist/date-picker.d.ts +249 -0
- package/dist/date-picker.js +29 -0
- package/dist/date-utils-7hTFTXNK.d.ts +34 -0
- package/dist/date-vMJBKAFK.d.ts +22 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +15 -0
- package/dist/drawer.d.ts +77 -0
- package/dist/drawer.js +14 -0
- package/dist/dropdown-menu.d.ts +218 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/file-trigger.d.ts +42 -0
- package/dist/file-trigger.js +3 -0
- package/dist/form.d.ts +487 -0
- package/dist/form.js +1179 -0
- package/dist/header-navigation.d.ts +74 -0
- package/dist/header-navigation.js +23 -0
- package/dist/icons/app.d.ts +48 -0
- package/dist/icons/app.js +282 -0
- package/dist/icons/flag.d.ts +817 -0
- package/dist/icons/flag.js +58336 -0
- package/dist/icons/integration.d.ts +36 -0
- package/dist/icons/integration.js +531 -0
- package/dist/icons/payment.d.ts +116 -0
- package/dist/icons/payment.js +2418 -0
- package/dist/icons.d.ts +2013 -0
- package/dist/icons.js +2012 -0
- package/dist/illustration.d.ts +48 -0
- package/dist/illustration.js +4 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +73 -0
- package/dist/indicator.d.ts +51 -0
- package/dist/indicator.js +7 -0
- package/dist/input.d.ts +66 -0
- package/dist/input.js +15 -0
- package/dist/multi-value-CJb_tnvi.d.ts +8 -0
- package/dist/nav-Bla0o_-1.d.ts +98 -0
- package/dist/number-input.d.ts +80 -0
- package/dist/number-input.js +15 -0
- package/dist/options-CPEIgjtd.d.ts +68 -0
- package/dist/overflow-Df0h42Oi.d.ts +29 -0
- package/dist/pagination.d.ts +77 -0
- package/dist/pagination.js +17 -0
- package/dist/payment-input.d.ts +7 -0
- package/dist/payment-input.js +15 -0
- package/dist/popover.d.ts +60 -0
- package/dist/popover.js +14 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +5 -0
- package/dist/radio.d.ts +77 -0
- package/dist/radio.js +12 -0
- package/dist/select.d.ts +68 -0
- package/dist/select.js +24 -0
- package/dist/shared-BNXAdgh2.d.ts +9 -0
- package/dist/shared-BYXJPnsN.d.ts +11 -0
- package/dist/shared-Dc-GgA16.d.ts +42 -0
- package/dist/sidebar-navigation.d.ts +129 -0
- package/dist/sidebar-navigation.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +23 -0
- package/dist/switch.js +7 -0
- package/dist/table.d.ts +692 -0
- package/dist/table.js +44 -0
- package/dist/tabs.d.ts +111 -0
- package/dist/tabs.js +8 -0
- package/dist/tag-input.d.ts +12 -0
- package/dist/tag-input.js +19 -0
- package/dist/tag.d.ts +98 -0
- package/dist/tag.js +9 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +12 -0
- package/dist/theme-script.d.ts +29 -0
- package/dist/theme-script.js +15 -0
- package/dist/theme.css +929 -0
- package/dist/theme.d.ts +71 -0
- package/dist/theme.js +15 -0
- package/dist/toast.d.ts +242 -0
- package/dist/toast.js +15 -0
- package/dist/tooltip.d.ts +70 -0
- package/dist/tooltip.js +6 -0
- package/dist/tree.d.ts +308 -0
- package/dist/tree.js +11 -0
- package/package.json +352 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { SURFACE_PADDING } from './chunk-MFJP5FA7.js';
|
|
2
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
3
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
4
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
6
|
+
import 'react';
|
|
7
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var GAP = { none: "", sm: "gap-3", md: "gap-4", lg: "gap-6" };
|
|
10
|
+
var GAP_MD = { none: "", sm: "md:gap-3", md: "md:gap-4", lg: "md:gap-6" };
|
|
11
|
+
var ROOT_PAD_MD = { none: "", sm: "md:p-3", md: "md:p-4", lg: "md:p-6" };
|
|
12
|
+
var BLEED = { none: "", sm: "-mx-3 px-3", md: "-mx-4 px-4", lg: "-mx-6 px-6" };
|
|
13
|
+
var BLEED_MD = {
|
|
14
|
+
none: "",
|
|
15
|
+
sm: "md:-mx-3 md:px-3",
|
|
16
|
+
md: "md:-mx-4 md:px-4",
|
|
17
|
+
lg: "md:-mx-6 md:px-6"
|
|
18
|
+
};
|
|
19
|
+
var HEADER_GUTTER = { none: "", sm: "pb-2", md: "pb-2.5", lg: "pb-4" };
|
|
20
|
+
var HEADER_GUTTER_MD = { none: "", sm: "md:pb-2", md: "md:pb-2.5", lg: "md:pb-4" };
|
|
21
|
+
var FOOTER_GUTTER = { none: "", sm: "pt-2", md: "pt-2.5", lg: "pt-4" };
|
|
22
|
+
var FOOTER_GUTTER_MD = { none: "", sm: "md:pt-2", md: "md:pt-2.5", lg: "md:pt-4" };
|
|
23
|
+
var CLOSE_INSET = { none: "", sm: "top-2 right-2", md: "top-3 right-3", lg: "top-4 right-4" };
|
|
24
|
+
var CLOSE_INSET_MD = {
|
|
25
|
+
none: "",
|
|
26
|
+
sm: "md:top-2 md:right-2",
|
|
27
|
+
md: "md:top-3 md:right-3",
|
|
28
|
+
lg: "md:top-4 md:right-4"
|
|
29
|
+
};
|
|
30
|
+
var CLOSE_GUTTER = "pr-10";
|
|
31
|
+
var CLOSE_GUTTER_BLEED = { none: "", sm: "pr-12", md: "pr-14", lg: "pr-16" };
|
|
32
|
+
var CLOSE_GUTTER_BLEED_MD = { none: "", sm: "md:pr-12", md: "md:pr-14", lg: "md:pr-16" };
|
|
33
|
+
var TITLE = {
|
|
34
|
+
md: "text-md font-semibold text-primary",
|
|
35
|
+
lg: "text-lg font-semibold text-primary"
|
|
36
|
+
};
|
|
37
|
+
var TITLE_COLUMN_GAP = { md: "gap-1", lg: "gap-1.5" };
|
|
38
|
+
var DESCRIPTION = "text-sm font-normal text-tertiary";
|
|
39
|
+
var BODY = "text-sm font-normal text-primary";
|
|
40
|
+
var defaultRenderer = (props) => /* @__PURE__ */ jsx("div", { ...props });
|
|
41
|
+
function PanelChrome(props) {
|
|
42
|
+
const {
|
|
43
|
+
render,
|
|
44
|
+
className,
|
|
45
|
+
padding = "md",
|
|
46
|
+
paddingMd,
|
|
47
|
+
titleScale = "md",
|
|
48
|
+
footerAlign = "start",
|
|
49
|
+
scrollBody = false,
|
|
50
|
+
bodyMask,
|
|
51
|
+
bodyRef,
|
|
52
|
+
dividers = false,
|
|
53
|
+
title,
|
|
54
|
+
description,
|
|
55
|
+
leading,
|
|
56
|
+
trailing,
|
|
57
|
+
footer,
|
|
58
|
+
children,
|
|
59
|
+
renderTitle = defaultRenderer,
|
|
60
|
+
renderDescription = defaultRenderer,
|
|
61
|
+
closeSlot
|
|
62
|
+
} = props;
|
|
63
|
+
const hasHeader = title != null || description != null || leading != null || trailing != null;
|
|
64
|
+
const hasText = title != null || description != null;
|
|
65
|
+
const rootClassName = cn("flex flex-col", SURFACE_PADDING[padding], GAP[padding], paddingMd && cn(ROOT_PAD_MD[paddingMd], GAP_MD[paddingMd]), className);
|
|
66
|
+
const closeClassName = cn("absolute shrink-0", CLOSE_INSET[padding], paddingMd && CLOSE_INSET_MD[paddingMd]);
|
|
67
|
+
const headerClassName = cn(
|
|
68
|
+
"flex shrink-0 gap-3",
|
|
69
|
+
// A lone title centers against its leading/trailing nodes; once a description makes the text
|
|
70
|
+
// column two lines tall, centering would float the avatar into the gap between them.
|
|
71
|
+
description != null ? "items-start" : "items-center",
|
|
72
|
+
dividers && cn("border-b border-secondary", BLEED[padding], HEADER_GUTTER[padding], paddingMd && cn(BLEED_MD[paddingMd], HEADER_GUTTER_MD[paddingMd])),
|
|
73
|
+
closeSlot && (dividers ? cn(CLOSE_GUTTER_BLEED[padding], paddingMd && CLOSE_GUTTER_BLEED_MD[paddingMd]) : CLOSE_GUTTER)
|
|
74
|
+
);
|
|
75
|
+
const footerClassName = cn(
|
|
76
|
+
"flex shrink-0 flex-wrap items-center gap-3",
|
|
77
|
+
footerAlign === "end" && "justify-end",
|
|
78
|
+
dividers && cn("border-t border-secondary", BLEED[padding], FOOTER_GUTTER[padding], paddingMd && cn(BLEED_MD[paddingMd], FOOTER_GUTTER_MD[paddingMd]))
|
|
79
|
+
);
|
|
80
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
+
closeSlot ? closeSlot(closeClassName) : null,
|
|
82
|
+
hasHeader ? /* @__PURE__ */ jsxs("div", { className: headerClassName, children: [
|
|
83
|
+
leading != null ? /* @__PURE__ */ jsx(Slot, { className: "[&>svg]:size-5", children: leading }) : null,
|
|
84
|
+
hasText ? (
|
|
85
|
+
// min-w-0 so a long title wraps inside its column instead of pushing `trailing` out.
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", TITLE_COLUMN_GAP[titleScale]), children: [
|
|
87
|
+
title != null ? renderTitle({ className: TITLE[titleScale], children: title }) : null,
|
|
88
|
+
description != null ? renderDescription({ className: DESCRIPTION, children: description }) : null
|
|
89
|
+
] })
|
|
90
|
+
) : /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1" }),
|
|
91
|
+
trailing != null ? /* @__PURE__ */ jsx(Slot, { className: "[&>svg]:size-5", children: trailing }) : null
|
|
92
|
+
] }) : null,
|
|
93
|
+
children != null ? /* @__PURE__ */ jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
ref: bodyRef,
|
|
97
|
+
className: cn("min-w-0", BODY, scrollBody && "min-h-0 flex-1 overflow-y-auto"),
|
|
98
|
+
style: bodyMask ? { maskImage: bodyMask, WebkitMaskImage: bodyMask } : void 0,
|
|
99
|
+
children
|
|
100
|
+
}
|
|
101
|
+
) : null,
|
|
102
|
+
footer != null ? /* @__PURE__ */ jsx("div", { className: footerClassName, children: footer }) : null
|
|
103
|
+
] });
|
|
104
|
+
return useRender({
|
|
105
|
+
defaultTagName: "div",
|
|
106
|
+
render,
|
|
107
|
+
props: mergeProps({ className: rootClassName }, { children: content })
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { PanelChrome };
|
|
112
|
+
//# sourceMappingURL=chunk-J7ZQQFPT.js.map
|
|
113
|
+
//# sourceMappingURL=chunk-J7ZQQFPT.js.map
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { PopupScrollViewport } from './chunk-ZZT2E5VT.js';
|
|
2
|
+
import { Slot } from './chunk-52IFGFTL.js';
|
|
3
|
+
import { ChevronRightIcon, CheckIcon } from './chunk-24TO7E32.js';
|
|
4
|
+
import { POPUP_MOTION, POPUP_MOTION_HOST } from './chunk-O4GRKO3I.js';
|
|
5
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
6
|
+
import { Menu } from '@base-ui/react/menu';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
var ITEM_SIZE = {
|
|
11
|
+
sm: "px-2 py-1.5 gap-1.5 text-sm rounded-md",
|
|
12
|
+
md: "px-2.5 py-2 gap-2 text-sm rounded-md",
|
|
13
|
+
lg: "px-3 py-2.5 gap-2.5 text-md rounded-[10px]"
|
|
14
|
+
};
|
|
15
|
+
var ICON_SIZE = {
|
|
16
|
+
sm: "[&>svg]:size-4 [&>svg]:[stroke-width:2.25px]",
|
|
17
|
+
md: "[&>svg]:size-4 [&>svg]:[stroke-width:2.25px]",
|
|
18
|
+
lg: "[&>svg]:size-5"
|
|
19
|
+
};
|
|
20
|
+
var LABEL_SIZE = {
|
|
21
|
+
sm: "px-3.5 py-1",
|
|
22
|
+
md: "px-4 py-1.5",
|
|
23
|
+
lg: "px-4.5 py-1.5"
|
|
24
|
+
};
|
|
25
|
+
var ITEM_BASE = "group relative mx-1.5 my-px flex cursor-pointer select-none items-center outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2 transition duration-100 ease-linear data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
|
|
26
|
+
var ITEM_VARIANT = {
|
|
27
|
+
default: "text-secondary data-[highlighted]:bg-secondary data-[highlighted]:text-secondary_hover",
|
|
28
|
+
// Resting: error text on the neutral menu surface (fg-error / -600). Highlighted:
|
|
29
|
+
// the row background flips to the error soft wash, so the text flips to the on-tint
|
|
30
|
+
// token (utility-error-fg / -700) to stay ≥AA on that wash — same fg-follows-bg move
|
|
31
|
+
// Button's destructive variants make on hover.
|
|
32
|
+
destructive: "text-error-primary data-[highlighted]:bg-error-primary data-[highlighted]:text-utility-red-700"
|
|
33
|
+
};
|
|
34
|
+
var ITEM_ACTIVE = "bg-brand-primary text-brand-secondary data-[highlighted]:bg-utility-brand-100 data-[highlighted]:text-brand-secondary";
|
|
35
|
+
var ICON_TONE = {
|
|
36
|
+
default: "text-fg-quaternary",
|
|
37
|
+
destructive: "text-error-primary",
|
|
38
|
+
// The caret and the leading icon follow the ROW, never keeping a resting gray on a
|
|
39
|
+
// row whose label has gone brand — that reads as a disabled control on the current row.
|
|
40
|
+
active: "text-brand-secondary"
|
|
41
|
+
};
|
|
42
|
+
var LABEL_SLOT = "min-w-0 flex-1 truncate text-left font-semibold";
|
|
43
|
+
var SHORTCUT_SLOT = "ml-1 shrink-0 pr-1 text-xs font-medium text-quaternary tabular-nums";
|
|
44
|
+
var GROUP_LABEL = "text-xs font-semibold text-quaternary select-none";
|
|
45
|
+
function LeadingIcon({ children, size, tone = "default" }) {
|
|
46
|
+
return /* @__PURE__ */ jsx(Slot, { className: cn(ICON_SIZE[size], ICON_TONE[tone]), children });
|
|
47
|
+
}
|
|
48
|
+
function CheckmarkIndicator({ kind, trailing = false }) {
|
|
49
|
+
const Indicator = kind === "checkbox" ? Menu.CheckboxItemIndicator : Menu.RadioItemIndicator;
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
Indicator,
|
|
52
|
+
{
|
|
53
|
+
keepMounted: true,
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
className: cn("inline-flex shrink-0 text-brand-secondary opacity-0 transition-opacity data-[checked]:opacity-100 [&_svg]:size-4", trailing && "ml-1"),
|
|
56
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { strokeWidth: 2.25 })
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function CheckboxBoxIndicator({ trailing = false }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: cn(
|
|
66
|
+
"relative inline-flex size-4 shrink-0 items-center justify-center rounded-sm bg-primary ring-1 ring-primary transition-colors duration-100 ease-linear ring-inset",
|
|
67
|
+
"group-data-[checked]:bg-brand-solid group-data-[checked]:ring-brand-solid",
|
|
68
|
+
trailing && "ml-1"
|
|
69
|
+
),
|
|
70
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3 text-fg-white opacity-0 transition-opacity group-data-[checked]:opacity-100" })
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function ActionRow({ item, size }) {
|
|
75
|
+
const { label, leading, trailing, shortcut, variant = "default", active, disabled, onClick, href, closeOnClick, className } = item;
|
|
76
|
+
const tone = variant === "destructive" ? "destructive" : active ? "active" : "default";
|
|
77
|
+
return /* @__PURE__ */ jsxs(
|
|
78
|
+
Menu.Item,
|
|
79
|
+
{
|
|
80
|
+
className: cn(ITEM_BASE, ITEM_VARIANT[variant], active && ITEM_ACTIVE, ITEM_SIZE[size], className),
|
|
81
|
+
"aria-current": active ? "page" : void 0,
|
|
82
|
+
disabled,
|
|
83
|
+
closeOnClick,
|
|
84
|
+
onClick,
|
|
85
|
+
render: href ? /* @__PURE__ */ jsx("a", { href }) : void 0,
|
|
86
|
+
children: [
|
|
87
|
+
leading ? /* @__PURE__ */ jsx(LeadingIcon, { size, tone, children: leading }) : null,
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: LABEL_SLOT, children: label }),
|
|
89
|
+
shortcut ? /* @__PURE__ */ jsx("span", { className: SHORTCUT_SLOT, children: shortcut }) : null,
|
|
90
|
+
trailing ? /* @__PURE__ */ jsx(Slot, { className: cn("items-center text-fg-quaternary", ICON_SIZE[size]), children: trailing }) : null
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function CheckboxRow({ item, size }) {
|
|
96
|
+
const { label, leading, selectionIndicator = "checkmark", checked, defaultChecked, onCheckedChange, disabled, className } = item;
|
|
97
|
+
const indicator = selectionIndicator === "checkbox" ? /* @__PURE__ */ jsx(CheckboxBoxIndicator, { trailing: leading != null }) : /* @__PURE__ */ jsx(CheckmarkIndicator, { kind: "checkbox", trailing: leading != null });
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
Menu.CheckboxItem,
|
|
100
|
+
{
|
|
101
|
+
className: cn(ITEM_BASE, ITEM_VARIANT.default, ITEM_SIZE[size], className),
|
|
102
|
+
checked,
|
|
103
|
+
defaultChecked,
|
|
104
|
+
disabled,
|
|
105
|
+
onCheckedChange: onCheckedChange ? (next) => onCheckedChange(next) : void 0,
|
|
106
|
+
children: [
|
|
107
|
+
leading ? /* @__PURE__ */ jsx(LeadingIcon, { size, children: leading }) : indicator,
|
|
108
|
+
/* @__PURE__ */ jsx("span", { className: LABEL_SLOT, children: label }),
|
|
109
|
+
leading ? indicator : null
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function RadioCluster({ item, size }) {
|
|
115
|
+
const { options, value, defaultValue, onValueChange, label } = item;
|
|
116
|
+
return /* @__PURE__ */ jsxs(
|
|
117
|
+
Menu.RadioGroup,
|
|
118
|
+
{
|
|
119
|
+
className: "flex flex-col",
|
|
120
|
+
value,
|
|
121
|
+
defaultValue,
|
|
122
|
+
onValueChange: onValueChange ? (next) => onValueChange(next) : void 0,
|
|
123
|
+
children: [
|
|
124
|
+
label ? /* @__PURE__ */ jsx(Menu.GroupLabel, { className: cn(GROUP_LABEL, LABEL_SIZE[size]), children: label }) : null,
|
|
125
|
+
options.map((opt) => /* @__PURE__ */ jsxs(
|
|
126
|
+
Menu.RadioItem,
|
|
127
|
+
{
|
|
128
|
+
value: opt.value,
|
|
129
|
+
disabled: opt.disabled,
|
|
130
|
+
className: cn(ITEM_BASE, ITEM_VARIANT.default, ITEM_SIZE[size], opt.className),
|
|
131
|
+
children: [
|
|
132
|
+
opt.leading ? /* @__PURE__ */ jsx(LeadingIcon, { size, children: opt.leading }) : /* @__PURE__ */ jsx(CheckmarkIndicator, { kind: "radio" }),
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: LABEL_SLOT, children: opt.label }),
|
|
134
|
+
opt.leading ? /* @__PURE__ */ jsx(CheckmarkIndicator, { kind: "radio", trailing: true }) : null
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
opt.value
|
|
138
|
+
))
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function GroupCluster({ item, size }) {
|
|
144
|
+
return /* @__PURE__ */ jsxs(Menu.Group, { className: "flex flex-col", children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Menu.GroupLabel, { className: cn(GROUP_LABEL, LABEL_SIZE[size]), children: item.group }),
|
|
146
|
+
/* @__PURE__ */ jsx(ItemList, { items: item.items, size })
|
|
147
|
+
] });
|
|
148
|
+
}
|
|
149
|
+
function SubmenuRow({ item, size }) {
|
|
150
|
+
const { label, leading, items, active, disabled, className } = item;
|
|
151
|
+
const tone = active ? "active" : "default";
|
|
152
|
+
return /* @__PURE__ */ jsxs(Menu.SubmenuRoot, { children: [
|
|
153
|
+
/* @__PURE__ */ jsxs(
|
|
154
|
+
Menu.SubmenuTrigger,
|
|
155
|
+
{
|
|
156
|
+
disabled,
|
|
157
|
+
className: cn(
|
|
158
|
+
ITEM_BASE,
|
|
159
|
+
ITEM_VARIANT.default,
|
|
160
|
+
// An open submenu takes the neutral highlight — unless it is the branch you
|
|
161
|
+
// are IN, which keeps its brand mark the whole time it is open: the trail is
|
|
162
|
+
// the only thing saying where the current row lives once it is a level down.
|
|
163
|
+
active ? ITEM_ACTIVE : "data-[popup-open]:bg-secondary",
|
|
164
|
+
ITEM_SIZE[size],
|
|
165
|
+
className
|
|
166
|
+
),
|
|
167
|
+
children: [
|
|
168
|
+
leading ? /* @__PURE__ */ jsx(LeadingIcon, { size, tone, children: leading }) : null,
|
|
169
|
+
/* @__PURE__ */ jsx("span", { className: LABEL_SLOT, children: label }),
|
|
170
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex shrink-0", ICON_TONE[tone], ICON_SIZE[size]), children: /* @__PURE__ */ jsx(ChevronRightIcon, { strokeWidth: 2.25 }) })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsx(MenuPopup, { items, size, side: "right", align: "start", inSub: true })
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
var POPUP_BOX = "w-fit max-w-[min(var(--available-width),22rem)] min-w-48 rounded-lg bg-primary shadow-lg ring-1 ring-secondary_alt ring-inset";
|
|
178
|
+
function ItemList({ items, size }) {
|
|
179
|
+
return /* @__PURE__ */ jsx(Fragment, { children: items.map((item, i) => {
|
|
180
|
+
const id = "separator" in item ? void 0 : item.id;
|
|
181
|
+
const key = id === void 0 ? `ix:${i}` : `id:${id}`;
|
|
182
|
+
if ("separator" in item) return /* @__PURE__ */ jsx(Menu.Separator, { className: "my-1 h-px w-full bg-border-secondary" }, key);
|
|
183
|
+
if ("type" in item)
|
|
184
|
+
return item.type === "checkbox" ? /* @__PURE__ */ jsx(CheckboxRow, { item, size }, key) : /* @__PURE__ */ jsx(RadioCluster, { item, size }, key);
|
|
185
|
+
if ("group" in item) return /* @__PURE__ */ jsx(GroupCluster, { item, size }, key);
|
|
186
|
+
if ("items" in item) return /* @__PURE__ */ jsx(SubmenuRow, { item, size }, key);
|
|
187
|
+
return /* @__PURE__ */ jsx(ActionRow, { item, size }, key);
|
|
188
|
+
}) });
|
|
189
|
+
}
|
|
190
|
+
function MenuPopup({
|
|
191
|
+
items,
|
|
192
|
+
size,
|
|
193
|
+
side,
|
|
194
|
+
align = "start",
|
|
195
|
+
className,
|
|
196
|
+
inSub = false,
|
|
197
|
+
header,
|
|
198
|
+
footer
|
|
199
|
+
}) {
|
|
200
|
+
const resolvedSide = side ?? (inSub ? "right" : "bottom");
|
|
201
|
+
const sideOffset = inSub ? -6 : 8;
|
|
202
|
+
const framed = header != null || footer != null;
|
|
203
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { side: resolvedSide, align, sideOffset, className: "z-50 outline-none", children: framed ? (
|
|
204
|
+
/* FRAMED: the BOX is a wrapper and `Menu.Popup` is only the menu.
|
|
205
|
+
*
|
|
206
|
+
* `Menu.Popup` carries `role="menu"`, and `role="menu"` may own only menu items, groups
|
|
207
|
+
* and separators. With header/footer inside it, a `footer` holding a real control put a
|
|
208
|
+
* focusable `<button>` in there — axe `aria-required-children`, "Element has children
|
|
209
|
+
* which are not allowed: button", on the shipped account-menu demo. A screen reader in
|
|
210
|
+
* menu mode has no way to reach it, because it is not a row.
|
|
211
|
+
*
|
|
212
|
+
* The header was tolerated (non-focusable text), so the fix is not "move the footer" — it
|
|
213
|
+
* is that the BOX and the MENU are two different things and this conflated them. A popup
|
|
214
|
+
* with pinned chrome is a container that HOLDS a menu. Base UI keeps every bit of the
|
|
215
|
+
* behaviour it owns; only our own box moves out. */
|
|
216
|
+
/* @__PURE__ */ jsxs("div", { className: cn(POPUP_BOX, "overflow-hidden", POPUP_MOTION_HOST, className), children: [
|
|
217
|
+
header != null ? /* @__PURE__ */ jsx("div", { className: "border-b border-secondary p-3", children: header }) : null,
|
|
218
|
+
/* @__PURE__ */ jsx(Menu.Popup, { className: cn("text-primary outline-none", POPUP_MOTION), children: /* @__PURE__ */ jsx(PopupScrollViewport, { max: "var(--available-height)", className: "flex flex-col py-1", children: /* @__PURE__ */ jsx(ItemList, { items, size }) }) }),
|
|
219
|
+
footer != null ? /* @__PURE__ */ jsx("div", { className: "border-t border-secondary p-3", children: footer }) : null
|
|
220
|
+
] })
|
|
221
|
+
) : /* @__PURE__ */ jsx(Menu.Popup, { className: cn(POPUP_BOX, "text-primary outline-none", POPUP_MOTION, className), children: /* @__PURE__ */ jsx(PopupScrollViewport, { max: "var(--available-height)", className: "flex flex-col py-1", children: /* @__PURE__ */ jsx(ItemList, { items, size }) }) }) }) });
|
|
222
|
+
}
|
|
223
|
+
function DropdownMenu(props) {
|
|
224
|
+
const { items, trigger, size = "md", side, align, open, defaultOpen, onOpenChange, modal = true, header, footer, className } = props;
|
|
225
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { open, defaultOpen, modal, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : void 0, children: [
|
|
226
|
+
trigger ? /* @__PURE__ */ jsx(Menu.Trigger, { render: trigger }) : null,
|
|
227
|
+
/* @__PURE__ */ jsx(MenuPopup, { items, size, side, align, className, header, footer })
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
DropdownMenu.displayName = "DropdownMenu";
|
|
231
|
+
|
|
232
|
+
export { DropdownMenu };
|
|
233
|
+
//# sourceMappingURL=chunk-JP26LPCY.js.map
|
|
234
|
+
//# sourceMappingURL=chunk-JP26LPCY.js.map
|