@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
|
@@ -18,13 +18,9 @@ const meta: Meta<typeof RequestLineEditor> = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof RequestLineEditor>;
|
|
20
20
|
|
|
21
|
-
function RequestLineEditorWrapper({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
inputValue,
|
|
25
|
-
}: RequestLineEditorProps) {
|
|
26
|
-
const [currentSelectedMethod, setMethod] = React.useState(selectedMethod);
|
|
27
|
-
const [currentInputValue, setInputValue] = React.useState(inputValue);
|
|
21
|
+
function RequestLineEditorWrapper({ method, path }: RequestLineEditorProps) {
|
|
22
|
+
const [currentSelectedMethod, setMethod] = React.useState(method);
|
|
23
|
+
const [currentInputValue, setInputValue] = React.useState(path);
|
|
28
24
|
const actionSetMethod = (method: string) => {
|
|
29
25
|
action("setMethod")(method);
|
|
30
26
|
setMethod(method);
|
|
@@ -35,56 +31,50 @@ function RequestLineEditorWrapper({
|
|
|
35
31
|
};
|
|
36
32
|
return (
|
|
37
33
|
<RequestLineEditor
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onInputChange={actionSetInputValue}
|
|
34
|
+
method={currentSelectedMethod}
|
|
35
|
+
onMethodChange={actionSetMethod}
|
|
36
|
+
path={currentInputValue}
|
|
37
|
+
onPathChange={actionSetInputValue}
|
|
43
38
|
/>
|
|
44
39
|
);
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
export const GET: Story = {
|
|
48
43
|
args: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
inputValue: "/fhir/Patient",
|
|
44
|
+
method: "GET",
|
|
45
|
+
path: "/fhir/Patient",
|
|
52
46
|
},
|
|
53
47
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
54
48
|
};
|
|
55
49
|
|
|
56
50
|
export const POST: Story = {
|
|
57
51
|
args: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
inputValue: "/fhir/Patient",
|
|
52
|
+
method: "POST",
|
|
53
|
+
path: "/fhir/Patient",
|
|
61
54
|
},
|
|
62
55
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
63
56
|
};
|
|
64
57
|
|
|
65
58
|
export const PUT: Story = {
|
|
66
59
|
args: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
inputValue: "/fhir/Patient",
|
|
60
|
+
method: "PUT",
|
|
61
|
+
path: "/fhir/Patient",
|
|
70
62
|
},
|
|
71
63
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
72
64
|
};
|
|
73
65
|
|
|
74
66
|
export const PATCH: Story = {
|
|
75
67
|
args: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
inputValue: "/fhir/Patient",
|
|
68
|
+
method: "PATCH",
|
|
69
|
+
path: "/fhir/Patient",
|
|
79
70
|
},
|
|
80
71
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
81
72
|
};
|
|
82
73
|
|
|
83
74
|
export const DELETE: Story = {
|
|
84
75
|
args: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
inputValue: "/fhir/Patient",
|
|
76
|
+
method: "DELETE",
|
|
77
|
+
path: "/fhir/Patient",
|
|
88
78
|
},
|
|
89
79
|
render: (args) => <RequestLineEditorWrapper {...args} />,
|
|
90
80
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
1
2
|
import type * as React from "react";
|
|
3
|
+
import { toast } from "sonner";
|
|
2
4
|
import { Input } from "#shadcn/components/ui/input";
|
|
3
5
|
import {
|
|
4
6
|
Select,
|
|
@@ -10,63 +12,63 @@ import {
|
|
|
10
12
|
import { cn } from "#shadcn/lib/utils";
|
|
11
13
|
import { CopyIcon } from "./copy-icon";
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
setMethod: (value: string) => void;
|
|
16
|
-
methods: string[];
|
|
17
|
-
inputValue?: string | undefined;
|
|
18
|
-
onInputChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
19
|
-
}
|
|
15
|
+
const METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"] as const;
|
|
16
|
+
type RequestMethod = (typeof METHODS)[number];
|
|
20
17
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
border: "border-violet-400! hover:border-violet-400 ring-violet-200!",
|
|
42
|
-
},
|
|
43
|
-
DELETE: {
|
|
44
|
-
text: "text-red-600 [&_svg]:text-red-600!",
|
|
45
|
-
background: "bg-red-200",
|
|
46
|
-
border: "border-red-300! hover:border-red-300 ring-red-200!",
|
|
18
|
+
const requestMethodVariants = cva<{ method: { [K in RequestMethod]: string } }>(
|
|
19
|
+
cn(
|
|
20
|
+
"border-r-0",
|
|
21
|
+
"rounded-r-none",
|
|
22
|
+
"shadow-none",
|
|
23
|
+
"typo-label",
|
|
24
|
+
"text-left",
|
|
25
|
+
"items-center",
|
|
26
|
+
"w-26",
|
|
27
|
+
),
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
method: {
|
|
31
|
+
GET: "text-utility-green [&_svg]:text-utility-green",
|
|
32
|
+
POST: "text-utility-yellow [&_svg]:text-utility-yellow",
|
|
33
|
+
PUT: "text-utility-blue [&_svg]:text-utility-blue ",
|
|
34
|
+
PATCH: "text-utility-violet [&_svg]:text-utility-violet",
|
|
35
|
+
DELETE: "text-utility-red [&_svg]:text-utility-red",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
47
38
|
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
type RequestMethodSelectorProps = {
|
|
42
|
+
value: string;
|
|
43
|
+
onValueChange?: (newMethod: string) => void;
|
|
48
44
|
};
|
|
49
45
|
|
|
46
|
+
function isKnownMethod(candidate: string): candidate is RequestMethod {
|
|
47
|
+
const methods: readonly string[] = METHODS;
|
|
48
|
+
return methods.includes(candidate);
|
|
49
|
+
}
|
|
50
|
+
|
|
50
51
|
function RequestMethodSelector({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}: RequestLineEditorProps) {
|
|
52
|
+
value,
|
|
53
|
+
onValueChange,
|
|
54
|
+
}: RequestMethodSelectorProps) {
|
|
55
55
|
return (
|
|
56
|
-
<Select
|
|
56
|
+
<Select
|
|
57
|
+
value={value}
|
|
58
|
+
{...(onValueChange ? { onValueChange: onValueChange } : {})}
|
|
59
|
+
>
|
|
57
60
|
<SelectTrigger
|
|
58
|
-
className={
|
|
61
|
+
className={requestMethodVariants(
|
|
62
|
+
isKnownMethod(value) ? { method: value } : undefined,
|
|
63
|
+
)}
|
|
59
64
|
>
|
|
60
|
-
<SelectValue
|
|
65
|
+
<SelectValue>{value}</SelectValue>
|
|
61
66
|
</SelectTrigger>
|
|
62
67
|
<SelectContent>
|
|
63
|
-
{
|
|
68
|
+
{METHODS.map((method) => (
|
|
64
69
|
<SelectItem key={method} value={method}>
|
|
65
|
-
<span
|
|
66
|
-
|
|
67
|
-
>
|
|
68
|
-
{" "}
|
|
69
|
-
{method}{" "}
|
|
70
|
+
<span className={requestMethodVariants({ method: method })}>
|
|
71
|
+
{method}
|
|
70
72
|
</span>
|
|
71
73
|
</SelectItem>
|
|
72
74
|
))}
|
|
@@ -75,29 +77,64 @@ function RequestMethodSelector({
|
|
|
75
77
|
);
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
type RequestLineEditorProps = {
|
|
81
|
+
method: string;
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
autoFocus?: boolean;
|
|
84
|
+
onMethodChange: (newMethod: string) => void;
|
|
85
|
+
path?: string | undefined;
|
|
86
|
+
onPathChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
87
|
+
className?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
78
90
|
function RequestLineEditor({
|
|
79
91
|
className,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
method,
|
|
93
|
+
onMethodChange,
|
|
94
|
+
path,
|
|
95
|
+
placeholder,
|
|
96
|
+
autoFocus,
|
|
97
|
+
onPathChange,
|
|
85
98
|
}: RequestLineEditorProps) {
|
|
86
99
|
return (
|
|
87
100
|
<div className={cn("flex", className)}>
|
|
88
|
-
<RequestMethodSelector
|
|
89
|
-
selectedMethod={selectedMethod}
|
|
90
|
-
setMethod={setMethod}
|
|
91
|
-
methods={methods}
|
|
92
|
-
/>
|
|
101
|
+
<RequestMethodSelector value={method} onValueChange={onMethodChange} />
|
|
93
102
|
<Input
|
|
94
|
-
className=
|
|
95
|
-
value={
|
|
96
|
-
|
|
97
|
-
{
|
|
103
|
+
className="rounded-l-none"
|
|
104
|
+
value={path}
|
|
105
|
+
autoFocus={autoFocus}
|
|
106
|
+
placeholder={placeholder}
|
|
107
|
+
rightSlot={
|
|
108
|
+
<CopyIcon
|
|
109
|
+
text={`${method} ${path}`}
|
|
110
|
+
tooltipText="Copy request line"
|
|
111
|
+
showToast={false}
|
|
112
|
+
onCopy={(text) => {
|
|
113
|
+
// Custom toast for request line
|
|
114
|
+
const truncatedText =
|
|
115
|
+
text.length > 30 ? `${text.slice(0, 30)}...` : text;
|
|
116
|
+
toast(
|
|
117
|
+
<div className="flex flex-col gap-1">
|
|
118
|
+
<span className="typo-body">Request line copied</span>
|
|
119
|
+
<span className="typo-code text-text-secondary">
|
|
120
|
+
{truncatedText}
|
|
121
|
+
</span>
|
|
122
|
+
</div>,
|
|
123
|
+
{
|
|
124
|
+
duration: 2000,
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
}
|
|
130
|
+
{...(onPathChange !== undefined ? { onChange: onPathChange } : {})}
|
|
98
131
|
/>
|
|
99
132
|
</div>
|
|
100
133
|
);
|
|
101
134
|
}
|
|
102
135
|
|
|
103
|
-
export {
|
|
136
|
+
export {
|
|
137
|
+
RequestLineEditor,
|
|
138
|
+
type RequestLineEditorProps,
|
|
139
|
+
requestMethodVariants,
|
|
140
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
|
|
3
|
+
import { SegmentControl, SegmentControlItem } from "./segment-control";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Component/SegmentControl",
|
|
7
|
+
component: SegmentControl,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
} satisfies Meta<typeof SegmentControl>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
return (
|
|
20
|
+
<SegmentControl
|
|
21
|
+
defaultValue="yaml"
|
|
22
|
+
onValueChange={(value) => console.log("Selected:", value)}
|
|
23
|
+
>
|
|
24
|
+
<SegmentControlItem value="yaml">YAML</SegmentControlItem>
|
|
25
|
+
<SegmentControlItem value="json">JSON</SegmentControlItem>
|
|
26
|
+
</SegmentControl>
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createContext, type ReactNode, useContext } from "react";
|
|
2
|
+
import { cn } from "#shadcn/lib/utils.js";
|
|
3
|
+
|
|
4
|
+
interface SegmentControlContextType {
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
onValueChange?: (value: string) => void;
|
|
7
|
+
name?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const SegmentControlContext = createContext<SegmentControlContextType>({});
|
|
11
|
+
|
|
12
|
+
export interface SegmentControlProps {
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
onValueChange?: (value: string) => void;
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface SegmentControlItemProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
const segmentControlItemClass = cn(
|
|
23
|
+
"flex",
|
|
24
|
+
"items-center",
|
|
25
|
+
"justify-center",
|
|
26
|
+
"px-2",
|
|
27
|
+
"py-0.5",
|
|
28
|
+
"text-sm",
|
|
29
|
+
"cursor-pointer",
|
|
30
|
+
"rounded-2xl",
|
|
31
|
+
"text-white/80",
|
|
32
|
+
"peer-checked:bg-bg-primary",
|
|
33
|
+
"peer-checked:text-text-secondary",
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const SegmentControlItem = ({ children, value }: SegmentControlItemProps) => {
|
|
37
|
+
const { defaultValue, onValueChange, name } = useContext(
|
|
38
|
+
SegmentControlContext,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="relative">
|
|
43
|
+
<input
|
|
44
|
+
type="radio"
|
|
45
|
+
id={`${name}-${value}`}
|
|
46
|
+
name={name}
|
|
47
|
+
value={value}
|
|
48
|
+
defaultChecked={value === defaultValue}
|
|
49
|
+
onChange={(e) => onValueChange?.(e.target.value)}
|
|
50
|
+
className="sr-only peer"
|
|
51
|
+
/>
|
|
52
|
+
<label htmlFor={`${name}-${value}`} className={segmentControlItemClass}>
|
|
53
|
+
{children}
|
|
54
|
+
</label>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const SegmentControl = ({
|
|
60
|
+
children,
|
|
61
|
+
defaultValue,
|
|
62
|
+
onValueChange,
|
|
63
|
+
name,
|
|
64
|
+
}: SegmentControlProps & { children?: ReactNode }) => {
|
|
65
|
+
const contextValue: SegmentControlContextType = {
|
|
66
|
+
...(defaultValue !== undefined && { defaultValue }),
|
|
67
|
+
...(onValueChange !== undefined && { onValueChange }),
|
|
68
|
+
name: name || "react-components-segment-control",
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<SegmentControlContext.Provider value={contextValue}>
|
|
73
|
+
<div className="inline-flex bg-gray-500 p-0.5 gap-0 rounded-full">
|
|
74
|
+
{children}
|
|
75
|
+
</div>
|
|
76
|
+
</SegmentControlContext.Provider>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { SegmentControl, SegmentControlItem };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ChevronDown, Plus, Save } from "lucide-react";
|
|
3
|
+
import { Button } from "#shadcn/components/ui/button.js";
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuLabel,
|
|
9
|
+
DropdownMenuSeparator,
|
|
10
|
+
DropdownMenuTrigger,
|
|
11
|
+
} from "#shadcn/components/ui/dropdown-menu.js";
|
|
12
|
+
import { SplitButton } from "./split-button";
|
|
13
|
+
|
|
14
|
+
const meta: Meta<typeof SplitButton> = {
|
|
15
|
+
title: "Component/SplitButton",
|
|
16
|
+
component: SplitButton,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof SplitButton>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: () => (
|
|
25
|
+
<SplitButton>
|
|
26
|
+
<Button variant="secondary">
|
|
27
|
+
<Save />
|
|
28
|
+
Save
|
|
29
|
+
</Button>
|
|
30
|
+
<DropdownMenu>
|
|
31
|
+
<DropdownMenuTrigger asChild>
|
|
32
|
+
<Button variant="secondary">
|
|
33
|
+
<ChevronDown />
|
|
34
|
+
</Button>
|
|
35
|
+
</DropdownMenuTrigger>
|
|
36
|
+
<DropdownMenuContent>
|
|
37
|
+
<DropdownMenuLabel>Save to collection:</DropdownMenuLabel>
|
|
38
|
+
<DropdownMenuSeparator />
|
|
39
|
+
<DropdownMenuItem disabled>No collections</DropdownMenuItem>
|
|
40
|
+
<DropdownMenuSeparator />
|
|
41
|
+
<DropdownMenuItem>
|
|
42
|
+
<Plus className="text-fg-link" />
|
|
43
|
+
New collection
|
|
44
|
+
</DropdownMenuItem>
|
|
45
|
+
</DropdownMenuContent>
|
|
46
|
+
</DropdownMenu>
|
|
47
|
+
</SplitButton>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "#shadcn/lib/utils";
|
|
2
|
+
|
|
3
|
+
const splitButtonStyles = cn(
|
|
4
|
+
"flex",
|
|
5
|
+
"*:data-[slot=button]:rounded-r-none",
|
|
6
|
+
"*:data-[slot=dropdown-menu-trigger]:px-1",
|
|
7
|
+
"*:data-[slot=dropdown-menu-trigger]:py-2",
|
|
8
|
+
"*:data-[slot=dropdown-menu-trigger]:rounded-l-none",
|
|
9
|
+
"*:data-[slot=dropdown-menu-trigger]:border-l-0",
|
|
10
|
+
"*:data-[slot=dropdown-menu-trigger]:border-l-0",
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const SplitButton = ({ children }: { children: React.ReactNode }) => {
|
|
14
|
+
return <div className={splitButtonStyles}>{children}</div>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { SplitButton };
|