@yunlefun/vue 0.4.0 → 0.4.2

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.
@@ -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 {
@@ -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] {
@@ -20,10 +20,13 @@ const props = withDefaults(defineProps<{
20
20
  description?: string
21
21
  /** 没有可见标题时供屏幕阅读器使用 */
22
22
  accessibleTitle?: string
23
+ /** Accessible name of the close button; localize it with the dialog content. */
24
+ closeLabel?: string
23
25
  /** Existing container in the same theme boundary. */
24
26
  portalTo?: string | HTMLElement
25
27
  }>(), {
26
28
  accessibleTitle: '对话框',
29
+ closeLabel: '关闭',
27
30
  })
28
31
 
29
32
  const open = defineModel<boolean>('open', { default: false })
@@ -63,7 +66,7 @@ const descriptionProps = computed(() => hasDescription.value
63
66
  <slot />
64
67
  </div>
65
68
 
66
- <DialogClose class="ylf-dialog__close" aria-label="关闭">
69
+ <DialogClose class="ylf-dialog__close" :aria-label="closeLabel">
67
70
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
68
71
  <path d="M6 6l12 12M18 6L6 18" />
69
72
  </svg>
@@ -79,11 +82,11 @@ const descriptionProps = computed(() => hasDescription.value
79
82
  inset: 0;
80
83
  z-index: 100;
81
84
  background: var(--ylf-c-overlay, rgba(13, 17, 32, 0.45));
82
- -webkit-backdrop-filter: blur(4px);
83
- backdrop-filter: blur(4px);
85
+ -webkit-backdrop-filter: var(--ylf-overlay-blur, blur(10px));
86
+ backdrop-filter: var(--ylf-overlay-blur, blur(10px));
84
87
 
85
88
  &[data-state='open'] {
86
- animation: ylf-dialog-overlay-in 0.2s ease;
89
+ animation: ylf-dialog-overlay-in var(--ylf-duration-normal, 240ms) ease;
87
90
  }
88
91
  }
89
92
 
@@ -93,18 +96,20 @@ const descriptionProps = computed(() => hasDescription.value
93
96
  top: 50%;
94
97
  left: 50%;
95
98
  width: calc(100vw - 32px);
96
- max-width: 460px;
99
+ max-width: 480px;
97
100
  max-height: calc(100vh - 32px);
98
101
  overflow: auto;
99
- padding: 24px;
102
+ padding: 28px;
100
103
  transform: translate(-50%, -50%);
101
104
  border-radius: var(--ylf-radius-lg, 20px);
102
- background: var(--ylf-c-surface, #fff);
105
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
103
106
  border: 1px solid var(--ylf-c-border, #e2e8f0);
104
- box-shadow: var(--ylf-shadow-lg, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
107
+ box-shadow: var(--ylf-shadow-panel, 0 22px 56px -14px rgba(15, 23, 42, 0.22));
108
+ -webkit-backdrop-filter: var(--ylf-glass-blur, blur(16px));
109
+ backdrop-filter: var(--ylf-glass-blur, blur(16px));
105
110
 
106
111
  &[data-state='open'] {
107
- animation: ylf-dialog-in 0.22s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
112
+ animation: ylf-dialog-in var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease);
108
113
  }
109
114
 
110
115
  &:focus-visible {
@@ -113,20 +118,22 @@ const descriptionProps = computed(() => hasDescription.value
113
118
  }
114
119
 
115
120
  .ylf-dialog__title {
116
- margin: 0 0 6px;
121
+ margin: 0 0 10px;
117
122
  padding-right: 32px;
118
123
  overflow-wrap: anywhere;
119
124
  font-family: var(--ylf-font-heading, inherit);
120
- font-size: 19px;
121
- font-weight: 700;
125
+ font-size: 24px;
126
+ font-weight: 650;
127
+ line-height: 1.35;
128
+ letter-spacing: -0.03em;
122
129
  color: var(--ylf-c-text, #0f172a);
123
130
  }
124
131
 
125
132
  .ylf-dialog__desc {
126
- margin: 0 0 16px;
133
+ margin: 0 0 24px;
127
134
  overflow-wrap: anywhere;
128
135
  font-size: 14px;
129
- line-height: 1.6;
136
+ line-height: 1.75;
130
137
  color: var(--ylf-c-text-2, #475569);
131
138
  }
132
139
 
@@ -141,7 +148,8 @@ const descriptionProps = computed(() => hasDescription.value
141
148
  padding: 0;
142
149
  border: none;
143
150
  border-radius: var(--ylf-radius-sm, 10px);
144
- background: transparent;
151
+ background: var(--ylf-c-surface-raised, transparent);
152
+ box-shadow: inset 0 1px 0 var(--ylf-c-highlight, transparent);
145
153
  color: var(--ylf-c-text-3, #64748b);
146
154
  cursor: pointer;
147
155
  transition:
@@ -159,8 +167,13 @@ const descriptionProps = computed(() => hasDescription.value
159
167
  }
160
168
 
161
169
  svg {
162
- width: 18px;
163
- height: 18px;
170
+ width: 16px;
171
+ height: 16px;
172
+ transition: transform var(--ylf-duration-fast, 160ms) ease;
173
+ }
174
+
175
+ &:hover svg {
176
+ transform: rotate(90deg);
164
177
  }
165
178
  }
166
179
 
@@ -182,7 +195,7 @@ const descriptionProps = computed(() => hasDescription.value
182
195
  @keyframes ylf-dialog-in {
183
196
  from {
184
197
  opacity: 0;
185
- transform: translate(-50%, -46%) scale(0.96);
198
+ transform: translate(-50%, -47%) scale(0.98);
186
199
  }
187
200
  }
188
201
 
@@ -191,5 +204,9 @@ const descriptionProps = computed(() => hasDescription.value
191
204
  .ylf-dialog__content[data-state='open'] {
192
205
  animation: none;
193
206
  }
207
+
208
+ .ylf-dialog__close svg {
209
+ transition: none;
210
+ }
194
211
  }
195
212
  </style>
@@ -49,14 +49,15 @@ const open = defineModel<boolean>('open', { default: false })
49
49
  z-index: 105;
50
50
  min-width: 180px;
51
51
  padding: 6px;
52
- background: var(--ylf-c-surface, #fff);
52
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
53
53
  border: 1px solid var(--ylf-c-border, #e2e8f0);
54
54
  border-radius: var(--ylf-radius, 14px);
55
- 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));
56
57
  transform-origin: var(--reka-dropdown-menu-content-transform-origin);
57
58
 
58
59
  &[data-state='open'] {
59
- animation: ylf-pop-in 0.16s ease;
60
+ animation: ylf-menu-in 0.16s ease;
60
61
  }
61
62
 
62
63
  &__item {
@@ -69,10 +70,12 @@ const open = defineModel<boolean>('open', { default: false })
69
70
  cursor: pointer;
70
71
  user-select: none;
71
72
  outline: none;
73
+ transition: background var(--ylf-duration-fast, 160ms) ease;
72
74
 
73
75
  &[data-highlighted] {
74
76
  background: var(--ylf-c-brand-soft, #eff6ff);
75
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);
76
79
  }
77
80
 
78
81
  &[data-disabled] {
@@ -94,7 +97,7 @@ const open = defineModel<boolean>('open', { default: false })
94
97
  }
95
98
  }
96
99
 
97
- @keyframes ylf-pop-in {
100
+ @keyframes ylf-menu-in {
98
101
  from {
99
102
  opacity: 0;
100
103
  transform: scale(0.96);
@@ -105,5 +108,9 @@ const open = defineModel<boolean>('open', { default: false })
105
108
  .ylf-menu[data-state='open'] {
106
109
  animation: none;
107
110
  }
111
+
112
+ .ylf-menu__item {
113
+ transition: none;
114
+ }
108
115
  }
109
116
  </style>
@@ -36,14 +36,15 @@ const open = defineModel<boolean>('open', { default: false })
36
36
  max-width: 320px;
37
37
  padding: 16px;
38
38
  color: var(--ylf-c-text, #0f172a);
39
- background: var(--ylf-c-surface, #fff);
39
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
40
40
  border: 1px solid var(--ylf-c-border, #e2e8f0);
41
41
  border-radius: var(--ylf-radius, 14px);
42
- 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));
43
44
  transform-origin: var(--reka-popover-content-transform-origin);
44
45
 
45
46
  &[data-state='open'] {
46
- 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));
47
48
  }
48
49
 
49
50
  &__arrow {
@@ -52,7 +53,7 @@ const open = defineModel<boolean>('open', { default: false })
52
53
  }
53
54
  }
54
55
 
55
- @keyframes ylf-pop-in {
56
+ @keyframes ylf-popover-in {
56
57
  from {
57
58
  opacity: 0;
58
59
  transform: scale(0.96);
@@ -97,6 +97,7 @@ function selectFocusedRadio(event: KeyboardEvent) {
97
97
  border: 2px solid var(--ylf-c-border-strong, #cbd5e1);
98
98
  border-radius: 50%;
99
99
  background: var(--ylf-c-surface, #fff);
100
+ box-shadow: var(--ylf-shadow-control);
100
101
  transition:
101
102
  border-color 0.18s ease,
102
103
  box-shadow 0.2s ease;
@@ -112,6 +113,8 @@ function selectFocusedRadio(event: KeyboardEvent) {
112
113
 
113
114
  &:focus-visible .ylf-radio__control {
114
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;
115
118
  }
116
119
 
117
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 {
@@ -86,6 +86,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
86
86
  background: var(--ylf-c-surface, #fff);
87
87
  border: 1px solid var(--ylf-c-border-strong, #cbd5e1);
88
88
  border-radius: var(--ylf-radius, 14px);
89
+ box-shadow: var(--ylf-shadow-control);
89
90
  cursor: pointer;
90
91
  transition:
91
92
  border-color 0.18s ease,
@@ -99,6 +100,13 @@ const selectedOption = computed(() => props.options.find(option => option.value
99
100
  border-color: var(--ylf-c-brand, #2563eb);
100
101
  }
101
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
+
102
110
  &:focus-visible {
103
111
  outline: none;
104
112
  border-color: var(--ylf-c-brand, #2563eb);
@@ -131,6 +139,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
131
139
  flex: none;
132
140
  display: inline-flex;
133
141
  color: var(--ylf-c-text-3, #64748b);
142
+ transition: transform var(--ylf-duration-fast, 160ms) ease;
134
143
 
135
144
  :where(svg, i, span) {
136
145
  width: 18px;
@@ -138,6 +147,10 @@ const selectedOption = computed(() => props.options.find(option => option.value
138
147
  }
139
148
  }
140
149
 
150
+ .ylf-select__trigger[data-state='open'] .ylf-select__icon {
151
+ transform: rotate(180deg);
152
+ }
153
+
141
154
  .ylf-select__content {
142
155
  z-index: 105;
143
156
  box-sizing: border-box;
@@ -145,13 +158,15 @@ const selectedOption = computed(() => props.options.find(option => option.value
145
158
  max-width: var(--reka-select-content-available-width);
146
159
  max-height: var(--reka-select-content-available-height);
147
160
  padding: 6px;
148
- background: var(--ylf-c-surface, #fff);
161
+ background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
149
162
  border: 1px solid var(--ylf-c-border, #e2e8f0);
150
163
  border-radius: var(--ylf-radius, 14px);
151
- 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);
152
167
 
153
168
  &[data-state='open'] {
154
- animation: ylf-pop-in 0.16s ease;
169
+ animation: ylf-select-in 0.16s ease;
155
170
  }
156
171
  }
157
172
 
@@ -171,10 +186,12 @@ const selectedOption = computed(() => props.options.find(option => option.value
171
186
  cursor: pointer;
172
187
  user-select: none;
173
188
  outline: none;
189
+ transition: background var(--ylf-duration-fast, 160ms) ease;
174
190
 
175
191
  &[data-highlighted] {
176
192
  background: var(--ylf-c-brand-soft, #eff6ff);
177
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);
178
195
  }
179
196
 
180
197
  &[data-disabled] {
@@ -214,7 +231,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
214
231
  }
215
232
  }
216
233
 
217
- @keyframes ylf-pop-in {
234
+ @keyframes ylf-select-in {
218
235
  from {
219
236
  opacity: 0;
220
237
  transform: scale(0.96);
@@ -225,5 +242,10 @@ const selectedOption = computed(() => props.options.find(option => option.value
225
242
  .ylf-select__content[data-state='open'] {
226
243
  animation: none;
227
244
  }
245
+
246
+ .ylf-select__icon,
247
+ .ylf-select__item {
248
+ transition: none;
249
+ }
228
250
  }
229
251
  </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;
@@ -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)),
@@ -39,17 +39,18 @@ withDefaults(defineProps<{
39
39
  .ylf-tooltip {
40
40
  z-index: 110;
41
41
  max-width: 240px;
42
- padding: 7px 11px;
42
+ padding: 8px 12px;
43
43
  font-size: 13px;
44
44
  line-height: 1.5;
45
45
  color: var(--ylf-c-bg, #fbfcff);
46
46
  background: var(--ylf-c-text, #0f172a);
47
47
  border-radius: var(--ylf-radius-sm, 10px);
48
+ border: 1px solid color-mix(in srgb, var(--ylf-c-bg, #fbfcff) 15%, transparent);
48
49
  box-shadow: var(--ylf-shadow, 0 10px 28px -8px rgba(15, 23, 42, 0.16));
49
50
  transform-origin: var(--reka-tooltip-content-transform-origin);
50
51
 
51
52
  &[data-state='delayed-open'] {
52
- animation: ylf-pop-in 0.16s ease;
53
+ animation: ylf-tooltip-in 0.16s ease;
53
54
  }
54
55
 
55
56
  &__arrow {
@@ -57,7 +58,7 @@ withDefaults(defineProps<{
57
58
  }
58
59
  }
59
60
 
60
- @keyframes ylf-pop-in {
61
+ @keyframes ylf-tooltip-in {
61
62
  from {
62
63
  opacity: 0;
63
64
  transform: scale(0.94);
@@ -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,13 +7,16 @@ 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` | `'对话框'` |
16
- | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
10
+ | 属性 | 说明 | 类型 | 默认值 |
11
+ | ----------------- | ---------------------------------- | ----------------------- | ----------------------- |
12
+ | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
+ | `title` | 可见标题 | `string` | — |
14
+ | `description` | 描述 | `string` | — |
15
+ | `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
16
+ | `closeLabel` | 关闭按钮的无障碍名称,可随正文翻译 | `string` | `'关闭'` |
17
+ | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
18
+
19
+ 英文界面可设置 `close-label="Close"`,让关闭按钮与正文语言一致。
17
20
 
18
21
  建议始终提供 `title`。只有视觉设计明确隐藏标题时,才改用描述场景的 `accessible-title`。
19
22
 
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  description?: string;
4
4
  /** 没有可见标题时供屏幕阅读器使用 */
5
5
  accessibleTitle?: string;
6
+ /** Accessible name of the close button; localize it with the dialog content. */
7
+ closeLabel?: string;
6
8
  /** Existing container in the same theme boundary. */
7
9
  portalTo?: string | HTMLElement;
8
10
  };
@@ -26,6 +28,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
26
28
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
27
29
  }>, {
28
30
  accessibleTitle: string;
31
+ closeLabel: string;
29
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
33
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
34
  declare const _default: typeof __VLS_export;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yunlefun/vue",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "description": "Vue components and Nuxt integration for YunLeFun Design",
6
6
  "author": "YunLeFun",
7
7
  "license": "MIT",