@vuer-ai/vuer-uikit 0.0.96 → 0.0.98
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 +106 -7
- package/cli/dial-cli.js +49 -7
- package/dist/SyncScroll/SyncScroll.cjs +10 -10
- package/dist/SyncScroll/SyncScroll.mjs +3 -3
- package/dist/SyncScroll/index.cjs +10 -10
- package/dist/SyncScroll/index.mjs +3 -3
- package/dist/chunk-3HEZVWRW.mjs +62 -0
- package/dist/chunk-4KWGGESI.cjs +494 -0
- package/dist/{chunk-CCMKL2OA.cjs → chunk-7GWDO25E.cjs} +2 -2
- package/dist/chunk-A5LCX2UQ.cjs +208 -0
- package/dist/chunk-BEJIZ56L.mjs +300 -0
- package/dist/chunk-C7VGRU3O.mjs +283 -0
- package/dist/{chunk-LONOMMFA.cjs → chunk-LJMNHTTG.cjs} +21 -21
- package/dist/chunk-O66RESRR.cjs +285 -0
- package/dist/{chunk-RINTUFYQ.cjs → chunk-RMK6W774.cjs} +24 -19
- package/dist/{chunk-BFQ2WL5U.mjs → chunk-TTYSYGVE.mjs} +2 -2
- package/dist/chunk-VA3PEYFM.mjs +489 -0
- package/dist/chunk-VBBJSIY7.cjs +308 -0
- package/dist/{chunk-AIINOWEH.mjs → chunk-W4JCKCW7.mjs} +5 -5
- package/dist/chunk-WWGF6TBZ.mjs +206 -0
- package/dist/chunk-ZGN4UEJR.cjs +679 -0
- package/dist/chunk-ZQLRMOUW.mjs +661 -0
- package/dist/dial/DialPanel.cjs +24 -24
- package/dist/dial/DialPanel.mjs +23 -23
- package/dist/dial/DialProvider.cjs +3 -3
- package/dist/dial/DialProvider.d.cts +1 -0
- package/dist/dial/DialProvider.d.ts +1 -0
- package/dist/dial/DialProvider.example.cjs +72 -0
- package/dist/dial/DialProvider.example.d.cts +7 -0
- package/dist/dial/DialProvider.example.d.ts +7 -0
- package/dist/dial/DialProvider.example.mjs +68 -0
- package/dist/dial/DialProvider.mjs +1 -1
- package/dist/dial/index.cjs +42 -42
- package/dist/dial/index.mjs +23 -23
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +27 -27
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialInputs.cjs +34 -34
- package/dist/dial/wrapped-inputs/DialInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +24 -24
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +23 -23
- package/dist/dial/wrapped-inputs/index.cjs +39 -39
- package/dist/dial/wrapped-inputs/index.mjs +23 -23
- package/dist/highlight-cursor/cursor-provider.cjs +3 -3
- package/dist/highlight-cursor/cursor-provider.mjs +2 -2
- package/dist/highlight-cursor/enhanced-components.cjs +10 -10
- package/dist/highlight-cursor/enhanced-components.mjs +5 -5
- package/dist/highlight-cursor/index.cjs +16 -16
- package/dist/highlight-cursor/index.mjs +6 -6
- package/dist/hooks/index.cjs +5 -5
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.cjs +190 -190
- package/dist/index.mjs +23 -23
- package/dist/ui/UIKitBadge.cjs +6 -6
- package/dist/ui/UIKitBadge.mjs +2 -2
- package/dist/ui/avatar.cjs +1 -1
- package/dist/ui/avatar.mjs +1 -1
- package/dist/ui/badge.cjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.mjs +1 -1
- package/dist/ui/button.cjs +1 -1
- package/dist/ui/button.mjs +1 -1
- package/dist/ui/card.cjs +1 -1
- package/dist/ui/card.mjs +1 -1
- package/dist/ui/checkbox.cjs +1 -1
- package/dist/ui/checkbox.mjs +1 -1
- package/dist/ui/collapsible.cjs +1 -1
- package/dist/ui/collapsible.mjs +1 -1
- package/dist/ui/drawer.cjs +1 -1
- package/dist/ui/drawer.mjs +1 -1
- package/dist/ui/dropdown.cjs +1 -1
- package/dist/ui/dropdown.mjs +1 -1
- package/dist/ui/index.cjs +107 -107
- package/dist/ui/index.mjs +17 -17
- package/dist/ui/inputs/color-input.cjs +1 -1
- package/dist/ui/inputs/color-input.mjs +1 -1
- package/dist/ui/inputs/index.cjs +11 -11
- package/dist/ui/inputs/index.mjs +3 -3
- package/dist/ui/inputs/input-numbers.cjs +1 -1
- package/dist/ui/inputs/input-numbers.mjs +1 -1
- package/dist/ui/inputs/input.cjs +1 -1
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/inputs/input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.cjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/index.cjs +11 -11
- package/dist/ui/inputs/number-inputs/index.mjs +3 -3
- package/dist/ui/inputs/presets-input.cjs +1 -1
- package/dist/ui/inputs/presets-input.mjs +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/layout.cjs +1 -1
- package/dist/ui/layout.mjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/dock-layout/index.cjs +1 -1
- package/dist/ui/layouts/dock-layout/index.mjs +1 -1
- package/dist/ui/layouts/index.cjs +2 -2
- package/dist/ui/layouts/index.mjs +2 -2
- package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.mjs +1 -1
- package/dist/ui/modal.cjs +1 -1
- package/dist/ui/modal.mjs +1 -1
- package/dist/ui/navigation.cjs +1 -1
- package/dist/ui/navigation.mjs +1 -1
- package/dist/ui/pagination.cjs +1 -1
- package/dist/ui/pagination.mjs +1 -1
- package/dist/ui/panel.cjs +1 -1
- package/dist/ui/panel.mjs +1 -1
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.mjs +1 -1
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.mjs +1 -1
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.mjs +1 -1
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/select.mjs +1 -1
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.mjs +1 -1
- package/dist/ui/sheet.cjs +1 -1
- package/dist/ui/sheet.mjs +1 -1
- package/dist/ui/sidebar.cjs +26 -26
- package/dist/ui/sidebar.mjs +2 -2
- package/dist/ui/simple-tree-view.cjs +1 -1
- package/dist/ui/simple-tree-view.mjs +1 -1
- package/dist/ui/skeleton.cjs +1 -1
- package/dist/ui/skeleton.mjs +1 -1
- package/dist/ui/slider.cjs +1 -1
- package/dist/ui/slider.mjs +1 -1
- package/dist/ui/switch.cjs +1 -1
- package/dist/ui/switch.mjs +1 -1
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.mjs +1 -1
- package/dist/ui/tabs.cjs +1 -1
- package/dist/ui/tabs.mjs +1 -1
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/textarea.mjs +1 -1
- package/dist/ui/theme/ThemeToggles.cjs +1 -1
- package/dist/ui/theme/ThemeToggles.mjs +1 -1
- package/dist/ui/theme/index.cjs +1 -1
- package/dist/ui/theme/index.mjs +1 -1
- package/dist/ui/toggle-buttons.cjs +1 -1
- package/dist/ui/toggle-buttons.mjs +1 -1
- package/dist/ui/toggle-group.cjs +1 -1
- package/dist/ui/toggle-group.mjs +1 -1
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.mjs +1 -1
- package/dist/ui/toolbar.cjs +1 -1
- package/dist/ui/toolbar.mjs +1 -1
- package/dist/ui/tooltip.cjs +1 -1
- package/dist/ui/tooltip.mjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.cjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.mjs +1 -1
- package/dist/ui/tree-view/TreeView.cjs +1 -1
- package/dist/ui/tree-view/TreeView.mjs +1 -1
- package/dist/ui/tree-view/index.cjs +6 -6
- package/dist/ui/tree-view/index.mjs +2 -2
- package/dist/ui/tree-view-legacy.cjs +9 -9
- package/dist/ui/tree-view-legacy.mjs +5 -5
- package/dist/ui/waterfall/CursorOverlay.cjs +1 -1
- package/dist/ui/waterfall/CursorOverlay.mjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.cjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.mjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.cjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.mjs +1 -1
- package/dist/ui/waterfall/Wedges.cjs +1 -1
- package/dist/ui/waterfall/Wedges.mjs +1 -1
- package/dist/ui/waterfall/index.cjs +8 -8
- package/dist/ui/waterfall/index.mjs +7 -7
- package/package.json +28 -2
- package/src/SyncScroll/README.md +283 -0
- package/src/SyncScroll/SyncScroll.tsx +361 -0
- package/src/SyncScroll/index.ts +22 -0
- package/src/SyncScroll/useSyncScroll.tsx +226 -0
- package/src/cli/dial-cli.ts +1133 -0
- package/src/dial/DialPanel.tsx +208 -0
- package/src/dial/DialProvider.example.tsx +80 -0
- package/src/dial/DialProvider.tsx +138 -0
- package/src/dial/index.ts +26 -0
- package/src/dial/wrapped-inputs/ControlledInputs.tsx +176 -0
- package/src/dial/wrapped-inputs/DialInputs.tsx +401 -0
- package/src/dial/wrapped-inputs/DialVectorInput.tsx +125 -0
- package/src/dial/wrapped-inputs/index.ts +25 -0
- package/src/highlight-cursor/cursor-context.tsx +23 -0
- package/src/highlight-cursor/cursor-provider.tsx +264 -0
- package/src/highlight-cursor/enhanced-components.tsx +16 -0
- package/src/highlight-cursor/index.ts +21 -0
- package/src/highlight-cursor/tabs-cursor-context.tsx +121 -0
- package/src/highlight-cursor/types.ts +40 -0
- package/src/highlight-cursor/with-cursor.tsx +144 -0
- package/src/hooks/clientOnly.tsx +54 -0
- package/src/hooks/cn.ts +33 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useDocument.tsx +18 -0
- package/src/hooks/useDragSelect.ts +116 -0
- package/src/hooks/useIsMobile.ts +35 -0
- package/src/hooks/useLocalStorage.ts +122 -0
- package/src/hooks/useLocation.tsx +95 -0
- package/src/hooks/useQueryParams.tsx +31 -0
- package/src/hooks/useWindow.tsx +18 -0
- package/src/index.css +5 -0
- package/src/index.ts +5 -0
- package/src/styles/.editorconfig +0 -0
- package/src/styles/theme.css +152 -0
- package/src/styles/toast.css +67 -0
- package/src/styles/variables.css +229 -0
- package/src/ui/UIKitBadge.tsx +171 -0
- package/src/ui/avatar.tsx +221 -0
- package/src/ui/badge.tsx +74 -0
- package/src/ui/button.tsx +143 -0
- package/src/ui/card.tsx +146 -0
- package/src/ui/checkbox.tsx +78 -0
- package/src/ui/collapsible.tsx +43 -0
- package/src/ui/drag-selectable/DragSelectProvider.tsx +178 -0
- package/src/ui/drag-selectable/createSelectable.tsx +43 -0
- package/src/ui/drag-selectable/index.ts +2 -0
- package/src/ui/drawer.tsx +137 -0
- package/src/ui/dropdown.tsx +707 -0
- package/src/ui/icons/MouseCursorIcons.tsx +39 -0
- package/src/ui/icons/cursor.tsx +38 -0
- package/src/ui/icons/index.ts +2 -0
- package/src/ui/index.ts +45 -0
- package/src/ui/inputs/color-input.tsx +61 -0
- package/src/ui/inputs/index.tsx +5 -0
- package/src/ui/inputs/input-numbers.tsx +394 -0
- package/src/ui/inputs/input.tsx +155 -0
- package/src/ui/inputs/number-inputs/CmInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/DegInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/EulerDegInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/EulerInput.tsx +30 -0
- package/src/ui/inputs/number-inputs/EulerRadInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/InchInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/IntInput.tsx +46 -0
- package/src/ui/inputs/number-inputs/KVectorInput.tsx +20 -0
- package/src/ui/inputs/number-inputs/QuaternionInput.tsx +27 -0
- package/src/ui/inputs/number-inputs/RadInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/TimeInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/Vec3Input.tsx +26 -0
- package/src/ui/inputs/number-inputs/VectorInput.tsx +38 -0
- package/src/ui/inputs/number-inputs/index.ts +38 -0
- package/src/ui/inputs/presets-input.tsx +59 -0
- package/src/ui/label.tsx +35 -0
- package/src/ui/layout.tsx +43 -0
- package/src/ui/layouts/dock-layout/DockLayoutView.tsx +128 -0
- package/src/ui/layouts/dock-layout/LayoutSlots.tsx +85 -0
- package/src/ui/layouts/dock-layout/index.tsx +2 -0
- package/src/ui/layouts/index.ts +2 -0
- package/src/ui/layouts/liquid-layout/LayoutSlots.tsx +82 -0
- package/src/ui/layouts/liquid-layout/LiquidLayoutView.tsx +76 -0
- package/src/ui/layouts/liquid-layout/index.ts +1 -0
- package/src/ui/modal.tsx +211 -0
- package/src/ui/navigation.tsx +86 -0
- package/src/ui/pagination.tsx +129 -0
- package/src/ui/panel.tsx +146 -0
- package/src/ui/popover.tsx +112 -0
- package/src/ui/radio-group.tsx +63 -0
- package/src/ui/resizable.tsx +52 -0
- package/src/ui/select.tsx +365 -0
- package/src/ui/separator.tsx +26 -0
- package/src/ui/sheet.tsx +257 -0
- package/src/ui/sidebar.tsx +695 -0
- package/src/ui/simple-tree-view.tsx +604 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slider.tsx +204 -0
- package/src/ui/switch.tsx +45 -0
- package/src/ui/table.tsx +99 -0
- package/src/ui/tabs.tsx +192 -0
- package/src/ui/textarea.tsx +55 -0
- package/src/ui/theme/ThemeProvider.tsx +319 -0
- package/src/ui/theme/ThemeToggles.tsx +84 -0
- package/src/ui/theme/index.ts +21 -0
- package/src/ui/theme/themeScript.tsx +179 -0
- package/src/ui/theme/types.ts +61 -0
- package/src/ui/toast.tsx +30 -0
- package/src/ui/toggle-buttons.tsx +290 -0
- package/src/ui/toggle-group.tsx +236 -0
- package/src/ui/toggle.tsx +94 -0
- package/src/ui/toolbar.tsx +54 -0
- package/src/ui/tooltip.tsx +171 -0
- package/src/ui/tree-view/TreeSearchBar.tsx +88 -0
- package/src/ui/tree-view/TreeView.tsx +232 -0
- package/src/ui/tree-view/hooks.tsx +289 -0
- package/src/ui/tree-view/index.ts +4 -0
- package/src/ui/tree-view/types.ts +23 -0
- package/src/ui/tree-view-legacy.tsx +644 -0
- package/src/ui/version-badge.tsx +0 -0
- package/src/ui/waterfall/CursorOverlay.tsx +96 -0
- package/src/ui/waterfall/NavigationControls.tsx +42 -0
- package/src/ui/waterfall/Tick.tsx +51 -0
- package/src/ui/waterfall/TimeRuleEventDot.tsx +19 -0
- package/src/ui/waterfall/TimelineEvent.tsx +60 -0
- package/src/ui/waterfall/TimelineProcessBar.tsx +207 -0
- package/src/ui/waterfall/Wedges.tsx +67 -0
- package/src/ui/waterfall/WheelZoomContext.tsx +128 -0
- package/src/ui/waterfall/hooks/useTimelineState.tsx +134 -0
- package/src/ui/waterfall/hooks/useViewport.tsx +293 -0
- package/src/ui/waterfall/index.tsx +326 -0
- package/src/ui/waterfall/types.ts +20 -0
- package/src/ui/waterfall/utils.ts +91 -0
- package/dist/chunk-W2YAQV5N.mjs +0 -57
- package/dist/{chunk-QLCEHV4Q.mjs → chunk-2OZK5DY5.mjs} +2 -2
- package/dist/{chunk-Z35DNFRZ.cjs → chunk-7IS37C3P.cjs} +2 -2
- package/dist/{chunk-4AOAH77D.mjs → chunk-A2PCEL5S.mjs} +2 -2
- package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
- package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
- package/dist/{chunk-VE3XLQLO.cjs → chunk-QUFZWF4E.cjs} +2 -2
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
4
|
+
import { type ComponentProps, createContext, type ReactNode, useContext } from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../hooks";
|
|
7
|
+
|
|
8
|
+
const SelectContext = createContext<{
|
|
9
|
+
font: "standard" | "mono";
|
|
10
|
+
align: "left" | "center" | "right";
|
|
11
|
+
}>({ font: "mono", align: "left" });
|
|
12
|
+
|
|
13
|
+
interface SelectRootProps extends ComponentProps<typeof SelectPrimitive.Root> {
|
|
14
|
+
font?: "standard" | "mono";
|
|
15
|
+
align?: "left" | "center" | "right";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Select root primitive.
|
|
20
|
+
*/
|
|
21
|
+
export function Select({ font = "mono", align = "left", ...props }: SelectRootProps) {
|
|
22
|
+
return (
|
|
23
|
+
<SelectContext.Provider value={{ font, align }}>
|
|
24
|
+
<SelectPrimitive.Root data-slot="select" data-font={font} data-align={align} {...props} />
|
|
25
|
+
</SelectContext.Provider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Group container for related select items.
|
|
31
|
+
*/
|
|
32
|
+
export function SelectGroup({ className, ...props }: ComponentProps<typeof SelectPrimitive.Group>) {
|
|
33
|
+
return (
|
|
34
|
+
<SelectPrimitive.Group
|
|
35
|
+
data-slot="select-group"
|
|
36
|
+
className={cn("space-y-xs", className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Displays the selected value inside the trigger.
|
|
44
|
+
*/
|
|
45
|
+
export function SelectValue({ ...props }: ComponentProps<typeof SelectPrimitive.Value>) {
|
|
46
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const selectTriggerVariants = cva(
|
|
50
|
+
[
|
|
51
|
+
"flex",
|
|
52
|
+
"items-center",
|
|
53
|
+
"gap-2",
|
|
54
|
+
"bg-select-secondary",
|
|
55
|
+
"whitespace-nowrap",
|
|
56
|
+
"shadow-xs",
|
|
57
|
+
"transition-[color,box-shadow]",
|
|
58
|
+
"outline-none",
|
|
59
|
+
"*:data-[slot=select-value]:line-clamp-1",
|
|
60
|
+
"*:data-[slot=select-value]:flex",
|
|
61
|
+
"*:data-[slot=select-value]:items-center",
|
|
62
|
+
"*:data-[slot=select-value]:gap-2",
|
|
63
|
+
"[&_svg]:shrink-0",
|
|
64
|
+
"[&_svg]:pointer-events-none",
|
|
65
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
66
|
+
"[type=number]:font-number-input",
|
|
67
|
+
],
|
|
68
|
+
{
|
|
69
|
+
variants: {
|
|
70
|
+
state: {
|
|
71
|
+
default: ["hover:bg-bg-secondary/80", "has-[input:focus]:bg-bg-secondary"],
|
|
72
|
+
disabled: ["disabled:cursor-not-allowed", "bg-bg-tertiary", "text-text-tertiary"],
|
|
73
|
+
error: ["hover:bg-danger-primary/10", "bg-danger-primary/20"],
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
sm: "px-sm py-xs text-uk-sm h-6 [&_svg:not([class*='size-'])]:size-3 rounded-uk-md",
|
|
77
|
+
md: "px-md py-sm text-uk-md h-8 [&_svg:not([class*='size-'])]:size-4 rounded-uk-lg",
|
|
78
|
+
lg: "px-lg py-sm text-uk-lg h-9 [&_svg:not([class*='size-'])]:size-5 rounded-uk-xl",
|
|
79
|
+
},
|
|
80
|
+
font: {
|
|
81
|
+
standard: "font-sans",
|
|
82
|
+
mono: "font-number-input",
|
|
83
|
+
},
|
|
84
|
+
align: {
|
|
85
|
+
left: "justify-between",
|
|
86
|
+
center:
|
|
87
|
+
"justify-center *:data-[slot=select-value]:flex-1 *:data-[slot=select-value]:justify-center",
|
|
88
|
+
right:
|
|
89
|
+
"justify-between *:data-[slot=select-value]:flex-1 *:data-[slot=select-value]:justify-end",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: {
|
|
93
|
+
state: "default",
|
|
94
|
+
size: "md",
|
|
95
|
+
font: "mono",
|
|
96
|
+
align: "left",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
interface SelectTriggerProps
|
|
102
|
+
extends Omit<ComponentProps<typeof SelectPrimitive.Trigger>, "ref">,
|
|
103
|
+
VariantProps<typeof selectTriggerVariants> {}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Trigger button for the select.
|
|
107
|
+
*/
|
|
108
|
+
export function SelectTrigger({
|
|
109
|
+
className,
|
|
110
|
+
size,
|
|
111
|
+
children,
|
|
112
|
+
disabled,
|
|
113
|
+
state,
|
|
114
|
+
font,
|
|
115
|
+
align,
|
|
116
|
+
...props
|
|
117
|
+
}: SelectTriggerProps) {
|
|
118
|
+
return (
|
|
119
|
+
<SelectPrimitive.Trigger
|
|
120
|
+
data-slot="select-trigger"
|
|
121
|
+
data-size={size}
|
|
122
|
+
className={cn(
|
|
123
|
+
selectTriggerVariants({
|
|
124
|
+
size,
|
|
125
|
+
className,
|
|
126
|
+
state: disabled ? "disabled" : state,
|
|
127
|
+
font,
|
|
128
|
+
align,
|
|
129
|
+
}),
|
|
130
|
+
)}
|
|
131
|
+
disabled={disabled}
|
|
132
|
+
{...props}
|
|
133
|
+
>
|
|
134
|
+
{children}
|
|
135
|
+
<SelectPrimitive.Icon asChild>
|
|
136
|
+
<ChevronDownIcon className="opacity-50" />
|
|
137
|
+
</SelectPrimitive.Icon>
|
|
138
|
+
</SelectPrimitive.Trigger>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Floating panel containing options.
|
|
144
|
+
*/
|
|
145
|
+
export function SelectContent({
|
|
146
|
+
className,
|
|
147
|
+
children,
|
|
148
|
+
position = "item-aligned",
|
|
149
|
+
...props
|
|
150
|
+
}: ComponentProps<typeof SelectPrimitive.Content>) {
|
|
151
|
+
const { font } = useContext(SelectContext);
|
|
152
|
+
return (
|
|
153
|
+
<SelectPrimitive.Portal>
|
|
154
|
+
<SelectPrimitive.Content
|
|
155
|
+
data-slot="select-content"
|
|
156
|
+
data-font={font}
|
|
157
|
+
className={cn(
|
|
158
|
+
[
|
|
159
|
+
"bg-bg-primary",
|
|
160
|
+
"data-[state=open]:animate-in",
|
|
161
|
+
"data-[state=closed]:animate-out",
|
|
162
|
+
"data-[state=closed]:fade-out-0",
|
|
163
|
+
"data-[state=open]:fade-in-0",
|
|
164
|
+
"data-[state=closed]:zoom-out-95",
|
|
165
|
+
"data-[state=open]:zoom-in-95",
|
|
166
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
167
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
168
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
169
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
170
|
+
"relative",
|
|
171
|
+
"z-50",
|
|
172
|
+
"max-h-(--radix-select-content-available-height)",
|
|
173
|
+
"origin-(--radix-select-content-transform-origin)",
|
|
174
|
+
"overflow-x-hidden",
|
|
175
|
+
"overflow-y-auto",
|
|
176
|
+
"rounded-uk-md",
|
|
177
|
+
"shadow-[0_4px_16px_0_var(--color-shadow-secondary)]",
|
|
178
|
+
"liquid:liquid-bg",
|
|
179
|
+
font === "standard" ? "font-sans" : "font-number-input",
|
|
180
|
+
],
|
|
181
|
+
{
|
|
182
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1":
|
|
183
|
+
position === "popper",
|
|
184
|
+
"-ml-2 translate-x-2": position === "item-aligned",
|
|
185
|
+
},
|
|
186
|
+
className,
|
|
187
|
+
)}
|
|
188
|
+
position={position}
|
|
189
|
+
{...props}
|
|
190
|
+
>
|
|
191
|
+
<SelectScrollUpButton />
|
|
192
|
+
<SelectPrimitive.Viewport
|
|
193
|
+
className={cn("p-md", {
|
|
194
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1":
|
|
195
|
+
position === "popper",
|
|
196
|
+
})}
|
|
197
|
+
>
|
|
198
|
+
{children}
|
|
199
|
+
</SelectPrimitive.Viewport>
|
|
200
|
+
<SelectScrollDownButton />
|
|
201
|
+
</SelectPrimitive.Content>
|
|
202
|
+
</SelectPrimitive.Portal>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Section label for options.
|
|
207
|
+
*/
|
|
208
|
+
export function SelectLabel({ className, ...props }: ComponentProps<typeof SelectPrimitive.Label>) {
|
|
209
|
+
return (
|
|
210
|
+
<SelectPrimitive.Label
|
|
211
|
+
data-slot="select-label"
|
|
212
|
+
className={cn("text-text-secondary text-uk-sm px-2 py-1.5", className)}
|
|
213
|
+
{...props}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
interface SelectItemProps extends Omit<ComponentProps<typeof SelectPrimitive.Item>, "prefix"> {
|
|
219
|
+
prefix?: ReactNode;
|
|
220
|
+
suffix?: ReactNode;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Single option row with optional prefix/suffix content.
|
|
225
|
+
*/
|
|
226
|
+
export function SelectItem({
|
|
227
|
+
className,
|
|
228
|
+
children,
|
|
229
|
+
prefix,
|
|
230
|
+
suffix,
|
|
231
|
+
disabled,
|
|
232
|
+
...props
|
|
233
|
+
}: SelectItemProps) {
|
|
234
|
+
return (
|
|
235
|
+
<SelectPrimitive.Item
|
|
236
|
+
data-slot="select-item"
|
|
237
|
+
disabled={disabled}
|
|
238
|
+
className={cn(
|
|
239
|
+
[
|
|
240
|
+
"group/select-item",
|
|
241
|
+
"w-full",
|
|
242
|
+
"flex",
|
|
243
|
+
"gap-sm",
|
|
244
|
+
"items-center",
|
|
245
|
+
"px-xs",
|
|
246
|
+
"py-xxs",
|
|
247
|
+
"relative",
|
|
248
|
+
"cursor-default",
|
|
249
|
+
"rounded-uk-sm",
|
|
250
|
+
"text-uk-sm",
|
|
251
|
+
"outline-hidden",
|
|
252
|
+
"select-none",
|
|
253
|
+
"focus:bg-bg-tertiary",
|
|
254
|
+
"active:text-text-withbg",
|
|
255
|
+
"active:bg-brand-primary/90",
|
|
256
|
+
"data-[state=checked]:bg-brand-primary",
|
|
257
|
+
"data-[state=checked]:text-text-withbg",
|
|
258
|
+
"data-[disabled]:pointer-events-none",
|
|
259
|
+
"data-[disabled]:text-bg-quaternary",
|
|
260
|
+
"[&_svg]:pointer-events-none",
|
|
261
|
+
"[&_svg]:shrink-0",
|
|
262
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
263
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
264
|
+
"*:[span]:last:flex",
|
|
265
|
+
"*:[span]:last:items-center",
|
|
266
|
+
"*:[span]:last:gap-2",
|
|
267
|
+
// Font inheritance from parent select
|
|
268
|
+
"[*[data-font=standard]_&]:font-sans",
|
|
269
|
+
"[*[data-font=mono]_&]:font-number-input",
|
|
270
|
+
// Alignment inheritance from parent select
|
|
271
|
+
"[*[data-align=left]_&]:justify-start",
|
|
272
|
+
"[*[data-align=center]_&]:justify-center",
|
|
273
|
+
"[*[data-align=right]_&]:justify-end",
|
|
274
|
+
],
|
|
275
|
+
className,
|
|
276
|
+
)}
|
|
277
|
+
{...props}
|
|
278
|
+
>
|
|
279
|
+
{prefix && (
|
|
280
|
+
<p
|
|
281
|
+
data-disabled={disabled}
|
|
282
|
+
className={cn([
|
|
283
|
+
"text-text-tertiary",
|
|
284
|
+
"flex",
|
|
285
|
+
"shrink-0",
|
|
286
|
+
"gap-0.5",
|
|
287
|
+
"data-[disabled=true]:text-bg-quaternary",
|
|
288
|
+
"group-data-[state=checked]/select-item:text-text-withbg",
|
|
289
|
+
])}
|
|
290
|
+
>
|
|
291
|
+
{prefix}
|
|
292
|
+
</p>
|
|
293
|
+
)}
|
|
294
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
295
|
+
{suffix && (
|
|
296
|
+
<p
|
|
297
|
+
data-disabled={disabled}
|
|
298
|
+
className={cn(
|
|
299
|
+
"text-text-tertiary",
|
|
300
|
+
"ml-auto",
|
|
301
|
+
"flex",
|
|
302
|
+
"shrink-0",
|
|
303
|
+
"gap-0.5",
|
|
304
|
+
"data-[disabled=true]:text-bg-quaternary",
|
|
305
|
+
"group-data-[state=checked]/select-item:text-text-withbg",
|
|
306
|
+
)}
|
|
307
|
+
>
|
|
308
|
+
{suffix}
|
|
309
|
+
</p>
|
|
310
|
+
)}
|
|
311
|
+
</SelectPrimitive.Item>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Visual separator between groups.
|
|
317
|
+
*/
|
|
318
|
+
export function SelectSeparator({
|
|
319
|
+
className,
|
|
320
|
+
...props
|
|
321
|
+
}: ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
322
|
+
return (
|
|
323
|
+
<SelectPrimitive.Separator
|
|
324
|
+
data-slot="select-separator"
|
|
325
|
+
className={cn("bg-line-primary my-lg pointer-events-none -mx-1 h-px", className)}
|
|
326
|
+
{...props}
|
|
327
|
+
/>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Scroll button at top of list.
|
|
333
|
+
*/
|
|
334
|
+
export function SelectScrollUpButton({
|
|
335
|
+
className,
|
|
336
|
+
...props
|
|
337
|
+
}: ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
338
|
+
return (
|
|
339
|
+
<SelectPrimitive.ScrollUpButton
|
|
340
|
+
data-slot="select-scroll-up-button"
|
|
341
|
+
className={cn("mx-24 flex cursor-default items-center justify-center py-1", className)}
|
|
342
|
+
{...props}
|
|
343
|
+
>
|
|
344
|
+
<ChevronUpIcon className="size-4" />
|
|
345
|
+
</SelectPrimitive.ScrollUpButton>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Scroll button at bottom of list.
|
|
351
|
+
*/
|
|
352
|
+
export function SelectScrollDownButton({
|
|
353
|
+
className,
|
|
354
|
+
...props
|
|
355
|
+
}: ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
356
|
+
return (
|
|
357
|
+
<SelectPrimitive.ScrollDownButton
|
|
358
|
+
data-slot="select-scroll-down-button"
|
|
359
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
360
|
+
{...props}
|
|
361
|
+
>
|
|
362
|
+
<ChevronDownIcon className="size-4" />
|
|
363
|
+
</SelectPrimitive.ScrollDownButton>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../hooks";
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
decorative = true,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
data-slot="separator-root"
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"bg-line-primary shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Separator };
|
package/src/ui/sheet.tsx
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import { XIcon } from "lucide-react";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn, createClientOnlyComponent } from "../hooks";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Sheet root using dialog primitives.
|
|
9
|
+
*/
|
|
10
|
+
function SheetRoot({ ...props }: ComponentProps<typeof SheetPrimitive.Root>) {
|
|
11
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function SheetFallback({ ...props }: ComponentProps<"div">) {
|
|
15
|
+
return <div data-slot="sheet" {...props} />;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Sheet = createClientOnlyComponent(SheetRoot, SheetFallback);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Trigger element that opens the sheet.
|
|
22
|
+
*/
|
|
23
|
+
function SheetTriggerRoot({ ...props }: ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
24
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function SheetTriggerFallback({
|
|
28
|
+
asChild,
|
|
29
|
+
children,
|
|
30
|
+
...props
|
|
31
|
+
}: ComponentProps<"button"> & { asChild?: boolean }) {
|
|
32
|
+
if (asChild) {
|
|
33
|
+
return <>{children}</>;
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
<button data-slot="sheet-trigger" {...props}>
|
|
37
|
+
{children}
|
|
38
|
+
</button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const SheetTrigger = createClientOnlyComponent(SheetTriggerRoot, SheetTriggerFallback);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Close control for the sheet.
|
|
46
|
+
*/
|
|
47
|
+
function SheetCloseRoot({ ...props }: ComponentProps<typeof SheetPrimitive.Close>) {
|
|
48
|
+
return (
|
|
49
|
+
<SheetPrimitive.Close
|
|
50
|
+
data-slot="sheet-close"
|
|
51
|
+
className={cn("focus:ring-0 focus:outline-none")}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function SheetCloseFallback({
|
|
58
|
+
asChild,
|
|
59
|
+
children,
|
|
60
|
+
...props
|
|
61
|
+
}: ComponentProps<"button"> & { asChild?: boolean }) {
|
|
62
|
+
if (asChild) {
|
|
63
|
+
return <>{children}</>;
|
|
64
|
+
}
|
|
65
|
+
return (
|
|
66
|
+
<button data-slot="sheet-close" className={cn("focus:ring-0 focus:outline-none")} {...props}>
|
|
67
|
+
{children}
|
|
68
|
+
</button>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const SheetClose = createClientOnlyComponent(SheetCloseRoot, SheetCloseFallback);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Portal for sheet overlay and content.
|
|
76
|
+
*/
|
|
77
|
+
function SheetPortal({ ...props }: ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
78
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Fullscreen overlay behind the sheet.
|
|
83
|
+
*/
|
|
84
|
+
function SheetOverlay({ className, ...props }: ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
85
|
+
return (
|
|
86
|
+
<SheetPrimitive.Overlay
|
|
87
|
+
data-slot="sheet-overlay"
|
|
88
|
+
className={cn(
|
|
89
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-bg-mask fixed inset-0 z-50",
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Sliding panel content for the sheet.
|
|
99
|
+
*/
|
|
100
|
+
function SheetContentRoot({
|
|
101
|
+
className,
|
|
102
|
+
children,
|
|
103
|
+
side = "right",
|
|
104
|
+
...props
|
|
105
|
+
}: ComponentProps<typeof SheetPrimitive.Content> & {
|
|
106
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
107
|
+
}) {
|
|
108
|
+
return (
|
|
109
|
+
<SheetPortal>
|
|
110
|
+
<SheetOverlay />
|
|
111
|
+
<SheetPrimitive.Content
|
|
112
|
+
data-slot="sheet-content"
|
|
113
|
+
className={cn(
|
|
114
|
+
"liquid:liquid-bg bg-bg-primary data-[state=open]:animate-in data-[state=closed]:animate-out p-xl fixed z-50 flex flex-col gap-4 shadow-[0_4px_16px_0_var(--color-shadow-secondary)] transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
115
|
+
side === "right" &&
|
|
116
|
+
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-[340px]",
|
|
117
|
+
side === "left" &&
|
|
118
|
+
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-[340px]",
|
|
119
|
+
side === "top" &&
|
|
120
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto",
|
|
121
|
+
side === "bottom" &&
|
|
122
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto",
|
|
123
|
+
className,
|
|
124
|
+
)}
|
|
125
|
+
{...props}
|
|
126
|
+
>
|
|
127
|
+
{children}
|
|
128
|
+
<SheetPrimitive.Close className="text-icon-primary hover:text-icon-highlight absolute top-4 right-4 disabled:pointer-events-none">
|
|
129
|
+
<XIcon className="size-4" />
|
|
130
|
+
<span className="sr-only">Close</span>
|
|
131
|
+
</SheetPrimitive.Close>
|
|
132
|
+
</SheetPrimitive.Content>
|
|
133
|
+
</SheetPortal>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function SheetContentFallback({
|
|
138
|
+
className,
|
|
139
|
+
children,
|
|
140
|
+
side = "right",
|
|
141
|
+
...props
|
|
142
|
+
}: ComponentProps<"div"> & {
|
|
143
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
144
|
+
}) {
|
|
145
|
+
return (
|
|
146
|
+
<div
|
|
147
|
+
data-slot="sheet-content"
|
|
148
|
+
className={cn(
|
|
149
|
+
"liquid:liquid-bg bg-bg-primary p-xl fixed z-50 flex flex-col gap-4 shadow-[0_4px_16px_0_var(--color-shadow-secondary)]",
|
|
150
|
+
side === "right" && "inset-y-0 right-0 h-full w-[340px]",
|
|
151
|
+
side === "left" && "inset-y-0 left-0 h-full w-[340px]",
|
|
152
|
+
side === "top" && "inset-x-0 top-0 h-auto",
|
|
153
|
+
side === "bottom" && "inset-x-0 bottom-0 h-auto",
|
|
154
|
+
className,
|
|
155
|
+
)}
|
|
156
|
+
{...props}
|
|
157
|
+
>
|
|
158
|
+
{children}
|
|
159
|
+
<button className="text-icon-primary hover:text-icon-highlight absolute top-4 right-4 disabled:pointer-events-none">
|
|
160
|
+
<XIcon className="size-4" />
|
|
161
|
+
<span className="sr-only">Close</span>
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const SheetContent = createClientOnlyComponent(SheetContentRoot, SheetContentFallback);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Header section inside the sheet.
|
|
171
|
+
*/
|
|
172
|
+
function SheetHeader({ className, ...props }: ComponentProps<"div">) {
|
|
173
|
+
return (
|
|
174
|
+
<div
|
|
175
|
+
data-slot="sheet-header"
|
|
176
|
+
className={cn("gap-md pb-xl flex flex-col", className)}
|
|
177
|
+
{...props}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Footer section inside the sheet.
|
|
184
|
+
*/
|
|
185
|
+
function SheetFooter({ className, ...props }: ComponentProps<"div">) {
|
|
186
|
+
return (
|
|
187
|
+
<div
|
|
188
|
+
data-slot="sheet-footer"
|
|
189
|
+
className={cn("gap-lg pt-xl mt-auto flex flex-col", className)}
|
|
190
|
+
{...props}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Title text for the sheet.
|
|
197
|
+
*/
|
|
198
|
+
function SheetTitleRoot({ className, ...props }: ComponentProps<typeof SheetPrimitive.Title>) {
|
|
199
|
+
return (
|
|
200
|
+
<SheetPrimitive.Title
|
|
201
|
+
data-slot="sheet-title"
|
|
202
|
+
className={cn("text-text-highlight text-uk-xl leading-uk-xl font-medium", className)}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function SheetTitleFallback({ className, ...props }: ComponentProps<"h2">) {
|
|
209
|
+
return (
|
|
210
|
+
<h2
|
|
211
|
+
data-slot="sheet-title"
|
|
212
|
+
className={cn("text-text-highlight text-uk-xl leading-uk-xl font-medium", className)}
|
|
213
|
+
{...props}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const SheetTitle = createClientOnlyComponent(SheetTitleRoot, SheetTitleFallback);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Secondary description text for the sheet.
|
|
222
|
+
*/
|
|
223
|
+
function SheetDescriptionRoot({
|
|
224
|
+
className,
|
|
225
|
+
...props
|
|
226
|
+
}: ComponentProps<typeof SheetPrimitive.Description>) {
|
|
227
|
+
return (
|
|
228
|
+
<SheetPrimitive.Description
|
|
229
|
+
data-slot="sheet-description"
|
|
230
|
+
className={cn("text-text-secondary text-uk-md leading-uk-md", className)}
|
|
231
|
+
{...props}
|
|
232
|
+
/>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function SheetDescriptionFallback({ className, ...props }: ComponentProps<"p">) {
|
|
237
|
+
return (
|
|
238
|
+
<p
|
|
239
|
+
data-slot="sheet-description"
|
|
240
|
+
className={cn("text-text-secondary text-uk-md leading-uk-md", className)}
|
|
241
|
+
{...props}
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const SheetDescription = createClientOnlyComponent(SheetDescriptionRoot, SheetDescriptionFallback);
|
|
247
|
+
|
|
248
|
+
export {
|
|
249
|
+
Sheet,
|
|
250
|
+
SheetTrigger,
|
|
251
|
+
SheetClose,
|
|
252
|
+
SheetContent,
|
|
253
|
+
SheetHeader,
|
|
254
|
+
SheetFooter,
|
|
255
|
+
SheetTitle,
|
|
256
|
+
SheetDescription,
|
|
257
|
+
};
|