sh-ui-cli 0.14.0 → 0.21.0

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 (162) hide show
  1. package/bin/sh-ui.mjs +6 -0
  2. package/data/changelog/versions.json +354 -0
  3. package/data/registry/flutter/foundation/sh_ui_tokens.dart +385 -0
  4. package/data/registry/flutter/registry.json +336 -0
  5. package/data/registry/flutter/widgets/sh_ui_accordion.dart +255 -0
  6. package/data/registry/flutter/widgets/sh_ui_app_shell.dart +267 -0
  7. package/data/registry/flutter/widgets/sh_ui_avatar.dart +95 -0
  8. package/data/registry/flutter/widgets/sh_ui_badge.dart +82 -0
  9. package/data/registry/flutter/widgets/sh_ui_breadcrumb.dart +107 -0
  10. package/data/registry/flutter/widgets/sh_ui_button.dart +201 -0
  11. package/data/registry/flutter/widgets/sh_ui_card.dart +159 -0
  12. package/data/registry/flutter/widgets/sh_ui_carousel.dart +204 -0
  13. package/data/registry/flutter/widgets/sh_ui_checkbox.dart +154 -0
  14. package/data/registry/flutter/widgets/sh_ui_color_picker.dart +264 -0
  15. package/data/registry/flutter/widgets/sh_ui_combobox.dart +614 -0
  16. package/data/registry/flutter/widgets/sh_ui_context_menu.dart +71 -0
  17. package/data/registry/flutter/widgets/sh_ui_date_picker.dart +648 -0
  18. package/data/registry/flutter/widgets/sh_ui_dialog.dart +567 -0
  19. package/data/registry/flutter/widgets/sh_ui_dropdown_menu.dart +251 -0
  20. package/data/registry/flutter/widgets/sh_ui_file_upload.dart +200 -0
  21. package/data/registry/flutter/widgets/sh_ui_header.dart +488 -0
  22. package/data/registry/flutter/widgets/sh_ui_input.dart +664 -0
  23. package/data/registry/flutter/widgets/sh_ui_label.dart +145 -0
  24. package/data/registry/flutter/widgets/sh_ui_menubar.dart +98 -0
  25. package/data/registry/flutter/widgets/sh_ui_pagination.dart +276 -0
  26. package/data/registry/flutter/widgets/sh_ui_popover.dart +248 -0
  27. package/data/registry/flutter/widgets/sh_ui_progress.dart +47 -0
  28. package/data/registry/flutter/widgets/sh_ui_radio.dart +108 -0
  29. package/data/registry/flutter/widgets/sh_ui_select.dart +904 -0
  30. package/data/registry/flutter/widgets/sh_ui_separator.dart +42 -0
  31. package/data/registry/flutter/widgets/sh_ui_sidebar.dart +1116 -0
  32. package/data/registry/flutter/widgets/sh_ui_skeleton.dart +129 -0
  33. package/data/registry/flutter/widgets/sh_ui_slider.dart +147 -0
  34. package/data/registry/flutter/widgets/sh_ui_spinner.dart +56 -0
  35. package/data/registry/flutter/widgets/sh_ui_switch.dart +109 -0
  36. package/data/registry/flutter/widgets/sh_ui_tabs.dart +329 -0
  37. package/data/registry/flutter/widgets/sh_ui_textarea.dart +126 -0
  38. package/data/registry/flutter/widgets/sh_ui_toast.dart +362 -0
  39. package/data/registry/flutter/widgets/sh_ui_toggle.dart +229 -0
  40. package/data/registry/flutter/widgets/sh_ui_tooltip.dart +62 -0
  41. package/data/registry/react/components/accordion/index.tsx +85 -0
  42. package/data/registry/react/components/accordion/styles.css +94 -0
  43. package/data/registry/react/components/animations/animations.css +51 -0
  44. package/data/registry/react/components/avatar/index.tsx +75 -0
  45. package/data/registry/react/components/avatar/styles.css +36 -0
  46. package/data/registry/react/components/badge/index.tsx +42 -0
  47. package/data/registry/react/components/badge/styles.css +57 -0
  48. package/data/registry/react/components/base/base.css +102 -0
  49. package/data/registry/react/components/breadcrumb/index.tsx +154 -0
  50. package/data/registry/react/components/breadcrumb/styles.css +82 -0
  51. package/data/registry/react/components/breakpoints/breakpoints.css +17 -0
  52. package/data/registry/react/components/button/index.tsx +47 -0
  53. package/data/registry/react/components/button/styles.css +93 -0
  54. package/data/registry/react/components/card/index.tsx +86 -0
  55. package/data/registry/react/components/card/styles.css +73 -0
  56. package/data/registry/react/components/carousel/index.tsx +432 -0
  57. package/data/registry/react/components/carousel/styles.css +155 -0
  58. package/data/registry/react/components/checkbox/index.tsx +98 -0
  59. package/data/registry/react/components/checkbox/styles.css +75 -0
  60. package/data/registry/react/components/code-panel/copy.tsx +56 -0
  61. package/data/registry/react/components/code-panel/index.tsx +193 -0
  62. package/data/registry/react/components/code-panel/styles.css +124 -0
  63. package/data/registry/react/components/color-picker/index.tsx +466 -0
  64. package/data/registry/react/components/color-picker/styles.css +166 -0
  65. package/data/registry/react/components/combobox/index.tsx +167 -0
  66. package/data/registry/react/components/combobox/styles.css +151 -0
  67. package/data/registry/react/components/context-menu/index.tsx +253 -0
  68. package/data/registry/react/components/context-menu/styles.css +140 -0
  69. package/data/registry/react/components/date-picker/index.tsx +757 -0
  70. package/data/registry/react/components/date-picker/styles.css +279 -0
  71. package/data/registry/react/components/dialog/index.tsx +97 -0
  72. package/data/registry/react/components/dialog/styles.css +127 -0
  73. package/data/registry/react/components/dropdown-menu/index.tsx +257 -0
  74. package/data/registry/react/components/dropdown-menu/styles.css +150 -0
  75. package/data/registry/react/components/file-upload/index.tsx +489 -0
  76. package/data/registry/react/components/file-upload/styles.css +170 -0
  77. package/data/registry/react/components/focus-ring/focus-ring.css +23 -0
  78. package/data/registry/react/components/form/context.ts +92 -0
  79. package/data/registry/react/components/form/field.test.tsx +230 -0
  80. package/data/registry/react/components/form/field.tsx +236 -0
  81. package/data/registry/react/components/form/focus-first-error.ts +54 -0
  82. package/data/registry/react/components/form/form.section.test.tsx +58 -0
  83. package/data/registry/react/components/form/form.test.tsx +146 -0
  84. package/data/registry/react/components/form/form.tsx +180 -0
  85. package/data/registry/react/components/form/index.tsx +61 -0
  86. package/data/registry/react/components/form/steps.test.tsx +106 -0
  87. package/data/registry/react/components/form/steps.tsx +193 -0
  88. package/data/registry/react/components/form/store.test.ts +206 -0
  89. package/data/registry/react/components/form/store.ts +318 -0
  90. package/data/registry/react/components/form/styles.css +47 -0
  91. package/data/registry/react/components/form/types.ts +104 -0
  92. package/data/registry/react/components/form/use-sh-ui-form.ts +15 -0
  93. package/data/registry/react/components/form/utils.test.ts +44 -0
  94. package/data/registry/react/components/form/utils.ts +49 -0
  95. package/data/registry/react/components/form/validation.test.ts +67 -0
  96. package/data/registry/react/components/form/validation.ts +64 -0
  97. package/data/registry/react/components/form-rhf/README.md +27 -0
  98. package/data/registry/react/components/form-rhf/index.tsx +289 -0
  99. package/data/registry/react/components/form-rhf/rhf.test.tsx +42 -0
  100. package/data/registry/react/components/form-tanstack/README.md +27 -0
  101. package/data/registry/react/components/form-tanstack/index.tsx +352 -0
  102. package/data/registry/react/components/form-tanstack/tanstack.test.tsx +45 -0
  103. package/data/registry/react/components/form-yup/README.md +22 -0
  104. package/data/registry/react/components/form-yup/index.tsx +50 -0
  105. package/data/registry/react/components/form-yup/yup.test.ts +27 -0
  106. package/data/registry/react/components/header/index.tsx +257 -0
  107. package/data/registry/react/components/header/styles.css +190 -0
  108. package/data/registry/react/components/input/index.tsx +517 -0
  109. package/data/registry/react/components/input/styles.css +203 -0
  110. package/data/registry/react/components/label/index.tsx +54 -0
  111. package/data/registry/react/components/label/styles.css +90 -0
  112. package/data/registry/react/components/menubar/index.tsx +34 -0
  113. package/data/registry/react/components/menubar/styles.css +45 -0
  114. package/data/registry/react/components/pagination/index.tsx +271 -0
  115. package/data/registry/react/components/pagination/styles.css +105 -0
  116. package/data/registry/react/components/popover/index.tsx +115 -0
  117. package/data/registry/react/components/popover/styles.css +65 -0
  118. package/data/registry/react/components/progress/index.tsx +56 -0
  119. package/data/registry/react/components/progress/styles.css +41 -0
  120. package/data/registry/react/components/radio/index.tsx +67 -0
  121. package/data/registry/react/components/radio/styles.css +80 -0
  122. package/data/registry/react/components/select/index.tsx +236 -0
  123. package/data/registry/react/components/select/styles.css +193 -0
  124. package/data/registry/react/components/separator/index.tsx +48 -0
  125. package/data/registry/react/components/separator/styles.css +15 -0
  126. package/data/registry/react/components/sidebar/index.tsx +1084 -0
  127. package/data/registry/react/components/sidebar/styles.css +502 -0
  128. package/data/registry/react/components/skeleton/index.tsx +24 -0
  129. package/data/registry/react/components/skeleton/styles.css +24 -0
  130. package/data/registry/react/components/slider/index.tsx +300 -0
  131. package/data/registry/react/components/slider/styles.css +64 -0
  132. package/data/registry/react/components/spinner/index.tsx +40 -0
  133. package/data/registry/react/components/spinner/styles.css +37 -0
  134. package/data/registry/react/components/switch/index.tsx +41 -0
  135. package/data/registry/react/components/switch/styles.css +83 -0
  136. package/data/registry/react/components/tabs/index.tsx +93 -0
  137. package/data/registry/react/components/tabs/styles.css +148 -0
  138. package/data/registry/react/components/textarea/index.tsx +25 -0
  139. package/data/registry/react/components/textarea/styles.css +54 -0
  140. package/data/registry/react/components/theme/index.tsx +91 -0
  141. package/data/registry/react/components/toast/index.tsx +257 -0
  142. package/data/registry/react/components/toast/styles.css +290 -0
  143. package/data/registry/react/components/toggle/index.tsx +133 -0
  144. package/data/registry/react/components/toggle/styles.css +85 -0
  145. package/data/registry/react/components/tooltip/index.tsx +85 -0
  146. package/data/registry/react/components/tooltip/styles.css +44 -0
  147. package/data/registry/react/components/z-index/z-index.css +16 -0
  148. package/data/registry/react/hooks/use-active-section.ts +104 -0
  149. package/data/registry/react/hooks/use-media-query.ts +27 -0
  150. package/data/registry/react/lib/cn.ts +39 -0
  151. package/data/registry/react/registry.json +835 -0
  152. package/data/summaries/flutter.json +42 -0
  153. package/data/summaries/react.json +50 -0
  154. package/data/tokens/build.mjs +553 -0
  155. package/data/tokens/src/primitives.json +146 -0
  156. package/data/tokens/src/semantic.json +146 -0
  157. package/package.json +13 -4
  158. package/src/add.mjs +13 -12
  159. package/src/list.mjs +3 -11
  160. package/src/mcp.mjs +308 -0
  161. package/src/paths.mjs +52 -0
  162. package/src/remove.mjs +4 -11
