@snowui-design-system/components 0.1.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 (184) hide show
  1. package/README.md +82 -0
  2. package/package.json +47 -0
  3. package/src/App.svelte +103 -0
  4. package/src/components/Avatar.md +452 -0
  5. package/src/components/Avatar.svelte +593 -0
  6. package/src/components/Avatar.test.ts +231 -0
  7. package/src/components/AvatarGroup.md +246 -0
  8. package/src/components/AvatarGroup.svelte +691 -0
  9. package/src/components/AvatarGroup.test.ts +142 -0
  10. package/src/components/Badge.md +164 -0
  11. package/src/components/Badge.svelte +461 -0
  12. package/src/components/Badge.test.ts +293 -0
  13. package/src/components/Button.md +312 -0
  14. package/src/components/Button.svelte +796 -0
  15. package/src/components/Button.test.ts +631 -0
  16. package/src/components/Checkbox.md +313 -0
  17. package/src/components/Checkbox.svelte +466 -0
  18. package/src/components/Checkbox.test.ts +57 -0
  19. package/src/components/CodeBlock.md +240 -0
  20. package/src/components/CodeBlock.svelte +1287 -0
  21. package/src/components/CodeBlock.test.ts +192 -0
  22. package/src/components/Form.md +33 -0
  23. package/src/components/Form.test.ts +307 -0
  24. package/src/components/Frame.svelte +220 -0
  25. package/src/components/Icon.md +279 -0
  26. package/src/components/Icon.svelte +505 -0
  27. package/src/components/Icon.test.ts +82 -0
  28. package/src/components/Image.md +292 -0
  29. package/src/components/Image.svelte +634 -0
  30. package/src/components/Image.test.ts +42 -0
  31. package/src/components/ImageGroup.md +168 -0
  32. package/src/components/ImageGroup.svelte +151 -0
  33. package/src/components/ImageGroup.test.ts +46 -0
  34. package/src/components/InView.test.ts +55 -0
  35. package/src/components/Input.md +666 -0
  36. package/src/components/Input.svelte +2741 -0
  37. package/src/components/Input.test.ts +503 -0
  38. package/src/components/Kbd.md +100 -0
  39. package/src/components/Kbd.svelte +110 -0
  40. package/src/components/Kbd.test.ts +50 -0
  41. package/src/components/Listbox.md +245 -0
  42. package/src/components/Listbox.svelte +389 -0
  43. package/src/components/Listbox.test.ts +139 -0
  44. package/src/components/MenuItem.md +184 -0
  45. package/src/components/MenuItem.svelte +326 -0
  46. package/src/components/MenuItem.test.ts +167 -0
  47. package/src/components/Morph.test.ts +53 -0
  48. package/src/components/Popover.md +87 -0
  49. package/src/components/Popover.svelte +186 -0
  50. package/src/components/Popover.test.ts +60 -0
  51. package/src/components/QuickAction.md +146 -0
  52. package/src/components/QuickAction.svelte +161 -0
  53. package/src/components/QuickAction.test.ts +299 -0
  54. package/src/components/Radio.md +318 -0
  55. package/src/components/Radio.svelte +502 -0
  56. package/src/components/Radio.test.ts +76 -0
  57. package/src/components/Select.md +492 -0
  58. package/src/components/Select.svelte +535 -0
  59. package/src/components/Select.test.ts +146 -0
  60. package/src/components/Skeleton.md +323 -0
  61. package/src/components/Skeleton.svelte +791 -0
  62. package/src/components/Skeleton.test.ts +121 -0
  63. package/src/components/Spinner.md +136 -0
  64. package/src/components/Spinner.svelte +296 -0
  65. package/src/components/Spinner.test.ts +88 -0
  66. package/src/components/SplitText.test.ts +142 -0
  67. package/src/components/Stagger.test.ts +57 -0
  68. package/src/components/Test.md +72 -0
  69. package/src/components/Test.svelte +106 -0
  70. package/src/components/Test.test.ts +27 -0
  71. package/src/components/Text.md +450 -0
  72. package/src/components/Text.svelte +507 -0
  73. package/src/components/Text.test.ts +150 -0
  74. package/src/components/Textarea.md +240 -0
  75. package/src/components/Textarea.svelte +742 -0
  76. package/src/components/Textarea.test.ts +131 -0
  77. package/src/components/Toggle.md +196 -0
  78. package/src/components/Toggle.svelte +384 -0
  79. package/src/components/Toggle.test.ts +57 -0
  80. package/src/components/Tooltip.md +164 -0
  81. package/src/components/Tooltip.svelte +417 -0
  82. package/src/components/Tooltip.test.ts +64 -0
  83. package/src/context.ts +312 -0
  84. package/src/dev.ts +10 -0
  85. package/src/index.ts +29 -0
  86. package/src/keys.ts +26 -0
  87. package/src/lib/search-filter.md +82 -0
  88. package/src/lib/search-filter.ts +57 -0
  89. package/src/lib/truncate.md +25 -0
  90. package/src/lib/truncate.ts +234 -0
  91. package/src/logic/README.md +146 -0
  92. package/src/logic/collapse.svelte.ts +6 -0
  93. package/src/logic/frame-dom-runtime.md +19 -0
  94. package/src/logic/frame-dom-runtime.svelte.ts +286 -0
  95. package/src/logic/frame-field-control.md +38 -0
  96. package/src/logic/frame-field-control.ts +95 -0
  97. package/src/logic/frame-identity.md +68 -0
  98. package/src/logic/frame-identity.svelte.ts +25 -0
  99. package/src/logic/frame-layout.md +91 -0
  100. package/src/logic/frame-layout.svelte.ts +111 -0
  101. package/src/logic/frame-motion-defaults.md +180 -0
  102. package/src/logic/frame-motion-defaults.ts +711 -0
  103. package/src/logic/frame-profile.md +156 -0
  104. package/src/logic/frame-profile.ts +130 -0
  105. package/src/logic/frame-prop-filter.md +34 -0
  106. package/src/logic/frame-prop-filter.ts +254 -0
  107. package/src/logic/frame-responsive.md +91 -0
  108. package/src/logic/frame-responsive.svelte.ts +92 -0
  109. package/src/logic/frame-skeleton-runtime.md +20 -0
  110. package/src/logic/frame-skeleton-runtime.svelte.ts +160 -0
  111. package/src/logic/frame-truncation.md +127 -0
  112. package/src/logic/frame-truncation.svelte.ts +193 -0
  113. package/src/logic/frame-types.md +157 -0
  114. package/src/logic/frame-types.ts +434 -0
  115. package/src/logic/frame-utils.md +22 -0
  116. package/src/logic/frame-utils.ts +250 -0
  117. package/src/logic/geometry-cache.ts +120 -0
  118. package/src/logic/image-preview.md +24 -0
  119. package/src/logic/image-preview.ts +186 -0
  120. package/src/logic/layout-flip.ts +109 -0
  121. package/src/logic/motion-config.ts +102 -0
  122. package/src/logic/motion-types.md +47 -0
  123. package/src/logic/motion-types.ts +119 -0
  124. package/src/logic/observer.md +20 -0
  125. package/src/logic/observer.svelte.ts +53 -0
  126. package/src/logic/responsive.md +64 -0
  127. package/src/logic/responsive.svelte.ts +118 -0
  128. package/src/logic/text-collapse.md +22 -0
  129. package/src/logic/text-collapse.svelte.ts +507 -0
  130. package/src/logic/wc-adapter.ts +188 -0
  131. package/src/motion/NumberFlow.md +16 -0
  132. package/src/motion/README.md +87 -0
  133. package/src/motion/defaults/bridge.md +53 -0
  134. package/src/motion/defaults/bridge.ts +171 -0
  135. package/src/motion/defaults/content-crossfade.ts +22 -0
  136. package/src/motion/defaults/expand.md +66 -0
  137. package/src/motion/defaults/expand.ts +22 -0
  138. package/src/motion/defaults/fade-out.md +41 -0
  139. package/src/motion/defaults/fade-out.ts +14 -0
  140. package/src/motion/defaults/morph.md +42 -0
  141. package/src/motion/defaults/morph.ts +14 -0
  142. package/src/motion/defaults/move.md +81 -0
  143. package/src/motion/defaults/move.ts +31 -0
  144. package/src/motion/defaults/number.md +41 -0
  145. package/src/motion/defaults/number.ts +17 -0
  146. package/src/motion/defaults/replace.md +56 -0
  147. package/src/motion/defaults/replace.ts +22 -0
  148. package/src/motion/defaults/rotate.css +15 -0
  149. package/src/motion/defaults/rotate.md +60 -0
  150. package/src/motion/defaults/rotate.ts +20 -0
  151. package/src/motion/defaults/while-2xl.ts +9 -0
  152. package/src/motion/defaults/while-active.ts +12 -0
  153. package/src/motion/defaults/while-appear.ts +12 -0
  154. package/src/motion/defaults/while-click.ts +9 -0
  155. package/src/motion/defaults/while-collapsed.ts +12 -0
  156. package/src/motion/defaults/while-disabled.ts +13 -0
  157. package/src/motion/defaults/while-disappear.ts +12 -0
  158. package/src/motion/defaults/while-drag.ts +9 -0
  159. package/src/motion/defaults/while-editing.ts +9 -0
  160. package/src/motion/defaults/while-expanded.ts +12 -0
  161. package/src/motion/defaults/while-focus.ts +9 -0
  162. package/src/motion/defaults/while-hover.ts +13 -0
  163. package/src/motion/defaults/while-idle.ts +9 -0
  164. package/src/motion/defaults/while-key.ts +9 -0
  165. package/src/motion/defaults/while-lg.ts +9 -0
  166. package/src/motion/defaults/while-load.ts +11 -0
  167. package/src/motion/defaults/while-md.ts +9 -0
  168. package/src/motion/defaults/while-reload.ts +12 -0
  169. package/src/motion/defaults/while-scroll.ts +9 -0
  170. package/src/motion/defaults/while-sm.ts +9 -0
  171. package/src/motion/defaults/while-uploading.ts +9 -0
  172. package/src/motion/defaults/while-validating.ts +9 -0
  173. package/src/motion/defaults/while-xl.ts +9 -0
  174. package/src/motion/defaults/while-xs.ts +9 -0
  175. package/src/styles/README.md +95 -0
  176. package/src/styles/auto-layout.css +111 -0
  177. package/src/styles/index.css +7 -0
  178. package/src/styles/layout.css +319 -0
  179. package/src/styles/scale.css +106 -0
  180. package/src/styles/scale.md +218 -0
  181. package/src/styles/scrollbar.css +173 -0
  182. package/src/styles/tokens.css +192 -0
  183. package/src/vite-env.d.ts +9 -0
  184. package/src//344/273/243/347/240/201.txt +61 -0
