@yunlefun/vue 0.6.0 → 0.8.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 (77) hide show
  1. package/README.md +5 -6
  2. package/components/YlfAccordion.vue +30 -29
  3. package/components/YlfAgentCard.vue +4 -4
  4. package/components/YlfAgentStatus.vue +1 -1
  5. package/components/YlfAgentTask.vue +4 -4
  6. package/components/YlfAiPromptLauncher.vue +18 -8
  7. package/components/YlfAvatar.vue +30 -30
  8. package/components/YlfBadge.vue +92 -73
  9. package/components/YlfBottomMenu.vue +5 -5
  10. package/components/YlfBottomMenuItem.vue +15 -15
  11. package/components/YlfButton.vue +300 -265
  12. package/components/YlfCard.vue +32 -32
  13. package/components/YlfCheckbox.vue +61 -54
  14. package/components/YlfCloud.vue +5 -18
  15. package/components/YlfDialog.vue +47 -46
  16. package/components/YlfDropdownMenu.vue +55 -57
  17. package/components/YlfInput.vue +22 -15
  18. package/components/YlfLogo.vue +58 -42
  19. package/components/YlfNavigation.vue +24 -24
  20. package/components/YlfNavigationLink.vue +58 -25
  21. package/components/YlfNavigationTrigger.vue +49 -21
  22. package/components/YlfPopover.vue +34 -31
  23. package/components/YlfProgress.vue +10 -6
  24. package/components/YlfRadioGroup.vue +73 -58
  25. package/components/YlfScrollFade.vue +66 -0
  26. package/components/YlfSegmentedControl.vue +21 -15
  27. package/components/YlfSelect.vue +110 -99
  28. package/components/YlfSeparator.vue +31 -26
  29. package/components/YlfSlider.vue +49 -46
  30. package/components/YlfSwitch.vue +67 -64
  31. package/components/YlfTabs.vue +30 -28
  32. package/components/YlfTooltip.vue +30 -27
  33. package/components/ai-prompt.ts +33 -6
  34. package/components/cloud.ts +21 -1
  35. package/components/navigation-indicator.ts +9 -3
  36. package/components/scroll-fade/demo.vue +49 -0
  37. package/components/scroll-fade/index.md +40 -0
  38. package/components/scroll-fade.ts +54 -0
  39. package/components/segmented-control/demo.vue +9 -2
  40. package/dist/ag-ui.cjs +11 -2
  41. package/dist/ag-ui.mjs +11 -2
  42. package/dist/ai-prompt.cjs +30 -5
  43. package/dist/ai-prompt.mjs +30 -5
  44. package/dist/components/YlfAccordion.vue.d.ts +5 -3
  45. package/dist/components/YlfAgentCard.vue.d.ts +9 -7
  46. package/dist/components/YlfAgentTask.vue.d.ts +7 -5
  47. package/dist/components/YlfBadge.vue.d.ts +5 -4
  48. package/dist/components/YlfBottomMenu.vue.d.ts +5 -3
  49. package/dist/components/YlfBottomMenuItem.vue.d.ts +5 -3
  50. package/dist/components/YlfButton.vue.d.ts +7 -6
  51. package/dist/components/YlfCard.vue.d.ts +5 -4
  52. package/dist/components/YlfDialog.vue.d.ts +11 -9
  53. package/dist/components/YlfDropdownMenu.vue.d.ts +5 -3
  54. package/dist/components/YlfNavigation.vue.d.ts +5 -3
  55. package/dist/components/YlfNavigationLink.vue.d.ts +5 -3
  56. package/dist/components/YlfNavigationTrigger.vue.d.ts +5 -3
  57. package/dist/components/YlfPopover.vue.d.ts +7 -5
  58. package/dist/components/YlfProgress.vue.d.ts +0 -1
  59. package/dist/components/YlfScrollFade.vue.d.ts +26 -0
  60. package/dist/components/YlfSeparator.vue.d.ts +0 -1
  61. package/dist/components/YlfSwitch.vue.d.ts +0 -1
  62. package/dist/components/YlfTabs.vue.d.ts +5 -3
  63. package/dist/components/YlfTooltip.vue.d.ts +7 -5
  64. package/dist/components/cloud.d.ts +2 -0
  65. package/dist/components/scroll-fade.d.ts +3 -0
  66. package/dist/index.cjs +20 -10
  67. package/dist/index.d.cts +3 -4
  68. package/dist/index.d.mts +3 -4
  69. package/dist/index.d.ts +3 -4
  70. package/dist/index.mjs +20 -8
  71. package/dist/node.cjs +11 -0
  72. package/dist/node.d.cts +4 -0
  73. package/dist/node.d.mts +4 -0
  74. package/dist/node.d.ts +4 -0
  75. package/dist/node.mjs +7 -0
  76. package/package.json +11 -4
  77. package/components/_navigation.scss +0 -38