@@ -0,0 +1,336 @@
1
+ {
2
+ "$description": "Flutter 레지스트리 매니페스트 — CLI가 각 컴포넌트 name으로 조회해 files를 사용자 프로젝트의 lib/ 아래로 복사한다.",
3
+ "components": {
4
+ "tokens": {
5
+ "name": "tokens",
6
+ "type": "foundation",
7
+ "files": [
8
+ { "src": "foundation/sh_ui_tokens.dart", "dest": "{foundation}/sh_ui_tokens.dart" }
9
+ ]
10
+ },
11
+ "button": {
12
+ "name": "button",
13
+ "type": "widget",
14
+ "files": [
15
+ { "src": "widgets/sh_ui_button.dart", "dest": "{widgets}/sh_ui_button.dart" }
16
+ ],
17
+ "dependencies": [],
18
+ "registryDependencies": ["tokens"]
19
+ },
20
+ "card": {
21
+ "name": "card",
22
+ "type": "widget",
23
+ "files": [
24
+ { "src": "widgets/sh_ui_card.dart", "dest": "{widgets}/sh_ui_card.dart" }
25
+ ],
26
+ "dependencies": [],
27
+ "registryDependencies": ["tokens"]
28
+ },
29
+ "input": {
30
+ "name": "input",
31
+ "type": "widget",
32
+ "files": [
33
+ { "src": "widgets/sh_ui_input.dart", "dest": "{widgets}/sh_ui_input.dart" }
34
+ ],
35
+ "dependencies": [],
36
+ "registryDependencies": ["tokens"]
37
+ },
38
+ "checkbox": {
39
+ "name": "checkbox",
40
+ "type": "widget",
41
+ "files": [
42
+ { "src": "widgets/sh_ui_checkbox.dart", "dest": "{widgets}/sh_ui_checkbox.dart" }
43
+ ],
44
+ "dependencies": [],
45
+ "registryDependencies": ["tokens"]
46
+ },
47
+ "radio": {
48
+ "name": "radio",
49
+ "type": "widget",
50
+ "files": [
51
+ { "src": "widgets/sh_ui_radio.dart", "dest": "{widgets}/sh_ui_radio.dart" }
52
+ ],
53
+ "dependencies": [],
54
+ "registryDependencies": ["tokens"]
55
+ },
56
+ "switch": {
57
+ "name": "switch",
58
+ "type": "widget",
59
+ "files": [
60
+ { "src": "widgets/sh_ui_switch.dart", "dest": "{widgets}/sh_ui_switch.dart" }
61
+ ],
62
+ "dependencies": [],
63
+ "registryDependencies": ["tokens"]
64
+ },
65
+ "toggle": {
66
+ "name": "toggle",
67
+ "type": "widget",
68
+ "files": [
69
+ { "src": "widgets/sh_ui_toggle.dart", "dest": "{widgets}/sh_ui_toggle.dart" }
70
+ ],
71
+ "dependencies": [],
72
+ "registryDependencies": ["tokens"]
73
+ },
74
+ "textarea": {
75
+ "name": "textarea",
76
+ "type": "widget",
77
+ "files": [
78
+ { "src": "widgets/sh_ui_textarea.dart", "dest": "{widgets}/sh_ui_textarea.dart" }
79
+ ],
80
+ "dependencies": [],
81
+ "registryDependencies": ["tokens"]
82
+ },
83
+ "label": {
84
+ "name": "label",
85
+ "type": "widget",
86
+ "files": [
87
+ { "src": "widgets/sh_ui_label.dart", "dest": "{widgets}/sh_ui_label.dart" }
88
+ ],
89
+ "dependencies": [],
90
+ "registryDependencies": ["tokens"]
91
+ },
92
+ "slider": {
93
+ "name": "slider",
94
+ "type": "widget",
95
+ "files": [
96
+ { "src": "widgets/sh_ui_slider.dart", "dest": "{widgets}/sh_ui_slider.dart" }
97
+ ],
98
+ "dependencies": [],
99
+ "registryDependencies": ["tokens"]
100
+ },
101
+ "select": {
102
+ "name": "select",
103
+ "type": "widget",
104
+ "files": [
105
+ { "src": "widgets/sh_ui_select.dart", "dest": "{widgets}/sh_ui_select.dart" }
106
+ ],
107
+ "dependencies": [],
108
+ "registryDependencies": ["tokens"]
109
+ },
110
+ "tabs": {
111
+ "name": "tabs",
112
+ "type": "widget",
113
+ "files": [
114
+ { "src": "widgets/sh_ui_tabs.dart", "dest": "{widgets}/sh_ui_tabs.dart" }
115
+ ],
116
+ "dependencies": [],
117
+ "registryDependencies": ["tokens"]
118
+ },
119
+ "dialog": {
120
+ "name": "dialog",
121
+ "type": "widget",
122
+ "files": [
123
+ { "src": "widgets/sh_ui_dialog.dart", "dest": "{widgets}/sh_ui_dialog.dart" }
124
+ ],
125
+ "dependencies": [],
126
+ "registryDependencies": ["tokens"]
127
+ },
128
+ "popover": {
129
+ "name": "popover",
130
+ "type": "widget",
131
+ "files": [
132
+ { "src": "widgets/sh_ui_popover.dart", "dest": "{widgets}/sh_ui_popover.dart" }
133
+ ],
134
+ "dependencies": [],
135
+ "registryDependencies": ["tokens"]
136
+ },
137
+ "toast": {
138
+ "name": "toast",
139
+ "type": "widget",
140
+ "files": [
141
+ { "src": "widgets/sh_ui_toast.dart", "dest": "{widgets}/sh_ui_toast.dart" }
142
+ ],
143
+ "dependencies": [],
144
+ "registryDependencies": ["tokens"]
145
+ },
146
+ "date-picker": {
147
+ "name": "date-picker",
148
+ "type": "widget",
149
+ "files": [
150
+ { "src": "widgets/sh_ui_date_picker.dart", "dest": "{widgets}/sh_ui_date_picker.dart" }
151
+ ],
152
+ "dependencies": [],
153
+ "registryDependencies": ["tokens"]
154
+ },
155
+ "color-picker": {
156
+ "name": "color-picker",
157
+ "type": "widget",
158
+ "files": [
159
+ { "src": "widgets/sh_ui_color_picker.dart", "dest": "{widgets}/sh_ui_color_picker.dart" }
160
+ ],
161
+ "dependencies": [],
162
+ "registryDependencies": ["tokens"]
163
+ },
164
+ "combobox": {
165
+ "name": "combobox",
166
+ "type": "widget",
167
+ "files": [
168
+ { "src": "widgets/sh_ui_combobox.dart", "dest": "{widgets}/sh_ui_combobox.dart" }
169
+ ],
170
+ "dependencies": [],
171
+ "registryDependencies": ["tokens"]
172
+ },
173
+ "file-upload": {
174
+ "name": "file-upload",
175
+ "type": "widget",
176
+ "files": [
177
+ { "src": "widgets/sh_ui_file_upload.dart", "dest": "{widgets}/sh_ui_file_upload.dart" }
178
+ ],
179
+ "dependencies": [],
180
+ "registryDependencies": ["tokens"]
181
+ },
182
+ "sidebar": {
183
+ "name": "sidebar",
184
+ "type": "widget",
185
+ "files": [
186
+ { "src": "widgets/sh_ui_sidebar.dart", "dest": "{widgets}/sh_ui_sidebar.dart" }
187
+ ],
188
+ "dependencies": [],
189
+ "registryDependencies": ["tokens"]
190
+ },
191
+ "app-shell": {
192
+ "name": "app-shell",
193
+ "type": "widget",
194
+ "files": [
195
+ { "src": "widgets/sh_ui_app_shell.dart", "dest": "{widgets}/sh_ui_app_shell.dart" }
196
+ ],
197
+ "dependencies": [],
198
+ "registryDependencies": ["tokens", "sidebar"]
199
+ },
200
+ "header": {
201
+ "name": "header",
202
+ "type": "widget",
203
+ "files": [
204
+ { "src": "widgets/sh_ui_header.dart", "dest": "{widgets}/sh_ui_header.dart" }
205
+ ],
206
+ "dependencies": [],
207
+ "registryDependencies": ["tokens"]
208
+ },
209
+ "skeleton": {
210
+ "name": "skeleton",
211
+ "type": "widget",
212
+ "files": [
213
+ { "src": "widgets/sh_ui_skeleton.dart", "dest": "{widgets}/sh_ui_skeleton.dart" }
214
+ ],
215
+ "dependencies": [],
216
+ "registryDependencies": ["tokens"]
217
+ },
218
+ "accordion": {
219
+ "name": "accordion",
220
+ "type": "widget",
221
+ "files": [
222
+ { "src": "widgets/sh_ui_accordion.dart", "dest": "{widgets}/sh_ui_accordion.dart" }
223
+ ],
224
+ "dependencies": [],
225
+ "registryDependencies": ["tokens"]
226
+ },
227
+ "carousel": {
228
+ "name": "carousel",
229
+ "type": "widget",
230
+ "files": [
231
+ { "src": "widgets/sh_ui_carousel.dart", "dest": "{widgets}/sh_ui_carousel.dart" }
232
+ ],
233
+ "dependencies": [],
234
+ "registryDependencies": ["tokens"]
235
+ },
236
+ "badge": {
237
+ "name": "badge",
238
+ "type": "widget",
239
+ "files": [
240
+ { "src": "widgets/sh_ui_badge.dart", "dest": "{widgets}/sh_ui_badge.dart" }
241
+ ],
242
+ "dependencies": [],
243
+ "registryDependencies": ["tokens"]
244
+ },
245
+ "avatar": {
246
+ "name": "avatar",
247
+ "type": "widget",
248
+ "files": [
249
+ { "src": "widgets/sh_ui_avatar.dart", "dest": "{widgets}/sh_ui_avatar.dart" }
250
+ ],
251
+ "dependencies": [],
252
+ "registryDependencies": ["tokens"]
253
+ },
254
+ "breadcrumb": {
255
+ "name": "breadcrumb",
256
+ "type": "widget",
257
+ "files": [
258
+ { "src": "widgets/sh_ui_breadcrumb.dart", "dest": "{widgets}/sh_ui_breadcrumb.dart" }
259
+ ],
260
+ "dependencies": [],
261
+ "registryDependencies": ["tokens"]
262
+ },
263
+ "pagination": {
264
+ "name": "pagination",
265
+ "type": "widget",
266
+ "files": [
267
+ { "src": "widgets/sh_ui_pagination.dart", "dest": "{widgets}/sh_ui_pagination.dart" }
268
+ ],
269
+ "dependencies": [],
270
+ "registryDependencies": ["tokens"]
271
+ },
272
+ "tooltip": {
273
+ "name": "tooltip",
274
+ "type": "widget",
275
+ "files": [
276
+ { "src": "widgets/sh_ui_tooltip.dart", "dest": "{widgets}/sh_ui_tooltip.dart" }
277
+ ],
278
+ "dependencies": [],
279
+ "registryDependencies": ["tokens"]
280
+ },
281
+ "dropdown-menu": {
282
+ "name": "dropdown-menu",
283
+ "type": "widget",
284
+ "files": [
285
+ { "src": "widgets/sh_ui_dropdown_menu.dart", "dest": "{widgets}/sh_ui_dropdown_menu.dart" }
286
+ ],
287
+ "dependencies": [],
288
+ "registryDependencies": ["tokens"]
289
+ },
290
+ "context-menu": {
291
+ "name": "context-menu",
292
+ "type": "widget",
293
+ "files": [
294
+ { "src": "widgets/sh_ui_context_menu.dart", "dest": "{widgets}/sh_ui_context_menu.dart" }
295
+ ],
296
+ "dependencies": [],
297
+ "registryDependencies": ["tokens", "dropdown-menu"]
298
+ },
299
+ "menubar": {
300
+ "name": "menubar",
301
+ "type": "widget",
302
+ "files": [
303
+ { "src": "widgets/sh_ui_menubar.dart", "dest": "{widgets}/sh_ui_menubar.dart" }
304
+ ],
305
+ "dependencies": [],
306
+ "registryDependencies": ["tokens", "dropdown-menu"]
307
+ },
308
+ "progress": {
309
+ "name": "progress",
310
+ "type": "widget",
311
+ "files": [
312
+ { "src": "widgets/sh_ui_progress.dart", "dest": "{widgets}/sh_ui_progress.dart" }
313
+ ],
314
+ "dependencies": [],
315
+ "registryDependencies": ["tokens"]
316
+ },
317
+ "spinner": {
318
+ "name": "spinner",
319
+ "type": "widget",
320
+ "files": [
321
+ { "src": "widgets/sh_ui_spinner.dart", "dest": "{widgets}/sh_ui_spinner.dart" }
322
+ ],
323
+ "dependencies": [],
324
+ "registryDependencies": ["tokens"]
325
+ },
326
+ "separator": {
327
+ "name": "separator",
328
+ "type": "widget",
329
+ "files": [
330
+ { "src": "widgets/sh_ui_separator.dart", "dest": "{widgets}/sh_ui_separator.dart" }
331
+ ],
332
+ "dependencies": [],
333
+ "registryDependencies": ["tokens"]
334
+ }
335
+ }
336
+ }
@@ -0,0 +1,255 @@
1
+ import 'package:flutter/material.dart';
2
+ import '../foundation/sh_ui_tokens.dart';
3
+
4
+ /// Accordion 열림 동작 모드.
5
+ /// - [single] : 한 번에 하나만 열림.
6
+ /// - [multiple] : 동시에 여러 개 열림.
7
+ enum ShUiAccordionType { single, multiple }
8
+
9
+ /// Accordion 항목 모델.
10
+ class ShUiAccordionItem {
11
+ /// 고유 식별자. 열림/닫힘 상태 추적에 사용된다.
12
+ final String value;
13
+
14
+ /// 헤더 타이틀.
15
+ final String title;
16
+
17
+ /// 펼친 뒤 표시될 본문.
18
+ final Widget content;
19
+
20
+ /// 헤더 왼쪽에 붙는 아이콘 (선택).
21
+ final IconData? leadingIcon;
22
+
23
+ /// 비활성화 상태.
24
+ final bool disabled;
25
+
26
+ const ShUiAccordionItem({
27
+ required this.value,
28
+ required this.title,
29
+ required this.content,
30
+ this.leadingIcon,
31
+ this.disabled = false,
32
+ });
33
+ }
34
+
35
+ /// shUi Accordion — 수직으로 쌓인 접이식 섹션 목록.
36
+ ///
37
+ /// [type]이 [ShUiAccordionType.single]이면 [initialValue]는 `String?`로,
38
+ /// [ShUiAccordionType.multiple]이면 `List<String>?`로 전달한다.
39
+ /// 상태 변경 시 [onValueChange]로 현재 열린 value(들)를 통지한다.
40
+ class ShUiAccordion extends StatefulWidget {
41
+ final List<ShUiAccordionItem> items;
42
+ final ShUiAccordionType type;
43
+
44
+ /// 초기 열림 값. single이면 `String?`, multiple이면 `List<String>?`.
45
+ final Object? initialValue;
46
+
47
+ /// 상태 변경 콜백. single이면 `String?`, multiple이면 `List<String>`이 전달된다.
48
+ final ValueChanged<Object?>? onValueChange;
49
+
50
+ const ShUiAccordion({
51
+ super.key,
52
+ required this.items,
53
+ this.type = ShUiAccordionType.multiple,
54
+ this.initialValue,
55
+ this.onValueChange,
56
+ });
57
+
58
+ @override
59
+ State<ShUiAccordion> createState() => _ShUiAccordionState();
60
+ }
61
+
62
+ class _ShUiAccordionState extends State<ShUiAccordion> {
63
+ late Set<String> _open;
64
+
65
+ @override
66
+ void initState() {
67
+ super.initState();
68
+ _open = _resolveInitial(widget.initialValue, widget.type);
69
+ }
70
+
71
+ static Set<String> _resolveInitial(Object? v, ShUiAccordionType type) {
72
+ if (v == null) return <String>{};
73
+ if (type == ShUiAccordionType.single) {
74
+ return v is String ? {v} : <String>{};
75
+ }
76
+ return v is List<String> ? v.toSet() : <String>{};
77
+ }
78
+
79
+ void _toggle(String value) {
80
+ setState(() {
81
+ if (widget.type == ShUiAccordionType.single) {
82
+ if (_open.contains(value)) {
83
+ _open = <String>{};
84
+ } else {
85
+ _open = {value};
86
+ }
87
+ } else {
88
+ _open = {..._open};
89
+ if (_open.contains(value)) {
90
+ _open.remove(value);
91
+ } else {
92
+ _open.add(value);
93
+ }
94
+ }
95
+ });
96
+ if (widget.onValueChange != null) {
97
+ if (widget.type == ShUiAccordionType.single) {
98
+ widget.onValueChange!(_open.isEmpty ? null : _open.first);
99
+ } else {
100
+ widget.onValueChange!(_open.toList());
101
+ }
102
+ }
103
+ }
104
+
105
+ @override
106
+ Widget build(BuildContext context) {
107
+ final shUi = Theme.of(context).extension<ShUiTheme>() ?? ShUiTheme.light;
108
+ return Container(
109
+ decoration: BoxDecoration(
110
+ border: Border.all(color: shUi.colors.border),
111
+ borderRadius: BorderRadius.circular(shUi.radius.defaultRadius),
112
+ ),
113
+ child: Column(
114
+ mainAxisSize: MainAxisSize.min,
115
+ children: [
116
+ for (var i = 0; i < widget.items.length; i++) ...[
117
+ _ShUiAccordionItemView(
118
+ item: widget.items[i],
119
+ isOpen: _open.contains(widget.items[i].value),
120
+ onTap: () {
121
+ if (!widget.items[i].disabled) {
122
+ _toggle(widget.items[i].value);
123
+ }
124
+ },
125
+ isFirst: i == 0,
126
+ isLast: i == widget.items.length - 1,
127
+ ),
128
+ if (i != widget.items.length - 1)
129
+ Container(height: 1, color: shUi.colors.border),
130
+ ],
131
+ ],
132
+ ),
133
+ );
134
+ }
135
+ }
136
+
137
+ class _ShUiAccordionItemView extends StatefulWidget {
138
+ final ShUiAccordionItem item;
139
+ final bool isOpen;
140
+ final VoidCallback onTap;
141
+ final bool isFirst;
142
+ final bool isLast;
143
+
144
+ const _ShUiAccordionItemView({
145
+ required this.item,
146
+ required this.isOpen,
147
+ required this.onTap,
148
+ required this.isFirst,
149
+ required this.isLast,
150
+ });
151
+
152
+ @override
153
+ State<_ShUiAccordionItemView> createState() => _ShUiAccordionItemViewState();
154
+ }
155
+
156
+ class _ShUiAccordionItemViewState extends State<_ShUiAccordionItemView> {
157
+ bool _hover = false;
158
+
159
+ @override
160
+ Widget build(BuildContext context) {
161
+ final shUi = Theme.of(context).extension<ShUiTheme>() ?? ShUiTheme.light;
162
+ final colors = shUi.colors;
163
+ final disabled = widget.item.disabled;
164
+
165
+ return Opacity(
166
+ opacity: disabled ? shUi.opacity.disabled : 1,
167
+ child: Column(
168
+ crossAxisAlignment: CrossAxisAlignment.stretch,
169
+ mainAxisSize: MainAxisSize.min,
170
+ children: [
171
+ MouseRegion(
172
+ cursor: disabled
173
+ ? SystemMouseCursors.basic
174
+ : SystemMouseCursors.click,
175
+ onEnter: (_) => setState(() => _hover = true),
176
+ onExit: (_) => setState(() => _hover = false),
177
+ child: GestureDetector(
178
+ onTap: disabled ? null : widget.onTap,
179
+ behavior: HitTestBehavior.opaque,
180
+ child: AnimatedContainer(
181
+ duration: shUi.duration.fast,
182
+ color: _hover && !disabled
183
+ ? colors.backgroundSubtle
184
+ : Colors.transparent,
185
+ padding: EdgeInsets.symmetric(
186
+ horizontal: shUi.spacing.s4,
187
+ vertical: shUi.spacing.s3,
188
+ ),
189
+ child: Row(
190
+ children: [
191
+ if (widget.item.leadingIcon != null) ...[
192
+ Icon(
193
+ widget.item.leadingIcon,
194
+ size: 16,
195
+ color: colors.foregroundMuted,
196
+ ),
197
+ SizedBox(width: shUi.spacing.s2),
198
+ ],
199
+ Expanded(
200
+ child: Text(
201
+ widget.item.title,
202
+ style: TextStyle(
203
+ color: colors.foreground,
204
+ fontSize: shUi.text.sm,
205
+ fontWeight: shUi.weight.medium,
206
+ height: 1.25,
207
+ ),
208
+ ),
209
+ ),
210
+ AnimatedRotation(
211
+ turns: widget.isOpen ? 0.5 : 0.0,
212
+ duration: shUi.duration.base,
213
+ curve: shUi.ease.standard,
214
+ child: Icon(
215
+ Icons.keyboard_arrow_down,
216
+ size: 18,
217
+ color: colors.foregroundMuted,
218
+ ),
219
+ ),
220
+ ],
221
+ ),
222
+ ),
223
+ ),
224
+ ),
225
+ AnimatedSize(
226
+ duration: shUi.duration.base,
227
+ curve: shUi.ease.standard,
228
+ alignment: Alignment.topCenter,
229
+ child: widget.isOpen
230
+ ? Padding(
231
+ padding: EdgeInsets.fromLTRB(
232
+ shUi.spacing.s4,
233
+ 0,
234
+ shUi.spacing.s4,
235
+ shUi.spacing.s3,
236
+ ),
237
+ child: DefaultTextStyle(
238
+ style: TextStyle(
239
+ color: colors.foregroundMuted,
240
+ fontSize: shUi.text.sm,
241
+ height: 1.5,
242
+ ),
243
+ child: Align(
244
+ alignment: Alignment.centerLeft,
245
+ child: widget.item.content,
246
+ ),
247
+ ),
248
+ )
249
+ : const SizedBox(width: double.infinity, height: 0),
250
+ ),
251
+ ],
252
+ ),
253
+ );
254
+ }
255
+ }