@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,13 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils"
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="skeleton"
|
|
7
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Slider as SliderPrimitive } from "@base-ui/react/slider"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Slider({
|
|
6
|
+
className,
|
|
7
|
+
defaultValue,
|
|
8
|
+
value,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
...props
|
|
12
|
+
}: SliderPrimitive.Root.Props) {
|
|
13
|
+
const _values = Array.isArray(value)
|
|
14
|
+
? value
|
|
15
|
+
: Array.isArray(defaultValue)
|
|
16
|
+
? defaultValue
|
|
17
|
+
: [min, max]
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SliderPrimitive.Root
|
|
21
|
+
className={cn("data-horizontal:w-full data-vertical:h-full", className)}
|
|
22
|
+
data-slot="slider"
|
|
23
|
+
defaultValue={defaultValue}
|
|
24
|
+
value={value}
|
|
25
|
+
min={min}
|
|
26
|
+
max={max}
|
|
27
|
+
thumbAlignment="edge"
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
|
|
31
|
+
<SliderPrimitive.Track
|
|
32
|
+
data-slot="slider-track"
|
|
33
|
+
className="relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
|
|
34
|
+
>
|
|
35
|
+
<SliderPrimitive.Indicator
|
|
36
|
+
data-slot="slider-range"
|
|
37
|
+
className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
38
|
+
/>
|
|
39
|
+
</SliderPrimitive.Track>
|
|
40
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
41
|
+
<SliderPrimitive.Thumb
|
|
42
|
+
data-slot="slider-thumb"
|
|
43
|
+
key={index}
|
|
44
|
+
className="relative block size-4 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
|
|
45
|
+
/>
|
|
46
|
+
))}
|
|
47
|
+
</SliderPrimitive.Control>
|
|
48
|
+
</SliderPrimitive.Root>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Slider }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils"
|
|
2
|
+
import { IconLoader6Outline18 } from "../../icons"
|
|
3
|
+
|
|
4
|
+
function Spinner({ className, ...props }: Omit<React.ComponentProps<"svg">, "strokeWidth">) {
|
|
5
|
+
return (
|
|
6
|
+
<IconLoader6Outline18 data-slot="spinner" role="status" aria-label="Loading" className={cn("size-4 animate-spin", className)} {...props} />
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { Spinner }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
|
|
7
|
+
function Switch({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}: SwitchPrimitive.Root.Props & {
|
|
12
|
+
size?: "sm" | "default"
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
data-slot="switch"
|
|
17
|
+
data-size={size}
|
|
18
|
+
className={cn(
|
|
19
|
+
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-5 data-[size=default]:w-[34px] data-[size=sm]:h-4 data-[size=sm]:w-[26px] px-px dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<SwitchPrimitive.Thumb
|
|
25
|
+
data-slot="switch-thumb"
|
|
26
|
+
className="pointer-events-none block rounded-full bg-background ring-0 group-data-[size=default]/switch:h-4 group-data-[size=sm]/switch:h-3 group-data-[size=default]/switch:w-4 group-data-[size=sm]/switch:w-3 group-data-[size=default]/switch:[--knob-w:1rem] group-data-[size=sm]/switch:[--knob-w:0.75rem] group-data-[size=default]/switch:[--knob-travel:14px] group-data-[size=sm]/switch:[--knob-travel:10px] group-data-[size=default]/switch:[--track-w:30px] group-data-[size=sm]/switch:[--track-w:22px] group-data-[size=default]/switch:data-checked:translate-x-[14px] group-data-[size=sm]/switch:data-checked:translate-x-[10px] dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground group-data-checked/switch:animate-switch-knob-on group-data-unchecked/switch:animate-switch-knob-off"
|
|
27
|
+
/>
|
|
28
|
+
</SwitchPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Switch }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="table-container"
|
|
9
|
+
className="relative w-full overflow-x-auto"
|
|
10
|
+
>
|
|
11
|
+
<table
|
|
12
|
+
data-slot="table"
|
|
13
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
21
|
+
return (
|
|
22
|
+
<thead
|
|
23
|
+
data-slot="table-header"
|
|
24
|
+
className={cn("[&_tr]:border-b", className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
|
31
|
+
return (
|
|
32
|
+
<tbody
|
|
33
|
+
data-slot="table-body"
|
|
34
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
41
|
+
return (
|
|
42
|
+
<tfoot
|
|
43
|
+
data-slot="table-footer"
|
|
44
|
+
className={cn(
|
|
45
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
54
|
+
return (
|
|
55
|
+
<tr
|
|
56
|
+
data-slot="table-row"
|
|
57
|
+
className={cn(
|
|
58
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
67
|
+
return (
|
|
68
|
+
<th
|
|
69
|
+
data-slot="table-head"
|
|
70
|
+
className={cn(
|
|
71
|
+
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
80
|
+
return (
|
|
81
|
+
<td
|
|
82
|
+
data-slot="table-cell"
|
|
83
|
+
className={cn(
|
|
84
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
85
|
+
className
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function TableCaption({
|
|
93
|
+
className,
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<"caption">) {
|
|
96
|
+
return (
|
|
97
|
+
<caption
|
|
98
|
+
data-slot="table-caption"
|
|
99
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Table,
|
|
107
|
+
TableHeader,
|
|
108
|
+
TableBody,
|
|
109
|
+
TableFooter,
|
|
110
|
+
TableHead,
|
|
111
|
+
TableRow,
|
|
112
|
+
TableCell,
|
|
113
|
+
TableCaption,
|
|
114
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function Tabs({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "horizontal",
|
|
11
|
+
...props
|
|
12
|
+
}: TabsPrimitive.Root.Props) {
|
|
13
|
+
return (
|
|
14
|
+
<TabsPrimitive.Root
|
|
15
|
+
data-slot="tabs"
|
|
16
|
+
data-orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"group/tabs flex gap-2 data-horizontal:flex-col",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const tabsListVariants = cva(
|
|
27
|
+
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
default: "bg-muted",
|
|
32
|
+
line: "gap-1 bg-transparent",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
function TabsList({
|
|
42
|
+
className,
|
|
43
|
+
variant = "default",
|
|
44
|
+
...props
|
|
45
|
+
}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
|
|
46
|
+
return (
|
|
47
|
+
<TabsPrimitive.List
|
|
48
|
+
data-slot="tabs-list"
|
|
49
|
+
data-variant={variant}
|
|
50
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
57
|
+
return (
|
|
58
|
+
<TabsPrimitive.Tab
|
|
59
|
+
data-slot="tabs-trigger"
|
|
60
|
+
className={cn(
|
|
61
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
62
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
63
|
+
"data-active:bg-background data-active:text-foreground dark:data-active:bg-background dark:data-active:text-foreground",
|
|
64
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
|
|
73
|
+
return (
|
|
74
|
+
<TabsPrimitive.Panel
|
|
75
|
+
data-slot="tabs-content"
|
|
76
|
+
className={cn("flex-1 text-sm outline-none", className)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
6
|
+
return (
|
|
7
|
+
<textarea
|
|
8
|
+
data-slot="textarea"
|
|
9
|
+
className={cn(
|
|
10
|
+
"flex field-sizing-content min-h-16 w-full rounded-lg border border-derived-strong bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Textarea }
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Toast as ToastPrimitive } from "@base-ui/react/toast"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { Button } from "./button"
|
|
8
|
+
import { IconOctagonWarningOutline18, IconCircleCheckOutline18, IconXmarkOutline18, IconCircleInfoOutline18, IconTriangleWarningOutline18, IconLoader6Outline18 } from "../../icons"
|
|
9
|
+
|
|
10
|
+
const toast = ToastPrimitive.createToastManager()
|
|
11
|
+
|
|
12
|
+
function ToastProvider({ ...props }: ToastPrimitive.Provider.Props) {
|
|
13
|
+
return <ToastPrimitive.Provider {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ToastPortal({ ...props }: ToastPrimitive.Portal.Props) {
|
|
17
|
+
return <ToastPrimitive.Portal data-slot="toast-portal" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ToastViewport({ className, ...props }: ToastPrimitive.Viewport.Props) {
|
|
21
|
+
return (
|
|
22
|
+
<ToastPrimitive.Viewport
|
|
23
|
+
data-slot="toast-viewport"
|
|
24
|
+
className={cn(
|
|
25
|
+
"pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function Toast({ className, ...props }: ToastPrimitive.Root.Props) {
|
|
34
|
+
return (
|
|
35
|
+
<ToastPrimitive.Root
|
|
36
|
+
data-slot="toast"
|
|
37
|
+
className={cn(
|
|
38
|
+
"group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
39
|
+
"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]",
|
|
40
|
+
"h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]",
|
|
41
|
+
"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
42
|
+
"data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
|
|
43
|
+
"data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]",
|
|
44
|
+
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
|
|
45
|
+
"data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
46
|
+
"data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
|
|
47
|
+
"data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
48
|
+
"data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
49
|
+
"data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
50
|
+
"data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
|
|
51
|
+
"data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
52
|
+
"data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ToastContent({ className, ...props }: ToastPrimitive.Content.Props) {
|
|
61
|
+
return (
|
|
62
|
+
<ToastPrimitive.Content
|
|
63
|
+
data-slot="toast-content"
|
|
64
|
+
className={cn(
|
|
65
|
+
"flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function ToastTitle({ className, ...props }: ToastPrimitive.Title.Props) {
|
|
74
|
+
return (
|
|
75
|
+
<ToastPrimitive.Title
|
|
76
|
+
data-slot="toast-title"
|
|
77
|
+
className={cn("text-sm font-medium", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function ToastDescription({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: ToastPrimitive.Description.Props) {
|
|
87
|
+
return (
|
|
88
|
+
<ToastPrimitive.Description
|
|
89
|
+
data-slot="toast-description"
|
|
90
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function ToastAction({
|
|
97
|
+
className,
|
|
98
|
+
render = <Button variant="outline" size="sm" />,
|
|
99
|
+
...props
|
|
100
|
+
}: ToastPrimitive.Action.Props) {
|
|
101
|
+
return (
|
|
102
|
+
<ToastPrimitive.Action
|
|
103
|
+
data-slot="toast-action"
|
|
104
|
+
render={render}
|
|
105
|
+
className={cn("shrink-0", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function ToastClose({
|
|
112
|
+
className,
|
|
113
|
+
children,
|
|
114
|
+
render = <Button variant="ghost" size="icon-sm" />,
|
|
115
|
+
...props
|
|
116
|
+
}: ToastPrimitive.Close.Props) {
|
|
117
|
+
return (
|
|
118
|
+
<ToastPrimitive.Close
|
|
119
|
+
data-slot="toast-close"
|
|
120
|
+
aria-label="Close toast"
|
|
121
|
+
render={render}
|
|
122
|
+
className={cn(
|
|
123
|
+
"relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children ?? (
|
|
129
|
+
<IconXmarkOutline18 aria-hidden="true" />
|
|
130
|
+
)}
|
|
131
|
+
</ToastPrimitive.Close>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function ToastIcon({ type }: { type: string | undefined }) {
|
|
136
|
+
let icon: React.ReactNode = null
|
|
137
|
+
|
|
138
|
+
if (type === "success") {
|
|
139
|
+
icon = (
|
|
140
|
+
<IconCircleCheckOutline18 aria-hidden="true" />
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (type === "info") {
|
|
145
|
+
icon = (
|
|
146
|
+
<IconCircleInfoOutline18 aria-hidden="true" />
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (type === "warning") {
|
|
151
|
+
icon = (
|
|
152
|
+
<IconTriangleWarningOutline18 aria-hidden="true" />
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (type === "error") {
|
|
157
|
+
icon = (
|
|
158
|
+
<IconOctagonWarningOutline18 className="text-destructive" aria-hidden="true" />
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (type === "loading") {
|
|
163
|
+
icon = (
|
|
164
|
+
<IconLoader6Outline18 className="animate-spin" aria-hidden="true" />
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!icon) {
|
|
169
|
+
return null
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<span
|
|
174
|
+
data-slot="toast-icon"
|
|
175
|
+
className="shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4"
|
|
176
|
+
>
|
|
177
|
+
{icon}
|
|
178
|
+
</span>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function ToastList() {
|
|
183
|
+
const { toasts } = ToastPrimitive.useToastManager()
|
|
184
|
+
|
|
185
|
+
return toasts.map((toastItem) => (
|
|
186
|
+
<Toast key={toastItem.id} toast={toastItem}>
|
|
187
|
+
<ToastContent>
|
|
188
|
+
<ToastIcon type={toastItem.type} />
|
|
189
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
190
|
+
<ToastTitle />
|
|
191
|
+
<ToastDescription />
|
|
192
|
+
</div>
|
|
193
|
+
<ToastAction />
|
|
194
|
+
<ToastClose />
|
|
195
|
+
</ToastContent>
|
|
196
|
+
</Toast>
|
|
197
|
+
))
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function Toaster({
|
|
201
|
+
children,
|
|
202
|
+
toastManager = toast,
|
|
203
|
+
...props
|
|
204
|
+
}: ToastPrimitive.Provider.Props) {
|
|
205
|
+
return (
|
|
206
|
+
<ToastProvider toastManager={toastManager} {...props}>
|
|
207
|
+
{children}
|
|
208
|
+
<ToastPortal>
|
|
209
|
+
<ToastViewport>
|
|
210
|
+
<ToastList />
|
|
211
|
+
</ToastViewport>
|
|
212
|
+
</ToastPortal>
|
|
213
|
+
</ToastProvider>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const createToastManager = ToastPrimitive.createToastManager
|
|
218
|
+
const useToastManager = ToastPrimitive.useToastManager
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
Toaster,
|
|
222
|
+
Toast,
|
|
223
|
+
ToastAction,
|
|
224
|
+
ToastClose,
|
|
225
|
+
ToastContent,
|
|
226
|
+
ToastDescription,
|
|
227
|
+
ToastPortal,
|
|
228
|
+
ToastProvider,
|
|
229
|
+
ToastTitle,
|
|
230
|
+
ToastViewport,
|
|
231
|
+
createToastManager,
|
|
232
|
+
toast,
|
|
233
|
+
useToastManager,
|
|
234
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
|
|
3
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "@base-ui/react/toggle-group"
|
|
4
|
+
import { type VariantProps } from "class-variance-authority"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { toggleVariants } from "./toggle"
|
|
8
|
+
|
|
9
|
+
const ToggleGroupContext = React.createContext<
|
|
10
|
+
VariantProps<typeof toggleVariants> & {
|
|
11
|
+
spacing?: number
|
|
12
|
+
orientation?: "horizontal" | "vertical"
|
|
13
|
+
}
|
|
14
|
+
>({
|
|
15
|
+
size: "default",
|
|
16
|
+
variant: "default",
|
|
17
|
+
spacing: 2,
|
|
18
|
+
orientation: "horizontal",
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
function ToggleGroup({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
size,
|
|
25
|
+
spacing = 2,
|
|
26
|
+
orientation = "horizontal",
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}: ToggleGroupPrimitive.Props &
|
|
30
|
+
VariantProps<typeof toggleVariants> & {
|
|
31
|
+
spacing?: number
|
|
32
|
+
orientation?: "horizontal" | "vertical"
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<ToggleGroupPrimitive
|
|
36
|
+
data-slot="toggle-group"
|
|
37
|
+
data-variant={variant}
|
|
38
|
+
data-size={size}
|
|
39
|
+
data-spacing={spacing}
|
|
40
|
+
data-orientation={orientation}
|
|
41
|
+
style={{ "--gap": spacing } as React.CSSProperties}
|
|
42
|
+
className={cn(
|
|
43
|
+
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<ToggleGroupContext.Provider
|
|
49
|
+
value={{ variant, size, spacing, orientation }}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</ToggleGroupContext.Provider>
|
|
53
|
+
</ToggleGroupPrimitive>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ToggleGroupItem({
|
|
58
|
+
className,
|
|
59
|
+
children,
|
|
60
|
+
variant = "default",
|
|
61
|
+
size = "default",
|
|
62
|
+
...props
|
|
63
|
+
}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
|
|
64
|
+
const context = React.useContext(ToggleGroupContext)
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<TogglePrimitive
|
|
68
|
+
data-slot="toggle-group-item"
|
|
69
|
+
data-variant={context.variant || variant}
|
|
70
|
+
data-size={context.size || size}
|
|
71
|
+
data-spacing={context.spacing}
|
|
72
|
+
className={cn(
|
|
73
|
+
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
|
|
74
|
+
toggleVariants({
|
|
75
|
+
variant: context.variant || variant,
|
|
76
|
+
size: context.size || size,
|
|
77
|
+
}),
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</TogglePrimitive>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { ToggleGroup, ToggleGroupItem }
|