@nsaa/core 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +30 -8
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- 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 +19 -0
- package/dist/alert/alert.js +58 -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 +106 -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 +112 -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 +90 -674
- package/dist/index.js +50 -3877
- 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/opener.js +29 -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/lazy-uisfx.d.ts +20 -0
- package/dist/sound/lazy-uisfx.js +68 -0
- package/dist/sound/sound-map.d.ts +72 -0
- package/dist/sound/sound-map.js +76 -0
- package/dist/sound/sound.d.ts +38 -0
- package/dist/sound/sound.js +136 -0
- package/dist/sound/uisfx.d.ts +41 -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/sources/accordion.css +3 -0
- package/dist/sources/alert-dialog.css +26 -0
- package/dist/sources/alert.css +8 -0
- package/dist/sources/avatar.css +3 -0
- package/dist/sources/badge.css +3 -0
- package/dist/sources/button.css +24 -0
- package/dist/sources/calendar.css +25 -0
- package/dist/sources/card.css +3 -0
- package/dist/sources/checkbox.css +6 -0
- package/dist/sources/collapsible.css +2 -0
- package/dist/sources/combobox.css +28 -0
- package/dist/sources/command.css +30 -0
- package/dist/sources/context-menu.css +6 -0
- package/dist/sources/dialog.css +26 -0
- package/dist/sources/drawer.css +6 -0
- package/dist/sources/dropdown-menu.css +6 -0
- package/dist/sources/empty.css +3 -0
- package/dist/sources/field.css +5 -0
- package/dist/sources/input-group.css +27 -0
- package/dist/sources/input-otp.css +8 -0
- package/dist/sources/input.css +3 -0
- package/dist/sources/kbd.css +3 -0
- package/dist/sources/label.css +3 -0
- package/dist/sources/loaders-text.css +8 -0
- package/dist/sources/loaders.css +40 -0
- package/dist/sources/native-select.css +3 -0
- package/dist/sources/pagination.css +25 -0
- package/dist/sources/popover.css +3 -0
- package/dist/sources/radio-group.css +6 -0
- package/dist/sources/select.css +6 -0
- package/dist/sources/separator.css +3 -0
- package/dist/sources/skeleton.css +3 -0
- package/dist/sources/slider.css +6 -0
- package/dist/sources/spinner.css +20 -0
- package/dist/sources/switch.css +6 -0
- package/dist/sources/table.css +3 -0
- package/dist/sources/tabs.css +3 -0
- package/dist/sources/textarea.css +3 -0
- package/dist/sources/toast.css +25 -0
- package/dist/sources/toggle-group.css +32 -0
- package/dist/sources/toolbar.css +34 -0
- package/dist/sources/tooltip.css +3 -0
- 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 +9 -5
- package/src/feel.css +52 -0
- package/src/styles-base.css +142 -0
- package/src/styles.css +3 -133
- 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,30 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Menu } from "@base-ui/react/menu";
|
|
4
|
+
declare function DropdownMenu({ ...props }: Menu.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function DropdownMenuPortal({ ...props }: Menu.Portal.Props): React.JSX.Element;
|
|
6
|
+
declare function DropdownMenuTrigger({ ...props }: Menu.Trigger.Props): React.JSX.Element;
|
|
7
|
+
declare function DropdownMenuContent({ align, alignOffset, side, sideOffset, className, ...props }: Menu.Popup.Props & Pick<Menu.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): React.JSX.Element;
|
|
8
|
+
declare function DropdownMenuGroup({ ...props }: Menu.Group.Props): React.JSX.Element;
|
|
9
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: Menu.GroupLabel.Props & {
|
|
10
|
+
inset?: boolean;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: Menu.Item.Props & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
variant?: "default" | "destructive";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function DropdownMenuSub({ ...props }: Menu.SubmenuRoot.Props): React.JSX.Element;
|
|
17
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: Menu.SubmenuTrigger.Props & {
|
|
18
|
+
inset?: boolean;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSubContent({ align, alignOffset, side, sideOffset, className, ...props }: React.ComponentProps<typeof DropdownMenuContent>): React.JSX.Element;
|
|
21
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, inset, onCheckedChange, ...props }: Menu.CheckboxItem.Props & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuRadioGroup({ onValueChange, ...props }: Menu.RadioGroup.Props): React.JSX.Element;
|
|
25
|
+
declare function DropdownMenuRadioItem({ className, children, inset, ...props }: Menu.RadioItem.Props & {
|
|
26
|
+
inset?: boolean;
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
declare function DropdownMenuSeparator({ className, ...props }: Menu.Separator.Props): React.JSX.Element;
|
|
29
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
30
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,177 @@
|
|
|
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 { Menu } from "@base-ui/react/menu";
|
|
7
|
+
// src/dropdown-menu/dropdown-menu.tsx
|
|
8
|
+
function DropdownMenu({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Menu.Root, {
|
|
10
|
+
"data-slot": "dropdown-menu",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function DropdownMenuPortal({ ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
16
|
+
"data-slot": "dropdown-menu-portal",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
22
|
+
"data-slot": "dropdown-menu-trigger",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function DropdownMenuContent({ align = "start", alignOffset = 0, side = "bottom", sideOffset = 4, className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
28
|
+
className: "isolate z-50 outline-none",
|
|
29
|
+
align,
|
|
30
|
+
alignOffset,
|
|
31
|
+
side,
|
|
32
|
+
sideOffset,
|
|
33
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
34
|
+
"data-slot": "dropdown-menu-content",
|
|
35
|
+
className: cn("cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 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:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
36
|
+
...props
|
|
37
|
+
})
|
|
38
|
+
}) });
|
|
39
|
+
}
|
|
40
|
+
function DropdownMenuGroup({ ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(Menu.Group, {
|
|
42
|
+
"data-slot": "dropdown-menu-group",
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
48
|
+
"data-slot": "dropdown-menu-label",
|
|
49
|
+
"data-inset": inset,
|
|
50
|
+
className: cn("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
56
|
+
"data-slot": "dropdown-menu-item",
|
|
57
|
+
"data-inset": inset,
|
|
58
|
+
"data-variant": variant,
|
|
59
|
+
className: cn("group/dropdown-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 not-data-[variant=destructive]: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 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function DropdownMenuSub({ ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuRoot, {
|
|
65
|
+
"data-slot": "dropdown-menu-sub",
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsxs(Menu.SubmenuTrigger, {
|
|
71
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
72
|
+
"data-inset": inset,
|
|
73
|
+
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 not-data-[variant=destructive]: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),
|
|
74
|
+
...props,
|
|
75
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
viewBox: "0 0 24 24",
|
|
78
|
+
fill: "none",
|
|
79
|
+
stroke: "currentColor",
|
|
80
|
+
strokeWidth: "2",
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round",
|
|
83
|
+
className: "cn-rtl-flip ml-auto",
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function DropdownMenuSubContent({ align = "start", alignOffset = -3, side = "right", sideOffset = 0, className, ...props }) {
|
|
90
|
+
return /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
91
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
92
|
+
className: cn("cn-menu-target cn-menu-translucent w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-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),
|
|
93
|
+
align,
|
|
94
|
+
alignOffset,
|
|
95
|
+
side,
|
|
96
|
+
sideOffset,
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function DropdownMenuCheckboxItem({ className, children, checked, inset, onCheckedChange, ...props }) {
|
|
101
|
+
const cue = useCue("dropdown-menu");
|
|
102
|
+
return /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
|
|
103
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
104
|
+
"data-inset": inset,
|
|
105
|
+
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 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),
|
|
106
|
+
checked,
|
|
107
|
+
onCheckedChange: (next, details) => {
|
|
108
|
+
onCheckedChange?.(next, details);
|
|
109
|
+
if (!details.isCanceled) cue("check");
|
|
110
|
+
},
|
|
111
|
+
...props,
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
114
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
115
|
+
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
116
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
117
|
+
viewBox: "0 0 24 24",
|
|
118
|
+
fill: "none",
|
|
119
|
+
stroke: "currentColor",
|
|
120
|
+
strokeWidth: "2",
|
|
121
|
+
strokeLinecap: "round",
|
|
122
|
+
strokeLinejoin: "round",
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
125
|
+
}) })
|
|
126
|
+
}), children]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function DropdownMenuRadioGroup({ onValueChange, ...props }) {
|
|
130
|
+
const cue = useCue("dropdown-menu");
|
|
131
|
+
return /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
132
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
133
|
+
onValueChange: (value, details) => {
|
|
134
|
+
onValueChange?.(value, details);
|
|
135
|
+
if (!details.isCanceled) cue("check");
|
|
136
|
+
},
|
|
137
|
+
...props
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function DropdownMenuRadioItem({ className, children, inset, ...props }) {
|
|
141
|
+
return /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
142
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
143
|
+
"data-inset": inset,
|
|
144
|
+
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 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),
|
|
145
|
+
...props,
|
|
146
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
148
|
+
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
149
|
+
children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
150
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
151
|
+
viewBox: "0 0 24 24",
|
|
152
|
+
fill: "none",
|
|
153
|
+
stroke: "currentColor",
|
|
154
|
+
strokeWidth: "2",
|
|
155
|
+
strokeLinecap: "round",
|
|
156
|
+
strokeLinejoin: "round",
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
159
|
+
}) })
|
|
160
|
+
}), children]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
164
|
+
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
165
|
+
"data-slot": "dropdown-menu-separator",
|
|
166
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
167
|
+
...props
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
171
|
+
return /* @__PURE__ */ jsx("span", {
|
|
172
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
173
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", className),
|
|
174
|
+
...props
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
3
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
declare function Empty({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function EmptyHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare const emptyMediaVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "icon" | "illustration" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export interface EmptyIllustrationOptions {
|
|
11
|
+
/** Outlined lines, or light tints on the faces (`il--filled`). */
|
|
12
|
+
appearance: "outlined" | "filled";
|
|
13
|
+
/** The line ramp from the ink, or from the brand (`il--brand`). The active object is always brand. */
|
|
14
|
+
lines: "ink" | "brand";
|
|
15
|
+
/** Soft tiles behind the piece: isometric (`il--floor`) or square (`il--grid`). */
|
|
16
|
+
backdrop: "none" | "floor" | "grid";
|
|
17
|
+
/** Which drawing of the piece to show (#118). */
|
|
18
|
+
projection: "isometric" | "flat";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The options of the `EmptyMedia variant="illustration"` around an illustration, or null outside
|
|
22
|
+
* one. Illustration components (`@nsaa/illustrations`) read it to pick their projection; the
|
|
23
|
+
* variant classes sit on the media itself (#125).
|
|
24
|
+
*/
|
|
25
|
+
declare function useEmptyIllustration(): EmptyIllustrationOptions | null;
|
|
26
|
+
type EmptyMediaProps = React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants> & {
|
|
27
|
+
/** illustration only: 120 / 168 / 240 px. */
|
|
28
|
+
size?: "sm" | "md" | "lg";
|
|
29
|
+
} & Partial<EmptyIllustrationOptions>;
|
|
30
|
+
declare function EmptyMedia({ className, variant, size, appearance, lines, backdrop, projection, children, ...props }: EmptyMediaProps): React.JSX.Element;
|
|
31
|
+
/** A div by default (base-nova); `render={<h2 />}` when the title heads a region. */
|
|
32
|
+
declare function EmptyTitle({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
33
|
+
declare function EmptyDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
34
|
+
declare function EmptyContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
35
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, useEmptyIllustration };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
// src/empty/empty.tsx
|
|
9
|
+
function Empty({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
"data-slot": "empty",
|
|
12
|
+
className: cn("il-host flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function EmptyHeader({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
"data-slot": "empty-header",
|
|
19
|
+
className: cn("flex max-w-sm flex-col items-center gap-2", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const emptyMediaVariants = cva("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
24
|
+
variants: { variant: {
|
|
25
|
+
default: "bg-transparent",
|
|
26
|
+
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
27
|
+
illustration: "bg-transparent data-[size=lg]:size-60 data-[size=md]:size-42 data-[size=sm]:size-30 [&_svg]:size-full"
|
|
28
|
+
} },
|
|
29
|
+
defaultVariants: { variant: "default" }
|
|
30
|
+
});
|
|
31
|
+
const EmptyIllustrationContext = React.createContext(null);
|
|
32
|
+
/**
|
|
33
|
+
* The options of the `EmptyMedia variant="illustration"` around an illustration, or null outside
|
|
34
|
+
* one. Illustration components (`@nsaa/illustrations`) read it to pick their projection; the
|
|
35
|
+
* variant classes sit on the media itself (#125).
|
|
36
|
+
*/
|
|
37
|
+
function useEmptyIllustration() {
|
|
38
|
+
return React.useContext(EmptyIllustrationContext);
|
|
39
|
+
}
|
|
40
|
+
/** The engine's variant classes for these options. They work from an ancestor of `.il` (#125). */
|
|
41
|
+
function illustrationClasses({ appearance, lines, backdrop }) {
|
|
42
|
+
return cn(appearance === "filled" && "il--filled", lines === "brand" && "il--brand", backdrop === "floor" && "il--floor", backdrop === "grid" && "il--grid");
|
|
43
|
+
}
|
|
44
|
+
function EmptyMedia({ className, variant = "default", size = "md", appearance = "outlined", lines = "ink", backdrop = "none", projection = "isometric", children, ...props }) {
|
|
45
|
+
const illustration = variant === "illustration";
|
|
46
|
+
const options = React.useMemo(() => ({
|
|
47
|
+
appearance,
|
|
48
|
+
lines,
|
|
49
|
+
backdrop,
|
|
50
|
+
projection
|
|
51
|
+
}), [
|
|
52
|
+
appearance,
|
|
53
|
+
lines,
|
|
54
|
+
backdrop,
|
|
55
|
+
projection
|
|
56
|
+
]);
|
|
57
|
+
return /* @__PURE__ */ jsx("div", {
|
|
58
|
+
"data-slot": "empty-icon",
|
|
59
|
+
"data-variant": variant,
|
|
60
|
+
"data-size": illustration ? size : void 0,
|
|
61
|
+
"data-projection": illustration ? projection : void 0,
|
|
62
|
+
className: cn(emptyMediaVariants({ variant }), illustration && illustrationClasses(options), className),
|
|
63
|
+
...props,
|
|
64
|
+
children: illustration ? /* @__PURE__ */ jsx(EmptyIllustrationContext.Provider, {
|
|
65
|
+
value: options,
|
|
66
|
+
children
|
|
67
|
+
}) : children
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** A div by default (base-nova); `render={<h2 />}` when the title heads a region. */
|
|
71
|
+
function EmptyTitle({ className, render, ...props }) {
|
|
72
|
+
return useRender({
|
|
73
|
+
defaultTagName: "div",
|
|
74
|
+
props: mergeProps({ className: cn("cn-font-heading text-label-heading", className) }, props),
|
|
75
|
+
render,
|
|
76
|
+
state: { slot: "empty-title" }
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function EmptyDescription({ className, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx("div", {
|
|
81
|
+
"data-slot": "empty-description",
|
|
82
|
+
className: cn("text-body-sm-loose text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function EmptyContent({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx("div", {
|
|
88
|
+
"data-slot": "empty-content",
|
|
89
|
+
className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance", className),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, useEmptyIllustration };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyIllustrationOptions, EmptyMedia, EmptyTitle, useEmptyIllustration } from "./empty.js";
|
|
3
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, type EmptyIllustrationOptions, EmptyMedia, EmptyTitle, useEmptyIllustration };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { Label } from "../label/label.js";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): React.JSX.Element;
|
|
6
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
7
|
+
variant?: "legend" | "label";
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare const fieldVariants: (props?: ({
|
|
11
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React.JSX.Element;
|
|
14
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
|
|
16
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
18
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
22
|
+
errors?: Array<{
|
|
23
|
+
message?: string;
|
|
24
|
+
} | undefined>;
|
|
25
|
+
}): React.JSX.Element | null;
|
|
26
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Label } from "../label/label.js";
|
|
4
|
+
import { Separator } from "../separator/separator.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
// src/field/field.tsx
|
|
9
|
+
function FieldSet({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
11
|
+
"data-slot": "field-set",
|
|
12
|
+
className: cn("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
18
|
+
"data-slot": "field-legend",
|
|
19
|
+
"data-variant": variant,
|
|
20
|
+
className: cn("mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function FieldGroup({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
"data-slot": "field-group",
|
|
27
|
+
className: cn("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", {
|
|
32
|
+
variants: { orientation: {
|
|
33
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
34
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
35
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
36
|
+
} },
|
|
37
|
+
defaultVariants: { orientation: "vertical" }
|
|
38
|
+
});
|
|
39
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
role: "group",
|
|
42
|
+
"data-slot": "field",
|
|
43
|
+
"data-orientation": orientation,
|
|
44
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function FieldContent({ className, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
"data-slot": "field-content",
|
|
51
|
+
className: cn("group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function FieldLabel({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
57
|
+
"data-slot": "field-label",
|
|
58
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function FieldTitle({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx("div", {
|
|
64
|
+
"data-slot": "field-label",
|
|
65
|
+
className: cn("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function FieldDescription({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx("p", {
|
|
71
|
+
"data-slot": "field-description",
|
|
72
|
+
className: cn("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
"data-slot": "field-separator",
|
|
79
|
+
"data-content": !!children,
|
|
80
|
+
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
81
|
+
...props,
|
|
82
|
+
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
84
|
+
"data-slot": "field-separator-content",
|
|
85
|
+
children
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
90
|
+
const content = useMemo(() => {
|
|
91
|
+
if (children) return children;
|
|
92
|
+
if (!errors?.length) return null;
|
|
93
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
94
|
+
if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
|
|
95
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
96
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
97
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
|
|
98
|
+
});
|
|
99
|
+
}, [children, errors]);
|
|
100
|
+
if (!content) return null;
|
|
101
|
+
return /* @__PURE__ */ jsx("div", {
|
|
102
|
+
role: "alert",
|
|
103
|
+
"data-slot": "field-error",
|
|
104
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
105
|
+
...props,
|
|
106
|
+
children: content
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./field.js";
|
|
3
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|