@cyberpunk-vue/components 1.12.7 → 1.13.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.
@@ -1,20 +1,4 @@
1
- /**
2
- * CpDropdown 赛博朋克风格下拉选择器
3
- *
4
- * 支持多种尺寸、形态变体、可搜索/可清空功能。具有特色的切角造型。
5
- *
6
- * @example
7
- * ```vue
8
- * <CpDropdown v-model="value" :options="options" placeholder="请选择" />
9
- * <CpDropdown v-model="search" filterable clearable />
10
- * ```
11
- *
12
- * @see {@link DropdownProps} 查看所有可用属性
13
- *
14
- * @slot default - 自定义选项内容
15
- * @slot prefix - 触发器前缀
16
- * @slot empty - 无选项时的空状态
17
- */
1
+ /** @deprecated 请使用 `CpSelect` */
18
2
  export declare const CpDropdown: import('../utils').SFCWithInstall<{
19
3
  new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
20
4
  readonly modelValue: {
@@ -22,7 +6,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
22
6
  readonly default: "";
23
7
  };
24
8
  readonly options: {
25
- readonly type: import('vue').PropType<import('.').DropdownOption[]>;
9
+ readonly type: import('vue').PropType<import('../select').SelectOption[]>;
26
10
  readonly default: () => never[];
27
11
  };
28
12
  readonly placeholder: {
@@ -46,15 +30,15 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
46
30
  readonly default: false;
47
31
  };
48
32
  readonly size: {
49
- readonly type: import('vue').PropType<import('.').DropdownSize>;
33
+ readonly type: import('vue').PropType<import('../select').SelectSize>;
50
34
  readonly default: "md";
51
35
  };
52
36
  readonly shape: {
53
- readonly type: import('vue').PropType<import('.').DropdownShape>;
37
+ readonly type: import('vue').PropType<import('../select').SelectShape>;
54
38
  readonly default: "clip";
55
39
  };
56
40
  readonly variant: {
57
- readonly type: import('vue').PropType<import('.').DropdownVariant>;
41
+ readonly type: import('vue').PropType<import('../select').SelectVariant>;
58
42
  readonly default: "outline";
59
43
  };
60
44
  readonly color: {
@@ -74,7 +58,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
74
58
  readonly default: false;
75
59
  };
76
60
  readonly placement: {
77
- readonly type: import('vue').PropType<import('.').DropdownPlacement>;
61
+ readonly type: import('vue').PropType<import('../select').SelectPlacement>;
78
62
  readonly default: "bottom-start";
79
63
  };
80
64
  readonly teleportTo: {
@@ -125,9 +109,9 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
125
109
  readonly size: import('@cyberpunk-vue/hooks').Size;
126
110
  readonly width: string | number;
127
111
  readonly color: string;
128
- readonly variant: import('.').DropdownVariant;
112
+ readonly variant: import('../select').SelectVariant;
129
113
  readonly disabled: boolean;
130
- readonly shape: import('.').DropdownShape;
114
+ readonly shape: import('../select').SelectShape;
131
115
  readonly inline: boolean;
132
116
  readonly placeholder: string;
133
117
  readonly modelValue: string | number;
@@ -137,8 +121,8 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
137
121
  readonly maxHeight: number;
138
122
  readonly inactiveColor: string;
139
123
  readonly teleportTo: string | HTMLElement;
140
- readonly placement: import('.').DropdownPlacement;
141
- readonly options: import('.').DropdownOption[];
124
+ readonly placement: import('../select').SelectPlacement;
125
+ readonly options: import('../select').SelectOption[];
142
126
  readonly filterPlaceholder: string;
143
127
  readonly filterable: boolean;
144
128
  readonly noMatchText: string;
@@ -161,7 +145,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
161
145
  readonly default: "";
162
146
  };
163
147
  readonly options: {
164
- readonly type: import('vue').PropType<import('.').DropdownOption[]>;
148
+ readonly type: import('vue').PropType<import('../select').SelectOption[]>;
165
149
  readonly default: () => never[];
166
150
  };
167
151
  readonly placeholder: {
@@ -185,15 +169,15 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
185
169
  readonly default: false;
186
170
  };
187
171
  readonly size: {
188
- readonly type: import('vue').PropType<import('.').DropdownSize>;
172
+ readonly type: import('vue').PropType<import('../select').SelectSize>;
189
173
  readonly default: "md";
190
174
  };
191
175
  readonly shape: {
192
- readonly type: import('vue').PropType<import('.').DropdownShape>;
176
+ readonly type: import('vue').PropType<import('../select').SelectShape>;
193
177
  readonly default: "clip";
194
178
  };
195
179
  readonly variant: {
196
- readonly type: import('vue').PropType<import('.').DropdownVariant>;
180
+ readonly type: import('vue').PropType<import('../select').SelectVariant>;
197
181
  readonly default: "outline";
198
182
  };
199
183
  readonly color: {
@@ -213,7 +197,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
213
197
  readonly default: false;
214
198
  };
215
199
  readonly placement: {
216
- readonly type: import('vue').PropType<import('.').DropdownPlacement>;
200
+ readonly type: import('vue').PropType<import('../select').SelectPlacement>;
217
201
  readonly default: "bottom-start";
218
202
  };
219
203
  readonly teleportTo: {
@@ -257,9 +241,9 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
257
241
  readonly size: import('@cyberpunk-vue/hooks').Size;
258
242
  readonly width: string | number;
259
243
  readonly color: string;
260
- readonly variant: import('.').DropdownVariant;
244
+ readonly variant: import('../select').SelectVariant;
261
245
  readonly disabled: boolean;
262
- readonly shape: import('.').DropdownShape;
246
+ readonly shape: import('../select').SelectShape;
263
247
  readonly inline: boolean;
264
248
  readonly placeholder: string;
265
249
  readonly modelValue: string | number;
@@ -269,8 +253,8 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
269
253
  readonly maxHeight: number;
270
254
  readonly inactiveColor: string;
271
255
  readonly teleportTo: string | HTMLElement;
272
- readonly placement: import('.').DropdownPlacement;
273
- readonly options: import('.').DropdownOption[];
256
+ readonly placement: import('../select').SelectPlacement;
257
+ readonly options: import('../select').SelectOption[];
274
258
  readonly filterPlaceholder: string;
275
259
  readonly filterable: boolean;
276
260
  readonly noMatchText: string;
@@ -285,7 +269,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
285
269
  readonly default: "";
286
270
  };
287
271
  readonly options: {
288
- readonly type: import('vue').PropType<import('.').DropdownOption[]>;
272
+ readonly type: import('vue').PropType<import('../select').SelectOption[]>;
289
273
  readonly default: () => never[];
290
274
  };
291
275
  readonly placeholder: {
@@ -309,15 +293,15 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
309
293
  readonly default: false;
310
294
  };
311
295
  readonly size: {
312
- readonly type: import('vue').PropType<import('.').DropdownSize>;
296
+ readonly type: import('vue').PropType<import('../select').SelectSize>;
313
297
  readonly default: "md";
314
298
  };
315
299
  readonly shape: {
316
- readonly type: import('vue').PropType<import('.').DropdownShape>;
300
+ readonly type: import('vue').PropType<import('../select').SelectShape>;
317
301
  readonly default: "clip";
318
302
  };
319
303
  readonly variant: {
320
- readonly type: import('vue').PropType<import('.').DropdownVariant>;
304
+ readonly type: import('vue').PropType<import('../select').SelectVariant>;
321
305
  readonly default: "outline";
322
306
  };
323
307
  readonly color: {
@@ -337,7 +321,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
337
321
  readonly default: false;
338
322
  };
339
323
  readonly placement: {
340
- readonly type: import('vue').PropType<import('.').DropdownPlacement>;
324
+ readonly type: import('vue').PropType<import('../select').SelectPlacement>;
341
325
  readonly default: "bottom-start";
342
326
  };
343
327
  readonly teleportTo: {
@@ -388,9 +372,9 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
388
372
  readonly size: import('@cyberpunk-vue/hooks').Size;
389
373
  readonly width: string | number;
390
374
  readonly color: string;
391
- readonly variant: import('.').DropdownVariant;
375
+ readonly variant: import('../select').SelectVariant;
392
376
  readonly disabled: boolean;
393
- readonly shape: import('.').DropdownShape;
377
+ readonly shape: import('../select').SelectShape;
394
378
  readonly inline: boolean;
395
379
  readonly placeholder: string;
396
380
  readonly modelValue: string | number;
@@ -400,8 +384,8 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
400
384
  readonly maxHeight: number;
401
385
  readonly inactiveColor: string;
402
386
  readonly teleportTo: string | HTMLElement;
403
- readonly placement: import('.').DropdownPlacement;
404
- readonly options: import('.').DropdownOption[];
387
+ readonly placement: import('../select').SelectPlacement;
388
+ readonly options: import('../select').SelectOption[];
405
389
  readonly filterPlaceholder: string;
406
390
  readonly filterable: boolean;
407
391
  readonly noMatchText: string;
@@ -411,7 +395,7 @@ export declare const CpDropdown: import('../utils').SFCWithInstall<{
411
395
  prefix?(_: {}): any;
412
396
  empty?(_: {}): any;
413
397
  default?(_: {
414
- option: import('.').DropdownOption;
398
+ option: import('../select').SelectOption;
415
399
  }): any;
416
400
  };
417
401
  })>;
