@yunlefun/vue 0.3.0 → 0.4.1

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 (65) hide show
  1. package/README.md +2 -0
  2. package/components/YlfAccordion.vue +8 -2
  3. package/components/YlfAvatar.vue +2 -1
  4. package/components/YlfButton.vue +26 -11
  5. package/components/YlfCard.vue +2 -1
  6. package/components/YlfCheckbox.vue +4 -1
  7. package/components/YlfDialog.vue +54 -19
  8. package/components/YlfDropdownMenu.vue +31 -13
  9. package/components/YlfPopover.vue +10 -6
  10. package/components/YlfProgress.vue +29 -5
  11. package/components/YlfRadioGroup.vue +23 -2
  12. package/components/YlfSegmentedControl.vue +4 -3
  13. package/components/YlfSelect.vue +34 -6
  14. package/components/YlfSlider.vue +32 -2
  15. package/components/YlfSwitch.vue +7 -1
  16. package/components/YlfTabs.vue +9 -3
  17. package/components/YlfTooltip.vue +9 -5
  18. package/components/accordion/demo.vue +1 -1
  19. package/components/accordion/index.md +2 -0
  20. package/components/avatar/index.md +3 -1
  21. package/components/checkbox/demo.vue +10 -9
  22. package/components/checkbox/index.md +2 -0
  23. package/components/dialog/demo.vue +144 -12
  24. package/components/dialog/index.md +9 -6
  25. package/components/dropdown-menu/index.md +9 -3
  26. package/components/popover/demo.vue +1 -1
  27. package/components/popover/index.md +8 -5
  28. package/components/progress/index.md +3 -1
  29. package/components/radio/demo.vue +1 -1
  30. package/components/radio/index.md +2 -0
  31. package/components/segmented-control/index.md +1 -1
  32. package/components/select/index.md +6 -0
  33. package/components/slider/demo.vue +2 -2
  34. package/components/slider/index.md +15 -7
  35. package/components/switch/index.md +2 -0
  36. package/components/tabs/index.md +2 -0
  37. package/components/tooltip/index.md +9 -5
  38. package/dist/components/YlfAccordion.vue.d.ts +35 -0
  39. package/dist/components/YlfAiPromptLauncher.vue.d.ts +25 -0
  40. package/dist/components/YlfAvatar.vue.d.ts +14 -0
  41. package/dist/components/YlfBadge.vue.d.ts +29 -0
  42. package/dist/components/YlfBottomMenu.vue.d.ts +19 -0
  43. package/dist/components/YlfBottomMenuItem.vue.d.ts +22 -0
  44. package/dist/components/YlfButton.vue.d.ts +48 -0
  45. package/dist/components/YlfCard.vue.d.ts +28 -0
  46. package/dist/components/YlfCheckbox.vue.d.ts +18 -0
  47. package/dist/components/YlfDialog.vue.d.ts +37 -0
  48. package/dist/components/YlfDropdownMenu.vue.d.ts +34 -0
  49. package/dist/components/YlfLogo.vue.d.ts +13 -0
  50. package/dist/components/YlfPopover.vue.d.ts +31 -0
  51. package/dist/components/YlfProgress.vue.d.ts +17 -0
  52. package/dist/components/YlfRadioGroup.vue.d.ts +24 -0
  53. package/dist/components/YlfSegmentedControl.vue.d.ts +35 -0
  54. package/dist/components/YlfSelect.vue.d.ts +43 -0
  55. package/dist/components/YlfSeparator.vue.d.ts +16 -0
  56. package/dist/components/YlfSlider.vue.d.ts +29 -0
  57. package/dist/components/YlfSwitch.vue.d.ts +24 -0
  58. package/dist/components/YlfTabs.vue.d.ts +32 -0
  59. package/dist/components/YlfTooltip.vue.d.ts +26 -0
  60. package/dist/components/ai-prompt.d.ts +33 -0
  61. package/dist/components/ai-provider-logos.d.ts +3 -0
  62. package/dist/components/bottom-menu/index.d.ts +20 -0
  63. package/dist/components/segmented-control.d.ts +8 -0
  64. package/dist/components/theme.d.ts +4 -0
  65. package/package.json +6 -2
