@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.
@@ -290,7 +290,7 @@ export declare const CpPagination: import('../utils').SFCWithInstall<{
290
290
  sizes?(_: {
291
291
  pageSize: number;
292
292
  pageSizes: number[];
293
- options: import('..').DropdownOption[];
293
+ options: import('..').SelectOption[];
294
294
  onChange: (val: string | number) => void;
295
295
  disabled: boolean;
296
296
  type: import('.').PaginationType;
@@ -1,11 +1,11 @@
1
- import { DropdownOption } from '../../dropdown/src/dropdown';
1
+ import { SelectOption } from '../../select/src/select';
2
2
  declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  sizes?(_: {
6
6
  pageSize: number;
7
7
  pageSizes: number[];
8
- options: DropdownOption[];
8
+ options: SelectOption[];
9
9
  onChange: (val: string | number) => void;
10
10
  disabled: boolean;
11
11
  type: import('./pagination').PaginationType;
@@ -0,0 +1,421 @@
1
+ /**
2
+ * CpSelect 赛博朋克风格下拉选择器
3
+ *
4
+ * 支持多种尺寸、形态变体、可搜索/可清空功能。具有特色的切角造型。
5
+ * 浮层定位基于 @floating-ui/dom,自动处理翻转、越界、以及触发器位置/尺寸变化的跟随。
6
+ *
7
+ * @example
8
+ * ```vue
9
+ * <CpSelect v-model="value" :options="options" placeholder="请选择" />
10
+ * <CpSelect v-model="search" filterable clearable />
11
+ * ```
12
+ *
13
+ * @see {@link SelectProps} 查看所有可用属性
14
+ *
15
+ * @slot default - 自定义选项内容
16
+ * @slot prefix - 触发器前缀
17
+ * @slot empty - 无选项时的空状态
18
+ */
19
+ export declare const CpSelect: import('../utils').SFCWithInstall<{
20
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
21
+ readonly modelValue: {
22
+ readonly type: import('vue').PropType<string | number>;
23
+ readonly default: "";
24
+ };
25
+ readonly options: {
26
+ readonly type: import('vue').PropType<import('.').SelectOption[]>;
27
+ readonly default: () => never[];
28
+ };
29
+ readonly placeholder: {
30
+ readonly type: StringConstructor;
31
+ readonly default: "请选择";
32
+ };
33
+ readonly filterPlaceholder: {
34
+ readonly type: StringConstructor;
35
+ readonly default: "搜索...";
36
+ };
37
+ readonly disabled: {
38
+ readonly type: BooleanConstructor;
39
+ readonly default: false;
40
+ };
41
+ readonly clearable: {
42
+ readonly type: BooleanConstructor;
43
+ readonly default: false;
44
+ };
45
+ readonly filterable: {
46
+ readonly type: BooleanConstructor;
47
+ readonly default: false;
48
+ };
49
+ readonly size: {
50
+ readonly type: import('vue').PropType<import('.').SelectSize>;
51
+ readonly default: "md";
52
+ };
53
+ readonly shape: {
54
+ readonly type: import('vue').PropType<import('.').SelectShape>;
55
+ readonly default: "clip";
56
+ };
57
+ readonly variant: {
58
+ readonly type: import('vue').PropType<import('.').SelectVariant>;
59
+ readonly default: "outline";
60
+ };
61
+ readonly color: {
62
+ readonly type: StringConstructor;
63
+ readonly default: "";
64
+ };
65
+ readonly inactiveColor: {
66
+ readonly type: StringConstructor;
67
+ readonly default: "";
68
+ };
69
+ readonly placeholderColor: {
70
+ readonly type: StringConstructor;
71
+ readonly default: "";
72
+ };
73
+ readonly inline: {
74
+ readonly type: BooleanConstructor;
75
+ readonly default: false;
76
+ };
77
+ readonly placement: {
78
+ readonly type: import('vue').PropType<import('.').SelectPlacement>;
79
+ readonly default: "bottom-start";
80
+ };
81
+ readonly teleportTo: {
82
+ readonly type: import('vue').PropType<string | HTMLElement>;
83
+ readonly default: "body";
84
+ };
85
+ readonly maxHeight: {
86
+ readonly type: NumberConstructor;
87
+ readonly default: 256;
88
+ };
89
+ readonly noMatchText: {
90
+ readonly type: StringConstructor;
91
+ readonly default: "无匹配数据";
92
+ };
93
+ readonly noDataText: {
94
+ readonly type: StringConstructor;
95
+ readonly default: "无数据";
96
+ };
97
+ readonly clearDuration: {
98
+ readonly type: NumberConstructor;
99
+ readonly default: 150;
100
+ };
101
+ readonly width: {
102
+ readonly type: import('vue').PropType<string | number>;
103
+ readonly default: "";
104
+ };
105
+ }>> & Readonly<{
106
+ onClear?: (() => any) | undefined;
107
+ onBlur?: (() => any) | undefined;
108
+ onChange?: ((value: string | number) => any) | undefined;
109
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
110
+ onFocus?: (() => any) | undefined;
111
+ onVisibleChange?: ((visible: boolean) => any) | undefined;
112
+ }>, {
113
+ open: () => void;
114
+ close: () => void;
115
+ toggle: () => void;
116
+ focus: () => void;
117
+ blur: () => void;
118
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
119
+ clear: () => void;
120
+ blur: () => void;
121
+ change: (value: string | number) => void;
122
+ "update:modelValue": (value: string | number) => void;
123
+ focus: () => void;
124
+ visibleChange: (visible: boolean) => void;
125
+ }, import('vue').PublicProps, {
126
+ readonly size: import('@cyberpunk-vue/hooks').Size;
127
+ readonly width: string | number;
128
+ readonly color: string;
129
+ readonly variant: import('.').SelectVariant;
130
+ readonly disabled: boolean;
131
+ readonly shape: import('.').SelectShape;
132
+ readonly inline: boolean;
133
+ readonly placeholder: string;
134
+ readonly modelValue: string | number;
135
+ readonly clearable: boolean;
136
+ readonly placeholderColor: string;
137
+ readonly clearDuration: number;
138
+ readonly maxHeight: number;
139
+ readonly inactiveColor: string;
140
+ readonly teleportTo: string | HTMLElement;
141
+ readonly placement: import('.').SelectPlacement;
142
+ readonly options: import('.').SelectOption[];
143
+ readonly filterPlaceholder: string;
144
+ readonly filterable: boolean;
145
+ readonly noMatchText: string;
146
+ readonly noDataText: string;
147
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
148
+ triggerRef: HTMLDivElement;
149
+ inlineInputRef: HTMLInputElement;
150
+ popperRef: HTMLDivElement;
151
+ filterInputRef: HTMLInputElement;
152
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
153
+ P: {};
154
+ B: {};
155
+ D: {};
156
+ C: {};
157
+ M: {};
158
+ Defaults: {};
159
+ }, Readonly<import('vue').ExtractPropTypes<{
160
+ readonly modelValue: {
161
+ readonly type: import('vue').PropType<string | number>;
162
+ readonly default: "";
163
+ };
164
+ readonly options: {
165
+ readonly type: import('vue').PropType<import('.').SelectOption[]>;
166
+ readonly default: () => never[];
167
+ };
168
+ readonly placeholder: {
169
+ readonly type: StringConstructor;
170
+ readonly default: "请选择";
171
+ };
172
+ readonly filterPlaceholder: {
173
+ readonly type: StringConstructor;
174
+ readonly default: "搜索...";
175
+ };
176
+ readonly disabled: {
177
+ readonly type: BooleanConstructor;
178
+ readonly default: false;
179
+ };
180
+ readonly clearable: {
181
+ readonly type: BooleanConstructor;
182
+ readonly default: false;
183
+ };
184
+ readonly filterable: {
185
+ readonly type: BooleanConstructor;
186
+ readonly default: false;
187
+ };
188
+ readonly size: {
189
+ readonly type: import('vue').PropType<import('.').SelectSize>;
190
+ readonly default: "md";
191
+ };
192
+ readonly shape: {
193
+ readonly type: import('vue').PropType<import('.').SelectShape>;
194
+ readonly default: "clip";
195
+ };
196
+ readonly variant: {
197
+ readonly type: import('vue').PropType<import('.').SelectVariant>;
198
+ readonly default: "outline";
199
+ };
200
+ readonly color: {
201
+ readonly type: StringConstructor;
202
+ readonly default: "";
203
+ };
204
+ readonly inactiveColor: {
205
+ readonly type: StringConstructor;
206
+ readonly default: "";
207
+ };
208
+ readonly placeholderColor: {
209
+ readonly type: StringConstructor;
210
+ readonly default: "";
211
+ };
212
+ readonly inline: {
213
+ readonly type: BooleanConstructor;
214
+ readonly default: false;
215
+ };
216
+ readonly placement: {
217
+ readonly type: import('vue').PropType<import('.').SelectPlacement>;
218
+ readonly default: "bottom-start";
219
+ };
220
+ readonly teleportTo: {
221
+ readonly type: import('vue').PropType<string | HTMLElement>;
222
+ readonly default: "body";
223
+ };
224
+ readonly maxHeight: {
225
+ readonly type: NumberConstructor;
226
+ readonly default: 256;
227
+ };
228
+ readonly noMatchText: {
229
+ readonly type: StringConstructor;
230
+ readonly default: "无匹配数据";
231
+ };
232
+ readonly noDataText: {
233
+ readonly type: StringConstructor;
234
+ readonly default: "无数据";
235
+ };
236
+ readonly clearDuration: {
237
+ readonly type: NumberConstructor;
238
+ readonly default: 150;
239
+ };
240
+ readonly width: {
241
+ readonly type: import('vue').PropType<string | number>;
242
+ readonly default: "";
243
+ };
244
+ }>> & Readonly<{
245
+ onClear?: (() => any) | undefined;
246
+ onBlur?: (() => any) | undefined;
247
+ onChange?: ((value: string | number) => any) | undefined;
248
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
249
+ onFocus?: (() => any) | undefined;
250
+ onVisibleChange?: ((visible: boolean) => any) | undefined;
251
+ }>, {
252
+ open: () => void;
253
+ close: () => void;
254
+ toggle: () => void;
255
+ focus: () => void;
256
+ blur: () => void;
257
+ }, {}, {}, {}, {
258
+ readonly size: import('@cyberpunk-vue/hooks').Size;
259
+ readonly width: string | number;
260
+ readonly color: string;
261
+ readonly variant: import('.').SelectVariant;
262
+ readonly disabled: boolean;
263
+ readonly shape: import('.').SelectShape;
264
+ readonly inline: boolean;
265
+ readonly placeholder: string;
266
+ readonly modelValue: string | number;
267
+ readonly clearable: boolean;
268
+ readonly placeholderColor: string;
269
+ readonly clearDuration: number;
270
+ readonly maxHeight: number;
271
+ readonly inactiveColor: string;
272
+ readonly teleportTo: string | HTMLElement;
273
+ readonly placement: import('.').SelectPlacement;
274
+ readonly options: import('.').SelectOption[];
275
+ readonly filterPlaceholder: string;
276
+ readonly filterable: boolean;
277
+ readonly noMatchText: string;
278
+ readonly noDataText: string;
279
+ }>;
280
+ __isFragment?: never;
281
+ __isTeleport?: never;
282
+ __isSuspense?: never;
283
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
284
+ readonly modelValue: {
285
+ readonly type: import('vue').PropType<string | number>;
286
+ readonly default: "";
287
+ };
288
+ readonly options: {
289
+ readonly type: import('vue').PropType<import('.').SelectOption[]>;
290
+ readonly default: () => never[];
291
+ };
292
+ readonly placeholder: {
293
+ readonly type: StringConstructor;
294
+ readonly default: "请选择";
295
+ };
296
+ readonly filterPlaceholder: {
297
+ readonly type: StringConstructor;
298
+ readonly default: "搜索...";
299
+ };
300
+ readonly disabled: {
301
+ readonly type: BooleanConstructor;
302
+ readonly default: false;
303
+ };
304
+ readonly clearable: {
305
+ readonly type: BooleanConstructor;
306
+ readonly default: false;
307
+ };
308
+ readonly filterable: {
309
+ readonly type: BooleanConstructor;
310
+ readonly default: false;
311
+ };
312
+ readonly size: {
313
+ readonly type: import('vue').PropType<import('.').SelectSize>;
314
+ readonly default: "md";
315
+ };
316
+ readonly shape: {
317
+ readonly type: import('vue').PropType<import('.').SelectShape>;
318
+ readonly default: "clip";
319
+ };
320
+ readonly variant: {
321
+ readonly type: import('vue').PropType<import('.').SelectVariant>;
322
+ readonly default: "outline";
323
+ };
324
+ readonly color: {
325
+ readonly type: StringConstructor;
326
+ readonly default: "";
327
+ };
328
+ readonly inactiveColor: {
329
+ readonly type: StringConstructor;
330
+ readonly default: "";
331
+ };
332
+ readonly placeholderColor: {
333
+ readonly type: StringConstructor;
334
+ readonly default: "";
335
+ };
336
+ readonly inline: {
337
+ readonly type: BooleanConstructor;
338
+ readonly default: false;
339
+ };
340
+ readonly placement: {
341
+ readonly type: import('vue').PropType<import('.').SelectPlacement>;
342
+ readonly default: "bottom-start";
343
+ };
344
+ readonly teleportTo: {
345
+ readonly type: import('vue').PropType<string | HTMLElement>;
346
+ readonly default: "body";
347
+ };
348
+ readonly maxHeight: {
349
+ readonly type: NumberConstructor;
350
+ readonly default: 256;
351
+ };
352
+ readonly noMatchText: {
353
+ readonly type: StringConstructor;
354
+ readonly default: "无匹配数据";
355
+ };
356
+ readonly noDataText: {
357
+ readonly type: StringConstructor;
358
+ readonly default: "无数据";
359
+ };
360
+ readonly clearDuration: {
361
+ readonly type: NumberConstructor;
362
+ readonly default: 150;
363
+ };
364
+ readonly width: {
365
+ readonly type: import('vue').PropType<string | number>;
366
+ readonly default: "";
367
+ };
368
+ }>> & Readonly<{
369
+ onClear?: (() => any) | undefined;
370
+ onBlur?: (() => any) | undefined;
371
+ onChange?: ((value: string | number) => any) | undefined;
372
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
373
+ onFocus?: (() => any) | undefined;
374
+ onVisibleChange?: ((visible: boolean) => any) | undefined;
375
+ }>, {
376
+ open: () => void;
377
+ close: () => void;
378
+ toggle: () => void;
379
+ focus: () => void;
380
+ blur: () => void;
381
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
382
+ clear: () => void;
383
+ blur: () => void;
384
+ change: (value: string | number) => void;
385
+ "update:modelValue": (value: string | number) => void;
386
+ focus: () => void;
387
+ visibleChange: (visible: boolean) => void;
388
+ }, string, {
389
+ readonly size: import('@cyberpunk-vue/hooks').Size;
390
+ readonly width: string | number;
391
+ readonly color: string;
392
+ readonly variant: import('.').SelectVariant;
393
+ readonly disabled: boolean;
394
+ readonly shape: import('.').SelectShape;
395
+ readonly inline: boolean;
396
+ readonly placeholder: string;
397
+ readonly modelValue: string | number;
398
+ readonly clearable: boolean;
399
+ readonly placeholderColor: string;
400
+ readonly clearDuration: number;
401
+ readonly maxHeight: number;
402
+ readonly inactiveColor: string;
403
+ readonly teleportTo: string | HTMLElement;
404
+ readonly placement: import('.').SelectPlacement;
405
+ readonly options: import('.').SelectOption[];
406
+ readonly filterPlaceholder: string;
407
+ readonly filterable: boolean;
408
+ readonly noMatchText: string;
409
+ readonly noDataText: string;
410
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
411
+ $slots: {
412
+ prefix?(_: {}): any;
413
+ empty?(_: {}): any;
414
+ default?(_: {
415
+ option: import('.').SelectOption;
416
+ }): any;
417
+ };
418
+ })>;
419
+ export default CpSelect;
420
+ export * from './src/select';
421
+ export type { SelectInstance } from './src/instance';
@@ -0,0 +1,16 @@
1
+ import { default as Select } from './select.vue';
2
+ /**
3
+ * CpSelect 组件实例类型
4
+ *
5
+ * @description 用于 ref 引用时获取正确的类型提示
6
+ *
7
+ * @example
8
+ * ```vue
9
+ * <script setup lang="ts">
10
+ * import type { SelectInstance } from '@cyberpunk-vue/components'
11
+ * const selectRef = ref<SelectInstance>()
12
+ * selectRef.value?.open()
13
+ * </script>
14
+ * ```
15
+ */
16
+ export type SelectInstance = InstanceType<typeof Select> & unknown;