@health-samurai/react-components 0.0.0-alpha.5 → 0.0.0-alpha.7

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.
Files changed (146) hide show
  1. package/dist/bundle.css +318 -31
  2. package/dist/src/components/button-dropdown.d.ts +10 -0
  3. package/dist/src/components/button-dropdown.d.ts.map +1 -0
  4. package/dist/src/components/button-dropdown.js +70 -0
  5. package/dist/src/components/button-dropdown.js.map +1 -0
  6. package/dist/src/components/button-dropdown.stories.d.ts +11 -0
  7. package/dist/src/components/button-dropdown.stories.d.ts.map +1 -0
  8. package/dist/src/components/button-dropdown.stories.js +48 -0
  9. package/dist/src/components/button-dropdown.stories.js.map +1 -0
  10. package/dist/src/components/code-editor/index.d.ts +3 -2
  11. package/dist/src/components/code-editor/index.d.ts.map +1 -1
  12. package/dist/src/components/code-editor/index.js +152 -4
  13. package/dist/src/components/code-editor/index.js.map +1 -1
  14. package/dist/src/components/code-editor.stories.d.ts +1 -0
  15. package/dist/src/components/code-editor.stories.d.ts.map +1 -1
  16. package/dist/src/components/code-editor.stories.js +252 -1
  17. package/dist/src/components/code-editor.stories.js.map +1 -1
  18. package/dist/src/components/copy-icon.d.ts +5 -1
  19. package/dist/src/components/copy-icon.d.ts.map +1 -1
  20. package/dist/src/components/copy-icon.js +41 -3
  21. package/dist/src/components/copy-icon.js.map +1 -1
  22. package/dist/src/components/data-table.d.ts +9 -0
  23. package/dist/src/components/data-table.d.ts.map +1 -0
  24. package/dist/src/components/data-table.js +66 -0
  25. package/dist/src/components/data-table.js.map +1 -0
  26. package/dist/src/components/data-table.stories.d.ts +7 -0
  27. package/dist/src/components/data-table.stories.d.ts.map +1 -0
  28. package/dist/src/components/data-table.stories.js +240 -0
  29. package/dist/src/components/data-table.stories.js.map +1 -0
  30. package/dist/src/components/fhir-structure-view.d.ts +34 -0
  31. package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
  32. package/dist/src/components/fhir-structure-view.js +226 -0
  33. package/dist/src/components/fhir-structure-view.js.map +1 -0
  34. package/dist/src/components/fhir-structure-view.stories.d.ts +7 -0
  35. package/dist/src/components/fhir-structure-view.stories.d.ts.map +1 -0
  36. package/dist/src/components/fhir-structure-view.stories.js +447 -0
  37. package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
  38. package/dist/src/components/request-line-editor.d.ts +3 -1
  39. package/dist/src/components/request-line-editor.d.ts.map +1 -1
  40. package/dist/src/components/request-line-editor.js +26 -5
  41. package/dist/src/components/request-line-editor.js.map +1 -1
  42. package/dist/src/components/segment-control.d.ts +16 -0
  43. package/dist/src/components/segment-control.d.ts.map +1 -0
  44. package/dist/src/components/segment-control.js +48 -0
  45. package/dist/src/components/segment-control.js.map +1 -0
  46. package/dist/src/components/segment-control.stories.d.ts +15 -0
  47. package/dist/src/components/segment-control.stories.d.ts.map +1 -0
  48. package/dist/src/components/segment-control.stories.js +33 -0
  49. package/dist/src/components/segment-control.stories.js.map +1 -0
  50. package/dist/src/components/split-button.d.ts +5 -0
  51. package/dist/src/components/split-button.d.ts.map +1 -0
  52. package/dist/src/components/split-button.js +12 -0
  53. package/dist/src/components/split-button.js.map +1 -0
  54. package/dist/src/components/split-button.stories.d.ts +7 -0
  55. package/dist/src/components/split-button.stories.d.ts.map +1 -0
  56. package/dist/src/components/split-button.stories.js +57 -0
  57. package/dist/src/components/split-button.stories.js.map +1 -0
  58. package/dist/src/components/tree-view.d.ts +16 -7
  59. package/dist/src/components/tree-view.d.ts.map +1 -1
  60. package/dist/src/components/tree-view.js +75 -19
  61. package/dist/src/components/tree-view.js.map +1 -1
  62. package/dist/src/components/tree-view.stories.d.ts +3 -3
  63. package/dist/src/components/tree-view.stories.d.ts.map +1 -1
  64. package/dist/src/components/tree-view.stories.js +14 -5
  65. package/dist/src/components/tree-view.stories.js.map +1 -1
  66. package/dist/src/icons.d.ts +6 -0
  67. package/dist/src/icons.d.ts.map +1 -1
  68. package/dist/src/icons.js +235 -3
  69. package/dist/src/icons.js.map +1 -1
  70. package/dist/src/index.d.ts +10 -0
  71. package/dist/src/index.d.ts.map +1 -1
  72. package/dist/src/index.js +10 -0
  73. package/dist/src/index.js.map +1 -1
  74. package/dist/src/shadcn/components/ui/alert-dialog.d.ts +3 -1
  75. package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
  76. package/dist/src/shadcn/components/ui/alert-dialog.js +5 -2
  77. package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
  78. package/dist/src/shadcn/components/ui/badge.d.ts +1 -1
  79. package/dist/src/shadcn/components/ui/card.d.ts +5 -1
  80. package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
  81. package/dist/src/shadcn/components/ui/card.js +21 -8
  82. package/dist/src/shadcn/components/ui/card.js.map +1 -1
  83. package/dist/src/shadcn/components/ui/card.stories.d.ts +302 -1
  84. package/dist/src/shadcn/components/ui/card.stories.d.ts.map +1 -1
  85. package/dist/src/shadcn/components/ui/card.stories.js +23 -2
  86. package/dist/src/shadcn/components/ui/card.stories.js.map +1 -1
  87. package/dist/src/shadcn/components/ui/combobox.d.ts +13 -0
  88. package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -1
  89. package/dist/src/shadcn/components/ui/combobox.js +102 -0
  90. package/dist/src/shadcn/components/ui/combobox.js.map +1 -1
  91. package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
  92. package/dist/src/shadcn/components/ui/dropdown-menu.js +1 -1
  93. package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
  94. package/dist/src/shadcn/components/ui/input.d.ts +3 -1
  95. package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
  96. package/dist/src/shadcn/components/ui/input.js +39 -1
  97. package/dist/src/shadcn/components/ui/input.js.map +1 -1
  98. package/dist/src/shadcn/components/ui/pagination.d.ts +8 -1
  99. package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
  100. package/dist/src/shadcn/components/ui/pagination.js +36 -19
  101. package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
  102. package/dist/src/shadcn/components/ui/pagination.stories.d.ts.map +1 -1
  103. package/dist/src/shadcn/components/ui/pagination.stories.js +44 -37
  104. package/dist/src/shadcn/components/ui/pagination.stories.js.map +1 -1
  105. package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
  106. package/dist/src/shadcn/components/ui/table.js +1 -1
  107. package/dist/src/shadcn/components/ui/table.js.map +1 -1
  108. package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
  109. package/dist/src/shadcn/components/ui/tabs.js +1 -0
  110. package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
  111. package/dist/src/shadcn/components/ui/tree.d.ts +10 -2
  112. package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -1
  113. package/dist/src/shadcn/components/ui/tree.js +31 -8
  114. package/dist/src/shadcn/components/ui/tree.js.map +1 -1
  115. package/dist/src/typography.css +36 -8
  116. package/package.json +5 -1
  117. package/src/components/button-dropdown.stories.tsx +41 -0
  118. package/src/components/button-dropdown.tsx +95 -0
  119. package/src/components/code-editor/index.tsx +129 -4
  120. package/src/components/code-editor.stories.tsx +294 -0
  121. package/src/components/copy-icon.tsx +57 -3
  122. package/src/components/data-table.stories.tsx +89 -0
  123. package/src/components/data-table.tsx +120 -0
  124. package/src/components/fhir-structure-view.stories.tsx +439 -0
  125. package/src/components/fhir-structure-view.tsx +229 -0
  126. package/src/components/request-line-editor.tsx +30 -4
  127. package/src/components/segment-control.stories.tsx +29 -0
  128. package/src/components/segment-control.tsx +81 -0
  129. package/src/components/split-button.stories.tsx +49 -0
  130. package/src/components/split-button.tsx +17 -0
  131. package/src/components/tree-view.stories.tsx +20 -15
  132. package/src/components/tree-view.tsx +118 -15
  133. package/src/icons.tsx +245 -3
  134. package/src/index.tsx +10 -2
  135. package/src/shadcn/components/ui/alert-dialog.tsx +6 -2
  136. package/src/shadcn/components/ui/card.stories.tsx +17 -3
  137. package/src/shadcn/components/ui/card.tsx +52 -8
  138. package/src/shadcn/components/ui/combobox.tsx +127 -0
  139. package/src/shadcn/components/ui/dropdown-menu.tsx +1 -2
  140. package/src/shadcn/components/ui/input.tsx +119 -0
  141. package/src/shadcn/components/ui/pagination.stories.tsx +8 -2
  142. package/src/shadcn/components/ui/pagination.tsx +54 -3
  143. package/src/shadcn/components/ui/table.tsx +6 -1
  144. package/src/shadcn/components/ui/tabs.tsx +1 -0
  145. package/src/shadcn/components/ui/tree.tsx +63 -10
  146. package/src/typography.css +36 -8
