@object-ui/components 0.3.1 → 0.5.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/.turbo/turbo-build.log +47 -0
- package/README.md +13 -0
- package/dist/index.css +1 -1
- package/dist/index.js +34610 -24854
- package/dist/index.umd.cjs +53 -32
- package/dist/src/SchemaRenderer.d.ts +3 -0
- package/dist/src/{ui → custom}/button-group.d.ts +1 -1
- package/dist/src/custom/field.d.ts +19 -0
- package/dist/src/custom/index.d.ts +12 -0
- package/dist/src/custom/input-group.d.ts +14 -0
- package/dist/src/{ui → custom}/item.d.ts +1 -1
- package/dist/src/custom/native-select.d.ts +12 -0
- package/dist/src/custom/sort-builder.d.ts +22 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/renderers/data-display/table.d.ts +1 -1
- package/dist/src/renderers/layout/page.d.ts +1 -1
- package/dist/src/renderers/placeholders.d.ts +1 -1
- package/dist/src/ui/accordion.d.ts +4 -4
- package/dist/src/ui/alert-dialog.d.ts +17 -11
- package/dist/src/ui/alert.d.ts +4 -5
- package/dist/src/ui/aspect-ratio.d.ts +1 -1
- package/dist/src/ui/avatar.d.ts +3 -3
- package/dist/src/ui/badge.d.ts +3 -3
- package/dist/src/ui/breadcrumb.d.ts +16 -8
- package/dist/src/ui/calendar.d.ts +7 -7
- package/dist/src/ui/card.d.ts +7 -8
- package/dist/src/ui/carousel.d.ts +5 -6
- package/dist/src/ui/chart.d.ts +62 -0
- package/dist/src/ui/checkbox.d.ts +1 -1
- package/dist/src/ui/collapsible.d.ts +3 -3
- package/dist/src/ui/command.d.ts +78 -16
- package/dist/src/ui/context-menu.d.ts +14 -12
- package/dist/src/ui/dialog.d.ts +17 -13
- package/dist/src/ui/drawer.d.ts +19 -10
- package/dist/src/ui/dropdown-menu.d.ts +20 -18
- package/dist/src/ui/form.d.ts +6 -7
- package/dist/src/ui/hover-card.d.ts +3 -3
- package/dist/src/ui/index.d.ts +2 -8
- package/dist/src/ui/input-otp.d.ts +30 -7
- package/dist/src/ui/label.d.ts +2 -1
- package/dist/src/ui/menubar.d.ts +19 -17
- package/dist/src/ui/navigation-menu.d.ts +9 -11
- package/dist/src/ui/pagination.d.ts +25 -10
- package/dist/src/ui/popover.d.ts +4 -5
- package/dist/src/ui/progress.d.ts +1 -1
- package/dist/src/ui/radio-group.d.ts +2 -2
- package/dist/src/ui/resizable.d.ts +5 -8
- package/dist/src/ui/scroll-area.d.ts +2 -2
- package/dist/src/ui/select.d.ts +11 -13
- package/dist/src/ui/sheet.d.ts +23 -11
- package/dist/src/ui/sidebar.d.ts +27 -29
- package/dist/src/ui/skeleton.d.ts +1 -1
- package/dist/src/ui/slider.d.ts +1 -1
- package/dist/src/ui/sonner.d.ts +2 -1
- package/dist/src/ui/switch.d.ts +2 -2
- package/dist/src/ui/tabs.d.ts +1 -1
- package/dist/src/ui/textarea.d.ts +1 -1
- package/dist/src/ui/toast.d.ts +22 -0
- package/dist/src/ui/toggle-group.d.ts +8 -3
- package/dist/src/ui/toggle.d.ts +4 -1
- package/dist/src/ui/tooltip.d.ts +4 -4
- package/dist/src/ui/typography.d.ts +21 -0
- package/package.json +17 -7
- package/shadcn-components.json +52 -47
- package/src/SchemaRenderer.tsx +28 -0
- package/src/__tests__/PageRendererRegions.test.tsx +59 -0
- package/src/__tests__/Registry.test.ts +21 -0
- package/src/__tests__/basic-renderers.test.tsx +1 -1
- package/src/__tests__/complex-disclosure-renderers.test.tsx +3 -2
- package/src/__tests__/feedback-overlay-renderers.test.tsx +1 -1
- package/src/__tests__/form-renderers.test.tsx +1 -1
- package/src/__tests__/layout-data-renderers.test.tsx +1 -1
- package/src/{ui → custom}/button-group.tsx +1 -1
- package/src/{ui → custom}/combobox.tsx +3 -3
- package/src/{ui → custom}/date-picker.tsx +3 -3
- package/src/custom/field.tsx +81 -0
- package/src/{ui → custom}/filter-builder.tsx +3 -3
- package/src/custom/index.ts +12 -0
- package/src/custom/input-group.tsx +53 -0
- package/src/{ui → custom}/item.tsx +1 -1
- package/src/custom/native-select.tsx +33 -0
- package/src/custom/sort-builder.tsx +129 -0
- package/src/index.css +20 -1
- package/src/index.ts +1 -0
- package/src/renderers/basic/button-group.tsx +1 -0
- package/src/renderers/basic/div.tsx +12 -1
- package/src/renderers/basic/html.tsx +1 -0
- package/src/renderers/basic/icon.tsx +1 -0
- package/src/renderers/basic/image.tsx +1 -0
- package/src/renderers/basic/navigation-menu.tsx +1 -0
- package/src/renderers/basic/pagination.tsx +31 -4
- package/src/renderers/basic/separator.tsx +1 -0
- package/src/renderers/basic/span.tsx +12 -1
- package/src/renderers/basic/text.tsx +4 -2
- package/src/renderers/complex/carousel.tsx +1 -0
- package/src/renderers/complex/data-table.tsx +134 -95
- package/src/renderers/complex/filter-builder.tsx +2 -1
- package/src/renderers/complex/resizable.tsx +2 -1
- package/src/renderers/complex/scroll-area.tsx +25 -7
- package/src/renderers/complex/table.tsx +1 -0
- package/src/renderers/data-display/alert.tsx +1 -0
- package/src/renderers/data-display/avatar.tsx +1 -0
- package/src/renderers/data-display/badge.tsx +1 -0
- package/src/renderers/data-display/breadcrumb.tsx +1 -0
- package/src/renderers/data-display/kbd.tsx +1 -0
- package/src/renderers/data-display/list.tsx +21 -49
- package/src/renderers/data-display/statistic.tsx +21 -5
- package/src/renderers/data-display/table.tsx +21 -11
- package/src/renderers/data-display/tree-view.tsx +7 -1
- package/src/renderers/disclosure/accordion.tsx +1 -0
- package/src/renderers/disclosure/collapsible.tsx +1 -0
- package/src/renderers/disclosure/toggle-group.tsx +2 -0
- package/src/renderers/feedback/empty.tsx +1 -0
- package/src/renderers/feedback/loading.tsx +2 -1
- package/src/renderers/feedback/progress.tsx +1 -0
- package/src/renderers/feedback/skeleton.tsx +1 -0
- package/src/renderers/feedback/sonner.tsx +1 -0
- package/src/renderers/feedback/spinner.tsx +1 -0
- package/src/renderers/feedback/toast.tsx +1 -0
- package/src/renderers/feedback/toaster.tsx +1 -0
- package/src/renderers/form/button.tsx +35 -1
- package/src/renderers/form/calendar.tsx +1 -0
- package/src/renderers/form/checkbox.tsx +38 -16
- package/src/renderers/form/combobox.tsx +2 -1
- package/src/renderers/form/command.tsx +1 -0
- package/src/renderers/form/date-picker.tsx +1 -0
- package/src/renderers/form/file-upload.tsx +1 -0
- package/src/renderers/form/form.tsx +92 -15
- package/src/renderers/form/input-otp.tsx +1 -0
- package/src/renderers/form/input.tsx +3 -0
- package/src/renderers/form/label.tsx +1 -0
- package/src/renderers/form/radio-group.tsx +1 -0
- package/src/renderers/form/select.tsx +35 -15
- package/src/renderers/form/slider.tsx +1 -0
- package/src/renderers/form/switch.tsx +1 -0
- package/src/renderers/form/textarea.tsx +50 -27
- package/src/renderers/form/toggle.tsx +3 -45
- package/src/renderers/layout/aspect-ratio.tsx +2 -1
- package/src/renderers/layout/card.tsx +10 -2
- package/src/renderers/layout/container.tsx +1 -0
- package/src/renderers/layout/flex.tsx +1 -0
- package/src/renderers/layout/grid.tsx +23 -8
- package/src/renderers/layout/page.tsx +35 -23
- package/src/renderers/layout/semantic.tsx +1 -0
- package/src/renderers/layout/stack.tsx +2 -1
- package/src/renderers/layout/tabs.tsx +43 -17
- package/src/renderers/navigation/header-bar.tsx +1 -0
- package/src/renderers/navigation/sidebar.tsx +5 -0
- package/src/renderers/overlay/alert-dialog.tsx +1 -0
- package/src/renderers/overlay/context-menu.tsx +1 -0
- package/src/renderers/overlay/dialog.tsx +1 -0
- package/src/renderers/overlay/drawer.tsx +1 -0
- package/src/renderers/overlay/dropdown-menu.tsx +1 -0
- package/src/renderers/overlay/hover-card.tsx +1 -0
- package/src/renderers/overlay/menubar.tsx +1 -0
- package/src/renderers/overlay/popover.tsx +1 -0
- package/src/renderers/overlay/sheet.tsx +1 -0
- package/src/renderers/overlay/tooltip.tsx +1 -0
- package/src/renderers/placeholders.tsx +2 -2
- package/src/stories/CRMApp.stories.tsx +706 -0
- package/src/stories/Guide.mdx +55 -0
- package/src/stories/Introduction.mdx +34 -0
- package/src/stories/MockedData.stories.tsx +71 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/stories-json/accordion.stories.tsx +43 -0
- package/src/stories-json/aggrid.stories.tsx +103 -0
- package/src/stories-json/alert.stories.tsx +39 -0
- package/src/stories-json/aspect-ratio.stories.tsx +34 -0
- package/src/stories-json/avatar.stories.tsx +38 -0
- package/src/stories-json/badge.stories.tsx +53 -0
- package/src/stories-json/breadcrumb.stories.tsx +30 -0
- package/src/stories-json/button-group.stories.tsx +43 -0
- package/src/stories-json/button.stories.tsx +73 -0
- package/src/stories-json/calendar.stories.tsx +85 -0
- package/src/stories-json/card.stories.tsx +48 -0
- package/src/stories-json/carousel.stories.tsx +33 -0
- package/src/stories-json/charts.stories.tsx +195 -0
- package/src/stories-json/chatbot.stories.tsx +248 -0
- package/src/stories-json/code-editor.stories.tsx +92 -0
- package/src/stories-json/collapsible.stories.tsx +40 -0
- package/src/stories-json/controls.stories.tsx +36 -0
- package/src/stories-json/dashboard.stories.tsx +318 -0
- package/src/stories-json/data-table.stories.tsx +60 -0
- package/src/stories-json/data_display_extras.stories.tsx +102 -0
- package/src/stories-json/date-picker.stories.tsx +28 -0
- package/src/stories-json/detail-view.stories.tsx +258 -0
- package/src/stories-json/dialog.stories.tsx +43 -0
- package/src/stories-json/feedback_extras.stories.tsx +40 -0
- package/src/stories-json/feedback_others.stories.tsx +46 -0
- package/src/stories-json/form_advanced.stories.tsx +117 -0
- package/src/stories-json/form_extras.stories.tsx +123 -0
- package/src/stories-json/grid.stories.tsx +56 -0
- package/src/stories-json/icon.stories.tsx +36 -0
- package/src/stories-json/input.stories.tsx +52 -0
- package/src/stories-json/kanban.stories.tsx +295 -0
- package/src/stories-json/layout_extended.stories.tsx +76 -0
- package/src/stories-json/layout_flex.stories.tsx +107 -0
- package/src/stories-json/list-view.stories.tsx +97 -0
- package/src/stories-json/markdown.stories.tsx +129 -0
- package/src/stories-json/menus.stories.tsx +63 -0
- package/src/stories-json/metric-card.stories.tsx +143 -0
- package/src/stories-json/navigation-menu.stories.tsx +37 -0
- package/src/stories-json/object-aggrid.stories.tsx +252 -0
- package/src/stories-json/object-form.stories.tsx +130 -0
- package/src/stories-json/object-gantt.stories.tsx +114 -0
- package/src/stories-json/object-grid.stories.tsx +157 -0
- package/src/stories-json/object-map.stories.tsx +116 -0
- package/src/stories-json/object-view.stories.tsx +118 -0
- package/src/stories-json/overlay_extras.stories.tsx +113 -0
- package/src/stories-json/overlay_others.stories.tsx +76 -0
- package/src/stories-json/page.stories.tsx +55 -0
- package/src/stories-json/reports.stories.tsx +163 -0
- package/src/stories-json/resizable.stories.tsx +44 -0
- package/src/stories-json/select.stories.tsx +34 -0
- package/src/stories-json/separator.stories.tsx +41 -0
- package/src/stories-json/sidebar.stories.tsx +147 -0
- package/src/stories-json/statistic.stories.tsx +44 -0
- package/src/stories-json/tabs.stories.tsx +51 -0
- package/src/stories-json/timeline.stories.tsx +188 -0
- package/src/stories-json/typography.stories.tsx +45 -0
- package/src/ui/accordion.tsx +47 -53
- package/src/ui/alert-dialog.tsx +103 -117
- package/src/ui/alert.tsx +35 -36
- package/src/ui/aspect-ratio.tsx +1 -5
- package/src/ui/avatar.tsx +41 -42
- package/src/ui/badge.tsx +6 -15
- package/src/ui/breadcrumb.tsx +81 -75
- package/src/ui/button.tsx +10 -11
- package/src/ui/calendar.tsx +178 -51
- package/src/ui/card.tsx +51 -110
- package/src/ui/carousel.tsx +136 -113
- package/src/ui/chart.tsx +367 -0
- package/src/ui/checkbox.tsx +20 -22
- package/src/ui/collapsible.tsx +5 -25
- package/src/ui/command.tsx +106 -135
- package/src/ui/context-menu.tsx +69 -116
- package/src/ui/dialog.tsx +94 -113
- package/src/ui/drawer.tsx +82 -99
- package/src/ui/dropdown-menu.tsx +134 -188
- package/src/ui/form.tsx +51 -40
- package/src/ui/hover-card.tsx +18 -33
- package/src/ui/index.ts +2 -8
- package/src/ui/input-otp.tsx +42 -52
- package/src/ui/input.tsx +13 -15
- package/src/ui/label.tsx +17 -15
- package/src/ui/menubar.tsx +188 -206
- package/src/ui/navigation-menu.tsx +96 -136
- package/src/ui/pagination.tsx +86 -96
- package/src/ui/popover.tsx +24 -41
- package/src/ui/progress.tsx +21 -22
- package/src/ui/radio-group.tsx +19 -20
- package/src/ui/resizable.tsx +32 -42
- package/src/ui/scroll-area.tsx +38 -48
- package/src/ui/select.tsx +129 -157
- package/src/ui/separator.tsx +2 -2
- package/src/ui/sheet.tsx +110 -107
- package/src/ui/sidebar.tsx +442 -408
- package/src/ui/skeleton.tsx +6 -11
- package/src/ui/slider.tsx +19 -54
- package/src/ui/sonner.tsx +19 -1
- package/src/ui/switch.tsx +19 -21
- package/src/ui/tabs.tsx +6 -37
- package/src/ui/textarea.tsx +8 -4
- package/src/ui/toast.tsx +137 -0
- package/src/ui/toggle-group.tsx +28 -37
- package/src/ui/toggle.tsx +19 -19
- package/src/ui/tooltip.tsx +21 -52
- package/src/ui/typography.tsx +85 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +9 -1
- package/vitest.config.ts +5 -0
- package/ISSUES_FOUND.md +0 -128
- /package/dist/src/{ui → custom}/combobox.d.ts +0 -0
- /package/dist/src/{ui → custom}/date-picker.d.ts +0 -0
- /package/dist/src/{ui → custom}/empty.d.ts +0 -0
- /package/dist/src/{ui → custom}/filter-builder.d.ts +0 -0
- /package/dist/src/{ui → custom}/kbd.d.ts +0 -0
- /package/dist/src/{ui → custom}/spinner.d.ts +0 -0
- /package/src/{ui → custom}/empty.tsx +0 -0
- /package/src/{ui → custom}/kbd.tsx +0 -0
- /package/src/{ui → custom}/spinner.tsx +0 -0
package/src/ui/skeleton.tsx
CHANGED
|
@@ -8,20 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
import { cn } from "../lib/utils"
|
|
10
10
|
|
|
11
|
-
function Skeleton({
|
|
11
|
+
function Skeleton({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
12
15
|
return (
|
|
13
16
|
<div
|
|
14
|
-
|
|
15
|
-
className={cn(
|
|
16
|
-
"relative overflow-hidden rounded-md bg-slate-900/50 border border-slate-800/50 backdrop-blur-sm",
|
|
17
|
-
"after:absolute after:inset-0 after:-translate-x-full after:animate-[shimmer_1.5s_infinite] after:bg-linear-to-r after:from-transparent after:via-cyan-900/20 after:to-transparent",
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
17
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
20
18
|
{...props}
|
|
21
|
-
|
|
22
|
-
{/* Optional tech pattern overlay for large skeletons */}
|
|
23
|
-
<div className="absolute inset-0 bg-[linear-gradient(45deg,transparent_25%,rgba(6,182,212,0.02)_50%,transparent_75%,transparent_100%)] bg-[size:8px_8px] opacity-50" />
|
|
24
|
-
</div>
|
|
19
|
+
/>
|
|
25
20
|
)
|
|
26
21
|
}
|
|
27
22
|
|
package/src/ui/slider.tsx
CHANGED
|
@@ -13,59 +13,24 @@ import * as SliderPrimitive from "@radix-ui/react-slider"
|
|
|
13
13
|
|
|
14
14
|
import { cn } from "../lib/utils"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<SliderPrimitive.Root
|
|
36
|
-
data-slot="slider"
|
|
37
|
-
defaultValue={defaultValue}
|
|
38
|
-
value={value}
|
|
39
|
-
min={min}
|
|
40
|
-
max={max}
|
|
41
|
-
className={cn(
|
|
42
|
-
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
>
|
|
47
|
-
<SliderPrimitive.Track
|
|
48
|
-
data-slot="slider-track"
|
|
49
|
-
className={cn(
|
|
50
|
-
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
51
|
-
)}
|
|
52
|
-
>
|
|
53
|
-
<SliderPrimitive.Range
|
|
54
|
-
data-slot="slider-range"
|
|
55
|
-
className={cn(
|
|
56
|
-
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
57
|
-
)}
|
|
58
|
-
/>
|
|
59
|
-
</SliderPrimitive.Track>
|
|
60
|
-
{Array.from({ length: _values.length }, (_, index) => (
|
|
61
|
-
<SliderPrimitive.Thumb
|
|
62
|
-
data-slot="slider-thumb"
|
|
63
|
-
key={index}
|
|
64
|
-
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
65
|
-
/>
|
|
66
|
-
))}
|
|
67
|
-
</SliderPrimitive.Root>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
16
|
+
const Slider = React.forwardRef<
|
|
17
|
+
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<SliderPrimitive.Root
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
"relative flex w-full touch-none select-none items-center",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
|
29
|
+
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
30
|
+
</SliderPrimitive.Track>
|
|
31
|
+
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
|
|
32
|
+
</SliderPrimitive.Root>
|
|
33
|
+
))
|
|
34
|
+
Slider.displayName = SliderPrimitive.Root.displayName
|
|
70
35
|
|
|
71
36
|
export { Slider }
|
package/src/ui/sonner.tsx
CHANGED
|
@@ -6,8 +6,19 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
CircleCheck,
|
|
13
|
+
Info,
|
|
14
|
+
LoaderCircle,
|
|
15
|
+
OctagonX,
|
|
16
|
+
TriangleAlert,
|
|
17
|
+
} from "lucide-react"
|
|
9
18
|
import { useTheme } from "next-themes"
|
|
10
|
-
import { Toaster as Sonner
|
|
19
|
+
import { Toaster as Sonner } from "sonner"
|
|
20
|
+
|
|
21
|
+
type ToasterProps = React.ComponentProps<typeof Sonner>
|
|
11
22
|
|
|
12
23
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
13
24
|
const { theme = "system" } = useTheme()
|
|
@@ -16,6 +27,13 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
16
27
|
<Sonner
|
|
17
28
|
theme={theme as ToasterProps["theme"]}
|
|
18
29
|
className="toaster group"
|
|
30
|
+
icons={{
|
|
31
|
+
success: <CircleCheck className="h-4 w-4" />,
|
|
32
|
+
info: <Info className="h-4 w-4" />,
|
|
33
|
+
warning: <TriangleAlert className="h-4 w-4" />,
|
|
34
|
+
error: <OctagonX className="h-4 w-4" />,
|
|
35
|
+
loading: <LoaderCircle className="h-4 w-4 animate-spin" />,
|
|
36
|
+
}}
|
|
19
37
|
toastOptions={{
|
|
20
38
|
classNames: {
|
|
21
39
|
toast:
|
package/src/ui/switch.tsx
CHANGED
|
@@ -9,31 +9,29 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import * as
|
|
12
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
13
13
|
|
|
14
14
|
import { cn } from "../lib/utils"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
data-
|
|
16
|
+
const Switch = React.forwardRef<
|
|
17
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<SwitchPrimitives.Root
|
|
21
|
+
className={cn(
|
|
22
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
ref={ref}
|
|
27
|
+
>
|
|
28
|
+
<SwitchPrimitives.Thumb
|
|
23
29
|
className={cn(
|
|
24
|
-
"
|
|
25
|
-
className
|
|
30
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
|
|
26
31
|
)}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className={cn(
|
|
32
|
-
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
33
|
-
)}
|
|
34
|
-
/>
|
|
35
|
-
</SwitchPrimitive.Root>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
32
|
+
/>
|
|
33
|
+
</SwitchPrimitives.Root>
|
|
34
|
+
))
|
|
35
|
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
38
36
|
|
|
39
37
|
export { Switch }
|
package/src/ui/tabs.tsx
CHANGED
|
@@ -13,18 +13,7 @@ import * as TabsPrimitive from "@radix-ui/react-tabs"
|
|
|
13
13
|
|
|
14
14
|
import { cn } from "../lib/utils"
|
|
15
15
|
|
|
16
|
-
const Tabs =
|
|
17
|
-
React.ElementRef<typeof TabsPrimitive.Root>,
|
|
18
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>
|
|
19
|
-
>(({ className, ...props }, ref) => (
|
|
20
|
-
<TabsPrimitive.Root
|
|
21
|
-
ref={ref}
|
|
22
|
-
data-slot="tabs"
|
|
23
|
-
className={cn("flex flex-col gap-2", className)}
|
|
24
|
-
{...props}
|
|
25
|
-
/>
|
|
26
|
-
))
|
|
27
|
-
Tabs.displayName = TabsPrimitive.Root.displayName
|
|
16
|
+
const Tabs = TabsPrimitive.Root
|
|
28
17
|
|
|
29
18
|
const TabsList = React.forwardRef<
|
|
30
19
|
React.ElementRef<typeof TabsPrimitive.List>,
|
|
@@ -32,9 +21,8 @@ const TabsList = React.forwardRef<
|
|
|
32
21
|
>(({ className, ...props }, ref) => (
|
|
33
22
|
<TabsPrimitive.List
|
|
34
23
|
ref={ref}
|
|
35
|
-
data-slot="tabs-list"
|
|
36
24
|
className={cn(
|
|
37
|
-
"
|
|
25
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
38
26
|
className
|
|
39
27
|
)}
|
|
40
28
|
{...props}
|
|
@@ -45,31 +33,15 @@ TabsList.displayName = TabsPrimitive.List.displayName
|
|
|
45
33
|
const TabsTrigger = React.forwardRef<
|
|
46
34
|
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
47
35
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
48
|
-
>(({ className,
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
49
37
|
<TabsPrimitive.Trigger
|
|
50
38
|
ref={ref}
|
|
51
|
-
data-slot="tabs-trigger"
|
|
52
39
|
className={cn(
|
|
53
|
-
"
|
|
54
|
-
"data-[state=active]:text-cyan-500 dark:data-[state=active]:text-cyan-400",
|
|
55
|
-
"text-muted-foreground hover:text-foreground/80",
|
|
56
|
-
"group overflow-hidden",
|
|
40
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
57
41
|
className
|
|
58
42
|
)}
|
|
59
43
|
{...props}
|
|
60
|
-
|
|
61
|
-
<span className="relative z-10 flex items-center gap-2">{children}</span>
|
|
62
|
-
|
|
63
|
-
{/* Active State: Background Glow */}
|
|
64
|
-
<span className="absolute inset-0 -z-10 bg-cyan-500/10 opacity-0 transition-opacity duration-300 group-data-[state=active]:opacity-100" />
|
|
65
|
-
|
|
66
|
-
{/* Active State: Bottom Scanner Line */}
|
|
67
|
-
<span className="absolute bottom-0 left-0 h-[2px] w-full bg-cyan-500 scale-x-0 transition-transform duration-300 ease-out group-data-[state=active]:scale-x-100 shadow-[0_0_10px_#06b6d4]" />
|
|
68
|
-
|
|
69
|
-
{/* Active State: Particle/Sparkle Simulation (Two rotating glows) */}
|
|
70
|
-
<span className="absolute -top-[50%] -left-[50%] w-[200%] h-[200%] bg-[radial-gradient(circle,rgba(6,182,212,0.1)_0%,transparent_50%)] opacity-0 group-data-[state=active]:opacity-100 group-data-[state=active]:animate-[spin_4s_linear_infinite]" />
|
|
71
|
-
|
|
72
|
-
</TabsPrimitive.Trigger>
|
|
44
|
+
/>
|
|
73
45
|
))
|
|
74
46
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
|
75
47
|
|
|
@@ -79,11 +51,8 @@ const TabsContent = React.forwardRef<
|
|
|
79
51
|
>(({ className, ...props }, ref) => (
|
|
80
52
|
<TabsPrimitive.Content
|
|
81
53
|
ref={ref}
|
|
82
|
-
data-slot="tabs-content"
|
|
83
54
|
className={cn(
|
|
84
|
-
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
85
|
-
// Add a subtle fade-in animation
|
|
86
|
-
"animate-in fade-in-0 zoom-in-95 duration-200",
|
|
55
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
87
56
|
className
|
|
88
57
|
)}
|
|
89
58
|
{...props}
|
package/src/ui/textarea.tsx
CHANGED
|
@@ -10,17 +10,21 @@ import * as React from "react"
|
|
|
10
10
|
|
|
11
11
|
import { cn } from "../lib/utils"
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const Textarea = React.forwardRef<
|
|
14
|
+
HTMLTextAreaElement,
|
|
15
|
+
React.ComponentProps<"textarea">
|
|
16
|
+
>(({ className, ...props }, ref) => {
|
|
14
17
|
return (
|
|
15
18
|
<textarea
|
|
16
|
-
data-slot="textarea"
|
|
17
19
|
className={cn(
|
|
18
|
-
"
|
|
20
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
19
21
|
className
|
|
20
22
|
)}
|
|
23
|
+
ref={ref}
|
|
21
24
|
{...props}
|
|
22
25
|
/>
|
|
23
26
|
)
|
|
24
|
-
}
|
|
27
|
+
})
|
|
28
|
+
Textarea.displayName = "Textarea"
|
|
25
29
|
|
|
26
30
|
export { Textarea }
|
package/src/ui/toast.tsx
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
11
|
+
import * as React from "react"
|
|
12
|
+
import * as ToastPrimitives from "@radix-ui/react-toast"
|
|
13
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
14
|
+
import { X } from "lucide-react"
|
|
15
|
+
|
|
16
|
+
import { cn } from "../lib/utils"
|
|
17
|
+
|
|
18
|
+
const ToastProvider = ToastPrimitives.Provider
|
|
19
|
+
|
|
20
|
+
const ToastViewport = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof ToastPrimitives.Viewport>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<ToastPrimitives.Viewport
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(
|
|
27
|
+
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName
|
|
34
|
+
|
|
35
|
+
const toastVariants = cva(
|
|
36
|
+
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "border bg-background text-foreground",
|
|
41
|
+
destructive:
|
|
42
|
+
"destructive group border-destructive bg-destructive text-destructive-foreground",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "default",
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const Toast = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof ToastPrimitives.Root>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
54
|
+
VariantProps<typeof toastVariants>
|
|
55
|
+
>(({ className, variant, ...props }, ref) => {
|
|
56
|
+
return (
|
|
57
|
+
<ToastPrimitives.Root
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(toastVariants({ variant }), className)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
})
|
|
64
|
+
Toast.displayName = ToastPrimitives.Root.displayName
|
|
65
|
+
|
|
66
|
+
const ToastAction = React.forwardRef<
|
|
67
|
+
React.ElementRef<typeof ToastPrimitives.Action>,
|
|
68
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
|
|
69
|
+
>(({ className, ...props }, ref) => (
|
|
70
|
+
<ToastPrimitives.Action
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={cn(
|
|
73
|
+
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
))
|
|
79
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName
|
|
80
|
+
|
|
81
|
+
const ToastClose = React.forwardRef<
|
|
82
|
+
React.ElementRef<typeof ToastPrimitives.Close>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
|
|
84
|
+
>(({ className, ...props }, ref) => (
|
|
85
|
+
<ToastPrimitives.Close
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(
|
|
88
|
+
"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
|
|
89
|
+
className
|
|
90
|
+
)}
|
|
91
|
+
toast-close=""
|
|
92
|
+
{...props}
|
|
93
|
+
>
|
|
94
|
+
<X className="h-4 w-4" />
|
|
95
|
+
</ToastPrimitives.Close>
|
|
96
|
+
))
|
|
97
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName
|
|
98
|
+
|
|
99
|
+
const ToastTitle = React.forwardRef<
|
|
100
|
+
React.ElementRef<typeof ToastPrimitives.Title>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<ToastPrimitives.Title
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn("text-sm font-semibold", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
))
|
|
109
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName
|
|
110
|
+
|
|
111
|
+
const ToastDescription = React.forwardRef<
|
|
112
|
+
React.ElementRef<typeof ToastPrimitives.Description>,
|
|
113
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
|
|
114
|
+
>(({ className, ...props }, ref) => (
|
|
115
|
+
<ToastPrimitives.Description
|
|
116
|
+
ref={ref}
|
|
117
|
+
className={cn("text-sm opacity-90", className)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
))
|
|
121
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName
|
|
122
|
+
|
|
123
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
|
|
124
|
+
|
|
125
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
type ToastProps,
|
|
129
|
+
type ToastActionElement,
|
|
130
|
+
ToastProvider,
|
|
131
|
+
ToastViewport,
|
|
132
|
+
Toast,
|
|
133
|
+
ToastTitle,
|
|
134
|
+
ToastDescription,
|
|
135
|
+
ToastClose,
|
|
136
|
+
ToastAction,
|
|
137
|
+
}
|
package/src/ui/toggle-group.tsx
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
9
11
|
import * as React from "react"
|
|
10
12
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
11
13
|
import { type VariantProps } from "class-variance-authority"
|
|
@@ -20,47 +22,34 @@ const ToggleGroupContext = React.createContext<
|
|
|
20
22
|
variant: "default",
|
|
21
23
|
})
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
className
|
|
39
|
-
)}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
43
|
-
{children}
|
|
44
|
-
</ToggleGroupContext.Provider>
|
|
45
|
-
</ToggleGroupPrimitive.Root>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
25
|
+
const ToggleGroup = React.forwardRef<
|
|
26
|
+
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
27
|
+
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
|
|
28
|
+
VariantProps<typeof toggleVariants>
|
|
29
|
+
>(({ className, variant, size, children, ...props }, ref) => (
|
|
30
|
+
<ToggleGroupPrimitive.Root
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn("flex items-center justify-center gap-1", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
36
|
+
{children}
|
|
37
|
+
</ToggleGroupContext.Provider>
|
|
38
|
+
</ToggleGroupPrimitive.Root>
|
|
39
|
+
))
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
VariantProps<typeof toggleVariants>) {
|
|
41
|
+
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
|
|
42
|
+
|
|
43
|
+
const ToggleGroupItem = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
|
|
46
|
+
VariantProps<typeof toggleVariants>
|
|
47
|
+
>(({ className, children, variant, size, ...props }, ref) => {
|
|
57
48
|
const context = React.useContext(ToggleGroupContext)
|
|
58
49
|
|
|
59
50
|
return (
|
|
60
51
|
<ToggleGroupPrimitive.Item
|
|
61
|
-
|
|
62
|
-
data-variant={context.variant || variant}
|
|
63
|
-
data-size={context.size || size}
|
|
52
|
+
ref={ref}
|
|
64
53
|
className={cn(
|
|
65
54
|
toggleVariants({
|
|
66
55
|
variant: context.variant || variant,
|
|
@@ -73,6 +62,8 @@ function ToggleGroupItem({
|
|
|
73
62
|
{children}
|
|
74
63
|
</ToggleGroupPrimitive.Item>
|
|
75
64
|
)
|
|
76
|
-
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
|
|
77
68
|
|
|
78
69
|
export { ToggleGroup, ToggleGroupItem }
|
package/src/ui/toggle.tsx
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
9
11
|
import * as React from "react"
|
|
10
12
|
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
11
13
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
@@ -13,7 +15,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
13
15
|
import { cn } from "../lib/utils"
|
|
14
16
|
|
|
15
17
|
const toggleVariants = cva(
|
|
16
|
-
"inline-flex items-center justify-center
|
|
18
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
|
|
17
19
|
{
|
|
18
20
|
variants: {
|
|
19
21
|
variant: {
|
|
@@ -22,9 +24,9 @@ const toggleVariants = cva(
|
|
|
22
24
|
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
23
25
|
},
|
|
24
26
|
size: {
|
|
25
|
-
default: "h-
|
|
26
|
-
sm: "h-
|
|
27
|
-
lg: "h-
|
|
27
|
+
default: "h-10 px-3 min-w-10",
|
|
28
|
+
sm: "h-9 px-2.5 min-w-9",
|
|
29
|
+
lg: "h-11 px-5 min-w-11",
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
defaultVariants: {
|
|
@@ -34,20 +36,18 @@ const toggleVariants = cva(
|
|
|
34
36
|
}
|
|
35
37
|
)
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
}
|
|
39
|
+
const Toggle = React.forwardRef<
|
|
40
|
+
React.ElementRef<typeof TogglePrimitive.Root>,
|
|
41
|
+
React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
|
|
42
|
+
VariantProps<typeof toggleVariants>
|
|
43
|
+
>(({ className, variant, size, ...props }, ref) => (
|
|
44
|
+
<TogglePrimitive.Root
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(toggleVariants({ variant, size, className }))}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
))
|
|
50
|
+
|
|
51
|
+
Toggle.displayName = TogglePrimitive.Root.displayName
|
|
52
52
|
|
|
53
53
|
export { Toggle, toggleVariants }
|