@codefast/ui 0.3.16-canary.2 → 0.4.0-canary.4
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 +81 -0
- package/README.md +28 -17
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +14 -14
- package/dist/components/alert.mjs +17 -28
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -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 +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
2
|
+
import { Context } from "radix-ui/internal";
|
|
3
|
+
import type { ComponentProps, CSSProperties, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import type { VariantProps } from "#/lib/utils";
|
|
6
|
+
import { cn } from "#/lib/utils";
|
|
7
|
+
import { toggleVariants } from "#/variants/toggle";
|
|
8
|
+
|
|
9
|
+
/* -----------------------------------------------------------------------------
|
|
10
|
+
* Context: ToggleGroup
|
|
11
|
+
* -------------------------------------------------------------------------- */
|
|
12
|
+
|
|
13
|
+
const TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
14
|
+
|
|
15
|
+
type ScopedProps<P> = P & { __scopeToggleGroup?: Context.Scope };
|
|
16
|
+
|
|
17
|
+
const [createToggleGroupContext] = Context.createContextScope(TOGGLE_GROUP_NAME, [
|
|
18
|
+
ToggleGroupPrimitive.createToggleGroupScope,
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const useToggleGroupScope = ToggleGroupPrimitive.createToggleGroupScope();
|
|
22
|
+
|
|
23
|
+
const [ToggleGroupProvider, useToggleGroupContext] = createToggleGroupContext<
|
|
24
|
+
VariantProps<typeof toggleVariants> & {
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
26
|
+
spacing?: number;
|
|
27
|
+
}
|
|
28
|
+
>(TOGGLE_GROUP_NAME);
|
|
29
|
+
|
|
30
|
+
/* -----------------------------------------------------------------------------
|
|
31
|
+
* Component: ToggleGroup
|
|
32
|
+
* -------------------------------------------------------------------------- */
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
37
|
+
type ToggleGroupProps = ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
38
|
+
VariantProps<typeof toggleVariants> & {
|
|
39
|
+
orientation?: "horizontal" | "vertical";
|
|
40
|
+
spacing?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.3.16-canary.0
|
|
45
|
+
*/
|
|
46
|
+
function ToggleGroup({
|
|
47
|
+
__scopeToggleGroup,
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
orientation = "horizontal",
|
|
51
|
+
size,
|
|
52
|
+
spacing = 2,
|
|
53
|
+
variant,
|
|
54
|
+
...props
|
|
55
|
+
}: ScopedProps<ToggleGroupProps>): JSX.Element {
|
|
56
|
+
const toggleGroupScope = useToggleGroupScope(__scopeToggleGroup);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ToggleGroupProvider
|
|
60
|
+
orientation={orientation}
|
|
61
|
+
scope={__scopeToggleGroup}
|
|
62
|
+
size={size}
|
|
63
|
+
spacing={spacing}
|
|
64
|
+
variant={variant}
|
|
65
|
+
>
|
|
66
|
+
<ToggleGroupPrimitive.Root
|
|
67
|
+
className={cn(
|
|
68
|
+
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs data-vertical:flex-col data-vertical:items-stretch",
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
data-orientation={orientation}
|
|
72
|
+
data-size={size}
|
|
73
|
+
data-slot="toggle-group"
|
|
74
|
+
data-spacing={spacing}
|
|
75
|
+
data-variant={variant}
|
|
76
|
+
style={{ "--gap": spacing } as CSSProperties}
|
|
77
|
+
{...toggleGroupScope}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</ToggleGroupPrimitive.Root>
|
|
82
|
+
</ToggleGroupProvider>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* -----------------------------------------------------------------------------
|
|
87
|
+
* Component: ToggleGroupItem
|
|
88
|
+
* -------------------------------------------------------------------------- */
|
|
89
|
+
|
|
90
|
+
const TOGGLE_GROUP_ITEM_NAME = "ToggleGroupItem";
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @since 0.3.16-canary.0
|
|
94
|
+
*/
|
|
95
|
+
type ToggleGroupItemProps = ScopedProps<
|
|
96
|
+
ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @since 0.3.16-canary.0
|
|
101
|
+
*/
|
|
102
|
+
function ToggleGroupItem({
|
|
103
|
+
__scopeToggleGroup,
|
|
104
|
+
className,
|
|
105
|
+
size = "default",
|
|
106
|
+
variant = "default",
|
|
107
|
+
...props
|
|
108
|
+
}: ToggleGroupItemProps): JSX.Element {
|
|
109
|
+
const context = useToggleGroupContext(TOGGLE_GROUP_ITEM_NAME, __scopeToggleGroup);
|
|
110
|
+
const toggleGroupScope = useToggleGroupScope(__scopeToggleGroup);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<ToggleGroupPrimitive.Item
|
|
114
|
+
className={cn(
|
|
115
|
+
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none 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-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md 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 data-on:bg-muted",
|
|
116
|
+
toggleVariants({
|
|
117
|
+
className,
|
|
118
|
+
size: context.size ?? size,
|
|
119
|
+
variant: context.variant ?? variant,
|
|
120
|
+
}),
|
|
121
|
+
)}
|
|
122
|
+
data-size={context.size ?? size}
|
|
123
|
+
data-slot="toggle-group-item"
|
|
124
|
+
data-spacing={context.spacing}
|
|
125
|
+
data-variant={context.variant ?? variant}
|
|
126
|
+
{...toggleGroupScope}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* -----------------------------------------------------------------------------
|
|
133
|
+
* Exports
|
|
134
|
+
* -------------------------------------------------------------------------- */
|
|
135
|
+
|
|
136
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
137
|
+
export type { ToggleGroupItemProps, ToggleGroupProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import type { ToggleVariants } from "#/variants/toggle";
|
|
5
|
+
import { toggleVariants } from "#/variants/toggle";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Toggle
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
interface ToggleProps extends ComponentProps<typeof TogglePrimitive.Root>, ToggleVariants {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
19
|
+
function Toggle({ className, size, variant, ...props }: ToggleProps): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<TogglePrimitive.Root className={toggleVariants({ className, size, variant })} data-slot="toggle" {...props} />
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* -----------------------------------------------------------------------------
|
|
26
|
+
* Exports
|
|
27
|
+
* -------------------------------------------------------------------------- */
|
|
28
|
+
|
|
29
|
+
export { Toggle };
|
|
30
|
+
export type { ToggleProps };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
|
|
6
|
+
/* -----------------------------------------------------------------------------
|
|
7
|
+
* Component: TooltipProvider
|
|
8
|
+
* -------------------------------------------------------------------------- */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @since 0.3.16-canary.0
|
|
12
|
+
*/
|
|
13
|
+
type TooltipProviderProps = ComponentProps<typeof TooltipPrimitive.Provider>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
function TooltipProvider({ delayDuration = 0, ...props }: TooltipProviderProps): JSX.Element {
|
|
19
|
+
return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* -----------------------------------------------------------------------------
|
|
23
|
+
* Component: Tooltip
|
|
24
|
+
* -------------------------------------------------------------------------- */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.3.16-canary.0
|
|
28
|
+
*/
|
|
29
|
+
type TooltipProps = ComponentProps<typeof TooltipPrimitive.Root>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
34
|
+
function Tooltip({ ...props }: TooltipProps): JSX.Element {
|
|
35
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* -----------------------------------------------------------------------------
|
|
39
|
+
* Component: TooltipTrigger
|
|
40
|
+
* -------------------------------------------------------------------------- */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
45
|
+
type TooltipTriggerProps = ComponentProps<typeof TooltipPrimitive.Trigger>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
function TooltipTrigger({ ...props }: TooltipTriggerProps): JSX.Element {
|
|
51
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* -----------------------------------------------------------------------------
|
|
55
|
+
* Component: TooltipContent
|
|
56
|
+
* -------------------------------------------------------------------------- */
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @since 0.3.16-canary.0
|
|
60
|
+
*/
|
|
61
|
+
type TooltipContentProps = ComponentProps<typeof TooltipPrimitive.Content>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @since 0.3.16-canary.0
|
|
65
|
+
*/
|
|
66
|
+
function TooltipContent({ children, className, sideOffset = 0, ...props }: TooltipContentProps): JSX.Element {
|
|
67
|
+
return (
|
|
68
|
+
<TooltipPrimitive.Portal data-slot="tooltip-portal">
|
|
69
|
+
<TooltipPrimitive.Content
|
|
70
|
+
className={cn(
|
|
71
|
+
"z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background ease-snappy has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-open:animate-in data-open:animation-duration-menu-in data-open:fade-in-0 data-open:zoom-in-95 data-open:data-side-top:slide-in-from-bottom-2 data-open:data-side-right:slide-in-from-left-2 data-open:data-side-bottom:slide-in-from-top-2 data-open:data-side-left:slide-in-from-right-2 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-menu-out 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 data-delayed-open:animate-in data-delayed-open:animation-duration-menu-in data-delayed-open:fade-in-0 data-delayed-open:zoom-in-95 data-delayed-open:data-side-top:slide-in-from-bottom-2 data-delayed-open:data-side-right:slide-in-from-left-2 data-delayed-open:data-side-bottom:slide-in-from-top-2 data-delayed-open:data-side-left:slide-in-from-right-2",
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
data-slot="tooltip-content"
|
|
75
|
+
sideOffset={sideOffset}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
<TooltipArrow />
|
|
80
|
+
</TooltipPrimitive.Content>
|
|
81
|
+
</TooltipPrimitive.Portal>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* -----------------------------------------------------------------------------
|
|
86
|
+
* Component: TooltipArrow
|
|
87
|
+
* -------------------------------------------------------------------------- */
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @since 0.3.16-canary.0
|
|
91
|
+
*/
|
|
92
|
+
type TooltipArrowProps = ComponentProps<typeof TooltipPrimitive.Arrow>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @since 0.3.16-canary.0
|
|
96
|
+
*/
|
|
97
|
+
function TooltipArrow({ className, ...props }: TooltipArrowProps): JSX.Element {
|
|
98
|
+
return (
|
|
99
|
+
<TooltipPrimitive.Arrow
|
|
100
|
+
className={cn(
|
|
101
|
+
"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-xs bg-foreground fill-foreground",
|
|
102
|
+
className,
|
|
103
|
+
)}
|
|
104
|
+
data-slot="tooltip-arrow"
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* -----------------------------------------------------------------------------
|
|
111
|
+
* Exports
|
|
112
|
+
* -------------------------------------------------------------------------- */
|
|
113
|
+
|
|
114
|
+
export { Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
115
|
+
export type { TooltipArrowProps, TooltipContentProps, TooltipProps, TooltipProviderProps, TooltipTriggerProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@layer base {
|
|
2
|
+
*,
|
|
3
|
+
::after,
|
|
4
|
+
::before,
|
|
5
|
+
::backdrop,
|
|
6
|
+
::file-selector-button {
|
|
7
|
+
border-color: var(--color-border);
|
|
8
|
+
outline-color: --alpha(var(--color-ring) / 20%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
::-webkit-scrollbar {
|
|
12
|
+
@apply size-2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
::-webkit-scrollbar-track {
|
|
16
|
+
@apply bg-transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::-webkit-scrollbar-thumb {
|
|
20
|
+
@apply rounded-full bg-border;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
* {
|
|
24
|
+
scrollbar-width: thin;
|
|
25
|
+
scrollbar-color: var(--color-border) transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
html,
|
|
29
|
+
body {
|
|
30
|
+
background-color: var(--color-background);
|
|
31
|
+
color: var(--color-foreground);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
input {
|
|
35
|
+
&::-webkit-search-cancel-button,
|
|
36
|
+
&::-webkit-search-decoration {
|
|
37
|
+
appearance: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&::-webkit-outer-spin-button,
|
|
41
|
+
&::-webkit-inner-spin-button {
|
|
42
|
+
-webkit-appearance: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[type="number"] {
|
|
47
|
+
-moz-appearance: textfield;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@theme {
|
|
2
|
+
/* Enter curves — decelerate into place. */
|
|
3
|
+
--ease-ui: cubic-bezier(0.32, 0.72, 0, 1); /* large surfaces: dialog, sheet */
|
|
4
|
+
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* playful overshoot, opt-in */
|
|
5
|
+
--ease-snappy: cubic-bezier(0.23, 1, 0.32, 1); /* small popups: menu, tooltip */
|
|
6
|
+
--ease-gentle: cubic-bezier(0.4, 0, 0.2, 1); /* continuous layout shifts, fades */
|
|
7
|
+
|
|
8
|
+
/* Exit curve — accelerate away; pair with data-closed:. */
|
|
9
|
+
--ease-exit: cubic-bezier(0.4, 0, 1, 1);
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Semantic durations — enter/exit pairs per surface role.
|
|
13
|
+
* Exit ≈ 60% of enter to offset the slow start of the accelerating exit curve.
|
|
14
|
+
*/
|
|
15
|
+
--animation-duration-menu-in: 150ms; /* menus, tooltip — instant tools */
|
|
16
|
+
--animation-duration-menu-out: 100ms;
|
|
17
|
+
--animation-duration-popup-in: 200ms; /* popover, hover card — content surfaces */
|
|
18
|
+
--animation-duration-popup-out: 120ms;
|
|
19
|
+
--animation-duration-overlay-in: 220ms; /* dialog content + backdrop */
|
|
20
|
+
--animation-duration-overlay-out: 150ms;
|
|
21
|
+
--animation-duration-panel-in: 320ms; /* sheet, drawer — large sliding panels */
|
|
22
|
+
--animation-duration-panel-out: 220ms;
|
|
23
|
+
--animation-duration-expand-in: 200ms; /* accordion, inline disclosure */
|
|
24
|
+
--animation-duration-expand-out: 150ms;
|
|
25
|
+
|
|
26
|
+
--animate-shimmer: shimmer 2.2s linear infinite;
|
|
27
|
+
|
|
28
|
+
@keyframes shimmer {
|
|
29
|
+
from {
|
|
30
|
+
background-position: 200% center;
|
|
31
|
+
}
|
|
32
|
+
to {
|
|
33
|
+
background-position: -200% center;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--radius: 0.375rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@theme inline {
|
|
6
|
+
--font-sans: var(--font-sans);
|
|
7
|
+
--font-heading: var(--font-heading);
|
|
8
|
+
--font-mono: var(--font-mono);
|
|
9
|
+
|
|
10
|
+
--color-background: var(--background);
|
|
11
|
+
--color-foreground: var(--foreground);
|
|
12
|
+
|
|
13
|
+
--color-primary: var(--primary);
|
|
14
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
+
|
|
16
|
+
--color-secondary: var(--secondary);
|
|
17
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
18
|
+
|
|
19
|
+
--color-destructive: var(--destructive);
|
|
20
|
+
|
|
21
|
+
--color-muted: var(--muted);
|
|
22
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
23
|
+
|
|
24
|
+
--color-accent: var(--accent);
|
|
25
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
26
|
+
|
|
27
|
+
--color-popover: var(--popover);
|
|
28
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
29
|
+
|
|
30
|
+
--color-card: var(--card);
|
|
31
|
+
--color-card-foreground: var(--card-foreground);
|
|
32
|
+
|
|
33
|
+
--color-border: var(--border);
|
|
34
|
+
--color-input: var(--input);
|
|
35
|
+
--color-ring: var(--ring);
|
|
36
|
+
|
|
37
|
+
--color-sidebar: var(--sidebar);
|
|
38
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
39
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
40
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
41
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
42
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
43
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
44
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
45
|
+
|
|
46
|
+
--color-chart-1: var(--chart-1);
|
|
47
|
+
--color-chart-2: var(--chart-2);
|
|
48
|
+
--color-chart-3: var(--chart-3);
|
|
49
|
+
--color-chart-4: var(--chart-4);
|
|
50
|
+
--color-chart-5: var(--chart-5);
|
|
51
|
+
|
|
52
|
+
--color-surface: var(--surface);
|
|
53
|
+
--color-surface-foreground: var(--surface-foreground);
|
|
54
|
+
|
|
55
|
+
--color-code: var(--code);
|
|
56
|
+
--color-code-foreground: var(--code-foreground);
|
|
57
|
+
--color-code-highlight: var(--code-highlight);
|
|
58
|
+
--color-code-number: var(--code-number);
|
|
59
|
+
|
|
60
|
+
--color-selection: var(--selection);
|
|
61
|
+
--color-selection-foreground: var(--selection-foreground);
|
|
62
|
+
|
|
63
|
+
--radius-xs: calc(var(--radius) * 2 / 6);
|
|
64
|
+
--radius-sm: calc(var(--radius) * 4 / 6);
|
|
65
|
+
--radius-md: var(--radius);
|
|
66
|
+
--radius-lg: calc(var(--radius) * 8 / 6);
|
|
67
|
+
--radius-xl: calc(var(--radius) * 12 / 6);
|
|
68
|
+
--radius-2xl: calc(var(--radius) * 16 / 6);
|
|
69
|
+
--radius-3xl: calc(var(--radius) * 24 / 6);
|
|
70
|
+
--radius-4xl: calc(var(--radius) * 32 / 6);
|
|
71
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Custom Tailwind variants for @codefast/ui.
|
|
3
|
+
*
|
|
4
|
+
* Shorthand usage (composes with group-, peer-, in-, has- modifiers):
|
|
5
|
+
* data-open: → [data-state="open"] or [data-open]:not([data-open="false"])
|
|
6
|
+
* group-data-disabled: → ancestor .group with matching data-disabled
|
|
7
|
+
* in-data-side-left: → ancestor with [data-side="left"]
|
|
8
|
+
*
|
|
9
|
+
* Prefer these over verbose arbitrary variants (data-[state=open]:, data-[side=left]:).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/* -------------------------------------------------------------------------
|
|
13
|
+
* Theme
|
|
14
|
+
* ------------------------------------------------------------------------- */
|
|
15
|
+
|
|
16
|
+
@custom-variant dark {
|
|
17
|
+
&:where(.dark, .dark *) {
|
|
18
|
+
@slot;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (prefers-color-scheme: dark) {
|
|
22
|
+
&:where(:not(.light, .light *)) {
|
|
23
|
+
@slot;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* -------------------------------------------------------------------------
|
|
29
|
+
* Layout — orientation & placement (Radix Popper)
|
|
30
|
+
* ------------------------------------------------------------------------- */
|
|
31
|
+
|
|
32
|
+
@custom-variant data-horizontal (&:where([data-orientation="horizontal"]));
|
|
33
|
+
@custom-variant data-vertical (&:where([data-orientation="vertical"]));
|
|
34
|
+
|
|
35
|
+
@custom-variant data-side-top (&:where([data-side="top"]));
|
|
36
|
+
@custom-variant data-side-right (&:where([data-side="right"]));
|
|
37
|
+
@custom-variant data-side-bottom (&:where([data-side="bottom"]));
|
|
38
|
+
@custom-variant data-side-left (&:where([data-side="left"]));
|
|
39
|
+
|
|
40
|
+
/* -------------------------------------------------------------------------
|
|
41
|
+
* State — boolean & Radix data-state
|
|
42
|
+
*
|
|
43
|
+
* Block variants match both Radix data-state="…" and boolean data-* attrs
|
|
44
|
+
* so components can use one shorthand regardless of attribute source.
|
|
45
|
+
* ------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
/* Matches Radix data-state="open" and boolean data-open (not "false"). */
|
|
48
|
+
@custom-variant data-open {
|
|
49
|
+
&:where([data-state="open"]),
|
|
50
|
+
&:where([data-open]:not([data-open="false"])) {
|
|
51
|
+
@slot;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@custom-variant data-closed {
|
|
56
|
+
&:where([data-state="closed"]),
|
|
57
|
+
&:where([data-closed]:not([data-closed="false"])) {
|
|
58
|
+
@slot;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@custom-variant data-checked {
|
|
63
|
+
&:where([data-state="checked"]),
|
|
64
|
+
&:where([data-checked]:not([data-checked="false"])) {
|
|
65
|
+
@slot;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@custom-variant data-unchecked {
|
|
70
|
+
&:where([data-state="unchecked"]),
|
|
71
|
+
&:where([data-unchecked]:not([data-unchecked="false"])) {
|
|
72
|
+
@slot;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* data-selected only matches explicit true, not bare data-selected. */
|
|
77
|
+
@custom-variant data-selected {
|
|
78
|
+
&:where([data-state="selected"]),
|
|
79
|
+
&:where([data-selected="true"]) {
|
|
80
|
+
@slot;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@custom-variant data-active {
|
|
85
|
+
&:where([data-state="active"]),
|
|
86
|
+
&:where([data-active]:not([data-active="false"])) {
|
|
87
|
+
@slot;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@custom-variant data-disabled {
|
|
92
|
+
&:where([data-disabled="true"]),
|
|
93
|
+
&:where([data-disabled]:not([data-disabled="false"])) {
|
|
94
|
+
@slot;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@custom-variant data-focused {
|
|
99
|
+
&:where([data-focused="true"]),
|
|
100
|
+
&:where([data-focused]:not([data-focused="false"])) {
|
|
101
|
+
@slot;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* -------------------------------------------------------------------------
|
|
106
|
+
* State — Radix-only (no boolean data-* equivalent)
|
|
107
|
+
* ------------------------------------------------------------------------- */
|
|
108
|
+
|
|
109
|
+
@custom-variant data-on (&:where([data-state="on"]));
|
|
110
|
+
@custom-variant data-collapsed (&:where([data-state="collapsed"]));
|
|
111
|
+
@custom-variant data-hidden (&:where([data-state="hidden"]));
|
|
112
|
+
@custom-variant data-visible (&:where([data-state="visible"]));
|
|
113
|
+
@custom-variant data-delayed-open (&:where([data-state="delayed-open"]));
|