@@ -0,0 +1,447 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FhirStructureView } from "./fhir-structure-view.js";
3
+ const meta = {
4
+ title: "Component/FHIRStructureView",
5
+ component: FhirStructureView
6
+ };
7
+ export default meta;
8
+ const tree = {
9
+ root: {
10
+ name: "Root",
11
+ children: [
12
+ "Patient"
13
+ ]
14
+ },
15
+ Patient: {
16
+ name: "Patient",
17
+ meta: {
18
+ type: "Resource",
19
+ min: "0",
20
+ max: "*",
21
+ desc: "Information about an individual or animal receiving health care services"
22
+ },
23
+ children: [
24
+ "Patient.id",
25
+ "Patient.meta",
26
+ "Patient.implicitRules",
27
+ "Patient.language",
28
+ "Patient.text",
29
+ "Patient.contained",
30
+ "Patient.extension",
31
+ "Patient.modifierExtension",
32
+ "Patient.identifier",
33
+ "Patient.active",
34
+ "Patient.name",
35
+ "Patient.telecom",
36
+ "Patient.gender",
37
+ "Patient.birthDate",
38
+ "Patient.deceased",
39
+ "Patient.address",
40
+ "Patient.maritalStatus",
41
+ "Patient.multipleBirth",
42
+ "Patient.photo",
43
+ "Patient.contact",
44
+ "Patient.communication",
45
+ "Patient.generalPractitioner",
46
+ "Patient.managingOrganization",
47
+ "Patient.link"
48
+ ]
49
+ },
50
+ "Patient.id": {
51
+ name: "id",
52
+ meta: {
53
+ type: "id",
54
+ min: "0",
55
+ max: "1",
56
+ isSummary: true,
57
+ desc: "Logical id of this artifact"
58
+ }
59
+ },
60
+ "Patient.meta": {
61
+ name: "meta",
62
+ meta: {
63
+ type: "Meta",
64
+ min: "0",
65
+ max: "1",
66
+ isSummary: true,
67
+ desc: "Metadata about the resource"
68
+ }
69
+ },
70
+ "Patient.implicitRules": {
71
+ name: "implicitRules",
72
+ meta: {
73
+ type: "uri",
74
+ min: "0",
75
+ max: "1",
76
+ isSummary: true,
77
+ isModifier: true,
78
+ desc: "A set of rules under which this content was created"
79
+ }
80
+ },
81
+ "Patient.language": {
82
+ name: "language",
83
+ meta: {
84
+ type: "code",
85
+ min: "0",
86
+ max: "1",
87
+ desc: "Language of the resource content"
88
+ }
89
+ },
90
+ "Patient.text": {
91
+ name: "text",
92
+ meta: {
93
+ type: "Narrative",
94
+ min: "0",
95
+ max: "1",
96
+ desc: "Text summary of the resource, for human interpretation"
97
+ }
98
+ },
99
+ "Patient.contained": {
100
+ name: "contained",
101
+ meta: {
102
+ type: "Resource",
103
+ min: "0",
104
+ max: "*",
105
+ desc: "Contained, inline Resources"
106
+ }
107
+ },
108
+ "Patient.extension": {
109
+ name: "extension",
110
+ meta: {
111
+ type: "Extension",
112
+ min: "0",
113
+ max: "*",
114
+ desc: "Additional content defined by implementations"
115
+ }
116
+ },
117
+ "Patient.modifierExtension": {
118
+ name: "modifierExtension",
119
+ meta: {
120
+ type: "Extension",
121
+ min: "0",
122
+ max: "*",
123
+ isSummary: true,
124
+ isModifier: true,
125
+ desc: "Extensions that cannot be ignored"
126
+ }
127
+ },
128
+ "Patient.identifier": {
129
+ name: "identifier",
130
+ meta: {
131
+ type: "Identifier",
132
+ min: "0",
133
+ max: "*",
134
+ isSummary: true,
135
+ desc: "An identifier for this patient"
136
+ }
137
+ },
138
+ "Patient.active": {
139
+ name: "active",
140
+ meta: {
141
+ type: "boolean",
142
+ min: "0",
143
+ max: "1",
144
+ isSummary: true,
145
+ isModifier: true,
146
+ desc: "Whether this patient's record is in active use"
147
+ }
148
+ },
149
+ "Patient.name": {
150
+ name: "name",
151
+ meta: {
152
+ type: "HumanName",
153
+ min: "0",
154
+ max: "*",
155
+ isSummary: true,
156
+ desc: "A name associated with the patient"
157
+ }
158
+ },
159
+ "Patient.telecom": {
160
+ name: "telecom",
161
+ meta: {
162
+ type: "ContactPoint",
163
+ min: "0",
164
+ max: "*",
165
+ isSummary: true,
166
+ desc: "A contact detail for the individual"
167
+ }
168
+ },
169
+ "Patient.gender": {
170
+ name: "gender",
171
+ meta: {
172
+ type: "code",
173
+ min: "0",
174
+ max: "1",
175
+ isSummary: true,
176
+ desc: "male | female | other | unknown"
177
+ }
178
+ },
179
+ "Patient.birthDate": {
180
+ name: "birthDate",
181
+ meta: {
182
+ type: "date",
183
+ min: "0",
184
+ max: "1",
185
+ isSummary: true,
186
+ desc: "The date of birth for the individual"
187
+ }
188
+ },
189
+ "Patient.deceased": {
190
+ name: "deceased[x]",
191
+ meta: {
192
+ type: "union",
193
+ min: "0",
194
+ max: "1",
195
+ isSummary: true,
196
+ isModifier: true,
197
+ desc: "Indicates if the individual is deceased or not"
198
+ },
199
+ children: [
200
+ "Patient.deceasedBoolean",
201
+ "Patient.deceasedDateTime"
202
+ ]
203
+ },
204
+ "Patient.deceasedBoolean": {
205
+ name: "deceasedBoolean",
206
+ meta: {
207
+ type: "boolean"
208
+ }
209
+ },
210
+ "Patient.deceasedDateTime": {
211
+ name: "deceasedDateTime",
212
+ meta: {
213
+ type: "dateTime",
214
+ lastNode: true
215
+ }
216
+ },
217
+ "Patient.address": {
218
+ name: "address",
219
+ meta: {
220
+ type: "Address",
221
+ min: "0",
222
+ max: "*",
223
+ isSummary: true,
224
+ desc: "An address for the individual"
225
+ }
226
+ },
227
+ "Patient.maritalStatus": {
228
+ name: "maritalStatus",
229
+ meta: {
230
+ type: "CodeableConcept",
231
+ min: "0",
232
+ max: "1",
233
+ desc: "Marital (civil) status of a patient"
234
+ }
235
+ },
236
+ "Patient.multipleBirth": {
237
+ name: "multipleBirth[x]",
238
+ meta: {
239
+ type: "union",
240
+ min: "0",
241
+ max: "1",
242
+ desc: "Whether patient is part of a multiple birth"
243
+ },
244
+ children: [
245
+ "Patient.multipleBirthBoolean",
246
+ "Patient.multipleBirthInteger"
247
+ ]
248
+ },
249
+ "Patient.multipleBirthBoolean": {
250
+ name: "multipleBirthBoolean",
251
+ meta: {
252
+ type: "boolean"
253
+ }
254
+ },
255
+ "Patient.multipleBirthInteger": {
256
+ name: "multipleBirthInteger",
257
+ meta: {
258
+ type: "integer",
259
+ lastNode: true
260
+ }
261
+ },
262
+ "Patient.photo": {
263
+ name: "photo",
264
+ meta: {
265
+ type: "Attachment",
266
+ min: "0",
267
+ max: "*",
268
+ desc: "Image of the patient"
269
+ }
270
+ },
271
+ "Patient.contact": {
272
+ name: "contact",
273
+ meta: {
274
+ type: "BackboneElement",
275
+ min: "0",
276
+ max: "*",
277
+ desc: "A contact party (e.g. guardian, partner, friend) for the patient"
278
+ },
279
+ children: [
280
+ "Patient.contact.relationship",
281
+ "Patient.contact.name",
282
+ "Patient.contact.telecom",
283
+ "Patient.contact.address",
284
+ "Patient.contact.gender",
285
+ "Patient.contact.organization",
286
+ "Patient.contact.period"
287
+ ]
288
+ },
289
+ "Patient.contact.relationship": {
290
+ name: "relationship",
291
+ meta: {
292
+ type: "CodeableConcept",
293
+ min: "0",
294
+ max: "*",
295
+ desc: "The kind of relationship"
296
+ }
297
+ },
298
+ "Patient.contact.name": {
299
+ name: "name",
300
+ meta: {
301
+ type: "HumanName",
302
+ min: "0",
303
+ max: "1",
304
+ desc: "A name associated with the contact person"
305
+ }
306
+ },
307
+ "Patient.contact.telecom": {
308
+ name: "telecom",
309
+ meta: {
310
+ type: "ContactPoint",
311
+ min: "0",
312
+ max: "*",
313
+ desc: "A contact detail for the person"
314
+ }
315
+ },
316
+ "Patient.contact.address": {
317
+ name: "address",
318
+ meta: {
319
+ type: "Address",
320
+ min: "0",
321
+ max: "1",
322
+ desc: "Address for the contact person"
323
+ }
324
+ },
325
+ "Patient.contact.gender": {
326
+ name: "gender",
327
+ meta: {
328
+ type: "code",
329
+ min: "0",
330
+ max: "1",
331
+ desc: "male | female | other | unknown"
332
+ }
333
+ },
334
+ "Patient.contact.organization": {
335
+ name: "organization",
336
+ meta: {
337
+ type: "Reference",
338
+ min: "0",
339
+ max: "1",
340
+ desc: "Organization that is associated with the contact"
341
+ }
342
+ },
343
+ "Patient.contact.period": {
344
+ name: "period",
345
+ meta: {
346
+ type: "Period",
347
+ min: "0",
348
+ max: "1",
349
+ lastNode: true,
350
+ desc: "The period during which this contact person or organization is valid to be contacted relating to this patient"
351
+ }
352
+ },
353
+ "Patient.communication": {
354
+ name: "communication",
355
+ meta: {
356
+ type: "BackboneElement",
357
+ min: "0",
358
+ max: "*",
359
+ desc: "A language which may be used to communicate with the patient about his or her health"
360
+ },
361
+ children: [
362
+ "Patient.communication.language",
363
+ "Patient.communication.preferred"
364
+ ]
365
+ },
366
+ "Patient.communication.language": {
367
+ name: "language",
368
+ meta: {
369
+ type: "CodeableConcept",
370
+ min: "1",
371
+ max: "1",
372
+ desc: "The language which can be used to communicate with the patient about his or her health"
373
+ }
374
+ },
375
+ "Patient.communication.preferred": {
376
+ name: "preferred",
377
+ meta: {
378
+ type: "boolean",
379
+ min: "0",
380
+ max: "1",
381
+ lastNode: true,
382
+ desc: "Language preference indicator"
383
+ }
384
+ },
385
+ "Patient.generalPractitioner": {
386
+ name: "generalPractitioner",
387
+ meta: {
388
+ type: "Reference",
389
+ min: "0",
390
+ max: "*",
391
+ desc: "Patient's nominated primary care provider"
392
+ }
393
+ },
394
+ "Patient.managingOrganization": {
395
+ name: "managingOrganization",
396
+ meta: {
397
+ type: "Reference",
398
+ min: "0",
399
+ max: "1",
400
+ isSummary: true,
401
+ desc: "Organization that is the custodian of the patient record"
402
+ }
403
+ },
404
+ "Patient.link": {
405
+ name: "link",
406
+ meta: {
407
+ type: "BackboneElement",
408
+ min: "0",
409
+ max: "*",
410
+ isSummary: true,
411
+ isModifier: true,
412
+ desc: "Link to a Patient or RelatedPerson resource that concerns the same actual individual"
413
+ },
414
+ children: [
415
+ "Patient.link.other",
416
+ "Patient.link.type"
417
+ ]
418
+ },
419
+ "Patient.link.other": {
420
+ name: "other",
421
+ meta: {
422
+ type: "Reference",
423
+ min: "1",
424
+ max: "1",
425
+ isSummary: true,
426
+ desc: "The other patient or related person resource that the link refers to"
427
+ }
428
+ },
429
+ "Patient.link.type": {
430
+ name: "type",
431
+ meta: {
432
+ type: "code",
433
+ min: "1",
434
+ max: "1",
435
+ isSummary: true,
436
+ lastNode: true,
437
+ desc: "replaced-by | replaces | refer | seealso"
438
+ }
439
+ }
440
+ };
441
+ export const Default = {
442
+ render: ()=>/*#__PURE__*/ _jsx(FhirStructureView, {
443
+ tree: tree
444
+ })
445
+ };
446
+
447
+ //# sourceMappingURL=fhir-structure-view.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/fhir-structure-view.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport { type FhirStructure, FhirStructureView } from \"./fhir-structure-view\";\nimport type { TreeViewItem } from \"./tree-view\";\n\nconst meta: Meta<typeof FhirStructureView> = {\n\ttitle: \"Component/FHIRStructureView\",\n\tcomponent: FhirStructureView,\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof FhirStructureView>;\n\nconst tree: Record<string, TreeViewItem<FhirStructure>> = {\n\troot: {\n\t\tname: \"Root\",\n\t\tchildren: [\"Patient\"],\n\t},\n\tPatient: {\n\t\tname: \"Patient\",\n\t\tmeta: {\n\t\t\ttype: \"Resource\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"Information about an individual or animal receiving health care services\",\n\t\t},\n\t\tchildren: [\n\t\t\t\"Patient.id\",\n\t\t\t\"Patient.meta\",\n\t\t\t\"Patient.implicitRules\",\n\t\t\t\"Patient.language\",\n\t\t\t\"Patient.text\",\n\t\t\t\"Patient.contained\",\n\t\t\t\"Patient.extension\",\n\t\t\t\"Patient.modifierExtension\",\n\t\t\t\"Patient.identifier\",\n\t\t\t\"Patient.active\",\n\t\t\t\"Patient.name\",\n\t\t\t\"Patient.telecom\",\n\t\t\t\"Patient.gender\",\n\t\t\t\"Patient.birthDate\",\n\t\t\t\"Patient.deceased\",\n\t\t\t\"Patient.address\",\n\t\t\t\"Patient.maritalStatus\",\n\t\t\t\"Patient.multipleBirth\",\n\t\t\t\"Patient.photo\",\n\t\t\t\"Patient.contact\",\n\t\t\t\"Patient.communication\",\n\t\t\t\"Patient.generalPractitioner\",\n\t\t\t\"Patient.managingOrganization\",\n\t\t\t\"Patient.link\",\n\t\t],\n\t},\n\t\"Patient.id\": {\n\t\tname: \"id\",\n\t\tmeta: {\n\t\t\ttype: \"id\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"Logical id of this artifact\",\n\t\t},\n\t},\n\t\"Patient.meta\": {\n\t\tname: \"meta\",\n\t\tmeta: {\n\t\t\ttype: \"Meta\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"Metadata about the resource\",\n\t\t},\n\t},\n\t\"Patient.implicitRules\": {\n\t\tname: \"implicitRules\",\n\t\tmeta: {\n\t\t\ttype: \"uri\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tisModifier: true,\n\t\t\tdesc: \"A set of rules under which this content was created\",\n\t\t},\n\t},\n\t\"Patient.language\": {\n\t\tname: \"language\",\n\t\tmeta: {\n\t\t\ttype: \"code\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Language of the resource content\",\n\t\t},\n\t},\n\t\"Patient.text\": {\n\t\tname: \"text\",\n\t\tmeta: {\n\t\t\ttype: \"Narrative\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Text summary of the resource, for human interpretation\",\n\t\t},\n\t},\n\t\"Patient.contained\": {\n\t\tname: \"contained\",\n\t\tmeta: {\n\t\t\ttype: \"Resource\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"Contained, inline Resources\",\n\t\t},\n\t},\n\t\"Patient.extension\": {\n\t\tname: \"extension\",\n\t\tmeta: {\n\t\t\ttype: \"Extension\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"Additional content defined by implementations\",\n\t\t},\n\t},\n\t\"Patient.modifierExtension\": {\n\t\tname: \"modifierExtension\",\n\t\tmeta: {\n\t\t\ttype: \"Extension\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tisModifier: true,\n\t\t\tdesc: \"Extensions that cannot be ignored\",\n\t\t},\n\t},\n\t\"Patient.identifier\": {\n\t\tname: \"identifier\",\n\t\tmeta: {\n\t\t\ttype: \"Identifier\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"An identifier for this patient\",\n\t\t},\n\t},\n\t\"Patient.active\": {\n\t\tname: \"active\",\n\t\tmeta: {\n\t\t\ttype: \"boolean\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tisModifier: true,\n\t\t\tdesc: \"Whether this patient's record is in active use\",\n\t\t},\n\t},\n\t\"Patient.name\": {\n\t\tname: \"name\",\n\t\tmeta: {\n\t\t\ttype: \"HumanName\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"A name associated with the patient\",\n\t\t},\n\t},\n\t\"Patient.telecom\": {\n\t\tname: \"telecom\",\n\t\tmeta: {\n\t\t\ttype: \"ContactPoint\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"A contact detail for the individual\",\n\t\t},\n\t},\n\t\"Patient.gender\": {\n\t\tname: \"gender\",\n\t\tmeta: {\n\t\t\ttype: \"code\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"male | female | other | unknown\",\n\t\t},\n\t},\n\t\"Patient.birthDate\": {\n\t\tname: \"birthDate\",\n\t\tmeta: {\n\t\t\ttype: \"date\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"The date of birth for the individual\",\n\t\t},\n\t},\n\t\"Patient.deceased\": {\n\t\tname: \"deceased[x]\",\n\t\tmeta: {\n\t\t\ttype: \"union\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tisModifier: true,\n\t\t\tdesc: \"Indicates if the individual is deceased or not\",\n\t\t},\n\t\tchildren: [\"Patient.deceasedBoolean\", \"Patient.deceasedDateTime\"],\n\t},\n\t\"Patient.deceasedBoolean\": {\n\t\tname: \"deceasedBoolean\",\n\t\tmeta: {\n\t\t\ttype: \"boolean\",\n\t\t},\n\t},\n\t\"Patient.deceasedDateTime\": {\n\t\tname: \"deceasedDateTime\",\n\t\tmeta: {\n\t\t\ttype: \"dateTime\",\n\t\t\tlastNode: true,\n\t\t},\n\t},\n\t\"Patient.address\": {\n\t\tname: \"address\",\n\t\tmeta: {\n\t\t\ttype: \"Address\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"An address for the individual\",\n\t\t},\n\t},\n\t\"Patient.maritalStatus\": {\n\t\tname: \"maritalStatus\",\n\t\tmeta: {\n\t\t\ttype: \"CodeableConcept\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Marital (civil) status of a patient\",\n\t\t},\n\t},\n\t\"Patient.multipleBirth\": {\n\t\tname: \"multipleBirth[x]\",\n\t\tmeta: {\n\t\t\ttype: \"union\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Whether patient is part of a multiple birth\",\n\t\t},\n\t\tchildren: [\"Patient.multipleBirthBoolean\", \"Patient.multipleBirthInteger\"],\n\t},\n\t\"Patient.multipleBirthBoolean\": {\n\t\tname: \"multipleBirthBoolean\",\n\t\tmeta: {\n\t\t\ttype: \"boolean\",\n\t\t},\n\t},\n\t\"Patient.multipleBirthInteger\": {\n\t\tname: \"multipleBirthInteger\",\n\t\tmeta: {\n\t\t\ttype: \"integer\",\n\t\t\tlastNode: true,\n\t\t},\n\t},\n\t\"Patient.photo\": {\n\t\tname: \"photo\",\n\t\tmeta: {\n\t\t\ttype: \"Attachment\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"Image of the patient\",\n\t\t},\n\t},\n\t\"Patient.contact\": {\n\t\tname: \"contact\",\n\t\tmeta: {\n\t\t\ttype: \"BackboneElement\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"A contact party (e.g. guardian, partner, friend) for the patient\",\n\t\t},\n\t\tchildren: [\n\t\t\t\"Patient.contact.relationship\",\n\t\t\t\"Patient.contact.name\",\n\t\t\t\"Patient.contact.telecom\",\n\t\t\t\"Patient.contact.address\",\n\t\t\t\"Patient.contact.gender\",\n\t\t\t\"Patient.contact.organization\",\n\t\t\t\"Patient.contact.period\",\n\t\t],\n\t},\n\t\"Patient.contact.relationship\": {\n\t\tname: \"relationship\",\n\t\tmeta: {\n\t\t\ttype: \"CodeableConcept\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"The kind of relationship\",\n\t\t},\n\t},\n\t\"Patient.contact.name\": {\n\t\tname: \"name\",\n\t\tmeta: {\n\t\t\ttype: \"HumanName\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"A name associated with the contact person\",\n\t\t},\n\t},\n\t\"Patient.contact.telecom\": {\n\t\tname: \"telecom\",\n\t\tmeta: {\n\t\t\ttype: \"ContactPoint\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"A contact detail for the person\",\n\t\t},\n\t},\n\t\"Patient.contact.address\": {\n\t\tname: \"address\",\n\t\tmeta: {\n\t\t\ttype: \"Address\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Address for the contact person\",\n\t\t},\n\t},\n\t\"Patient.contact.gender\": {\n\t\tname: \"gender\",\n\t\tmeta: {\n\t\t\ttype: \"code\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"male | female | other | unknown\",\n\t\t},\n\t},\n\t\"Patient.contact.organization\": {\n\t\tname: \"organization\",\n\t\tmeta: {\n\t\t\ttype: \"Reference\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"Organization that is associated with the contact\",\n\t\t},\n\t},\n\t\"Patient.contact.period\": {\n\t\tname: \"period\",\n\t\tmeta: {\n\t\t\ttype: \"Period\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tlastNode: true,\n\t\t\tdesc: \"The period during which this contact person or organization is valid to be contacted relating to this patient\",\n\t\t},\n\t},\n\t\"Patient.communication\": {\n\t\tname: \"communication\",\n\t\tmeta: {\n\t\t\ttype: \"BackboneElement\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"A language which may be used to communicate with the patient about his or her health\",\n\t\t},\n\t\tchildren: [\n\t\t\t\"Patient.communication.language\",\n\t\t\t\"Patient.communication.preferred\",\n\t\t],\n\t},\n\t\"Patient.communication.language\": {\n\t\tname: \"language\",\n\t\tmeta: {\n\t\t\ttype: \"CodeableConcept\",\n\t\t\tmin: \"1\",\n\t\t\tmax: \"1\",\n\t\t\tdesc: \"The language which can be used to communicate with the patient about his or her health\",\n\t\t},\n\t},\n\t\"Patient.communication.preferred\": {\n\t\tname: \"preferred\",\n\t\tmeta: {\n\t\t\ttype: \"boolean\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tlastNode: true,\n\t\t\tdesc: \"Language preference indicator\",\n\t\t},\n\t},\n\t\"Patient.generalPractitioner\": {\n\t\tname: \"generalPractitioner\",\n\t\tmeta: {\n\t\t\ttype: \"Reference\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tdesc: \"Patient's nominated primary care provider\",\n\t\t},\n\t},\n\t\"Patient.managingOrganization\": {\n\t\tname: \"managingOrganization\",\n\t\tmeta: {\n\t\t\ttype: \"Reference\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"Organization that is the custodian of the patient record\",\n\t\t},\n\t},\n\t\"Patient.link\": {\n\t\tname: \"link\",\n\t\tmeta: {\n\t\t\ttype: \"BackboneElement\",\n\t\t\tmin: \"0\",\n\t\t\tmax: \"*\",\n\t\t\tisSummary: true,\n\t\t\tisModifier: true,\n\t\t\tdesc: \"Link to a Patient or RelatedPerson resource that concerns the same actual individual\",\n\t\t},\n\t\tchildren: [\"Patient.link.other\", \"Patient.link.type\"],\n\t},\n\t\"Patient.link.other\": {\n\t\tname: \"other\",\n\t\tmeta: {\n\t\t\ttype: \"Reference\",\n\t\t\tmin: \"1\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tdesc: \"The other patient or related person resource that the link refers to\",\n\t\t},\n\t},\n\t\"Patient.link.type\": {\n\t\tname: \"type\",\n\t\tmeta: {\n\t\t\ttype: \"code\",\n\t\t\tmin: \"1\",\n\t\t\tmax: \"1\",\n\t\t\tisSummary: true,\n\t\t\tlastNode: true,\n\t\t\tdesc: \"replaced-by | replaces | refer | seealso\",\n\t\t},\n\t},\n};\n\nexport const Default: Story = {\n\trender: () => <FhirStructureView tree={tree} />,\n};\n"],"names":["FhirStructureView","meta","title","component","tree","root","name","children","Patient","type","min","max","desc","isSummary","isModifier","lastNode","Default","render"],"mappings":";AACA,SAA6BA,iBAAiB,QAAQ,2BAAwB;AAG9E,MAAMC,OAAuC;IAC5CC,OAAO;IACPC,WAAWH;AACZ;AAEA,eAAeC,KAAK;AAIpB,MAAMG,OAAoD;IACzDC,MAAM;QACLC,MAAM;QACNC,UAAU;YAAC;SAAU;IACtB;IACAC,SAAS;QACRF,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,MAAM;QACP;QACAL,UAAU;YACT;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACA;IACF;IACA,cAAc;QACbD,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLE,WAAW;YACXD,MAAM;QACP;IACD;IACA,gBAAgB;QACfN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLE,WAAW;YACXD,MAAM;QACP;IACD;IACA,yBAAyB;QACxBN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLE,WAAW;YACXC,YAAY;YACZF,MAAM;QACP;IACD;IACA,oBAAoB;QACnBN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,MAAM;QACP;IACD;IACA,gBAAgB;QACfN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,MAAM;QACP;IACD;IACA,qBAAqB;QACpBN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,MAAM;QACP;IACD;IACA,qBAAqB;QACpBN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,MAAM;QACP;IACD;IACA,6BAA6B;QAC5BN,MAAM;QACNL,MAAM;YACLQ,MAAM;YACNC,KAAK;YACLC,KAAK;YACLE,WAAW;YACXC,YAAY;YACZF,MAAM;QACP;IACD;IACA,sBAAsB;QACrBN,MAAM;QACNL,MAAM;YACLQ,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"}
@@ -4,11 +4,13 @@ declare const requestMethodVariants: (props?: ({
4
4
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
5
  type RequestLineEditorProps = {
6
6
  method: string;
7
+ placeholder?: string;
8
+ autoFocus?: boolean;
7
9
  onMethodChange: (newMethod: string) => void;
8
10
  path?: string | undefined;
9
11
  onPathChange?: React.ChangeEventHandler<HTMLInputElement>;
10
12
  className?: string;
11
13
  };
12
- declare function RequestLineEditor({ className, method, onMethodChange, path, onPathChange, }: RequestLineEditorProps): import("react/jsx-runtime").JSX.Element;
14
+ declare function RequestLineEditor({ className, method, onMethodChange, path, placeholder, autoFocus, onPathChange, }: RequestLineEditorProps): import("react/jsx-runtime").JSX.Element;
13
15
  export { RequestLineEditor, type RequestLineEditorProps, requestMethodVariants, };
14
16
  //# sourceMappingURL=request-line-editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-line-editor.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAepC,QAAA,MAAM,qBAAqB;;8EAqB1B,CAAC;AA4CF,KAAK,sBAAsB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EAC1B,SAAS,EACT,MAAM,EACN,cAAc,EACd,IAAI,EACJ,YAAY,GACZ,EAAE,sBAAsB,2CAYxB;AAED,OAAO,EACN,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,CAAC"}
1
+ {"version":3,"file":"request-line-editor.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAgBpC,QAAA,MAAM,qBAAqB;;8EAqB1B,CAAC;AAyCF,KAAK,sBAAsB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EAC1B,SAAS,EACT,MAAM,EACN,cAAc,EACd,IAAI,EACJ,WAAW,EACX,SAAS,EACT,YAAY,GACZ,EAAE,sBAAsB,2CAoCxB;AAED,OAAO,EACN,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cva } from "class-variance-authority";
3
+ import { toast } from "sonner";
3
4
  import { Input } from "../shadcn/components/ui/input.js";
4
5
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../shadcn/components/ui/select.js";
5
6
  import { cn } from "../shadcn/lib/utils.js";
@@ -27,9 +28,6 @@ function isKnownMethod(candidate) {
27
28
  return methods.includes(candidate);
28
29
  }
29
30
  function RequestMethodSelector({ value, onValueChange }) {
30
- console.log(value);
31
- console.log(requestMethodVariants());
32
- console.log(requestMethodVariants(undefined));
33
31
  return /*#__PURE__*/ _jsxs(Select, {
34
32
  value: value,
35
33
  ...onValueChange ? {
@@ -58,7 +56,7 @@ function RequestMethodSelector({ value, onValueChange }) {
58
56
  ]
59
57
  });
60
58
  }
61
- function RequestLineEditor({ className, method, onMethodChange, path, onPathChange }) {
59
+ function RequestLineEditor({ className, method, onMethodChange, path, placeholder, autoFocus, onPathChange }) {
62
60
  return /*#__PURE__*/ _jsxs("div", {
63
61
  className: cn("flex", className),
64
62
  children: [
@@ -69,8 +67,31 @@ function RequestLineEditor({ className, method, onMethodChange, path, onPathChan
69
67
  /*#__PURE__*/ _jsx(Input, {
70
68
  className: "rounded-l-none",
71
69
  value: path,
70
+ autoFocus: autoFocus,
71
+ placeholder: placeholder,
72
72
  rightSlot: /*#__PURE__*/ _jsx(CopyIcon, {
73
- text: `${method} ${path}`
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
+ }
74
95
  }),
75
96
  ...onPathChange !== undefined ? {
76
97
  onChange: onPathChange
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/request-line-editor.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport 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\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\tconsole.log(value);\n\tconsole.log(requestMethodVariants());\n\tconsole.log(requestMethodVariants(undefined));\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\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\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\trightSlot={<CopyIcon text={`${method} ${path}`} />}\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","Input","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","cn","CopyIcon","METHODS","requestMethodVariants","variants","method","GET","POST","PUT","PATCH","DELETE","isKnownMethod","candidate","methods","includes","RequestMethodSelector","value","onValueChange","console","log","undefined","className","map","span","RequestLineEditor","onMethodChange","path","onPathChange","div","rightSlot","text","onChange"],"mappings":";AAAA,SAASA,GAAG,QAAQ,2BAA2B;AAE/C,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,wBAAwBV,IAC7BO,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;IAC5BC,QAAQC,GAAG,CAACH;IACZE,QAAQC,GAAG,CAAChB;IACZe,QAAQC,GAAG,CAAChB,sBAAsBiB;IAClC,qBACC,MAACzB;QACAqB,OAAOA;QACN,GAAIC,gBAAgB;YAAEA,eAAeA;QAAc,IAAI,CAAC,CAAC;;0BAE1D,KAACnB;gBACAuB,WAAWlB,sBACVQ,cAAcK,SAAS;oBAAEX,QAAQW;gBAAM,IAAII;0BAG5C,cAAA,KAACrB;8BAAaiB;;;0BAEf,KAACpB;0BACCM,QAAQoB,GAAG,CAAC,CAACjB,uBACb,KAACR;wBAAwBmB,OAAOX;kCAC/B,cAAA,KAACkB;4BAAKF,WAAWlB,sBAAsB;gCAAEE,QAAQA;4BAAO;sCACtDA;;uBAFcA;;;;AAStB;AAUA,SAASmB,kBAAkB,EAC1BH,SAAS,EACThB,MAAM,EACNoB,cAAc,EACdC,IAAI,EACJC,YAAY,EACY;IACxB,qBACC,MAACC;QAAIP,WAAWrB,GAAG,QAAQqB;;0BAC1B,KAACN;gBAAsBC,OAAOX;gBAAQY,eAAeQ;;0BACrD,KAAC/B;gBACA2B,WAAU;gBACVL,OAAOU;gBACPG,yBAAW,KAAC5B;oBAAS6B,MAAM,GAAGzB,OAAO,CAAC,EAAEqB,MAAM;;gBAC7C,GAAIC,iBAAiBP,YAAY;oBAAEW,UAAUJ;gBAAa,IAAI,CAAC,CAAC;;;;AAIrE;AAEA,SACCH,iBAAiB,EAEjBrB,qBAAqB,GACpB"}
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"}
@@ -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;AAgBD,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", "select-none");
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