@@ -1,280 +1,111 @@
1
- import { ExtractPropTypes, PropType } from 'vue';
2
- import { Size } from '@cyberpunk-vue/hooks';
3
- /**
4
- * 下拉选项类型
5
- */
6
- export interface DropdownOption {
7
- /**
8
- * 显示文本
9
- */
10
- label: string;
11
- /**
12
- * 选项值
13
- */
14
- value: string | number;
15
- /**
16
- * 是否禁用该选项
17
- */
18
- disabled?: boolean;
19
- }
20
- /**
21
- * 下拉框尺寸
22
- * - `sm` - 小尺寸 (28px 高)
23
- * - `md` - 中等尺寸 (36px 高),默认
24
- * - `lg` - 大尺寸 (44px 高)
25
- * - 也支持数字 (px) 或带单位字符串 (如 '2rem')
26
- */
27
- export type DropdownSize = Size;
28
- /**
29
- * 下拉框形状
30
- * - `clip` - 切角样式(默认,赛博朋克特色)
31
- * - `no-clip` - 直角矩形
32
- * - `round` - 圆角矩形
33
- */
34
- export type DropdownShape = 'clip' | 'no-clip' | 'round';
35
- /**
36
- * 下拉框变体
37
- * - `outline` - 边框样式(默认),透明背景
38
- * - `filled` - 填充样式,带背景色
39
- * - `ghost` - 幽灵样式,无边框无背景
40
- */
41
- export type DropdownVariant = 'outline' | 'filled' | 'ghost';
42
- /**
43
- * 弹出位置
44
- */
45
- export type DropdownPlacement = 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end';
46
- /**
47
- * CpDropdown 组件 Props 定义
48
- *
49
- * @description 赛博朋克风格下拉选择器,支持多种尺寸、形态变体、可搜索/可清空功能。
50
- *
51
- * @example
52
- * ```vue
53
- * <!-- 基础用法 -->
54
- * <CpDropdown v-model="value" :options="options" placeholder="请选择" />
55
- *
56
- * <!-- 可搜索 -->
57
- * <CpDropdown v-model="value" :options="options" filterable />
58
- *
59
- * <!-- 可清空 -->
60
- * <CpDropdown v-model="value" :options="options" clearable />
61
- * ```
62
- *
63
- * @slots
64
- * - `default` - 自定义选项内容
65
- * - `prefix` - 触发器前缀
66
- * - `empty` - 无选项时的空状态
67
- *
68
- * @exposes
69
- * - `focus()` - 使下拉框获取焦点
70
- * - `blur()` - 使下拉框失去焦点
71
- * - `open()` - 打开下拉面板
72
- * - `close()` - 关闭下拉面板
73
- * @category 表单组件
74
- * @displayName CpDropdown 下拉选择
75
- */
1
+ import { SelectOption, SelectSize, SelectShape, SelectVariant, SelectPlacement, SelectProps, SelectEmits } from '../../select/src/select';
2
+ /** @deprecated 请使用 `SelectOption` */
3
+ export type DropdownOption = SelectOption;
4
+ /** @deprecated 请使用 `SelectSize` */
5
+ export type DropdownSize = SelectSize;
6
+ /** @deprecated 请使用 `SelectShape` */
7
+ export type DropdownShape = SelectShape;
8
+ /** @deprecated 请使用 `SelectVariant` */
9
+ export type DropdownVariant = SelectVariant;
10
+ /** @deprecated 请使用 `SelectPlacement` */
11
+ export type DropdownPlacement = SelectPlacement;
12
+ /** @deprecated 请使用 `SelectProps` */
13
+ export type DropdownProps = SelectProps;
14
+ /** @deprecated 请使用 `SelectEmits` */
15
+ export type DropdownEmits = SelectEmits;
16
+ /** @deprecated 请使用 `selectProps` */
76
17
  export declare const dropdownProps: {
77
- /**
78
- * 绑定值 (v-model)
79
- * @default ''
80
- */
81
18
  readonly modelValue: {
82
- readonly type: PropType<string | number>;
19
+ readonly type: import('vue').PropType<string | number>;
83
20
  readonly default: "";
84
21
  };
85
- /**
86
- * 选项列表
87
- * @default []
88
- */
89
22
  readonly options: {
90
- readonly type: PropType<DropdownOption[]>;
23
+ readonly type: import('vue').PropType<SelectOption[]>;
91
24
  readonly default: () => never[];
92
25
  };
93
- /**
94
- * 占位文本
95
- * @default '请选择'
96
- */
97
26
  readonly placeholder: {
98
27
  readonly type: StringConstructor;
99
28
  readonly default: "请选择";
100
29
  };
101
- /**
102
- * 搜索框占位文本 (仅在面板开启搜索时有效)
103
- * @default '搜索...'
104
- */
105
30
  readonly filterPlaceholder: {
106
31
  readonly type: StringConstructor;
107
32
  readonly default: "搜索...";
108
33
  };
109
- /**
110
- * 是否禁用
111
- * @default false
112
- */
113
34
  readonly disabled: {
114
35
  readonly type: BooleanConstructor;
115
36
  readonly default: false;
116
37
  };
117
- /**
118
- * 是否可清空
119
- * @default false
120
- */
121
38
  readonly clearable: {
122
39
  readonly type: BooleanConstructor;
123
40
  readonly default: false;
124
41
  };
125
- /**
126
- * 是否可搜索过滤
127
- * @default false
128
- */
129
42
  readonly filterable: {
130
43
  readonly type: BooleanConstructor;
131
44
  readonly default: false;
132
45
  };
133
- /**
134
- * 下拉框尺寸
135
- * @default 'md'
136
- */
137
46
  readonly size: {
138
- readonly type: PropType<DropdownSize>;
47
+ readonly type: import('vue').PropType<SelectSize>;
139
48
  readonly default: "md";
140
49
  };
141
- /**
142
- * 下拉框形状
143
- * @default 'clip'
144
- */
145
50
  readonly shape: {
146
- readonly type: PropType<DropdownShape>;
51
+ readonly type: import('vue').PropType<SelectShape>;
147
52
  readonly default: "clip";
148
53
  };
149
- /**
150
- * 下拉框变体
151
- * @default 'outline'
152
- */
153
54
  readonly variant: {
154
- readonly type: PropType<DropdownVariant>;
55
+ readonly type: import('vue').PropType<SelectVariant>;
155
56
  readonly default: "outline";
156
57
  };
157
- /**
158
- * 自定义聚焦颜色
159
- * @default ''
160
- */
161
58
  readonly color: {
162
59
  readonly type: StringConstructor;
163
60
  readonly default: "";
164
61
  };
165
- /**
166
- * 未激活状态边框颜色
167
- * @default ''
168
- */
169
62
  readonly inactiveColor: {
170
63
  readonly type: StringConstructor;
171
64
  readonly default: "";
172
65
  };
173
- /**
174
- * Placeholder 文字颜色
175
- * @default ''
176
- */
177
66
  readonly placeholderColor: {
178
67
  readonly type: StringConstructor;
179
68
  readonly default: "";
180
69
  };
181
- /**
182
- * 是否启用行内搜索 (直接在触发器输入)
183
- * @default false
184
- */
185
70
  readonly inline: {
186
71
  readonly type: BooleanConstructor;
187
72
  readonly default: false;
188
73
  };
189
- /**
190
- * 弹出位置
191
- * @default 'bottom-start'
192
- */
193
74
  readonly placement: {
194
- readonly type: PropType<DropdownPlacement>;
75
+ readonly type: import('vue').PropType<SelectPlacement>;
195
76
  readonly default: "bottom-start";
196
77
  };
197
- /**
198
- * Teleport 目标
199
- * @default 'body'
200
- */
201
78
  readonly teleportTo: {
202
- readonly type: PropType<string | HTMLElement>;
79
+ readonly type: import('vue').PropType<string | HTMLElement>;
203
80
  readonly default: "body";
204
81
  };
205
- /**
206
- * 下拉面板最大高度 (px)
207
- * @default 256
208
- */
209
82
  readonly maxHeight: {
210
83
  readonly type: NumberConstructor;
211
84
  readonly default: 256;
212
85
  };
213
- /**
214
- * 无匹配时的文本
215
- * @default '无匹配数据'
216
- */
217
86
  readonly noMatchText: {
218
87
  readonly type: StringConstructor;
219
88
  readonly default: "无匹配数据";
220
89
  };
221
- /**
222
- * 无数据时的文本
223
- * @default '无数据'
224
- */
225
90
  readonly noDataText: {
226
91
  readonly type: StringConstructor;
227
92
  readonly default: "无数据";
228
93
  };
229
- /**
230
- * 清除动画持续时间 (ms)
231
- * 控制点击清空按钮时文字消失动画的速度
232
- * @default 150
233
- * @example `<CpDropdown :clear-duration="300" />`
234
- */
235
94
  readonly clearDuration: {
236
95
  readonly type: NumberConstructor;
237
96
  readonly default: 150;
238
97
  };
239
- /**
240
- * 下拉框宽度
241
- * 支持数字 (px) 或带单位字符串 (如 '200px', '15rem')。
242
- * 为空时默认 100%(铺满父容器)。
243
- * @default ''
244
- */
245
98
  readonly width: {
246
- readonly type: PropType<string | number>;
99
+ readonly type: import('vue').PropType<string | number>;
247
100
  readonly default: "";
248
101
  };
249
102
  };
