@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
@@ -11,10 +11,16 @@ const props = withDefaults(defineProps<{
11
11
  size?: 'sm' | 'md'
12
12
  placeholder?: string
13
13
  disabled?: boolean
14
+ /** Native form field name and validation. */
15
+ name?: string
16
+ required?: boolean
17
+ /** Existing container in the same theme boundary. */
18
+ portalTo?: string | HTMLElement
14
19
  }>(), {
15
20
  size: 'md',
16
21
  placeholder: '请选择',
17
22
  disabled: false,
23
+ required: false,
18
24
  })
19
25
 
20
26
  const model = defineModel<T>()
@@ -22,7 +28,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
22
28
  </script>
23
29
 
24
30
  <template>
25
- <SelectRoot v-model="model" :disabled="disabled">
31
+ <SelectRoot v-model="model" :disabled="disabled" :name="name" :required="required">
26
32
  <SelectTrigger class="ylf-select__trigger" :data-size="size" :aria-label="$attrs.id || $attrs['aria-labelledby'] ? undefined : placeholder" v-bind="$attrs">
27
33
  <SelectValue :placeholder="placeholder" class="ylf-select__label">
28
34
  <span v-if="selectedOption?.color" class="ylf-select__swatch" :style="{ backgroundColor: selectedOption.color }" aria-hidden="true" />
@@ -36,7 +42,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
36
42
  </slot>
37
43
  </SelectIcon>
38
44
  </SelectTrigger>
39
- <SelectPortal>
45
+ <SelectPortal :to="portalTo">
40
46
  <SelectContent class="ylf-select__content" :data-size="size" position="popper" :side-offset="6">
41
47
  <SelectViewport class="ylf-select__viewport">
42
48
  <SelectItem
