@nsaa/core 0.1.0-alpha.1 → 0.1.0-alpha.2
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/dist/accordion/accordion.d.ts +7 -0
- package/dist/accordion/accordion.js +54 -0
- package/dist/accordion/index.d.ts +3 -0
- package/dist/alert/alert.d.ts +18 -0
- package/dist/alert/alert.js +53 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert-dialog/alert-dialog.d.ts +19 -0
- package/dist/alert-dialog/alert-dialog.js +100 -0
- package/dist/alert-dialog/index.d.ts +3 -0
- package/dist/avatar/avatar.d.ts +12 -0
- package/dist/avatar/avatar.js +50 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/badge/badge.d.ts +8 -0
- package/dist/badge/badge.js +29 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/button/button.d.ts +25 -0
- package/dist/button/button.js +136 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/calendar/calendar.d.ts +11 -0
- package/dist/calendar/calendar.js +131 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/card/card.d.ts +12 -0
- package/dist/card/card.js +55 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/checkbox/checkbox.d.ts +4 -0
- package/dist/checkbox/checkbox.js +35 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/collapsible/collapsible.d.ts +6 -0
- package/dist/collapsible/collapsible.js +24 -0
- package/dist/collapsible/index.d.ts +3 -0
- package/dist/combobox/combobox.d.ts +27 -0
- package/dist/combobox/combobox.js +226 -0
- package/dist/combobox/index.d.ts +3 -0
- package/dist/command/command.d.ts +20 -0
- package/dist/command/command.js +116 -0
- package/dist/command/index.d.ts +3 -0
- package/dist/context-menu/context-menu.d.ts +30 -0
- package/dist/context-menu/context-menu.js +173 -0
- package/dist/context-menu/index.d.ts +3 -0
- package/dist/dialog/dialog.d.ts +18 -0
- package/dist/dialog/dialog.js +106 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/direction.d.ts +3 -0
- package/dist/direction.js +2 -0
- package/dist/drawer/drawer.d.ts +17 -0
- package/dist/drawer/drawer.js +136 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/dropdown-menu/dropdown-menu.d.ts +30 -0
- package/dist/dropdown-menu/dropdown-menu.js +177 -0
- package/dist/dropdown-menu/index.d.ts +3 -0
- package/dist/empty/empty.d.ts +35 -0
- package/dist/empty/empty.js +93 -0
- package/dist/empty/index.d.ts +3 -0
- package/dist/field/field.d.ts +26 -0
- package/dist/field/field.js +109 -0
- package/dist/field/index.d.ts +3 -0
- package/dist/index.d.ts +89 -674
- package/dist/index.js +48 -3876
- package/dist/input/index.d.ts +3 -0
- package/dist/input/input.d.ts +4 -0
- package/dist/input/input.js +14 -0
- package/dist/input-group/index.d.ts +3 -0
- package/dist/input-group/input-group.d.ts +19 -0
- package/dist/input-group/input-group.js +78 -0
- package/dist/input-otp/index.d.ts +3 -0
- package/dist/input-otp/input-otp.d.ts +12 -0
- package/dist/input-otp/input-otp.js +73 -0
- package/dist/kbd/index.d.ts +3 -0
- package/dist/kbd/kbd.d.ts +5 -0
- package/dist/kbd/kbd.js +19 -0
- package/dist/label/index.d.ts +3 -0
- package/dist/label/label.d.ts +4 -0
- package/dist/label/label.js +13 -0
- package/dist/legacy/icon-button/icon-swap.js +58 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/{cn-DxFBFdwT.js → lib/cn.js} +1 -1
- package/dist/lib/control-defaults.js +8 -0
- package/dist/lib/icon-swap.d.ts +15 -0
- package/dist/lib/icon-swap.js +26 -0
- package/dist/lib/input-modality.js +39 -0
- package/dist/lib/merge-refs.js +21 -0
- package/dist/lib/shortcut.js +50 -0
- package/dist/lib/track-input-modality.d.ts +2 -0
- package/dist/lib/track-input-modality.js +4 -0
- package/dist/lib/tv.js +7 -0
- package/dist/lib/use-press.js +48 -0
- package/dist/lib/user-action.js +13 -0
- package/dist/loaders/arc.d.ts +6 -0
- package/dist/loaders/arc.js +31 -0
- package/dist/loaders/atom.d.ts +5 -0
- package/dist/loaders/atom.js +70 -0
- package/dist/loaders/blocks.d.ts +8 -0
- package/dist/loaders/blocks.js +74 -0
- package/dist/loaders/bouncing-dots.d.ts +3 -0
- package/dist/loaders/bouncing-dots.js +45 -0
- package/dist/loaders/cap.d.ts +6 -0
- package/dist/loaders/cap.js +7 -0
- package/dist/loaders/cascade.d.ts +5 -0
- package/dist/loaders/cascade.js +50 -0
- package/dist/loaders/circular-dots.d.ts +3 -0
- package/dist/loaders/circular-dots.js +40 -0
- package/dist/loaders/classic-v2.d.ts +3 -0
- package/dist/loaders/classic-v2.js +41 -0
- package/dist/loaders/classic.d.ts +3 -0
- package/dist/loaders/classic.js +48 -0
- package/dist/loaders/clock.d.ts +5 -0
- package/dist/loaders/clock.js +31 -0
- package/dist/loaders/comet.d.ts +5 -0
- package/dist/loaders/comet.js +52 -0
- package/dist/loaders/compass.d.ts +3 -0
- package/dist/loaders/compass.js +39 -0
- package/dist/loaders/dual.d.ts +6 -0
- package/dist/loaders/dual.js +47 -0
- package/dist/loaders/easing.d.ts +6 -0
- package/dist/loaders/easing.js +34 -0
- package/dist/loaders/eclipse.d.ts +3 -0
- package/dist/loaders/eclipse.js +69 -0
- package/dist/loaders/fade.js +28 -0
- package/dist/loaders/flip.d.ts +3 -0
- package/dist/loaders/flip.js +41 -0
- package/dist/{frame-CK9IBOZB.js → loaders/frame.js} +2 -50
- package/dist/loaders/gather.d.ts +3 -0
- package/dist/loaders/gather.js +85 -0
- package/dist/loaders/leap.d.ts +3 -0
- package/dist/loaders/leap.js +67 -0
- package/dist/loaders/linear-dots.d.ts +3 -0
- package/dist/loaders/linear-dots.js +54 -0
- package/dist/loaders/loading.d.ts +3 -0
- package/dist/loaders/loading.js +64 -0
- package/dist/loaders/morph.d.ts +3 -0
- package/dist/loaders/morph.js +40 -0
- package/dist/loaders/motion.d.ts +35 -0
- package/dist/loaders/motion.js +51 -0
- package/dist/loaders/orbit.d.ts +5 -0
- package/dist/loaders/orbit.js +44 -0
- package/dist/loaders/pulse.d.ts +3 -0
- package/dist/loaders/pulse.js +52 -0
- package/dist/loaders/radar.d.ts +5 -0
- package/dist/loaders/radar.js +64 -0
- package/dist/loaders/ring.d.ts +6 -0
- package/dist/loaders/ring.js +38 -0
- package/dist/loaders/ripple.d.ts +8 -0
- package/dist/loaders/ripple.js +57 -0
- package/dist/loaders/slide.d.ts +3 -0
- package/dist/loaders/slide.js +74 -0
- package/dist/loaders/snake.d.ts +6 -0
- package/dist/loaders/snake.js +59 -0
- package/dist/loaders/spinners.d.ts +61 -0
- package/dist/loaders/spinners.js +63 -0
- package/dist/loaders/swirl.d.ts +3 -0
- package/dist/loaders/swirl.js +50 -0
- package/dist/loaders/text/shared.js +25 -0
- package/dist/loaders/text/text-loaders.d.ts +48 -0
- package/dist/loaders/text/text-loaders.js +723 -0
- package/dist/loaders/trace.d.ts +6 -0
- package/dist/loaders/trace.js +46 -0
- package/dist/loaders/types.d.ts +10 -0
- package/dist/loaders/wave.d.ts +8 -0
- package/dist/loaders/wave.js +59 -0
- package/dist/loaders-text.d.ts +2 -47
- package/dist/loaders-text.js +1 -743
- package/dist/loaders.d.ts +36 -132
- package/dist/loaders.js +35 -1096
- package/dist/native-select/index.d.ts +3 -0
- package/dist/native-select/native-select.d.ts +9 -0
- package/dist/native-select/native-select.js +44 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/pagination.d.ts +18 -0
- package/dist/pagination/pagination.js +134 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/popover.d.ts +10 -0
- package/dist/popover/popover.js +54 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/radio-group.d.ts +6 -0
- package/dist/radio-group/radio-group.js +33 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/select.d.ts +16 -0
- package/dist/select/select.js +148 -0
- package/dist/separator/index.d.ts +3 -0
- package/dist/separator/separator.d.ts +4 -0
- package/dist/separator/separator.js +15 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/skeleton.d.ts +10 -0
- package/dist/skeleton/skeleton.js +24 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/slider.d.ts +4 -0
- package/dist/slider/slider.js +39 -0
- package/dist/sound/sound-map.d.ts +70 -0
- package/dist/sound/sound-map.js +72 -0
- package/dist/sound/sound.d.ts +38 -0
- package/dist/sound/sound.js +136 -0
- package/dist/sound/uisfx.d.ts +37 -0
- package/dist/sound/uisfx.js +59 -0
- package/dist/sound-uisfx.d.ts +2 -37
- package/dist/sound-uisfx.js +1 -58
- package/dist/spinner/index.d.ts +5 -0
- package/dist/spinner/loader-provider.d.ts +16 -0
- package/dist/spinner/loader-provider.js +28 -0
- package/dist/spinner/registry.d.ts +9 -0
- package/dist/spinner/registry.js +15 -0
- package/dist/spinner/spinner.d.ts +26 -0
- package/dist/spinner/spinner.js +143 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/switch.d.ts +6 -0
- package/dist/switch/switch.js +25 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/table.d.ts +17 -0
- package/dist/table/table.js +66 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/tabs.d.ts +11 -0
- package/dist/tabs/tabs.js +46 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/textarea.d.ts +4 -0
- package/dist/textarea/textarea.js +12 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/toast.d.ts +17 -0
- package/dist/toast/toast.js +211 -0
- package/dist/toggle-group/index.d.ts +3 -0
- package/dist/toggle-group/toggle-group.d.ts +64 -0
- package/dist/toggle-group/toggle-group.js +95 -0
- package/dist/tokens/dist/motion.d.ts +24 -0
- package/dist/{motion-NQq2BA78.js → tokens/dist/motion.js} +1 -1
- package/dist/toolbar/index.d.ts +3 -0
- package/dist/toolbar/overflow.d.ts +4 -0
- package/dist/toolbar/overflow.js +242 -0
- package/dist/toolbar/toolbar-item.d.ts +29 -0
- package/dist/toolbar/toolbar-item.js +71 -0
- package/dist/toolbar/toolbar.d.ts +73 -0
- package/dist/toolbar/toolbar.js +250 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/tooltip.d.ts +7 -0
- package/dist/tooltip/tooltip.js +41 -0
- package/package.json +4 -3
- package/dist/registry-2PyPW9Xw.js +0 -390
- package/dist/registry-DjfWNw3R.d.ts +0 -18
- package/dist/sound-DiYNAnR_.d.ts +0 -61
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { SoundSilence } from "../sound/sound-map.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../input-group/input-group.js";
|
|
6
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../dialog/dialog.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Command, useCommandState } from "cmdk";
|
|
9
|
+
// src/command/command.tsx
|
|
10
|
+
function Command$1({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Command, {
|
|
12
|
+
"data-slot": "command",
|
|
13
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(SoundSilence, { children: /* @__PURE__ */ jsxs(Dialog, {
|
|
19
|
+
...props,
|
|
20
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
21
|
+
className: "sr-only",
|
|
22
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
23
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
24
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
25
|
+
showCloseButton,
|
|
26
|
+
children
|
|
27
|
+
})]
|
|
28
|
+
}) });
|
|
29
|
+
}
|
|
30
|
+
function CommandInput({ className, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", {
|
|
32
|
+
"data-slot": "command-input-wrapper",
|
|
33
|
+
className: "p-1 pb-0",
|
|
34
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
35
|
+
className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",
|
|
36
|
+
children: [/* @__PURE__ */ jsx(Command.Input, {
|
|
37
|
+
"data-slot": "command-input",
|
|
38
|
+
className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
39
|
+
...props
|
|
40
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxs("svg", {
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
viewBox: "0 0 24 24",
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: "2",
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeLinejoin: "round",
|
|
48
|
+
className: "size-4 shrink-0 opacity-50",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m21 21-4.34-4.34" }), /* @__PURE__ */ jsx("circle", {
|
|
51
|
+
cx: "11",
|
|
52
|
+
cy: "11",
|
|
53
|
+
r: "8"
|
|
54
|
+
})]
|
|
55
|
+
}) })]
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function CommandList({ className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(Command.List, {
|
|
61
|
+
"data-slot": "command-list",
|
|
62
|
+
className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function CommandEmpty({ className, ...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Command.Empty, {
|
|
68
|
+
"data-slot": "command-empty",
|
|
69
|
+
className: cn("py-6 text-center text-sm", className),
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function CommandGroup({ className, ...props }) {
|
|
74
|
+
return /* @__PURE__ */ jsx(Command.Group, {
|
|
75
|
+
"data-slot": "command-group",
|
|
76
|
+
className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function CommandSeparator({ className, alwaysRender, ...props }) {
|
|
81
|
+
if (useCommandState((state) => state.search !== "") && !alwaysRender) return null;
|
|
82
|
+
return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
role: "none",
|
|
84
|
+
"cmdk-separator": "",
|
|
85
|
+
"data-slot": "command-separator",
|
|
86
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function CommandItem({ className, children, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsxs(Command.Item, {
|
|
92
|
+
"data-slot": "command-item",
|
|
93
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", className),
|
|
94
|
+
...props,
|
|
95
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
96
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
97
|
+
viewBox: "0 0 24 24",
|
|
98
|
+
fill: "none",
|
|
99
|
+
stroke: "currentColor",
|
|
100
|
+
strokeWidth: "2",
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100",
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function CommandShortcut({ className, ...props }) {
|
|
110
|
+
return /* @__PURE__ */ jsx("span", {
|
|
111
|
+
"data-slot": "command-shortcut",
|
|
112
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
113
|
+
...props
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export { Command$1 as Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./command.js";
|
|
3
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
4
|
+
declare function ContextMenu$1({ ...props }: ContextMenu.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function ContextMenuPortal({ ...props }: ContextMenu.Portal.Props): React.JSX.Element;
|
|
6
|
+
declare function ContextMenuTrigger({ className, ...props }: ContextMenu.Trigger.Props): React.JSX.Element;
|
|
7
|
+
declare function ContextMenuContent({ className, align, alignOffset, side, sideOffset, ...props }: ContextMenu.Popup.Props & Pick<ContextMenu.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): React.JSX.Element;
|
|
8
|
+
declare function ContextMenuGroup({ ...props }: ContextMenu.Group.Props): React.JSX.Element;
|
|
9
|
+
declare function ContextMenuLabel({ className, inset, ...props }: ContextMenu.GroupLabel.Props & {
|
|
10
|
+
inset?: boolean;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function ContextMenuItem({ className, inset, variant, ...props }: ContextMenu.Item.Props & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
variant?: "default" | "destructive";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function ContextMenuSub({ ...props }: ContextMenu.SubmenuRoot.Props): React.JSX.Element;
|
|
17
|
+
declare function ContextMenuSubTrigger({ className, inset, children, ...props }: ContextMenu.SubmenuTrigger.Props & {
|
|
18
|
+
inset?: boolean;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function ContextMenuSubContent({ ...props }: React.ComponentProps<typeof ContextMenuContent>): React.JSX.Element;
|
|
21
|
+
declare function ContextMenuCheckboxItem({ className, children, checked, inset, onCheckedChange, ...props }: ContextMenu.CheckboxItem.Props & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function ContextMenuRadioGroup({ onValueChange, ...props }: ContextMenu.RadioGroup.Props): React.JSX.Element;
|
|
25
|
+
declare function ContextMenuRadioItem({ className, children, inset, ...props }: ContextMenu.RadioItem.Props & {
|
|
26
|
+
inset?: boolean;
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
declare function ContextMenuSeparator({ className, ...props }: ContextMenu.Separator.Props): React.JSX.Element;
|
|
29
|
+
declare function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
30
|
+
export { ContextMenu$1 as ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useCue } from "../sound/sound-map.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
7
|
+
// src/context-menu/context-menu.tsx
|
|
8
|
+
function ContextMenu$1({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(ContextMenu.Root, {
|
|
10
|
+
"data-slot": "context-menu",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function ContextMenuPortal({ ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(ContextMenu.Portal, {
|
|
16
|
+
"data-slot": "context-menu-portal",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function ContextMenuTrigger({ className, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(ContextMenu.Trigger, {
|
|
22
|
+
"data-slot": "context-menu-trigger",
|
|
23
|
+
className: cn("select-none", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function ContextMenuContent({ className, align = "start", alignOffset = 4, side = "right", sideOffset = 0, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(ContextMenu.Portal, { children: /* @__PURE__ */ jsx(ContextMenu.Positioner, {
|
|
29
|
+
className: "isolate z-50 outline-none",
|
|
30
|
+
align,
|
|
31
|
+
alignOffset,
|
|
32
|
+
side,
|
|
33
|
+
sideOffset,
|
|
34
|
+
children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
|
|
35
|
+
"data-slot": "context-menu-content",
|
|
36
|
+
className: cn("cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
37
|
+
...props
|
|
38
|
+
})
|
|
39
|
+
}) });
|
|
40
|
+
}
|
|
41
|
+
function ContextMenuGroup({ ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(ContextMenu.Group, {
|
|
43
|
+
"data-slot": "context-menu-group",
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function ContextMenuLabel({ className, inset, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(ContextMenu.GroupLabel, {
|
|
49
|
+
"data-slot": "context-menu-label",
|
|
50
|
+
"data-inset": inset,
|
|
51
|
+
className: cn("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx(ContextMenu.Item, {
|
|
57
|
+
"data-slot": "context-menu-item",
|
|
58
|
+
"data-inset": inset,
|
|
59
|
+
"data-variant": variant,
|
|
60
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function ContextMenuSub({ ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx(ContextMenu.SubmenuRoot, {
|
|
66
|
+
"data-slot": "context-menu-sub",
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsxs(ContextMenu.SubmenuTrigger, {
|
|
72
|
+
"data-slot": "context-menu-sub-trigger",
|
|
73
|
+
"data-inset": inset,
|
|
74
|
+
className: cn("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
75
|
+
...props,
|
|
76
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
viewBox: "0 0 24 24",
|
|
79
|
+
fill: "none",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
strokeWidth: "2",
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
strokeLinejoin: "round",
|
|
84
|
+
className: "cn-rtl-flip ml-auto",
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function ContextMenuSubContent({ ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsx(ContextMenuContent, {
|
|
92
|
+
"data-slot": "context-menu-sub-content",
|
|
93
|
+
className: "cn-menu-target cn-menu-translucent shadow-lg",
|
|
94
|
+
side: "right",
|
|
95
|
+
...props
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function ContextMenuCheckboxItem({ className, children, checked, inset, onCheckedChange, ...props }) {
|
|
99
|
+
const cue = useCue("context-menu");
|
|
100
|
+
return /* @__PURE__ */ jsxs(ContextMenu.CheckboxItem, {
|
|
101
|
+
"data-slot": "context-menu-checkbox-item",
|
|
102
|
+
"data-inset": inset,
|
|
103
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
104
|
+
checked,
|
|
105
|
+
onCheckedChange: (next, details) => {
|
|
106
|
+
onCheckedChange?.(next, details);
|
|
107
|
+
if (!details.isCanceled) cue("check");
|
|
108
|
+
},
|
|
109
|
+
...props,
|
|
110
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
111
|
+
className: "pointer-events-none absolute right-2",
|
|
112
|
+
children: /* @__PURE__ */ jsx(ContextMenu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
113
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
114
|
+
viewBox: "0 0 24 24",
|
|
115
|
+
fill: "none",
|
|
116
|
+
stroke: "currentColor",
|
|
117
|
+
strokeWidth: "2",
|
|
118
|
+
strokeLinecap: "round",
|
|
119
|
+
strokeLinejoin: "round",
|
|
120
|
+
"aria-hidden": "true",
|
|
121
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
122
|
+
}) })
|
|
123
|
+
}), children]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function ContextMenuRadioGroup({ onValueChange, ...props }) {
|
|
127
|
+
const cue = useCue("context-menu");
|
|
128
|
+
return /* @__PURE__ */ jsx(ContextMenu.RadioGroup, {
|
|
129
|
+
"data-slot": "context-menu-radio-group",
|
|
130
|
+
onValueChange: (value, details) => {
|
|
131
|
+
onValueChange?.(value, details);
|
|
132
|
+
if (!details.isCanceled) cue("check");
|
|
133
|
+
},
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function ContextMenuRadioItem({ className, children, inset, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsxs(ContextMenu.RadioItem, {
|
|
139
|
+
"data-slot": "context-menu-radio-item",
|
|
140
|
+
"data-inset": inset,
|
|
141
|
+
className: cn("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
142
|
+
...props,
|
|
143
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
144
|
+
className: "pointer-events-none absolute right-2",
|
|
145
|
+
children: /* @__PURE__ */ jsx(ContextMenu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
146
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
147
|
+
viewBox: "0 0 24 24",
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
strokeWidth: "2",
|
|
151
|
+
strokeLinecap: "round",
|
|
152
|
+
strokeLinejoin: "round",
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
155
|
+
}) })
|
|
156
|
+
}), children]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
160
|
+
return /* @__PURE__ */ jsx(ContextMenu.Separator, {
|
|
161
|
+
"data-slot": "context-menu-separator",
|
|
162
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
163
|
+
...props
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function ContextMenuShortcut({ className, ...props }) {
|
|
167
|
+
return /* @__PURE__ */ jsx("span", {
|
|
168
|
+
"data-slot": "context-menu-shortcut",
|
|
169
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground", className),
|
|
170
|
+
...props
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
export { ContextMenu$1 as ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./context-menu.js";
|
|
3
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
+
declare function Dialog$1({ onOpenChange, ...props }: Dialog.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function DialogTrigger({ ...props }: Dialog.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function DialogPortal({ ...props }: Dialog.Portal.Props): React.JSX.Element;
|
|
7
|
+
declare function DialogClose({ ...props }: Dialog.Close.Props): React.JSX.Element;
|
|
8
|
+
declare function DialogOverlay({ className, ...props }: Dialog.Backdrop.Props): React.JSX.Element;
|
|
9
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: Dialog.Popup.Props & {
|
|
10
|
+
showCloseButton?: boolean;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
|
|
14
|
+
showCloseButton?: boolean;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function DialogTitle({ className, ...props }: Dialog.Title.Props): React.JSX.Element;
|
|
17
|
+
declare function DialogDescription({ className, ...props }: Dialog.Description.Props): React.JSX.Element;
|
|
18
|
+
export { Dialog$1 as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useCue } from "../sound/sound-map.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
8
|
+
// src/dialog/dialog.tsx
|
|
9
|
+
function Dialog$1({ onOpenChange, ...props }) {
|
|
10
|
+
const cue = useCue("dialog");
|
|
11
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
12
|
+
"data-slot": "dialog",
|
|
13
|
+
onOpenChange: (open, details) => {
|
|
14
|
+
onOpenChange?.(open, details);
|
|
15
|
+
if (!details.isCanceled) cue(open ? "open" : "close");
|
|
16
|
+
},
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function DialogTrigger({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
22
|
+
"data-slot": "dialog-trigger",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function DialogPortal({ ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, {
|
|
28
|
+
"data-slot": "dialog-portal",
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function DialogClose({ ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
34
|
+
"data-slot": "dialog-close",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function DialogOverlay({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
40
|
+
"data-slot": "dialog-overlay",
|
|
41
|
+
className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
47
|
+
"data-slot": "dialog-content",
|
|
48
|
+
className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
49
|
+
...props,
|
|
50
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog.Close, {
|
|
51
|
+
"data-slot": "dialog-close",
|
|
52
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
className: "absolute top-2 right-2",
|
|
55
|
+
size: "icon-sm"
|
|
56
|
+
}),
|
|
57
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
58
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59
|
+
viewBox: "0 0 24 24",
|
|
60
|
+
fill: "none",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
strokeWidth: "2",
|
|
63
|
+
strokeLinecap: "round",
|
|
64
|
+
strokeLinejoin: "round",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }), /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })]
|
|
67
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "sr-only",
|
|
69
|
+
children: "Close"
|
|
70
|
+
})]
|
|
71
|
+
})]
|
|
72
|
+
})] });
|
|
73
|
+
}
|
|
74
|
+
function DialogHeader({ className, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx("div", {
|
|
76
|
+
"data-slot": "dialog-header",
|
|
77
|
+
className: cn("flex flex-col gap-2", className),
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
82
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
"data-slot": "dialog-footer",
|
|
84
|
+
className: cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end", className),
|
|
85
|
+
...props,
|
|
86
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
|
|
87
|
+
render: /* @__PURE__ */ jsx(Button, { variant: "outline" }),
|
|
88
|
+
children: "Close"
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function DialogTitle({ className, ...props }) {
|
|
93
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
94
|
+
"data-slot": "dialog-title",
|
|
95
|
+
className: cn("cn-font-heading text-base leading-none font-medium", className),
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function DialogDescription({ className, ...props }) {
|
|
100
|
+
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
101
|
+
"data-slot": "dialog-description",
|
|
102
|
+
className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export { Dialog$1 as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
3
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
4
|
+
declare function Drawer$1({ modal, showSwipeHandle, snapPoints, swipeDirection, onOpenChange, onSnapPointChange, ...props }: Drawer.Root.Props & {
|
|
5
|
+
showSwipeHandle?: boolean;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function DrawerTrigger({ ...props }: Drawer.Trigger.Props): React.JSX.Element;
|
|
8
|
+
declare function DrawerPortal({ ...props }: Drawer.Portal.Props): React.JSX.Element;
|
|
9
|
+
declare function DrawerClose({ ...props }: Drawer.Close.Props): React.JSX.Element;
|
|
10
|
+
declare function DrawerOverlay({ className, ...props }: Drawer.Backdrop.Props): React.JSX.Element;
|
|
11
|
+
declare function DrawerSwipeHandle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function DrawerContent({ className, children, ...props }: Drawer.Popup.Props): React.JSX.Element;
|
|
13
|
+
declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function DrawerTitle({ className, ...props }: Drawer.Title.Props): React.JSX.Element;
|
|
16
|
+
declare function DrawerDescription({ className, ...props }: Drawer.Description.Props): React.JSX.Element;
|
|
17
|
+
export { Drawer$1 as Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useCue } from "../sound/sound-map.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
8
|
+
// src/drawer/drawer.tsx
|
|
9
|
+
const DrawerContext = React.createContext(null);
|
|
10
|
+
function useDrawer() {
|
|
11
|
+
const context = React.useContext(DrawerContext);
|
|
12
|
+
if (!context) throw new Error("useDrawer must be used within a Drawer.");
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function Drawer$1({ modal = true, showSwipeHandle = false, snapPoints, swipeDirection = "down", onOpenChange, onSnapPointChange, ...props }) {
|
|
16
|
+
const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
|
|
17
|
+
const cue = useCue("drawer");
|
|
18
|
+
const closing = React.useRef(false);
|
|
19
|
+
const contextValue = React.useMemo(() => ({
|
|
20
|
+
hasSnapPoints,
|
|
21
|
+
modal,
|
|
22
|
+
showSwipeHandle,
|
|
23
|
+
swipeDirection
|
|
24
|
+
}), [
|
|
25
|
+
hasSnapPoints,
|
|
26
|
+
modal,
|
|
27
|
+
showSwipeHandle,
|
|
28
|
+
swipeDirection
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ jsx(DrawerContext.Provider, {
|
|
31
|
+
value: contextValue,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Drawer.Root, {
|
|
33
|
+
"data-slot": "drawer",
|
|
34
|
+
modal,
|
|
35
|
+
snapPoints,
|
|
36
|
+
swipeDirection,
|
|
37
|
+
onOpenChange: (open, details) => {
|
|
38
|
+
onOpenChange?.(open, details);
|
|
39
|
+
if (details.isCanceled) return;
|
|
40
|
+
closing.current = !open;
|
|
41
|
+
cue(open ? "open" : "close");
|
|
42
|
+
},
|
|
43
|
+
onSnapPointChange: (snapPoint, details) => {
|
|
44
|
+
onSnapPointChange?.(snapPoint, details);
|
|
45
|
+
if (!details.isCanceled && snapPoint != null && !closing.current) cue("snap");
|
|
46
|
+
},
|
|
47
|
+
...props
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function DrawerTrigger({ ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
53
|
+
"data-slot": "drawer-trigger",
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function DrawerPortal({ ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Drawer.Portal, {
|
|
59
|
+
"data-slot": "drawer-portal",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function DrawerClose({ ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(Drawer.Close, {
|
|
65
|
+
"data-slot": "drawer-close",
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function DrawerOverlay({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(Drawer.Backdrop, {
|
|
71
|
+
"data-slot": "drawer-overlay",
|
|
72
|
+
className: cn("fixed inset-0 z-50 min-h-dvh bg-black/10 opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function DrawerSwipeHandle({ className, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx("div", {
|
|
78
|
+
"data-slot": "drawer-swipe-handle",
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: cn("relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-24 group-data-[swipe-axis=x]/drawer-popup:after:w-1 group-data-[swipe-axis=y]/drawer-popup:after:h-1 group-data-[swipe-axis=y]/drawer-popup:after:w-24 active:cursor-grabbing", className),
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function DrawerContent({ className, children, ...props }) {
|
|
85
|
+
const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = useDrawer();
|
|
86
|
+
const swipeAxis = swipeDirection === "down" || swipeDirection === "up" ? "y" : "x";
|
|
87
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
88
|
+
"data-slot": "drawer-portal",
|
|
89
|
+
children: [modal === true && /* @__PURE__ */ jsx(DrawerOverlay, { "data-snap-points": hasSnapPoints ? "" : void 0 }), /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
90
|
+
"data-slot": "drawer-viewport",
|
|
91
|
+
"data-modal": modal,
|
|
92
|
+
className: "pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto",
|
|
93
|
+
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
94
|
+
"data-slot": "drawer-popup",
|
|
95
|
+
"data-swipe-axis": swipeAxis,
|
|
96
|
+
"data-snap-points": hasSnapPoints ? "" : void 0,
|
|
97
|
+
className: cn("group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b", "data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95", "after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full", "[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]", "[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]", "data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]", "data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)", "data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row", "data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]", "data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]", "data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]", "data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]", className),
|
|
98
|
+
...props,
|
|
99
|
+
children: [showSwipeHandle && /* @__PURE__ */ jsx(DrawerSwipeHandle, {}), /* @__PURE__ */ jsx(Drawer.Content, {
|
|
100
|
+
"data-slot": "drawer-content",
|
|
101
|
+
className: cn("flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none"),
|
|
102
|
+
children
|
|
103
|
+
})]
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function DrawerHeader({ className, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsx("div", {
|
|
110
|
+
"data-slot": "drawer-header",
|
|
111
|
+
className: cn("flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-0.5 md:text-left", className),
|
|
112
|
+
...props
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function DrawerFooter({ className, ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx("div", {
|
|
117
|
+
"data-slot": "drawer-footer",
|
|
118
|
+
className: cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className),
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function DrawerTitle({ className, ...props }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(Drawer.Title, {
|
|
124
|
+
"data-slot": "drawer-title",
|
|
125
|
+
className: cn("cn-font-heading text-base font-medium text-foreground", className),
|
|
126
|
+
...props
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function DrawerDescription({ className, ...props }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(Drawer.Description, {
|
|
131
|
+
"data-slot": "drawer-description",
|
|
132
|
+
className: cn("text-sm text-balance text-muted-foreground", className),
|
|
133
|
+
...props
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export { Drawer$1 as Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
3
|
+
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger };
|