@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
|
@@ -1,82 +1,105 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { toast } from "sonner";
|
|
2
4
|
import { Input } from "../shadcn/components/ui/input.js";
|
|
3
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../shadcn/components/ui/select.js";
|
|
4
6
|
import { cn } from "../shadcn/lib/utils.js";
|
|
5
7
|
import { CopyIcon } from "./copy-icon.js";
|
|
6
|
-
const
|
|
7
|
-
GET
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
PATCH: {
|
|
23
|
-
text: "text-violet-600 [&_svg]:text-violet-600",
|
|
24
|
-
background: "bg-violet-200",
|
|
25
|
-
border: "border-violet-400! hover:border-violet-400 ring-violet-200!"
|
|
26
|
-
},
|
|
27
|
-
DELETE: {
|
|
28
|
-
text: "text-red-600 [&_svg]:text-red-600!",
|
|
29
|
-
background: "bg-red-200",
|
|
30
|
-
border: "border-red-300! hover:border-red-300 ring-red-200!"
|
|
8
|
+
const METHODS = [
|
|
9
|
+
"GET",
|
|
10
|
+
"POST",
|
|
11
|
+
"PUT",
|
|
12
|
+
"PATCH",
|
|
13
|
+
"DELETE"
|
|
14
|
+
];
|
|
15
|
+
const requestMethodVariants = cva(cn("border-r-0", "rounded-r-none", "shadow-none", "typo-label", "text-left", "items-center", "w-26"), {
|
|
16
|
+
variants: {
|
|
17
|
+
method: {
|
|
18
|
+
GET: "text-utility-green [&_svg]:text-utility-green",
|
|
19
|
+
POST: "text-utility-yellow [&_svg]:text-utility-yellow",
|
|
20
|
+
PUT: "text-utility-blue [&_svg]:text-utility-blue ",
|
|
21
|
+
PATCH: "text-utility-violet [&_svg]:text-utility-violet",
|
|
22
|
+
DELETE: "text-utility-red [&_svg]:text-utility-red"
|
|
23
|
+
}
|
|
31
24
|
}
|
|
32
|
-
};
|
|
33
|
-
function
|
|
25
|
+
});
|
|
26
|
+
function isKnownMethod(candidate) {
|
|
27
|
+
const methods = METHODS;
|
|
28
|
+
return methods.includes(candidate);
|
|
29
|
+
}
|
|
30
|
+
function RequestMethodSelector({ value, onValueChange }) {
|
|
34
31
|
return /*#__PURE__*/ _jsxs(Select, {
|
|
35
|
-
value:
|
|
36
|
-
onValueChange
|
|
32
|
+
value: value,
|
|
33
|
+
...onValueChange ? {
|
|
34
|
+
onValueChange: onValueChange
|
|
35
|
+
} : {},
|
|
37
36
|
children: [
|
|
38
37
|
/*#__PURE__*/ _jsx(SelectTrigger, {
|
|
39
|
-
className:
|
|
40
|
-
|
|
38
|
+
className: requestMethodVariants(isKnownMethod(value) ? {
|
|
39
|
+
method: value
|
|
40
|
+
} : undefined),
|
|
41
|
+
children: /*#__PURE__*/ _jsx(SelectValue, {
|
|
42
|
+
children: value
|
|
43
|
+
})
|
|
41
44
|
}),
|
|
42
45
|
/*#__PURE__*/ _jsx(SelectContent, {
|
|
43
|
-
children:
|
|
46
|
+
children: METHODS.map((method)=>/*#__PURE__*/ _jsx(SelectItem, {
|
|
44
47
|
value: method,
|
|
45
|
-
children: /*#__PURE__*/
|
|
46
|
-
className:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
" "
|
|
51
|
-
]
|
|
48
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
49
|
+
className: requestMethodVariants({
|
|
50
|
+
method: method
|
|
51
|
+
}),
|
|
52
|
+
children: method
|
|
52
53
|
})
|
|
53
54
|
}, method))
|
|
54
55
|
})
|
|
55
56
|
]
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
|
-
function RequestLineEditor({ className,
|
|
59
|
+
function RequestLineEditor({ className, method, onMethodChange, path, placeholder, autoFocus, onPathChange }) {
|
|
59
60
|
return /*#__PURE__*/ _jsxs("div", {
|
|
60
61
|
className: cn("flex", className),
|
|
61
62
|
children: [
|
|
62
63
|
/*#__PURE__*/ _jsx(RequestMethodSelector, {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
methods: methods
|
|
64
|
+
value: method,
|
|
65
|
+
onValueChange: onMethodChange
|
|
66
66
|
}),
|
|
67
67
|
/*#__PURE__*/ _jsx(Input, {
|
|
68
|
-
className:
|
|
69
|
-
value:
|
|
68
|
+
className: "rounded-l-none",
|
|
69
|
+
value: path,
|
|
70
|
+
autoFocus: autoFocus,
|
|
71
|
+
placeholder: placeholder,
|
|
70
72
|
rightSlot: /*#__PURE__*/ _jsx(CopyIcon, {
|
|
71
|
-
text: `${
|
|
73
|
+
text: `${method} ${path}`,
|
|
74
|
+
tooltipText: "Copy request line",
|
|
75
|
+
showToast: false,
|
|
76
|
+
onCopy: (text)=>{
|
|
77
|
+
// Custom toast for request line
|
|
78
|
+
const truncatedText = text.length > 30 ? `${text.slice(0, 30)}...` : text;
|
|
79
|
+
toast(/*#__PURE__*/ _jsxs("div", {
|
|
80
|
+
className: "flex flex-col gap-1",
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ _jsx("span", {
|
|
83
|
+
className: "typo-body",
|
|
84
|
+
children: "Request line copied"
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx("span", {
|
|
87
|
+
className: "typo-code text-text-secondary",
|
|
88
|
+
children: truncatedText
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
}), {
|
|
92
|
+
duration: 2000
|
|
93
|
+
});
|
|
94
|
+
}
|
|
72
95
|
}),
|
|
73
|
-
...
|
|
74
|
-
onChange:
|
|
96
|
+
...onPathChange !== undefined ? {
|
|
97
|
+
onChange: onPathChange
|
|
75
98
|
} : {}
|
|
76
99
|
})
|
|
77
100
|
]
|
|
78
101
|
});
|
|
79
102
|
}
|
|
80
|
-
export { RequestLineEditor,
|
|
103
|
+
export { RequestLineEditor, requestMethodVariants };
|
|
81
104
|
|
|
82
105
|
//# sourceMappingURL=request-line-editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/request-line-editor.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { Input } from \"#shadcn/components/ui/input\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"#shadcn/components/ui/select\";\nimport { cn } from \"#shadcn/lib/utils\";\nimport { CopyIcon } from \"./copy-icon\";\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/request-line-editor.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { toast } from \"sonner\";\nimport { Input } from \"#shadcn/components/ui/input\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"#shadcn/components/ui/select\";\nimport { cn } from \"#shadcn/lib/utils\";\nimport { CopyIcon } from \"./copy-icon\";\n\nconst METHODS = [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"] as const;\ntype RequestMethod = (typeof METHODS)[number];\n\nconst requestMethodVariants = cva<{ method: { [K in RequestMethod]: string } }>(\n\tcn(\n\t\t\"border-r-0\",\n\t\t\"rounded-r-none\",\n\t\t\"shadow-none\",\n\t\t\"typo-label\",\n\t\t\"text-left\",\n\t\t\"items-center\",\n\t\t\"w-26\",\n\t),\n\t{\n\t\tvariants: {\n\t\t\tmethod: {\n\t\t\t\tGET: \"text-utility-green [&_svg]:text-utility-green\",\n\t\t\t\tPOST: \"text-utility-yellow [&_svg]:text-utility-yellow\",\n\t\t\t\tPUT: \"text-utility-blue [&_svg]:text-utility-blue \",\n\t\t\t\tPATCH: \"text-utility-violet [&_svg]:text-utility-violet\",\n\t\t\t\tDELETE: \"text-utility-red [&_svg]:text-utility-red\",\n\t\t\t},\n\t\t},\n\t},\n);\n\ntype RequestMethodSelectorProps = {\n\tvalue: string;\n\tonValueChange?: (newMethod: string) => void;\n};\n\nfunction isKnownMethod(candidate: string): candidate is RequestMethod {\n\tconst methods: readonly string[] = METHODS;\n\treturn methods.includes(candidate);\n}\n\nfunction RequestMethodSelector({\n\tvalue,\n\tonValueChange,\n}: RequestMethodSelectorProps) {\n\treturn (\n\t\t<Select\n\t\t\tvalue={value}\n\t\t\t{...(onValueChange ? { onValueChange: onValueChange } : {})}\n\t\t>\n\t\t\t<SelectTrigger\n\t\t\t\tclassName={requestMethodVariants(\n\t\t\t\t\tisKnownMethod(value) ? { method: value } : undefined,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<SelectValue>{value}</SelectValue>\n\t\t\t</SelectTrigger>\n\t\t\t<SelectContent>\n\t\t\t\t{METHODS.map((method) => (\n\t\t\t\t\t<SelectItem key={method} value={method}>\n\t\t\t\t\t\t<span className={requestMethodVariants({ method: method })}>\n\t\t\t\t\t\t\t{method}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</SelectItem>\n\t\t\t\t))}\n\t\t\t</SelectContent>\n\t\t</Select>\n\t);\n}\n\ntype RequestLineEditorProps = {\n\tmethod: string;\n\tplaceholder?: string;\n\tautoFocus?: boolean;\n\tonMethodChange: (newMethod: string) => void;\n\tpath?: string | undefined;\n\tonPathChange?: React.ChangeEventHandler<HTMLInputElement>;\n\tclassName?: string;\n};\n\nfunction RequestLineEditor({\n\tclassName,\n\tmethod,\n\tonMethodChange,\n\tpath,\n\tplaceholder,\n\tautoFocus,\n\tonPathChange,\n}: RequestLineEditorProps) {\n\treturn (\n\t\t<div className={cn(\"flex\", className)}>\n\t\t\t<RequestMethodSelector value={method} onValueChange={onMethodChange} />\n\t\t\t<Input\n\t\t\t\tclassName=\"rounded-l-none\"\n\t\t\t\tvalue={path}\n\t\t\t\tautoFocus={autoFocus}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\trightSlot={\n\t\t\t\t\t<CopyIcon\n\t\t\t\t\t\ttext={`${method} ${path}`}\n\t\t\t\t\t\ttooltipText=\"Copy request line\"\n\t\t\t\t\t\tshowToast={false}\n\t\t\t\t\t\tonCopy={(text) => {\n\t\t\t\t\t\t\t// Custom toast for request line\n\t\t\t\t\t\t\tconst truncatedText =\n\t\t\t\t\t\t\t\ttext.length > 30 ? `${text.slice(0, 30)}...` : text;\n\t\t\t\t\t\t\ttoast(\n\t\t\t\t\t\t\t\t<div className=\"flex flex-col gap-1\">\n\t\t\t\t\t\t\t\t\t<span className=\"typo-body\">Request line copied</span>\n\t\t\t\t\t\t\t\t\t<span className=\"typo-code text-text-secondary\">\n\t\t\t\t\t\t\t\t\t\t{truncatedText}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</div>,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tduration: 2000,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\t{...(onPathChange !== undefined ? { onChange: onPathChange } : {})}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n\trequestMethodVariants,\n};\n"],"names":["cva","toast","Input","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","cn","CopyIcon","METHODS","requestMethodVariants","variants","method","GET","POST","PUT","PATCH","DELETE","isKnownMethod","candidate","methods","includes","RequestMethodSelector","value","onValueChange","className","undefined","map","span","RequestLineEditor","onMethodChange","path","placeholder","autoFocus","onPathChange","div","rightSlot","text","tooltipText","showToast","onCopy","truncatedText","length","slice","duration","onChange"],"mappings":";AAAA,SAASA,GAAG,QAAQ,2BAA2B;AAE/C,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,KAAK,QAAQ,mCAA8B;AACpD,SACCC,MAAM,EACNC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,WAAW,QACL,oCAA+B;AACtC,SAASC,EAAE,QAAQ,yBAAoB;AACvC,SAASC,QAAQ,QAAQ,iBAAc;AAEvC,MAAMC,UAAU;IAAC;IAAO;IAAQ;IAAO;IAAS;CAAS;AAGzD,MAAMC,wBAAwBX,IAC7BQ,GACC,cACA,kBACA,eACA,cACA,aACA,gBACA,SAED;IACCI,UAAU;QACTC,QAAQ;YACPC,KAAK;YACLC,MAAM;YACNC,KAAK;YACLC,OAAO;YACPC,QAAQ;QACT;IACD;AACD;AAQD,SAASC,cAAcC,SAAiB;IACvC,MAAMC,UAA6BX;IACnC,OAAOW,QAAQC,QAAQ,CAACF;AACzB;AAEA,SAASG,sBAAsB,EAC9BC,KAAK,EACLC,aAAa,EACe;IAC5B,qBACC,MAACtB;QACAqB,OAAOA;QACN,GAAIC,gBAAgB;YAAEA,eAAeA;QAAc,IAAI,CAAC,CAAC;;0BAE1D,KAACnB;gBACAoB,WAAWf,sBACVQ,cAAcK,SAAS;oBAAEX,QAAQW;gBAAM,IAAIG;0BAG5C,cAAA,KAACpB;8BAAaiB;;;0BAEf,KAACpB;0BACCM,QAAQkB,GAAG,CAAC,CAACf,uBACb,KAACR;wBAAwBmB,OAAOX;kCAC/B,cAAA,KAACgB;4BAAKH,WAAWf,sBAAsB;gCAAEE,QAAQA;4BAAO;sCACtDA;;uBAFcA;;;;AAStB;AAYA,SAASiB,kBAAkB,EAC1BJ,SAAS,EACTb,MAAM,EACNkB,cAAc,EACdC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,YAAY,EACY;IACxB,qBACC,MAACC;QAAIV,WAAWlB,GAAG,QAAQkB;;0BAC1B,KAACH;gBAAsBC,OAAOX;gBAAQY,eAAeM;;0BACrD,KAAC7B;gBACAwB,WAAU;gBACVF,OAAOQ;gBACPE,WAAWA;gBACXD,aAAaA;gBACbI,yBACC,KAAC5B;oBACA6B,MAAM,GAAGzB,OAAO,CAAC,EAAEmB,MAAM;oBACzBO,aAAY;oBACZC,WAAW;oBACXC,QAAQ,CAACH;wBACR,gCAAgC;wBAChC,MAAMI,gBACLJ,KAAKK,MAAM,GAAG,KAAK,GAAGL,KAAKM,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAGN;wBAChDrC,oBACC,MAACmC;4BAAIV,WAAU;;8CACd,KAACG;oCAAKH,WAAU;8CAAY;;8CAC5B,KAACG;oCAAKH,WAAU;8CACdgB;;;4BAGH;4BACCG,UAAU;wBACX;oBAEF;;gBAGD,GAAIV,iBAAiBR,YAAY;oBAAEmB,UAAUX;gBAAa,IAAI,CAAC,CAAC;;;;AAIrE;AAEA,SACCL,iBAAiB,EAEjBnB,qBAAqB,GACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-line-editor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACN,iBAAiB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"request-line-editor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACN,iBAAiB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAuBhD,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC"}
|
|
@@ -13,9 +13,9 @@ const meta = {
|
|
|
13
13
|
]
|
|
14
14
|
};
|
|
15
15
|
export default meta;
|
|
16
|
-
function RequestLineEditorWrapper({
|
|
17
|
-
const [currentSelectedMethod, setMethod] = React.useState(
|
|
18
|
-
const [currentInputValue, setInputValue] = React.useState(
|
|
16
|
+
function RequestLineEditorWrapper({ method, path }) {
|
|
17
|
+
const [currentSelectedMethod, setMethod] = React.useState(method);
|
|
18
|
+
const [currentInputValue, setInputValue] = React.useState(path);
|
|
19
19
|
const actionSetMethod = (method)=>{
|
|
20
20
|
action("setMethod")(method);
|
|
21
21
|
setMethod(method);
|
|
@@ -25,24 +25,16 @@ function RequestLineEditorWrapper({ selectedMethod, methods, inputValue }) {
|
|
|
25
25
|
setInputValue(event.target.value);
|
|
26
26
|
};
|
|
27
27
|
return /*#__PURE__*/ _jsx(RequestLineEditor, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onInputChange: actionSetInputValue
|
|
28
|
+
method: currentSelectedMethod,
|
|
29
|
+
onMethodChange: actionSetMethod,
|
|
30
|
+
path: currentInputValue,
|
|
31
|
+
onPathChange: actionSetInputValue
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
export const GET = {
|
|
36
35
|
args: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"GET",
|
|
40
|
-
"POST",
|
|
41
|
-
"PUT",
|
|
42
|
-
"PATCH",
|
|
43
|
-
"DELETE"
|
|
44
|
-
],
|
|
45
|
-
inputValue: "/fhir/Patient"
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: "/fhir/Patient"
|
|
46
38
|
},
|
|
47
39
|
render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
|
|
48
40
|
...args
|
|
@@ -50,15 +42,8 @@ export const GET = {
|
|
|
50
42
|
};
|
|
51
43
|
export const POST = {
|
|
52
44
|
args: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"GET",
|
|
56
|
-
"POST",
|
|
57
|
-
"PUT",
|
|
58
|
-
"PATCH",
|
|
59
|
-
"DELETE"
|
|
60
|
-
],
|
|
61
|
-
inputValue: "/fhir/Patient"
|
|
45
|
+
method: "POST",
|
|
46
|
+
path: "/fhir/Patient"
|
|
62
47
|
},
|
|
63
48
|
render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
|
|
64
49
|
...args
|
|
@@ -66,15 +51,8 @@ export const POST = {
|
|
|
66
51
|
};
|
|
67
52
|
export const PUT = {
|
|
68
53
|
args: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"GET",
|
|
72
|
-
"POST",
|
|
73
|
-
"PUT",
|
|
74
|
-
"PATCH",
|
|
75
|
-
"DELETE"
|
|
76
|
-
],
|
|
77
|
-
inputValue: "/fhir/Patient"
|
|
54
|
+
method: "PUT",
|
|
55
|
+
path: "/fhir/Patient"
|
|
78
56
|
},
|
|
79
57
|
render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
|
|
80
58
|
...args
|
|
@@ -82,15 +60,8 @@ export const PUT = {
|
|
|
82
60
|
};
|
|
83
61
|
export const PATCH = {
|
|
84
62
|
args: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"GET",
|
|
88
|
-
"POST",
|
|
89
|
-
"PUT",
|
|
90
|
-
"PATCH",
|
|
91
|
-
"DELETE"
|
|
92
|
-
],
|
|
93
|
-
inputValue: "/fhir/Patient"
|
|
63
|
+
method: "PATCH",
|
|
64
|
+
path: "/fhir/Patient"
|
|
94
65
|
},
|
|
95
66
|
render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
|
|
96
67
|
...args
|
|
@@ -98,15 +69,8 @@ export const PATCH = {
|
|
|
98
69
|
};
|
|
99
70
|
export const DELETE = {
|
|
100
71
|
args: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"GET",
|
|
104
|
-
"POST",
|
|
105
|
-
"PUT",
|
|
106
|
-
"PATCH",
|
|
107
|
-
"DELETE"
|
|
108
|
-
],
|
|
109
|
-
inputValue: "/fhir/Patient"
|
|
72
|
+
method: "DELETE",
|
|
73
|
+
path: "/fhir/Patient"
|
|
110
74
|
},
|
|
111
75
|
render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
|
|
112
76
|
...args
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/request-line-editor.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport * as React from \"react\";\nimport { action } from \"storybook/actions\";\nimport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n} from \"./request-line-editor\";\n\nconst meta: Meta<typeof RequestLineEditor> = {\n\ttitle: \"Component/Request line editor\",\n\tcomponent: RequestLineEditor,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n};\n\nexport default meta;\ntype Story = StoryObj<typeof RequestLineEditor>;\n\nfunction RequestLineEditorWrapper({
|
|
1
|
+
{"version":3,"sources":["../../../src/components/request-line-editor.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport * as React from \"react\";\nimport { action } from \"storybook/actions\";\nimport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n} from \"./request-line-editor\";\n\nconst meta: Meta<typeof RequestLineEditor> = {\n\ttitle: \"Component/Request line editor\",\n\tcomponent: RequestLineEditor,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n};\n\nexport default meta;\ntype Story = StoryObj<typeof RequestLineEditor>;\n\nfunction RequestLineEditorWrapper({ method, path }: RequestLineEditorProps) {\n\tconst [currentSelectedMethod, setMethod] = React.useState(method);\n\tconst [currentInputValue, setInputValue] = React.useState(path);\n\tconst actionSetMethod = (method: string) => {\n\t\taction(\"setMethod\")(method);\n\t\tsetMethod(method);\n\t};\n\tconst actionSetInputValue = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\taction(\"setMethod\")(event);\n\t\tsetInputValue(event.target.value);\n\t};\n\treturn (\n\t\t<RequestLineEditor\n\t\t\tmethod={currentSelectedMethod}\n\t\t\tonMethodChange={actionSetMethod}\n\t\t\tpath={currentInputValue}\n\t\t\tonPathChange={actionSetInputValue}\n\t\t/>\n\t);\n}\n\nexport const GET: Story = {\n\targs: {\n\t\tmethod: \"GET\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const POST: Story = {\n\targs: {\n\t\tmethod: \"POST\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PUT: Story = {\n\targs: {\n\t\tmethod: \"PUT\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PATCH: Story = {\n\targs: {\n\t\tmethod: \"PATCH\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const DELETE: Story = {\n\targs: {\n\t\tmethod: \"DELETE\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n"],"names":["React","action","RequestLineEditor","meta","title","component","parameters","layout","tags","RequestLineEditorWrapper","method","path","currentSelectedMethod","setMethod","useState","currentInputValue","setInputValue","actionSetMethod","actionSetInputValue","event","target","value","onMethodChange","onPathChange","GET","args","render","POST","PUT","PATCH","DELETE"],"mappings":";AACA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SACCC,iBAAiB,QAEX,2BAAwB;AAE/B,MAAMC,OAAuC;IAC5CC,OAAO;IACPC,WAAWH;IACXI,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,SAASM,yBAAyB,EAAEC,MAAM,EAAEC,IAAI,EAA0B;IACzE,MAAM,CAACC,uBAAuBC,UAAU,GAAGb,MAAMc,QAAQ,CAACJ;IAC1D,MAAM,CAACK,mBAAmBC,cAAc,GAAGhB,MAAMc,QAAQ,CAACH;IAC1D,MAAMM,kBAAkB,CAACP;QACxBT,OAAO,aAAaS;QACpBG,UAAUH;IACX;IACA,MAAMQ,sBAAsB,CAACC;QAC5BlB,OAAO,aAAakB;QACpBH,cAAcG,MAAMC,MAAM,CAACC,KAAK;IACjC;IACA,qBACC,KAACnB;QACAQ,QAAQE;QACRU,gBAAgBL;QAChBN,MAAMI;QACNQ,cAAcL;;AAGjB;AAEA,OAAO,MAAMM,MAAa;IACzBC,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAME,OAAc;IAC1BF,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMG,MAAa;IACzBH,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMI,QAAe;IAC3BJ,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMK,SAAgB;IAC5BL,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface SegmentControlProps {
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
onValueChange?: (value: string) => void;
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
interface SegmentControlItemProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
declare const SegmentControlItem: ({ children, value }: SegmentControlItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const SegmentControl: ({ children, defaultValue, onValueChange, name, }: SegmentControlProps & {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { SegmentControl, SegmentControlItem };
|
|
16
|
+
//# sourceMappingURL=segment-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-control.d.ts","sourceRoot":"","sources":["../../../src/components/segment-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAWlE,MAAM,WAAW,mBAAmB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd;AAeD,QAAA,MAAM,kBAAkB,GAAI,qBAAqB,uBAAuB,4CAqBvE,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,kDAKrB,mBAAmB,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,4CAchD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
4
|
+
const SegmentControlContext = /*#__PURE__*/ createContext({});
|
|
5
|
+
const segmentControlItemClass = cn("flex", "items-center", "justify-center", "px-2", "py-0.5", "text-sm", "cursor-pointer", "rounded-2xl", "text-white/80", "peer-checked:bg-bg-primary", "peer-checked:text-text-secondary");
|
|
6
|
+
const SegmentControlItem = ({ children, value })=>{
|
|
7
|
+
const { defaultValue, onValueChange, name } = useContext(SegmentControlContext);
|
|
8
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
9
|
+
className: "relative",
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ _jsx("input", {
|
|
12
|
+
type: "radio",
|
|
13
|
+
id: `${name}-${value}`,
|
|
14
|
+
name: name,
|
|
15
|
+
value: value,
|
|
16
|
+
defaultChecked: value === defaultValue,
|
|
17
|
+
onChange: (e)=>onValueChange?.(e.target.value),
|
|
18
|
+
className: "sr-only peer"
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ _jsx("label", {
|
|
21
|
+
htmlFor: `${name}-${value}`,
|
|
22
|
+
className: segmentControlItemClass,
|
|
23
|
+
children: children
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const SegmentControl = ({ children, defaultValue, onValueChange, name })=>{
|
|
29
|
+
const contextValue = {
|
|
30
|
+
...defaultValue !== undefined && {
|
|
31
|
+
defaultValue
|
|
32
|
+
},
|
|
33
|
+
...onValueChange !== undefined && {
|
|
34
|
+
onValueChange
|
|
35
|
+
},
|
|
36
|
+
name: name || "react-components-segment-control"
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/ _jsx(SegmentControlContext.Provider, {
|
|
39
|
+
value: contextValue,
|
|
40
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
41
|
+
className: "inline-flex bg-gray-500 p-0.5 gap-0 rounded-full",
|
|
42
|
+
children: children
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export { SegmentControl, SegmentControlItem };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=segment-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/segment-control.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from \"react\";\nimport { cn } from \"#shadcn/lib/utils.js\";\n\ninterface SegmentControlContextType {\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\tname?: string;\n}\n\nconst SegmentControlContext = createContext<SegmentControlContextType>({});\n\nexport interface SegmentControlProps {\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\tname?: string;\n}\n\ninterface SegmentControlItemProps {\n\tchildren: ReactNode;\n\tvalue: string;\n}\nconst segmentControlItemClass = cn(\n\t\"flex\",\n\t\"items-center\",\n\t\"justify-center\",\n\t\"px-2\",\n\t\"py-0.5\",\n\t\"text-sm\",\n\t\"cursor-pointer\",\n\t\"rounded-2xl\",\n\t\"text-white/80\",\n\t\"peer-checked:bg-bg-primary\",\n\t\"peer-checked:text-text-secondary\",\n);\n\nconst SegmentControlItem = ({ children, value }: SegmentControlItemProps) => {\n\tconst { defaultValue, onValueChange, name } = useContext(\n\t\tSegmentControlContext,\n\t);\n\n\treturn (\n\t\t<div className=\"relative\">\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tid={`${name}-${value}`}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdefaultChecked={value === defaultValue}\n\t\t\t\tonChange={(e) => onValueChange?.(e.target.value)}\n\t\t\t\tclassName=\"sr-only peer\"\n\t\t\t/>\n\t\t\t<label htmlFor={`${name}-${value}`} className={segmentControlItemClass}>\n\t\t\t\t{children}\n\t\t\t</label>\n\t\t</div>\n\t);\n};\n\nconst SegmentControl = ({\n\tchildren,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n}: SegmentControlProps & { children?: ReactNode }) => {\n\tconst contextValue: SegmentControlContextType = {\n\t\t...(defaultValue !== undefined && { defaultValue }),\n\t\t...(onValueChange !== undefined && { onValueChange }),\n\t\tname: name || \"react-components-segment-control\",\n\t};\n\n\treturn (\n\t\t<SegmentControlContext.Provider value={contextValue}>\n\t\t\t<div className=\"inline-flex bg-gray-500 p-0.5 gap-0 rounded-full\">\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</SegmentControlContext.Provider>\n\t);\n};\n\nexport { SegmentControl, SegmentControlItem };\n"],"names":["createContext","useContext","cn","SegmentControlContext","segmentControlItemClass","SegmentControlItem","children","value","defaultValue","onValueChange","name","div","className","input","type","id","defaultChecked","onChange","e","target","label","htmlFor","SegmentControl","contextValue","undefined","Provider"],"mappings":";AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,QAAQ;AAClE,SAASC,EAAE,QAAQ,yBAAuB;AAQ1C,MAAMC,sCAAwBH,cAAyC,CAAC;AAYxE,MAAMI,0BAA0BF,GAC/B,QACA,gBACA,kBACA,QACA,UACA,WACA,kBACA,eACA,iBACA,8BACA;AAGD,MAAMG,qBAAqB,CAAC,EAAEC,QAAQ,EAAEC,KAAK,EAA2B;IACvE,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAEC,IAAI,EAAE,GAAGT,WAC7CE;IAGD,qBACC,MAACQ;QAAIC,WAAU;;0BACd,KAACC;gBACAC,MAAK;gBACLC,IAAI,GAAGL,KAAK,CAAC,EAAEH,OAAO;gBACtBG,MAAMA;gBACNH,OAAOA;gBACPS,gBAAgBT,UAAUC;gBAC1BS,UAAU,CAACC,IAAMT,gBAAgBS,EAAEC,MAAM,CAACZ,KAAK;gBAC/CK,WAAU;;0BAEX,KAACQ;gBAAMC,SAAS,GAAGX,KAAK,CAAC,EAAEH,OAAO;gBAAEK,WAAWR;0BAC7CE;;;;AAIL;AAEA,MAAMgB,iBAAiB,CAAC,EACvBhB,QAAQ,EACRE,YAAY,EACZC,aAAa,EACbC,IAAI,EAC4C;IAChD,MAAMa,eAA0C;QAC/C,GAAIf,iBAAiBgB,aAAa;YAAEhB;QAAa,CAAC;QAClD,GAAIC,kBAAkBe,aAAa;YAAEf;QAAc,CAAC;QACpDC,MAAMA,QAAQ;IACf;IAEA,qBACC,KAACP,sBAAsBsB,QAAQ;QAAClB,OAAOgB;kBACtC,cAAA,KAACZ;YAAIC,WAAU;sBACbN;;;AAIL;AAEA,SAASgB,cAAc,EAAEjB,kBAAkB,GAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ children, defaultValue, onValueChange, name, }: import("./segment-control").SegmentControlProps & {
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
tags: string[];
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Default: Story;
|
|
15
|
+
//# sourceMappingURL=segment-control.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-control.stories.d.ts","sourceRoot":"","sources":["../../../src/components/segment-control.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;gBAyBorB,CAAC;;;;;;CAlBxpB,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SegmentControl, SegmentControlItem } from "./segment-control.js";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Component/SegmentControl",
|
|
5
|
+
component: SegmentControl,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "centered"
|
|
8
|
+
},
|
|
9
|
+
tags: [
|
|
10
|
+
"autodocs"
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const Default = {
|
|
15
|
+
render: ()=>{
|
|
16
|
+
return /*#__PURE__*/ _jsxs(SegmentControl, {
|
|
17
|
+
defaultValue: "yaml",
|
|
18
|
+
onValueChange: (value)=>console.log("Selected:", value),
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ _jsx(SegmentControlItem, {
|
|
21
|
+
value: "yaml",
|
|
22
|
+
children: "YAML"
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ _jsx(SegmentControlItem, {
|
|
25
|
+
value: "json",
|
|
26
|
+
children: "JSON"
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=segment-control.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/segment-control.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\n\nimport { SegmentControl, SegmentControlItem } from \"./segment-control\";\n\nconst meta = {\n\ttitle: \"Component/SegmentControl\",\n\tcomponent: SegmentControl,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n} satisfies Meta<typeof SegmentControl>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n\trender: () => {\n\t\treturn (\n\t\t\t<SegmentControl\n\t\t\t\tdefaultValue=\"yaml\"\n\t\t\t\tonValueChange={(value) => console.log(\"Selected:\", value)}\n\t\t\t>\n\t\t\t\t<SegmentControlItem value=\"yaml\">YAML</SegmentControlItem>\n\t\t\t\t<SegmentControlItem value=\"json\">JSON</SegmentControlItem>\n\t\t\t</SegmentControl>\n\t\t);\n\t},\n};\n"],"names":["SegmentControl","SegmentControlItem","meta","title","component","parameters","layout","tags","Default","render","defaultValue","onValueChange","value","console","log"],"mappings":";AAEA,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,uBAAoB;AAEvE,MAAMC,OAAO;IACZC,OAAO;IACPC,WAAWJ;IACXK,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,OAAO,MAAMM,UAAiB;IAC7BC,QAAQ;QACP,qBACC,MAACT;YACAU,cAAa;YACbC,eAAe,CAACC,QAAUC,QAAQC,GAAG,CAAC,aAAaF;;8BAEnD,KAACX;oBAAmBW,OAAM;8BAAO;;8BACjC,KAACX;oBAAmBW,OAAM;8BAAO;;;;IAGpC;AACD,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,WAAW,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAE/D,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
3
|
+
const splitButtonStyles = cn("flex", "*:data-[slot=button]:rounded-r-none", "*:data-[slot=dropdown-menu-trigger]:px-1", "*:data-[slot=dropdown-menu-trigger]:py-2", "*:data-[slot=dropdown-menu-trigger]:rounded-l-none", "*:data-[slot=dropdown-menu-trigger]:border-l-0", "*:data-[slot=dropdown-menu-trigger]:border-l-0");
|
|
4
|
+
const SplitButton = ({ children })=>{
|
|
5
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
6
|
+
className: splitButtonStyles,
|
|
7
|
+
children: children
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export { SplitButton };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=split-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/split-button.tsx"],"sourcesContent":["import { cn } from \"#shadcn/lib/utils\";\n\nconst splitButtonStyles = cn(\n\t\"flex\",\n\t\"*:data-[slot=button]:rounded-r-none\",\n\t\"*:data-[slot=dropdown-menu-trigger]:px-1\",\n\t\"*:data-[slot=dropdown-menu-trigger]:py-2\",\n\t\"*:data-[slot=dropdown-menu-trigger]:rounded-l-none\",\n\t\"*:data-[slot=dropdown-menu-trigger]:border-l-0\",\n\t\"*:data-[slot=dropdown-menu-trigger]:border-l-0\",\n);\n\nconst SplitButton = ({ children }: { children: React.ReactNode }) => {\n\treturn <div className={splitButtonStyles}>{children}</div>;\n};\n\nexport { SplitButton };\n"],"names":["cn","splitButtonStyles","SplitButton","children","div","className"],"mappings":";AAAA,SAASA,EAAE,QAAQ,yBAAoB;AAEvC,MAAMC,oBAAoBD,GACzB,QACA,uCACA,4CACA,4CACA,sDACA,kDACA;AAGD,MAAME,cAAc,CAAC,EAAEC,QAAQ,EAAiC;IAC/D,qBAAO,KAACC;QAAIC,WAAWJ;kBAAoBE;;AAC5C;AAEA,SAASD,WAAW,GAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { SplitButton } from "./split-button";
|
|
3
|
+
declare const meta: Meta<typeof SplitButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SplitButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
//# sourceMappingURL=split-button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/split-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAGlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KA0BrB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, Plus, Save } from "lucide-react";
|
|
3
|
+
import { Button } from "../shadcn/components/ui/button.js";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../shadcn/components/ui/dropdown-menu.js";
|
|
5
|
+
import { SplitButton } from "./split-button.js";
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Component/SplitButton",
|
|
8
|
+
component: SplitButton
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
render: ()=>/*#__PURE__*/ _jsxs(SplitButton, {
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ _jsxs(Button, {
|
|
15
|
+
variant: "secondary",
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ _jsx(Save, {}),
|
|
18
|
+
"Save"
|
|
19
|
+
]
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ _jsxs(DropdownMenu, {
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ _jsx(DropdownMenuTrigger, {
|
|
24
|
+
asChild: true,
|
|
25
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
children: /*#__PURE__*/ _jsx(ChevronDown, {})
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ _jsxs(DropdownMenuContent, {
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx(DropdownMenuLabel, {
|
|
33
|
+
children: "Save to collection:"
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
|
|
36
|
+
/*#__PURE__*/ _jsx(DropdownMenuItem, {
|
|
37
|
+
disabled: true,
|
|
38
|
+
children: "No collections"
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
|
|
41
|
+
/*#__PURE__*/ _jsxs(DropdownMenuItem, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(Plus, {
|
|
44
|
+
className: "text-fg-link"
|
|
45
|
+
}),
|
|
46
|
+
"New collection"
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=split-button.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/split-button.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport { ChevronDown, Plus, Save } from \"lucide-react\";\nimport { Button } from \"#shadcn/components/ui/button.js\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuTrigger,\n} from \"#shadcn/components/ui/dropdown-menu.js\";\nimport { SplitButton } from \"./split-button\";\n\nconst meta: Meta<typeof SplitButton> = {\n\ttitle: \"Component/SplitButton\",\n\tcomponent: SplitButton,\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof SplitButton>;\n\nexport const Default: Story = {\n\trender: () => (\n\t\t<SplitButton>\n\t\t\t<Button variant=\"secondary\">\n\t\t\t\t<Save />\n\t\t\t\tSave\n\t\t\t</Button>\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button variant=\"secondary\">\n\t\t\t\t\t\t<ChevronDown />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent>\n\t\t\t\t\t<DropdownMenuLabel>Save to collection:</DropdownMenuLabel>\n\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t<DropdownMenuItem disabled>No collections</DropdownMenuItem>\n\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t<DropdownMenuItem>\n\t\t\t\t\t\t<Plus className=\"text-fg-link\" />\n\t\t\t\t\t\tNew collection\n\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t</SplitButton>\n\t),\n};\n"],"names":["ChevronDown","Plus","Save","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuTrigger","SplitButton","meta","title","component","Default","render","variant","asChild","disabled","className"],"mappings":";AACA,SAASA,WAAW,EAAEC,IAAI,EAAEC,IAAI,QAAQ,eAAe;AACvD,SAASC,MAAM,QAAQ,oCAAkC;AACzD,SACCC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,mBAAmB,QACb,2CAAyC;AAChD,SAASC,WAAW,QAAQ,oBAAiB;AAE7C,MAAMC,OAAiC;IACtCC,OAAO;IACPC,WAAWH;AACZ;AAEA,eAAeC,KAAK;AAIpB,OAAO,MAAMG,UAAiB;IAC7BC,QAAQ,kBACP,MAACL;;8BACA,MAACP;oBAAOa,SAAQ;;sCACf,KAACd;wBAAO;;;8BAGT,MAACE;;sCACA,KAACK;4BAAoBQ,OAAO;sCAC3B,cAAA,KAACd;gCAAOa,SAAQ;0CACf,cAAA,KAAChB;;;sCAGH,MAACK;;8CACA,KAACE;8CAAkB;;8CACnB,KAACC;8CACD,KAACF;oCAAiBY,QAAQ;8CAAC;;8CAC3B,KAACV;8CACD,MAACF;;sDACA,KAACL;4CAAKkB,WAAU;;wCAAiB;;;;;;;;;AAOvC,EAAE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ItemInstance, TreeInstance } from "@headless-tree/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface TreeViewItem<T> {
|
|
4
|
+
name: string;
|
|
5
|
+
children?: string[];
|
|
6
|
+
meta?: T;
|
|
7
|
+
}
|
|
8
|
+
declare function TreeView<T>({ rootItemId, items, selectedItemId, expandedItemIds, onSelectItem, customItemView, onRename, disableHover, zebra, horizontalLines, hideChevron, }: {
|
|
9
|
+
rootItemId: string;
|
|
10
|
+
selectedItemId?: string;
|
|
11
|
+
expandedItemIds?: string[];
|
|
12
|
+
onSelectItem?: (item: ItemInstance<TreeViewItem<T>>) => void;
|
|
13
|
+
items: Record<string, TreeViewItem<T>>;
|
|
14
|
+
customItemView?: (item: ItemInstance<TreeViewItem<T>>, tree: TreeInstance<TreeViewItem<T>>) => React.ReactNode;
|
|
15
|
+
onRename?: ((item: ItemInstance<TreeViewItem<T>>, value: string) => void) | undefined;
|
|
16
|
+
disableHover?: boolean;
|
|
17
|
+
zebra?: boolean;
|
|
18
|
+
horizontalLines?: boolean;
|
|
19
|
+
hideChevron?: boolean;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { TreeView, type TreeViewItem, type TreeInstance };
|
|
22
|
+
//# sourceMappingURL=tree-view.d.ts.map
|