@destyler/radio 0.0.2 → 0.0.4

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.
@@ -0,0 +1,519 @@
1
+ import * as vue from 'vue';
2
+ import { PropType, Ref, ComputedRef } from 'vue';
3
+ import * as _destyler_primitive from '@destyler/primitive';
4
+ import { DataOrientation, Direction, ExtractPublicPropTypes } from '@destyler/shared';
5
+
6
+ declare const radioGroupRootProps: {
7
+ /**
8
+ * The controlled value of the radio item to check. Can be binded as `v-model`.
9
+ */
10
+ readonly modelValue: {
11
+ readonly type: PropType<string>;
12
+ readonly required: false;
13
+ };
14
+ /**
15
+ * The value of the radio item that should be checked when initially rendered.
16
+ *
17
+ * Use when you do not need to control the state of the radio items.
18
+ */
19
+ readonly defaultValue: {
20
+ readonly type: PropType<string>;
21
+ readonly required: false;
22
+ };
23
+ /**
24
+ * When `true`, prevents the user from interacting with radio items.
25
+ */
26
+ readonly disabled: {
27
+ readonly type: PropType<boolean>;
28
+ readonly required: false;
29
+ readonly default: false;
30
+ };
31
+ /**
32
+ * The name of the group. Submitted with its owning form as part of a name/value pair.
33
+ */
34
+ readonly name: {
35
+ readonly type: PropType<string>;
36
+ readonly required: false;
37
+ };
38
+ /**
39
+ * When `true`, indicates that the user must check a radio item before the owning form can be submitted.
40
+ *
41
+ * @default false
42
+ */
43
+ readonly required: {
44
+ readonly type: PropType<boolean>;
45
+ readonly required: false;
46
+ readonly default: false;
47
+ };
48
+ /**
49
+ * The orientation of the component.
50
+ *
51
+ * @default undefined
52
+ */
53
+ readonly orientation: {
54
+ readonly type: PropType<DataOrientation>;
55
+ readonly required: false;
56
+ readonly default: undefined;
57
+ };
58
+ /**
59
+ * The reading direction of the radio when applicable.
60
+ */
61
+ readonly dir: {
62
+ readonly type: PropType<Direction>;
63
+ readonly required: false;
64
+ };
65
+ /**
66
+ * When `true`, keyboard navigation will loop from last item to first, and vice versa.
67
+ *
68
+ * @default true
69
+ */
70
+ readonly loop: {
71
+ readonly type: PropType<boolean>;
72
+ readonly required: false;
73
+ readonly default: true;
74
+ };
75
+ readonly as: {
76
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
77
+ readonly required: false;
78
+ readonly default: "div";
79
+ };
80
+ readonly asChild: {
81
+ readonly type: PropType<boolean>;
82
+ readonly required: false;
83
+ readonly default: false;
84
+ };
85
+ };
86
+ type RadioGroupRootProps = ExtractPublicPropTypes<typeof radioGroupRootProps>;
87
+ declare const radioGroupRootEmits: {
88
+ /**
89
+ * Event handler called when the radio group value changes
90
+ */
91
+ 'update:modelValue': (_value: string) => boolean;
92
+ };
93
+ interface RadioGroupRootContext {
94
+ modelValue?: Readonly<Ref<string | undefined>>;
95
+ changeModelValue: (value?: string) => void;
96
+ disabled: Ref<boolean>;
97
+ loop: Ref<boolean>;
98
+ orientation: Ref<DataOrientation | undefined>;
99
+ name?: string;
100
+ required: Ref<boolean>;
101
+ }
102
+ declare const RadioGroupRoot: vue.DefineComponent<{
103
+ /**
104
+ * The controlled value of the radio item to check. Can be binded as `v-model`.
105
+ */
106
+ readonly modelValue: {
107
+ readonly type: PropType<string>;
108
+ readonly required: false;
109
+ };
110
+ /**
111
+ * The value of the radio item that should be checked when initially rendered.
112
+ *
113
+ * Use when you do not need to control the state of the radio items.
114
+ */
115
+ readonly defaultValue: {
116
+ readonly type: PropType<string>;
117
+ readonly required: false;
118
+ };
119
+ /**
120
+ * When `true`, prevents the user from interacting with radio items.
121
+ */
122
+ readonly disabled: {
123
+ readonly type: PropType<boolean>;
124
+ readonly required: false;
125
+ readonly default: false;
126
+ };
127
+ /**
128
+ * The name of the group. Submitted with its owning form as part of a name/value pair.
129
+ */
130
+ readonly name: {
131
+ readonly type: PropType<string>;
132
+ readonly required: false;
133
+ };
134
+ /**
135
+ * When `true`, indicates that the user must check a radio item before the owning form can be submitted.
136
+ *
137
+ * @default false
138
+ */
139
+ readonly required: {
140
+ readonly type: PropType<boolean>;
141
+ readonly required: false;
142
+ readonly default: false;
143
+ };
144
+ /**
145
+ * The orientation of the component.
146
+ *
147
+ * @default undefined
148
+ */
149
+ readonly orientation: {
150
+ readonly type: PropType<DataOrientation>;
151
+ readonly required: false;
152
+ readonly default: undefined;
153
+ };
154
+ /**
155
+ * The reading direction of the radio when applicable.
156
+ */
157
+ readonly dir: {
158
+ readonly type: PropType<Direction>;
159
+ readonly required: false;
160
+ };
161
+ /**
162
+ * When `true`, keyboard navigation will loop from last item to first, and vice versa.
163
+ *
164
+ * @default true
165
+ */
166
+ readonly loop: {
167
+ readonly type: PropType<boolean>;
168
+ readonly required: false;
169
+ readonly default: true;
170
+ };
171
+ readonly as: {
172
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
173
+ readonly required: false;
174
+ readonly default: "div";
175
+ };
176
+ readonly asChild: {
177
+ readonly type: PropType<boolean>;
178
+ readonly required: false;
179
+ readonly default: false;
180
+ };
181
+ }, {
182
+ orientation: Ref<DataOrientation | undefined>;
183
+ dir: vue.ComputedRef<Direction>;
184
+ loop: Ref<boolean>;
185
+ disabled: Ref<boolean>;
186
+ required: Ref<boolean>;
187
+ name: Ref<string | undefined>;
188
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
189
+ /**
190
+ * Event handler called when the radio group value changes
191
+ */
192
+ 'update:modelValue': (_value: string) => boolean;
193
+ }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
194
+ /**
195
+ * The controlled value of the radio item to check. Can be binded as `v-model`.
196
+ */
197
+ readonly modelValue: {
198
+ readonly type: PropType<string>;
199
+ readonly required: false;
200
+ };
201
+ /**
202
+ * The value of the radio item that should be checked when initially rendered.
203
+ *
204
+ * Use when you do not need to control the state of the radio items.
205
+ */
206
+ readonly defaultValue: {
207
+ readonly type: PropType<string>;
208
+ readonly required: false;
209
+ };
210
+ /**
211
+ * When `true`, prevents the user from interacting with radio items.
212
+ */
213
+ readonly disabled: {
214
+ readonly type: PropType<boolean>;
215
+ readonly required: false;
216
+ readonly default: false;
217
+ };
218
+ /**
219
+ * The name of the group. Submitted with its owning form as part of a name/value pair.
220
+ */
221
+ readonly name: {
222
+ readonly type: PropType<string>;
223
+ readonly required: false;
224
+ };
225
+ /**
226
+ * When `true`, indicates that the user must check a radio item before the owning form can be submitted.
227
+ *
228
+ * @default false
229
+ */
230
+ readonly required: {
231
+ readonly type: PropType<boolean>;
232
+ readonly required: false;
233
+ readonly default: false;
234
+ };
235
+ /**
236
+ * The orientation of the component.
237
+ *
238
+ * @default undefined
239
+ */
240
+ readonly orientation: {
241
+ readonly type: PropType<DataOrientation>;
242
+ readonly required: false;
243
+ readonly default: undefined;
244
+ };
245
+ /**
246
+ * The reading direction of the radio when applicable.
247
+ */
248
+ readonly dir: {
249
+ readonly type: PropType<Direction>;
250
+ readonly required: false;
251
+ };
252
+ /**
253
+ * When `true`, keyboard navigation will loop from last item to first, and vice versa.
254
+ *
255
+ * @default true
256
+ */
257
+ readonly loop: {
258
+ readonly type: PropType<boolean>;
259
+ readonly required: false;
260
+ readonly default: true;
261
+ };
262
+ readonly as: {
263
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
264
+ readonly required: false;
265
+ readonly default: "div";
266
+ };
267
+ readonly asChild: {
268
+ readonly type: PropType<boolean>;
269
+ readonly required: false;
270
+ readonly default: false;
271
+ };
272
+ }>> & {
273
+ "onUpdate:modelValue"?: ((_value: string) => any) | undefined;
274
+ }, {
275
+ readonly disabled: boolean;
276
+ readonly required: boolean;
277
+ readonly orientation: DataOrientation;
278
+ readonly loop: boolean;
279
+ readonly as: _destyler_primitive.AsTag | vue.Component;
280
+ readonly asChild: boolean;
281
+ }, {}>;
282
+
283
+ declare const radioGroupItemProps: {
284
+ readonly asChild: {
285
+ readonly type: vue.PropType<boolean>;
286
+ readonly required: false;
287
+ readonly default: false;
288
+ };
289
+ readonly as: {
290
+ readonly default: "button";
291
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
292
+ readonly required: false;
293
+ };
294
+ /**
295
+ * The name of the input fields in the radio (Useful for form submission).
296
+ */
297
+ readonly id: {
298
+ readonly type: vue.PropType<string>;
299
+ readonly required: false;
300
+ };
301
+ /**
302
+ * The value given as data when submitted with a `name`.
303
+ */
304
+ readonly value: {
305
+ readonly type: vue.PropType<string>;
306
+ readonly required: false;
307
+ };
308
+ /**
309
+ * When `true`, prevents the user from interacting with the radio item.
310
+ */
311
+ readonly disabled: {
312
+ readonly type: vue.PropType<boolean>;
313
+ readonly required: false;
314
+ readonly default: false;
315
+ };
316
+ /**
317
+ * When `true`, indicates that the user must check the radio item before the owning form can be submitted.
318
+ */
319
+ readonly required: {
320
+ readonly type: vue.PropType<boolean>;
321
+ readonly required: false;
322
+ };
323
+ /**
324
+ * The name of the input fields in the radio (Useful for form submission).
325
+ */
326
+ readonly name: {
327
+ readonly type: vue.PropType<string>;
328
+ readonly required: false;
329
+ };
330
+ };
331
+ type RadioGroupItemProps = ExtractPublicPropTypes<typeof radioGroupItemProps>;
332
+ interface RadioGroupItemContext {
333
+ disabled: ComputedRef<boolean>;
334
+ checked: ComputedRef<boolean>;
335
+ }
336
+ declare const RadioGroupItem: vue.DefineComponent<{
337
+ readonly asChild: {
338
+ readonly type: vue.PropType<boolean>;
339
+ readonly required: false;
340
+ readonly default: false;
341
+ };
342
+ readonly as: {
343
+ readonly default: "button";
344
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
345
+ readonly required: false;
346
+ };
347
+ /**
348
+ * The name of the input fields in the radio (Useful for form submission).
349
+ */
350
+ readonly id: {
351
+ readonly type: vue.PropType<string>;
352
+ readonly required: false;
353
+ };
354
+ /**
355
+ * The value given as data when submitted with a `name`.
356
+ */
357
+ readonly value: {
358
+ readonly type: vue.PropType<string>;
359
+ readonly required: false;
360
+ };
361
+ /**
362
+ * When `true`, prevents the user from interacting with the radio item.
363
+ */
364
+ readonly disabled: {
365
+ readonly type: vue.PropType<boolean>;
366
+ readonly required: false;
367
+ readonly default: false;
368
+ };
369
+ /**
370
+ * When `true`, indicates that the user must check the radio item before the owning form can be submitted.
371
+ */
372
+ readonly required: {
373
+ readonly type: vue.PropType<boolean>;
374
+ readonly required: false;
375
+ };
376
+ /**
377
+ * The name of the input fields in the radio (Useful for form submission).
378
+ */
379
+ readonly name: {
380
+ readonly type: vue.PropType<string>;
381
+ readonly required: false;
382
+ };
383
+ }, {
384
+ checked: ComputedRef<boolean>;
385
+ disabled: ComputedRef<boolean>;
386
+ required: ComputedRef<boolean | undefined>;
387
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
388
+ rootContext: RadioGroupRootContext;
389
+ handleFocus: () => void;
390
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
391
+ readonly asChild: {
392
+ readonly type: vue.PropType<boolean>;
393
+ readonly required: false;
394
+ readonly default: false;
395
+ };
396
+ readonly as: {
397
+ readonly default: "button";
398
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
399
+ readonly required: false;
400
+ };
401
+ /**
402
+ * The name of the input fields in the radio (Useful for form submission).
403
+ */
404
+ readonly id: {
405
+ readonly type: vue.PropType<string>;
406
+ readonly required: false;
407
+ };
408
+ /**
409
+ * The value given as data when submitted with a `name`.
410
+ */
411
+ readonly value: {
412
+ readonly type: vue.PropType<string>;
413
+ readonly required: false;
414
+ };
415
+ /**
416
+ * When `true`, prevents the user from interacting with the radio item.
417
+ */
418
+ readonly disabled: {
419
+ readonly type: vue.PropType<boolean>;
420
+ readonly required: false;
421
+ readonly default: false;
422
+ };
423
+ /**
424
+ * When `true`, indicates that the user must check the radio item before the owning form can be submitted.
425
+ */
426
+ readonly required: {
427
+ readonly type: vue.PropType<boolean>;
428
+ readonly required: false;
429
+ };
430
+ /**
431
+ * The name of the input fields in the radio (Useful for form submission).
432
+ */
433
+ readonly name: {
434
+ readonly type: vue.PropType<string>;
435
+ readonly required: false;
436
+ };
437
+ }>>, {
438
+ readonly disabled: boolean;
439
+ readonly as: _destyler_primitive.AsTag | vue.Component;
440
+ readonly asChild: boolean;
441
+ }, {}>;
442
+
443
+ declare const radioGroupIndicatorProps: {
444
+ /**
445
+ * @default span
446
+ */
447
+ readonly as: {
448
+ readonly default: "span";
449
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
450
+ readonly required: false;
451
+ };
452
+ /**
453
+ * Used to force mounting when more control is needed. Useful when
454
+ * controlling animation with Vue animation libraries.
455
+ */
456
+ readonly forceMount: {
457
+ readonly type: PropType<boolean>;
458
+ readonly required: false;
459
+ };
460
+ readonly asChild: {
461
+ readonly type: PropType<boolean>;
462
+ readonly required: false;
463
+ readonly default: false;
464
+ };
465
+ };
466
+ type RadioGroupIndicatorProps = ExtractPublicPropTypes<typeof radioGroupIndicatorProps>;
467
+ declare const RadioGroupIndicator: vue.DefineComponent<{
468
+ /**
469
+ * @default span
470
+ */
471
+ readonly as: {
472
+ readonly default: "span";
473
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
474
+ readonly required: false;
475
+ };
476
+ /**
477
+ * Used to force mounting when more control is needed. Useful when
478
+ * controlling animation with Vue animation libraries.
479
+ */
480
+ readonly forceMount: {
481
+ readonly type: PropType<boolean>;
482
+ readonly required: false;
483
+ };
484
+ readonly asChild: {
485
+ readonly type: PropType<boolean>;
486
+ readonly required: false;
487
+ readonly default: false;
488
+ };
489
+ }, {
490
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
491
+ itemContext: RadioGroupItemContext;
492
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
493
+ /**
494
+ * @default span
495
+ */
496
+ readonly as: {
497
+ readonly default: "span";
498
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
499
+ readonly required: false;
500
+ };
501
+ /**
502
+ * Used to force mounting when more control is needed. Useful when
503
+ * controlling animation with Vue animation libraries.
504
+ */
505
+ readonly forceMount: {
506
+ readonly type: PropType<boolean>;
507
+ readonly required: false;
508
+ };
509
+ readonly asChild: {
510
+ readonly type: PropType<boolean>;
511
+ readonly required: false;
512
+ readonly default: false;
513
+ };
514
+ }>>, {
515
+ readonly as: _destyler_primitive.AsTag | vue.Component;
516
+ readonly asChild: boolean;
517
+ }, {}>;
518
+
519
+ export { RadioGroupRoot as R, radioGroupRootEmits as a, type RadioGroupRootProps as b, RadioGroupItem as c, radioGroupItemProps as d, type RadioGroupItemProps as e, RadioGroupIndicator as f, radioGroupIndicatorProps as g, type RadioGroupIndicatorProps as h, radioGroupRootProps as r };
package/package.json CHANGED
@@ -1,24 +1,22 @@
1
1
  {
2
2
  "name": "@destyler/radio",
3
- "version": "0.0.2",
4
- "description": "unstyled radio component for vue",
3
+ "type": "module",
4
+ "version": "0.0.4",
5
+ "description": "a set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
5
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
6
7
  "license": "MIT",
7
8
  "exports": {
8
9
  ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
12
  },
13
13
  "./resolver": {
14
- "types": "./dist/resolver.d.ts",
15
- "import": "./dist/resolver.mjs",
16
- "require": "./dist/resolver.cjs"
14
+ "types": "./dist/resolver.d.mts",
15
+ "default": "./dist/resolver.mjs"
17
16
  },
18
17
  "./component": {
19
- "types": "./dist/component.d.ts",
20
- "import": "./dist/component.mjs",
21
- "require": "./dist/component.cjs"
18
+ "types": "./dist/component.d.mts",
19
+ "default": "./dist/component.mjs"
22
20
  },
23
21
  "./*": "./*"
24
22
  },
@@ -30,18 +28,20 @@
30
28
  "dist"
31
29
  ],
32
30
  "peerDependencies": {
33
- "vue": ">=3.3.4"
31
+ "vue": ">=3.4.21"
34
32
  },
35
33
  "dependencies": {
36
- "@vueuse/core": "^10.7.2",
37
- "@destyler/composition": "0.0.2",
38
- "@destyler/roving-focus": "0.0.2",
39
- "@destyler/primitive": "0.0.2",
40
- "@destyler/shared": "0.0.2",
41
- "@destyler/directives": "0.0.2"
34
+ "@vueuse/core": "^10.9.0",
35
+ "@destyler/composition": "0.0.4",
36
+ "@destyler/directives": "0.0.4",
37
+ "@destyler/primitive": "0.0.4",
38
+ "@destyler/shared": "0.0.4",
39
+ "@destyler/roving-focus": "0.0.4",
40
+ "@destyler/presence": "0.0.4"
42
41
  },
43
42
  "scripts": {
44
43
  "clear": "rimraf ./dist",
45
- "build": "pnpm run clear && unbuild"
44
+ "build": "pnpm run clear && unbuild",
45
+ "stub": "unbuild --stub"
46
46
  }
47
47
  }