@codefast/ui 0.3.16-canary.2 → 0.3.16-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/dist/components/accordion.mjs +2 -2
- package/dist/components/alert-dialog.d.mts +1 -1
- package/dist/components/alert-dialog.mjs +4 -4
- package/dist/components/alert.d.mts +3 -13
- package/dist/components/alert.mjs +3 -23
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +2 -44
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +3 -24
- package/dist/components/button.d.mts +3 -25
- package/dist/components/button.mjs +2 -72
- package/dist/components/calendar.mjs +2 -1
- package/dist/components/carousel.d.mts +1 -2
- package/dist/components/chart.d.mts +2 -4
- package/dist/components/checkbox.mjs +2 -2
- package/dist/components/context-menu.mjs +2 -2
- package/dist/components/dialog.d.mts +1 -1
- package/dist/components/dialog.mjs +4 -4
- package/dist/components/drawer.d.mts +1 -1
- package/dist/components/drawer.mjs +2 -2
- package/dist/components/dropdown-menu.mjs +2 -2
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +3 -18
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +3 -32
- package/dist/components/form.d.mts +2 -4
- package/dist/components/hover-card.mjs +1 -1
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +3 -90
- package/dist/components/input-number.mjs +4 -4
- package/dist/components/input-otp.mjs +2 -2
- package/dist/components/input.mjs +1 -1
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +3 -56
- package/dist/components/menubar.mjs +2 -2
- package/dist/components/native-select.mjs +1 -1
- package/dist/components/navigation-menu.d.mts +1 -6
- package/dist/components/navigation-menu.mjs +8 -15
- package/dist/components/pagination.d.mts +1 -1
- package/dist/components/pagination.mjs +1 -1
- package/dist/components/popover.mjs +1 -1
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -47
- package/dist/components/progress.mjs +1 -1
- package/dist/components/radio-group.mjs +1 -1
- package/dist/components/radio.mjs +1 -1
- package/dist/components/scroll-area.d.mts +3 -19
- package/dist/components/scroll-area.mjs +4 -61
- package/dist/components/select.d.mts +1 -1
- package/dist/components/select.mjs +3 -3
- package/dist/components/separator.d.mts +3 -18
- package/dist/components/separator.mjs +3 -23
- package/dist/components/sheet.d.mts +6 -18
- package/dist/components/sheet.mjs +6 -49
- package/dist/components/sidebar.d.mts +4 -19
- package/dist/components/sidebar.mjs +10 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/spinner.mjs +1 -1
- package/dist/components/switch.mjs +2 -2
- package/dist/components/table.mjs +1 -1
- package/dist/components/tabs.mjs +1 -1
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +3 -2
- package/dist/components/toggle-group.mjs +1 -1
- package/dist/components/toggle.d.mts +2 -21
- package/dist/components/toggle.mjs +2 -39
- package/dist/components/tooltip.mjs +1 -1
- package/dist/index.d.mts +31 -16
- package/dist/index.mjs +30 -15
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +1 -2
- package/dist/primitives/input-number.d.mts +1 -2
- package/dist/primitives/input.d.mts +1 -2
- package/dist/primitives/progress-circle.d.mts +1 -2
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +25 -0
- package/dist/variants/badge.d.mts +20 -0
- package/dist/variants/badge.mjs +46 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +26 -0
- package/dist/variants/button.d.mts +30 -0
- package/dist/variants/button.mjs +76 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +20 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +34 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +93 -0
- package/dist/variants/item.d.mts +37 -0
- package/dist/variants/item.mjs +60 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +12 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +49 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +63 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +50 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +42 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +43 -0
- package/package.json +168 -20
- package/src/components/accordion.tsx +156 -0
- package/src/components/alert-dialog.tsx +314 -0
- package/src/components/alert.tsx +86 -0
- package/src/components/aspect-ratio.tsx +28 -0
- package/src/components/avatar.tsx +84 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +197 -0
- package/src/components/button-group.tsx +107 -0
- package/src/components/button.tsx +66 -0
- package/src/components/calendar.tsx +277 -0
- package/src/components/card.tsx +175 -0
- package/src/components/carousel.tsx +367 -0
- package/src/components/chart.tsx +587 -0
- package/src/components/checkbox-cards.tsx +92 -0
- package/src/components/checkbox-group.tsx +83 -0
- package/src/components/checkbox.tsx +65 -0
- package/src/components/collapsible.tsx +60 -0
- package/src/components/command.tsx +311 -0
- package/src/components/context-menu.tsx +489 -0
- package/src/components/dialog.tsx +295 -0
- package/src/components/drawer.tsx +271 -0
- package/src/components/dropdown-menu.tsx +498 -0
- package/src/components/empty.tsx +169 -0
- package/src/components/field.tsx +362 -0
- package/src/components/form.tsx +300 -0
- package/src/components/hover-card.tsx +116 -0
- package/src/components/input-group.tsx +224 -0
- package/src/components/input-number.tsx +161 -0
- package/src/components/input-otp.tsx +151 -0
- package/src/components/input-password.tsx +74 -0
- package/src/components/input-search.tsx +98 -0
- package/src/components/input.tsx +52 -0
- package/src/components/item.tsx +280 -0
- package/src/components/kbd.tsx +59 -0
- package/src/components/label.tsx +44 -0
- package/src/components/menubar.tsx +531 -0
- package/src/components/native-select.tsx +96 -0
- package/src/components/navigation-menu.tsx +295 -0
- package/src/components/pagination.tsx +204 -0
- package/src/components/popover.tsx +139 -0
- package/src/components/progress-circle.tsx +203 -0
- package/src/components/progress.tsx +54 -0
- package/src/components/radio-cards.tsx +85 -0
- package/src/components/radio-group.tsx +79 -0
- package/src/components/radio.tsx +61 -0
- package/src/components/resizable.tsx +99 -0
- package/src/components/scroll-area.tsx +115 -0
- package/src/components/select.tsx +319 -0
- package/src/components/separator.tsx +74 -0
- package/src/components/sheet.tsx +278 -0
- package/src/components/sidebar.tsx +1056 -0
- package/src/components/skeleton.tsx +37 -0
- package/src/components/slider.tsx +95 -0
- package/src/components/sonner.tsx +47 -0
- package/src/components/spinner.tsx +75 -0
- package/src/components/switch.tsx +66 -0
- package/src/components/table.tsx +200 -0
- package/src/components/tabs.tsx +128 -0
- package/src/components/textarea.tsx +49 -0
- package/src/components/toggle-group.tsx +141 -0
- package/src/components/toggle.tsx +39 -0
- package/src/components/tooltip.tsx +141 -0
- package/src/css/amber.css +59 -22
- package/src/css/blue.css +59 -22
- package/src/css/cyan.css +59 -22
- package/src/css/emerald.css +59 -22
- package/src/css/fuchsia.css +59 -22
- package/src/css/gray.css +59 -22
- package/src/css/green.css +59 -22
- package/src/css/indigo.css +59 -22
- package/src/css/lime.css +59 -22
- package/src/css/neutral.css +59 -22
- package/src/css/orange.css +59 -22
- package/src/css/pink.css +59 -22
- package/src/css/preset.css +32 -13
- package/src/css/purple.css +59 -22
- package/src/css/red.css +59 -22
- package/src/css/rose.css +59 -22
- package/src/css/sky.css +59 -22
- package/src/css/slate.css +59 -22
- package/src/css/stone.css +59 -22
- package/src/css/teal.css +59 -22
- package/src/css/violet.css +59 -22
- package/src/css/yellow.css +59 -22
- package/src/css/zinc.css +59 -22
- package/src/hooks/use-animated-value.ts +97 -0
- package/src/hooks/use-copy-to-clipboard.ts +63 -0
- package/src/hooks/use-is-mobile.ts +27 -0
- package/src/hooks/use-media-query.ts +71 -0
- package/src/hooks/use-mutation-observer.ts +54 -0
- package/src/hooks/use-pagination.ts +166 -0
- package/src/index.ts +720 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +360 -0
- package/src/primitives/input-number.tsx +1013 -0
- package/src/primitives/input.tsx +243 -0
- package/src/primitives/progress-circle.tsx +537 -0
- package/src/variants/alert.ts +45 -0
- package/src/variants/badge.ts +66 -0
- package/src/variants/button-group.ts +49 -0
- package/src/variants/button.ts +93 -0
- package/src/variants/empty.ts +43 -0
- package/src/variants/field.ts +50 -0
- package/src/variants/input-group.ts +132 -0
- package/src/variants/item.ts +90 -0
- package/src/variants/navigation-menu.ts +32 -0
- package/src/variants/progress-circle.ts +47 -0
- package/src/variants/scroll-area.ts +79 -0
- package/src/variants/separator.ts +41 -0
- package/src/variants/sheet.ts +70 -0
- package/src/variants/sidebar.ts +61 -0
- package/src/variants/toggle.ts +59 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn
|
|
3
|
-
import { buttonVariants } from "
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { buttonVariants } from "../variants/button.mjs";
|
|
4
|
+
import { sheetContentVariants } from "../variants/sheet.mjs";
|
|
4
5
|
import { XIcon } from "lucide-react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
@@ -8,50 +9,6 @@ import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
|
8
9
|
/**
|
|
9
10
|
* @since 0.3.16-canary.0
|
|
10
11
|
*/
|
|
11
|
-
const sheetContentVariants = tv({
|
|
12
|
-
base: [
|
|
13
|
-
"fixed z-50 flex flex-col overflow-auto",
|
|
14
|
-
"bg-background shadow-lg",
|
|
15
|
-
"ease-ui data-open:animate-in data-open:animation-duration-500",
|
|
16
|
-
"data-closed:animate-out data-closed:animation-duration-500"
|
|
17
|
-
],
|
|
18
|
-
defaultVariants: { side: "right" },
|
|
19
|
-
variants: { side: {
|
|
20
|
-
bottom: [
|
|
21
|
-
"max-h-[80vh]",
|
|
22
|
-
"inset-x-0 bottom-0",
|
|
23
|
-
"border-t",
|
|
24
|
-
"data-open:slide-in-from-bottom",
|
|
25
|
-
"data-closed:slide-out-to-bottom"
|
|
26
|
-
],
|
|
27
|
-
left: [
|
|
28
|
-
"h-full w-3/4",
|
|
29
|
-
"inset-y-0 left-0",
|
|
30
|
-
"border-r",
|
|
31
|
-
"sm:max-w-sm",
|
|
32
|
-
"data-open:slide-in-from-left",
|
|
33
|
-
"data-closed:slide-out-to-left"
|
|
34
|
-
],
|
|
35
|
-
right: [
|
|
36
|
-
"h-full w-3/4",
|
|
37
|
-
"inset-y-0 right-0",
|
|
38
|
-
"border-l",
|
|
39
|
-
"sm:max-w-sm",
|
|
40
|
-
"data-open:slide-in-from-right",
|
|
41
|
-
"data-closed:slide-out-to-right"
|
|
42
|
-
],
|
|
43
|
-
top: [
|
|
44
|
-
"max-h-[80vh]",
|
|
45
|
-
"inset-x-0 top-0",
|
|
46
|
-
"border-b",
|
|
47
|
-
"data-open:slide-in-from-top",
|
|
48
|
-
"data-closed:slide-out-to-top"
|
|
49
|
-
]
|
|
50
|
-
} }
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* @since 0.3.16-canary.0
|
|
54
|
-
*/
|
|
55
12
|
function Sheet({ children, ...props }) {
|
|
56
13
|
return /* @__PURE__ */ jsx(SheetPrimitive.Root, {
|
|
57
14
|
"data-slot": "sheet",
|
|
@@ -73,7 +30,7 @@ function SheetTrigger({ ...props }) {
|
|
|
73
30
|
*/
|
|
74
31
|
function SheetContent({ children, className, classNames, side = "right", ...props }) {
|
|
75
32
|
return /* @__PURE__ */ jsxs(SheetPrimitive.Portal, { children: [/* @__PURE__ */ jsx(SheetPrimitive.Overlay, {
|
|
76
|
-
className: cn("fixed inset-0 z-50", "bg-black/
|
|
33
|
+
className: cn("fixed inset-0 z-50", "bg-black/40 backdrop-blur-sm", "ease-gentle data-open:animate-in data-open:animation-duration-380 data-open:fade-in-0", "data-closed:animate-out data-closed:animation-duration-280 data-closed:fade-out-0", "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0", classNames?.overlay),
|
|
77
34
|
"data-slot": "sheet-overlay"
|
|
78
35
|
}), /* @__PURE__ */ jsxs(SheetPrimitive.Content, {
|
|
79
36
|
className: sheetContentVariants({
|
|
@@ -149,7 +106,7 @@ function SheetDescription({ className, ...props }) {
|
|
|
149
106
|
/**
|
|
150
107
|
* @since 0.3.16-canary.0
|
|
151
108
|
*/
|
|
152
|
-
function SheetClose({ className, size, variant
|
|
109
|
+
function SheetClose({ className, size, variant, ...props }) {
|
|
153
110
|
return /* @__PURE__ */ jsx(SheetPrimitive.Close, {
|
|
154
111
|
className: buttonVariants({
|
|
155
112
|
className,
|
|
@@ -161,4 +118,4 @@ function SheetClose({ className, size, variant = "outline", ...props }) {
|
|
|
161
118
|
});
|
|
162
119
|
}
|
|
163
120
|
//#endregion
|
|
164
|
-
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger
|
|
121
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
import { VariantProps } from "../lib/utils.mjs";
|
|
2
|
-
import { Button } from "./button.mjs";
|
|
3
1
|
import { Separator } from "./separator.mjs";
|
|
2
|
+
import { Button } from "./button.mjs";
|
|
4
3
|
import { Input } from "./input.mjs";
|
|
4
|
+
import { SidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
5
5
|
import { TooltipContent } from "./tooltip.mjs";
|
|
6
|
-
import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
7
6
|
import { ComponentProps, Dispatch, JSX, SetStateAction } from "react";
|
|
8
7
|
|
|
9
8
|
//#region src/components/sidebar.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* @since 0.3.16-canary.0
|
|
12
|
-
*/
|
|
13
|
-
declare const sidebarMenuButtonVariants: _$_codefast_tailwind_variants0.VariantResolver<{
|
|
14
|
-
size: {
|
|
15
|
-
sm: string[];
|
|
16
|
-
md: string[];
|
|
17
|
-
lg: string[];
|
|
18
|
-
};
|
|
19
|
-
variant: {
|
|
20
|
-
default: string;
|
|
21
|
-
outline: string[];
|
|
22
|
-
};
|
|
23
|
-
}, Record<string, never>>;
|
|
24
9
|
interface SidebarContextValue {
|
|
25
10
|
isMobile: boolean;
|
|
26
11
|
open: boolean;
|
|
@@ -234,7 +219,7 @@ declare function SidebarMenuItem({
|
|
|
234
219
|
/**
|
|
235
220
|
* @since 0.3.16-canary.0
|
|
236
221
|
*/
|
|
237
|
-
interface SidebarMenuButtonProps extends ComponentProps<"button">,
|
|
222
|
+
interface SidebarMenuButtonProps extends ComponentProps<"button">, SidebarMenuButtonVariants {
|
|
238
223
|
asChild?: boolean;
|
|
239
224
|
isActive?: boolean;
|
|
240
225
|
tooltip?: ComponentProps<typeof TooltipContent> | string;
|
|
@@ -333,4 +318,4 @@ declare function SidebarMenuSubButton({
|
|
|
333
318
|
...props
|
|
334
319
|
}: SidebarMenuSubButtonProps): JSX.Element;
|
|
335
320
|
//#endregion
|
|
336
|
-
export { Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, SidebarGroupAction, type SidebarGroupActionProps, SidebarGroupContent, type SidebarGroupContentProps, SidebarGroupLabel, type SidebarGroupLabelProps, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarInput, type SidebarInputProps, SidebarInset, type SidebarInsetProps, SidebarMenu, SidebarMenuAction, type SidebarMenuActionProps, SidebarMenuBadge, type SidebarMenuBadgeProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, type SidebarMenuItemProps, type SidebarMenuProps, SidebarMenuSkeleton, type SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, type SidebarRailProps, SidebarSeparator, type SidebarSeparatorProps, SidebarTrigger, type SidebarTriggerProps,
|
|
321
|
+
export { Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, SidebarGroupAction, type SidebarGroupActionProps, SidebarGroupContent, type SidebarGroupContentProps, SidebarGroupLabel, type SidebarGroupLabelProps, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarInput, type SidebarInputProps, SidebarInset, type SidebarInsetProps, SidebarMenu, SidebarMenuAction, type SidebarMenuActionProps, SidebarMenuBadge, type SidebarMenuBadgeProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, type SidebarMenuItemProps, type SidebarMenuProps, SidebarMenuSkeleton, type SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, type SidebarRailProps, SidebarSeparator, type SidebarSeparatorProps, SidebarTrigger, type SidebarTriggerProps, useSidebar };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn
|
|
3
|
-
import { Button } from "./button.mjs";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
4
3
|
import { Separator } from "./separator.mjs";
|
|
4
|
+
import { Button } from "./button.mjs";
|
|
5
5
|
import { Input } from "./input.mjs";
|
|
6
6
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.mjs";
|
|
7
|
+
import { sidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
7
8
|
import { Skeleton } from "./skeleton.mjs";
|
|
8
9
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.mjs";
|
|
9
10
|
import { useIsMobile } from "../hooks/use-is-mobile.mjs";
|
|
@@ -13,43 +14,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
14
|
import { useCallback, useEffect, useState } from "react";
|
|
14
15
|
import { createContext } from "@radix-ui/react-context";
|
|
15
16
|
//#region src/components/sidebar.tsx
|
|
16
|
-
/**
|
|
17
|
-
* @since 0.3.16-canary.0
|
|
18
|
-
*/
|
|
19
|
-
const sidebarMenuButtonVariants = tv({
|
|
20
|
-
base: [
|
|
21
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden p-2",
|
|
22
|
-
"rounded-md ring-sidebar-ring outline-hidden",
|
|
23
|
-
"text-left text-sm",
|
|
24
|
-
"transition-[width,height,padding]",
|
|
25
|
-
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
26
|
-
"group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2!",
|
|
27
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
28
|
-
"focus-visible:ring-3",
|
|
29
|
-
"active:bg-sidebar-accent active:text-sidebar-accent-foreground",
|
|
30
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
31
|
-
"aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
32
|
-
"data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground",
|
|
33
|
-
"data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground",
|
|
34
|
-
"[&>span:last-child]:truncate",
|
|
35
|
-
"[&>svg]:size-4 [&>svg]:shrink-0"
|
|
36
|
-
],
|
|
37
|
-
defaultVariants: {
|
|
38
|
-
size: "md",
|
|
39
|
-
variant: "default"
|
|
40
|
-
},
|
|
41
|
-
variants: {
|
|
42
|
-
size: {
|
|
43
|
-
sm: ["h-7", "text-xs"],
|
|
44
|
-
md: ["h-8", "text-sm"],
|
|
45
|
-
lg: ["h-12 text-sm", "group-data-[collapsible=icon]:p-0!"]
|
|
46
|
-
},
|
|
47
|
-
variant: {
|
|
48
|
-
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
49
|
-
outline: ["bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))]", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"]
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
17
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
54
18
|
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
55
19
|
const SIDEBAR_WIDTH = "16rem";
|
|
@@ -151,10 +115,10 @@ function Sidebar({ children, className, collapsible = "offcanvas", side = "left"
|
|
|
151
115
|
"data-state": state,
|
|
152
116
|
"data-variant": variant,
|
|
153
117
|
children: [/* @__PURE__ */ jsx("div", {
|
|
154
|
-
className: cn("relative", "w-(--sidebar-width)", "bg-transparent", "transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-side-right:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),
|
|
118
|
+
className: cn("relative", "w-(--sidebar-width)", "bg-transparent", "transition-[width] duration-200 ease-linear", "motion-reduce:transition-none motion-reduce:duration-0", "group-data-[collapsible=offcanvas]:w-0", "group-data-side-right:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),
|
|
155
119
|
"data-slot": "sidebar-gap"
|
|
156
120
|
}), /* @__PURE__ */ jsx("div", {
|
|
157
|
-
className: cn("fixed inset-y-0 z-10 hidden", "h-svh w-(--sidebar-width)", "transition-[left,right,width] duration-200 ease-linear", "md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-side-right:border-l group-data-side-left:border-r", className),
|
|
121
|
+
className: cn("fixed inset-y-0 z-10 hidden", "h-svh w-(--sidebar-width)", "transition-[left,right,width] duration-200 ease-linear", "motion-reduce:transition-none motion-reduce:duration-0", "md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-side-right:border-l group-data-side-left:border-r", className),
|
|
158
122
|
"data-slot": "sidebar-container",
|
|
159
123
|
...props,
|
|
160
124
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -196,7 +160,7 @@ const SIDEBAR_RAIL_NAME = "SidebarRail";
|
|
|
196
160
|
function SidebarRail({ className, ...props }) {
|
|
197
161
|
const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
|
|
198
162
|
return /* @__PURE__ */ jsx("button", {
|
|
199
|
-
className: cn("absolute inset-y-0 z-20 hidden", "w-4 -translate-x-1/2 transition-all ease-linear", "in-data-side-right:cursor-e-resize", "in-data-side-left:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0", "group-data-side-right:left-0", "group-data-side-left:-right-4", "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5", "group-data-[collapsible=offcanvas]:after:left-full", "hover:group-data-[collapsible=offcanvas]:bg-sidebar", "hover:after:bg-sidebar-border", "sm:flex", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", "[[data-side=right][data-state=collapsed]_&]:cursor-w-resize", className),
|
|
163
|
+
className: cn("absolute inset-y-0 z-20 hidden", "w-4 -translate-x-1/2 transition-all ease-linear", "motion-reduce:transition-none", "in-data-side-right:cursor-e-resize", "in-data-side-left:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0", "group-data-side-right:left-0", "group-data-side-left:-right-4", "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5", "group-data-[collapsible=offcanvas]:after:left-full", "hover:group-data-[collapsible=offcanvas]:bg-sidebar", "hover:after:bg-sidebar-border", "sm:flex", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", "[[data-side=right][data-state=collapsed]_&]:cursor-w-resize", className),
|
|
200
164
|
"data-sidebar": "rail",
|
|
201
165
|
"data-slot": "sidebar-rail",
|
|
202
166
|
title: "Toggle Sidebar",
|
|
@@ -286,7 +250,7 @@ function SidebarGroup({ className, ...props }) {
|
|
|
286
250
|
*/
|
|
287
251
|
function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
288
252
|
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
289
|
-
className: cn("flex h-8 shrink-0 items-center px-2", "rounded-md ring-sidebar-ring outline-hidden", "truncate text-xs font-medium text-sidebar-foreground/70", "transition-[margin,opacity] duration-200 ease-linear", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", "focus-visible:ring-3", "[&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
253
|
+
className: cn("flex h-8 shrink-0 items-center px-2", "rounded-md ring-sidebar-ring outline-hidden", "truncate text-xs font-medium text-sidebar-foreground/70", "transition-[margin,opacity] duration-200 ease-linear", "motion-reduce:transition-none motion-reduce:duration-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", "focus-visible:ring-3", "[&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
290
254
|
"data-sidebar": "group-label",
|
|
291
255
|
"data-slot": "sidebar-group-label",
|
|
292
256
|
...props
|
|
@@ -297,7 +261,7 @@ function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
|
297
261
|
*/
|
|
298
262
|
function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
299
263
|
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
300
|
-
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center p-0", "rounded-md ring-sidebar-ring outline-hidden", "text-sidebar-foreground", "transition-transform", "group-data-[collapsible=icon]:hidden", "after:absolute after:-inset-2", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "focus-visible:ring-3", "md:after:hidden", "[&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
264
|
+
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center p-0", "rounded-md ring-sidebar-ring outline-hidden", "text-sidebar-foreground", "transition-transform", "motion-reduce:transition-none", "group-data-[collapsible=icon]:hidden", "after:absolute after:-inset-2", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "focus-visible:ring-3", "md:after:hidden", "[&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
301
265
|
"data-sidebar": "group-action",
|
|
302
266
|
"data-slot": "sidebar-group-action",
|
|
303
267
|
...props
|
|
@@ -371,7 +335,7 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
371
335
|
*/
|
|
372
336
|
function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
|
|
373
337
|
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
374
|
-
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center p-0", "rounded-md ring-sidebar-ring outline-hidden", "text-sidebar-foreground", "transition-transform", "group-data-[collapsible=icon]:hidden", "peer-hover/menu-button:text-sidebar-accent-foreground", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "peer-data-[size=sm]/menu-button:top-1", "after:absolute after:-inset-2", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "focus-visible:ring-3", "md:after:hidden", "[&>svg]:size-4 [&>svg]:shrink-0", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground md:opacity-0 data-open:opacity-100", className),
|
|
338
|
+
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center p-0", "rounded-md ring-sidebar-ring outline-hidden", "text-sidebar-foreground", "transition-transform", "motion-reduce:transition-none", "group-data-[collapsible=icon]:hidden", "peer-hover/menu-button:text-sidebar-accent-foreground", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "peer-data-[size=sm]/menu-button:top-1", "after:absolute after:-inset-2", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "focus-visible:ring-3", "md:after:hidden", "[&>svg]:size-4 [&>svg]:shrink-0", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground md:opacity-0 data-open:opacity-100", className),
|
|
375
339
|
"data-sidebar": "menu-action",
|
|
376
340
|
"data-slot": "sidebar-menu-action",
|
|
377
341
|
...props
|
|
@@ -444,4 +408,4 @@ function SidebarMenuSubButton({ asChild = false, className, isActive = false, si
|
|
|
444
408
|
});
|
|
445
409
|
}
|
|
446
410
|
//#endregion
|
|
447
|
-
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger,
|
|
411
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function Skeleton({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
className: cn("rounded-lg", "bg-muted", "animate-
|
|
9
|
+
className: cn("rounded-lg", "bg-gradient-to-r from-muted via-white/15 to-muted bg-[length:400%_100%]", "animate-shimmer motion-reduce:animate-none", className),
|
|
10
10
|
"data-slot": "skeleton",
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
@@ -34,7 +34,7 @@ function Slider({ className, defaultValue, max = 100, min = 0, value, ...props }
|
|
|
34
34
|
})
|
|
35
35
|
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(SliderPrimitive.Thumb, {
|
|
36
36
|
"aria-label": "Volume",
|
|
37
|
-
className: cn("flex size-4 items-center justify-center", "rounded-full border-2 border-primary", "bg-primary shadow-sm outline-hidden", "after:size-full after:rounded-full after:bg-background after:transition-[width,height]", "focus-visible:ring-4 focus-visible:ring-primary/20", "active:not-data-disabled:after:size-1", "dark:focus-visible:ring-primary/40"),
|
|
37
|
+
className: cn("flex size-4 items-center justify-center", "rounded-full border-2 border-primary", "bg-primary shadow-sm outline-hidden", "after:size-full after:rounded-full after:bg-background after:transition-[width,height] after:duration-200 after:ease-spring", "motion-reduce:after:transition-none motion-reduce:after:duration-0", "focus-visible:ring-4 focus-visible:ring-primary/20", "active:not-data-disabled:after:size-1", "dark:focus-visible:ring-primary/40"),
|
|
38
38
|
"data-slot": "slider-thumb"
|
|
39
39
|
}, index))]
|
|
40
40
|
});
|
|
@@ -13,7 +13,7 @@ function Spinner({ children, className, loading = true, ...props }) {
|
|
|
13
13
|
className: cn("relative flex size-4 items-center justify-center", "opacity-60", className),
|
|
14
14
|
...props,
|
|
15
15
|
children: Array.from({ length: SPINNER_COUNT }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
16
|
-
className: cn("absolute", "h-full rotate-(--spinner-rotate)", "before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current before:delay-(--spinner-delay) before:animation-duration-(--spinner-duration) before:fade-out-25 before:repeat-infinite"),
|
|
16
|
+
className: cn("absolute", "h-full rotate-(--spinner-rotate)", "before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current before:delay-(--spinner-delay) before:animation-duration-(--spinner-duration) before:fade-out-25 before:repeat-infinite motion-reduce:before:animate-none"),
|
|
17
17
|
style: {
|
|
18
18
|
"--spinner-delay": `-${((SPINNER_COUNT - index) * 100).toString()}ms`,
|
|
19
19
|
"--spinner-duration": `${(SPINNER_COUNT * 100).toString()}ms`,
|
|
@@ -8,11 +8,11 @@ import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
|
8
8
|
*/
|
|
9
9
|
function Switch({ className, ...props }) {
|
|
10
10
|
return /* @__PURE__ */ jsx(SwitchPrimitives.Root, {
|
|
11
|
-
className: cn("peer inline-flex h-5 w-9 shrink-0 items-center p-0.75", "rounded-full border border-transparent shadow-xs outline-hidden", "transition-
|
|
11
|
+
className: cn("peer group/switch inline-flex h-5 w-9 shrink-0 items-center p-0.75", "rounded-full border border-transparent shadow-xs outline-hidden", "transition-[background-color,box-shadow] duration-200 ease-snappy", "motion-reduce:transition-none motion-reduce:duration-0", "active:not-disabled:inset-shadow-sm", "focus-visible:ring-3 focus-visible:ring-ring/50", "focus-visible:not-data-checked:border-ring/60", "disabled:opacity-50", "data-checked:bg-primary", "data-checked:focus-visible:ring-primary/20", "dark:data-checked:focus-visible:ring-primary/40", "data-unchecked:bg-input", "dark:data-unchecked:bg-input/80", className),
|
|
12
12
|
"data-slot": "switch",
|
|
13
13
|
...props,
|
|
14
14
|
children: /* @__PURE__ */ jsx(SwitchPrimitives.Thumb, {
|
|
15
|
-
className: cn("block", "size-3.5", "rounded-full", "bg-background shadow-sm", "pointer-events-none transition-transform", "dark:not-data-checked:bg-foreground", "data-checked:translate-x-3.5", "data-unchecked:translate-x-0"),
|
|
15
|
+
className: cn("block", "size-3.5", "rounded-full", "bg-background shadow-sm", "pointer-events-none", "transition-transform duration-300 ease-spring", "motion-reduce:transition-none motion-reduce:duration-0", "dark:not-data-checked:bg-foreground", "data-checked:translate-x-3.5", "data-unchecked:translate-x-0"),
|
|
16
16
|
"data-slot": "switch-thumb"
|
|
17
17
|
})
|
|
18
18
|
});
|
|
@@ -50,7 +50,7 @@ function TableFooter({ className, ...props }) {
|
|
|
50
50
|
*/
|
|
51
51
|
function TableRow({ className, ...props }) {
|
|
52
52
|
return /* @__PURE__ */ jsx("tr", {
|
|
53
|
-
className: cn("border-b", "transition-colors", "hover:bg-muted/50", "has-aria-expanded:bg-muted/50", "data-selected:bg-muted", className),
|
|
53
|
+
className: cn("border-b", "transition-colors", "motion-reduce:transition-none", "hover:bg-muted/50", "has-aria-expanded:bg-muted/50", "data-selected:bg-muted", className),
|
|
54
54
|
"data-slot": "table-row",
|
|
55
55
|
...props
|
|
56
56
|
});
|
package/dist/components/tabs.mjs
CHANGED
|
@@ -28,7 +28,7 @@ function TabsList({ className, ...props }) {
|
|
|
28
28
|
*/
|
|
29
29
|
function TabsTrigger({ className, ...props }) {
|
|
30
30
|
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, {
|
|
31
|
-
className: cn("inline-flex items-center justify-center gap-1.5", "px-2 py-1.5", "rounded-lg", "text-sm font-medium whitespace-nowrap text-muted-foreground", "transition", "not-dark:outline-hidden", "hover:not-disabled:text-foreground", "focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "dark:focus-visible:-outline-offset-1 dark:focus-visible:outline-ring", "data-active:bg-background data-active:text-foreground data-active:shadow-sm", "dark:data-active:bg-input/50", "dark:focus-visible:data-active:outline-1", "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
31
|
+
className: cn("inline-flex items-center justify-center gap-1.5", "px-2 py-1.5", "rounded-lg", "text-sm font-medium whitespace-nowrap text-muted-foreground", "transition-[color,background-color,box-shadow] duration-150 ease-snappy", "motion-reduce:transition-none motion-reduce:duration-0", "not-dark:outline-hidden", "hover:not-disabled:text-foreground", "focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "dark:focus-visible:-outline-offset-1 dark:focus-visible:outline-ring", "data-active:bg-background data-active:text-foreground data-active:shadow-sm", "dark:data-active:bg-input/50", "dark:focus-visible:data-active:outline-1", "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
32
32
|
"data-slot": "tabs-trigger",
|
|
33
33
|
...props
|
|
34
34
|
});
|
|
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function Textarea({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("textarea", {
|
|
9
|
-
className: cn("flex min-h-16 w-full grow px-3 py-2", "rounded-lg border border-input shadow-xs outline-hidden", "text-base", "transition", "placeholder:text-muted-foreground", "hover:not-disabled:not-focus-visible:border-ring/60", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "aria-invalid:border-destructive", "focus-within:aria-invalid:ring-destructive/20", "hover:not-disabled:not-focus-within:aria-invalid:border-destructive/60", "md:text-sm", "dark:bg-input/30", "dark:focus-within:aria-invalid:ring-destructive/40", className),
|
|
9
|
+
className: cn("flex min-h-16 w-full grow px-3 py-2", "rounded-lg border border-input shadow-xs outline-hidden", "text-base", "transition-[color,box-shadow] duration-150 ease-snappy", "motion-reduce:transition-none motion-reduce:duration-0", "placeholder:text-muted-foreground", "hover:not-disabled:not-focus-visible:border-ring/60", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "aria-invalid:border-destructive", "focus-within:aria-invalid:ring-destructive/20", "hover:not-disabled:not-focus-within:aria-invalid:border-destructive/60", "md:text-sm", "dark:bg-input/30", "dark:focus-within:aria-invalid:ring-destructive/40", className),
|
|
10
10
|
"data-slot": "textarea",
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VariantProps } from "../lib/utils.mjs";
|
|
2
|
+
import { toggleVariants } from "../variants/toggle.mjs";
|
|
2
3
|
import { ComponentProps, JSX } from "react";
|
|
3
4
|
import { Scope } from "@radix-ui/react-context";
|
|
4
5
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
@@ -10,7 +11,7 @@ type ScopedProps<P> = P & {
|
|
|
10
11
|
/**
|
|
11
12
|
* @since 0.3.16-canary.0
|
|
12
13
|
*/
|
|
13
|
-
type ToggleGroupProps = ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
14
|
+
type ToggleGroupProps = ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & {
|
|
14
15
|
spacing?: number;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.mjs";
|
|
3
|
-
import { toggleVariants } from "
|
|
3
|
+
import { toggleVariants } from "../variants/toggle.mjs";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { createContextScope } from "@radix-ui/react-context";
|
|
6
6
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
1
|
+
import { ToggleVariants } from "../variants/toggle.mjs";
|
|
3
2
|
import { ComponentProps, JSX } from "react";
|
|
4
3
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
5
4
|
|
|
6
5
|
//#region src/components/toggle.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* @since 0.3.16-canary.0
|
|
9
|
-
*/
|
|
10
|
-
declare const toggleVariants: _$_codefast_tailwind_variants0.VariantResolver<{
|
|
11
|
-
size: {
|
|
12
|
-
default: string[];
|
|
13
|
-
lg: string[];
|
|
14
|
-
sm: string[];
|
|
15
|
-
};
|
|
16
|
-
variant: {
|
|
17
|
-
default: string;
|
|
18
|
-
outline: string[];
|
|
19
|
-
};
|
|
20
|
-
}, Record<string, never>>;
|
|
21
|
-
/**
|
|
22
|
-
* @since 0.3.16-canary.0
|
|
23
|
-
*/
|
|
24
|
-
type ToggleVariants = VariantProps<typeof toggleVariants>;
|
|
25
6
|
/**
|
|
26
7
|
* @since 0.3.16-canary.0
|
|
27
8
|
*/
|
|
@@ -37,4 +18,4 @@ declare function Toggle({
|
|
|
37
18
|
...props
|
|
38
19
|
}: ToggleProps): JSX.Element;
|
|
39
20
|
//#endregion
|
|
40
|
-
export { Toggle, type ToggleProps
|
|
21
|
+
export { Toggle, type ToggleProps };
|
|
@@ -1,48 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { toggleVariants } from "../variants/toggle.mjs";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
5
5
|
//#region src/components/toggle.tsx
|
|
6
6
|
/**
|
|
7
7
|
* @since 0.3.16-canary.0
|
|
8
8
|
*/
|
|
9
|
-
const toggleVariants = tv({
|
|
10
|
-
base: [
|
|
11
|
-
"inline-flex items-center justify-center gap-2",
|
|
12
|
-
"rounded-lg outline-none",
|
|
13
|
-
"text-sm font-medium whitespace-nowrap",
|
|
14
|
-
"transition-[color,box-shadow]",
|
|
15
|
-
"hover:bg-muted hover:text-muted-foreground",
|
|
16
|
-
"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
17
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
18
|
-
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
19
|
-
"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
20
|
-
"dark:aria-invalid:ring-destructive/40",
|
|
21
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
22
|
-
],
|
|
23
|
-
variants: {
|
|
24
|
-
size: {
|
|
25
|
-
default: ["h-9 min-w-9", "px-2"],
|
|
26
|
-
lg: ["h-10 min-w-10", "px-2.5"],
|
|
27
|
-
sm: ["h-8 min-w-8", "px-1.5"]
|
|
28
|
-
},
|
|
29
|
-
variant: {
|
|
30
|
-
default: "bg-transparent",
|
|
31
|
-
outline: [
|
|
32
|
-
"border border-input",
|
|
33
|
-
"bg-transparent shadow-xs",
|
|
34
|
-
"hover:bg-accent hover:text-accent-foreground"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
defaultVariants: {
|
|
39
|
-
size: "default",
|
|
40
|
-
variant: "default"
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* @since 0.3.16-canary.0
|
|
45
|
-
*/
|
|
46
9
|
function Toggle({ children, className, size, variant, ...props }) {
|
|
47
10
|
return /* @__PURE__ */ jsx(TogglePrimitive.Root, {
|
|
48
11
|
className: toggleVariants({
|
|
@@ -56,4 +19,4 @@ function Toggle({ children, className, size, variant, ...props }) {
|
|
|
56
19
|
});
|
|
57
20
|
}
|
|
58
21
|
//#endregion
|
|
59
|
-
export { Toggle
|
|
22
|
+
export { Toggle };
|
|
@@ -35,7 +35,7 @@ function TooltipTrigger({ ...props }) {
|
|
|
35
35
|
*/
|
|
36
36
|
function TooltipContent({ children, className, sideOffset = 4, ...props }) {
|
|
37
37
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
|
|
38
|
-
className: cn("z-50", "w-fit max-w-(--radix-tooltip-content-available-width) px-3 py-1.5", "rounded-md", "bg-primary text-xs text-balance text-primary-foreground", "ease-
|
|
38
|
+
className: cn("z-50", "w-fit max-w-(--radix-tooltip-content-available-width) px-3 py-1.5", "rounded-md", "bg-primary text-xs text-balance text-primary-foreground", "ease-snappy data-[state=delayed-open]:animate-in data-[state=delayed-open]:duration-150 data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95", "data-[state=delayed-open]:data-side-top:slide-in-from-bottom-2", "data-[state=delayed-open]:data-side-right:slide-in-from-left-2", "data-[state=delayed-open]:data-side-bottom:slide-in-from-top-2", "data-[state=delayed-open]:data-side-left:slide-in-from-right-2", "data-closed:animate-out data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95", "data-closed:data-side-top:slide-out-to-bottom-2", "data-closed:data-side-right:slide-out-to-left-2", "data-closed:data-side-bottom:slide-out-to-top-2", "data-closed:data-side-left:slide-out-to-right-2", "motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0", "origin-(--radix-tooltip-content-transform-origin)", className),
|
|
39
39
|
collisionPadding: 8,
|
|
40
40
|
"data-slot": "tooltip-content",
|
|
41
41
|
sideOffset,
|