@underpin/ui 0.0.0-stage → 2.0.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 +21 -0
- package/README.md +45 -2
- package/components/autocomplete.d.ts +25 -0
- package/components/autocomplete.js +71 -0
- package/components/autocomplete.js.map +1 -0
- package/components/avatar.d.ts +5 -0
- package/components/avatar.js +26 -0
- package/components/avatar.js.map +1 -0
- package/components/badge.d.ts +36 -0
- package/components/badge.js +140 -0
- package/components/badge.js.map +1 -0
- package/components/bar-list.d.ts +133 -0
- package/components/bar-list.js +204 -0
- package/components/bar-list.js.map +1 -0
- package/components/breakdown-card.d.ts +30 -0
- package/components/breakdown-card.js +43 -0
- package/components/breakdown-card.js.map +1 -0
- package/components/button-group.d.ts +17 -0
- package/components/button-group.js +27 -0
- package/components/button-group.js.map +1 -0
- package/components/button.d.ts +39 -0
- package/components/button.js +128 -0
- package/components/button.js.map +1 -0
- package/components/calendar.d.ts +27 -0
- package/components/calendar.js +95 -0
- package/components/calendar.js.map +1 -0
- package/components/callout.d.ts +26 -0
- package/components/callout.js +71 -0
- package/components/callout.js.map +1 -0
- package/components/card.d.ts +55 -0
- package/components/card.js +96 -0
- package/components/card.js.map +1 -0
- package/components/chart.d.ts +32 -0
- package/components/chart.js +43 -0
- package/components/chart.js.map +1 -0
- package/components/checkbox.d.ts +15 -0
- package/components/checkbox.js +42 -0
- package/components/checkbox.js.map +1 -0
- package/components/code-block.d.ts +21 -0
- package/components/code-block.js +35 -0
- package/components/code-block.js.map +1 -0
- package/components/collapse.d.ts +14 -0
- package/components/collapse.js +25 -0
- package/components/collapse.js.map +1 -0
- package/components/combobox.d.ts +71 -0
- package/components/combobox.js +155 -0
- package/components/combobox.js.map +1 -0
- package/components/copy-button.d.ts +29 -0
- package/components/copy-button.js +100 -0
- package/components/copy-button.js.map +1 -0
- package/components/copy-input.d.ts +15 -0
- package/components/copy-input.js +51 -0
- package/components/copy-input.js.map +1 -0
- package/components/date-picker-trigger.d.ts +12 -0
- package/components/date-picker-trigger.js +30 -0
- package/components/date-picker-trigger.js.map +1 -0
- package/components/date-picker.d.ts +36 -0
- package/components/date-picker.js +70 -0
- package/components/date-picker.js.map +1 -0
- package/components/detail-row.d.ts +51 -0
- package/components/detail-row.js +77 -0
- package/components/detail-row.js.map +1 -0
- package/components/dialog.d.ts +121 -0
- package/components/dialog.js +327 -0
- package/components/dialog.js.map +1 -0
- package/components/disabled-reason.d.ts +31 -0
- package/components/disabled-reason.js +67 -0
- package/components/disabled-reason.js.map +1 -0
- package/components/empty-state.d.ts +41 -0
- package/components/empty-state.js +84 -0
- package/components/empty-state.js.map +1 -0
- package/components/entity-avatar.d.ts +54 -0
- package/components/entity-avatar.js +68 -0
- package/components/entity-avatar.js.map +1 -0
- package/components/form-section.d.ts +22 -0
- package/components/form-section.js +38 -0
- package/components/form-section.js.map +1 -0
- package/components/form.d.ts +199 -0
- package/components/form.js +456 -0
- package/components/form.js.map +1 -0
- package/components/formatted-number.d.ts +21 -0
- package/components/formatted-number.js +13 -0
- package/components/formatted-number.js.map +1 -0
- package/components/heading.d.ts +23 -0
- package/components/heading.js +44 -0
- package/components/heading.js.map +1 -0
- package/components/icon-swap.d.ts +15 -0
- package/components/icon-swap.js +29 -0
- package/components/icon-swap.js.map +1 -0
- package/components/inline-action.d.ts +21 -0
- package/components/inline-action.js +36 -0
- package/components/inline-action.js.map +1 -0
- package/components/input.d.ts +51 -0
- package/components/input.js +52 -0
- package/components/input.js.map +1 -0
- package/components/kbd.d.ts +17 -0
- package/components/kbd.js +34 -0
- package/components/kbd.js.map +1 -0
- package/components/label.d.ts +10 -0
- package/components/label.js +20 -0
- package/components/label.js.map +1 -0
- package/components/menu.d.ts +77 -0
- package/components/menu.js +189 -0
- package/components/menu.js.map +1 -0
- package/components/nav-button.d.ts +34 -0
- package/components/nav-button.js +71 -0
- package/components/nav-button.js.map +1 -0
- package/components/nav.d.ts +39 -0
- package/components/nav.js +68 -0
- package/components/nav.js.map +1 -0
- package/components/number-input.d.ts +16 -0
- package/components/number-input.js +25 -0
- package/components/number-input.js.map +1 -0
- package/components/page.d.ts +14 -0
- package/components/page.js +23 -0
- package/components/page.js.map +1 -0
- package/components/pagination.d.ts +15 -0
- package/components/pagination.js +63 -0
- package/components/pagination.js.map +1 -0
- package/components/ping.d.ts +38 -0
- package/components/ping.js +50 -0
- package/components/ping.js.map +1 -0
- package/components/popover.d.ts +5 -0
- package/components/popover.js +25 -0
- package/components/popover.js.map +1 -0
- package/components/radio-group.d.ts +35 -0
- package/components/radio-group.js +81 -0
- package/components/radio-group.js.map +1 -0
- package/components/relative-time.d.ts +25 -0
- package/components/relative-time.js +51 -0
- package/components/relative-time.js.map +1 -0
- package/components/saved-mark.d.ts +15 -0
- package/components/saved-mark.js +45 -0
- package/components/saved-mark.js.map +1 -0
- package/components/search-input.d.ts +13 -0
- package/components/search-input.js +44 -0
- package/components/search-input.js.map +1 -0
- package/components/section-header.d.ts +83 -0
- package/components/section-header.js +170 -0
- package/components/section-header.js.map +1 -0
- package/components/segmented-control.d.ts +24 -0
- package/components/segmented-control.js +70 -0
- package/components/segmented-control.js.map +1 -0
- package/components/select.d.ts +28 -0
- package/components/select.js +129 -0
- package/components/select.js.map +1 -0
- package/components/shortcut-keys.d.ts +14 -0
- package/components/shortcut-keys.js +32 -0
- package/components/shortcut-keys.js.map +1 -0
- package/components/shortcuts-dialog.d.ts +10 -0
- package/components/shortcuts-dialog.js +92 -0
- package/components/shortcuts-dialog.js.map +1 -0
- package/components/skeleton.d.ts +8 -0
- package/components/skeleton.js +23 -0
- package/components/skeleton.js.map +1 -0
- package/components/sparkline.d.ts +25 -0
- package/components/sparkline.js +70 -0
- package/components/sparkline.js.map +1 -0
- package/components/stack.d.ts +21 -0
- package/components/stack.js +45 -0
- package/components/stack.js.map +1 -0
- package/components/stat-strip.d.ts +43 -0
- package/components/stat-strip.js +151 -0
- package/components/stat-strip.js.map +1 -0
- package/components/steps.d.ts +19 -0
- package/components/steps.js +25 -0
- package/components/steps.js.map +1 -0
- package/components/switch.d.ts +16 -0
- package/components/switch.js +29 -0
- package/components/switch.js.map +1 -0
- package/components/tabs.d.ts +18 -0
- package/components/tabs.js +65 -0
- package/components/tabs.js.map +1 -0
- package/components/text-link.d.ts +16 -0
- package/components/text-link.js +32 -0
- package/components/text-link.js.map +1 -0
- package/components/textarea.d.ts +10 -0
- package/components/textarea.js +23 -0
- package/components/textarea.js.map +1 -0
- package/components/theme.d.ts +28 -0
- package/components/theme.js +158 -0
- package/components/theme.js.map +1 -0
- package/components/time-series-chart.d.ts +122 -0
- package/components/time-series-chart.js +722 -0
- package/components/time-series-chart.js.map +1 -0
- package/components/toaster.d.ts +3 -0
- package/components/toaster.js +44 -0
- package/components/toaster.js.map +1 -0
- package/components/tooltip.d.ts +64 -0
- package/components/tooltip.js +126 -0
- package/components/tooltip.js.map +1 -0
- package/components/view-picker.d.ts +20 -0
- package/components/view-picker.js +24 -0
- package/components/view-picker.js.map +1 -0
- package/fonts/inter-OFL.txt +93 -0
- package/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/fonts/inter-cyrillic.woff2 +0 -0
- package/fonts/inter-greek-ext.woff2 +0 -0
- package/fonts/inter-greek.woff2 +0 -0
- package/fonts/inter-latin-ext.woff2 +0 -0
- package/fonts/inter-latin.woff2 +0 -0
- package/fonts/inter-vietnamese.woff2 +0 -0
- package/fonts.css +83 -0
- package/lib/animation.d.ts +14 -0
- package/lib/animation.js +20 -0
- package/lib/animation.js.map +1 -0
- package/lib/aria.d.ts +5 -0
- package/lib/aria.js +12 -0
- package/lib/aria.js.map +1 -0
- package/lib/chart-curve.d.ts +13 -0
- package/lib/chart-curve.js +79 -0
- package/lib/chart-curve.js.map +1 -0
- package/lib/classes.d.ts +134 -0
- package/lib/classes.js +152 -0
- package/lib/classes.js.map +1 -0
- package/lib/color.d.ts +25 -0
- package/lib/color.js +149 -0
- package/lib/color.js.map +1 -0
- package/lib/day.d.ts +9 -0
- package/lib/day.js +20 -0
- package/lib/day.js.map +1 -0
- package/lib/design-tokens.d.ts +56 -0
- package/lib/design-tokens.js +196 -0
- package/lib/design-tokens.js.map +1 -0
- package/lib/icon.d.ts +17 -0
- package/lib/icon.js +34 -0
- package/lib/icon.js.map +1 -0
- package/lib/icons.d.ts +23 -0
- package/lib/icons.js +28 -0
- package/lib/icons.js.map +1 -0
- package/lib/interactive.d.ts +21 -0
- package/lib/interactive.js +31 -0
- package/lib/interactive.js.map +1 -0
- package/lib/media.d.ts +58 -0
- package/lib/media.js +116 -0
- package/lib/media.js.map +1 -0
- package/lib/segmented.d.ts +57 -0
- package/lib/segmented.js +83 -0
- package/lib/segmented.js.map +1 -0
- package/lib/shortcuts.d.ts +94 -0
- package/lib/shortcuts.js +271 -0
- package/lib/shortcuts.js.map +1 -0
- package/lib/slot.d.ts +9 -0
- package/lib/slot.js +18 -0
- package/lib/slot.js.map +1 -0
- package/lib/time-series.d.ts +100 -0
- package/lib/time-series.js +144 -0
- package/lib/time-series.js.map +1 -0
- package/lib/tone.d.ts +6 -0
- package/lib/tone.js +0 -0
- package/lib/variants.d.ts +12 -0
- package/lib/variants.js +14 -0
- package/lib/variants.js.map +1 -0
- package/package.json +116 -4
- package/styles.css +619 -0
- package/tokens.d.ts +104 -0
- package/tokens.js +108 -0
- package/tokens.js.map +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cn } from "../lib/variants.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/icon-swap.tsx
|
|
4
|
+
const swap = [
|
|
5
|
+
"col-start-1 row-start-1 grid place-items-center",
|
|
6
|
+
"transition-[opacity,filter,scale] duration-200 ease-swap",
|
|
7
|
+
"motion-reduce:transition-[opacity] motion-reduce:scale-100 motion-reduce:blur-none"
|
|
8
|
+
];
|
|
9
|
+
const shown = "scale-100 opacity-100 blur-none";
|
|
10
|
+
const hidden = "scale-[0.25] opacity-0 blur-[4px]";
|
|
11
|
+
/**
|
|
12
|
+
* Marks that share one spot and cross-fade with a state, all mounted so leaving a state animates
|
|
13
|
+
* as well as entering it. `value` names the mark on show, and the spot is as large as the
|
|
14
|
+
* largest mark. Reduced motion drops the travel and keeps the crossfade: the mark still changes,
|
|
15
|
+
* it just no longer grows into place.
|
|
16
|
+
*/
|
|
17
|
+
function IconSwap({ value, marks, className }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("span", {
|
|
19
|
+
className: cn("grid place-items-center", className),
|
|
20
|
+
children: Object.entries(marks).map(([key, mark]) => /* @__PURE__ */ jsx("span", {
|
|
21
|
+
"aria-hidden": key !== value,
|
|
22
|
+
className: cn(swap, key === value ? shown : hidden),
|
|
23
|
+
children: mark
|
|
24
|
+
}, key))
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { IconSwap };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=icon-swap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-swap.js","names":[],"sources":["../../src/components/icon-swap.tsx"],"sourcesContent":["import type { ReactNode } from \"react\"\nimport { cn } from \"../lib/variants\"\n\ninterface IconSwapProps<T extends string> {\n /** The key of the mark on show. */\n value: T\n marks: Record<T, ReactNode>\n className?: string\n}\n\nconst swap = [\n \"col-start-1 row-start-1 grid place-items-center\",\n \"transition-[opacity,filter,scale] duration-200 ease-swap\",\n \"motion-reduce:transition-[opacity] motion-reduce:scale-100 motion-reduce:blur-none\",\n]\nconst shown = \"scale-100 opacity-100 blur-none\"\nconst hidden = \"scale-[0.25] opacity-0 blur-[4px]\"\n\n/**\n * Marks that share one spot and cross-fade with a state, all mounted so leaving a state animates\n * as well as entering it. `value` names the mark on show, and the spot is as large as the\n * largest mark. Reduced motion drops the travel and keeps the crossfade: the mark still changes,\n * it just no longer grows into place.\n */\nexport function IconSwap<T extends string>({ value, marks, className }: IconSwapProps<T>) {\n return (\n <span className={cn(\"grid place-items-center\", className)}>\n {Object.entries<ReactNode>(marks).map(([key, mark]) => (\n <span\n key={key}\n aria-hidden={key !== value}\n className={cn(swap, key === value ? shown : hidden)}\n >\n {mark}\n </span>\n ))}\n </span>\n )\n}\n"],"mappings":";;;AAUA,MAAM,OAAO;CACX;CACA;CACA;AACF;AACA,MAAM,QAAQ;AACd,MAAM,SAAS;;;;;;;AAQf,SAAgB,SAA2B,EAAE,OAAO,OAAO,aAA+B;CACxF,OACE,oBAAC,QAAD;EAAM,WAAW,GAAG,2BAA2B,SAAS;EACrD,UAAA,OAAO,QAAmB,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,UAC3C,oBAAC,QAAD;GAEE,eAAa,QAAQ;GACrB,WAAW,GAAG,MAAM,QAAQ,QAAQ,QAAQ,MAAM;GAEjD,UAAA;EACG,GALC,GAKD,CACP;CACG,CAAA;AAEV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VariantProps } from "../lib/variants.js";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
declare const inlineActionVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
/**
|
|
5
|
+
* Grow the label's line into a 40px touch target on a coarse pointer. The padding bleeds
|
|
6
|
+
* into the surrounding strip's own, and the negative margin keeps the strip's height; a
|
|
7
|
+
* control whose neighbours sit tight against it leaves this off.
|
|
8
|
+
*/
|
|
9
|
+
touchTarget: {
|
|
10
|
+
true: string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, "flex w-fit items-center gap-1.5 font-medium text-ink-muted hover:text-ink", undefined, undefined, undefined>;
|
|
13
|
+
export type InlineActionProps = useRender.ComponentProps<"button"> & VariantProps<typeof inlineActionVariants>;
|
|
14
|
+
/**
|
|
15
|
+
* A control styled as text rather than as a button: a card's footer trigger, a breadcrumb, a
|
|
16
|
+
* link to the page a panel summarises. It inherits the type scale around it and sets only
|
|
17
|
+
* what marks it as interactive, so a new one matches the rest without restating any of it.
|
|
18
|
+
* Pass `render` for a link or a library trigger. A link inside a sentence is `TextLink`.
|
|
19
|
+
*/
|
|
20
|
+
declare function InlineAction({ className, render, touchTarget, ...props }: InlineActionProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
21
|
+
export { InlineAction };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { variants } from "../lib/variants.js";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
// src/components/inline-action.tsx
|
|
4
|
+
const inlineActionVariants = variants({
|
|
5
|
+
base: "flex w-fit items-center gap-1.5 font-medium text-ink-muted hover:text-ink",
|
|
6
|
+
variants: {
|
|
7
|
+
/**
|
|
8
|
+
* Grow the label's line into a 40px touch target on a coarse pointer. The padding bleeds
|
|
9
|
+
* into the surrounding strip's own, and the negative margin keeps the strip's height; a
|
|
10
|
+
* control whose neighbours sit tight against it leaves this off.
|
|
11
|
+
*/
|
|
12
|
+
touchTarget: { true: "pointer-coarse:-my-2.5 pointer-coarse:py-2.5" } }
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* A control styled as text rather than as a button: a card's footer trigger, a breadcrumb, a
|
|
16
|
+
* link to the page a panel summarises. It inherits the type scale around it and sets only
|
|
17
|
+
* what marks it as interactive, so a new one matches the rest without restating any of it.
|
|
18
|
+
* Pass `render` for a link or a library trigger. A link inside a sentence is `TextLink`.
|
|
19
|
+
*/
|
|
20
|
+
function InlineAction({ className, render, touchTarget, ...props }) {
|
|
21
|
+
return useRender({
|
|
22
|
+
render,
|
|
23
|
+
defaultTagName: "button",
|
|
24
|
+
props: {
|
|
25
|
+
className: inlineActionVariants({
|
|
26
|
+
touchTarget,
|
|
27
|
+
className
|
|
28
|
+
}),
|
|
29
|
+
...!render && { type: "button" },
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { InlineAction };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=inline-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-action.js","names":[],"sources":["../../src/components/inline-action.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst inlineActionVariants = variants({\n // The label carries the weight, so a control reads as one against the plain text beside it\n // at the same size. Size and colour are the surrounding strip's, never this component's.\n base: \"flex w-fit items-center gap-1.5 font-medium text-ink-muted hover:text-ink\",\n\n variants: {\n /**\n * Grow the label's line into a 40px touch target on a coarse pointer. The padding bleeds\n * into the surrounding strip's own, and the negative margin keeps the strip's height; a\n * control whose neighbours sit tight against it leaves this off.\n */\n touchTarget: {\n true: \"pointer-coarse:-my-2.5 pointer-coarse:py-2.5\",\n },\n },\n})\n\nexport type InlineActionProps = useRender.ComponentProps<\"button\"> &\n VariantProps<typeof inlineActionVariants>\n\n/**\n * A control styled as text rather than as a button: a card's footer trigger, a breadcrumb, a\n * link to the page a panel summarises. It inherits the type scale around it and sets only\n * what marks it as interactive, so a new one matches the rest without restating any of it.\n * Pass `render` for a link or a library trigger. A link inside a sentence is `TextLink`.\n */\nfunction InlineAction({ className, render, touchTarget, ...props }: InlineActionProps) {\n // Never a form's submit, as with `Button`; only on a real `<button>`.\n return useRender({\n render,\n defaultTagName: \"button\",\n props: {\n className: inlineActionVariants({ touchTarget, className }),\n ...(!render && { type: \"button\" as const }),\n ...props,\n },\n })\n}\n\nexport { InlineAction }\n"],"mappings":";;;AAGA,MAAM,uBAAuB,SAAS;CAGpC,MAAM;CAEN,UAAU;;;;;;AAMR,aAAa,EACX,MAAM,+CACR,EACF;AACF,CAAC;;;;;;;AAWD,SAAS,aAAa,EAAE,WAAW,QAAQ,aAAa,GAAG,SAA4B;CAErF,OAAO,UAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GACL,WAAW,qBAAqB;IAAE;IAAa;GAAU,CAAC;GAC1D,GAAI,CAAC,UAAU,EAAE,MAAM,SAAkB;GACzC,GAAG;EACL;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { VariantProps } from "../lib/variants.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
declare const inputVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
bordered: {
|
|
5
|
+
false: string;
|
|
6
|
+
};
|
|
7
|
+
size: {
|
|
8
|
+
sm: string;
|
|
9
|
+
md: string;
|
|
10
|
+
lg: string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, string[], {
|
|
13
|
+
interactive: {
|
|
14
|
+
true: string;
|
|
15
|
+
};
|
|
16
|
+
bordered: {
|
|
17
|
+
true: string;
|
|
18
|
+
};
|
|
19
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
20
|
+
interactive: {
|
|
21
|
+
true: string;
|
|
22
|
+
};
|
|
23
|
+
bordered: {
|
|
24
|
+
true: string;
|
|
25
|
+
};
|
|
26
|
+
}, undefined, "transition-[color,background-color,border-color,box-shadow,opacity,filter] duration-75 ease-out aria-invalid:border-danger aria-invalid:focus:border-danger", undefined, undefined, undefined>>;
|
|
27
|
+
/**
|
|
28
|
+
* Attributes that keep password managers off a field. 1Password, LastPass and Bitwarden all
|
|
29
|
+
* decorate a field they read as a credential (an inline button over the text, and an offer to
|
|
30
|
+
* save what was typed once the form submits), and nearly every field in a product is a name, a
|
|
31
|
+
* domain, a note or a third party's secret, none of which belong in a vault. So a field blocks
|
|
32
|
+
* them unless it says otherwise: only a sign-in or register field passes
|
|
33
|
+
* `allowPasswordManager`, since a manager filling those is the point of having one.
|
|
34
|
+
*/
|
|
35
|
+
export declare const NO_PASSWORD_MANAGER: {
|
|
36
|
+
readonly "data-1p-ignore": true;
|
|
37
|
+
readonly "data-lpignore": "true";
|
|
38
|
+
readonly "data-bwignore": true;
|
|
39
|
+
};
|
|
40
|
+
export interface PasswordManagerProps {
|
|
41
|
+
/** Lets password managers fill the field. Only a credential field sets it. */
|
|
42
|
+
allowPasswordManager?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function passwordManagerAttributes(allowPasswordManager?: boolean): {
|
|
45
|
+
readonly "data-1p-ignore": true;
|
|
46
|
+
readonly "data-lpignore": "true";
|
|
47
|
+
readonly "data-bwignore": true;
|
|
48
|
+
} | undefined;
|
|
49
|
+
type InputProps = Omit<ComponentProps<"input">, "size"> & VariantProps<typeof inputVariants> & PasswordManagerProps;
|
|
50
|
+
declare function Input({ className, interactive, bordered, size, allowPasswordManager, ...props }: InputProps): import("react").JSX.Element;
|
|
51
|
+
export { Input, inputVariants };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { interactiveVariants } from "../lib/interactive.js";
|
|
2
|
+
import { variants } from "../lib/variants.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/input.tsx
|
|
5
|
+
const inputVariants = variants({
|
|
6
|
+
extend: interactiveVariants,
|
|
7
|
+
base: ["appearance-none min-h-0 w-full self-stretch border border-edge-strong bg-field text-ink break-words disabled:bg-fill-subtle disabled:text-ink-secondary aria-disabled:bg-fill-subtle aria-disabled:text-ink-secondary", "text-control"],
|
|
8
|
+
variants: {
|
|
9
|
+
bordered: { false: "border-transparent" },
|
|
10
|
+
size: {
|
|
11
|
+
sm: "px-2 py-1.25 font-normal rounded-md",
|
|
12
|
+
md: "px-3 py-1.75 rounded-md",
|
|
13
|
+
lg: "px-3.5 py-1.75 rounded-lg text-sm"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
interactive: false,
|
|
18
|
+
bordered: true,
|
|
19
|
+
size: "md"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Attributes that keep password managers off a field. 1Password, LastPass and Bitwarden all
|
|
24
|
+
* decorate a field they read as a credential (an inline button over the text, and an offer to
|
|
25
|
+
* save what was typed once the form submits), and nearly every field in a product is a name, a
|
|
26
|
+
* domain, a note or a third party's secret, none of which belong in a vault. So a field blocks
|
|
27
|
+
* them unless it says otherwise: only a sign-in or register field passes
|
|
28
|
+
* `allowPasswordManager`, since a manager filling those is the point of having one.
|
|
29
|
+
*/
|
|
30
|
+
const NO_PASSWORD_MANAGER = {
|
|
31
|
+
"data-1p-ignore": true,
|
|
32
|
+
"data-lpignore": "true",
|
|
33
|
+
"data-bwignore": true
|
|
34
|
+
};
|
|
35
|
+
function passwordManagerAttributes(allowPasswordManager = false) {
|
|
36
|
+
return allowPasswordManager ? void 0 : NO_PASSWORD_MANAGER;
|
|
37
|
+
}
|
|
38
|
+
function Input({ className, interactive, bordered, size, allowPasswordManager, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("input", {
|
|
40
|
+
className: inputVariants({
|
|
41
|
+
interactive,
|
|
42
|
+
bordered,
|
|
43
|
+
size,
|
|
44
|
+
className
|
|
45
|
+
}),
|
|
46
|
+
...passwordManagerAttributes(allowPasswordManager),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { Input, NO_PASSWORD_MANAGER, inputVariants, passwordManagerAttributes };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../src/components/input.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst inputVariants = variants({\n extend: interactiveVariants,\n // A field is an opening in its card: its own ground, white in light and a tone under the card\n // in dark, behind a stronger edge than the card's. Disabled, it fills in and keeps its value\n // readable, so a value never reads as an empty field's placeholder.\n base: [\n \"appearance-none min-h-0 w-full self-stretch border border-edge-strong bg-field text-ink break-words disabled:bg-fill-subtle disabled:text-ink-secondary aria-disabled:bg-fill-subtle aria-disabled:text-ink-secondary\",\n \"text-control\",\n ],\n\n variants: {\n // A field without an edge keeps a transparent border, so it stays the same box.\n bordered: {\n false: \"border-transparent\",\n },\n // Padding and the border around one line put a field on the control scale, so it is as tall\n // as a button of the same size: 28, 32 and 36px. A textarea shares the padding and grows by\n // lines.\n size: {\n sm: \"px-2 py-1.25 font-normal rounded-md\",\n md: \"px-3 py-1.75 rounded-md\",\n lg: \"px-3.5 py-1.75 rounded-lg text-sm\",\n },\n },\n\n defaultVariants: {\n interactive: false,\n bordered: true,\n size: \"md\",\n },\n})\n\n/**\n * Attributes that keep password managers off a field. 1Password, LastPass and Bitwarden all\n * decorate a field they read as a credential (an inline button over the text, and an offer to\n * save what was typed once the form submits), and nearly every field in a product is a name, a\n * domain, a note or a third party's secret, none of which belong in a vault. So a field blocks\n * them unless it says otherwise: only a sign-in or register field passes\n * `allowPasswordManager`, since a manager filling those is the point of having one.\n */\nexport const NO_PASSWORD_MANAGER = {\n \"data-1p-ignore\": true,\n \"data-lpignore\": \"true\",\n \"data-bwignore\": true,\n} as const\n\nexport interface PasswordManagerProps {\n /** Lets password managers fill the field. Only a credential field sets it. */\n allowPasswordManager?: boolean\n}\n\nexport function passwordManagerAttributes(allowPasswordManager = false) {\n return allowPasswordManager ? undefined : NO_PASSWORD_MANAGER\n}\n\ntype InputProps = Omit<ComponentProps<\"input\">, \"size\"> &\n VariantProps<typeof inputVariants> &\n PasswordManagerProps\n\nfunction Input({\n className,\n interactive,\n bordered,\n size,\n allowPasswordManager,\n ...props\n}: InputProps) {\n return (\n <input\n className={inputVariants({ interactive, bordered, size, className })}\n {...passwordManagerAttributes(allowPasswordManager)}\n {...props}\n />\n )\n}\n\nexport { Input, inputVariants }\n"],"mappings":";;;;AAIA,MAAM,gBAAgB,SAAS;CAC7B,QAAQ;CAIR,MAAM,CACJ,yNACA,cACF;CAEA,UAAU;EAER,UAAU,EACR,OAAO,qBACT;EAIA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CAEA,iBAAiB;EACf,aAAa;EACb,UAAU;EACV,MAAM;CACR;AACF,CAAC;;;;;;;;;AAUD,MAAa,sBAAsB;CACjC,kBAAkB;CAClB,iBAAiB;CACjB,iBAAiB;AACnB;AAOA,SAAgB,0BAA0B,uBAAuB,OAAO;CACtE,OAAO,uBAAuB,KAAA,IAAY;AAC5C;AAMA,SAAS,MAAM,EACb,WACA,aACA,UACA,MACA,sBACA,GAAG,SACU;CACb,OACE,oBAAC,SAAD;EACE,WAAW,cAAc;GAAE;GAAa;GAAU;GAAM;EAAU,CAAC;EACnE,GAAI,0BAA0B,oBAAoB;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VariantProps } from "../lib/variants.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
declare const kbdVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
soft: string;
|
|
6
|
+
plain: string;
|
|
7
|
+
outline: string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "inline-flex min-w-[1.426em] justify-center gap-[0.1em] -my-0.5 px-[0.22em] py-[0.088em] whitespace-nowrap tabular-nums rounded-sm font-system text-xs/tight text-ink-muted", undefined, undefined, undefined>;
|
|
10
|
+
type KbdProps = ComponentProps<"kbd"> & VariantProps<typeof kbdVariants> & {
|
|
11
|
+
meta?: boolean;
|
|
12
|
+
shift?: boolean;
|
|
13
|
+
alt?: boolean;
|
|
14
|
+
ctrl?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function Kbd({ children, className, variant, meta, shift, alt, ctrl, ...props }: KbdProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { variants } from "../lib/variants.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/kbd.tsx
|
|
4
|
+
const kbdVariants = variants({
|
|
5
|
+
base: "inline-flex min-w-[1.426em] justify-center gap-[0.1em] -my-0.5 px-[0.22em] py-[0.088em] whitespace-nowrap tabular-nums rounded-sm font-system text-xs/tight text-ink-muted",
|
|
6
|
+
variants: { variant: {
|
|
7
|
+
soft: "bg-fill-subtle",
|
|
8
|
+
plain: "",
|
|
9
|
+
outline: "min-w-[calc(1.426em+2px)] border"
|
|
10
|
+
} },
|
|
11
|
+
defaultVariants: { variant: "outline" }
|
|
12
|
+
});
|
|
13
|
+
function Kbd({ children, className, variant, meta, shift, alt, ctrl, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("kbd", {
|
|
15
|
+
className: kbdVariants({
|
|
16
|
+
variant,
|
|
17
|
+
className
|
|
18
|
+
}),
|
|
19
|
+
...props,
|
|
20
|
+
children: [
|
|
21
|
+
shift && /* @__PURE__ */ jsx("span", { children: "⇧" }),
|
|
22
|
+
meta && /* @__PURE__ */ jsx("span", { children: "⌘" }),
|
|
23
|
+
alt && /* @__PURE__ */ jsx("span", { children: "⌥" }),
|
|
24
|
+
ctrl && /* @__PURE__ */ jsx("span", { children: "⌃" }),
|
|
25
|
+
children && /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "contents",
|
|
27
|
+
children
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { Kbd };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=kbd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.js","names":[],"sources":["../../src/components/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst kbdVariants = variants({\n // `font-system`: a key cap is the one place the platform's font beats the brand's, since the\n // modifier glyphs (⇧ ⌘ ⌥ ⌃) are drawn to match its letterforms and Inter's are not.\n // A single-key cap is square: its minimum width is its height (the 1.25em line plus\n // 0.088em above and below), and the 0.22em side padding is what still fits `W`, the widest\n // letter, inside it (measured), so a column of letter caps lines up. A chord grows wider.\n base: \"inline-flex min-w-[1.426em] justify-center gap-[0.1em] -my-0.5 px-[0.22em] py-[0.088em] whitespace-nowrap tabular-nums rounded-sm font-system text-xs/tight text-ink-muted\",\n\n variants: {\n variant: {\n soft: \"bg-fill-subtle\",\n // The letters alone, for the end of a menu row, where a column of caps would outweigh the\n // labels it annotates. The square minimum width still lines the letters up.\n plain: \"\",\n // An outline only, with no fill: a cap sits beside a label in a tooltip, a field or help\n // text, where a filled box would outweigh the words around it.\n // Its border adds 2px to the height, so the width takes the same to keep a letter cap square.\n outline: \"min-w-[calc(1.426em+2px)] border\",\n },\n },\n\n defaultVariants: {\n variant: \"outline\",\n },\n})\n\ntype KbdProps = ComponentProps<\"kbd\"> &\n VariantProps<typeof kbdVariants> & {\n meta?: boolean\n shift?: boolean\n alt?: boolean\n ctrl?: boolean\n }\n\nexport function Kbd({ children, className, variant, meta, shift, alt, ctrl, ...props }: KbdProps) {\n return (\n <kbd className={kbdVariants({ variant, className })} {...props}>\n {shift && <span>⇧</span>}\n {meta && <span>⌘</span>}\n {alt && <span>⌥</span>}\n {ctrl && <span>⌃</span>}\n {/* `contents`, so a caller passing its own parts (see `ShortcutKeys`) gets them spaced by\n the gap above rather than run together inside one box */}\n {children && <span className=\"contents\">{children}</span>}\n </kbd>\n )\n}\n"],"mappings":";;;AAGA,MAAM,cAAc,SAAS;CAM3B,MAAM;CAEN,UAAU,EACR,SAAS;EACP,MAAM;EAGN,OAAO;EAIP,SAAS;CACX,EACF;CAEA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAUD,SAAgB,IAAI,EAAE,UAAU,WAAW,SAAS,MAAM,OAAO,KAAK,MAAM,GAAG,SAAmB;CAChG,OACE,qBAAC,OAAD;EAAK,WAAW,YAAY;GAAE;GAAS;EAAU,CAAC;EAAG,GAAI;EAAzD,UAAA;GACG,SAAS,oBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;GACtB,QAAQ,oBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;GACrB,OAAO,oBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;GACpB,QAAQ,oBAAC,QAAD,EAAA,UAAM,IAAO,CAAA;GAGrB,YAAY,oBAAC,QAAD;IAAM,WAAU;IAAY;GAAe,CAAA;EACrD;;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from "../lib/variants.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
declare const labelVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
isRequired: {
|
|
5
|
+
true: string;
|
|
6
|
+
};
|
|
7
|
+
}, undefined, "self-start text-sm font-medium text-ink [&[for]]:cursor-pointer", undefined, undefined, undefined>;
|
|
8
|
+
type LabelProps = ComponentProps<"label"> & VariantProps<typeof labelVariants>;
|
|
9
|
+
declare function Label({ className, isRequired, ...props }: LabelProps): import("react").JSX.Element;
|
|
10
|
+
export { Label };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { variants } from "../lib/variants.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/label.tsx
|
|
5
|
+
const labelVariants = variants({
|
|
6
|
+
base: "self-start text-sm font-medium text-ink [&[for]]:cursor-pointer",
|
|
7
|
+
variants: { isRequired: { true: "after:ml-0.5 after:text-danger-ink after:content-['*'_/_'']" } }
|
|
8
|
+
});
|
|
9
|
+
function Label({ className, isRequired, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("label", {
|
|
11
|
+
className: labelVariants({
|
|
12
|
+
isRequired,
|
|
13
|
+
className
|
|
14
|
+
}),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { Label };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","names":[],"sources":["../../src/components/label.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ComponentProps } from \"react\"\nimport { variants, type VariantProps } from \"../lib/variants\"\n\nconst labelVariants = variants({\n base: \"self-start text-sm font-medium text-ink [&[for]]:cursor-pointer\",\n\n variants: {\n isRequired: {\n // The empty alternative text after the slash keeps a screen reader from reading the star.\n true: \"after:ml-0.5 after:text-danger-ink after:content-['*'_/_'']\",\n },\n },\n})\n\ntype LabelProps = ComponentProps<\"label\"> & VariantProps<typeof labelVariants>\n\nfunction Label({ className, isRequired, ...props }: LabelProps) {\n // oxlint-disable-next-line jsx-a11y/label-has-associated-control -- htmlFor is supplied by callers (e.g. FormLabel)\n return <label className={labelVariants({ isRequired, className })} {...props} />\n}\n\nexport { Label }\n"],"mappings":";;;;AAKA,MAAM,gBAAgB,SAAS;CAC7B,MAAM;CAEN,UAAU,EACR,YAAY,EAEV,MAAM,8DACR,EACF;AACF,CAAC;AAID,SAAS,MAAM,EAAE,WAAW,YAAY,GAAG,SAAqB;CAE9D,OAAO,oBAAC,SAAD;EAAO,WAAW,cAAc;GAAE;GAAY;EAAU,CAAC;EAAG,GAAI;CAAQ,CAAA;AACjF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Kbd } from "./kbd.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
4
|
+
/**
|
|
5
|
+
* Not modal: the page keeps scrolling under an open menu, and one press outside both closes it
|
|
6
|
+
* and reaches what is underneath, so moving to the next control takes one click. Base UI's own
|
|
7
|
+
* default is modal.
|
|
8
|
+
*/
|
|
9
|
+
declare function Menu<Payload>(props: Menu$1.Root.Props<Payload>): import("react").JSX.Element;
|
|
10
|
+
declare const MenuTrigger: Menu$1.Trigger;
|
|
11
|
+
declare const MenuGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").MenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const MenuRadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react").MenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
interface MenuContentProps extends Menu$1.Popup.Props, Pick<Menu$1.Positioner.Props, "align" | "side" | "sideOffset"> {
|
|
14
|
+
/** Names the menu for a screen reader: the popup's accessible name. */
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The menu, hanging off its trigger at every width. A menu is a quick pick, so on a phone it
|
|
19
|
+
* opens where the finger already is instead of rising from the bottom edge; only a dialog, which
|
|
20
|
+
* is a task of its own, becomes a sheet.
|
|
21
|
+
*/
|
|
22
|
+
declare function MenuContent({ className, sideOffset, align, side, label, children, onKeyDownCapture, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
23
|
+
interface MenuItemProps extends Menu$1.Item.Props {
|
|
24
|
+
inset?: boolean;
|
|
25
|
+
/** An item that deletes or gives something away, set in the danger tone. */
|
|
26
|
+
danger?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Why the item cannot run. It stays in the menu, disabled but reachable with the arrow keys,
|
|
29
|
+
* and the reason is read with it and shown in a tooltip, which a tap opens too.
|
|
30
|
+
*/
|
|
31
|
+
disabledReason?: string;
|
|
32
|
+
}
|
|
33
|
+
declare function MenuItem({ className, inset, danger, disabled, disabledReason, onPointerUp, children, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
34
|
+
declare function MenuCheckboxItem({ className, children, checked, shortcut, ...props }: Menu$1.CheckboxItem.Props & {
|
|
35
|
+
/** A `MenuShortcut` for the item, drawn after the check slot. */
|
|
36
|
+
shortcut?: ReactNode;
|
|
37
|
+
}): import("react").JSX.Element;
|
|
38
|
+
declare function MenuRadioItem({ className, children, shortcut, ...props }: Menu$1.RadioItem.Props & {
|
|
39
|
+
/** A `MenuShortcut` for the item, drawn after the check slot. */
|
|
40
|
+
shortcut?: ReactNode;
|
|
41
|
+
}): import("react").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* A few short choices on one line, drawn as a segmented row inside a menu row: a chart's bucket
|
|
44
|
+
* size under its range presets. Its options are radio items of the menu, so the arrow keys reach
|
|
45
|
+
* them like any other row and the menu's opening focus never lands on one, which a plain
|
|
46
|
+
* `SegmentedControl` would take. The pill slides between them as it does in that control.
|
|
47
|
+
*/
|
|
48
|
+
declare function MenuSegmentedGroup({ className, children, ...props }: Menu$1.RadioGroup.Props): import("react").JSX.Element;
|
|
49
|
+
/** One option in a `MenuSegmentedGroup`; its children are its label. Picking it leaves the menu open. */
|
|
50
|
+
declare function MenuSegmentedItem({ className, ...props }: Menu$1.RadioItem.Props): import("react").JSX.Element;
|
|
51
|
+
interface MenuGroupHeaderProps {
|
|
52
|
+
/** The group's heading, drawn as its `MenuGroupLabel`. */
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
/** An icon-only `MenuItem` at the heading's end, the group's own action. */
|
|
55
|
+
action?: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A section's heading, in the secondary ink so it reads above the muted group labels inside it,
|
|
59
|
+
* with an optional action beside it, such as a plus that adds to the section. The action is a
|
|
60
|
+
* real menu item, so arrow keys reach it; the label stays text alone.
|
|
61
|
+
*/
|
|
62
|
+
declare function MenuGroupHeader({ label, action }: MenuGroupHeaderProps): import("react").JSX.Element;
|
|
63
|
+
declare function MenuGroupLabel({ className, inset, ...props }: Menu$1.GroupLabel.Props & {
|
|
64
|
+
inset?: boolean;
|
|
65
|
+
}): import("react").JSX.Element;
|
|
66
|
+
declare function MenuSeparator({ className, ...props }: Menu$1.Separator.Props): import("react").JSX.Element;
|
|
67
|
+
/**
|
|
68
|
+
* A muted note under a menu's rows, such as what its choices apply to. Capped so a long note
|
|
69
|
+
* wraps instead of widening the menu.
|
|
70
|
+
*/
|
|
71
|
+
declare function MenuNote({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* A row's shortcut: the letters alone, so a column of them does not outweigh the labels. A key
|
|
74
|
+
* written as text is named in `data-shortcut`, so the open menu picks the row when it is pressed.
|
|
75
|
+
*/
|
|
76
|
+
declare function MenuShortcut({ className, children, ...props }: ComponentProps<typeof Kbd>): import("react").JSX.Element;
|
|
77
|
+
export { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupHeader, MenuGroupLabel, MenuItem, MenuNote, MenuRadioGroup, MenuRadioItem, MenuSegmentedGroup, MenuSegmentedItem, MenuSeparator, MenuShortcut, MenuTrigger };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { popoverAnimationClasses, popupBackdropClasses, popupGroupLabelClasses, popupItemClasses, popupSeparatorClasses, popupSurfaceClasses } from "../lib/classes.js";
|
|
3
|
+
import { CheckIcon } from "../lib/icons.js";
|
|
4
|
+
import { SEGMENTED_INDICATOR_BOX, SEGMENTED_UNMEASURED_KEY, segmentedVariants, useSegmentedIndicator } from "../lib/segmented.js";
|
|
5
|
+
import { findShortcutRow, toHotkey } from "../lib/shortcuts.js";
|
|
6
|
+
import { cn } from "../lib/variants.js";
|
|
7
|
+
import { useDisabledReason } from "./disabled-reason.js";
|
|
8
|
+
import { Kbd } from "./kbd.js";
|
|
9
|
+
import { Tooltip } from "./tooltip.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
12
|
+
// src/components/menu.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Not modal: the page keeps scrolling under an open menu, and one press outside both closes it
|
|
15
|
+
* and reaches what is underneath, so moving to the next control takes one click. Base UI's own
|
|
16
|
+
* default is modal.
|
|
17
|
+
*/
|
|
18
|
+
function Menu(props) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Menu$1.Root, {
|
|
20
|
+
modal: false,
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const MenuTrigger = Menu$1.Trigger;
|
|
25
|
+
const MenuGroup = Menu$1.Group;
|
|
26
|
+
const MenuRadioGroup = Menu$1.RadioGroup;
|
|
27
|
+
/**
|
|
28
|
+
* The end of a checkbox or radio row: a 16px check slot, then the shortcut. Only a checked row
|
|
29
|
+
* takes the slot, so an unchecked label runs up to its shortcut; the shortcuts still line up,
|
|
30
|
+
* since the row ends on them. `pl-4` on top of the row's gap is the floor between the label and
|
|
31
|
+
* the shortcut on the widest row of a menu sized to its content.
|
|
32
|
+
*/
|
|
33
|
+
function MenuChoiceTrailing({ indicator, shortcut }) {
|
|
34
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
35
|
+
className: cn("ml-auto flex shrink-0 items-center gap-2", shortcut ? "pl-4" : "group-data-unchecked/choice:hidden"),
|
|
36
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
className: "flex size-4 items-center justify-center text-ink-muted group-data-unchecked/choice:hidden [&_svg]:size-4",
|
|
39
|
+
children: indicator
|
|
40
|
+
}), shortcut]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** A row the menu shows but will not run: disabled, or held by a reason. */
|
|
44
|
+
const DISABLED_ROW_SELECTOR = "[data-disabled],[aria-disabled=\"true\"]";
|
|
45
|
+
/**
|
|
46
|
+
* The menu, hanging off its trigger at every width. A menu is a quick pick, so on a phone it
|
|
47
|
+
* opens where the finger already is instead of rising from the bottom edge; only a dialog, which
|
|
48
|
+
* is a task of its own, becomes a sheet.
|
|
49
|
+
*/
|
|
50
|
+
function MenuContent({ className, sideOffset = 6, align, side, label, children, onKeyDownCapture, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsxs(Menu$1.Portal, { children: [/* @__PURE__ */ jsx(Menu$1.Backdrop, { className: popupBackdropClasses }), /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
52
|
+
sideOffset,
|
|
53
|
+
align,
|
|
54
|
+
side,
|
|
55
|
+
className: "isolate z-50",
|
|
56
|
+
children: /* @__PURE__ */ jsx(Menu$1.Popup, {
|
|
57
|
+
"aria-label": label,
|
|
58
|
+
className: cn(popupSurfaceClasses, "flex max-h-(--available-height) min-w-[max(10rem,var(--anchor-width))] flex-col overflow-y-auto overscroll-contain p-1 outline-none", popoverAnimationClasses, className),
|
|
59
|
+
onKeyDownCapture: (event) => {
|
|
60
|
+
onKeyDownCapture?.(event);
|
|
61
|
+
const row = findShortcutRow(event.currentTarget, event);
|
|
62
|
+
if (!row) return;
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
if (!row.matches(DISABLED_ROW_SELECTOR)) row.click();
|
|
66
|
+
},
|
|
67
|
+
...props,
|
|
68
|
+
children
|
|
69
|
+
})
|
|
70
|
+
})] });
|
|
71
|
+
}
|
|
72
|
+
function MenuItem({ className, inset, danger, disabled, disabledReason, onPointerUp, children, ...props }) {
|
|
73
|
+
const reason = useDisabledReason(disabledReason, props["aria-describedby"]);
|
|
74
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
75
|
+
id: reason.triggerId,
|
|
76
|
+
tooltip: disabledReason,
|
|
77
|
+
side: "left",
|
|
78
|
+
children: /* @__PURE__ */ jsxs(Menu$1.Item, {
|
|
79
|
+
...props,
|
|
80
|
+
disabled: disabled === true || !!disabledReason,
|
|
81
|
+
"aria-describedby": reason.describedBy,
|
|
82
|
+
onPointerUp: (event) => {
|
|
83
|
+
onPointerUp?.(event);
|
|
84
|
+
reason.onPointerUp(event);
|
|
85
|
+
},
|
|
86
|
+
className: cn(popupItemClasses, "relative m-0 gap-2 px-2 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", danger && "text-danger-ink focus:text-danger-ink data-highlighted:text-danger-ink", className),
|
|
87
|
+
children: [children, reason.reasonText]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function MenuCheckboxItem({ className, children, checked, shortcut, ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsxs(Menu$1.CheckboxItem, {
|
|
93
|
+
className: cn(popupItemClasses, "group/choice gap-2 px-2 data-checked:text-ink", className),
|
|
94
|
+
checked,
|
|
95
|
+
...props,
|
|
96
|
+
children: [children, /* @__PURE__ */ jsx(MenuChoiceTrailing, {
|
|
97
|
+
indicator: /* @__PURE__ */ jsx(Menu$1.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
98
|
+
shortcut
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function MenuRadioItem({ className, children, shortcut, ...props }) {
|
|
103
|
+
return /* @__PURE__ */ jsxs(Menu$1.RadioItem, {
|
|
104
|
+
className: cn(popupItemClasses, "group/choice gap-2 px-2 data-checked:text-ink", className),
|
|
105
|
+
...props,
|
|
106
|
+
children: [children, /* @__PURE__ */ jsx(MenuChoiceTrailing, {
|
|
107
|
+
indicator: /* @__PURE__ */ jsx(Menu$1.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
108
|
+
shortcut
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const SEGMENTED = segmentedVariants({ size: "xs" });
|
|
113
|
+
/**
|
|
114
|
+
* A few short choices on one line, drawn as a segmented row inside a menu row: a chart's bucket
|
|
115
|
+
* size under its range presets. Its options are radio items of the menu, so the arrow keys reach
|
|
116
|
+
* them like any other row and the menu's opening focus never lands on one, which a plain
|
|
117
|
+
* `SegmentedControl` would take. The pill slides between them as it does in that control.
|
|
118
|
+
*/
|
|
119
|
+
function MenuSegmentedGroup({ className, children, ...props }) {
|
|
120
|
+
const ref = useSegmentedIndicator(props.value);
|
|
121
|
+
return /* @__PURE__ */ jsxs(Menu$1.RadioGroup, {
|
|
122
|
+
ref,
|
|
123
|
+
className: cn(SEGMENTED.root(), SEGMENTED_UNMEASURED_KEY, className),
|
|
124
|
+
...props,
|
|
125
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
126
|
+
"aria-hidden": true,
|
|
127
|
+
className: SEGMENTED.indicator({ className: SEGMENTED_INDICATOR_BOX })
|
|
128
|
+
}), children]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** One option in a `MenuSegmentedGroup`; its children are its label. Picking it leaves the menu open. */
|
|
132
|
+
function MenuSegmentedItem({ className, ...props }) {
|
|
133
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioItem, {
|
|
134
|
+
className: cn(SEGMENTED.item(), "cursor-pointer select-none data-checked:text-ink data-highlighted:text-ink", className),
|
|
135
|
+
...props
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A section's heading, in the secondary ink so it reads above the muted group labels inside it,
|
|
140
|
+
* with an optional action beside it, such as a plus that adds to the section. The action is a
|
|
141
|
+
* real menu item, so arrow keys reach it; the label stays text alone.
|
|
142
|
+
*/
|
|
143
|
+
function MenuGroupHeader({ label, action }) {
|
|
144
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: "flex items-center gap-1 pr-1",
|
|
146
|
+
children: [/* @__PURE__ */ jsx(MenuGroupLabel, {
|
|
147
|
+
className: "flex-1 text-ink-secondary",
|
|
148
|
+
children: label
|
|
149
|
+
}), action]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function MenuGroupLabel({ className, inset, ...props }) {
|
|
153
|
+
return /* @__PURE__ */ jsx(Menu$1.GroupLabel, {
|
|
154
|
+
className: cn(popupGroupLabelClasses, inset && "pl-8", className),
|
|
155
|
+
...props
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function MenuSeparator({ className, ...props }) {
|
|
159
|
+
return /* @__PURE__ */ jsx(Menu$1.Separator, {
|
|
160
|
+
className: cn(popupSeparatorClasses, className),
|
|
161
|
+
...props
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A muted note under a menu's rows, such as what its choices apply to. Capped so a long note
|
|
166
|
+
* wraps instead of widening the menu.
|
|
167
|
+
*/
|
|
168
|
+
function MenuNote({ className, ...props }) {
|
|
169
|
+
return /* @__PURE__ */ jsx("p", {
|
|
170
|
+
className: cn("max-w-60 px-2 py-1.5 text-ink-muted text-xs", className),
|
|
171
|
+
...props
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A row's shortcut: the letters alone, so a column of them does not outweigh the labels. A key
|
|
176
|
+
* written as text is named in `data-shortcut`, so the open menu picks the row when it is pressed.
|
|
177
|
+
*/
|
|
178
|
+
function MenuShortcut({ className, children, ...props }) {
|
|
179
|
+
return /* @__PURE__ */ jsx(Kbd, {
|
|
180
|
+
"data-shortcut": typeof children === "string" ? toHotkey(children) : void 0,
|
|
181
|
+
variant: "plain",
|
|
182
|
+
className: cn("ml-auto pointer-coarse:hidden", className),
|
|
183
|
+
...props,
|
|
184
|
+
children
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
export { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupHeader, MenuGroupLabel, MenuItem, MenuNote, MenuRadioGroup, MenuRadioItem, MenuSegmentedGroup, MenuSegmentedItem, MenuSeparator, MenuShortcut, MenuTrigger };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.js","names":["MenuPrimitive"],"sources":["../../src/components/menu.tsx"],"sourcesContent":["\"use client\"\n\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\"\nimport type { ComponentProps, ReactNode } from \"react\"\nimport {\n POPUP_SIDE_OFFSET,\n popoverAnimationClasses,\n popupBackdropClasses,\n popupGroupLabelClasses,\n popupItemClasses,\n popupSeparatorClasses,\n popupSurfaceClasses,\n} from \"../lib/classes\"\nimport { CheckIcon } from \"../lib/icons\"\nimport {\n SEGMENTED_INDICATOR_BOX,\n SEGMENTED_UNMEASURED_KEY,\n segmentedVariants,\n useSegmentedIndicator,\n} from \"../lib/segmented\"\nimport { findShortcutRow, toHotkey } from \"../lib/shortcuts\"\nimport { cn } from \"../lib/variants\"\nimport { useDisabledReason } from \"./disabled-reason\"\nimport { Kbd } from \"./kbd\"\nimport { Tooltip } from \"./tooltip\"\n\n/**\n * Not modal: the page keeps scrolling under an open menu, and one press outside both closes it\n * and reaches what is underneath, so moving to the next control takes one click. Base UI's own\n * default is modal.\n */\nfunction Menu<Payload>(props: MenuPrimitive.Root.Props<Payload>) {\n return <MenuPrimitive.Root modal={false} {...props} />\n}\n\nconst MenuTrigger = MenuPrimitive.Trigger\nconst MenuGroup = MenuPrimitive.Group\nconst MenuRadioGroup = MenuPrimitive.RadioGroup\n\ninterface MenuChoiceTrailingProps {\n indicator: ReactNode\n shortcut?: ReactNode\n}\n\n/**\n * The end of a checkbox or radio row: a 16px check slot, then the shortcut. Only a checked row\n * takes the slot, so an unchecked label runs up to its shortcut; the shortcuts still line up,\n * since the row ends on them. `pl-4` on top of the row's gap is the floor between the label and\n * the shortcut on the widest row of a menu sized to its content.\n */\nfunction MenuChoiceTrailing({ indicator, shortcut }: MenuChoiceTrailingProps) {\n return (\n <span\n className={cn(\n \"ml-auto flex shrink-0 items-center gap-2\",\n shortcut ? \"pl-4\" : \"group-data-unchecked/choice:hidden\",\n )}\n >\n <span\n aria-hidden\n className=\"flex size-4 items-center justify-center text-ink-muted group-data-unchecked/choice:hidden [&_svg]:size-4\"\n >\n {indicator}\n </span>\n {shortcut}\n </span>\n )\n}\n\n/** A row the menu shows but will not run: disabled, or held by a reason. */\nconst DISABLED_ROW_SELECTOR = '[data-disabled],[aria-disabled=\"true\"]'\n\ninterface MenuContentProps\n extends\n MenuPrimitive.Popup.Props,\n Pick<MenuPrimitive.Positioner.Props, \"align\" | \"side\" | \"sideOffset\"> {\n /** Names the menu for a screen reader: the popup's accessible name. */\n label?: string\n}\n\n/**\n * The menu, hanging off its trigger at every width. A menu is a quick pick, so on a phone it\n * opens where the finger already is instead of rising from the bottom edge; only a dialog, which\n * is a task of its own, becomes a sheet.\n */\nfunction MenuContent({\n className,\n sideOffset = POPUP_SIDE_OFFSET,\n align,\n side,\n label,\n children,\n onKeyDownCapture,\n ...props\n}: MenuContentProps) {\n return (\n <MenuPrimitive.Portal>\n <MenuPrimitive.Backdrop className={popupBackdropClasses} />\n <MenuPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n side={side}\n className=\"isolate z-50\"\n >\n <MenuPrimitive.Popup\n aria-label={label}\n // As wide as the trigger it hangs off, and wider only if a row needs it: a fixed width\n // leaves dead space after every label and a gulf between a label and its shortcut.\n // The cap keeps a tall menu inside the room the screen has on its side of the trigger.\n className={cn(\n popupSurfaceClasses,\n \"flex max-h-(--available-height) min-w-[max(10rem,var(--anchor-width))] flex-col overflow-y-auto overscroll-contain p-1 outline-none\",\n popoverAnimationClasses,\n className,\n )}\n // The key printed beside a row picks that row, as a click would, before the typeahead\n // can read it as the first letter of another row's label.\n onKeyDownCapture={event => {\n onKeyDownCapture?.(event)\n const row = findShortcutRow(event.currentTarget, event)\n if (!row) return\n event.preventDefault()\n event.stopPropagation()\n if (!row.matches(DISABLED_ROW_SELECTOR)) row.click()\n }}\n {...props}\n >\n {children}\n </MenuPrimitive.Popup>\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\ninterface MenuItemProps extends MenuPrimitive.Item.Props {\n inset?: boolean\n /** An item that deletes or gives something away, set in the danger tone. */\n danger?: boolean\n /**\n * Why the item cannot run. It stays in the menu, disabled but reachable with the arrow keys,\n * and the reason is read with it and shown in a tooltip, which a tap opens too.\n */\n disabledReason?: string\n}\n\nfunction MenuItem({\n className,\n inset,\n danger,\n disabled,\n disabledReason,\n onPointerUp,\n children,\n ...props\n}: MenuItemProps) {\n const reason = useDisabledReason(disabledReason, props[\"aria-describedby\"])\n\n return (\n // Beside the menu, so it covers no other row; it flips to the other side without room.\n <Tooltip id={reason.triggerId} tooltip={disabledReason} side=\"left\">\n <MenuPrimitive.Item\n // First, so the caller's description and pointer-up merge with the reason's.\n {...props}\n disabled={disabled === true || !!disabledReason}\n aria-describedby={reason.describedBy}\n onPointerUp={event => {\n onPointerUp?.(event)\n reason.onPointerUp(event)\n }}\n className={cn(\n popupItemClasses,\n \"relative m-0 gap-2 px-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n inset && \"pl-8\",\n danger && \"text-danger-ink focus:text-danger-ink data-highlighted:text-danger-ink\",\n className,\n )}\n >\n {children}\n {reason.reasonText}\n </MenuPrimitive.Item>\n </Tooltip>\n )\n}\n\nfunction MenuCheckboxItem({\n className,\n children,\n checked,\n shortcut,\n ...props\n}: MenuPrimitive.CheckboxItem.Props & {\n /** A `MenuShortcut` for the item, drawn after the check slot. */\n shortcut?: ReactNode\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n className={cn(popupItemClasses, \"group/choice gap-2 px-2 data-checked:text-ink\", className)}\n checked={checked}\n {...props}\n >\n {children}\n <MenuChoiceTrailing\n indicator={\n <MenuPrimitive.CheckboxItemIndicator>\n <CheckIcon />\n </MenuPrimitive.CheckboxItemIndicator>\n }\n shortcut={shortcut}\n />\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction MenuRadioItem({\n className,\n children,\n shortcut,\n ...props\n}: MenuPrimitive.RadioItem.Props & {\n /** A `MenuShortcut` for the item, drawn after the check slot. */\n shortcut?: ReactNode\n}) {\n return (\n <MenuPrimitive.RadioItem\n className={cn(popupItemClasses, \"group/choice gap-2 px-2 data-checked:text-ink\", className)}\n {...props}\n >\n {children}\n <MenuChoiceTrailing\n indicator={\n <MenuPrimitive.RadioItemIndicator>\n <CheckIcon />\n </MenuPrimitive.RadioItemIndicator>\n }\n shortcut={shortcut}\n />\n </MenuPrimitive.RadioItem>\n )\n}\n\nconst SEGMENTED = segmentedVariants({ size: \"xs\" })\n\n/**\n * A few short choices on one line, drawn as a segmented row inside a menu row: a chart's bucket\n * size under its range presets. Its options are radio items of the menu, so the arrow keys reach\n * them like any other row and the menu's opening focus never lands on one, which a plain\n * `SegmentedControl` would take. The pill slides between them as it does in that control.\n */\nfunction MenuSegmentedGroup({ className, children, ...props }: MenuPrimitive.RadioGroup.Props) {\n const ref = useSegmentedIndicator(props.value)\n\n return (\n <MenuPrimitive.RadioGroup\n ref={ref}\n className={cn(SEGMENTED.root(), SEGMENTED_UNMEASURED_KEY, className)}\n {...props}\n >\n <span aria-hidden className={SEGMENTED.indicator({ className: SEGMENTED_INDICATOR_BOX })} />\n {children}\n </MenuPrimitive.RadioGroup>\n )\n}\n\n/** One option in a `MenuSegmentedGroup`; its children are its label. Picking it leaves the menu open. */\nfunction MenuSegmentedItem({ className, ...props }: MenuPrimitive.RadioItem.Props) {\n return (\n <MenuPrimitive.RadioItem\n className={cn(\n SEGMENTED.item(),\n \"cursor-pointer select-none data-checked:text-ink data-highlighted:text-ink\",\n className,\n )}\n {...props}\n />\n )\n}\n\ninterface MenuGroupHeaderProps {\n /** The group's heading, drawn as its `MenuGroupLabel`. */\n label: ReactNode\n /** An icon-only `MenuItem` at the heading's end, the group's own action. */\n action?: ReactNode\n}\n\n/**\n * A section's heading, in the secondary ink so it reads above the muted group labels inside it,\n * with an optional action beside it, such as a plus that adds to the section. The action is a\n * real menu item, so arrow keys reach it; the label stays text alone.\n */\nfunction MenuGroupHeader({ label, action }: MenuGroupHeaderProps) {\n return (\n <div className=\"flex items-center gap-1 pr-1\">\n <MenuGroupLabel className=\"flex-1 text-ink-secondary\">{label}</MenuGroupLabel>\n {action}\n </div>\n )\n}\n\nfunction MenuGroupLabel({\n className,\n inset,\n ...props\n}: MenuPrimitive.GroupLabel.Props & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.GroupLabel\n className={cn(popupGroupLabelClasses, inset && \"pl-8\", className)}\n {...props}\n />\n )\n}\n\nfunction MenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {\n return <MenuPrimitive.Separator className={cn(popupSeparatorClasses, className)} {...props} />\n}\n\n/**\n * A muted note under a menu's rows, such as what its choices apply to. Capped so a long note\n * wraps instead of widening the menu.\n */\nfunction MenuNote({ className, ...props }: ComponentProps<\"p\">) {\n return <p className={cn(\"max-w-60 px-2 py-1.5 text-ink-muted text-xs\", className)} {...props} />\n}\n\n/**\n * A row's shortcut: the letters alone, so a column of them does not outweigh the labels. A key\n * written as text is named in `data-shortcut`, so the open menu picks the row when it is pressed.\n */\nfunction MenuShortcut({ className, children, ...props }: ComponentProps<typeof Kbd>) {\n return (\n <Kbd\n data-shortcut={typeof children === \"string\" ? toHotkey(children) : undefined}\n variant=\"plain\"\n className={cn(\"ml-auto pointer-coarse:hidden\", className)}\n {...props}\n >\n {children}\n </Kbd>\n )\n}\n\nexport {\n Menu,\n MenuCheckboxItem,\n MenuContent,\n MenuGroup,\n MenuItem,\n MenuGroupHeader,\n MenuGroupLabel,\n MenuNote,\n MenuRadioGroup,\n MenuRadioItem,\n MenuSegmentedGroup,\n MenuSegmentedItem,\n MenuSeparator,\n MenuShortcut,\n MenuTrigger,\n}\n"],"mappings":"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"}
|