package/README.md CHANGED
@@ -38,6 +38,8 @@ export default defineNuxtConfig({
38
38
 
39
39
  根入口目前提供类型和组件目录信息,组件通过 `components/*.vue` 子路径或 Nuxt 模块使用;没有公开的 `YlfResolver`。
40
40
 
41
+ 组件子路径提供预生成类型声明,运行时继续使用原始 SFC。现有 15 个 Reka UI 封装的验收范围见[组件验收](../guide/component-acceptance.md)。
42
+
41
43
  更多内容见 [Vue 接入](./index.md)、[子包职责](../guide/packages.md)与[设计体系](../guide/design-system.md)。
42
44
 
43
45
  ## AI 提示词入口
@@ -9,7 +9,7 @@ interface AccordionItemData {
9
9
  }
10
10
 
11
11
  withDefaults(defineProps<{
12
- items: AccordionItemData[]
12
+ items: readonly AccordionItemData[]
13
13
  type?: 'single' | 'multiple'
14
14
  collapsible?: boolean
15
15
  }>(), {
@@ -59,6 +59,7 @@ const model = defineModel<string | string[]>()
59
59
  border-radius: var(--ylf-radius, 14px);
60
60
  overflow: hidden;
61
61
  background: var(--ylf-c-surface, #fff);
62
+ box-shadow: var(--ylf-shadow-control);
62
63
  }
63
64
 
64
65
  .ylf-accordion__item + .ylf-accordion__item {
@@ -90,6 +91,11 @@ const model = defineModel<string | string[]>()
90
91
  background: var(--ylf-c-bg-soft, #f1f5f9);
91
92
  }
92
93
 
94
+ &[data-state='open'] {
95
+ color: var(--ylf-c-brand, #2563eb);
96
+ background: color-mix(in srgb, var(--ylf-c-brand-soft, #eff6ff) 60%, transparent);
97
+ }
98
+
93
99
  &[data-disabled] {
94
100
  opacity: 0.45;
95
101
  cursor: not-allowed;
@@ -129,7 +135,7 @@ const model = defineModel<string | string[]>()
129
135
  }
130
136
 
131
137
  .ylf-accordion__body {
132
- padding: 0 16px 16px;
138
+ padding: 12px 16px 16px;
133
139
  }
134
140
 
135
141
  @keyframes ylf-acc-down {
@@ -10,13 +10,14 @@ withDefaults(defineProps<{
10
10
  }>(), {
11
11
  size: 'md',
12
12
  fallback: '',
13
+ alt: '',
13
14
  })
14
15
  </script>
15
16
 
16
17
  <template>
17
18
  <AvatarRoot class="ylf-avatar" :class="`ylf-avatar--${size}`">
18
19
  <AvatarImage v-if="src" :src="src" :alt="alt" class="ylf-avatar__img" />
19
- <AvatarFallback class="ylf-avatar__fallback" :delay-ms="200">
20
+ <AvatarFallback class="ylf-avatar__fallback" :delay-ms="200" :role="alt || fallback ? 'img' : undefined" :aria-label="alt || fallback || undefined">
20
21
  {{ fallback }}
21
22
  </AvatarFallback>
22
23
  </AvatarRoot>
@@ -82,6 +82,7 @@ function onClick(e: MouseEvent) {
82
82
  <style lang="scss">
83
83
  .ylf-button {
84
84
  --_radius: var(--ylf-radius, 14px);
85
+ --_fill: var(--ylf-c-brand, #2563eb);
85
86
 
86
87
  display: inline-flex;
87
88
  align-items: center;
@@ -112,12 +113,9 @@ function onClick(e: MouseEvent) {
112
113
  width: 100%;
113
114
  }
114
115
 
115
- &:active {
116
- transform: scale(0.96);
117
- }
118
-
119
116
  &:focus-visible {
120
- outline: none;
117
+ outline: 2px solid var(--ylf-c-brand, #2563eb);
118
+ outline-offset: 4px;
121
119
  box-shadow:
122
120
  0 0 0 3px var(--ylf-c-brand-soft, #eff6ff),
123
121
  0 0 0 5px var(--ylf-c-brand, #2563eb);
@@ -143,25 +141,36 @@ function onClick(e: MouseEvent) {
143
141
  &--primary {
144
142
  color: var(--ylf-c-text-on-accent, #fff);
145
143
  background: var(--ylf-c-brand, #2563eb);
146
- box-shadow: var(--ylf-shadow-sm);
144
+ border-color: color-mix(in srgb, var(--_fill) 85%, #000);
145
+ box-shadow:
146
+ inset 0 1px 0 rgba(255, 255, 255, 0.22),
147
+ 0 2px 0 color-mix(in srgb, var(--_fill) 80%, #000),
148
+ 0 6px 14px -6px color-mix(in srgb, var(--_fill) 40%, transparent);
147
149
 
148
150
  &:hover {
149
151
  background: var(--ylf-c-brand-hover, #1d4ed8);
150
- transform: translateY(-2px);
151
- box-shadow: var(--ylf-shadow-sm);
152
+ transform: translateY(-1px);
153
+ box-shadow:
154
+ inset 0 1px 0 rgba(255, 255, 255, 0.22),
155
+ 0 3px 0 color-mix(in srgb, var(--_fill) 80%, #000),
156
+ 0 8px 18px -6px color-mix(in srgb, var(--_fill) 35%, transparent);
152
157
  }
153
158
  }
154
159
 
155
160
  // 强调色来自共享上下文;实色上的文字与填充色成组维护。
156
161
  &--accent,
157
162
  &--aurora {
163
+ --_fill: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
158
164
  --_color: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
159
165
  --_soft: var(--ylf-accent-soft, var(--ylf-c-brand-soft, #eff6ff));
160
166
  --_text: var(--ylf-accent-text, var(--ylf-c-brand, #2563eb));
161
167
 
162
168
  color: var(--ylf-accent-on, var(--ylf-c-text-on-accent, #fff));
163
169
  background: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
164
- box-shadow: var(--ylf-shadow-sm);
170
+ border-color: color-mix(in srgb, var(--_fill) 82%, #000);
171
+ box-shadow:
172
+ inset 0 1px 0 rgba(255, 255, 255, 0.2),
173
+ 0 2px 0 color-mix(in srgb, var(--_fill) 78%, #000);
165
174
 
166
175
  &:hover {
167
176
  background: var(--ylf-accent-hover, var(--ylf-c-brand-hover, #1d4ed8));
@@ -173,11 +182,12 @@ function onClick(e: MouseEvent) {
173
182
  color: var(--ylf-c-text, #0f172a);
174
183
  background: var(--ylf-c-surface, #fff);
175
184
  border-color: var(--ylf-c-border-strong, #cbd5e1);
185
+ box-shadow: var(--ylf-shadow-control);
176
186
 
177
187
  &:hover {
178
188
  color: var(--ylf-c-brand, #2563eb);
179
189
  border-color: var(--ylf-c-brand, #2563eb);
180
- transform: translateY(-2px);
190
+ transform: translateY(-1px);
181
191
  }
182
192
  }
183
193
 
@@ -185,9 +195,10 @@ function onClick(e: MouseEvent) {
185
195
  &--soft {
186
196
  color: var(--ylf-c-brand, #2563eb);
187
197
  background: var(--ylf-c-brand-soft, #eff6ff);
198
+ border-color: color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
188
199
 
189
200
  &:hover {
190
- transform: translateY(-2px);
201
+ transform: translateY(-1px);
191
202
  box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
192
203
  }
193
204
  }
@@ -253,6 +264,10 @@ function onClick(e: MouseEvent) {
253
264
  }
254
265
 
255
266
  // --- 状态 ---
267
+ &:active:not(.is-disabled, .is-loading) {
268
+ transform: translateY(1px) scale(0.985);
269
+ }
270
+
256
271
  &.is-disabled,
257
272
  &:disabled {
258
273
  opacity: 0.45;
@@ -41,7 +41,7 @@ withDefaults(defineProps<{
41
41
  color: var(--ylf-c-text, #0f172a);
42
42
  background: var(--ylf-c-surface, #fff);
43
43
  border: 1px solid var(--ylf-c-border, #e2e8f0);
44
- box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
44
+ box-shadow: var(--ylf-shadow-control, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
45
45
  transition:
46
46
  transform var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
47
47
  box-shadow var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
@@ -58,6 +58,7 @@ withDefaults(defineProps<{
58
58
  border-color: var(--ylf-glass-border, rgba(255, 255, 255, 0.7));
59
59
  -webkit-backdrop-filter: var(--ylf-glass-blur, saturate(160%) blur(16px));
60
60
  backdrop-filter: var(--ylf-glass-blur, saturate(160%) blur(16px));
61
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
61
62
  }
62
63
 
63
64
  &--accent,
@@ -44,6 +44,7 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
44
44
  border: 2px solid var(--ylf-c-border-strong, #cbd5e1);
45
45
  border-radius: 7px;
46
46
  background: var(--ylf-c-surface, #fff);
47
+ box-shadow: var(--ylf-shadow-control);
47
48
  color: var(--ylf-c-text-on-accent, #fff);
48
49
  cursor: pointer;
49
50
  -webkit-tap-highlight-color: transparent;
@@ -57,7 +58,8 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
57
58
  }
58
59
 
59
60
  &:focus-visible {
60
- outline: none;
61
+ outline: 2px solid var(--ylf-c-brand, #2563eb);
62
+ outline-offset: 3px;
61
63
  box-shadow: 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff);
62
64
  }
63
65
 
@@ -65,6 +67,7 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
65
67
  &[data-state='indeterminate'] {
66
68
  background: var(--ylf-c-brand, #2563eb);
67
69
  border-color: var(--ylf-c-brand, #2563eb);
70
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
68
71
  }
69
72
 
70
73
  &[data-disabled] {
@@ -13,11 +13,15 @@ import {
13
13
  } from 'reka-ui'
14
14
  import { computed, useSlots } from 'vue'
15
15
 
16
+ defineOptions({ inheritAttrs: false })
17
+
16
18
  const props = withDefaults(defineProps<{
17
19
  title?: string
18
20
  description?: string
19
21
  /** 没有可见标题时供屏幕阅读器使用 */
20
22
  accessibleTitle?: string
23
+ /** Existing container in the same theme boundary. */
24
+ portalTo?: string | HTMLElement
21
25
  }>(), {
22
26
  accessibleTitle: '对话框',
23
27
  })
@@ -37,9 +41,9 @@ const descriptionProps = computed(() => hasDescription.value
37
41
  <slot name="trigger" />
38
42
  </DialogTrigger>
39
43
 
40
- <DialogPortal>
44
+ <DialogPortal :to="portalTo">
41
45
  <DialogOverlay class="ylf-dialog__overlay" />
42
- <DialogContent class="ylf-dialog__content" v-bind="descriptionProps">
46
+ <DialogContent class="ylf-dialog__content" v-bind="{ ...descriptionProps, ...$attrs }">
43
47
  <DialogTitle v-if="hasVisibleTitle" class="ylf-dialog__title">
44
48
  <slot name="title">
45
49
  {{ title }}
@@ -75,11 +79,11 @@ const descriptionProps = computed(() => hasDescription.value
75
79
  inset: 0;
76
80
  z-index: 100;
77
81
  background: var(--ylf-c-overlay, rgba(13, 17, 32, 0.45));
78
- -webkit-backdrop-filter: blur(4px);
79
- backdrop-filter: blur(4px);
82
+ -webkit-backdrop-filter: var(--ylf-overlay-blur, blur(10px));
83
+ backdrop-filter: var(--ylf-overlay-blur, blur(10px));
80
84
 
81
85
  &[data-state='open'] {
82
- animation: ylf-dialog-overlay-in 0.2s ease;
86
+ animation: ylf-dialog-overlay-in var(--ylf-duration-normal, 240ms) ease;
83
87
  }
84
88
  }
85
89
 
@@ -89,18 +93,20 @@ const descriptionProps = computed(() => hasDescription.value
89
93
  top: 50%;
90
94
  left: 50%;
91
95
  width: calc(100vw - 32px);
92
- max-width: 460px;
96
+ max-width: 480px;
93
97
  max-height: calc(100vh - 32px);
94
98
  overflow: auto;
95
- padding: 24px;
99
+ padding: 28px;
96
100
  transform: translate(-50%, -50%);
97
101
  border-radius: var(--ylf-radius-lg, 20px);
98
- background: var(--ylf-c-surface, #fff);
102
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
99
103
  border: 1px solid var(--ylf-c-border, #e2e8f0);
100
- box-shadow: var(--ylf-shadow-lg, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
104
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
105
+ -webkit-backdrop-filter: var(--ylf-glass-blur, blur(16px));
106
+ backdrop-filter: var(--ylf-glass-blur, blur(16px));
101
107
 
102
108
  &[data-state='open'] {
103
- animation: ylf-dialog-in 0.22s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
109
+ animation: ylf-dialog-in var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease);
104
110
  }
105
111
 
106
112
  &:focus-visible {
@@ -109,17 +115,22 @@ const descriptionProps = computed(() => hasDescription.value
109
115
  }
110
116
 
111
117
  .ylf-dialog__title {
112
- margin: 0 0 6px;
118
+ margin: 0 0 10px;
119
+ padding-right: 32px;
120
+ overflow-wrap: anywhere;
113
121
  font-family: var(--ylf-font-heading, inherit);
114
- font-size: 19px;
115
- font-weight: 700;
122
+ font-size: 24px;
123
+ font-weight: 650;
124
+ line-height: 1.35;
125
+ letter-spacing: -0.03em;
116
126
  color: var(--ylf-c-text, #0f172a);
117
127
  }
118
128
 
119
129
  .ylf-dialog__desc {
120
- margin: 0 0 16px;
130
+ margin: 0 0 24px;
131
+ overflow-wrap: anywhere;
121
132
  font-size: 14px;
122
- line-height: 1.6;
133
+ line-height: 1.75;
123
134
  color: var(--ylf-c-text-2, #475569);
124
135
  }
125
136
 
@@ -134,7 +145,8 @@ const descriptionProps = computed(() => hasDescription.value
134
145
  padding: 0;
135
146
  border: none;
136
147
  border-radius: var(--ylf-radius-sm, 10px);
137
- background: transparent;
148
+ background: var(--ylf-c-surface-raised, transparent);
149
+ box-shadow: inset 0 1px 0 var(--ylf-c-highlight, transparent);
138
150
  color: var(--ylf-c-text-3, #64748b);
139
151
  cursor: pointer;
140
152
  transition:
@@ -146,9 +158,28 @@ const descriptionProps = computed(() => hasDescription.value
146
158
  color: var(--ylf-c-text, #0f172a);
147
159
  }
148
160
 
161
+ &:focus-visible {
162
+ outline: 2px solid var(--ylf-c-brand, #2563eb);
163
+ outline-offset: 2px;
164
+ }
165
+
149
166
  svg {
150
- width: 18px;
151
- height: 18px;
167
+ width: 16px;
168
+ height: 16px;
169
+ transition: transform var(--ylf-duration-fast, 160ms) ease;
170
+ }
171
+
172
+ &:hover svg {
173
+ transform: rotate(90deg);
174
+ }
175
+ }
176
+
177
+ @media (pointer: coarse) {
178
+ .ylf-dialog__close {
179
+ top: 10px;
180
+ right: 10px;
181
+ width: 44px;
182
+ height: 44px;
152
183
  }
153
184
  }
154
185
 
@@ -161,7 +192,7 @@ const descriptionProps = computed(() => hasDescription.value
161
192
  @keyframes ylf-dialog-in {
162
193
  from {
163
194
  opacity: 0;
164
- transform: translate(-50%, -46%) scale(0.96);
195
+ transform: translate(-50%, -47%) scale(0.98);
165
196
  }
166
197
  }
167
198
 
@@ -170,5 +201,9 @@ const descriptionProps = computed(() => hasDescription.value
170
201
  .ylf-dialog__content[data-state='open'] {
171
202
  animation: none;
172
203
  }
204
+
205
+ .ylf-dialog__close svg {
206
+ transition: none;
207
+ }
173
208
  }
174
209
  </style>
@@ -1,6 +1,15 @@
1
1
  <script lang="ts" setup>
2
2
  import { DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuTrigger } from 'reka-ui'
3
3
 
4
+ defineOptions({ inheritAttrs: false })
5
+
6
+ defineProps<{
7
+ items: readonly MenuItem[]
8
+ portalTo?: string | HTMLElement
9
+ }>()
10
+
11
+ const emit = defineEmits<{ select: [value: string] }>()
12
+
4
13
  interface MenuItem {
5
14
  label?: string
6
15
  value?: string
@@ -9,27 +18,23 @@ interface MenuItem {
9
18
  separator?: boolean
10
19
  }
11
20
 
12
- defineProps<{
13
- items: MenuItem[]
14
- }>()
15
-
16
- const emit = defineEmits<{ select: [value: string] }>()
21
+ const open = defineModel<boolean>('open', { default: false })
17
22
  </script>
18
23
 
19
24
  <template>
20
- <DropdownMenuRoot>
25
+ <DropdownMenuRoot v-model:open="open">
21
26
  <DropdownMenuTrigger as-child>
22
27
  <slot name="trigger" />
23
28
  </DropdownMenuTrigger>
24
- <DropdownMenuPortal>
25
- <DropdownMenuContent class="ylf-menu" :side-offset="6" align="start">
29
+ <DropdownMenuPortal :to="portalTo">
30
+ <DropdownMenuContent v-bind="$attrs" class="ylf-menu" :side-offset="6" align="start">
26
31
  <template v-for="(it, i) in items" :key="i">
27
32
  <DropdownMenuSeparator v-if="it.separator" class="ylf-menu__sep" />
28
33
  <DropdownMenuItem
29
34
  v-else
30
35
  class="ylf-menu__item"
31
36
  :disabled="it.disabled"
32
- @select="it.value && emit('select', it.value)"
37
+ @select="it.value !== undefined && emit('select', it.value)"
33
38
  >
34
39
  {{ it.label }}
35
40
  </DropdownMenuItem>
@@ -44,14 +49,15 @@ const emit = defineEmits<{ select: [value: string] }>()
44
49
  z-index: 105;
45
50
  min-width: 180px;
46
51
  padding: 6px;
47
- background: var(--ylf-c-surface, #fff);
52
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
48
53
  border: 1px solid var(--ylf-c-border, #e2e8f0);
49
54
  border-radius: var(--ylf-radius, 14px);
50
- box-shadow: var(--ylf-shadow-lg, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
55
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
56
+ backdrop-filter: var(--ylf-glass-blur, blur(16px));
51
57
  transform-origin: var(--reka-dropdown-menu-content-transform-origin);
52
58
 
53
59
  &[data-state='open'] {
54
- animation: ylf-pop-in 0.16s ease;
60
+ animation: ylf-menu-in 0.16s ease;
55
61
  }
56
62
 
57
63
  &__item {
@@ -64,10 +70,12 @@ const emit = defineEmits<{ select: [value: string] }>()
64
70
  cursor: pointer;
65
71
  user-select: none;
66
72
  outline: none;
73
+ transition: background var(--ylf-duration-fast, 160ms) ease;
67
74
 
68
75
  &[data-highlighted] {
69
76
  background: var(--ylf-c-brand-soft, #eff6ff);
70
77
  color: var(--ylf-c-brand, #2563eb);
78
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
71
79
  }
72
80
 
73
81
  &[data-disabled] {
@@ -83,7 +91,13 @@ const emit = defineEmits<{ select: [value: string] }>()
83
91
  }
84
92
  }
85
93
 
86
- @keyframes ylf-pop-in {
94
+ @media (pointer: coarse) {
95
+ .ylf-menu__item {
96
+ min-height: 44px;
97
+ }
98
+ }
99
+
100
+ @keyframes ylf-menu-in {
87
101
  from {
88
102
  opacity: 0;
89
103
  transform: scale(0.96);
@@ -94,5 +108,9 @@ const emit = defineEmits<{ select: [value: string] }>()
94
108
  .ylf-menu[data-state='open'] {
95
109
  animation: none;
96
110
  }
111
+
112
+ .ylf-menu__item {
113
+ transition: none;
114
+ }
97
115
  }
98
116
  </style>
@@ -1,9 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import { PopoverArrow, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'
3
3
 
4
+ defineOptions({ inheritAttrs: false })
5
+
4
6
  withDefaults(defineProps<{
5
7
  side?: 'top' | 'right' | 'bottom' | 'left'
6
8
  align?: 'start' | 'center' | 'end'
9
+ portalTo?: string | HTMLElement
7
10
  }>(), {
8
11
  side: 'bottom',
9
12
  align: 'center',
@@ -17,8 +20,8 @@ const open = defineModel<boolean>('open', { default: false })
17
20
  <PopoverTrigger as-child>
18
21
  <slot name="trigger" />
19
22
  </PopoverTrigger>
20
- <PopoverPortal>
21
- <PopoverContent :side="side" :align="align" :side-offset="8" class="ylf-popover">
23
+ <PopoverPortal :to="portalTo">
24
+ <PopoverContent v-bind="$attrs" :side="side" :align="align" :side-offset="8" class="ylf-popover">
22
25
  <slot />
23
26
  <PopoverArrow class="ylf-popover__arrow" :width="12" :height="6" />
24
27
  </PopoverContent>
@@ -33,14 +36,15 @@ const open = defineModel<boolean>('open', { default: false })
33
36
  max-width: 320px;
34
37
  padding: 16px;
35
38
  color: var(--ylf-c-text, #0f172a);
36
- background: var(--ylf-c-surface, #fff);
39
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
37
40
  border: 1px solid var(--ylf-c-border, #e2e8f0);
38
41
  border-radius: var(--ylf-radius, 14px);
39
- box-shadow: var(--ylf-shadow-lg, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
42
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
43
+ backdrop-filter: var(--ylf-glass-blur, blur(16px));
40
44
  transform-origin: var(--reka-popover-content-transform-origin);
41
45
 
42
46
  &[data-state='open'] {
43
- animation: ylf-pop-in 0.18s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
47
+ animation: ylf-popover-in 0.18s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
44
48
  }
45
49
 
46
50
  &__arrow {
@@ -49,7 +53,7 @@ const open = defineModel<boolean>('open', { default: false })
49
53
  }
50
54
  }
51
55
 
52
- @keyframes ylf-pop-in {
56
+ @keyframes ylf-popover-in {
53
57
  from {
54
58
  opacity: 0;
55
59
  transform: scale(0.96);
@@ -4,7 +4,8 @@ import { ProgressIndicator, ProgressRoot } from 'reka-ui'
4
4
  import { computed } from 'vue'
5
5
 
6
6
  const props = withDefaults(defineProps<{
7
- value?: number
7
+ /** null means that progress is unknown. */
8
+ value?: number | null
8
9
  max?: number
9
10
  /** 进度条填充:brand 主色或 accent 纯色;aurora 是 accent 的旧别名 */
10
11
  variant?: 'brand' | 'accent' | 'aurora'
@@ -16,20 +17,24 @@ const props = withDefaults(defineProps<{
16
17
  tone: 'blue',
17
18
  })
18
19
 
19
- const percent = computed(() => Math.max(0, Math.min(100, (props.value / props.max) * 100)))
20
+ const safeMax = computed(() => Number.isFinite(props.max) && props.max > 0 ? props.max : 100)
21
+ const safeValue = computed(() => props.value === null || !Number.isFinite(props.value)
22
+ ? null
23
+ : Math.max(0, Math.min(safeMax.value, props.value)))
24
+ const percent = computed(() => safeValue.value === null ? null : safeValue.value / safeMax.value * 100)
20
25
  </script>
21
26
 
22
27
  <template>
23
28
  <ProgressRoot
24
- :model-value="value"
25
- :max="max"
29
+ :model-value="safeValue"
30
+ :max="safeMax"
26
31
  class="ylf-progress"
27
32
  :data-ylf-tone="tone"
28
33
  :class="`ylf-progress--${variant}`"
29
34
  >
30
35
  <ProgressIndicator
31
36
  class="ylf-progress__indicator"
32
- :style="{ transform: `translateX(-${100 - percent}%)` }"
37
+ :style="{ transform: percent === null ? undefined : `translateX(-${100 - percent}%)` }"
33
38
  />
34
39
  </ProgressRoot>
35
40
  </template>
@@ -52,6 +57,20 @@ const percent = computed(() => Math.max(0, Math.min(100, (props.value / props.ma
52
57
  transition: transform 0.4s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
53
58
  }
54
59
 
60
+ .ylf-progress[data-state='indeterminate'] .ylf-progress__indicator {
61
+ width: 40%;
62
+ animation: ylf-progress-indeterminate 1.4s ease-in-out infinite;
63
+ }
64
+
65
+ @keyframes ylf-progress-indeterminate {
66
+ from {
67
+ transform: translateX(-100%);
68
+ }
69
+ to {
70
+ transform: translateX(250%);
71
+ }
72
+ }
73
+
55
74
  .ylf-progress--accent .ylf-progress__indicator,
56
75
  .ylf-progress--aurora .ylf-progress__indicator {
57
76
  background: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
@@ -61,5 +80,10 @@ const percent = computed(() => Math.max(0, Math.min(100, (props.value / props.ma
61
80
  .ylf-progress__indicator {
62
81
  transition: none;
63
82
  }
83
+
84
+ .ylf-progress[data-state='indeterminate'] .ylf-progress__indicator {
85
+ animation: none;
86
+ transform: translateX(75%);
87
+ }
64
88
  }
65
89
  </style>
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  // 行为 / 可访问性由 reka-ui 提供(role=radiogroup、方向键 roving focus);皮肤走 token。
3
3
  import { RadioGroupIndicator, RadioGroupItem, RadioGroupRoot } from 'reka-ui'
4
+ import { nextTick } from 'vue'
4
5
 
5
6
  interface RadioOption {
6
7
  label: string
@@ -8,8 +9,8 @@ interface RadioOption {
8
9
  disabled?: boolean
9
10
  }
10
11
 
11
- withDefaults(defineProps<{
12
- options: RadioOption[]
12
+ const props = withDefaults(defineProps<{
13
+ options: readonly RadioOption[]
13
14
  disabled?: boolean
14
15
  orientation?: 'vertical' | 'horizontal'
15
16
  }>(), {
@@ -18,6 +19,22 @@ withDefaults(defineProps<{
18
19
  })
19
20
 
20
21
  const model = defineModel<string>()
22
+
23
+ function selectFocusedRadio(event: KeyboardEvent) {
24
+ if (props.disabled || !event.defaultPrevented || !['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key))
25
+ return
26
+ const group = event.currentTarget as HTMLElement
27
+ // Reka 2.10.x defers selection until after focus; a fast keyup can clear its flag.
28
+ // Let Reka move focus and skip disabled items, then synchronize that choice.
29
+ nextTick(() => {
30
+ const focused = document.activeElement
31
+ if (!(focused instanceof HTMLElement) || !group.contains(focused) || focused.getAttribute('role') !== 'radio')
32
+ return
33
+ const option = props.options.find(option => option.value === focused.getAttribute('value'))
34
+ if (option && !option.disabled && model.value !== option.value)
35
+ model.value = option.value
36
+ })
37
+ }
21
38
  </script>
22
39
 
23
40
  <template>
@@ -27,6 +44,7 @@ const model = defineModel<string>()
27
44
  :orientation="orientation"
28
45
  class="ylf-radio-group"
29
46
  :class="`ylf-radio-group--${orientation}`"
47
+ @keydown="selectFocusedRadio"
30
48
  >
31
49
  <RadioGroupItem
32
50
  v-for="opt in options"
@@ -79,6 +97,7 @@ const model = defineModel<string>()
79
97
  border: 2px solid var(--ylf-c-border-strong, #cbd5e1);
80
98
  border-radius: 50%;
81
99
  background: var(--ylf-c-surface, #fff);
100
+ box-shadow: var(--ylf-shadow-control);
82
101
  transition:
83
102
  border-color 0.18s ease,
84
103
  box-shadow 0.2s ease;
@@ -94,6 +113,8 @@ const model = defineModel<string>()
94
113
 
95
114
  &:focus-visible .ylf-radio__control {
96
115
  box-shadow: 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff);
116
+ outline: 2px solid var(--ylf-c-brand, #2563eb);
117
+ outline-offset: 3px;
97
118
  }
98
119
 
99
120
  &[data-state='checked'] .ylf-radio__control {
@@ -69,7 +69,8 @@ function updateValue(value: unknown): void {
69
69
  padding: 3px;
70
70
  border: 1px solid var(--ylf-c-border, #e2e8f0);
71
71
  border-radius: var(--ylf-radius-sm, 10px);
72
- background: var(--ylf-c-bg-soft, #f1f5f9);
72
+ background: var(--ylf-c-surface-inset, var(--ylf-c-bg-soft, #f1f5f9));
73
+ box-shadow: var(--ylf-shadow-inset);
73
74
  font-family: var(--ylf-font-body, inherit);
74
75
  }
75
76
 
@@ -122,7 +123,7 @@ function updateValue(value: unknown): void {
122
123
  color: var(--ylf-c-brand, #2563eb);
123
124
  background: var(--ylf-c-surface, #fff);
124
125
  border-color: var(--ylf-c-border, #e2e8f0);
125
- box-shadow: var(--ylf-shadow-sm);
126
+ box-shadow: var(--ylf-shadow-control, var(--ylf-shadow-sm));
126
127
  }
127
128
 
128
129
  .ylf-segmented__item:focus-visible {
@@ -155,7 +156,7 @@ function updateValue(value: unknown): void {
155
156
 
156
157
  .ylf-segmented__count {
157
158
  min-width: 16px;
158
- color: var(--ylf-c-text-3, #64748b);
159
+ color: var(--ylf-c-text-2, #475569);
159
160
  font-size: 10px;
160
161
  font-variant-numeric: tabular-nums;
161
162
  text-align: center;