@health-samurai/react-components 0.0.0-alpha.4 → 0.0.0-alpha.6
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/dist/bundle.css +1375 -484
- package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/dist/src/components/code-editor/http/grammar/http.js +38 -0
- package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.test.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
- package/dist/src/components/code-editor/http/index.d.ts +4 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +66 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +14 -2
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +309 -20
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor.stories.d.ts +1 -0
- package/dist/src/components/code-editor.stories.d.ts.map +1 -1
- package/dist/src/components/code-editor.stories.js +255 -2
- package/dist/src/components/code-editor.stories.js.map +1 -1
- package/dist/src/components/copy-icon.d.ts +5 -1
- package/dist/src/components/copy-icon.d.ts.map +1 -1
- package/dist/src/components/copy-icon.js +41 -3
- package/dist/src/components/copy-icon.js.map +1 -1
- package/dist/src/components/data-table.d.ts +8 -0
- package/dist/src/components/data-table.d.ts.map +1 -0
- package/dist/src/components/data-table.js +65 -0
- package/dist/src/components/data-table.js.map +1 -0
- package/dist/src/components/data-table.stories.d.ts +7 -0
- package/dist/src/components/data-table.stories.d.ts.map +1 -0
- package/dist/src/components/data-table.stories.js +44 -0
- package/dist/src/components/data-table.stories.js.map +1 -0
- package/dist/src/components/fhir-structure-view.d.ts +34 -0
- package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
- package/dist/src/components/fhir-structure-view.js +229 -0
- package/dist/src/components/fhir-structure-view.js.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.d.ts +7 -0
- package/dist/src/components/fhir-structure-view.stories.d.ts.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.js +447 -0
- package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
- package/dist/src/components/patient-table.d.ts +73 -0
- package/dist/src/components/patient-table.d.ts.map +1 -0
- package/dist/src/components/patient-table.js +921 -0
- package/dist/src/components/patient-table.js.map +1 -0
- package/dist/src/components/patient-table.stories.d.ts +111 -0
- package/dist/src/components/patient-table.stories.d.ts.map +1 -0
- package/dist/src/components/patient-table.stories.js +172 -0
- package/dist/src/components/patient-table.stories.js.map +1 -0
- package/dist/src/components/request-line-editor.d.ts +13 -35
- package/dist/src/components/request-line-editor.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.js +72 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.stories.js +17 -53
- package/dist/src/components/request-line-editor.stories.js.map +1 -1
- package/dist/src/components/segment-control.d.ts +16 -0
- package/dist/src/components/segment-control.d.ts.map +1 -0
- package/dist/src/components/segment-control.js +48 -0
- package/dist/src/components/segment-control.js.map +1 -0
- package/dist/src/components/segment-control.stories.d.ts +15 -0
- package/dist/src/components/segment-control.stories.d.ts.map +1 -0
- package/dist/src/components/segment-control.stories.js +33 -0
- package/dist/src/components/segment-control.stories.js.map +1 -0
- package/dist/src/components/split-button.d.ts +5 -0
- package/dist/src/components/split-button.d.ts.map +1 -0
- package/dist/src/components/split-button.js +12 -0
- package/dist/src/components/split-button.js.map +1 -0
- package/dist/src/components/split-button.stories.d.ts +7 -0
- package/dist/src/components/split-button.stories.d.ts.map +1 -0
- package/dist/src/components/split-button.stories.js +57 -0
- package/dist/src/components/split-button.stories.js.map +1 -0
- package/dist/src/components/tree-view.d.ts +22 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +101 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.d.ts +13 -0
- package/dist/src/components/tree-view.stories.d.ts.map +1 -0
- package/dist/src/components/tree-view.stories.js +274 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +9 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +279 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +42 -3
- package/dist/src/index.d.ts +9 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +23 -5
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts +3 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.js +5 -2
- package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +12 -5
- package/dist/src/shadcn/components/ui/alert.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.js +4 -3
- package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/badge.js +16 -5
- package/dist/src/shadcn/components/ui/badge.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +6 -6
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +19 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +14 -6
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +20 -5
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +44 -35
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +18 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +121 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts +11 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +16 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +73 -12
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +0 -1
- package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.js +35 -7
- package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.js +26 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +12 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +12 -4
- package/dist/src/shadcn/components/ui/form.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.d.ts +3 -1
- package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input.js +126 -17
- package/dist/src/shadcn/components/ui/input.js.map +1 -1
- package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +8 -1
- package/dist/src/shadcn/components/ui/label.js.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.js +35 -13
- package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +6 -6
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +12 -1
- package/dist/src/shadcn/components/ui/popover.js.map +1 -1
- package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/progress.js +6 -2
- package/dist/src/shadcn/components/ui/progress.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +11 -6
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +57 -34
- package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.js +9 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -14
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +1 -4
- package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/separator.js +7 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +20 -6
- package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.js +3 -1
- package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
- package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/slider.js +34 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +16 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +23 -3
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +19 -11
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +18 -2
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +12 -8
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +21 -3
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +315 -9
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +50 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +15 -1
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +6 -2
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +18 -6
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +11 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +28 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +122 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/dist/src/typography.css +12 -0
- package/package.json +13 -2
- package/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
- package/src/components/code-editor/http/grammar/http.test.ts +110 -0
- package/src/components/code-editor/http/grammar/http.ts +21 -0
- package/src/components/code-editor/http/index.ts +87 -0
- package/src/components/code-editor/index.tsx +307 -21
- package/src/components/code-editor.stories.tsx +295 -1
- package/src/components/copy-icon.tsx +57 -3
- package/src/components/data-table.stories.tsx +38 -0
- package/src/components/data-table.tsx +117 -0
- package/src/components/fhir-structure-view.stories.tsx +439 -0
- package/src/components/fhir-structure-view.tsx +231 -0
- package/src/components/patient-table.stories.tsx +111 -0
- package/src/components/patient-table.tsx +1301 -0
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +98 -61
- package/src/components/segment-control.stories.tsx +29 -0
- package/src/components/segment-control.tsx +80 -0
- package/src/components/split-button.stories.tsx +49 -0
- package/src/components/split-button.tsx +17 -0
- package/src/components/tree-view.stories.tsx +259 -0
- package/src/components/tree-view.tsx +172 -0
- package/src/icons.tsx +287 -0
- package/src/index.css +42 -3
- package/src/index.tsx +9 -2
- package/src/shadcn/components/ui/accordion.tsx +66 -8
- package/src/shadcn/components/ui/alert-dialog.tsx +6 -2
- package/src/shadcn/components/ui/alert.tsx +53 -15
- package/src/shadcn/components/ui/avatar.tsx +17 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.tsx +35 -7
- package/src/shadcn/components/ui/button.tsx +118 -57
- package/src/shadcn/components/ui/card.tsx +44 -13
- package/src/shadcn/components/ui/checkbox.stories.tsx +20 -24
- package/src/shadcn/components/ui/checkbox.tsx +45 -4
- package/src/shadcn/components/ui/combobox.stories.tsx +19 -0
- package/src/shadcn/components/ui/combobox.tsx +142 -0
- package/src/shadcn/components/ui/command.stories.tsx +1 -1
- package/src/shadcn/components/ui/command.tsx +192 -36
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +93 -18
- package/src/shadcn/components/ui/dropdown-menu.tsx +37 -9
- package/src/shadcn/components/ui/form.tsx +16 -4
- package/src/shadcn/components/ui/input.tsx +400 -29
- package/src/shadcn/components/ui/label.tsx +21 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.tsx +12 -6
- package/src/shadcn/components/ui/popover.tsx +35 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-group.stories.tsx +22 -14
- package/src/shadcn/components/ui/radio-group.tsx +42 -5
- package/src/shadcn/components/ui/scroll-area.tsx +33 -5
- package/src/shadcn/components/ui/select.stories.tsx +0 -2
- package/src/shadcn/components/ui/select.tsx +184 -33
- package/src/shadcn/components/ui/separator.tsx +15 -5
- package/src/shadcn/components/ui/sidebar.tsx +68 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +82 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +19 -15
- package/src/shadcn/components/ui/sonner.tsx +53 -3
- package/src/shadcn/components/ui/switch.tsx +53 -7
- package/src/shadcn/components/ui/table.tsx +38 -11
- package/src/shadcn/components/ui/tabs.stories.tsx +32 -0
- package/src/shadcn/components/ui/tabs.tsx +456 -17
- package/src/shadcn/components/ui/textarea.tsx +42 -4
- package/src/shadcn/components/ui/toggle-group.tsx +27 -5
- package/src/shadcn/components/ui/toggle.tsx +59 -18
- package/src/shadcn/components/ui/tooltip.tsx +33 -8
- package/src/shadcn/components/ui/tree.tsx +233 -0
- package/src/typography.css +12 -0
|
@@ -4,34 +4,79 @@ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
import { cn } from "#shadcn/lib/utils";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
// Base select trigger styles
|
|
8
|
+
const baseSelectTriggerStyles = cn(
|
|
9
|
+
// Layout
|
|
10
|
+
"flex",
|
|
11
|
+
"w-full",
|
|
12
|
+
"items-center",
|
|
13
|
+
"justify-between",
|
|
14
|
+
"gap-2",
|
|
15
|
+
"whitespace-nowrap",
|
|
16
|
+
// Shape
|
|
17
|
+
"rounded-md",
|
|
18
|
+
// Borders
|
|
19
|
+
"border",
|
|
20
|
+
"border-border-primary",
|
|
21
|
+
// Background & Colors
|
|
22
|
+
"bg-transparent",
|
|
23
|
+
"text-sm",
|
|
24
|
+
// Spacing
|
|
25
|
+
"px-3",
|
|
26
|
+
"py-2",
|
|
27
|
+
// Transitions
|
|
28
|
+
"transition-colors",
|
|
29
|
+
"duration-300",
|
|
30
|
+
"outline-none",
|
|
31
|
+
// Hover
|
|
32
|
+
"hover:border-border-primary_hover",
|
|
33
|
+
// Focus
|
|
34
|
+
"focus-visible:ring-2",
|
|
35
|
+
"focus-visible:ring-utility-blue/70",
|
|
36
|
+
// Placeholder
|
|
37
|
+
"data-[placeholder]:text-text-tertiary",
|
|
38
|
+
// Selection
|
|
39
|
+
"selection:bg-selection",
|
|
40
|
+
"selection:text-text-primary",
|
|
41
|
+
// SVG icons
|
|
42
|
+
"[&_svg:not([class*='text-'])]:text-text-tertiary",
|
|
43
|
+
"[&_svg]:pointer-events-none",
|
|
44
|
+
"[&_svg]:shrink-0",
|
|
45
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
46
|
+
// Value styles
|
|
47
|
+
"*:data-[slot=select-value]:line-clamp-1",
|
|
48
|
+
"*:data-[slot=select-value]:flex",
|
|
49
|
+
"*:data-[slot=select-value]:items-center",
|
|
50
|
+
"*:data-[slot=select-value]:gap-2",
|
|
51
|
+
// Disabled
|
|
52
|
+
"disabled:pointer-events-none",
|
|
53
|
+
"disabled:cursor-not-allowed",
|
|
54
|
+
"disabled:text-text-disabled",
|
|
55
|
+
"disabled:bg-bg-disabled",
|
|
56
|
+
"disabled:border-border-disabled",
|
|
57
|
+
// Invalid
|
|
58
|
+
"aria-invalid:text-text-error-primary",
|
|
59
|
+
"aria-invalid:border-border-error",
|
|
60
|
+
"aria-invalid:ring-2",
|
|
61
|
+
"aria-invalid:ring-utility-red/70",
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const selectTriggerVariants = cva(baseSelectTriggerStyles, {
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
regular: cn("h-9"),
|
|
68
|
+
small: cn("h-8"),
|
|
28
69
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
70
|
+
variant: {
|
|
71
|
+
default: cn(""),
|
|
72
|
+
compound: cn("border-r-0", "typo-label"),
|
|
32
73
|
},
|
|
33
74
|
},
|
|
34
|
-
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
size: "regular",
|
|
77
|
+
variant: "default",
|
|
78
|
+
},
|
|
79
|
+
});
|
|
35
80
|
|
|
36
81
|
function Select({
|
|
37
82
|
...props
|
|
@@ -67,7 +112,7 @@ function SelectTrigger({
|
|
|
67
112
|
>
|
|
68
113
|
{children}
|
|
69
114
|
<SelectPrimitive.Icon asChild>
|
|
70
|
-
<ChevronDownIcon
|
|
115
|
+
<ChevronDownIcon />
|
|
71
116
|
</SelectPrimitive.Icon>
|
|
72
117
|
</SelectPrimitive.Trigger>
|
|
73
118
|
);
|
|
@@ -84,9 +129,47 @@ function SelectContent({
|
|
|
84
129
|
<SelectPrimitive.Content
|
|
85
130
|
data-slot="select-content"
|
|
86
131
|
className={cn(
|
|
87
|
-
|
|
132
|
+
// Layout
|
|
133
|
+
"relative",
|
|
134
|
+
"z-50",
|
|
135
|
+
"group",
|
|
136
|
+
"min-w-[8rem]",
|
|
137
|
+
"max-h-(--radix-select-content-available-height)",
|
|
138
|
+
"origin-(--radix-select-content-transform-origin)",
|
|
139
|
+
"overflow-x-hidden",
|
|
140
|
+
"overflow-y-auto",
|
|
141
|
+
// Shape
|
|
142
|
+
"rounded-md",
|
|
143
|
+
// Borders
|
|
144
|
+
"border",
|
|
145
|
+
"border-border-primary",
|
|
146
|
+
// Background & Colors
|
|
147
|
+
"bg-bg-primary",
|
|
148
|
+
"text-text-primary",
|
|
149
|
+
// Spacing
|
|
150
|
+
"py-1",
|
|
151
|
+
// Shadow
|
|
152
|
+
"shadow-lg",
|
|
153
|
+
// Animations - open
|
|
154
|
+
"data-[state=open]:animate-in",
|
|
155
|
+
"data-[state=open]:fade-in-0",
|
|
156
|
+
"data-[state=open]:zoom-in-95",
|
|
157
|
+
// Animations - closed
|
|
158
|
+
"data-[state=closed]:animate-out",
|
|
159
|
+
"data-[state=closed]:fade-out-0",
|
|
160
|
+
"data-[state=closed]:zoom-out-95",
|
|
161
|
+
// Slide animations
|
|
162
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
163
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
164
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
165
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
88
166
|
position === "popper" &&
|
|
89
|
-
|
|
167
|
+
cn(
|
|
168
|
+
"data-[side=bottom]:translate-y-1",
|
|
169
|
+
"data-[side=left]:-translate-x-1",
|
|
170
|
+
"data-[side=right]:translate-x-1",
|
|
171
|
+
"data-[side=top]:-translate-y-1",
|
|
172
|
+
),
|
|
90
173
|
className,
|
|
91
174
|
)}
|
|
92
175
|
position={position}
|
|
@@ -97,7 +180,12 @@ function SelectContent({
|
|
|
97
180
|
className={cn(
|
|
98
181
|
"p-1",
|
|
99
182
|
position === "popper" &&
|
|
100
|
-
|
|
183
|
+
cn(
|
|
184
|
+
"h-[var(--radix-select-trigger-height)]",
|
|
185
|
+
"w-full",
|
|
186
|
+
"min-w-[var(--radix-select-trigger-width)]",
|
|
187
|
+
"scroll-my-1",
|
|
188
|
+
),
|
|
101
189
|
)}
|
|
102
190
|
>
|
|
103
191
|
{children}
|
|
@@ -115,7 +203,13 @@ function SelectLabel({
|
|
|
115
203
|
return (
|
|
116
204
|
<SelectPrimitive.Label
|
|
117
205
|
data-slot="select-label"
|
|
118
|
-
className={cn(
|
|
206
|
+
className={cn(
|
|
207
|
+
"text-text-tertiary",
|
|
208
|
+
"px-2",
|
|
209
|
+
"py-1.5",
|
|
210
|
+
"typo-label",
|
|
211
|
+
className,
|
|
212
|
+
)}
|
|
119
213
|
{...props}
|
|
120
214
|
/>
|
|
121
215
|
);
|
|
@@ -130,12 +224,62 @@ function SelectItem({
|
|
|
130
224
|
<SelectPrimitive.Item
|
|
131
225
|
data-slot="select-item"
|
|
132
226
|
className={cn(
|
|
133
|
-
|
|
227
|
+
// Layout
|
|
228
|
+
"relative",
|
|
229
|
+
"flex",
|
|
230
|
+
"w-full",
|
|
231
|
+
"items-center",
|
|
232
|
+
"cursor-default",
|
|
233
|
+
"select-none",
|
|
234
|
+
// Shape
|
|
235
|
+
"rounded-md",
|
|
236
|
+
// Spacing
|
|
237
|
+
"py-1.5",
|
|
238
|
+
"pl-3",
|
|
239
|
+
"pr-8",
|
|
240
|
+
"mb-0.5",
|
|
241
|
+
"last:mb-0",
|
|
242
|
+
// Typography
|
|
243
|
+
"text-sm",
|
|
244
|
+
"text-text-primary",
|
|
245
|
+
// Interaction
|
|
246
|
+
"outline-hidden",
|
|
247
|
+
// Hover
|
|
248
|
+
"hover:bg-bg-tertiary",
|
|
249
|
+
// Active
|
|
250
|
+
"active:text-text-primary",
|
|
251
|
+
// Focus
|
|
252
|
+
"focus-visible:bg-bg-tertiary",
|
|
253
|
+
// Checked state
|
|
254
|
+
"data-[state=checked]:bg-bg-tertiary",
|
|
255
|
+
"data-[state=checked]:text-text-primary",
|
|
256
|
+
"group-hover:data-[state=checked]:bg-transparent",
|
|
257
|
+
// Disabled
|
|
258
|
+
"data-[disabled]:pointer-events-none",
|
|
259
|
+
"data-[disabled]:opacity-50",
|
|
260
|
+
// SVG icons
|
|
261
|
+
"[&_svg:not([class*='text-'])]:text-text-tertiary",
|
|
262
|
+
"[&_svg]:pointer-events-none",
|
|
263
|
+
"[&_svg]:shrink-0",
|
|
264
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
265
|
+
// Span styles
|
|
266
|
+
"*:[span]:last:flex",
|
|
267
|
+
"*:[span]:last:items-center",
|
|
268
|
+
"*:[span]:last:gap-2",
|
|
134
269
|
className,
|
|
135
270
|
)}
|
|
136
271
|
{...props}
|
|
137
272
|
>
|
|
138
|
-
<span
|
|
273
|
+
<span
|
|
274
|
+
className={cn(
|
|
275
|
+
"absolute",
|
|
276
|
+
"right-2",
|
|
277
|
+
"flex",
|
|
278
|
+
"size-3.5",
|
|
279
|
+
"items-center",
|
|
280
|
+
"justify-center",
|
|
281
|
+
)}
|
|
282
|
+
>
|
|
139
283
|
<SelectPrimitive.ItemIndicator>
|
|
140
284
|
<CheckIcon className="size-4" />
|
|
141
285
|
</SelectPrimitive.ItemIndicator>
|
|
@@ -152,7 +296,14 @@ function SelectSeparator({
|
|
|
152
296
|
return (
|
|
153
297
|
<SelectPrimitive.Separator
|
|
154
298
|
data-slot="select-separator"
|
|
155
|
-
className={cn(
|
|
299
|
+
className={cn(
|
|
300
|
+
"bg-border-separator",
|
|
301
|
+
"pointer-events-none",
|
|
302
|
+
"-mx-1",
|
|
303
|
+
"my-1",
|
|
304
|
+
"h-px",
|
|
305
|
+
className,
|
|
306
|
+
)}
|
|
156
307
|
{...props}
|
|
157
308
|
/>
|
|
158
309
|
);
|
|
@@ -4,6 +4,20 @@ import type * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "#shadcn/lib/utils";
|
|
6
6
|
|
|
7
|
+
// Separator styles
|
|
8
|
+
const separatorStyles = cn(
|
|
9
|
+
// Background
|
|
10
|
+
"bg-border-separator",
|
|
11
|
+
// Layout
|
|
12
|
+
"shrink-0",
|
|
13
|
+
// Horizontal orientation
|
|
14
|
+
"data-[orientation=horizontal]:h-px",
|
|
15
|
+
"data-[orientation=horizontal]:w-full",
|
|
16
|
+
// Vertical orientation
|
|
17
|
+
"data-[orientation=vertical]:h-full",
|
|
18
|
+
"data-[orientation=vertical]:w-px",
|
|
19
|
+
);
|
|
20
|
+
|
|
7
21
|
function Separator({
|
|
8
22
|
className,
|
|
9
23
|
orientation = "horizontal",
|
|
@@ -15,11 +29,7 @@ function Separator({
|
|
|
15
29
|
data-slot="separator"
|
|
16
30
|
decorative={decorative}
|
|
17
31
|
orientation={orientation}
|
|
18
|
-
className={cn(
|
|
19
|
-
"bg-bg-quaternary shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full",
|
|
20
|
-
"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
32
|
+
className={cn(separatorStyles, className)}
|
|
23
33
|
{...props}
|
|
24
34
|
/>
|
|
25
35
|
);
|
|
@@ -477,35 +477,77 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
|
477
477
|
);
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
480
|
+
// Base sidebar menu button styles
|
|
481
|
+
const baseSidebarMenuButtonStyles = cn(
|
|
482
|
+
// Layout
|
|
483
|
+
"flex",
|
|
484
|
+
"items-center",
|
|
485
|
+
"gap-2",
|
|
486
|
+
"w-full",
|
|
487
|
+
"overflow-hidden",
|
|
488
|
+
// Shape
|
|
489
|
+
"rounded-lg",
|
|
490
|
+
// Spacing
|
|
491
|
+
"py-2",
|
|
492
|
+
"px-[0.44rem]",
|
|
493
|
+
// Typography
|
|
494
|
+
"typo-body",
|
|
495
|
+
"text-text-secondary",
|
|
496
|
+
// Interaction
|
|
497
|
+
"outline-hidden",
|
|
498
|
+
"transition-all",
|
|
499
|
+
"cursor-pointer",
|
|
500
|
+
// Focus
|
|
501
|
+
"focus-visible:ring-2",
|
|
502
|
+
"focus-visible:ring-utility-blue/70",
|
|
503
|
+
// Hover
|
|
504
|
+
"hover:bg-bg-secondary",
|
|
505
|
+
"hover:text-text-primary",
|
|
506
|
+
// Active
|
|
507
|
+
"active:bg-bg-quaternary",
|
|
508
|
+
"data-[active=true]:bg-bg-brand-secondary",
|
|
509
|
+
"data-[active=true]:text-text-primary",
|
|
510
|
+
"data-[active=true]:[&>svg]:text-text-brand-primary",
|
|
511
|
+
// Open state
|
|
512
|
+
"data-[state=open]:hover:bg-bg-secondary",
|
|
513
|
+
"data-[state=open]:hover:text-text-primary",
|
|
514
|
+
// Disabled
|
|
515
|
+
"disabled:pointer-events-none",
|
|
516
|
+
"disabled:opacity-50",
|
|
517
|
+
"aria-disabled:pointer-events-none",
|
|
518
|
+
"aria-disabled:opacity-50",
|
|
519
|
+
// Group styles
|
|
520
|
+
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
521
|
+
"group-data-[collapsible=icon]:py-2!",
|
|
522
|
+
"group-data-[collapsible=icon]:px-[0.44rem]!",
|
|
523
|
+
// Content styles
|
|
524
|
+
"[&>span:last-child]:truncate",
|
|
525
|
+
"[&>svg]:size-5",
|
|
526
|
+
"[&>svg]:shrink-0",
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
const sidebarMenuButtonVariants = cva(baseSidebarMenuButtonStyles, {
|
|
530
|
+
variants: {
|
|
531
|
+
variant: {
|
|
532
|
+
default: cn(""),
|
|
533
|
+
outline: cn(
|
|
534
|
+
"shadow-[0_0_0_1px_hsl(var(--sidebar-border))]",
|
|
535
|
+
"hover:bg-bg-secondary",
|
|
536
|
+
"hover:text-text-primary",
|
|
537
|
+
"hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
538
|
+
),
|
|
502
539
|
},
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
540
|
+
size: {
|
|
541
|
+
default: cn(""),
|
|
542
|
+
sm: cn(""),
|
|
543
|
+
lg: cn("h-12", "text-sm", "group-data-[collapsible=icon]:p-0!"),
|
|
506
544
|
},
|
|
507
545
|
},
|
|
508
|
-
|
|
546
|
+
defaultVariants: {
|
|
547
|
+
variant: "default",
|
|
548
|
+
size: "default",
|
|
549
|
+
},
|
|
550
|
+
});
|
|
509
551
|
|
|
510
552
|
function SidebarMenuButton({
|
|
511
553
|
asChild = false,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { cn } from "#shadcn/lib/utils";
|
|
2
2
|
|
|
3
|
+
// Skeleton styles
|
|
4
|
+
const skeletonStyles = cn("bg-bg-tertiary", "animate-pulse", "rounded-md");
|
|
5
|
+
|
|
3
6
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
7
|
return (
|
|
5
8
|
<div
|
|
6
9
|
data-slot="skeleton"
|
|
7
|
-
className={cn(
|
|
10
|
+
className={cn(skeletonStyles, className)}
|
|
8
11
|
{...props}
|
|
9
12
|
/>
|
|
10
13
|
);
|
|
@@ -4,6 +4,84 @@ import * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "#shadcn/lib/utils";
|
|
6
6
|
|
|
7
|
+
// Slider root styles
|
|
8
|
+
const sliderRootStyles = cn(
|
|
9
|
+
// Layout
|
|
10
|
+
"relative",
|
|
11
|
+
"flex",
|
|
12
|
+
"w-full",
|
|
13
|
+
"items-center",
|
|
14
|
+
// Interaction
|
|
15
|
+
"touch-none",
|
|
16
|
+
"select-none",
|
|
17
|
+
// Disabled
|
|
18
|
+
"data-[disabled]:opacity-50",
|
|
19
|
+
// Vertical orientation
|
|
20
|
+
"data-[orientation=vertical]:h-full",
|
|
21
|
+
"data-[orientation=vertical]:min-h-44",
|
|
22
|
+
"data-[orientation=vertical]:w-auto",
|
|
23
|
+
"data-[orientation=vertical]:flex-col",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Slider track styles
|
|
27
|
+
const sliderTrackStyles = cn(
|
|
28
|
+
// Background
|
|
29
|
+
"bg-bg-quaternary",
|
|
30
|
+
// Layout
|
|
31
|
+
"relative",
|
|
32
|
+
"grow",
|
|
33
|
+
"overflow-hidden",
|
|
34
|
+
// Shape
|
|
35
|
+
"rounded-full",
|
|
36
|
+
// Horizontal orientation
|
|
37
|
+
"data-[orientation=horizontal]:h-1.5",
|
|
38
|
+
"data-[orientation=horizontal]:w-full",
|
|
39
|
+
// Vertical orientation
|
|
40
|
+
"data-[orientation=vertical]:h-full",
|
|
41
|
+
"data-[orientation=vertical]:w-1.5",
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// Slider range styles
|
|
45
|
+
const sliderRangeStyles = cn(
|
|
46
|
+
// Background
|
|
47
|
+
"bg-bg-link",
|
|
48
|
+
// Layout
|
|
49
|
+
"absolute",
|
|
50
|
+
// Horizontal orientation
|
|
51
|
+
"data-[orientation=horizontal]:h-full",
|
|
52
|
+
// Vertical orientation
|
|
53
|
+
"data-[orientation=vertical]:w-full",
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Slider thumb styles
|
|
57
|
+
const sliderThumbStyles = cn(
|
|
58
|
+
// Layout
|
|
59
|
+
"block",
|
|
60
|
+
"size-4",
|
|
61
|
+
"shrink-0",
|
|
62
|
+
// Shape
|
|
63
|
+
"rounded-full",
|
|
64
|
+
// Borders
|
|
65
|
+
"border",
|
|
66
|
+
"border-border-link",
|
|
67
|
+
// Background
|
|
68
|
+
"bg-bg-primary",
|
|
69
|
+
// Shadow
|
|
70
|
+
"shadow-sm",
|
|
71
|
+
// Transitions
|
|
72
|
+
"transition-[color,box-shadow]",
|
|
73
|
+
// Hover
|
|
74
|
+
"hover:ring-4",
|
|
75
|
+
"hover:ring-utility-blue/70",
|
|
76
|
+
// Focus
|
|
77
|
+
"focus-visible:ring-4",
|
|
78
|
+
"focus-visible:ring-utility-blue/70",
|
|
79
|
+
"focus-visible:outline-hidden",
|
|
80
|
+
// Disabled
|
|
81
|
+
"disabled:pointer-events-none",
|
|
82
|
+
"disabled:opacity-50",
|
|
83
|
+
);
|
|
84
|
+
|
|
7
85
|
function Slider({
|
|
8
86
|
className,
|
|
9
87
|
defaultValue,
|
|
@@ -29,23 +107,16 @@ function Slider({
|
|
|
29
107
|
{...(value !== undefined ? { value } : {})}
|
|
30
108
|
min={min}
|
|
31
109
|
max={max}
|
|
32
|
-
className={cn(
|
|
33
|
-
"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",
|
|
34
|
-
className,
|
|
35
|
-
)}
|
|
110
|
+
className={cn(sliderRootStyles, className)}
|
|
36
111
|
{...props}
|
|
37
112
|
>
|
|
38
113
|
<SliderPrimitive.Track
|
|
39
114
|
data-slot="slider-track"
|
|
40
|
-
className={
|
|
41
|
-
"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",
|
|
42
|
-
)}
|
|
115
|
+
className={sliderTrackStyles}
|
|
43
116
|
>
|
|
44
117
|
<SliderPrimitive.Range
|
|
45
118
|
data-slot="slider-range"
|
|
46
|
-
className={
|
|
47
|
-
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
48
|
-
)}
|
|
119
|
+
className={sliderRangeStyles}
|
|
49
120
|
/>
|
|
50
121
|
</SliderPrimitive.Track>
|
|
51
122
|
{Array.from({ length: _values.length }, (_, index) => (
|
|
@@ -53,7 +124,7 @@ function Slider({
|
|
|
53
124
|
data-slot="slider-thumb"
|
|
54
125
|
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME: unchanged shadcn
|
|
55
126
|
key={index}
|
|
56
|
-
className=
|
|
127
|
+
className={sliderThumbStyles}
|
|
57
128
|
/>
|
|
58
129
|
))}
|
|
59
130
|
</SliderPrimitive.Root>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { toast } from "sonner";
|
|
3
2
|
import { Button } from "#shadcn/components/ui/button";
|
|
3
|
+
import { Toaster, toast } from "#shadcn/components/ui/sonner";
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: "Component/Sonner",
|
|
@@ -11,19 +11,23 @@ type Story = StoryObj<typeof meta>;
|
|
|
11
11
|
|
|
12
12
|
export const Demo = {
|
|
13
13
|
render: () => (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
<div>
|
|
15
|
+
<Button
|
|
16
|
+
variant="secondary"
|
|
17
|
+
onClick={() =>
|
|
18
|
+
toast("Event has been created", {
|
|
19
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
20
|
+
action: {
|
|
21
|
+
label: "Undo",
|
|
22
|
+
variant: "primary",
|
|
23
|
+
onClick: () => console.log("Undo"),
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
Show Toast
|
|
29
|
+
</Button>
|
|
30
|
+
<Toaster position="top-center" />
|
|
31
|
+
</div>
|
|
28
32
|
),
|
|
29
33
|
} satisfies Story;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from "class-variance-authority";
|
|
1
4
|
import { useTheme } from "next-themes";
|
|
2
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Toaster as Sonner,
|
|
7
|
+
toast as sonnerToast,
|
|
8
|
+
type ToasterProps,
|
|
9
|
+
} from "sonner";
|
|
10
|
+
import { Button, type buttonVariants } from "./button";
|
|
3
11
|
|
|
4
12
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
5
13
|
const { theme = "system" } = useTheme();
|
|
6
14
|
|
|
7
15
|
return (
|
|
8
16
|
<Sonner
|
|
9
|
-
theme={
|
|
17
|
+
theme={
|
|
18
|
+
theme === "system" ? "system" : theme === "dark" ? "dark" : "light"
|
|
19
|
+
}
|
|
10
20
|
className="toaster group"
|
|
11
21
|
style={
|
|
12
22
|
{
|
|
@@ -20,4 +30,44 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|
|
20
30
|
);
|
|
21
31
|
};
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
// Custom toast wrapper with our buttons
|
|
34
|
+
const toast = (
|
|
35
|
+
message: string,
|
|
36
|
+
options?: {
|
|
37
|
+
description?: string;
|
|
38
|
+
action?: {
|
|
39
|
+
label: string;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
42
|
+
};
|
|
43
|
+
cancel?: {
|
|
44
|
+
label: string;
|
|
45
|
+
onClick: () => void;
|
|
46
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
) => {
|
|
50
|
+
return sonnerToast(message, {
|
|
51
|
+
...options,
|
|
52
|
+
action: options?.action ? (
|
|
53
|
+
<Button
|
|
54
|
+
variant={options.action.variant || "secondary"}
|
|
55
|
+
size="small"
|
|
56
|
+
onClick={options.action.onClick}
|
|
57
|
+
>
|
|
58
|
+
{options.action.label}
|
|
59
|
+
</Button>
|
|
60
|
+
) : undefined,
|
|
61
|
+
cancel: options?.cancel ? (
|
|
62
|
+
<Button
|
|
63
|
+
variant={options.cancel.variant || "ghost"}
|
|
64
|
+
size="small"
|
|
65
|
+
onClick={options.cancel.onClick}
|
|
66
|
+
>
|
|
67
|
+
{options.cancel.label}
|
|
68
|
+
</Button>
|
|
69
|
+
) : undefined,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { Toaster, toast };
|