@@ -35,7 +35,6 @@ const props = withDefaults(defineProps<{
35
35
  tag?: string
36
36
  }>(), {
37
37
  variant: 'primary',
38
- tone: 'blue',
39
38
  appearance: 'solid',
40
39
  size: 'md',
41
40
  iconOnly: false,
@@ -62,8 +61,11 @@ const classes = computed(() => [
62
61
  ])
63
62
 
64
63
  function onClick(e: MouseEvent) {
65
- if (props.disabled || props.loading)
64
+ if (props.disabled || props.loading) {
65
+ e.preventDefault()
66
+ e.stopPropagation()
66
67
  return
68
+ }
67
69
  emit('click', e)
68
70
  }
69
71
  </script>
@@ -75,7 +77,9 @@ function onClick(e: MouseEvent) {
75
77
  :class="classes"
76
78
  :data-ylf-tone="tone"
77
79
  :type="tag === 'button' ? 'button' : undefined"
78
- :disabled="tag === 'button' ? (disabled || loading) : undefined"
80
+ :disabled="tag === 'button' ? disabled : undefined"
81
+ :aria-disabled="disabled || loading ? 'true' : undefined"
82
+ :tabindex="tag !== 'button' && disabled ? -1 : undefined"
79
83
  :aria-busy="loading || undefined"
80
84
  @click="onClick"
81
85
  >
@@ -85,9 +89,9 @@ function onClick(e: MouseEvent) {
85
89
  </component>
86
90
  </template>
87
91
 
88
- <style lang="scss">
92
+ <style>
89
93
  .ylf-button {
90
- --_radius: var(--ylf-radius, 14px);
94
+ --_radius: var(--ylf-control-radius, var(--ylf-radius, 14px));
91
95
  --_fill: var(--ylf-c-brand, #2563eb);
92
96
 
93
97
  box-sizing: border-box;
@@ -109,322 +113,353 @@ function onClick(e: MouseEvent) {
109
113
  user-select: none;
110
114
  text-decoration: none;
111
115
  transition:
112
- transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease)),
113
- box-shadow var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
114
- background var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
115
- color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
116
- border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
117
-
118
- &.is-round {
119
- --_radius: var(--ylf-radius-pill, 999px);
120
- }
116
+ transform var(--ylf-duration-slow, 480ms)
117
+ var(--ylf-ease-spring, var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1))),
118
+ box-shadow var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1)),
119
+ background var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1)),
120
+ color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1)),
121
+ border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1));
122
+ }
121
123
 
122
- &.is-block {
123
- display: flex;
124
- width: 100%;
125
- }
124
+ .ylf-button.is-round {
125
+ --_radius: var(--ylf-radius-pill, 999px);
126
+ }
126
127
 