250
- export type DropdownProps = ExtractPropTypes<typeof dropdownProps>;
251
- /**
252
- * CpDropdown 组件事件定义
253
- */
103
+ /** @deprecated 请使用 `selectEmits` */
254
104
  export declare const dropdownEmits: {
255
- /**
256
- * 值变化时触发 (v-model 绑定)
257
- */
258
105
  'update:modelValue': (value: string | number) => boolean;
259
- /**
260
- * 选中值变化时触发
261
- */
262
106
  change: (value: string | number) => boolean;
263
- /**
264
- * 清空时触发
265
- */
266
107
  clear: () => boolean;
267
- /**
268
- * 获取焦点时触发
269
- */
270
108
  focus: () => boolean;
271
- /**
272
- * 失去焦点时触发
273
- */
274
109
  blur: () => boolean;
275
- /**
276
- * 下拉面板显示时触发
277
- */
278
110
  visibleChange: (visible: boolean) => boolean;
279
111
  };
280
- export type DropdownEmits = typeof dropdownEmits;
@@ -1,16 +1,7 @@
1
- import { default as Dropdown } from './dropdown.vue';
1
+ import { SelectInstance } from '../../select/src/instance';
2
2
  /**
3
- * CpDropdown 组件实例类型
3
+ * @deprecated 请使用 `SelectInstance`
4
4
  *
5
- * @description 用于 ref 引用时获取正确的类型提示
6
- *
7
- * @example
8
- * ```vue
9
- * <script setup lang="ts">
10
- * import type { DropdownInstance } from '@cyberpunk-vue/components'
11
- * const dropdownRef = ref<DropdownInstance>()
12
- * dropdownRef.value?.open()
13
- * </script>
14
- * ```
5
+ * CpDropdown 组件实例类型 —— 自 1.13.0 起作为 `SelectInstance` 的别名保留。
15
6
  */
16
- export type DropdownInstance = InstanceType<typeof Dropdown> & unknown;
7
+ export type DropdownInstance = SelectInstance;