@snowui-design-system/components 0.1.0 → 0.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/package.json +9 -3
- package/src/components/Accordion.md +218 -0
- package/src/components/Accordion.svelte +301 -0
- package/src/components/Accordion.test.ts +126 -0
- package/src/components/AccordionItem.md +114 -0
- package/src/components/AccordionItem.svelte +389 -0
- package/src/components/AccordionItem.test.ts +52 -0
- package/src/components/Avatar.md +54 -36
- package/src/components/Avatar.svelte +73 -126
- package/src/components/AvatarGroup.md +17 -14
- package/src/components/AvatarGroup.svelte +12 -50
- package/src/components/AvatarGroup.test.ts +69 -68
- package/src/components/Badge.md +53 -8
- package/src/components/Badge.svelte +303 -79
- package/src/components/Badge.test.ts +47 -0
- package/src/components/Breadcrumb.md +164 -0
- package/src/components/Breadcrumb.svelte +330 -0
- package/src/components/Breadcrumb.test.ts +154 -0
- package/src/components/Button.md +243 -57
- package/src/components/Button.svelte +278 -177
- package/src/components/Button.test.ts +175 -86
- package/src/components/ButtonGroup.md +140 -0
- package/src/components/ButtonGroup.svelte +491 -0
- package/src/components/ButtonGroup.test.ts +58 -0
- package/src/components/Card.md +186 -0
- package/src/components/Card.svelte +408 -0
- package/src/components/Card.test.ts +193 -0
- package/src/components/Checkbox.md +14 -10
- package/src/components/Checkbox.svelte +39 -99
- package/src/components/Chip.md +185 -0
- package/src/components/Chip.svelte +241 -0
- package/src/components/Chip.test.ts +117 -0
- package/src/components/CodeBlock.md +29 -16
- package/src/components/CodeBlock.svelte +132 -352
- package/src/components/CodeBlock.test.ts +15 -1
- package/src/components/CopyButton.md +41 -0
- package/src/components/CopyButton.svelte +164 -0
- package/src/components/CopyButton.test.ts +26 -0
- package/src/components/Dialog.md +95 -0
- package/src/components/Dialog.svelte +416 -0
- package/src/components/Dialog.test.ts +145 -0
- package/src/components/ExpandButton.md +41 -0
- package/src/components/ExpandButton.svelte +103 -0
- package/src/components/ExpandButton.test.ts +18 -0
- package/src/components/Form.md +4 -3
- package/src/components/Form.test.ts +72 -73
- package/src/components/Frame.md +243 -0
- package/src/components/Frame.svelte +208 -87
- package/src/components/Frame.test.ts +121 -0
- package/src/components/Icon.md +34 -6
- package/src/components/Icon.svelte +46 -95
- package/src/components/Image.md +24 -13
- package/src/components/Image.svelte +42 -128
- package/src/components/ImageGroup.md +6 -7
- package/src/components/ImageGroup.svelte +1 -28
- package/src/components/Indicator.md +92 -0
- package/src/components/Indicator.svelte +490 -0
- package/src/components/Indicator.test.ts +57 -0
- package/src/components/Input.md +81 -28
- package/src/components/Input.svelte +291 -178
- package/src/components/Input.test.ts +85 -48
- package/src/components/Kbd.md +0 -3
- package/src/components/Kbd.svelte +0 -1
- package/src/components/Link.md +192 -0
- package/src/components/Link.svelte +464 -0
- package/src/components/Link.test.ts +110 -0
- package/src/components/Listbox.md +52 -10
- package/src/components/Listbox.svelte +204 -50
- package/src/components/Listbox.test.ts +76 -33
- package/src/components/LocaleProvider.md +52 -0
- package/src/components/LocaleProvider.svelte +30 -0
- package/src/components/LocaleProvider.test.ts +32 -0
- package/src/components/MenuItem.md +23 -9
- package/src/components/MenuItem.svelte +57 -47
- package/src/components/MenuItem.test.ts +72 -65
- package/src/components/Pagination.md +504 -0
- package/src/components/Pagination.svelte +958 -0
- package/src/components/Pagination.test.ts +316 -0
- package/src/components/Popover.md +245 -42
- package/src/components/Popover.svelte +558 -127
- package/src/components/Popover.test.ts +361 -44
- package/src/components/Progress.md +91 -0
- package/src/components/Progress.svelte +374 -0
- package/src/components/Progress.test.ts +56 -0
- package/src/components/Radio.md +4 -6
- package/src/components/Radio.svelte +25 -117
- package/src/components/ScrollArea.md +116 -0
- package/src/components/ScrollArea.svelte +180 -0
- package/src/components/ScrollArea.test.ts +84 -0
- package/src/components/SearchInput.md +135 -0
- package/src/components/SearchInput.svelte +153 -0
- package/src/components/SearchInput.test.ts +61 -0
- package/src/components/Select.md +39 -8
- package/src/components/Select.svelte +196 -45
- package/src/components/Select.test.ts +79 -41
- package/src/components/SelectButton.md +50 -0
- package/src/components/SelectButton.svelte +186 -0
- package/src/components/SelectButton.test.ts +142 -0
- package/src/components/Separator.md +89 -0
- package/src/components/Separator.svelte +143 -0
- package/src/components/Separator.test.ts +35 -0
- package/src/components/Skeleton.md +2 -5
- package/src/components/Skeleton.svelte +202 -7
- package/src/components/Skeleton.test.ts +10 -10
- package/src/components/Slider.md +101 -0
- package/src/components/Slider.svelte +566 -0
- package/src/components/Slider.test.ts +51 -0
- package/src/components/Spinner.md +3 -4
- package/src/components/Spinner.svelte +11 -23
- package/src/components/{Toggle.md → Switch.md} +20 -21
- package/src/components/Switch.svelte +314 -0
- package/src/components/Switch.test.ts +57 -0
- package/src/components/Table.md +249 -0
- package/src/components/Table.svelte +139 -0
- package/src/components/Table.test.ts +64 -0
- package/src/components/TableBody.md +63 -0
- package/src/components/TableBody.svelte +78 -0
- package/src/components/TableBody.test.ts +13 -0
- package/src/components/TableCell.md +89 -0
- package/src/components/TableCell.svelte +368 -0
- package/src/components/TableCell.test.ts +51 -0
- package/src/components/TableHead.md +129 -0
- package/src/components/TableHead.svelte +281 -0
- package/src/components/TableHead.test.ts +44 -0
- package/src/components/TableHeader.md +26 -0
- package/src/components/TableHeader.svelte +10 -0
- package/src/components/TableHeader.test.ts +3 -0
- package/src/components/TableRow.md +36 -0
- package/src/components/TableRow.svelte +64 -0
- package/src/components/TableRow.test.ts +2 -0
- package/src/components/TableToolbar.svelte +260 -0
- package/src/components/Tag.md +270 -0
- package/src/components/Tag.svelte +462 -0
- package/src/components/Tag.test.ts +91 -0
- package/src/components/Text.md +87 -25
- package/src/components/Text.svelte +467 -93
- package/src/components/Text.test.ts +21 -36
- package/src/components/Textarea.md +22 -7
- package/src/components/Textarea.svelte +76 -155
- package/src/components/Textarea.test.ts +12 -5
- package/src/components/Tooltip.md +101 -12
- package/src/components/Tooltip.svelte +581 -108
- package/src/components/Tooltip.test.ts +63 -1
- package/src/context.ts +93 -5
- package/src/dev.ts +6 -10
- package/src/i18n/locale.svelte.ts +60 -0
- package/src/i18n/messages.ts +45 -0
- package/src/index.ts +177 -2
- package/src/keys.ts +7 -0
- package/src/lib/clipboard.ts +10 -0
- package/src/lib/color.md +36 -0
- package/src/lib/color.ts +57 -0
- package/src/lib/date-format.md +37 -0
- package/src/lib/date-format.ts +130 -0
- package/src/lib/edge-fade.md +101 -0
- package/src/lib/edge-fade.ts +55 -0
- package/src/lib/floating-position.md +20 -0
- package/src/lib/floating-position.ts +107 -0
- package/src/lib/number-format.md +40 -0
- package/src/lib/number-format.ts +132 -0
- package/src/lib/overlay-scrollbar.md +36 -0
- package/src/lib/overlay-scrollbar.svelte.ts +221 -0
- package/src/lib/overlay-trigger-timing.md +15 -0
- package/src/lib/overlay-trigger-timing.ts +8 -0
- package/src/lib/progressive-blur.md +95 -0
- package/src/lib/progressive-blur.ts +266 -0
- package/src/lib/resizable.md +41 -0
- package/src/lib/resizable.ts +211 -0
- package/src/lib/table-context.svelte.ts +129 -0
- package/src/lib/table-row-context.svelte.ts +16 -0
- package/src/lib/tooltip-behavior.ts +39 -0
- package/src/lib/tooltip-delay.md +33 -0
- package/src/lib/tooltip-delay.ts +49 -0
- package/src/lib/tooltip-overlay.md +30 -0
- package/src/lib/tooltip-overlay.ts +64 -0
- package/src/lib/truncate.md +7 -2
- package/src/lib/truncate.ts +105 -10
- package/src/logic/README.md +17 -7
- package/src/logic/component-parts.md +32 -0
- package/src/logic/component-parts.svelte.ts +130 -0
- package/src/logic/dialog.md +30 -0
- package/src/logic/dialog.svelte.ts +88 -0
- package/src/logic/frame-actions.md +28 -0
- package/src/logic/frame-actions.svelte.ts +49 -0
- package/src/logic/frame-class-state.md +21 -0
- package/src/logic/frame-class-state.svelte.ts +163 -0
- package/src/logic/frame-dom-runtime.svelte.ts +51 -0
- package/src/logic/frame-inline-style.md +56 -0
- package/src/logic/frame-inline-style.svelte.ts +623 -0
- package/src/logic/frame-motion-defaults.md +90 -9
- package/src/logic/frame-motion-defaults.ts +55 -49
- package/src/logic/frame-motion.svelte.ts +173 -0
- package/src/logic/frame-perception.md +83 -0
- package/src/logic/frame-perception.svelte.ts +273 -0
- package/src/logic/frame-prop-filter.ts +7 -1
- package/src/logic/frame-scale-observer.md +153 -0
- package/src/logic/frame-scale-observer.svelte.ts +98 -0
- package/src/logic/frame-scale-resolver.md +25 -0
- package/src/logic/frame-scale-resolver.svelte.ts +56 -0
- package/src/logic/frame-state-value.md +74 -0
- package/src/logic/frame-state-value.ts +30 -0
- package/src/logic/frame-state.svelte.ts +426 -0
- package/src/logic/frame-truncation.md +17 -3
- package/src/logic/frame-truncation.svelte.ts +23 -43
- package/src/logic/frame-types.md +2 -1
- package/src/logic/frame-types.ts +41 -7
- package/src/logic/frame-utils.md +4 -0
- package/src/logic/frame-utils.ts +54 -26
- package/src/logic/image-preview.md +9 -2
- package/src/logic/image-preview.ts +33 -7
- package/src/logic/morph.md +19 -0
- package/src/logic/morph.ts +7 -0
- package/src/logic/motion-config.ts +49 -3
- package/src/logic/motion-engine.md +43 -0
- package/src/logic/motion-engine.ts +272 -0
- package/src/logic/overlay-presence.svelte.ts +71 -0
- package/src/logic/popover.md +89 -0
- package/src/logic/popover.svelte.ts +236 -0
- package/src/logic/resource-size.md +21 -0
- package/src/logic/resource-size.ts +53 -0
- package/src/logic/text-collapse.md +2 -1
- package/src/logic/text-collapse.svelte.ts +1 -1
- package/src/logic/wc-adapter.ts +1 -1
- package/src/motion/README.md +97 -37
- package/src/motion/{defaults/bridge.md → bridge.md} +24 -4
- package/src/motion/{defaults/bridge.ts → bridge.ts} +16 -5
- package/src/motion/{defaults/content-crossfade.ts → content-crossfade.ts} +1 -1
- package/src/motion/{defaults/expand.md → expand.md} +2 -2
- package/src/motion/{defaults/expand.ts → expand.ts} +4 -3
- package/src/motion/fade-in.md +40 -0
- package/src/motion/fade-in.ts +14 -0
- package/src/motion/{defaults/fade-out.md → fade-out.md} +2 -2
- package/src/motion/fade-out.ts +14 -0
- package/src/motion/{defaults/morph.md → morph.md} +1 -1
- package/src/motion/{defaults/morph.ts → morph.ts} +3 -3
- package/src/motion/move.md +179 -0
- package/src/motion/move.ts +74 -0
- package/src/motion/number.md +50 -0
- package/src/motion/number.ts +30 -0
- package/src/motion/presets/README.md +50 -0
- package/src/motion/presets/dialog.md +20 -0
- package/src/motion/presets/dialog.ts +47 -0
- package/src/motion/presets/effects.md +32 -0
- package/src/motion/presets/effects.ts +111 -0
- package/src/motion/presets/generic.md +27 -0
- package/src/motion/presets/generic.ts +32 -0
- package/src/motion/presets/overlay.md +21 -0
- package/src/motion/presets/overlay.ts +18 -0
- package/src/motion/presets/replacement.md +19 -0
- package/src/motion/presets/replacement.ts +6 -0
- package/src/motion/presets/resize.md +23 -0
- package/src/motion/presets/resize.ts +16 -0
- package/src/motion/presets/tab.md +21 -0
- package/src/motion/presets/tab.ts +19 -0
- package/src/motion/presets/tooltip.md +20 -0
- package/src/motion/presets/tooltip.ts +37 -0
- package/src/motion/presets/utils.md +15 -0
- package/src/motion/presets/utils.ts +11 -0
- package/src/motion/primitives.md +22 -0
- package/src/motion/primitives.ts +46 -0
- package/src/motion/{defaults/replace.md → replace.md} +2 -2
- package/src/motion/{defaults/replace.ts → replace.ts} +4 -4
- package/src/motion/{defaults/rotate.md → rotate.md} +4 -4
- package/src/motion/{defaults/rotate.ts → rotate.ts} +4 -3
- package/src/motion/scale-in.md +40 -0
- package/src/motion/scale-in.ts +19 -0
- package/src/motion/spring.md +19 -0
- package/src/motion/spring.ts +96 -0
- package/src/motion/tokens.md +45 -0
- package/src/motion/tokens.ts +80 -0
- package/src/motion/{defaults/while-2xl.ts → while-2xl.ts} +1 -1
- package/src/motion/{defaults/while-active.ts → while-active.ts} +1 -1
- package/src/motion/while-appear.ts +10 -0
- package/src/motion/{defaults/while-click.ts → while-click.ts} +1 -1
- package/src/motion/{defaults/while-collapsed.ts → while-collapsed.ts} +1 -1
- package/src/motion/{defaults/while-disabled.ts → while-disabled.ts} +3 -2
- package/src/motion/while-disappear.ts +10 -0
- package/src/motion/{defaults/while-drag.ts → while-drag.ts} +1 -1
- package/src/motion/{defaults/while-editing.ts → while-editing.ts} +1 -1
- package/src/motion/{defaults/while-expanded.ts → while-expanded.ts} +1 -1
- package/src/motion/{defaults/while-focus.ts → while-focus.ts} +1 -1
- package/src/motion/{defaults/while-hover.ts → while-hover.ts} +1 -1
- package/src/motion/{defaults/while-idle.ts → while-idle.ts} +1 -1
- package/src/motion/{defaults/while-key.ts → while-key.ts} +1 -1
- package/src/motion/{defaults/while-lg.ts → while-lg.ts} +1 -1
- package/src/motion/{defaults/while-load.ts → while-load.ts} +3 -2
- package/src/motion/{defaults/while-md.ts → while-md.ts} +1 -1
- package/src/motion/{defaults/while-reload.ts → while-reload.ts} +1 -1
- package/src/motion/{defaults/while-scroll.ts → while-scroll.ts} +1 -1
- package/src/motion/{defaults/while-sm.ts → while-sm.ts} +1 -1
- package/src/motion/{defaults/while-uploading.ts → while-uploading.ts} +1 -1
- package/src/motion/{defaults/while-validating.ts → while-validating.ts} +1 -1
- package/src/motion/{defaults/while-xl.ts → while-xl.ts} +1 -1
- package/src/motion/{defaults/while-xs.ts → while-xs.ts} +1 -1
- package/src/styles/auto-layout.css +92 -10
- package/src/styles/layout.css +370 -30
- package/src/styles/scrollbar.css +72 -7
- package/src/App.svelte +0 -103
- package/src/components/QuickAction.md +0 -146
- package/src/components/QuickAction.svelte +0 -161
- package/src/components/QuickAction.test.ts +0 -299
- package/src/components/Test.md +0 -72
- package/src/components/Test.svelte +0 -106
- package/src/components/Test.test.ts +0 -27
- package/src/components/Toggle.svelte +0 -384
- package/src/components/Toggle.test.ts +0 -57
- package/src/logic/frame-profile.md +0 -156
- package/src/logic/frame-profile.ts +0 -130
- package/src/motion/NumberFlow.md +0 -16
- package/src/motion/defaults/fade-out.ts +0 -14
- package/src/motion/defaults/move.md +0 -81
- package/src/motion/defaults/move.ts +0 -31
- package/src/motion/defaults/number.md +0 -41
- package/src/motion/defaults/number.ts +0 -17
- package/src/motion/defaults/while-appear.ts +0 -12
- package/src/motion/defaults/while-disappear.ts +0 -12
- package/src//344/273/243/347/240/201.txt +0 -61
- /package/src/motion/{defaults/rotate.css → rotate.css} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Button.test.ts
|
|
3
|
-
* v1.4.
|
|
4
|
-
* 变更记录 (2026-
|
|
5
|
-
* 变更记录 (2026-
|
|
6
|
-
* 变更记录 (2026-03-15):
|
|
3
|
+
* v1.4.2
|
|
4
|
+
* 变更记录 (2026-07-05): 新增 backgroundBlur 开启状态示例。
|
|
5
|
+
* 变更记录 (2026-05-18): 新增 B6 复制按钮示例,覆盖 P0.2 瞬时反馈模式:副作用挂 onclick,状态切换与内容回弹由 Frame 接管。
|
|
6
|
+
* 变更记录 (2026-03-15): 修复 B3 图标按钮示例运行时错误,示例下拉图标改为 test 沙箱已注入的 `ArrowLineDown`。
|
|
7
7
|
* 变更记录 (2026-02-04): H1 示例使用 Icon 组件,避免未导入的 Command 组件导致运行时错误。
|
|
8
8
|
* 变更记录 (2026-02-26): 修复 B1/B2/D1/F1/G1/G2/G3/H1 示例为当前 Button/Frame 能力;重写 H2 为直观对比并补充说明。
|
|
9
|
-
* 变更记录 (2026-02-26): D1 右侧改为 C6 同款状态链流转;G1 增加 count 加减与
|
|
9
|
+
* 变更记录 (2026-02-26): D1 右侧改为 C6 同款状态链流转;G1 增加 count 加减与 FlowText 数字滚动动效。
|
|
10
10
|
* 变更记录 (2026-02-26): D1 改为“仅 Button”点击状态流:Ready -> Loading -> Completed -> Disabled,并去除额外点击动效。
|
|
11
11
|
* 变更记录 (2026-02-26): D1 改为纯 Frame 状态链能力(Button 透传 currentState),移除手动 DOM 状态推进。
|
|
12
12
|
* 变更记录 (2026-02-26): 修复 D1 按钮不可点击(移除 whileLoad/whileActive,避免触发 skeleton 的 pointer-events:none)。
|
|
@@ -24,7 +24,8 @@ export const examples = [
|
|
|
24
24
|
<Button variant="filled">Filled</Button>
|
|
25
25
|
<Button variant="outline">Outline</Button>
|
|
26
26
|
<Button variant="borderless">Borderless</Button>
|
|
27
|
-
<Button
|
|
27
|
+
<Button bare>Bare</Button>
|
|
28
|
+
<Button bare aria-label="减少"><Minus /></Button>`,
|
|
28
29
|
|
|
29
30
|
logic: ["Style"],
|
|
30
31
|
},
|
|
@@ -58,6 +59,41 @@ export const examples = [
|
|
|
58
59
|
|
|
59
60
|
logic: ["State"],
|
|
60
61
|
},
|
|
62
|
+
{
|
|
63
|
+
name: "A4: 无外壳按钮 (Bare)",
|
|
64
|
+
code: `A4
|
|
65
|
+
<div class="flex-row gap-12 items-center">
|
|
66
|
+
<Button bare>All</Button>
|
|
67
|
+
<Button bare><FourLeafClover size={24} /></Button>
|
|
68
|
+
<Button bare disabled>Disabled</Button>
|
|
69
|
+
</div>`,
|
|
70
|
+
|
|
71
|
+
expected: {
|
|
72
|
+
render: "无外壳按钮可包含文字或 Icon,无 padding、圆角、背景和边框,默认以 40% 透明度显示。",
|
|
73
|
+
layout: "按钮尺寸由内部内容自然撑开。",
|
|
74
|
+
interaction: "可用按钮 hover 时透明度提升到 100%,禁用按钮不响应 hover。",
|
|
75
|
+
performance: "仅通过 Button class 与 CSS 变量切换视觉。",
|
|
76
|
+
responsive: "字号与行高继续跟随 Button size。",
|
|
77
|
+
},
|
|
78
|
+
logic: ["Style", "State", "Bare"],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "A5: 背景模糊 (Background Blur)",
|
|
82
|
+
code: `A5
|
|
83
|
+
<div class="bg-gradient-indigo p-40 rounded-12">
|
|
84
|
+
<Button size="md" variant="gray" backgroundBlur>
|
|
85
|
+
Background Blur
|
|
86
|
+
</Button>
|
|
87
|
+
</div>`,
|
|
88
|
+
expected: {
|
|
89
|
+
render: "gray Button 保持半透明背景,并模糊按钮背后的渐变内容。",
|
|
90
|
+
layout: "Button 使用 md 尺寸,外层仅提供便于观察模糊效果的背景。",
|
|
91
|
+
interaction: "hover 与点击行为保持普通 gray Button 语义。",
|
|
92
|
+
performance: "仅在显式 backgroundBlur 时启用 backdrop-filter。",
|
|
93
|
+
responsive: "按钮尺寸与模糊强度不随示例容器变化。",
|
|
94
|
+
},
|
|
95
|
+
logic: ["Style", "BackgroundBlur"],
|
|
96
|
+
},
|
|
61
97
|
{
|
|
62
98
|
name: "B1: 内容组合 (Composition)",
|
|
63
99
|
code: `B1
|
|
@@ -97,48 +133,149 @@ export const examples = [
|
|
|
97
133
|
logic: ["Composition"],
|
|
98
134
|
},
|
|
99
135
|
{
|
|
100
|
-
name: "B3:
|
|
136
|
+
name: "B3: Bare 单 Icon 与混合内容",
|
|
101
137
|
code: `B3
|
|
102
138
|
<div class="flex-col gap-12">
|
|
103
139
|
<div class="flex-row gap-8 items-center">
|
|
104
|
-
<Button
|
|
105
|
-
<Minus />
|
|
140
|
+
<Button bare aria-label="减少">
|
|
141
|
+
<Minus size={12} />
|
|
106
142
|
</Button>
|
|
107
|
-
<Button
|
|
108
|
-
<FourLeafClover />
|
|
143
|
+
<Button bare aria-label="筛选">
|
|
144
|
+
<FourLeafClover size={16} />
|
|
109
145
|
</Button>
|
|
110
|
-
<Button
|
|
111
|
-
<
|
|
146
|
+
<Button bare size="lg" variant="filled" aria-label="展开">
|
|
147
|
+
<ArrowLineDown />
|
|
112
148
|
</Button>
|
|
113
|
-
<Button
|
|
114
|
-
<Plus />
|
|
149
|
+
<Button bare aria-label="增加">
|
|
150
|
+
<Plus size={24} />
|
|
115
151
|
</Button>
|
|
116
152
|
</div>
|
|
117
153
|
<div class="flex-row gap-8 items-center p-8 rounded-12 bg-surface-1">
|
|
118
154
|
<Input placeholder="搜索内容" />
|
|
119
|
-
<Button
|
|
120
|
-
<
|
|
155
|
+
<Button bare size="md" variant="outline" aria-label="展开筛选">
|
|
156
|
+
<ArrowLineDown />
|
|
121
157
|
</Button>
|
|
122
|
-
<Button
|
|
123
|
-
<Minus />
|
|
158
|
+
<Button bare aria-label="清空输入">
|
|
159
|
+
<Minus size={16} />
|
|
124
160
|
</Button>
|
|
125
161
|
</div>
|
|
126
162
|
<div class="flex-row gap-8 items-center">
|
|
127
|
-
<Button
|
|
163
|
+
<Button bare variant="filled">
|
|
128
164
|
仅文本内容
|
|
129
165
|
</Button>
|
|
130
|
-
<Button
|
|
166
|
+
<Button bare size="lg" variant="outline">
|
|
131
167
|
<FourLeafClover />
|
|
132
168
|
带文字图标
|
|
133
169
|
</Button>
|
|
134
170
|
</div>
|
|
135
171
|
<div class="text-12 text-black-40">
|
|
136
|
-
说明:
|
|
172
|
+
说明:bare 忽略 filled/outline 等 variant 的视觉结果。单 Icon 默认继承当前 size 档位的 12/16/20px 尺寸上下文,并获得至少 16×16px 的透明点击热区;精确尺寸直接声明在子 Icon 上。Icon + 文字继续保留普通 Button 的内容 gap。
|
|
137
173
|
</div>
|
|
138
174
|
</div>`,
|
|
139
175
|
|
|
140
176
|
logic: ["Composition", "State"],
|
|
141
177
|
},
|
|
178
|
+
{
|
|
179
|
+
name: "B4: Toggle 切换 (toggle prop 语法糖 / 等价完整声明)",
|
|
180
|
+
code: `B4
|
|
181
|
+
<div class="flex-col gap-16">
|
|
182
|
+
<div class="flex-row gap-8 items-center">
|
|
183
|
+
<Button toggle>
|
|
184
|
+
<Icon><Bell /></Icon>
|
|
185
|
+
通知
|
|
186
|
+
</Button>
|
|
187
|
+
<Button variant="outline" toggle>
|
|
188
|
+
<Icon><Star /></Icon>
|
|
189
|
+
收藏
|
|
190
|
+
</Button>
|
|
191
|
+
<Button
|
|
192
|
+
whileClick={false}
|
|
193
|
+
Click={{ Idle: "Active", Active: "Idle" }}
|
|
194
|
+
>
|
|
195
|
+
<Icon><Heart /></Icon>
|
|
196
|
+
等价完整写法
|
|
197
|
+
</Button>
|
|
198
|
+
</div>
|
|
199
|
+
<div class="text-12 text-black-40">
|
|
200
|
+
说明:Toggle 由 Frame 状态机驱动。<Button toggle> 是语法糖,内部自动注入 Click={"{ Idle: 'Active', Active: 'Idle' }"} 与 whileClick=false;Active 状态由 Frame 自动暴露的 data-state="Active" 触发 Secondary/Indigo 配色(与 Tag variant="active" 一致);aria-pressed 由 Frame 自动输出。消费方需要复杂状态机时绕过 toggle 直接写 Click 字典即可。
|
|
201
|
+
</div>
|
|
202
|
+
</div>`,
|
|
203
|
+
|
|
204
|
+
logic: ["Toggle", "State"],
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "B5: 瞬时反馈 (Click + Active=[Idle,auto])",
|
|
208
|
+
code: `B5
|
|
209
|
+
<div class="flex-col gap-16">
|
|
210
|
+
<div class="flex-row gap-8 items-center">
|
|
211
|
+
<Button
|
|
212
|
+
variant="outline"
|
|
213
|
+
whileClick={false}
|
|
214
|
+
Click="Active"
|
|
215
|
+
Active={["Idle", "auto"]}
|
|
216
|
+
whileActive={{ duration: 2000 }}
|
|
217
|
+
>
|
|
218
|
+
<Icon><Paperclip /></Icon>
|
|
219
|
+
复制内容
|
|
220
|
+
</Button>
|
|
221
|
+
<Button
|
|
222
|
+
variant="filled"
|
|
223
|
+
whileClick={false}
|
|
224
|
+
Click="Active"
|
|
225
|
+
Active={["Idle", "auto"]}
|
|
226
|
+
whileActive={{ duration: 1500 }}
|
|
227
|
+
stateClass={{ Idle: "", Active: "opacity-40" }}
|
|
228
|
+
>
|
|
229
|
+
<Icon><PaperPlaneRight /></Icon>
|
|
230
|
+
发送
|
|
231
|
+
</Button>
|
|
232
|
+
</div>
|
|
233
|
+
<div class="text-12 text-black-40">
|
|
234
|
+
说明:Click="Active" 进入 Active;Active={"[\\"Idle\\", \\"auto\\"]"} 自动回弹到 Idle;whileActive.duration 只用作 Active 停留时长。复制按钮 variant="outline",在 Active 期间由 Frame 自动暴露的 data-state="Active" 触发 Indigo 配色,无需手写 stateClass;发送按钮 variant="filled" 被默认 Indigo 规则排除,通过 stateClass={"{ Active: 'opacity-40' }"} 自定义反馈(说明消费方仍可通过 stateClass / stateStyle 完全自定义 Active 视觉)。
|
|
235
|
+
</div>
|
|
236
|
+
</div>`,
|
|
237
|
+
|
|
238
|
+
logic: ["Feedback", "Motion", "State"],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "B6: 复制按钮反馈 (Copy Feedback)",
|
|
242
|
+
code: `B6
|
|
243
|
+
<div class="flex-col gap-16">
|
|
244
|
+
<div class="flex-row gap-8 items-center">
|
|
245
|
+
<Button
|
|
246
|
+
variant="outline"
|
|
247
|
+
aria-label="复制 SnowUI Button 示例文本"
|
|
248
|
+
whileClick={false}
|
|
249
|
+
Click="Active"
|
|
250
|
+
Active={["Idle", "auto"]}
|
|
251
|
+
whileActive={{ duration: 2000 }}
|
|
252
|
+
stateClass={{ Idle: "", Active: "snowui-button-active" }}
|
|
253
|
+
onclick={() => void navigator.clipboard?.writeText("SnowUI Button")?.catch(() => {})}
|
|
254
|
+
>
|
|
255
|
+
<Icon stateIcon={{ Idle: Paperclip, Active: Check }} />
|
|
256
|
+
<Text stateText={{ Idle: "复制 SnowUI Button", Active: "已复制" }} />
|
|
257
|
+
</Button>
|
|
258
|
+
<Button
|
|
259
|
+
variant="filled"
|
|
260
|
+
aria-label="复制安装命令"
|
|
261
|
+
whileClick={false}
|
|
262
|
+
Click="Active"
|
|
263
|
+
Active={["Idle", "auto"]}
|
|
264
|
+
whileActive={{ duration: 2000 }}
|
|
265
|
+
stateClass={{ Idle: "", Active: "opacity-40" }}
|
|
266
|
+
onclick={() => void navigator.clipboard?.writeText("pnpm add @snowui-design-system/components")?.catch(() => {})}
|
|
267
|
+
>
|
|
268
|
+
<Icon stateIcon={{ Idle: Paperclip, Active: Check }} />
|
|
269
|
+
<Text stateText={{ Idle: "复制安装命令", Active: "已复制" }} />
|
|
270
|
+
</Button>
|
|
271
|
+
</div>
|
|
272
|
+
<div class="text-12 text-black-40">
|
|
273
|
+
说明:复制副作用只放在 onclick;Click="Active" 触发反馈态,Active={"{[\\"Idle\\", \\"auto\\"]}"} 在 2 秒后自动回弹;Icon 和 Text 通过父 Frame Context 读取 currentState 并声明式切换展示。
|
|
274
|
+
</div>
|
|
275
|
+
</div>`,
|
|
276
|
+
|
|
277
|
+
logic: ["Feedback", "Copy", "State"],
|
|
278
|
+
},
|
|
142
279
|
{
|
|
143
280
|
name: "C1: 角色化组合 - 提示 (Role-based Composition: Tooltip)",
|
|
144
281
|
code: `C1
|
|
@@ -158,28 +295,14 @@ export const examples = [
|
|
|
158
295
|
{
|
|
159
296
|
name: "D1: 状态流 (State Flow)",
|
|
160
297
|
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
298
|
<Button
|
|
174
299
|
whileClick={false}
|
|
175
|
-
Click={{ Idle: "
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}}
|
|
182
|
-
/>`,
|
|
300
|
+
Click={{ Idle: "Pending", Active: "Idle" }}
|
|
301
|
+
Pending={["Active", "auto"]}
|
|
302
|
+
>
|
|
303
|
+
<Icon stateIcon={{ Idle: null, Pending: Spinner, Active: Check }} />
|
|
304
|
+
<Text stateText={{ Idle: "Ready", Pending: "Loading...", Active: "Completed" }} />
|
|
305
|
+
</Button>`,
|
|
183
306
|
|
|
184
307
|
logic: ["State"],
|
|
185
308
|
},
|
|
@@ -216,24 +339,10 @@ export const examples = [
|
|
|
216
339
|
|
|
217
340
|
logic: ["Polymorphism"],
|
|
218
341
|
},
|
|
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
342
|
{
|
|
231
343
|
name: "F3: 长文本按钮(无内置截断)",
|
|
232
344
|
code: `F3
|
|
233
345
|
<div class="flex-col gap-16" style="width: 200px;">
|
|
234
|
-
<Button variant="link" href="#">
|
|
235
|
-
这是一个非常长的链接文本,Button 本身不处理截断,文本将自然换行。
|
|
236
|
-
</Button>
|
|
237
346
|
<Button variant="outline">
|
|
238
347
|
这也是一个很长的按钮文本,若需要截断请在内容侧使用 Text 组件的 lines 能力。
|
|
239
348
|
</Button>
|
|
@@ -256,7 +365,7 @@ export const examples = [
|
|
|
256
365
|
<Minus />
|
|
257
366
|
</Button>
|
|
258
367
|
<div class="text-24 font-semibold min-w-48" style="text-align: center;">
|
|
259
|
-
<
|
|
368
|
+
<FlowText
|
|
260
369
|
value={currentState === "Active" ? 6 : currentState === "Disabled" ? 4 : 5}
|
|
261
370
|
duration={500}
|
|
262
371
|
/>
|
|
@@ -266,7 +375,7 @@ export const examples = [
|
|
|
266
375
|
</Button>
|
|
267
376
|
</div>
|
|
268
377
|
<div class="text-12 text-black-40">
|
|
269
|
-
说明:点击计数器区域后数字按 5 -> 6 -> 4 -> 5 流转,
|
|
378
|
+
说明:点击计数器区域后数字按 5 -> 6 -> 4 -> 5 流转,FlowText 负责滚动过渡动效。
|
|
270
379
|
</div>
|
|
271
380
|
{/snippet}
|
|
272
381
|
</Frame>`,
|
|
@@ -380,7 +489,6 @@ export const examples = [
|
|
|
380
489
|
<Button variant="filled">Filled</Button>
|
|
381
490
|
<Button variant="outline">Outline</Button>
|
|
382
491
|
<Button variant="borderless">Borderless</Button>
|
|
383
|
-
<Button href="#" variant="link">About</Button>
|
|
384
492
|
</div>
|
|
385
493
|
<div class="flex gap-8 flex-row items-center">
|
|
386
494
|
<Button disabled
|
|
@@ -393,7 +501,6 @@ export const examples = [
|
|
|
393
501
|
<Button disabled variant="filled">Filled</Button>
|
|
394
502
|
<Button disabled variant="outline">Outline</Button>
|
|
395
503
|
<Button disabled variant="borderless">Borderless</Button>
|
|
396
|
-
<Button disabled href="#" variant="link">About</Button>
|
|
397
504
|
</div>
|
|
398
505
|
<div class="flex gap-8 flex-row items-center">
|
|
399
506
|
<Button size="md"
|
|
@@ -406,7 +513,6 @@ export const examples = [
|
|
|
406
513
|
<Button size="md" variant="filled">Filled</Button>
|
|
407
514
|
<Button size="md" variant="outline">Outline</Button>
|
|
408
515
|
<Button size="md" variant="borderless">Borderless</Button>
|
|
409
|
-
<Button size="md" href="#" variant="link">About</Button>
|
|
410
516
|
</div>
|
|
411
517
|
<div class="flex gap-8 flex-row items-center">
|
|
412
518
|
<Button size="lg"
|
|
@@ -419,7 +525,6 @@ export const examples = [
|
|
|
419
525
|
<Button size="lg" variant="filled">Filled</Button>
|
|
420
526
|
<Button size="lg" variant="outline">Outline</Button>
|
|
421
527
|
<Button size="lg" variant="borderless">Borderless</Button>
|
|
422
|
-
<Button size="lg" href="#" variant="link">About</Button>
|
|
423
528
|
</div>
|
|
424
529
|
<div class="flex gap-8 flex-row items-center">
|
|
425
530
|
<Button
|
|
@@ -603,29 +708,13 @@ export const examples = [
|
|
|
603
708
|
},
|
|
604
709
|
{
|
|
605
710
|
name: "Custom 23-00-59",
|
|
606
|
-
code: `<Button
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
<Button
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
<Button
|
|
613
|
-
|
|
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>`,
|
|
711
|
+
code: `<Button bare><FourLeafClover size={16} /></Button>
|
|
712
|
+
<Button bare><FourLeafClover size={20} /></Button>
|
|
713
|
+
<Button bare><FourLeafClover size={24} /></Button>
|
|
714
|
+
<Button bare><FourLeafClover size={32} /></Button>
|
|
715
|
+
<Button bare><FourLeafClover size={40} /></Button>
|
|
716
|
+
<Button bare><FourLeafClover size={48} /></Button>
|
|
717
|
+
<Button bare><FourLeafClover size={80} /></Button>
|
|
718
|
+
<Button bare>文字</Button>`,
|
|
630
719
|
logic: ["UserCreated"],
|
|
631
720
|
},] as const;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# ButtonGroup.svelte 文档
|
|
2
|
+
|
|
3
|
+
> **版本**: v1.0.0
|
|
4
|
+
> **职责**: 提供由多个 Button 单元格与 Separator 组成的拆分按钮容器。
|
|
5
|
+
|
|
6
|
+
**继承**: 复用 Frame.svelte 的通用能力。
|
|
7
|
+
**默认能力开关**: `enableResponsive=false`, `enableContext=true`, `enableScaleObserver=false`。
|
|
8
|
+
|
|
9
|
+
## 关键字 (Keyword)
|
|
10
|
+
|
|
11
|
+
| 关键字 | 类型 | 默认值 | 描述 |
|
|
12
|
+
| :--- | :--- | :--- | :--- |
|
|
13
|
+
| variant | `'gray' \| 'filled' \| 'outline' \| 'borderless'` | `'gray'` | 外壳视觉变体 |
|
|
14
|
+
| size | `'sm' \| 'md' \| 'lg'` | `'sm'` | 尺寸档位 |
|
|
15
|
+
| disabled | `boolean` | `false` | 禁用整个 ButtonGroup,并传递给内部嵌入态 Button |
|
|
16
|
+
| children | `Snippet` | - | 直接放置 Button / Separator |
|
|
17
|
+
| ...rest | `FrameProps` | - | 透传到根 Frame,保留状态、动效、事件、`data-*` 等能力 |
|
|
18
|
+
|
|
19
|
+
## 组件边界
|
|
20
|
+
|
|
21
|
+
- ButtonGroup 属于 OSS 组件,作用半径只覆盖自身一个 Frame 容器,不依赖 PRO 的跨 Frame 编排能力。
|
|
22
|
+
- `variant` 对齐 Button 的 `gray` / `filled` / `outline` / `borderless`。初版不开放 `link`,因为 link 形态没有稳定按钮外壳,不适合承载分割线。
|
|
23
|
+
- ButtonGroup 不内置 Popover / Menu 行为。需要菜单时,消费方把 Popover 触发器或菜单图标放入某个 Button 单元格。
|
|
24
|
+
- ButtonGroup 不提供专用 Cell 组件。单元格直接复用 Button,避免平行维护第二套按钮事件、链接、状态、图标尺寸与无障碍逻辑。
|
|
25
|
+
- ButtonGroup 不改变 Button 的 `bare` 无外壳语义;单 Icon 的尺寸上下文与透明点击热区继续由 Button 自动处理。
|
|
26
|
+
|
|
27
|
+
## 结构规则
|
|
28
|
+
|
|
29
|
+
单元格直接使用 `Button`,分割线使用 `Separator`:
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<ButtonGroup>
|
|
33
|
+
<Button as="item" onclick={copy}>
|
|
34
|
+
<Icon><Copy /></Icon>
|
|
35
|
+
<Text>Copy</Text>
|
|
36
|
+
</Button>
|
|
37
|
+
<Separator as="separator" column />
|
|
38
|
+
<Button as="item" onclick={openMore}>
|
|
39
|
+
<Icon><ChevronDown /></Icon>
|
|
40
|
+
<Text>More</Text>
|
|
41
|
+
</Button>
|
|
42
|
+
</ButtonGroup>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
内部 Button 作为 ButtonGroup 的直系子项时自动进入嵌入态:
|
|
46
|
+
|
|
47
|
+
- 保留独立 `onclick` / `href` / 状态机 / 动效 / 无障碍能力。
|
|
48
|
+
- 退掉自身背景、边框和圆角,但接收 ButtonGroup 分配的单元格 padding。
|
|
49
|
+
- 保留自身内容布局与单元格内 gap。
|
|
50
|
+
- 默认继承 ButtonGroup 的 `size` / `variant` / `disabled`,实例显式传值可覆盖 size / variant。
|
|
51
|
+
- ButtonGroup 会自动标记直系 Button 的单元格位置:`only` / `first` / `middle` / `last`,消费方不需要手写 `as="first"` / `as="last"`。
|
|
52
|
+
|
|
53
|
+
若消费方想使用更短的 `<Line />` 写法,只建议在业务文件中对 `Separator` 做本地别名:
|
|
54
|
+
|
|
55
|
+
```svelte
|
|
56
|
+
<script>
|
|
57
|
+
import { Separator as Line } from "@snowui-design-system/components";
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 布局模型
|
|
62
|
+
|
|
63
|
+
主布局模型:**内联外壳布局**。定义见 [../../../specs/LayoutProtocol.md §12.4](../../../specs/LayoutProtocol.md)。
|
|
64
|
+
|
|
65
|
+
- ButtonGroup 根层管理外壳圆角、背景、边框与裁剪;视觉 padding 转交给嵌入态 Button,确保每个单元格的 hover / 点击热区覆盖自身完整单元格。
|
|
66
|
+
- 如果消费方在 ButtonGroup 根层追加 padding(例如 `class="p-40"` 或内联 `padding`),ButtonGroup 会把根层 padding 映射为首尾单元格 hover 覆盖的扩展区域;hover 仍然按单元格独立响应,并被根层圆角裁剪。
|
|
67
|
+
- ButtonGroup 与 Button 相同的视觉规则统一使用 Button token:`--snowui-button-padding-block` / `--snowui-button-padding-inline`、`--snowui-button-radius`、`--snowui-button-background`、`--snowui-button-color`、`--snowui-button-border-*`、`--snowui-button-font-size`、`--snowui-button-line-height`。ButtonGroup 只保留分组专属的内侧间距、Separator 长度与外部 padding 扩展变量。
|
|
68
|
+
- Button 管理单元格内部 Icon / Text / Spinner 的 gap。
|
|
69
|
+
- Separator 不通过 margin 表达间距;单元格到分割线的空间由嵌入态 Button 的单元格 padding 承担。
|
|
70
|
+
- 外侧 padding 是单元格内容到 ButtonGroup 边缘的距离,沿用 Button 的 padding-x;内侧 padding 是单元格内容到 Separator 的距离,使用 ButtonGroup 的 gap。
|
|
71
|
+
- 首单元格左侧使用外侧 padding,右侧使用内侧 padding;尾单元格右侧使用外侧 padding,左侧使用内侧 padding;中间单元格两侧都使用内侧 padding。多个单元格按 DOM 顺序自动应用。
|
|
72
|
+
- ButtonGroup 根元素默认 `width: max-content` 且 `align-self: flex-start`,避免放在 `flex-col` 这类父容器中被 `align-items: stretch` 横向撑大。
|
|
73
|
+
- 默认单元格保持 Hug 内容,不做均分拉伸。
|
|
74
|
+
- Hover 状态由内部每个 Button 单元格分别响应,ButtonGroup 外壳不做整块 hover 变色;单元格 hover 颜色规则与 Button 对应 variant 保持一致。
|
|
75
|
+
- Disabled 状态由 ButtonGroup 外壳统一应用 `opacity: 0.2`;内部继承 disabled 的嵌入态 Button 只保留禁用语义,不重复衰减透明度。
|
|
76
|
+
- 内容不使用三槽位语义;`as="leading"` / `as="trailing"` 只表示 ButtonGroup 作为外层宿主的配件角色,不改变 ButtonGroup 内部排列。
|
|
77
|
+
|
|
78
|
+
## 样式规范
|
|
79
|
+
|
|
80
|
+
| Size | Padding Y | 外侧 Padding X | 内侧 Padding X | 单元格内 Gap | Radius | Font Size | Line Height | Separator 高度 |
|
|
81
|
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
82
|
+
| sm | `var(--padding-1)` | `var(--padding-3)` | `var(--gap-2)` | `var(--gap-1)` | `var(--radius-3)` | `var(--text-12)` | `var(--leading-12)` | `var(--size-3)` |
|
|
83
|
+
| md | `var(--padding-2)` | `var(--padding-4)` | `var(--gap-3)` | `calc((var(--gap-1) + var(--gap-2)) / 2)` | `var(--radius-4)` | `var(--text-14)` | `var(--leading-14)` | `var(--size-4)` |
|
|
84
|
+
| lg | `var(--padding-3)` | `var(--padding-5)` | `var(--gap-4)` | `var(--gap-2)` | `var(--radius-5)` | `var(--text-16)` | `var(--leading-16)` | `var(--size-5)` |
|
|
85
|
+
|
|
86
|
+
分割线:
|
|
87
|
+
|
|
88
|
+
- 粗细:`var(--border-1)`,即 0.5px。
|
|
89
|
+
- filled 变体颜色:`var(--static-white-20)`。
|
|
90
|
+
- 非 filled 变体颜色:`var(--black-10)`。
|
|
91
|
+
- 默认圆角,可在 Separator 上设置 `rounded={false}`。
|
|
92
|
+
|
|
93
|
+
## 验收覆盖
|
|
94
|
+
|
|
95
|
+
测试示例至少覆盖:
|
|
96
|
+
|
|
97
|
+
- `sm` / `md` / `lg` 三个尺寸。
|
|
98
|
+
- `gray` / `filled` / `outline` / `borderless` 四个变体。
|
|
99
|
+
- 多个 Button 单元格、多个 Separator、每个 Button 独立 `onclick`。
|
|
100
|
+
- ButtonGroup `disabled` 状态。
|
|
101
|
+
- `Separator rounded={false}` 与 Separator 通用水平 / 垂直基础示例。
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
> **以下内容供 AI 阅读,用于维护代码与文档的关联**
|
|
108
|
+
|
|
109
|
+
## 开发者指南 (AI)
|
|
110
|
+
|
|
111
|
+
### 模块索引
|
|
112
|
+
|
|
113
|
+
- **ButtonGroup 组件**: [./ButtonGroup.svelte](./ButtonGroup.svelte)
|
|
114
|
+
- **Button 嵌入态**: [./Button.svelte](./Button.svelte)
|
|
115
|
+
- **Separator 组件**: [./Separator.svelte](./Separator.svelte)
|
|
116
|
+
|
|
117
|
+
### 关键 CSS 类
|
|
118
|
+
|
|
119
|
+
| 类名 | 描述 |
|
|
120
|
+
| :--- | :--- |
|
|
121
|
+
| `.snowui-button-group` | 根元素 |
|
|
122
|
+
| `.snowui-button-group-sm/md/lg` | 尺寸档 |
|
|
123
|
+
| `.snowui-button-group-gray/filled/outline/borderless` | 视觉变体 |
|
|
124
|
+
| `.snowui-button-embedded-button-group` | Button 进入 ButtonGroup 嵌入态 |
|
|
125
|
+
|
|
126
|
+
### 关联关系
|
|
127
|
+
|
|
128
|
+
- **子组件**: Button、Separator
|
|
129
|
+
- **依赖**: Frame、ButtonGroup Context
|
|
130
|
+
|
|
131
|
+
## 更新日志 (Changelog)
|
|
132
|
+
|
|
133
|
+
### v1.0.0 (2026-05-19)
|
|
134
|
+
|
|
135
|
+
#### 新功能
|
|
136
|
+
- 初始版本,支持 Button 嵌入态、Separator 分割线、四种变体与三种尺寸。
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|