@@ -80,6 +86,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
80
86
  background: var(--ylf-c-surface, #fff);
81
87
  border: 1px solid var(--ylf-c-border-strong, #cbd5e1);
82
88
  border-radius: var(--ylf-radius, 14px);
89
+ box-shadow: var(--ylf-shadow-control);
83
90
  cursor: pointer;
84
91
  transition:
85
92
  border-color 0.18s ease,
@@ -93,6 +100,13 @@ const selectedOption = computed(() => props.options.find(option => option.value
93
100
  border-color: var(--ylf-c-brand, #2563eb);
94
101
  }
95
102
 
103
+ &[data-state='open'] {
104
+ border-color: var(--ylf-c-brand, #2563eb);
105
+ box-shadow:
106
+ var(--ylf-shadow-control),
107
+ 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff);
108
+ }
109
+
96
110
  &:focus-visible {
97
111
  outline: none;
98
112
  border-color: var(--ylf-c-brand, #2563eb);
@@ -125,6 +139,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
125
139
  flex: none;
126
140
  display: inline-flex;
127
141
  color: var(--ylf-c-text-3, #64748b);
142
+ transition: transform var(--ylf-duration-fast, 160ms) ease;
128
143
 
129
144
  :where(svg, i, span) {
130
145
  width: 18px;
@@ -132,6 +147,10 @@ const selectedOption = computed(() => props.options.find(option => option.value
132
147
  }
133
148
  }
134
149
 
150
+ .ylf-select__trigger[data-state='open'] .ylf-select__icon {
151
+ transform: rotate(180deg);
152
+ }
153
+
135
154
  .ylf-select__content {
136
155
  z-index: 105;
137
156
  box-sizing: border-box;
@@ -139,13 +158,15 @@ const selectedOption = computed(() => props.options.find(option => option.value
139
158
  max-width: var(--reka-select-content-available-width);
140
159
  max-height: var(--reka-select-content-available-height);
141
160
  padding: 6px;
142
- background: var(--ylf-c-surface, #fff);
161
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
143
162
  border: 1px solid var(--ylf-c-border, #e2e8f0);
144
163
  border-radius: var(--ylf-radius, 14px);
145
- box-shadow: var(--ylf-shadow-lg, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
164
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
165
+ backdrop-filter: var(--ylf-glass-blur, blur(16px));
166
+ transform-origin: var(--reka-select-content-transform-origin);
146
167
 
147
168
  &[data-state='open'] {
148
- animation: ylf-pop-in 0.16s ease;
169
+ animation: ylf-select-in 0.16s ease;
149
170
  }
150
171
  }
151
172
 
@@ -165,10 +186,12 @@ const selectedOption = computed(() => props.options.find(option => option.value
165
186
  cursor: pointer;
166
187
  user-select: none;
167
188
  outline: none;
189
+ transition: background var(--ylf-duration-fast, 160ms) ease;
168
190
 
169
191
  &[data-highlighted] {
170
192
  background: var(--ylf-c-brand-soft, #eff6ff);
171
193
  color: var(--ylf-c-brand, #2563eb);
194
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
172
195
  }
173
196
 
174
197
  &[data-disabled] {
@@ -208,7 +231,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
208
231
  }
209
232
  }
210
233
 
211
- @keyframes ylf-pop-in {
234
+ @keyframes ylf-select-in {
212
235
  from {
213
236
  opacity: 0;
214
237
  transform: scale(0.96);
@@ -219,5 +242,10 @@ const selectedOption = computed(() => props.options.find(option => option.value
219
242
  .ylf-select__content[data-state='open'] {
220
243
  animation: none;
221
244
  }
245
+
246
+ .ylf-select__icon,
247
+ .ylf-select__item {
248
+ transition: none;
249
+ }
222
250
  }
223
251
  </style>
@@ -6,13 +6,19 @@ withDefaults(defineProps<{
6
6
  max?: number
7
7
  step?: number
8
8
  disabled?: boolean
9
+ /** Accessible name for a single value or the range as a whole. */
10
+ label?: string
11
+ /** Per-thumb accessible names, such as minimum and maximum price. */
12
+ thumbLabels?: readonly string[]
9
13
  }>(), {
10
14
  min: 0,
11
15
  max: 100,
12
16
  step: 1,
13
17
  disabled: false,
18
+ label: '数值',
14
19
  })
15
20
 
21
+ const emit = defineEmits<{ valueCommit: [value: number[]] }>()
16
22
  const model = defineModel<number[]>({ default: () => [50] })
17
23
  </script>
18
24
 
@@ -24,11 +30,17 @@ const model = defineModel<number[]>({ default: () => [50] })
24
30
  :step="step"
25
31
  :disabled="disabled"
26
32
  class="ylf-slider"
33
+ @value-commit="emit('valueCommit', $event)"
27
34
  >
28
35
  <SliderTrack class="ylf-slider__track">
29
36
  <SliderRange class="ylf-slider__range" />
30
37
  </SliderTrack>
31
- <SliderThumb v-for="(_, i) in model" :key="i" class="ylf-slider__thumb" />
38
+ <SliderThumb
39
+ v-for="(_, i) in model"
40
+ :key="i"
41
+ class="ylf-slider__thumb"
42
+ :aria-label="thumbLabels?.[i] || (model.length === 1 ? label : `${label} ${i + 1}`)"
43
+ />
32
44
  </SliderRoot>
33
45
  </template>
34
46
 
@@ -66,7 +78,7 @@ const model = defineModel<number[]>({ default: () => [50] })
66
78
  width: 18px;
67
79
  height: 18px;
68
80
  border-radius: 50%;
69
- background: #fff;
81
+ background: var(--ylf-c-surface, #fff);
70
82
  border: 2px solid var(--ylf-c-brand, #2563eb);
71
83
  box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
72
84
  cursor: grab;
@@ -86,4 +98,22 @@ const model = defineModel<number[]>({ default: () => [50] })
86
98
  }
87
99
  }
88
100
  }
101
+
102
+ @media (pointer: coarse) {
103
+ .ylf-slider {
104
+ height: 44px;
105
+ }
106
+
107
+ .ylf-slider__thumb::before {
108
+ position: absolute;
109
+ inset: -13px;
110
+ content: '';
111
+ }
112
+ }
113
+
114
+ @media (prefers-reduced-motion: reduce) {
115
+ .ylf-slider__thumb {
116
+ transition: none;
117
+ }
118
+ }
89
119
  </style>
@@ -46,6 +46,9 @@ const checked = defineModel<boolean>({ default: false })
46
46
  border: none;
47
47
  border-radius: var(--ylf-radius-pill, 999px);
48
48
  background: var(--ylf-c-bg-mute, #e2e8f0);
49
+ box-shadow:
50
+ var(--ylf-shadow-inset),
51
+ inset 0 0 0 1px var(--ylf-c-edge, transparent);
49
52
  cursor: pointer;
50
53
  -webkit-tap-highlight-color: transparent;
51
54
  transition:
@@ -86,7 +89,10 @@ const checked = defineModel<boolean>({ default: false })
86
89
  height: calc(var(--_h) - var(--_pad) * 2);
87
90
  border-radius: 50%;
88
91
  background: #fff;
89
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
92
+ box-shadow:
93
+ inset 0 1px 0 rgba(255, 255, 255, 0.4),
94
+ 0 1px 2px rgba(0, 0, 0, 0.12),
95
+ 0 3px 5px rgba(0, 0, 0, 0.18);
90
96
  transform: translateX(var(--_pad));
91
97
  transition: transform var(--ylf-duration-normal, 240ms) var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
92
98
  will-change: transform;
@@ -8,7 +8,7 @@ interface TabItem {
8
8
  }
9
9
 
10
10
  withDefaults(defineProps<{
11
- items: TabItem[]
11
+ items: readonly TabItem[]
12
12
  orientation?: 'horizontal' | 'vertical'
13
13
  }>(), {
14
14
  orientation: 'horizontal',
@@ -65,7 +65,10 @@ const model = defineModel<string>()
65
65
  background: transparent;
66
66
  border: none;
67
67
  cursor: pointer;
68
- transition: color 0.2s ease;
68
+ border-radius: var(--ylf-radius-sm, 10px) var(--ylf-radius-sm, 10px) 0 0;
69
+ transition:
70
+ color var(--ylf-duration-fast, 160ms) ease,
71
+ background var(--ylf-duration-fast, 160ms) ease;
69
72
 
70
73
  &:hover:not([data-disabled]) {
71
74
  color: var(--ylf-c-text, #0f172a);
@@ -73,6 +76,7 @@ const model = defineModel<string>()
73
76
 
74
77
  &[data-state='active'] {
75
78
  color: var(--ylf-c-brand, #2563eb);
79
+ background: color-mix(in srgb, var(--ylf-c-brand-soft, #eff6ff) 65%, transparent);
76
80
  }
77
81
 
78
82
  &[data-disabled] {
@@ -81,7 +85,8 @@ const model = defineModel<string>()
81
85
  }
82
86
 
83
87
  &:focus-visible {
84
- outline: none;
88
+ outline: 2px solid var(--ylf-c-brand, #2563eb);
89
+ outline-offset: -3px;
85
90
  border-radius: var(--ylf-radius-sm, 10px);
86
91
  box-shadow: 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff);
87
92
  }
@@ -95,6 +100,7 @@ const model = defineModel<string>()
95
100
  height: 2.5px;
96
101
  border-radius: 999px;
97
102
  background: var(--ylf-c-brand, #2563eb);
103
+ box-shadow: 0 1px 4px color-mix(in srgb, var(--ylf-c-brand, #2563eb) 25%, transparent);
98
104
  transform: translateX(var(--reka-tabs-indicator-position));
99
105
  transition:
100
106
  transform 0.25s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1)),
@@ -2,11 +2,14 @@
2
2
  // 行为 / 定位 / a11y 由 reka-ui 提供;皮肤走 token。
3
3
  import { TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger } from 'reka-ui'
4
4
 
5
+ defineOptions({ inheritAttrs: false })
6
+
5
7
  withDefaults(defineProps<{
6
8
  content?: string
7
9
  side?: 'top' | 'right' | 'bottom' | 'left'
8
10
  delay?: number
9
11
  disabled?: boolean
12
+ portalTo?: string | HTMLElement
10
13
  }>(), {
11
14
  side: 'top',
12
15
  delay: 300,
@@ -17,10 +20,10 @@ withDefaults(defineProps<{
17
20
  <template>
18
21
  <TooltipProvider :delay-duration="delay">
19
22
  <TooltipRoot :disabled="disabled">
20
- <TooltipTrigger as-child>
23
+ <TooltipTrigger as-child v-bind="$attrs">
21
24
  <slot />
22
25
  </TooltipTrigger>
23
- <TooltipPortal>
26
+ <TooltipPortal :to="portalTo">
24
27
  <TooltipContent :side="side" :side-offset="6" class="ylf-tooltip">
25
28
  <slot name="content">
26
29
  {{ content }}
@@ -36,17 +39,18 @@ withDefaults(defineProps<{
36
39
  .ylf-tooltip {
37
40
  z-index: 110;
38
41
  max-width: 240px;
39
- padding: 7px 11px;
42
+ padding: 8px 12px;
40
43
  font-size: 13px;
41
44
  line-height: 1.5;
42
45
  color: var(--ylf-c-bg, #fbfcff);
43
46
  background: var(--ylf-c-text, #0f172a);
44
47
  border-radius: var(--ylf-radius-sm, 10px);
48
+ border: 1px solid color-mix(in srgb, var(--ylf-c-bg, #fbfcff) 15%, transparent);
45
49
  box-shadow: var(--ylf-shadow, 0 10px 28px -8px rgba(15, 23, 42, 0.16));
46
50
  transform-origin: var(--reka-tooltip-content-transform-origin);
47
51
 
48
52
  &[data-state='delayed-open'] {
49
- animation: ylf-pop-in 0.16s ease;
53
+ animation: ylf-tooltip-in 0.16s ease;
50
54
  }
51
55
 
52
56
  &__arrow {
@@ -54,7 +58,7 @@ withDefaults(defineProps<{
54
58
  }
55
59
  }
56
60
 
57
- @keyframes ylf-pop-in {
61
+ @keyframes ylf-tooltip-in {
58
62
  from {
59
63
  opacity: 0;
60
64
  transform: scale(0.94);
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  const items = [
3
3
  { value: 'a', title: '什么是 YunLeFun Design?', content: '云乐坊设计系统,统一设计规范、品牌视觉与 UI 实现;默认晴空蓝为主,高饱和纯色点缀。' },
4
- { value: 'b', title: '为什么基于 reka-ui?', content: 'reka 管行为与可访问性,我们只管皮肤——省心,且无障碍达标。' },
4
+ { value: 'b', title: '为什么基于 reka-ui?', content: 'Reka UI 提供键盘、焦点和 ARIA 行为,云乐坊提供产品接口与主题;封装后的场景仍需逐项验收。' },
5
5
  { value: 'c', title: '支持暗色吗?', content: '晴空白与深蓝夜空两套中性色,token 驱动,零配置随主题切换。' },
6
6
  ]
7
7
  </script>
@@ -17,3 +17,5 @@ title_zh: 手风琴
17
17
  ## Slots
18
18
 
19
19
  每项内容可用 `value` 同名插槽覆盖 `content`。
20
+
21
+ `items` 支持只读数组。单开模式全部收起时值为 `undefined`,多开模式为字符串数组;调用方应允许收起状态。方向键、Home / End 在标题间移动焦点,跳过禁用项。
@@ -10,6 +10,8 @@ title_zh: 头像
10
10
  | 属性 | 说明 | 类型 | 默认值 |
11
11
  | ---------- | ---------------------- | ---------------- | ------ |
12
12
  | `src` | 图片地址 | `string` | — |
13
- | `alt` | 替代文字 | `string` | — |
13
+ | `alt` | 替代文字 | `string` | `''` |
14
14
  | `fallback` | 回退文字(如姓名首字) | `string` | — |
15
15
  | `size` | 尺寸 | `sm \| md \| lg` | `md` |
16
+
17
+ 有意义的头像使用完整 `alt`(例如用户姓名);图片缺失时,回退图像也使用该名称。没有 `alt` 时回退文字作为名称;仅装饰的图片可保留空 `alt`。`fallback` 决定显示的文字,不会从图片地址自动推断姓名。
@@ -1,28 +1,29 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue'
2
+ import { ref, useId } from 'vue'
3
3
 
4
4
  const a = ref(true)
5
5
  const b = ref(false)
6
6
  const c = ref<boolean | 'indeterminate'>('indeterminate')
7
+ const id = useId()
7
8
  </script>
8
9
 
9
10
  <template>
10
11
  <div class="flex flex-col gap-4">
11
12
  <div class="flex items-center gap-2">
12
- <YlfCheckbox v-model="a" />
13
- <span class="text-sm">已勾选</span>
13
+ <YlfCheckbox :id="`${id}-checked`" v-model="a" />
14
+ <label :for="`${id}-checked`" class="text-sm">已勾选</label>
14
15
  </div>
15
16
  <div class="flex items-center gap-2">
16
- <YlfCheckbox v-model="b" />
17
- <span class="text-sm">未勾选</span>
17
+ <YlfCheckbox :id="`${id}-unchecked`" v-model="b" />
18
+ <label :for="`${id}-unchecked`" class="text-sm">未勾选</label>
18
19
  </div>
19
20
  <div class="flex items-center gap-2">
20
- <YlfCheckbox v-model="c" />
21
- <span class="text-sm">半选 indeterminate</span>
21
+ <YlfCheckbox :id="`${id}-mixed`" v-model="c" />
22
+ <label :for="`${id}-mixed`" class="text-sm">半选 indeterminate</label>
22
23
  </div>
23
24
  <div class="flex items-center gap-2 op-60">
24
- <YlfCheckbox :model-value="true" disabled />
25
- <span class="text-sm">禁用</span>
25
+ <YlfCheckbox :id="`${id}-disabled`" :model-value="true" disabled />
26
+ <label :for="`${id}-disabled`" class="text-sm">禁用</label>
26
27
  </div>
27
28
  </div>
28
29
  </template>
@@ -12,3 +12,5 @@ title_zh: 复选框
12
12
  | `v-model` | 勾选状态 | `boolean \| 'indeterminate'` | `false` |
13
13
  | `value` | 表单提交值 | `string` | — |
14
14
  | `disabled` | 禁用 | `boolean` | `false` |
15
+
16
+ 每个复选框必须有可访问名称:传入 `aria-label="同意服务条款"`,或通过 `id` 与 `<label for>` 关联。旁边的普通 `<span>` 不会自动成为标签。`name` 和 `required` 透传给 Reka UI;置于原生表单时,勾选值进入 `FormData`,禁用项不提交。
@@ -2,32 +2,164 @@
2
2
  import { ref } from 'vue'
3
3
 
4
4
  const open = ref(false)
5
+ const saved = ref(false)
6
+
7
+ function saveWork() {
8
+ saved.value = true
9
+ open.value = false
10
+ }
5
11
  </script>
6
12
 
7
13
  <template>
8
14
  <YlfDialog
9
15
  v-model:open="open"
10
16
  title="云端之上"
11
- description="这是一个基于 reka-ui 的对话框:自带遮罩、焦点陷阱、ESC / 点击外部关闭、滚动锁与 aria 关联。"
17
+ description="给灵感一个安心的落点。保存这份作品,下次从这里继续。"
12
18
  >
13
19
  <template #trigger>
14
20
  <YlfButton variant="primary">
21
+ <template #icon>
22
+ <svg class="dialog-demo__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
23
+ <path d="M7 18a5 5 0 0 1-.5-10 6 6 0 0 1 11.4 1.5A4.3 4.3 0 0 1 18 18H7Z" />
24
+ </svg>
25
+ </template>
15
26
  打开对话框
16
27
  </YlfButton>
17
28
  </template>
18
29
 
19
- <div class="flex flex-col gap-4">
20
- <p class="text-sm">
21
- 行为由 reka-ui 提供,皮肤是云乐坊 token —— 试试按 <kbd>Esc</kbd> 或点击遮罩关闭。
22
- </p>
23
- <div class="flex justify-end gap-2">
24
- <YlfButton variant="secondary" size="sm" @click="open = false">
25
- 取消
26
- </YlfButton>
27
- <YlfButton variant="primary" size="sm" @click="open = false">
28
- 确定
29
- </YlfButton>
30
+ <div class="dialog-demo__work">
31
+ <div class="dialog-demo__thumbnail" aria-hidden="true">
32
+ <svg viewBox="0 0 80 64" fill="none">
33
+ <circle cx="53" cy="20" r="10" fill="var(--ylf-accent-sun)" />
34
+ <path d="M16 47a11 11 0 0 1 3-22 15 15 0 0 1 28 6 9 9 0 0 1 1 18H16Z" fill="var(--ylf-c-surface)" stroke="var(--ylf-c-border)" />
35
+ </svg>
36
+ </div>
37
+ <div class="dialog-demo__work-copy">
38
+ <strong>一朵云的灵感</strong>
39
+ <span>创作草稿 · 刚刚编辑</span>
30
40
  </div>
41
+ <YlfBadge variant="featured">
42
+ 原创
43
+ </YlfBadge>
44
+ </div>
45
+
46
+ <div class="dialog-demo__destination">
47
+ <svg class="dialog-demo__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
48
+ <path d="M7 18a5 5 0 0 1-.5-10 6 6 0 0 1 11.4 1.5A4.3 4.3 0 0 1 18 18H7Z" />
49
+ </svg>
50
+ <div><strong>我的云端空间</strong><span>自动同步到你的设备</span></div>
51
+ <svg class="dialog-demo__icon dialog-demo__check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="m5 12 4 4L19 6" /></svg>
52
+ </div>
53
+
54
+ <div class="dialog-demo__actions">
55
+ <YlfButton variant="secondary" @click="open = false">
56
+ 再想想
57
+ </YlfButton>
58
+ <YlfButton variant="primary" @click="saveWork">
59
+ 保存到云端
60
+ </YlfButton>
31
61
  </div>
32
62
  </YlfDialog>
63
+ <p v-if="saved" class="dialog-demo__saved" role="status">
64
+ 作品已保存到云端,可以安心继续创作。
65
+ </p>
33
66
  </template>
67
+
68
+ <style scoped>
69
+ .dialog-demo__icon {
70
+ width: 20px;
71
+ height: 20px;
72
+ flex: none;
73
+ }
74
+ .dialog-demo__work {
75
+ display: flex;
76
+ align-items: center;
77
+ gap: 14px;
78
+ padding: 14px;
79
+ border: 1px solid var(--ylf-c-border);
80
+ border-radius: var(--ylf-radius);
81
+ background: var(--ylf-c-surface-raised);
82
+ box-shadow: var(--ylf-shadow-control);
83
+ }
84
+ .dialog-demo__thumbnail {
85
+ width: 64px;
86
+ height: 64px;
87
+ flex: none;
88
+ border-radius: 12px;
89
+ background: var(--ylf-c-sky);
90
+ overflow: hidden;
91
+ }
92
+ .dialog-demo__thumbnail svg {
93
+ width: 100%;
94
+ height: 100%;
95
+ }
96
+ .dialog-demo__work-copy {
97
+ display: grid;
98
+ flex: 1;
99
+ gap: 5px;
100
+ min-width: 0;
101
+ }
102
+ .dialog-demo__work strong,
103
+ .dialog-demo__destination strong {
104
+ font-size: 14px;
105
+ font-weight: 600;
106
+ }
107
+ .dialog-demo__work-copy span,
108
+ .dialog-demo__destination span {
109
+ font-size: 12px;
110
+ color: var(--ylf-c-text-2);
111
+ line-height: 1.6;
112
+ }
113
+ .dialog-demo__destination {
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 12px;
117
+ padding: 20px 4px;
118
+ color: var(--ylf-c-brand);
119
+ }
120
+ .dialog-demo__destination > div {
121
+ display: grid;
122
+ flex: 1;
123
+ gap: 4px;
124
+ }
125
+ .dialog-demo__destination strong {
126
+ color: var(--ylf-c-text);
127
+ }
128
+ .dialog-demo__check {
129
+ width: 18px;
130
+ }
131
+ .dialog-demo__actions {
132
+ display: flex;
133
+ justify-content: flex-end;
134
+ flex-wrap: wrap;
135
+ gap: 10px;
136
+ padding-top: 20px;
137
+ border-top: 1px solid var(--ylf-c-border);
138
+ }
139
+ .dialog-demo__saved {
140
+ margin: 18px 0 0;
141
+ color: var(--ylf-c-text-2);
142
+ font-size: 14px;
143
+ }
144
+ @media (max-width: 400px) {
145
+ .dialog-demo__work {
146
+ display: grid;
147
+ grid-template-columns: 52px minmax(0, 1fr);
148
+ gap: 8px 12px;
149
+ }
150
+ .dialog-demo__thumbnail {
151
+ width: 52px;
152
+ height: 52px;
153
+ }
154
+ .dialog-demo__work :deep(.ylf-badge) {
155
+ grid-column: 2;
156
+ justify-self: start;
157
+ }
158
+ .dialog-demo__thumbnail {
159
+ grid-row: 1 / 3;
160
+ }
161
+ .dialog-demo__actions :deep(.ylf-button) {
162
+ padding-inline: 18px;
163
+ }
164
+ }
165
+ </style>
@@ -7,15 +7,18 @@ title_zh: 对话框
7
7
 
8
8
  ## Props
9
9
 
10
- | 属性 | 说明 | 类型 | 默认值 |
11
- | ----------------- | -------------------------------- | --------- | ---------- |
12
- | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
- | `title` | 可见标题 | `string` | — |
14
- | `description` | 描述 | `string` | — |
15
- | `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
10
+ | 属性 | 说明 | 类型 | 默认值 |
11
+ | ----------------- | -------------------------------- | ----------------------- | ----------------------- |
12
+ | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
+ | `title` | 可见标题 | `string` | — |
14
+ | `description` | 描述 | `string` | — |
15
+ | `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
16
+ | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
16
17
 
17
18
  建议始终提供 `title`。只有视觉设计明确隐藏标题时,才改用描述场景的 `accessible-title`。
18
19
 
20
+ `class`、`id`、`data-*` 和事件传给对话框内容;显式的 `aria-describedby` 可关联调用方的说明。焦点陷阱、Escape 关闭和关闭后回到触发器仍由 Reka UI 管理。局部主题中把 `portal-to` 指向同一主题边界内的容器。长标题会换行并为关闭按钮保留空间。
21
+
19
22
  ## Registry
20
23
 
21
24
  Dialog 可通过 [Registry 分发](/guide/registry)复制源码;安装时会自动带入 `reka-ui`、Sass 与共享 token。
@@ -7,9 +7,13 @@ title_zh: 下拉菜单
7
7
 
8
8
  ## Props
9
9
 
10
- | 属性 | 说明 | 类型 | 默认值 |
11
- | ------- | ------ | ------------ | ------ |
12
- | `items` | 菜单项 | `MenuItem[]` | — |
10
+ | 属性 | 说明 | 类型 | 默认值 |
11
+ | -------------- | ---------------------- | ----------------------- | ----------------------- |
12
+ | `items` | 菜单项 | `readonly MenuItem[]` | — |
13
+ | `v-model:open` | 显隐状态 | `boolean` | `false` |
14
+ | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
15
+
16
+ `class`、`data-*`、ARIA 属性和事件传给菜单内容。`portal-to` 可把菜单放入已有的局部主题容器;未传时继续使用 ConfigProvider 或 `body`。支持方向键、Home / End、Enter 选择和 Escape 关闭;禁用项会被跳过。
13
17
 
14
18
  ### MenuItem
15
19
 
@@ -25,3 +29,5 @@ title_zh: 下拉菜单
25
29
  | 名称 | 说明 |
26
30
  | -------- | ---------------------------- |
27
31
  | `select` | 选中某项时触发,回传 `value` |
32
+
33
+ `value=""` 可表示“全部”或“清除筛选”,仍会触发 `select`。没有 `value` 的项不触发选值事件。
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <YlfPopover side="bottom" align="start">
2
+ <YlfPopover side="bottom" align="start" aria-label="云乐坊介绍">
3
3
  <template #trigger>
4
4
  <YlfButton variant="primary">
5
5
  打开浮层
@@ -7,11 +7,14 @@ title_zh: 浮层
7
7
 
8
8
  ## Props
9
9
 
10
- | 属性 | 说明 | 类型 | 默认值 |
11
- | -------------- | -------- | -------------------------------- | -------- |
12
- | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
- | `side` | 方向 | `top \| right \| bottom \| left` | `bottom` |
14
- | `align` | 对齐 | `start \| center \| end` | `center` |
10
+ | 属性 | 说明 | 类型 | 默认值 |
11
+ | -------------- | ---------------------- | -------------------------------- | ----------------------- |
12
+ | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
+ | `side` | 方向 | `top \| right \| bottom \| left` | `bottom` |
14
+ | `align` | 对齐 | `start \| center \| end` | `center` |
15
+ | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
16
+
17
+ `class`、`data-*`、ARIA 属性和事件传给浮层内容,内部关联 ID 由 Reka UI 管理。默认可访问名称与触发器关联;触发器应使用说明用途的文字。局部主题的 `portal-to` 容器应处于相同主题边界。
15
18
 
16
19
  ## Slots
17
20
 
@@ -9,9 +9,11 @@ title_zh: 进度条
9
9
 
10
10
  | 属性 | 说明 | 类型 | 默认值 |
11
11
  | --------- | ------------------------- | ----------------------------------------------- | ------- |
12
- | `value` | 当前进度 | `number` | `0` |
12
+ | `value` | 当前进度;`null` 表示未知 | `number \| null` | `0` |
13
13
  | `max` | 最大值 | `number` | `100` |
14
14
  | `variant` | 填充 | `brand \| accent` | `brand` |
15
15
  | `tone` | 强调色,仅作用于 `accent` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
16
16
 
17
17
  `tone` 接受 `blue | sun | cyan | coral | pink | green`,默认 `blue`(晴空蓝),只在 `accent` 下生效。旧 `aurora` 值映射到 `accent`。同一流程中的同类状态使用同一种颜色。
18
+
19
+ 提供用途名称,例如 `aria-label="文件上传进度"`。有限数值会限制在 `0…max`,无效的 `max` 回退到 `100`,确保显示与 ARIA 值一致。`null`、NaN 或无限值按未知进度显示,不输出 `aria-valuenow`;减少动态效果时显示静态进度段。