@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
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { ItemInstance } from "@headless-tree/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Tooltip,
|
|
5
|
+
TooltipContent,
|
|
6
|
+
TooltipTrigger,
|
|
7
|
+
} from "#shadcn/components/ui/tooltip";
|
|
8
|
+
import { cn } from "#shadcn/lib/utils.js";
|
|
9
|
+
import * as CustomIcon from "../icons";
|
|
10
|
+
import { TreeView, type TreeViewItem } from "./tree-view";
|
|
11
|
+
|
|
12
|
+
type PackageSpec = {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Coordinate = {
|
|
18
|
+
id: string;
|
|
19
|
+
packageSpec: PackageSpec;
|
|
20
|
+
"package-spec": PackageSpec;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type FhirStructure = {
|
|
25
|
+
type?: string;
|
|
26
|
+
min?: string;
|
|
27
|
+
max?: string;
|
|
28
|
+
lastNode?: boolean;
|
|
29
|
+
isSummary?: boolean;
|
|
30
|
+
isModifier?: boolean;
|
|
31
|
+
mustSupport?: boolean;
|
|
32
|
+
datatype?: string;
|
|
33
|
+
short?: string;
|
|
34
|
+
desc?: string;
|
|
35
|
+
extensionUrl?: string;
|
|
36
|
+
extensionCoordinate?: Coordinate;
|
|
37
|
+
binding?: {
|
|
38
|
+
valueSet: string;
|
|
39
|
+
};
|
|
40
|
+
vsCoordinate?: Coordinate;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const FiledIcon = (item: ItemInstance<TreeViewItem<FhirStructure>>) => {
|
|
44
|
+
const filedType = item.getItemData()?.meta?.type;
|
|
45
|
+
|
|
46
|
+
switch (filedType) {
|
|
47
|
+
case "Resource":
|
|
48
|
+
return <CustomIcon.ResourceIcon />;
|
|
49
|
+
case "BackboneElement":
|
|
50
|
+
return <CustomIcon.BackoneElementIcon />;
|
|
51
|
+
case "Reference":
|
|
52
|
+
return <CustomIcon.ReferenceIcon />;
|
|
53
|
+
case "union":
|
|
54
|
+
return <CustomIcon.UnionIcon />;
|
|
55
|
+
case "instant":
|
|
56
|
+
case "time":
|
|
57
|
+
case "date":
|
|
58
|
+
case "dateTime":
|
|
59
|
+
case "decimal":
|
|
60
|
+
case "boolean":
|
|
61
|
+
case "integer":
|
|
62
|
+
case "string":
|
|
63
|
+
case "uri":
|
|
64
|
+
case "base64Binary":
|
|
65
|
+
case "code":
|
|
66
|
+
case "id":
|
|
67
|
+
case "oid":
|
|
68
|
+
case "unsignedInt":
|
|
69
|
+
case "positiveInt":
|
|
70
|
+
case "markdown":
|
|
71
|
+
case "url":
|
|
72
|
+
case "canonical":
|
|
73
|
+
case "uuid":
|
|
74
|
+
case "integer64":
|
|
75
|
+
return <CustomIcon.TypCodeIcon />;
|
|
76
|
+
default:
|
|
77
|
+
return <CustomIcon.ComplexTypeIcon />;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const customItemFieldNameClass = cn(
|
|
82
|
+
"flex",
|
|
83
|
+
"items-center",
|
|
84
|
+
"truncate",
|
|
85
|
+
"gap-2",
|
|
86
|
+
"min-w-[calc(260px-var(--tree-padding))]",
|
|
87
|
+
"w-[calc(260px-var(--tree-padding))]",
|
|
88
|
+
"in-data-[folder=true]:w-[calc(260px-var(--tree-padding))]",
|
|
89
|
+
"in-data-[folder=true]:min-w-[calc(260px-var(--tree-padding))]",
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const customItemView = (item: ItemInstance<TreeViewItem<FhirStructure>>) => {
|
|
93
|
+
const fieldName = item.getItemData()?.name;
|
|
94
|
+
const cardinalityMin = item.getItemData()?.meta?.min;
|
|
95
|
+
const cardinalityMax = item.getItemData()?.meta?.max;
|
|
96
|
+
const isSummary = item.getItemData()?.meta?.isSummary;
|
|
97
|
+
const isModifier = item.getItemData()?.meta?.isModifier;
|
|
98
|
+
const mustSupport = item.getItemData()?.meta?.mustSupport;
|
|
99
|
+
const datatype = item.getItemData()?.meta?.type;
|
|
100
|
+
const short = item.getItemData()?.meta?.short;
|
|
101
|
+
const desc = item.getItemData()?.meta?.desc;
|
|
102
|
+
const extensionUrl = item.getItemData()?.meta?.extensionUrl;
|
|
103
|
+
const extensionCoordinate = item.getItemData()?.meta?.extensionCoordinate;
|
|
104
|
+
const binding = item.getItemData()?.meta?.binding;
|
|
105
|
+
const vsCoordinate = item.getItemData()?.meta?.vsCoordinate;
|
|
106
|
+
return (
|
|
107
|
+
<div className="flex items-start gap-2">
|
|
108
|
+
<div className={customItemFieldNameClass}>
|
|
109
|
+
{FiledIcon(item)}
|
|
110
|
+
{fieldName}
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<div className="flex items-center gap-1 min-w-[60px] w-[60px]">
|
|
114
|
+
{mustSupport && (
|
|
115
|
+
<Tooltip>
|
|
116
|
+
<TooltipTrigger asChild>
|
|
117
|
+
<span className="px-[2px] max-h-[20px] text-white bg-red-600 rounded cursor-help">
|
|
118
|
+
S
|
|
119
|
+
</span>
|
|
120
|
+
</TooltipTrigger>
|
|
121
|
+
<TooltipContent>
|
|
122
|
+
<p>Must be supported</p>
|
|
123
|
+
</TooltipContent>
|
|
124
|
+
</Tooltip>
|
|
125
|
+
)}
|
|
126
|
+
{isSummary && (
|
|
127
|
+
<Tooltip>
|
|
128
|
+
<TooltipTrigger asChild>
|
|
129
|
+
<span className="px-[2px] max-h-[20px] cursor-help">Σ</span>
|
|
130
|
+
</TooltipTrigger>
|
|
131
|
+
<TooltipContent>
|
|
132
|
+
<p>Part of the summary set</p>
|
|
133
|
+
</TooltipContent>
|
|
134
|
+
</Tooltip>
|
|
135
|
+
)}
|
|
136
|
+
{isModifier && (
|
|
137
|
+
<Tooltip>
|
|
138
|
+
<TooltipTrigger asChild>
|
|
139
|
+
<span className="px-[2px] max-h-[20px] cursor-help">!?</span>
|
|
140
|
+
</TooltipTrigger>
|
|
141
|
+
<TooltipContent>
|
|
142
|
+
<p>Modifying element</p>
|
|
143
|
+
</TooltipContent>
|
|
144
|
+
</Tooltip>
|
|
145
|
+
)}
|
|
146
|
+
</div>
|
|
147
|
+
<div className="flex items-center gap-1 min-w-[50px] w-[50px] typo-code">
|
|
148
|
+
{cardinalityMin && cardinalityMax
|
|
149
|
+
? `${cardinalityMin}..${cardinalityMax}`
|
|
150
|
+
: ""}
|
|
151
|
+
</div>
|
|
152
|
+
<div className="flex gap-1 w-[200px] min-w-[200px]">
|
|
153
|
+
{datatype !== "union" && datatype}
|
|
154
|
+
</div>
|
|
155
|
+
<div className="text-left overflow-hidden">
|
|
156
|
+
{short && <div className="line-clamp-2">{short}</div>}
|
|
157
|
+
{!short && desc && <div className="line-clamp-2">{desc}</div>}
|
|
158
|
+
{extensionUrl && (
|
|
159
|
+
<div className="flex items-center gap-1">
|
|
160
|
+
<span>URL:</span>
|
|
161
|
+
{extensionCoordinate?.id ? (
|
|
162
|
+
<a
|
|
163
|
+
href={`#/ig/${extensionCoordinate?.["package-spec"]?.name || extensionCoordinate?.packageSpec?.name}#${extensionCoordinate?.["package-spec"]?.version || extensionCoordinate?.packageSpec?.version}/sd/${extensionCoordinate?.id}`}
|
|
164
|
+
className="font-medium hover:underline"
|
|
165
|
+
>
|
|
166
|
+
{extensionCoordinate?.label || extensionUrl}
|
|
167
|
+
</a>
|
|
168
|
+
) : (
|
|
169
|
+
<span className="font-medium">
|
|
170
|
+
{extensionCoordinate?.label || extensionUrl}
|
|
171
|
+
</span>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
)}
|
|
175
|
+
{binding && (
|
|
176
|
+
<div className="flex items-center gap-1">
|
|
177
|
+
<span>Binding:</span>
|
|
178
|
+
{vsCoordinate?.id ? (
|
|
179
|
+
<a
|
|
180
|
+
href={`#/ig/${vsCoordinate?.["package-spec"]?.name || vsCoordinate?.packageSpec?.name}#${vsCoordinate?.["package-spec"]?.version || vsCoordinate?.packageSpec?.version}/vs/${vsCoordinate?.id}`}
|
|
181
|
+
className="font-medium hover:underline"
|
|
182
|
+
>
|
|
183
|
+
{vsCoordinate?.label || binding?.valueSet || "Binding"}
|
|
184
|
+
</a>
|
|
185
|
+
) : (
|
|
186
|
+
<span className="font-medium">
|
|
187
|
+
{vsCoordinate?.label || binding?.valueSet || "Binding"}
|
|
188
|
+
</span>
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const FhirStructureView = ({
|
|
198
|
+
tree,
|
|
199
|
+
}: {
|
|
200
|
+
tree: Record<string, TreeViewItem<FhirStructure>>;
|
|
201
|
+
}) => {
|
|
202
|
+
const expandedItemIds = React.useMemo(() => {
|
|
203
|
+
return Object.keys(tree ?? {});
|
|
204
|
+
}, [tree]);
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div className="flex flex-col h-full">
|
|
208
|
+
<div className="flex items-center gap-2 font-semibold text-text-secondary border-b pb-2 bg-bg-primary sticky top-0 z-10">
|
|
209
|
+
<div className="min-w-[260px] w-[260px] ml-9">Name</div>
|
|
210
|
+
<div className="min-w-[60px] w-[60px]">Flags</div>
|
|
211
|
+
<div className="min-w-[50px] w-[50px]">Card.</div>
|
|
212
|
+
<div className="min-w-[200px] w-[200px]">Type</div>
|
|
213
|
+
<div className="min-w-[200px] w-[200px]">Description</div>
|
|
214
|
+
</div>
|
|
215
|
+
<div className="flex-1 overflow-auto">
|
|
216
|
+
<TreeView
|
|
217
|
+
hideChevron={true}
|
|
218
|
+
horizontalLines={true}
|
|
219
|
+
disableHover={true}
|
|
220
|
+
zebra={true}
|
|
221
|
+
rootItemId="root"
|
|
222
|
+
items={tree}
|
|
223
|
+
customItemView={customItemView}
|
|
224
|
+
expandedItemIds={expandedItemIds}
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export { FhirStructureView, type FhirStructure };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { PatientTable, type PatientTableProps } from "./patient-table";
|
|
3
|
+
|
|
4
|
+
// Интерфейс для Storybook контролов (расширяем основные пропсы)
|
|
5
|
+
interface PatientTableStoryProps extends PatientTableProps {
|
|
6
|
+
// Добавляем дополнительные контролы если нужно
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Компонент обертка для Stories (аналогично InputWithLabel)
|
|
10
|
+
function PatientTableWithStory({
|
|
11
|
+
page = 1,
|
|
12
|
+
count = 10,
|
|
13
|
+
showFilters = true,
|
|
14
|
+
showSorting = true,
|
|
15
|
+
enableColumnResizing = false,
|
|
16
|
+
enableColumnReordering = false,
|
|
17
|
+
enableColumnPinning = false,
|
|
18
|
+
showPinningMenu = true,
|
|
19
|
+
columnWidths,
|
|
20
|
+
columnConfigs,
|
|
21
|
+
}: PatientTableStoryProps) {
|
|
22
|
+
return (
|
|
23
|
+
<PatientTable
|
|
24
|
+
page={page}
|
|
25
|
+
count={count}
|
|
26
|
+
showFilters={showFilters}
|
|
27
|
+
showSorting={showSorting}
|
|
28
|
+
enableColumnResizing={enableColumnResizing}
|
|
29
|
+
enableColumnReordering={enableColumnReordering}
|
|
30
|
+
enableColumnPinning={enableColumnPinning}
|
|
31
|
+
showPinningMenu={showPinningMenu}
|
|
32
|
+
{...(columnWidths && { columnWidths })}
|
|
33
|
+
{...(columnConfigs && { columnConfigs })}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const meta = {
|
|
39
|
+
title: "Component/PatientTable",
|
|
40
|
+
component: PatientTableWithStory,
|
|
41
|
+
parameters: {
|
|
42
|
+
layout: "padded",
|
|
43
|
+
},
|
|
44
|
+
tags: ["autodocs"],
|
|
45
|
+
argTypes: {
|
|
46
|
+
page: { control: { type: "number", min: 1 } },
|
|
47
|
+
count: { control: { type: "number", min: 1, max: 100 } },
|
|
48
|
+
showFilters: { control: "boolean" },
|
|
49
|
+
showSorting: { control: "boolean" },
|
|
50
|
+
enableColumnResizing: { control: "boolean" },
|
|
51
|
+
enableColumnReordering: { control: "boolean" },
|
|
52
|
+
enableColumnPinning: { control: "boolean" },
|
|
53
|
+
showPinningMenu: { control: "boolean" },
|
|
54
|
+
columnWidths: { control: "object" },
|
|
55
|
+
columnConfigs: { control: "object" },
|
|
56
|
+
},
|
|
57
|
+
} satisfies Meta<typeof PatientTableWithStory>;
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
type Story = StoryObj<typeof meta>;
|
|
61
|
+
|
|
62
|
+
export const Default = {
|
|
63
|
+
args: {
|
|
64
|
+
page: 1,
|
|
65
|
+
count: 10,
|
|
66
|
+
showFilters: true,
|
|
67
|
+
showSorting: true,
|
|
68
|
+
enableColumnResizing: true,
|
|
69
|
+
},
|
|
70
|
+
} satisfies Story;
|
|
71
|
+
|
|
72
|
+
export const Aidbox = {
|
|
73
|
+
args: {
|
|
74
|
+
page: 1,
|
|
75
|
+
count: 10,
|
|
76
|
+
showFilters: true,
|
|
77
|
+
showSorting: true,
|
|
78
|
+
enableColumnResizing: true,
|
|
79
|
+
enableColumnReordering: true,
|
|
80
|
+
enableColumnPinning: true,
|
|
81
|
+
showPinningMenu: true,
|
|
82
|
+
columnConfigs: [
|
|
83
|
+
{ key: "firstName", label: "First Name", width: "160px" },
|
|
84
|
+
{ key: "lastName", label: "Last Name", width: "150px" },
|
|
85
|
+
{ key: "id", label: "Patient ID", width: "160px", type: "code" },
|
|
86
|
+
{ key: "birthDate", label: "Birth Date", width: "150px" },
|
|
87
|
+
{ key: "phoneNumber", label: "Phone Number", width: "200px" },
|
|
88
|
+
{ key: "email", label: "Email Address", width: "250px" },
|
|
89
|
+
{ key: "gender", label: "Gender", width: "120px" },
|
|
90
|
+
{ key: "street", label: "Street", width: "200px" },
|
|
91
|
+
{ key: "city", label: "City", width: "120px" },
|
|
92
|
+
{ key: "state", label: "State", width: "120px" },
|
|
93
|
+
{ key: "zip", label: "ZIP", width: "120px" },
|
|
94
|
+
{ key: "encounters", label: "Visits", width: "110px", rightAlign: true },
|
|
95
|
+
{
|
|
96
|
+
key: "actions",
|
|
97
|
+
label: "Actions",
|
|
98
|
+
width: "90px",
|
|
99
|
+
fixed: true,
|
|
100
|
+
type: "button",
|
|
101
|
+
actions: [
|
|
102
|
+
{
|
|
103
|
+
label: "Match",
|
|
104
|
+
onClick: (id) => console.log("Match patient:", id),
|
|
105
|
+
variant: "secondary",
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
} satisfies Story;
|