@stagewise/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -0
- package/package.json +80 -0
- package/src/components/ui/accordion.tsx +66 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/avatar.tsx +107 -0
- package/src/components/ui/badge.tsx +52 -0
- package/src/components/ui/breadcrumb.tsx +125 -0
- package/src/components/ui/bubble.tsx +128 -0
- package/src/components/ui/button-group.tsx +87 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +221 -0
- package/src/components/ui/card.tsx +103 -0
- package/src/components/ui/carousel.tsx +240 -0
- package/src/components/ui/chart.tsx +371 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +295 -0
- package/src/components/ui/command.tsx +348 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +160 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +228 -0
- package/src/components/ui/dropdown-menu.tsx +266 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +236 -0
- package/src/components/ui/hover-card.tsx +51 -0
- package/src/components/ui/input-group.tsx +158 -0
- package/src/components/ui/input-otp.tsx +85 -0
- package/src/components/ui/input.tsx +20 -0
- package/src/components/ui/item.tsx +201 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +20 -0
- package/src/components/ui/marker.tsx +71 -0
- package/src/components/ui/menubar.tsx +280 -0
- package/src/components/ui/message.tsx +92 -0
- package/src/components/ui/native-select.tsx +61 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/pagination.tsx +130 -0
- package/src/components/ui/popover.tsx +88 -0
- package/src/components/ui/progress.tsx +83 -0
- package/src/components/ui/questionnaire.tsx +324 -0
- package/src/components/ui/radio-group.tsx +36 -0
- package/src/components/ui/resizable.tsx +50 -0
- package/src/components/ui/scroll-area.tsx +53 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +136 -0
- package/src/components/ui/sidebar.tsx +723 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +52 -0
- package/src/components/ui/spinner.tsx +10 -0
- package/src/components/ui/switch.tsx +32 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/tabs.tsx +82 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toast.tsx +234 -0
- package/src/components/ui/toggle-group.tsx +87 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +66 -0
- package/src/fonts/OFL.txt +92 -0
- package/src/fonts/geist-variable-italic.woff2 +0 -0
- package/src/fonts/geist-variable.woff2 +0 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/icons/custom/index.ts +1 -0
- package/src/icons/custom/ui-outline-18/Icon.tsx +28 -0
- package/src/icons/custom/ui-outline-18/IconBrowserTab.tsx +40 -0
- package/src/icons/custom/ui-outline-18/IconNewTerminal.tsx +77 -0
- package/src/icons/custom/ui-outline-18/index.ts +3 -0
- package/src/icons/index.ts +52 -0
- package/src/icons/nucleo/LICENSE.md +29 -0
- package/src/icons/nucleo/core-outline-24/Icon.tsx +27 -0
- package/src/icons/nucleo/core-outline-24/IconArrowUpOutline24.tsx +36 -0
- package/src/icons/nucleo/core-outline-24/IconBluetoothOutline24.tsx +26 -0
- package/src/icons/nucleo/core-outline-24/IconTrash2Outline24.tsx +76 -0
- package/src/icons/nucleo/core-outline-24/IconUsbOutline24.tsx +64 -0
- package/src/icons/nucleo/core-outline-24/index.ts +5 -0
- package/src/icons/nucleo/index.ts +48 -0
- package/src/icons/nucleo/micro-bold/Icon.tsx +27 -0
- package/src/icons/nucleo/micro-bold/IconArrowLeft.tsx +28 -0
- package/src/icons/nucleo/micro-bold/IconArrowRight.tsx +28 -0
- package/src/icons/nucleo/micro-bold/IconArrowRotateAnticlockwise.tsx +27 -0
- package/src/icons/nucleo/micro-bold/IconChevronLeft.tsx +16 -0
- package/src/icons/nucleo/micro-bold/IconChevronRight.tsx +16 -0
- package/src/icons/nucleo/micro-bold/IconClipboardContent.tsx +59 -0
- package/src/icons/nucleo/micro-bold/IconMagicWandSparkle.tsx +44 -0
- package/src/icons/nucleo/micro-bold/IconTriangleWarning.tsx +30 -0
- package/src/icons/nucleo/micro-bold/IconXmark.tsx +31 -0
- package/src/icons/nucleo/micro-bold/index.ts +10 -0
- package/src/icons/nucleo/social-media/Icon.tsx +27 -0
- package/src/icons/nucleo/social-media/IconApple.tsx +12 -0
- package/src/icons/nucleo/social-media/IconGithub.tsx +11 -0
- package/src/icons/nucleo/social-media/IconGoogle.tsx +20 -0
- package/src/icons/nucleo/social-media/index.ts +4 -0
- package/src/icons/nucleo/ui-fill-18/Icon.tsx +27 -0
- package/src/icons/nucleo/ui-fill-18/IconArrowLeftFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconArrowRightFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconCheckFill18.tsx +12 -0
- package/src/icons/nucleo/ui-fill-18/IconChevronDownFill18.tsx +12 -0
- package/src/icons/nucleo/ui-fill-18/IconGlobe2Fill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconLinkFill18.tsx +21 -0
- package/src/icons/nucleo/ui-fill-18/IconMediaStopFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconPinTackFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconPlusFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconVolumeUpFill18.tsx +22 -0
- package/src/icons/nucleo/ui-fill-18/IconVolumeXmarkFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/IconXmarkFill18.tsx +17 -0
- package/src/icons/nucleo/ui-fill-18/index.ts +13 -0
- package/src/icons/nucleo/ui-fill-duo-18/Icon.tsx +27 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconBrainNodesFillDuo18.tsx +32 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconCloudeCodeFillDuo18.tsx +25 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconDatabaseFillDuo18.tsx +24 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconDownload4FillDuo18.tsx +18 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconEarthFillDuo18.tsx +20 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconFinderFillDuo18.tsx +36 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconFolderContent2FillDuo18.tsx +22 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconGear3FillDuo18.tsx +18 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconHistoryFillDuo18.tsx +20 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconLockKeyFillDuo18.tsx +24 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconNoteFillDuo18.tsx +34 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconPenDrawSparkleFillDuo18.tsx +34 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconServerFillDuo18.tsx +22 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconSpace3dFillDuo18.tsx +24 -0
- package/src/icons/nucleo/ui-fill-duo-18/IconTriangleWarningFillDuo18.tsx +24 -0
- package/src/icons/nucleo/ui-fill-duo-18/index.ts +16 -0
- package/src/icons/nucleo/ui-outline-18/Icon.tsx +27 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowDownOutline18.tsx +33 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowRightOutline18.tsx +34 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowUpRightOutline18.tsx +34 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowsOppositeDirectionXOutline18.tsx +54 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowsToCenterOutline18.tsx +101 -0
- package/src/icons/nucleo/ui-outline-18/IconBanOutline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconBellDotOutline18.tsx +43 -0
- package/src/icons/nucleo/ui-outline-18/IconBookOpen5Outline18.tsx +40 -0
- package/src/icons/nucleo/ui-outline-18/IconBookOpenOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconBooks2Outline18.tsx +100 -0
- package/src/icons/nucleo/ui-outline-18/IconBoxSparkleOutline18.tsx +75 -0
- package/src/icons/nucleo/ui-outline-18/IconBrainOutline18.tsx +57 -0
- package/src/icons/nucleo/ui-outline-18/IconBranchOutOutline18.tsx +52 -0
- package/src/icons/nucleo/ui-outline-18/IconBugOutline18.tsx +98 -0
- package/src/icons/nucleo/ui-outline-18/IconCameraOutline18.tsx +42 -0
- package/src/icons/nucleo/ui-outline-18/IconChartPieOutline18.tsx +30 -0
- package/src/icons/nucleo/ui-outline-18/IconCheck2Outline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconCheckOutline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronDownOutline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronExpandYOutline18.tsx +31 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronLeftOutline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronReduceYOutline18.tsx +31 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronRightOutline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronUpOutline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconCircleCheckOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconCircleInfoOutline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconCircleQuestionOutline18.tsx +39 -0
- package/src/icons/nucleo/ui-outline-18/IconClipboardContentOutline18.tsx +60 -0
- package/src/icons/nucleo/ui-outline-18/IconClipboardOutline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconClone2Outline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconCloneDashed2Outline18.tsx +49 -0
- package/src/icons/nucleo/ui-outline-18/IconCodeBranchOutline18.tsx +65 -0
- package/src/icons/nucleo/ui-outline-18/IconCodeCommitOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconColorPaletteOutline18.tsx +56 -0
- package/src/icons/nucleo/ui-outline-18/IconConnection2Outline18.tsx +43 -0
- package/src/icons/nucleo/ui-outline-18/IconCopyIdOutline18.tsx +52 -0
- package/src/icons/nucleo/ui-outline-18/IconCopyOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconCreditCardOutline18.tsx +61 -0
- package/src/icons/nucleo/ui-outline-18/IconDatabaseSearchOutline18.tsx +64 -0
- package/src/icons/nucleo/ui-outline-18/IconDotsOutline18.tsx +46 -0
- package/src/icons/nucleo/ui-outline-18/IconDownload4Outline18.tsx +43 -0
- package/src/icons/nucleo/ui-outline-18/IconEarthOutline18.tsx +47 -0
- package/src/icons/nucleo/ui-outline-18/IconEarthSearchOutline18.tsx +61 -0
- package/src/icons/nucleo/ui-outline-18/IconEnvelopeOutline18.tsx +38 -0
- package/src/icons/nucleo/ui-outline-18/IconEye2Outline18.tsx +34 -0
- package/src/icons/nucleo/ui-outline-18/IconEyeOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconFilePenOutline18.tsx +56 -0
- package/src/icons/nucleo/ui-outline-18/IconFileSearchOutline18.tsx +64 -0
- package/src/icons/nucleo/ui-outline-18/IconFloppyDiskOutline18.tsx +40 -0
- package/src/icons/nucleo/ui-outline-18/IconFolder5Outline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderCloudOutline18.tsx +39 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderOpenOutline18.tsx +31 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderPenOutline18.tsx +40 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderPlusOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconFolderSearchOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconGear2Outline18.tsx +193 -0
- package/src/icons/nucleo/ui-outline-18/IconGear3Outline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconGlobe3Outline18.tsx +61 -0
- package/src/icons/nucleo/ui-outline-18/IconGripDotsVerticalOutline18.tsx +74 -0
- package/src/icons/nucleo/ui-outline-18/IconHardDriveOutline18.tsx +40 -0
- package/src/icons/nucleo/ui-outline-18/IconHelpChatOutline18.tsx +47 -0
- package/src/icons/nucleo/ui-outline-18/IconHotDrinkOutline18.tsx +60 -0
- package/src/icons/nucleo/ui-outline-18/IconImageSparkle3Outline18.tsx +41 -0
- package/src/icons/nucleo/ui-outline-18/IconKey2Outline18.tsx +61 -0
- package/src/icons/nucleo/ui-outline-18/IconLoader6Outline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconLocation2Outline18.tsx +45 -0
- package/src/icons/nucleo/ui-outline-18/IconLockKeyOutline18.tsx +58 -0
- package/src/icons/nucleo/ui-outline-18/IconMagicWandOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconMagnifierMinusOutline18.tsx +39 -0
- package/src/icons/nucleo/ui-outline-18/IconMagnifierOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconMagnifierPlusOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconMicrophone3Outline18.tsx +57 -0
- package/src/icons/nucleo/ui-outline-18/IconMinusOutline18.tsx +25 -0
- package/src/icons/nucleo/ui-outline-18/IconMoonOutline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconMsgSleepOutline18.tsx +41 -0
- package/src/icons/nucleo/ui-outline-18/IconMsgWritingOutline18.tsx +42 -0
- package/src/icons/nucleo/ui-outline-18/IconMusicOutline18.tsx +67 -0
- package/src/icons/nucleo/ui-outline-18/IconOctagonWarningOutline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconOpenExternalOutline18.tsx +51 -0
- package/src/icons/nucleo/ui-outline-18/IconOpenRectArrowInOutline18.tsx +43 -0
- package/src/icons/nucleo/ui-outline-18/IconPanelLeftOutline18.tsx +39 -0
- package/src/icons/nucleo/ui-outline-18/IconPaperclip2Outline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconPen2Outline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconPenDrawSparkleOutline18.tsx +46 -0
- package/src/icons/nucleo/ui-outline-18/IconPenOutline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconPenPlusOutline18.tsx +47 -0
- package/src/icons/nucleo/ui-outline-18/IconPenWriting3Outline18.tsx +31 -0
- package/src/icons/nucleo/ui-outline-18/IconPhoneOutline18.tsx +23 -0
- package/src/icons/nucleo/ui-outline-18/IconPinTackOutline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconPinTackSlashOutline18.tsx +47 -0
- package/src/icons/nucleo/ui-outline-18/IconPlusOutline18.tsx +38 -0
- package/src/icons/nucleo/ui-outline-18/IconPowerOffOutline18.tsx +36 -0
- package/src/icons/nucleo/ui-outline-18/IconPresentationScreenVideoOutline18.tsx +55 -0
- package/src/icons/nucleo/ui-outline-18/IconPuzzlePieceOutline18.tsx +22 -0
- package/src/icons/nucleo/ui-outline-18/IconRedoOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconRefreshAnticlockwiseOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconReuseOutline18.tsx +50 -0
- package/src/icons/nucleo/ui-outline-18/IconSearchContentOutline18.tsx +81 -0
- package/src/icons/nucleo/ui-outline-18/IconServerOutline18.tsx +73 -0
- package/src/icons/nucleo/ui-outline-18/IconSideProfileSparkleOutline18.tsx +28 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarLeftHideOutline18.tsx +49 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarLeftShowOutline18.tsx +49 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarRightHideOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarRightShowOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconSparkleOutline18.tsx +43 -0
- package/src/icons/nucleo/ui-outline-18/IconSpeakerOutline18.tsx +47 -0
- package/src/icons/nucleo/ui-outline-18/IconSplitViewOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconSquareCodeOutline18.tsx +40 -0
- package/src/icons/nucleo/ui-outline-18/IconSquareDashedOutline18.tsx +94 -0
- package/src/icons/nucleo/ui-outline-18/IconSquareTerminalOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconSunOutline18.tsx +121 -0
- package/src/icons/nucleo/ui-outline-18/IconTerminalOutline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconTextAlignLeft2Outline18.tsx +60 -0
- package/src/icons/nucleo/ui-outline-18/IconTextBgColorOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconTextColorOutline18.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconThumbsDownOutline18.tsx +36 -0
- package/src/icons/nucleo/ui-outline-18/IconThumbsUpOutline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconTrashOutline18.tsx +41 -0
- package/src/icons/nucleo/ui-outline-18/IconTriangleWarningOutline18.tsx +37 -0
- package/src/icons/nucleo/ui-outline-18/IconUndoOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconVersionsOutline18.tsx +46 -0
- package/src/icons/nucleo/ui-outline-18/IconVideoOutline18.tsx +45 -0
- package/src/icons/nucleo/ui-outline-18/IconWaveformLinesOutline18.tsx +80 -0
- package/src/icons/nucleo/ui-outline-18/IconWindowCodeOutline18.tsx +62 -0
- package/src/icons/nucleo/ui-outline-18/IconWindowPointerOutline18.tsx +51 -0
- package/src/icons/nucleo/ui-outline-18/IconXmarkOutline18.tsx +38 -0
- package/src/icons/nucleo/ui-outline-18/index.ts +128 -0
- package/src/index.ts +66 -0
- package/src/lib/utils.ts +6 -0
- package/src/plugin/index.ts +611 -0
- package/src/styles/animations.css +59 -0
- package/src/styles/bridge.css +117 -0
- package/src/styles/derived-utilities.css +179 -0
- package/src/styles/fonts.css +23 -0
- package/src/styles/index.css +72 -0
- package/src/styles/palette.css +189 -0
- package/src/styles/tailwind-tokens.css +56 -0
- package/src/styles/theme.css +103 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils"
|
|
5
|
+
import { IconChevronRightOutline18, IconCheckOutline18 } from "../../icons"
|
|
6
|
+
|
|
7
|
+
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
|
|
8
|
+
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
|
|
12
|
+
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
|
|
16
|
+
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function DropdownMenuContent({
|
|
20
|
+
align = "start",
|
|
21
|
+
alignOffset = 0,
|
|
22
|
+
side = "bottom",
|
|
23
|
+
sideOffset = 4,
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: MenuPrimitive.Popup.Props &
|
|
27
|
+
Pick<
|
|
28
|
+
MenuPrimitive.Positioner.Props,
|
|
29
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
30
|
+
>) {
|
|
31
|
+
return (
|
|
32
|
+
<MenuPrimitive.Portal>
|
|
33
|
+
<MenuPrimitive.Positioner
|
|
34
|
+
className="isolate z-50 outline-none"
|
|
35
|
+
align={align}
|
|
36
|
+
alignOffset={alignOffset}
|
|
37
|
+
side={side}
|
|
38
|
+
sideOffset={sideOffset}
|
|
39
|
+
>
|
|
40
|
+
<MenuPrimitive.Popup
|
|
41
|
+
data-slot="dropdown-menu-content"
|
|
42
|
+
className={cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 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 relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!", className )}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
</MenuPrimitive.Positioner>
|
|
46
|
+
</MenuPrimitive.Portal>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
|
|
51
|
+
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function DropdownMenuLabel({
|
|
55
|
+
className,
|
|
56
|
+
inset,
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<"div"> & {
|
|
59
|
+
inset?: boolean
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
data-slot="dropdown-menu-label"
|
|
64
|
+
data-inset={inset}
|
|
65
|
+
className={cn(
|
|
66
|
+
"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function DropdownMenuItem({
|
|
75
|
+
className,
|
|
76
|
+
inset,
|
|
77
|
+
variant = "default",
|
|
78
|
+
...props
|
|
79
|
+
}: MenuPrimitive.Item.Props & {
|
|
80
|
+
inset?: boolean
|
|
81
|
+
variant?: "default" | "destructive"
|
|
82
|
+
}) {
|
|
83
|
+
return (
|
|
84
|
+
<MenuPrimitive.Item
|
|
85
|
+
data-slot="dropdown-menu-item"
|
|
86
|
+
data-inset={inset}
|
|
87
|
+
data-variant={variant}
|
|
88
|
+
className={cn(
|
|
89
|
+
"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",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
|
|
98
|
+
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function DropdownMenuSubTrigger({
|
|
102
|
+
className,
|
|
103
|
+
inset,
|
|
104
|
+
children,
|
|
105
|
+
...props
|
|
106
|
+
}: MenuPrimitive.SubmenuTrigger.Props & {
|
|
107
|
+
inset?: boolean
|
|
108
|
+
}) {
|
|
109
|
+
return (
|
|
110
|
+
<MenuPrimitive.SubmenuTrigger
|
|
111
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
112
|
+
data-inset={inset}
|
|
113
|
+
className={cn(
|
|
114
|
+
"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",
|
|
115
|
+
className
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
{children}
|
|
120
|
+
<IconChevronRightOutline18 className="ml-auto" />
|
|
121
|
+
</MenuPrimitive.SubmenuTrigger>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function DropdownMenuSubContent({
|
|
126
|
+
align = "start",
|
|
127
|
+
alignOffset = -3,
|
|
128
|
+
side = "right",
|
|
129
|
+
sideOffset = 0,
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
133
|
+
return (
|
|
134
|
+
<DropdownMenuContent
|
|
135
|
+
data-slot="dropdown-menu-sub-content"
|
|
136
|
+
className={cn("w-auto min-w-[96px] rounded-lg p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 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 relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!", className )}
|
|
137
|
+
align={align}
|
|
138
|
+
alignOffset={alignOffset}
|
|
139
|
+
side={side}
|
|
140
|
+
sideOffset={sideOffset}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function DropdownMenuCheckboxItem({
|
|
147
|
+
className,
|
|
148
|
+
children,
|
|
149
|
+
checked,
|
|
150
|
+
inset,
|
|
151
|
+
...props
|
|
152
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
153
|
+
inset?: boolean
|
|
154
|
+
}) {
|
|
155
|
+
return (
|
|
156
|
+
<MenuPrimitive.CheckboxItem
|
|
157
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
158
|
+
data-inset={inset}
|
|
159
|
+
className={cn(
|
|
160
|
+
"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",
|
|
161
|
+
className
|
|
162
|
+
)}
|
|
163
|
+
checked={checked}
|
|
164
|
+
{...props}
|
|
165
|
+
>
|
|
166
|
+
<span
|
|
167
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
168
|
+
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
169
|
+
>
|
|
170
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
171
|
+
<IconCheckOutline18
|
|
172
|
+
/>
|
|
173
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
174
|
+
</span>
|
|
175
|
+
{children}
|
|
176
|
+
</MenuPrimitive.CheckboxItem>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
181
|
+
return (
|
|
182
|
+
<MenuPrimitive.RadioGroup
|
|
183
|
+
data-slot="dropdown-menu-radio-group"
|
|
184
|
+
{...props}
|
|
185
|
+
/>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function DropdownMenuRadioItem({
|
|
190
|
+
className,
|
|
191
|
+
children,
|
|
192
|
+
inset,
|
|
193
|
+
...props
|
|
194
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
195
|
+
inset?: boolean
|
|
196
|
+
}) {
|
|
197
|
+
return (
|
|
198
|
+
<MenuPrimitive.RadioItem
|
|
199
|
+
data-slot="dropdown-menu-radio-item"
|
|
200
|
+
data-inset={inset}
|
|
201
|
+
className={cn(
|
|
202
|
+
"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",
|
|
203
|
+
className
|
|
204
|
+
)}
|
|
205
|
+
{...props}
|
|
206
|
+
>
|
|
207
|
+
<span
|
|
208
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
209
|
+
data-slot="dropdown-menu-radio-item-indicator"
|
|
210
|
+
>
|
|
211
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
212
|
+
<IconCheckOutline18
|
|
213
|
+
/>
|
|
214
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
215
|
+
</span>
|
|
216
|
+
{children}
|
|
217
|
+
</MenuPrimitive.RadioItem>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function DropdownMenuSeparator({
|
|
222
|
+
className,
|
|
223
|
+
...props
|
|
224
|
+
}: MenuPrimitive.Separator.Props) {
|
|
225
|
+
return (
|
|
226
|
+
<MenuPrimitive.Separator
|
|
227
|
+
data-slot="dropdown-menu-separator"
|
|
228
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
229
|
+
{...props}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function DropdownMenuShortcut({
|
|
235
|
+
className,
|
|
236
|
+
...props
|
|
237
|
+
}: React.ComponentProps<"span">) {
|
|
238
|
+
return (
|
|
239
|
+
<span
|
|
240
|
+
data-slot="dropdown-menu-shortcut"
|
|
241
|
+
className={cn(
|
|
242
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
243
|
+
className
|
|
244
|
+
)}
|
|
245
|
+
{...props}
|
|
246
|
+
/>
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export {
|
|
251
|
+
DropdownMenu,
|
|
252
|
+
DropdownMenuPortal,
|
|
253
|
+
DropdownMenuTrigger,
|
|
254
|
+
DropdownMenuContent,
|
|
255
|
+
DropdownMenuGroup,
|
|
256
|
+
DropdownMenuLabel,
|
|
257
|
+
DropdownMenuItem,
|
|
258
|
+
DropdownMenuCheckboxItem,
|
|
259
|
+
DropdownMenuRadioGroup,
|
|
260
|
+
DropdownMenuRadioItem,
|
|
261
|
+
DropdownMenuSeparator,
|
|
262
|
+
DropdownMenuShortcut,
|
|
263
|
+
DropdownMenuSub,
|
|
264
|
+
DropdownMenuSubTrigger,
|
|
265
|
+
DropdownMenuSubContent,
|
|
266
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Empty({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="empty"
|
|
9
|
+
className={cn(
|
|
10
|
+
"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",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="empty-header"
|
|
22
|
+
className={cn("flex max-w-sm flex-col items-center gap-2", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const emptyMediaVariants = cva(
|
|
29
|
+
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
default: "bg-transparent",
|
|
34
|
+
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: "default",
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
function EmptyMedia({
|
|
44
|
+
className,
|
|
45
|
+
variant = "default",
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
data-slot="empty-icon"
|
|
51
|
+
data-variant={variant}
|
|
52
|
+
className={cn(emptyMediaVariants({ variant, className }))}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="empty-title"
|
|
62
|
+
className={cn(
|
|
63
|
+
"font-heading text-sm font-medium tracking-tight",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot="empty-description"
|
|
75
|
+
className={cn(
|
|
76
|
+
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="empty-content"
|
|
88
|
+
className={cn(
|
|
89
|
+
"flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
Empty,
|
|
99
|
+
EmptyHeader,
|
|
100
|
+
EmptyTitle,
|
|
101
|
+
EmptyDescription,
|
|
102
|
+
EmptyContent,
|
|
103
|
+
EmptyMedia,
|
|
104
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { useMemo } from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils"
|
|
5
|
+
import { Label } from "./label"
|
|
6
|
+
import { Separator } from "./separator"
|
|
7
|
+
|
|
8
|
+
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
9
|
+
return (
|
|
10
|
+
<fieldset
|
|
11
|
+
data-slot="field-set"
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function FieldLegend({
|
|
22
|
+
className,
|
|
23
|
+
variant = "legend",
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
|
|
26
|
+
return (
|
|
27
|
+
<legend
|
|
28
|
+
data-slot="field-legend"
|
|
29
|
+
data-variant={variant}
|
|
30
|
+
className={cn(
|
|
31
|
+
"mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
data-slot="field-group"
|
|
43
|
+
className={cn(
|
|
44
|
+
"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",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fieldVariants = cva(
|
|
53
|
+
"group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
|
|
54
|
+
{
|
|
55
|
+
variants: {
|
|
56
|
+
orientation: {
|
|
57
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
58
|
+
horizontal:
|
|
59
|
+
"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",
|
|
60
|
+
responsive:
|
|
61
|
+
"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",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
orientation: "vertical",
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
function Field({
|
|
71
|
+
className,
|
|
72
|
+
orientation = "vertical",
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
role="group"
|
|
78
|
+
data-slot="field"
|
|
79
|
+
data-orientation={orientation}
|
|
80
|
+
className={cn(fieldVariants({ orientation }), className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
data-slot="field-content"
|
|
90
|
+
className={cn(
|
|
91
|
+
"group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function FieldLabel({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof Label>) {
|
|
103
|
+
return (
|
|
104
|
+
<Label
|
|
105
|
+
data-slot="field-label"
|
|
106
|
+
className={cn(
|
|
107
|
+
"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 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10",
|
|
108
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
data-slot="field-label"
|
|
120
|
+
className={cn(
|
|
121
|
+
"flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
130
|
+
return (
|
|
131
|
+
<p
|
|
132
|
+
data-slot="field-description"
|
|
133
|
+
className={cn(
|
|
134
|
+
"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
|
|
135
|
+
"last:mt-0 nth-last-2:-mt-1",
|
|
136
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
137
|
+
className
|
|
138
|
+
)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function FieldSeparator({
|
|
145
|
+
children,
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
}: React.ComponentProps<"div"> & {
|
|
149
|
+
children?: React.ReactNode
|
|
150
|
+
}) {
|
|
151
|
+
return (
|
|
152
|
+
<div
|
|
153
|
+
data-slot="field-separator"
|
|
154
|
+
data-content={!!children}
|
|
155
|
+
className={cn(
|
|
156
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<Separator className="absolute inset-0 top-1/2" />
|
|
162
|
+
{children && (
|
|
163
|
+
<span
|
|
164
|
+
className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"
|
|
165
|
+
data-slot="field-separator-content"
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function FieldError({
|
|
175
|
+
className,
|
|
176
|
+
children,
|
|
177
|
+
errors,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<"div"> & {
|
|
180
|
+
errors?: Array<{ message?: string } | undefined>
|
|
181
|
+
}) {
|
|
182
|
+
const content = useMemo(() => {
|
|
183
|
+
if (children) {
|
|
184
|
+
return children
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!errors?.length) {
|
|
188
|
+
return null
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const uniqueErrors = [
|
|
192
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
if (uniqueErrors?.length == 1) {
|
|
196
|
+
return uniqueErrors[0]?.message
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
201
|
+
{uniqueErrors.map(
|
|
202
|
+
(error, index) =>
|
|
203
|
+
error?.message && <li key={index}>{error.message}</li>
|
|
204
|
+
)}
|
|
205
|
+
</ul>
|
|
206
|
+
)
|
|
207
|
+
}, [children, errors])
|
|
208
|
+
|
|
209
|
+
if (!content) {
|
|
210
|
+
return null
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div
|
|
215
|
+
role="alert"
|
|
216
|
+
data-slot="field-error"
|
|
217
|
+
className={cn("text-sm font-normal text-destructive", className)}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
{content}
|
|
221
|
+
</div>
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
Field,
|
|
227
|
+
FieldLabel,
|
|
228
|
+
FieldDescription,
|
|
229
|
+
FieldError,
|
|
230
|
+
FieldGroup,
|
|
231
|
+
FieldLegend,
|
|
232
|
+
FieldSeparator,
|
|
233
|
+
FieldSet,
|
|
234
|
+
FieldContent,
|
|
235
|
+
FieldTitle,
|
|
236
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
|
|
7
|
+
function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
|
|
8
|
+
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
|
|
12
|
+
return (
|
|
13
|
+
<PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function HoverCardContent({
|
|
18
|
+
className,
|
|
19
|
+
side = "bottom",
|
|
20
|
+
sideOffset = 4,
|
|
21
|
+
align = "center",
|
|
22
|
+
alignOffset = 4,
|
|
23
|
+
...props
|
|
24
|
+
}: PreviewCardPrimitive.Popup.Props &
|
|
25
|
+
Pick<
|
|
26
|
+
PreviewCardPrimitive.Positioner.Props,
|
|
27
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
28
|
+
>) {
|
|
29
|
+
return (
|
|
30
|
+
<PreviewCardPrimitive.Portal data-slot="hover-card-portal">
|
|
31
|
+
<PreviewCardPrimitive.Positioner
|
|
32
|
+
align={align}
|
|
33
|
+
alignOffset={alignOffset}
|
|
34
|
+
side={side}
|
|
35
|
+
sideOffset={sideOffset}
|
|
36
|
+
className="isolate z-50"
|
|
37
|
+
>
|
|
38
|
+
<PreviewCardPrimitive.Popup
|
|
39
|
+
data-slot="hover-card-content"
|
|
40
|
+
className={cn(
|
|
41
|
+
"z-50 w-64 origin-(--transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
</PreviewCardPrimitive.Positioner>
|
|
47
|
+
</PreviewCardPrimitive.Portal>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent }
|