@@ -0,0 +1,631 @@
1
+ /**
2
+ * Button.test.ts
3
+ * v1.4.1
4
+ * 变更记录 (2026-03-15): 调整 B3 图标按钮示例,覆盖 `iconButton` 忽略 `variant`、继承当前 `size` 图标尺寸、以及无图标内容仅保留透明度反馈。
5
+ * 变更记录 (2026-03-15): 修复 B3 图标按钮示例运行时错误,示例下拉图标改为 test 沙箱已注入的 `ArrowLineDown2`。
6
+ * 变更记录 (2026-03-15): 新增 B3 图标按钮示例,覆盖 `iconButton` 的尺寸梯度与表单 trailing action 场景。
7
+ * 变更记录 (2026-02-04): H1 示例使用 Icon 组件,避免未导入的 Command 组件导致运行时错误。
8
+ * 变更记录 (2026-02-26): 修复 B1/B2/D1/F1/G1/G2/G3/H1 示例为当前 Button/Frame 能力;重写 H2 为直观对比并补充说明。
9
+ * 变更记录 (2026-02-26): D1 右侧改为 C6 同款状态链流转;G1 增加 count 加减与 NumberFlow 数字滚动动效。
10
+ * 变更记录 (2026-02-26): D1 改为“仅 Button”点击状态流:Ready -> Loading -> Completed -> Disabled,并去除额外点击动效。
11
+ * 变更记录 (2026-02-26): D1 改为纯 Frame 状态链能力(Button 透传 currentState),移除手动 DOM 状态推进。
12
+ * 变更记录 (2026-02-26): 修复 D1 按钮不可点击(移除 whileLoad/whileActive,避免触发 skeleton 的 pointer-events:none)。
13
+ * 变更记录 (2026-02-26): D1 改为 Frame 通用 stateVars 写法(去除 stateText 特化能力)。
14
+ * 变更记录 (2026-02-26): D1 升级为 Frame 默认动效示例:Idle(无图标) -> Load(Spinner+文案) -> Active(Check+文案),Active 再次点击回 Idle。
15
+ * 变更记录 (2026-02-26): D1 简化为纯 Button 状态链示例(移除内嵌 Frame 与显式 whileAppear/whileDisappear)。
16
+ * 变更记录 (2026-03-02): 修复 examples 数组末尾缺少逗号导致的语法错误(esbuild: Expected "]" but found "{")。
17
+ */
18
+ export const examples = [
19
+ {
20
+ name: "A1: 基础样式 (Styles)",
21
+ code: `A1
22
+ <Button>Default</Button>
23
+ <Button variant="gray">Gray</Button>
24
+ <Button variant="filled">Filled</Button>
25
+ <Button variant="outline">Outline</Button>
26
+ <Button variant="borderless">Borderless</Button>
27
+ <Button href="#" variant="link">About</Button>`,
28
+
29
+ logic: ["Style"],
30
+ },
31
+ {
32
+ name: "A2: 尺寸 (Sizes)",
33
+ code: `A2
34
+ <div class="flex-col gap-8">
35
+ <div class="flex-row gap-8 items-center">
36
+ <Button size="sm">Small</Button>
37
+ <Button size="md">Medium</Button>
38
+ <Button size="lg">Large</Button>
39
+ </div>
40
+ <div class="flex-row gap-8 items-center">
41
+ <Button variant="filled" size="sm">Small</Button>
42
+ <Button variant="filled" size="md">Medium</Button>
43
+ <Button variant="filled" size="lg">Large</Button>
44
+ </div>
45
+ </div>`,
46
+
47
+ logic: ["Size"],
48
+ },
49
+ {
50
+ name: "A3: 禁用状态 (Disabled)",
51
+ code: `A3
52
+ <div class="flex-row gap-8">
53
+ <Button disabled>Gray</Button>
54
+ <Button variant="filled" disabled>Filled</Button>
55
+ <Button variant="outline" disabled>Outline</Button>
56
+ <Button variant="borderless" disabled>Borderless</Button>
57
+ </div>`,
58
+
59
+ logic: ["State"],
60
+ },
61
+ {
62
+ name: "B1: 内容组合 (Composition)",
63
+ code: `B1
64
+ <Button>
65
+ <Icon><FourLeafClover /></Icon>
66
+ Search
67
+ </Button>
68
+ <Button variant="filled">
69
+ <Icon><FourLeafClover /></Icon>
70
+ Search
71
+ </Button>
72
+
73
+ <Button size="sm">
74
+ <Icon><FourLeafClover /></Icon>
75
+ Small
76
+ </Button>
77
+ <Button size="lg">
78
+ <Icon><FourLeafClover /></Icon>
79
+ Large
80
+ </Button>`,
81
+
82
+ logic: ["Composition"],
83
+ },
84
+ {
85
+ name: "B2: 纯图标按钮 (Icon Only)",
86
+ code: `B2
87
+ <Button size="sm">
88
+ <FourLeafClover />
89
+ </Button>
90
+ <Button size="md">
91
+ <FourLeafClover />
92
+ </Button>
93
+ <Button size="lg">
94
+ <FourLeafClover />
95
+ </Button>`,
96
+
97
+ logic: ["Composition"],
98
+ },
99
+ {
100
+ name: "B3: 图标按钮 (Icon Button)",
101
+ code: `B3
102
+ <div class="flex-col gap-12">
103
+ <div class="flex-row gap-8 items-center">
104
+ <Button iconButton={12} aria-label="减少">
105
+ <Minus />
106
+ </Button>
107
+ <Button iconButton={16} aria-label="筛选">
108
+ <FourLeafClover />
109
+ </Button>
110
+ <Button iconButton size="lg" variant="filled" aria-label="展开">
111
+ <ArrowLineDown2 />
112
+ </Button>
113
+ <Button iconButton={24} aria-label="增加">
114
+ <Plus />
115
+ </Button>
116
+ </div>
117
+ <div class="flex-row gap-8 items-center p-8 rounded-12 bg-surface-1">
118
+ <Input placeholder="搜索内容" />
119
+ <Button iconButton size="md" variant="outline" aria-label="展开筛选">
120
+ <ArrowLineDown2 />
121
+ </Button>
122
+ <Button iconButton={16} aria-label="清空输入">
123
+ <Minus />
124
+ </Button>
125
+ </div>
126
+ <div class="flex-row gap-8 items-center">
127
+ <Button iconButton variant="filled">
128
+ 仅文本内容
129
+ </Button>
130
+ <Button iconButton size="lg" variant="outline">
131
+ <FourLeafClover />
132
+ 带文字图标
133
+ </Button>
134
+ </div>
135
+ <div class="text-12 text-black-40">
136
+ 说明:iconButton 会忽略 filled/outline 等 variant 的视觉结果。未传数字尺寸时,图标回退到当前 size 档位的常规图标尺寸;传数字时则使用显式尺寸。若没有图标内容,只保留透明度 40% -> hover 100% 的反馈。
137
+ </div>
138
+ </div>`,
139
+
140
+ logic: ["Composition", "State"],
141
+ },
142
+ {
143
+ name: "C1: 角色化组合 - 提示 (Role-based Composition: Tooltip)",
144
+ code: `C1
145
+ <div class="flex-row gap-8">
146
+ <Button>
147
+ <span>保存更改</span>
148
+ <Tooltip as="tooltip">保存更改</Tooltip>
149
+ </Button>
150
+ <Button variant="filled">
151
+ <span>组合模式</span>
152
+ <Tooltip as="tooltip" position="bottom">点击上传</Tooltip>
153
+ </Button>
154
+ </div>`,
155
+
156
+ logic: ["Tooltip"],
157
+ },
158
+ {
159
+ name: "D1: 状态流 (State Flow)",
160
+ code: `D1
161
+ {#snippet readyContent()}
162
+ Ready
163
+ {/snippet}
164
+ {#snippet loadingContent()}
165
+ <Spinner />
166
+ Loading...
167
+ {/snippet}
168
+ {#snippet completedContent()}
169
+ <Check />
170
+ Completed
171
+ {/snippet}
172
+
173
+ <Button
174
+ whileClick={false}
175
+ Click={{ Idle: "Load", Active: "Idle" }}
176
+ Load={["Active", "auto"]}
177
+ stateContent={{
178
+ Idle: readyContent,
179
+ Load: loadingContent,
180
+ Active: completedContent,
181
+ }}
182
+ />`,
183
+
184
+ logic: ["State"],
185
+ },
186
+ {
187
+ name: "E1: 响应式配置 (Responsive)",
188
+ code: `E1
189
+ <Button
190
+ enableResponsive
191
+ responsive={{
192
+ sm: { size: "sm", variant: "outline" },
193
+ lg: { size: "lg", variant: "filled" }
194
+ }}
195
+ >
196
+ Responsive Button
197
+ </Button>`,
198
+
199
+ logic: ["Responsive"],
200
+ },
201
+ {
202
+ name: "F1: 多态链接 (Polymorphic Link)",
203
+ code: `F1
204
+ <div class="flex-col gap-8">
205
+ <div class="flex-row gap-8 items-center">
206
+ <Button href="https://google.com" target="_blank" rel="noreferrer">
207
+ 外链(a)
208
+ </Button>
209
+ <Button href="#">站内链接(a)</Button>
210
+ <Button>普通动作(button)</Button>
211
+ </div>
212
+ <div class="text-12 text-black-40">
213
+ 说明:传入 href 时渲染 a 标签;不传 href 时渲染 button 标签。
214
+ </div>
215
+ </div>`,
216
+
217
+ logic: ["Polymorphism"],
218
+ },
219
+ {
220
+ name: "F2: Link 变体 (Link Variant)",
221
+ code: `F2
222
+ <div class="flex-row gap-8 items-center">
223
+ <Button variant="link" href="#">Link Variant</Button>
224
+ <Button variant="link" size="lg" href="#">Large Link</Button>
225
+ <Button variant="link" disabled href="#">Disabled Link</Button>
226
+ </div>`,
227
+
228
+ logic: ["Style"],
229
+ },
230
+ {
231
+ name: "F3: 长文本按钮(无内置截断)",
232
+ code: `F3
233
+ <div class="flex-col gap-16" style="width: 200px;">
234
+ <Button variant="link" href="#">
235
+ 这是一个非常长的链接文本,Button 本身不处理截断,文本将自然换行。
236
+ </Button>
237
+ <Button variant="outline">
238
+ 这也是一个很长的按钮文本,若需要截断请在内容侧使用 Text 组件的 lines 能力。
239
+ </Button>
240
+ </div>`,
241
+
242
+ logic: ["Layout"],
243
+ },
244
+ {
245
+ name: "G1: 计数器示例 (Counter Example)",
246
+ code: `G1
247
+ <Frame
248
+ class="flex-col gap-8"
249
+ Click="Active"
250
+ Active={["Disabled", "auto"]}
251
+ Disabled={["Idle", "auto"]}
252
+ >
253
+ {#snippet children({ currentState })}
254
+ <div class="flex-row gap-16 items-center bg-background-1 p-16 rounded-12 border-black-10 w-hug">
255
+ <Button variant="gray" size="lg">
256
+ <Minus />
257
+ </Button>
258
+ <div class="text-24 font-semibold min-w-48" style="text-align: center;">
259
+ <NumberFlow
260
+ value={currentState === "Active" ? 6 : currentState === "Disabled" ? 4 : 5}
261
+ duration={500}
262
+ />
263
+ </div>
264
+ <Button variant="gray" size="lg">
265
+ <Plus />
266
+ </Button>
267
+ </div>
268
+ <div class="text-12 text-black-40">
269
+ 说明:点击计数器区域后数字按 5 -> 6 -> 4 -> 5 流转,NumberFlow 负责滚动过渡动效。
270
+ </div>
271
+ {/snippet}
272
+ </Frame>`,
273
+
274
+ logic: ["Motion", "Composition"],
275
+ },
276
+ {
277
+ name: "G2: 神奇移动 (Magic Move / layoutId)",
278
+ code: `G2
279
+ <div class="flex-col gap-8">
280
+ <div class="flex-row gap-16 p-16 bg-background-1 rounded-16 border-black-10 w-hug">
281
+ <Button variant="filled" class="relative">
282
+ 选中项
283
+ <Frame
284
+ layoutId="active-pill"
285
+ class="absolute top-0 right-0 bottom-0 left-0 bg-primary -z-10"
286
+ style="border-radius: inherit;"
287
+ />
288
+ </Button>
289
+ <Button variant="gray">未选中</Button>
290
+ <Button variant="gray">未选中</Button>
291
+ </div>
292
+ <div class="text-12 text-black-40">
293
+ 说明:共享元素转场请挂在 Frame 上(layoutId),不要写在原生 div 上。
294
+ </div>
295
+ </div>`,
296
+
297
+ logic: ["Motion", "SharedLayout"],
298
+ },
299
+ {
300
+ name: "G3: 布局过渡 (Layout Transition)",
301
+ code: `G3
302
+ <div class="p-16 bg-background-1 rounded-16 border-black-10 w-hug flex-col gap-16">
303
+ <Button
304
+ variant="filled"
305
+ Click="Active"
306
+ Active={["Idle", "auto"]}
307
+ whileActive={{ width: "+40px", duration: 600 }}
308
+ >
309
+ 点击后宽度过渡
310
+ </Button>
311
+ <div class="text-12 text-black-40">
312
+ 说明:用状态链 + whileActive 驱动尺寸变化;layout 不是 Button 的有效能力。
313
+ </div>
314
+ </div>`,
315
+
316
+ logic: ["Motion", "Layout"],
317
+ },
318
+ {
319
+ name: "H1: 复杂动效",
320
+ code: `H1
321
+ <div class="flex-col gap-8">
322
+ <Button
323
+ variant="gray"
324
+ size="md"
325
+ Click="Active"
326
+ Active={["Disabled", "auto"]}
327
+ Disabled={["Idle", "auto"]}
328
+ whileHover={{ scale: 1.02 }}
329
+ whileClick={{ scale: 0.98 }}
330
+ whileActive={{ duration: 1500 }}
331
+ whileDisabled={{ duration: 2000 }}
332
+ >
333
+ <Star />
334
+ Button
335
+ </Button>
336
+ <div class="text-12 text-black-40">
337
+ 说明:点击后状态链 Active -> Disabled -> Idle 自动轮转。
338
+ </div>
339
+ </div>`,
340
+
341
+ logic: ["Motion", "Layout"],
342
+ },
343
+ {
344
+ name: "H2: 启用上下文 (Enable Context)",
345
+ code: `H2
346
+ <div class="flex-col gap-8">
347
+ <div class="flex-row gap-8 items-center">
348
+ <Button size="lg" variant="outline">
349
+ <Icon><FourLeafClover /></Icon>
350
+ enableContext 默认 true
351
+ </Button>
352
+ <Button size="lg" variant="outline" enableContext={false}>
353
+ <Icon><FourLeafClover /></Icon>
354
+ enableContext=false
355
+ </Button>
356
+ </div>
357
+ <div class="text-12 text-black-40">
358
+ 说明:左侧 Icon 会继承 Button 的 size=lg(约24);右侧关闭 context 后回退默认尺寸(16)。
359
+ </div>
360
+ </div>`,
361
+ logic: ["Context", "Capability"],
362
+ },
363
+ {
364
+ name: "Custom 00-48-19",
365
+ code: `<Button><Spinner/>Loading...</Button>`,
366
+ logic: ["UserCreated"],
367
+ },
368
+
369
+ {
370
+ name: "Custom 00-42-34",
371
+ code: `<section class=" flex flex-col items-center p-40 gap-16 justify-center">
372
+ <div class="flex gap-8 flex-row items-center">
373
+ <Button
374
+ ><Icon>
375
+ <FourLeafClover />
376
+ </Icon></Button
377
+ >
378
+ <Button>Default</Button>
379
+ <Button variant="gray">Gray</Button>
380
+ <Button variant="filled">Filled</Button>
381
+ <Button variant="outline">Outline</Button>
382
+ <Button variant="borderless">Borderless</Button>
383
+ <Button href="#" variant="link">About</Button>
384
+ </div>
385
+ <div class="flex gap-8 flex-row items-center">
386
+ <Button disabled
387
+ ><Icon>
388
+ <FourLeafClover />
389
+ </Icon></Button
390
+ >
391
+ <Button disabled>Default</Button>
392
+ <Button disabled variant="gray">Gray</Button>
393
+ <Button disabled variant="filled">Filled</Button>
394
+ <Button disabled variant="outline">Outline</Button>
395
+ <Button disabled variant="borderless">Borderless</Button>
396
+ <Button disabled href="#" variant="link">About</Button>
397
+ </div>
398
+ <div class="flex gap-8 flex-row items-center">
399
+ <Button size="md"
400
+ ><Icon>
401
+ <FourLeafClover />
402
+ </Icon></Button
403
+ >
404
+ <Button size="md">Default</Button>
405
+ <Button size="md" variant="gray">Gray</Button>
406
+ <Button size="md" variant="filled">Filled</Button>
407
+ <Button size="md" variant="outline">Outline</Button>
408
+ <Button size="md" variant="borderless">Borderless</Button>
409
+ <Button size="md" href="#" variant="link">About</Button>
410
+ </div>
411
+ <div class="flex gap-8 flex-row items-center">
412
+ <Button size="lg"
413
+ ><Icon>
414
+ <FourLeafClover />
415
+ </Icon></Button
416
+ >
417
+ <Button size="lg">Default</Button>
418
+ <Button size="lg" variant="gray">Gray</Button>
419
+ <Button size="lg" variant="filled">Filled</Button>
420
+ <Button size="lg" variant="outline">Outline</Button>
421
+ <Button size="lg" variant="borderless">Borderless</Button>
422
+ <Button size="lg" href="#" variant="link">About</Button>
423
+ </div>
424
+ <div class="flex gap-8 flex-row items-center">
425
+ <Button
426
+ ><Icon>
427
+ <FourLeafClover />
428
+ </Icon></Button
429
+ >
430
+ <Button
431
+ ><Icon>
432
+ <FourLeafClover />
433
+ </Icon>Default</Button
434
+ >
435
+ <Button variant="gray"
436
+ ><Icon>
437
+ <FourLeafClover />
438
+ </Icon>Gray</Button
439
+ >
440
+ <Button variant="filled"
441
+ ><Icon>
442
+ <FourLeafClover />
443
+ </Icon>Filled</Button
444
+ >
445
+ <Button variant="outline"
446
+ ><Icon>
447
+ <FourLeafClover />
448
+ </Icon>Outline</Button
449
+ >
450
+ <Button variant="borderless"
451
+ ><Icon>
452
+ <FourLeafClover />
453
+ </Icon>Borderless</Button
454
+ >
455
+ </div>
456
+ <div class="flex gap-8 flex-row items-center">
457
+ <Button size="md"
458
+ ><Icon>
459
+ <FourLeafClover />
460
+ </Icon></Button
461
+ >
462
+ <Button size="md"
463
+ ><Icon>
464
+ <FourLeafClover />
465
+ </Icon>Default</Button
466
+ >
467
+ <Button variant="gray" size="md"
468
+ ><Icon>
469
+ <FourLeafClover />
470
+ </Icon>Gray</Button
471
+ >
472
+ <Button variant="filled" size="md"
473
+ ><Icon>
474
+ <FourLeafClover />
475
+ </Icon>Filled</Button
476
+ >
477
+ <Button variant="outline" size="md"
478
+ ><Icon>
479
+ <FourLeafClover />
480
+ </Icon>Outline</Button
481
+ >
482
+ <Button variant="borderless" size="md"
483
+ ><Icon>
484
+ <FourLeafClover />
485
+ </Icon>Borderless</Button
486
+ >
487
+ </div>
488
+ <div class="flex gap-8 flex-row items-center">
489
+ <Button size="lg"
490
+ ><Icon>
491
+ <FourLeafClover />
492
+ </Icon></Button
493
+ >
494
+ <Button size="lg"
495
+ ><Icon>
496
+ <FourLeafClover />
497
+ </Icon>Default</Button
498
+ >
499
+ <Button variant="gray" size="lg"
500
+ ><Icon>
501
+ <FourLeafClover />
502
+ </Icon>Gray</Button
503
+ >
504
+ <Button variant="filled" size="lg"
505
+ ><Icon>
506
+ <FourLeafClover />
507
+ </Icon>Filled</Button
508
+ >
509
+ <Button variant="outline" size="lg"
510
+ ><Icon>
511
+ <FourLeafClover />
512
+ </Icon>Outline</Button
513
+ >
514
+ <Button variant="borderless" size="lg"
515
+ ><Icon>
516
+ <FourLeafClover />
517
+ </Icon>Borderless</Button
518
+ >
519
+ </div>
520
+ <div class="flex gap-8 flex-row items-center">
521
+ <Button
522
+ ><Icon>
523
+ <FourLeafClover />
524
+ </Icon></Button
525
+ >
526
+ <Button variant="gray"
527
+ ><Icon>
528
+ <FourLeafClover />
529
+ </Icon></Button
530
+ >
531
+ <Button variant="filled"
532
+ ><Icon>
533
+ <FourLeafClover />
534
+ </Icon></Button
535
+ >
536
+ <Button variant="outline"
537
+ ><Icon>
538
+ <FourLeafClover />
539
+ </Icon></Button
540
+ >
541
+ <Button variant="borderless"
542
+ ><Icon>
543
+ <FourLeafClover />
544
+ </Icon></Button
545
+ >
546
+ </div>
547
+ <div class="flex gap-8 flex-row items-center">
548
+ <Button size="md"
549
+ ><Icon>
550
+ <FourLeafClover />
551
+ </Icon></Button
552
+ >
553
+ <Button variant="gray" size="md"
554
+ ><Icon>
555
+ <FourLeafClover />
556
+ </Icon></Button
557
+ >
558
+ <Button variant="filled" size="md"
559
+ ><Icon>
560
+ <FourLeafClover />
561
+ </Icon></Button
562
+ >
563
+ <Button variant="outline" size="md"
564
+ ><Icon>
565
+ <FourLeafClover />
566
+ </Icon></Button
567
+ >
568
+ <Button variant="borderless" size="md"
569
+ ><Icon>
570
+ <FourLeafClover />
571
+ </Icon></Button
572
+ >
573
+ </div>
574
+ <div class="flex gap-8 flex-row items-center">
575
+ <Button size="lg"
576
+ ><Icon>
577
+ <FourLeafClover />
578
+ </Icon></Button
579
+ >
580
+ <Button variant="gray" size="lg"
581
+ ><Icon>
582
+ <FourLeafClover />
583
+ </Icon></Button
584
+ >
585
+ <Button variant="filled" size="lg"
586
+ ><Icon>
587
+ <FourLeafClover />
588
+ </Icon></Button
589
+ >
590
+ <Button variant="outline" size="lg"
591
+ ><Icon>
592
+ <FourLeafClover />
593
+ </Icon></Button
594
+ >
595
+ <Button variant="borderless" size="lg"
596
+ ><Icon>
597
+ <FourLeafClover />
598
+ </Icon></Button
599
+ >
600
+ </div>
601
+ </section>`,
602
+ logic: ["UserCreated"],
603
+ },
604
+ {
605
+ name: "Custom 23-00-59",
606
+ code: `<Button iconButton={16}>
607
+ <FourLeafClover />
608
+ </Button>
609
+ <Button iconButton={20}>
610
+ <FourLeafClover />
611
+ </Button>
612
+ <Button iconButton={24}>
613
+ <FourLeafClover />
614
+ </Button>
615
+ <Button iconButton={32}>
616
+ <FourLeafClover />
617
+ </Button>
618
+ <Button iconButton={40}>
619
+ <FourLeafClover />
620
+ </Button>
621
+ <Button iconButton={48}>
622
+ <FourLeafClover />
623
+ </Button>
624
+ <Button iconButton={80}>
625
+ <FourLeafClover />
626
+ </Button>
627
+ <Button iconButton={80}>
628
+ 文字
629
+ </Button>`,
630
+ logic: ["UserCreated"],
631
+ },] as const;