127
- &:focus-visible {
128
- outline: 2px solid var(--ylf-c-brand, #2563eb);
129
- outline-offset: 4px;
130
- box-shadow:
131
- 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff),
132
- 0 0 0 5px var(--ylf-c-brand, #2563eb);
133
- }
128
+ .ylf-button.is-block {
129
+ display: flex;
130
+ width: 100%;
131
+ }
134
132
 
135
- // --- sizes ---
136
- &--sm {
137
- padding: 8px 18px;
138
- font-size: 13px;
139
- }
133
+ .ylf-button:focus-visible {
134
+ outline: var(--ylf-ring-width, 2px) solid var(--ylf-ring-color, var(--ylf-c-brand, #2563eb));
135
+ outline-offset: 4px;
136
+ box-shadow:
137
+ 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff),
138
+ 0 0 0 5px var(--ylf-ring-color, var(--ylf-c-brand, #2563eb));
139
+ }
140
140
 
141
- &--md {
142
- padding: 11px 24px;
143
- font-size: 15px;
144
- }
141
+ /* --- sizes --- */
142
+ .ylf-button--sm {
143
+ padding: 8px 18px;
144
+ font-size: var(--ylf-control-font-size-sm, 0.8125rem);
145
+ }
145
146
 
146
- &--lg {
147
- padding: 14px 30px;
148
- font-size: 17px;
149
- }
147
+ .ylf-button--md {
148
+ padding: 11px 24px;
149
+ font-size: var(--ylf-control-font-size, 0.9375rem);
150
+ }
150
151
 
151
- &--xl {
152
- --_min-height: 56px;
153
- min-height: var(--_min-height);
154
- padding: 16px 28px;
155
- font-size: 16px;
156
- line-height: 22px;
157
- }
152
+ .ylf-button--lg {
153
+ padding: 14px 30px;
154
+ font-size: 17px;
155
+ }
158
156
 
159
- &.is-icon-only {
160
- width: 36px;
161
- height: 36px;
162
- min-height: 36px;
163
- flex: none;
164
- padding: 0;
165
- font-size: 18px;
166
-
167
- &.ylf-button--sm {
168
- width: 32px;
169
- height: 32px;
170
- min-height: 32px;
171
- font-size: 16px;
172
- }
173
-
174
- &.ylf-button--lg,
175
- &.ylf-button--xl {
176
- width: 44px;
177
- height: 44px;
178
- min-height: 44px;
179
- font-size: 20px;
180
- }
181
-
182
- &:focus-visible {
183
- outline-offset: -2px;
184
- box-shadow: none;
185
- }
186
- }
157
+ .ylf-button--xl {
158
+ --_min-height: var(--ylf-control-h-xl, 56px);
159
+ min-height: var(--_min-height);
160
+ padding: 16px 28px;
161
+ font-size: var(--ylf-text-base, 1rem);
162
+ line-height: 22px;
163
+ }
164
+
165
+ .ylf-button.is-icon-only {
166
+ width: 36px;
167
+ height: 36px;
168
+ min-height: 36px;
169
+ flex: none;
170
+ padding: 0;
171
+ font-size: 18px;
172
+ }
173
+
174
+ .ylf-button.is-icon-only.ylf-button--sm {
175
+ width: 32px;
176
+ height: 32px;
177
+ min-height: 32px;
178
+ font-size: 16px;
179
+ }
187
180
 
188
- // Opt-in brand entrance; everyday primary actions keep their solid appearance.
189
- &--hero {
190
- color: var(--ylf-hero-foreground, #fff);
191
- background: var(--ylf-hero-background, linear-gradient(115deg, #2563eb, #0f74b8 58%, #0369a1));
192
- border-color: var(--ylf-hero-border, rgb(255 255 255 / 0.16));
193
- box-shadow: var(--ylf-hero-shadow, inset 0 1px 0 rgb(255 255 255 / 0.24), 0 12px 26px -14px rgb(3 105 161 / 0.58));
194
-
195
- @media (hover: hover) and (pointer: fine) {
196
- &:hover:not(.is-disabled, .is-loading, :disabled) {
197
- background: var(--ylf-hero-background-hover, linear-gradient(115deg, #1d4ed8, #096ba9 58%, #075985));
198
- box-shadow: var(
199
- --ylf-hero-shadow-hover,
200
- inset 0 1px 0 rgb(255 255 255 / 0.3),
201
- 0 14px 30px -14px rgb(3 105 161 / 0.58)
202
- );
203
- transform: translateY(var(--ylf-hover-lift, -1px));
204
- }
205
- }
206
-
207
- &:focus-visible {
208
- outline: 2px solid var(--ylf-hero-foreground, #fff);
209
- outline-offset: 3px;
210
- box-shadow: 0 0 0 5px var(--ylf-hero-end, #0369a1);
211
- }
181
+ .ylf-button.is-icon-only.ylf-button--lg,
182
+ .ylf-button.is-icon-only.ylf-button--xl {
183
+ width: var(--ylf-touch-target, 44px);
184
+ height: var(--ylf-touch-target, 44px);
185
+ min-height: var(--ylf-touch-target, 44px);
186
+ font-size: 20px;
187
+ }
188
+
189
+ .ylf-button.is-icon-only:focus-visible {
190
+ outline-offset: -2px;
191
+ box-shadow: none;
192
+ }
193
+
194
+ /* Opt-in brand entrance; everyday primary actions keep their solid appearance. */
195
+ .ylf-button--hero {
196
+ color: var(--ylf-hero-foreground, #fff);
197
+ background: var(--ylf-hero-background, linear-gradient(115deg, #2563eb, #0f74b8 58%, #0369a1));
198
+ border-color: var(--ylf-hero-border, rgb(255 255 255 / 0.16));
199
+ box-shadow: var(--ylf-hero-shadow, inset 0 1px 0 rgb(255 255 255 / 0.24), 0 12px 26px -14px rgb(3 105 161 / 0.58));
200
+ }
201
+
202
+ @media (hover: hover) and (pointer: fine) {
203
+ .ylf-button--hero:hover:not(.is-disabled, .is-loading, :disabled) {
204
+ background: var(--ylf-hero-background-hover, linear-gradient(115deg, #1d4ed8, #096ba9 58%, #075985));
205
+ box-shadow: var(
206
+ --ylf-hero-shadow-hover,
207
+ inset 0 1px 0 rgb(255 255 255 / 0.3),
208
+ 0 14px 30px -14px rgb(3 105 161 / 0.58)
209
+ );
210
+ transform: translateY(var(--ylf-hover-lift, -1px));
212
211
  }
212
+ }
213
+
214
+ .ylf-button--hero:focus-visible {
215
+ outline: var(--ylf-ring-width, 2px) solid var(--ylf-hero-foreground, #fff);
216
+ outline-offset: 3px;
217
+ box-shadow: 0 0 0 5px var(--ylf-hero-end, #0369a1);
218
+ }
213
219
 
214
- // --- primary:晴空蓝实色(主操作,单色不花) ---
215
- &--primary {
216
- color: var(--ylf-c-text-on-accent, #fff);
217
- background: var(--ylf-c-brand, #2563eb);
218
- border-color: color-mix(in srgb, var(--_fill) 85%, #000);
220
+ /* --- primary:晴空蓝实色(主操作,单色不花) --- */
221
+ .ylf-button--primary {
222
+ color: var(--ylf-c-text-on-accent, #fff);
223
+ background: var(--ylf-c-brand, #2563eb);
224
+ border-color: color-mix(in srgb, var(--_fill) 85%, #000);
225
+ box-shadow:
226
+ inset 0 1px 0 rgba(255, 255, 255, 0.22),
227
+ 0 2px 0 color-mix(in srgb, var(--_fill) 80%, #000),
228
+ 0 6px 14px -6px color-mix(in srgb, var(--_fill) 40%, transparent);
229
+ }
230
+
231
+ @media (hover: hover) and (pointer: fine) {
232
+ .ylf-button--primary:hover:not(.is-disabled, .is-loading, :disabled) {
233
+ background: var(--ylf-c-brand-hover, #1d4ed8);
234
+ transform: translateY(var(--ylf-hover-lift, -1px));
219
235
  box-shadow:
220
236
  inset 0 1px 0 rgba(255, 255, 255, 0.22),
221
- 0 2px 0 color-mix(in srgb, var(--_fill) 80%, #000),
222
- 0 6px 14px -6px color-mix(in srgb, var(--_fill) 40%, transparent);
223
-
224
- @media (hover: hover) and (pointer: fine) {
225
- &:hover:not(.is-disabled, .is-loading, :disabled) {
226
- background: var(--ylf-c-brand-hover, #1d4ed8);
227
- transform: translateY(var(--ylf-hover-lift, -1px));
228
- box-shadow:
229
- inset 0 1px 0 rgba(255, 255, 255, 0.22),
230
- 0 3px 0 color-mix(in srgb, var(--_fill) 80%, #000),
231
- 0 8px 18px -6px color-mix(in srgb, var(--_fill) 35%, transparent);
232
- }
233
- }
237
+ 0 3px 0 color-mix(in srgb, var(--_fill) 80%, #000),
238
+ 0 8px 18px -6px color-mix(in srgb, var(--_fill) 35%, transparent);
234
239
  }
240
+ }
235
241
 
236
- // 强调色来自共享上下文;实色上的文字与填充色成组维护。
237
- &--accent,
238
- &--aurora {
239
- --_fill: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
240
- --_color: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
241
- --_soft: var(--ylf-accent-soft, var(--ylf-c-brand-soft, #eff6ff));
242
- --_text: var(--ylf-accent-text, var(--ylf-c-brand, #2563eb));
243
-
244
- color: var(--ylf-accent-on, var(--ylf-c-text-on-accent, #fff));
245
- background: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
246
- border-color: color-mix(in srgb, var(--_fill) 82%, #000);
247
- box-shadow:
248
- inset 0 1px 0 rgba(255, 255, 255, 0.2),
249
- 0 2px 0 color-mix(in srgb, var(--_fill) 78%, #000);
250
-
251
- @media (hover: hover) and (pointer: fine) {
252
- &:hover:not(.is-disabled, .is-loading, :disabled) {
253
- background: var(--ylf-accent-hover, var(--ylf-c-brand-hover, #1d4ed8));
254
- }
255
- }
256
- }
242
+ /* 强调色来自共享上下文;实色上的文字与填充色成组维护。 */
243
+ .ylf-button--accent,
244
+ .ylf-button--aurora {
245
+ --_fill: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
246
+ --_color: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
247
+ --_soft: var(--ylf-accent-soft, var(--ylf-c-brand-soft, #eff6ff));
248
+ --_text: var(--ylf-accent-text, var(--ylf-c-brand, #2563eb));
249
+
250
+ color: var(--ylf-accent-on, var(--ylf-c-text-on-accent, #fff));
251
+ background: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
252
+ border-color: color-mix(in srgb, var(--_fill) 82%, #000);
253
+ box-shadow:
254
+ inset 0 1px 0 rgba(255, 255, 255, 0.2),
255
+ 0 2px 0 color-mix(in srgb, var(--_fill) 78%, #000);
256
+ }
257
257
 
258
- // --- secondary:描边 ---
259
- &--secondary {
260
- color: var(--ylf-c-text, #0f172a);
261
- background: var(--ylf-c-surface, #fff);
262
- border-color: var(--ylf-c-border-strong, #cbd5e1);
263
- box-shadow: var(--ylf-shadow-control);
264
-
265
- @media (hover: hover) and (pointer: fine) {
266
- &:hover:not(.is-disabled, .is-loading, :disabled) {
267
- color: var(--ylf-c-brand, #2563eb);
268
- border-color: var(--ylf-c-brand, #2563eb);
269
- transform: translateY(var(--ylf-hover-lift, -1px));
270
- }
271
- }
258
+ @media (hover: hover) and (pointer: fine) {
259
+ .ylf-button--accent:hover:not(.is-disabled, .is-loading, :disabled),
260
+ .ylf-button--aurora:hover:not(.is-disabled, .is-loading, :disabled) {
261
+ background: var(--ylf-accent-hover, var(--ylf-c-brand-hover, #1d4ed8));
272
262
  }
263
+ }
264
+
265
+ /* --- secondary:描边 --- */
266
+ .ylf-button--secondary {
267
+ color: var(--ylf-c-text, #0f172a);
268
+ background: var(--ylf-c-surface, #fff);
269
+ border-color: var(--ylf-c-border-strong, #cbd5e1);
270
+ box-shadow: var(--ylf-shadow-control);
271
+ }
273
272
 
274
- // --- soft:柔色填充 ---
275
- &--soft {
273
+ @media (hover: hover) and (pointer: fine) {
274
+ .ylf-button--secondary:hover:not(.is-disabled, .is-loading, :disabled) {
276
275
  color: var(--ylf-c-brand, #2563eb);
277
- background: var(--ylf-c-brand-soft, #eff6ff);
278
- border-color: color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
279
-
280
- @media (hover: hover) and (pointer: fine) {
281
- &:hover:not(.is-disabled, .is-loading, :disabled) {
282
- transform: translateY(var(--ylf-hover-lift, -1px));
283
- box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
284
- }
285
- }
276
+ border-color: var(--ylf-c-brand, #2563eb);
277
+ transform: translateY(var(--ylf-hover-lift, -1px));
286
278
  }
279
+ }
287
280
 
288
- // --- ghost:幽灵 ---
289
- &--ghost {
290
- color: var(--ylf-c-text-2, #475569);
291
- background: transparent;
292
-
293
- @media (hover: hover) and (pointer: fine) {
294
- &:hover:not(.is-disabled, .is-loading, :disabled) {
295
- color: var(--ylf-c-brand, #2563eb);
296
- background: var(--ylf-c-brand-soft, #eff6ff);
297
- }
298
- }
299
-
300
- &[aria-pressed='true'] {
301
- color: var(--ylf-c-brand, #2563eb);
302
- background: var(--ylf-c-brand-soft, #eff6ff);
303
- }
304
- }
281
+ /* --- soft:柔色填充 --- */
282
+ .ylf-button--soft {
283
+ color: var(--ylf-c-brand, #2563eb);
284
+ background: var(--ylf-c-brand-soft, #eff6ff);
285
+ border-color: color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
286
+ }
305
287
 
306
- // --- 语义色 ---
307
- @each $status, $fill, $on, $hover in (success, #22c55e, #124324, #4ade80), (warning, #facc15, #64380e, #eab308),
308
- (danger, #ff6b4a, #551b0a, #ff856b)
309
- {
310
- &--#{$status} {
311
- --_color: var(--ylf-status-#{$status}, #{$fill});
312
- --_soft: var(--ylf-status-#{$status}-soft, var(--ylf-c-bg-soft, #f1f5f9));
313
- --_text: var(--ylf-status-#{$status}-text, #{$on});
314
-
315
- color: var(--ylf-status-#{$status}-on, $on);
316
- background: var(--ylf-status-#{$status}, $fill);
317
-
318
- @media (hover: hover) and (pointer: fine) {
319
- &:hover:not(.is-disabled, .is-loading, :disabled) {
320
- background: var(--ylf-status-#{$status}-hover, $hover);
321
- }
322
- }
323
- }
288
+ @media (hover: hover) and (pointer: fine) {
289
+ .ylf-button--soft:hover:not(.is-disabled, .is-loading, :disabled) {
290
+ transform: translateY(var(--ylf-hover-lift, -1px));
291
+ box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
324
292
  }
293
+ }
325
294
 
326
- &--accent,
327
- &--aurora,
328
- &--success,
329
- &--warning,
330
- &--danger {
331
- &.is-soft,
332
- &.is-outline {
333
- color: var(--_text);
334
- box-shadow: none;
335
-
336
- @media (hover: hover) and (pointer: fine) {
337
- &:hover:not(.is-disabled, .is-loading, :disabled) {
338
- background: var(--_soft);
339
- border-color: var(--_text);
340
- }
341
- }
342
-
343
- &:focus-visible {
344
- outline: 2px solid var(--ylf-c-brand, #2563eb);
345
- outline-offset: 3px;
346
- }
347
- }
348
-
349
- &.is-soft {
350
- background: var(--_soft);
351
- }
352
-
353
- &.is-outline {
354
- background: transparent;
355
- border-color: var(--_text);
356
- }
357
- }
295
+ /* --- ghost:幽灵 --- */
296
+ .ylf-button--ghost {
297
+ color: var(--ylf-c-text-2, #475569);
298
+ background: transparent;
299
+ }
358
300
 
359
- // --- 状态 ---
360
- &:active:not(.is-disabled, .is-loading, :disabled) {
361
- transition-duration: var(--ylf-duration-press, 100ms);
362
- transform: scale(var(--ylf-press-scale, 0.98));
301
+ @media (hover: hover) and (pointer: fine) {
302
+ .ylf-button--ghost:hover:not(.is-disabled, .is-loading, :disabled) {
303
+ color: var(--ylf-c-brand, #2563eb);
304
+ background: var(--ylf-c-brand-soft, #eff6ff);
363
305
  }
306
+ }
307
+
308
+ .ylf-button--ghost[aria-pressed='true'] {
309
+ color: var(--ylf-c-brand, #2563eb);
310
+ background: var(--ylf-c-brand-soft, #eff6ff);
311
+ }
312
+
313
+ /* --- 语义色 --- */
314
+ .ylf-button--success {
315
+ --_color: var(--ylf-status-success, #22c55e);
316
+ --_soft: var(--ylf-status-success-soft, var(--ylf-c-bg-soft, #f1f5f9));
317
+ --_text: var(--ylf-status-success-text, #166534);
318
+
319
+ color: var(--ylf-status-success-on, #124324);
320
+ background: var(--ylf-status-success, #22c55e);
321
+ }
322
+
323
+ .ylf-button--warning {
324
+ --_color: var(--ylf-status-warning, #facc15);
325
+ --_soft: var(--ylf-status-warning-soft, var(--ylf-c-bg-soft, #f1f5f9));
326
+ --_text: var(--ylf-status-warning-text, #854d0e);
327
+
328
+ color: var(--ylf-status-warning-on, #64380e);
329
+ background: var(--ylf-status-warning, #facc15);
330
+ }
331
+
332
+ .ylf-button--danger {
333
+ --_color: var(--ylf-status-danger, #ff6b4a);
334
+ --_soft: var(--ylf-status-danger-soft, var(--ylf-c-bg-soft, #f1f5f9));
335
+ --_text: var(--ylf-status-danger-text, #9a3412);
336
+
337
+ color: var(--ylf-status-danger-on, #551b0a);
338
+ background: var(--ylf-status-danger, #ff6b4a);
339
+ }
364
340
 
365
- &.is-disabled,
366
- &:disabled {
367
- opacity: 0.45;
368
- cursor: not-allowed;
369
- box-shadow: none;
370
- transform: none !important;
341
+ @media (hover: hover) and (pointer: fine) {
342
+ .ylf-button--success:hover:not(.is-disabled, .is-loading, :disabled) {
343
+ background: var(--ylf-status-success-hover, #4ade80);
371
344
  }
372
345
 
373
- &.is-loading {
374
- cursor: progress;
346
+ .ylf-button--warning:hover:not(.is-disabled, .is-loading, :disabled) {
347
+ background: var(--ylf-status-warning-hover, #eab308);
375
348
  }
376
349
 
377
- &__label {
378
- min-width: 0;
379
- line-height: inherit;
380
- box-sizing: border-box;
381
- max-width: 100%;
382
- display: inline-flex;
383
- align-items: center;
350
+ .ylf-button--danger:hover:not(.is-disabled, .is-loading, :disabled) {
351
+ background: var(--ylf-status-danger-hover, #ff856b);
384
352
  }
353
+ }
354
+
355
+ :is(.ylf-button--accent, .ylf-button--aurora, .ylf-button--success, .ylf-button--warning, .ylf-button--danger):is(
356
+ .is-soft,
357
+ .is-outline
358
+ ) {
359
+ color: var(--_text);
360
+ box-shadow: none;
361
+ }
385
362
 
386
- &__spinner {
387
- width: 1em;
388
- height: 1em;
389
- border: 2px solid currentColor;
390
- border-right-color: transparent;
391
- border-radius: 50%;
392
- animation: ylf-button-spin 0.7s linear infinite;
363
+ @media (hover: hover) and (pointer: fine) {
364
+ :is(.ylf-button--accent, .ylf-button--aurora, .ylf-button--success, .ylf-button--warning, .ylf-button--danger):is(
365
+ .is-soft,
366
+ .is-outline
367
+ ):hover:not(.is-disabled, .is-loading, :disabled) {
368
+ background: var(--_soft);
369
+ border-color: var(--_text);
393
370
  }
394
371
  }
395
372
 
373
+ :is(.ylf-button--accent, .ylf-button--aurora, .ylf-button--success, .ylf-button--warning, .ylf-button--danger):is(
374
+ .is-soft,
375
+ .is-outline
376
+ ):focus-visible {
377
+ outline: var(--ylf-ring-width, 2px) solid var(--ylf-ring-color, var(--ylf-c-brand, #2563eb));
378
+ outline-offset: 3px;
379
+ }
380
+
381
+ :is(.ylf-button--accent, .ylf-button--aurora, .ylf-button--success, .ylf-button--warning, .ylf-button--danger).is-soft {
382
+ background: var(--_soft);
383
+ }
384
+
385
+ :is(
386
+ .ylf-button--accent,
387
+ .ylf-button--aurora,
388
+ .ylf-button--success,
389
+ .ylf-button--warning,
390
+ .ylf-button--danger
391
+ ).is-outline {
392
+ background: transparent;
393
+ border-color: var(--_text);
394
+ }
395
+
396
+ /* --- 状态 --- */
397
+ .ylf-button:active:not(.is-disabled, .is-loading, :disabled) {
398
+ transition-duration: var(--ylf-duration-press, 100ms);
399
+ transform: scale(var(--ylf-press-scale, 0.98));
400
+ }
401
+
402
+ .ylf-button.is-disabled,
403
+ .ylf-button:disabled {
404
+ opacity: var(--ylf-disabled-opacity, 0.48);
405
+ cursor: not-allowed;
406
+ box-shadow: none;
407
+ transform: none !important;
408
+ }
409
+
410
+ .ylf-button.is-loading {
411
+ cursor: progress;
412
+ }
413
+
414
+ .ylf-button__label {
415
+ min-width: 0;
416
+ line-height: inherit;
417
+ box-sizing: border-box;
418
+ max-width: 100%;
419
+ display: inline-flex;
420
+ align-items: center;
421
+ }
422
+
423
+ .ylf-button__spinner {
424
+ width: 1em;
425
+ height: 1em;
426
+ border: 2px solid currentColor;
427
+ border-right-color: transparent;
428
+ border-radius: 50%;
429
+ animation: ylf-button-spin 0.7s linear infinite;
430
+ }
431
+
396
432
  @keyframes ylf-button-spin {
397
433
  to {
398
434
  transform: rotate(360deg);
399
435
  }
400
436
  }
401
437
 
402
- @media (pointer: coarse) {
403
- .ylf-button.is-icon-only {
404
- min-width: 44px;
405
- min-height: 44px;
406
- }
407
- }
408
-
409
438
  @media (prefers-reduced-motion: reduce) {
410
439
  .ylf-button {
411
440
  transition: none;
441
+ }
412
442
 
413
- &:is(:hover, :active):not(.is-disabled, .is-loading, :disabled) {
414
- transform: none;
415
- transition: none;
416
- }
443
+ .ylf-button:is(:hover, :active):not(.is-disabled, .is-loading, :disabled) {
444
+ transform: none;
445
+ transition: none;
417
446
  }
418
447
 
419
448
  .ylf-button__spinner {
420
449
  animation: none;
421
450
  }
422
451
  }
452
+
423
453
  @media (pointer: coarse) {
424
454
  .ylf-button {
425
455
  min-width: var(--ylf-touch-target, 44px);
426
456
  min-height: max(var(--_min-height, 0px), var(--ylf-touch-target, 44px));
427
457
  line-height: 1.4;
428
458
  }
459
+
460
+ .ylf-button.is-icon-only {
461
+ min-width: var(--ylf-touch-target, 44px);
462
+ min-height: var(--ylf-touch-target, 44px);
463
+ }
429
464
  }
430
465
  </style>