@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.
- package/README.md +7 -0
- package/dist/component.cjs +163 -89
- package/dist/component.d.cts +109 -29
- package/dist/component.d.mts +109 -29
- package/dist/component.d.ts +109 -29
- package/dist/component.mjs +157 -89
- package/dist/index.cjs +7 -4
- package/dist/index.d.cts +4 -333
- package/dist/index.d.mts +4 -333
- package/dist/index.d.ts +4 -333
- package/dist/index.mjs +2 -2
- package/dist/resolver.cjs +5 -5
- package/dist/resolver.d.cts +2 -2
- package/dist/resolver.d.mts +2 -2
- package/dist/resolver.d.ts +2 -2
- package/dist/resolver.mjs +5 -5
- package/dist/shared/radio.54693474.d.cts +519 -0
- package/dist/shared/radio.54693474.d.mts +519 -0
- package/dist/shared/radio.54693474.d.ts +519 -0
- package/package.json +19 -19
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @destyler/radio
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@destyler/radio)
|
|
4
|
+
|
|
5
|
+
> a set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
|
|
6
|
+
|
|
7
|
+
[GitHub](https://github.com/destyler/destyler) | [Documentation](https://destyler-dev.zeabur.app/)
|
package/dist/component.cjs
CHANGED
|
@@ -6,61 +6,90 @@ const shared = require('@destyler/shared');
|
|
|
6
6
|
const composition = require('@destyler/composition');
|
|
7
7
|
const rovingFocus = require('@destyler/roving-focus');
|
|
8
8
|
const core = require('@vueuse/core');
|
|
9
|
-
const
|
|
9
|
+
const presence = require('@destyler/presence');
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
asChild: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
required: false,
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
11
|
+
const radioGroupRootProps = {
|
|
12
|
+
...primitive.primitiveProps,
|
|
13
|
+
/**
|
|
14
|
+
* The controlled value of the radio item to check. Can be binded as `v-model`.
|
|
15
|
+
*/
|
|
22
16
|
modelValue: {
|
|
23
17
|
type: String,
|
|
24
18
|
required: false
|
|
25
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* The value of the radio item that should be checked when initially rendered.
|
|
22
|
+
*
|
|
23
|
+
* Use when you do not need to control the state of the radio items.
|
|
24
|
+
*/
|
|
26
25
|
defaultValue: {
|
|
27
26
|
type: String,
|
|
28
27
|
required: false
|
|
29
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* When `true`, prevents the user from interacting with radio items.
|
|
31
|
+
*/
|
|
30
32
|
disabled: {
|
|
31
33
|
type: Boolean,
|
|
32
34
|
required: false,
|
|
33
35
|
default: false
|
|
34
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* The name of the group. Submitted with its owning form as part of a name/value pair.
|
|
39
|
+
*/
|
|
35
40
|
name: {
|
|
36
41
|
type: String,
|
|
37
42
|
required: false
|
|
38
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* When `true`, indicates that the user must check a radio item before the owning form can be submitted.
|
|
46
|
+
*
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
39
49
|
required: {
|
|
40
50
|
type: Boolean,
|
|
41
51
|
required: false,
|
|
42
52
|
default: false
|
|
43
53
|
},
|
|
54
|
+
/**
|
|
55
|
+
* The orientation of the component.
|
|
56
|
+
*
|
|
57
|
+
* @default undefined
|
|
58
|
+
*/
|
|
44
59
|
orientation: {
|
|
45
60
|
type: String,
|
|
46
61
|
required: false,
|
|
47
62
|
default: void 0
|
|
48
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* The reading direction of the radio when applicable.
|
|
66
|
+
*/
|
|
49
67
|
dir: {
|
|
50
68
|
type: String,
|
|
51
69
|
required: false
|
|
52
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* When `true`, keyboard navigation will loop from last item to first, and vice versa.
|
|
73
|
+
*
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
53
76
|
loop: {
|
|
54
77
|
type: Boolean,
|
|
55
78
|
required: false,
|
|
56
79
|
default: true
|
|
57
80
|
}
|
|
58
81
|
};
|
|
82
|
+
const radioGroupRootEmits = {
|
|
83
|
+
/**
|
|
84
|
+
* Event handler called when the radio group value changes
|
|
85
|
+
*/
|
|
86
|
+
"update:modelValue": (_value) => true
|
|
87
|
+
};
|
|
59
88
|
const [injectRadioGroupRootContext, provideRadioGroupRootContext] = shared.createContext("DestylerRadioGroupRoot");
|
|
60
|
-
const
|
|
89
|
+
const RadioGroupRoot = vue.defineComponent({
|
|
61
90
|
name: "DestylerRadioGroupRoot",
|
|
62
|
-
props:
|
|
63
|
-
emits:
|
|
91
|
+
props: radioGroupRootProps,
|
|
92
|
+
emits: radioGroupRootEmits,
|
|
64
93
|
setup(props, { emit }) {
|
|
65
94
|
const modelValue = composition.useVModel(props, "modelValue", emit, {
|
|
66
95
|
defaultValue: props.defaultValue,
|
|
@@ -89,66 +118,88 @@ const DestylerRadioGroupRoot = vue.defineComponent({
|
|
|
89
118
|
};
|
|
90
119
|
},
|
|
91
120
|
render() {
|
|
92
|
-
return vue.h(rovingFocus.
|
|
121
|
+
return vue.h(rovingFocus.RovingFocusGroup, {
|
|
93
122
|
asChild: true,
|
|
94
123
|
orientation: this.orientation,
|
|
95
124
|
dir: this.dir,
|
|
96
125
|
loop: this.loop
|
|
97
|
-
}, vue.h(primitive.
|
|
126
|
+
}, () => vue.h(primitive.Primitive, {
|
|
98
127
|
"role": "radiogroup",
|
|
99
128
|
"data-disabled": this.disabled ? "" : void 0,
|
|
100
129
|
"asChild": this.$props.asChild,
|
|
101
130
|
"aria-required": this.required,
|
|
102
131
|
"dir": this.dir,
|
|
103
132
|
"name": this.name
|
|
104
|
-
},
|
|
105
|
-
default: () => this.$slots.default?.()
|
|
106
|
-
}));
|
|
133
|
+
}, () => this.$slots.default?.()));
|
|
107
134
|
}
|
|
108
135
|
});
|
|
109
136
|
|
|
110
|
-
const
|
|
137
|
+
const radioProps = {
|
|
138
|
+
...primitive.primitiveProps,
|
|
139
|
+
/**
|
|
140
|
+
* @default button
|
|
141
|
+
*/
|
|
111
142
|
as: {
|
|
112
|
-
|
|
113
|
-
required: false,
|
|
143
|
+
...primitive.primitiveProps.as,
|
|
114
144
|
default: "button"
|
|
115
145
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
default: false
|
|
120
|
-
},
|
|
146
|
+
/**
|
|
147
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
148
|
+
*/
|
|
121
149
|
id: {
|
|
122
150
|
type: String,
|
|
123
151
|
required: false
|
|
124
152
|
},
|
|
153
|
+
/**
|
|
154
|
+
* The value given as data when submitted with a `name`.
|
|
155
|
+
*/
|
|
125
156
|
value: {
|
|
126
157
|
type: String,
|
|
127
158
|
required: false
|
|
128
159
|
},
|
|
160
|
+
/**
|
|
161
|
+
* When `true`, prevents the user from interacting with the radio item.
|
|
162
|
+
*/
|
|
129
163
|
disabled: {
|
|
130
164
|
type: Boolean,
|
|
131
165
|
required: false,
|
|
132
166
|
default: false
|
|
133
167
|
},
|
|
168
|
+
/**
|
|
169
|
+
* When `true`, indicates that the user must check the radio item before the owning form can be submitted.
|
|
170
|
+
*/
|
|
134
171
|
required: {
|
|
135
172
|
type: Boolean,
|
|
136
173
|
required: false
|
|
137
174
|
},
|
|
175
|
+
/**
|
|
176
|
+
* The controlled value of the radio item to check. Can be binded as `v-model`.
|
|
177
|
+
*
|
|
178
|
+
* @default undefined
|
|
179
|
+
*/
|
|
138
180
|
checked: {
|
|
139
181
|
type: Boolean,
|
|
140
182
|
required: false,
|
|
141
183
|
default: void 0
|
|
142
184
|
},
|
|
185
|
+
/**
|
|
186
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
187
|
+
*/
|
|
143
188
|
name: {
|
|
144
189
|
type: String,
|
|
145
190
|
required: false
|
|
146
191
|
}
|
|
147
192
|
};
|
|
148
|
-
const
|
|
193
|
+
const radioEmits = {
|
|
194
|
+
/**
|
|
195
|
+
* Event handler called when the radio item is checked.
|
|
196
|
+
*/
|
|
197
|
+
"update:checked": (_value) => true
|
|
198
|
+
};
|
|
199
|
+
const Radio = vue.defineComponent({
|
|
149
200
|
name: "DestylerRadio",
|
|
150
|
-
props:
|
|
151
|
-
emits:
|
|
201
|
+
props: radioProps,
|
|
202
|
+
emits: radioEmits,
|
|
152
203
|
setup(props, { emit }) {
|
|
153
204
|
const checkedRef = composition.useVModel(props, "checked", emit, {
|
|
154
205
|
passive: props.checked === void 0
|
|
@@ -172,9 +223,10 @@ const DestylerRadio = vue.defineComponent({
|
|
|
172
223
|
};
|
|
173
224
|
},
|
|
174
225
|
render() {
|
|
175
|
-
return vue.
|
|
226
|
+
return vue.h(primitive.Primitive, vue.mergeProps(this.$attrs, {
|
|
227
|
+
"id": this.$props.id,
|
|
176
228
|
"role": "radio",
|
|
177
|
-
"ref":
|
|
229
|
+
"ref": this.forwardRef,
|
|
178
230
|
"type": this.$props.as === "button" ? "button" : void 0,
|
|
179
231
|
"as": this.$props.as,
|
|
180
232
|
"aria-checked": this.checkedRef,
|
|
@@ -189,15 +241,18 @@ const DestylerRadio = vue.defineComponent({
|
|
|
189
241
|
"onClick": vue.withModifiers((event) => {
|
|
190
242
|
this.handleClick(event);
|
|
191
243
|
}, ["stop"])
|
|
192
|
-
}), [
|
|
244
|
+
}), () => [
|
|
193
245
|
this.$slots.default?.(),
|
|
194
246
|
this.isFormControl ? vue.h("input", {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
247
|
+
"type": "radio",
|
|
248
|
+
"tabindex": -1,
|
|
249
|
+
"aria-hidden": "",
|
|
250
|
+
"value": this.value,
|
|
251
|
+
"checked": this.checkedRef,
|
|
252
|
+
"name": this.$props.name,
|
|
253
|
+
"disabled": this.disabled,
|
|
254
|
+
"required": this.required,
|
|
255
|
+
"style": {
|
|
201
256
|
transform: "translateX(-100%)",
|
|
202
257
|
position: "absolute",
|
|
203
258
|
pointerEvents: "none",
|
|
@@ -205,50 +260,53 @@ const DestylerRadio = vue.defineComponent({
|
|
|
205
260
|
margin: 0
|
|
206
261
|
}
|
|
207
262
|
}) : null
|
|
208
|
-
]), [
|
|
209
|
-
[directives.BindOnceDirective, { id: this.$props.id }]
|
|
210
263
|
]);
|
|
211
264
|
}
|
|
212
265
|
});
|
|
213
266
|
|
|
214
|
-
const
|
|
215
|
-
as: {
|
|
216
|
-
type: [String, Object],
|
|
217
|
-
required: false,
|
|
218
|
-
default: "button"
|
|
219
|
-
},
|
|
267
|
+
const radioGroupItemProps = {
|
|
220
268
|
asChild: {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
269
|
+
...radioProps.asChild
|
|
270
|
+
},
|
|
271
|
+
as: {
|
|
272
|
+
...radioProps.as
|
|
224
273
|
},
|
|
274
|
+
/**
|
|
275
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
276
|
+
*/
|
|
225
277
|
id: {
|
|
226
|
-
|
|
227
|
-
required: false
|
|
278
|
+
...radioProps.id
|
|
228
279
|
},
|
|
280
|
+
/**
|
|
281
|
+
* The value given as data when submitted with a `name`.
|
|
282
|
+
*/
|
|
229
283
|
value: {
|
|
230
|
-
|
|
231
|
-
required: false
|
|
284
|
+
...radioProps.value
|
|
232
285
|
},
|
|
286
|
+
/**
|
|
287
|
+
* When `true`, prevents the user from interacting with the radio item.
|
|
288
|
+
*/
|
|
233
289
|
disabled: {
|
|
234
|
-
|
|
235
|
-
required: false,
|
|
236
|
-
default: false
|
|
290
|
+
...radioProps.disabled
|
|
237
291
|
},
|
|
292
|
+
/**
|
|
293
|
+
* When `true`, indicates that the user must check the radio item before the owning form can be submitted.
|
|
294
|
+
*/
|
|
238
295
|
required: {
|
|
239
|
-
|
|
240
|
-
required: false
|
|
296
|
+
...radioProps.required
|
|
241
297
|
},
|
|
298
|
+
/**
|
|
299
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
300
|
+
*/
|
|
242
301
|
name: {
|
|
243
|
-
|
|
244
|
-
required: false
|
|
302
|
+
...radioProps.name
|
|
245
303
|
}
|
|
246
304
|
};
|
|
247
|
-
const [injectRadioGroupItemContext, provideRadiogroupItemContext] = shared.createContext("
|
|
248
|
-
const
|
|
249
|
-
name: "
|
|
305
|
+
const [injectRadioGroupItemContext, provideRadiogroupItemContext] = shared.createContext("RadioGroupItem");
|
|
306
|
+
const RadioGroupItem = vue.defineComponent({
|
|
307
|
+
name: "RadioGroupItem",
|
|
250
308
|
inheritAttrs: false,
|
|
251
|
-
props:
|
|
309
|
+
props: radioGroupItemProps,
|
|
252
310
|
setup(props) {
|
|
253
311
|
const { forwardRef, currentElement } = composition.useForwardExpose();
|
|
254
312
|
const rootContext = injectRadioGroupRootContext();
|
|
@@ -281,62 +339,78 @@ const DestylerRadioGroupItem = vue.defineComponent({
|
|
|
281
339
|
};
|
|
282
340
|
},
|
|
283
341
|
render() {
|
|
284
|
-
return vue.h(rovingFocus.
|
|
342
|
+
return vue.h(rovingFocus.RovingFocusItem, {
|
|
285
343
|
asChild: true,
|
|
286
344
|
checked: this.checked,
|
|
287
345
|
disabled: this.disabled,
|
|
288
346
|
focusable: !this.disabled,
|
|
289
347
|
active: this.checked
|
|
290
|
-
}, vue.h(
|
|
348
|
+
}, () => vue.h(Radio, vue.mergeProps(this.$attrs, this.$props, {
|
|
291
349
|
"ref": (el) => this.forwardRef(el),
|
|
292
350
|
"checked": this.checked,
|
|
293
351
|
"required": this.required,
|
|
294
352
|
"onUpdate:checked": () => {
|
|
295
353
|
this.rootContext.changeModelValue(this.$props.value);
|
|
296
354
|
},
|
|
355
|
+
"onKeydown": vue.withKeys((event) => {
|
|
356
|
+
event.preventDefault();
|
|
357
|
+
}, ["enter"]),
|
|
297
358
|
"onFocus": () => {
|
|
298
359
|
this.handleFocus();
|
|
299
360
|
}
|
|
300
|
-
}),
|
|
301
|
-
default: () => this.$slots.default?.()
|
|
302
|
-
}));
|
|
361
|
+
}), () => this.$slots.default?.()));
|
|
303
362
|
}
|
|
304
363
|
});
|
|
305
364
|
|
|
306
|
-
const
|
|
365
|
+
const radioGroupIndicatorProps = {
|
|
366
|
+
...primitive.primitiveProps,
|
|
367
|
+
/**
|
|
368
|
+
* @default span
|
|
369
|
+
*/
|
|
307
370
|
as: {
|
|
308
|
-
|
|
309
|
-
required: false,
|
|
371
|
+
...primitive.primitiveProps.as,
|
|
310
372
|
default: "span"
|
|
311
373
|
},
|
|
312
|
-
|
|
374
|
+
/**
|
|
375
|
+
* Used to force mounting when more control is needed. Useful when
|
|
376
|
+
* controlling animation with Vue animation libraries.
|
|
377
|
+
*/
|
|
378
|
+
forceMount: {
|
|
313
379
|
type: Boolean,
|
|
314
|
-
required: false
|
|
315
|
-
default: false
|
|
380
|
+
required: false
|
|
316
381
|
}
|
|
317
382
|
};
|
|
318
|
-
const
|
|
383
|
+
const RadioGroupIndicator = vue.defineComponent({
|
|
319
384
|
name: "DestylerRadioGroupindicator",
|
|
320
|
-
props:
|
|
385
|
+
props: radioGroupIndicatorProps,
|
|
321
386
|
setup() {
|
|
322
387
|
const itemContext = injectRadioGroupItemContext();
|
|
388
|
+
const { forwardRef } = composition.useForwardExpose();
|
|
323
389
|
return {
|
|
390
|
+
forwardRef,
|
|
324
391
|
itemContext
|
|
325
392
|
};
|
|
326
393
|
},
|
|
327
394
|
render() {
|
|
328
|
-
return
|
|
395
|
+
return vue.h(presence.Presence, {
|
|
396
|
+
present: this.$props.forceMount || this.itemContext.checked.value
|
|
397
|
+
}, () => vue.h(primitive.Primitive, vue.mergeProps(this.$attrs, {
|
|
398
|
+
"ref": (el) => this.forwardRef(el),
|
|
329
399
|
"data-state": this.itemContext.checked.value ? "checked" : "unchecked",
|
|
330
400
|
"data-disabled": this.itemContext.disabled.value ? "" : void 0,
|
|
331
|
-
"
|
|
332
|
-
"
|
|
333
|
-
},
|
|
334
|
-
default: () => this.$slots.default?.()
|
|
335
|
-
}) : null;
|
|
401
|
+
"asChild": this.$props.asChild,
|
|
402
|
+
"as": this.$props.as
|
|
403
|
+
}), () => this.$slots.default?.()));
|
|
336
404
|
}
|
|
337
405
|
});
|
|
338
406
|
|
|
339
|
-
exports.
|
|
340
|
-
exports.
|
|
341
|
-
exports.
|
|
342
|
-
exports.
|
|
407
|
+
exports.Radio = Radio;
|
|
408
|
+
exports.RadioGroupIndicator = RadioGroupIndicator;
|
|
409
|
+
exports.RadioGroupItem = RadioGroupItem;
|
|
410
|
+
exports.RadioGroupRoot = RadioGroupRoot;
|
|
411
|
+
exports.radioEmits = radioEmits;
|
|
412
|
+
exports.radioGroupIndicatorProps = radioGroupIndicatorProps;
|
|
413
|
+
exports.radioGroupItemProps = radioGroupItemProps;
|
|
414
|
+
exports.radioGroupRootEmits = radioGroupRootEmits;
|
|
415
|
+
exports.radioGroupRootProps = radioGroupRootProps;
|
|
416
|
+
exports.radioProps = radioProps;
|
package/dist/component.d.cts
CHANGED
|
@@ -1,85 +1,137 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { f as RadioGroupIndicator, h as RadioGroupIndicatorProps, c as RadioGroupItem, e as RadioGroupItemProps, R as RadioGroupRoot, b as RadioGroupRootProps, g as radioGroupIndicatorProps, d as radioGroupItemProps, a as radioGroupRootEmits, r as radioGroupRootProps } from './shared/radio.54693474.cjs';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
|
-
import { PropType
|
|
4
|
-
import
|
|
3
|
+
import { PropType } from 'vue';
|
|
4
|
+
import * as _destyler_primitive from '@destyler/primitive';
|
|
5
5
|
import { ExtractPublicPropTypes } from '@destyler/shared';
|
|
6
6
|
|
|
7
|
-
declare const
|
|
7
|
+
declare const radioProps: {
|
|
8
|
+
/**
|
|
9
|
+
* @default button
|
|
10
|
+
*/
|
|
8
11
|
readonly as: {
|
|
9
|
-
readonly type: PropType<AsTag | Component>;
|
|
10
|
-
readonly required: false;
|
|
11
12
|
readonly default: "button";
|
|
12
|
-
|
|
13
|
-
readonly asChild: {
|
|
14
|
-
readonly type: PropType<boolean>;
|
|
13
|
+
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
15
14
|
readonly required: false;
|
|
16
|
-
readonly default: false;
|
|
17
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
18
|
+
*/
|
|
18
19
|
readonly id: {
|
|
19
20
|
readonly type: PropType<string>;
|
|
20
21
|
readonly required: false;
|
|
21
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The value given as data when submitted with a `name`.
|
|
25
|
+
*/
|
|
22
26
|
readonly value: {
|
|
23
27
|
readonly type: PropType<string>;
|
|
24
28
|
readonly required: false;
|
|
25
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* When `true`, prevents the user from interacting with the radio item.
|
|
32
|
+
*/
|
|
26
33
|
readonly disabled: {
|
|
27
34
|
readonly type: PropType<boolean>;
|
|
28
35
|
readonly required: false;
|
|
29
36
|
readonly default: false;
|
|
30
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* When `true`, indicates that the user must check the radio item before the owning form can be submitted.
|
|
40
|
+
*/
|
|
31
41
|
readonly required: {
|
|
32
42
|
readonly type: PropType<boolean>;
|
|
33
43
|
readonly required: false;
|
|
34
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* The controlled value of the radio item to check. Can be binded as `v-model`.
|
|
47
|
+
*
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
35
50
|
readonly checked: {
|
|
36
51
|
readonly type: PropType<boolean>;
|
|
37
52
|
readonly required: false;
|
|
38
53
|
readonly default: undefined;
|
|
39
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
57
|
+
*/
|
|
40
58
|
readonly name: {
|
|
41
59
|
readonly type: PropType<string>;
|
|
42
60
|
readonly required: false;
|
|
43
61
|
};
|
|
44
|
-
};
|
|
45
|
-
type DestylerRadioProps = ExtractPublicPropTypes<typeof destylerRadioProps>;
|
|
46
|
-
declare const DestylerRadio: vue.DefineComponent<{
|
|
47
|
-
readonly as: {
|
|
48
|
-
readonly type: PropType<AsTag | Component>;
|
|
49
|
-
readonly required: false;
|
|
50
|
-
readonly default: "button";
|
|
51
|
-
};
|
|
52
62
|
readonly asChild: {
|
|
53
63
|
readonly type: PropType<boolean>;
|
|
54
64
|
readonly required: false;
|
|
55
65
|
readonly default: false;
|
|
56
66
|
};
|
|
67
|
+
};
|
|
68
|
+
type RadioProps = ExtractPublicPropTypes<typeof radioProps>;
|
|
69
|
+
declare const radioEmits: {
|
|
70
|
+
/**
|
|
71
|
+
* Event handler called when the radio item is checked.
|
|
72
|
+
*/
|
|
73
|
+
'update:checked': (_value: boolean) => boolean;
|
|
74
|
+
};
|
|
75
|
+
declare const Radio: vue.DefineComponent<{
|
|
76
|
+
/**
|
|
77
|
+
* @default button
|
|
78
|
+
*/
|
|
79
|
+
readonly as: {
|
|
80
|
+
readonly default: "button";
|
|
81
|
+
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
82
|
+
readonly required: false;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
86
|
+
*/
|
|
57
87
|
readonly id: {
|
|
58
88
|
readonly type: PropType<string>;
|
|
59
89
|
readonly required: false;
|
|
60
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* The value given as data when submitted with a `name`.
|
|
93
|
+
*/
|
|
61
94
|
readonly value: {
|
|
62
95
|
readonly type: PropType<string>;
|
|
63
96
|
readonly required: false;
|
|
64
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* When `true`, prevents the user from interacting with the radio item.
|
|
100
|
+
*/
|
|
65
101
|
readonly disabled: {
|
|
66
102
|
readonly type: PropType<boolean>;
|
|
67
103
|
readonly required: false;
|
|
68
104
|
readonly default: false;
|
|
69
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* When `true`, indicates that the user must check the radio item before the owning form can be submitted.
|
|
108
|
+
*/
|
|
70
109
|
readonly required: {
|
|
71
110
|
readonly type: PropType<boolean>;
|
|
72
111
|
readonly required: false;
|
|
73
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* The controlled value of the radio item to check. Can be binded as `v-model`.
|
|
115
|
+
*
|
|
116
|
+
* @default undefined
|
|
117
|
+
*/
|
|
74
118
|
readonly checked: {
|
|
75
119
|
readonly type: PropType<boolean>;
|
|
76
120
|
readonly required: false;
|
|
77
121
|
readonly default: undefined;
|
|
78
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
125
|
+
*/
|
|
79
126
|
readonly name: {
|
|
80
127
|
readonly type: PropType<string>;
|
|
81
128
|
readonly required: false;
|
|
82
129
|
};
|
|
130
|
+
readonly asChild: {
|
|
131
|
+
readonly type: PropType<boolean>;
|
|
132
|
+
readonly required: false;
|
|
133
|
+
readonly default: false;
|
|
134
|
+
};
|
|
83
135
|
}, {
|
|
84
136
|
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
85
137
|
checkedRef: vue.WritableComputedRef<boolean | undefined>;
|
|
@@ -87,50 +139,78 @@ declare const DestylerRadio: vue.DefineComponent<{
|
|
|
87
139
|
value: vue.Ref<string | undefined>;
|
|
88
140
|
isFormControl: vue.ComputedRef<boolean>;
|
|
89
141
|
handleClick: (event: MouseEvent) => void;
|
|
90
|
-
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin,
|
|
142
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
143
|
+
/**
|
|
144
|
+
* Event handler called when the radio item is checked.
|
|
145
|
+
*/
|
|
146
|
+
'update:checked': (_value: boolean) => boolean;
|
|
147
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
148
|
+
/**
|
|
149
|
+
* @default button
|
|
150
|
+
*/
|
|
91
151
|
readonly as: {
|
|
92
|
-
readonly type: PropType<AsTag | Component>;
|
|
93
|
-
readonly required: false;
|
|
94
152
|
readonly default: "button";
|
|
95
|
-
|
|
96
|
-
readonly asChild: {
|
|
97
|
-
readonly type: PropType<boolean>;
|
|
153
|
+
readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
|
|
98
154
|
readonly required: false;
|
|
99
|
-
readonly default: false;
|
|
100
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
158
|
+
*/
|
|
101
159
|
readonly id: {
|
|
102
160
|
readonly type: PropType<string>;
|
|
103
161
|
readonly required: false;
|
|
104
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* The value given as data when submitted with a `name`.
|
|
165
|
+
*/
|
|
105
166
|
readonly value: {
|
|
106
167
|
readonly type: PropType<string>;
|
|
107
168
|
readonly required: false;
|
|
108
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* When `true`, prevents the user from interacting with the radio item.
|
|
172
|
+
*/
|
|
109
173
|
readonly disabled: {
|
|
110
174
|
readonly type: PropType<boolean>;
|
|
111
175
|
readonly required: false;
|
|
112
176
|
readonly default: false;
|
|
113
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* When `true`, indicates that the user must check the radio item before the owning form can be submitted.
|
|
180
|
+
*/
|
|
114
181
|
readonly required: {
|
|
115
182
|
readonly type: PropType<boolean>;
|
|
116
183
|
readonly required: false;
|
|
117
184
|
};
|
|
185
|
+
/**
|
|
186
|
+
* The controlled value of the radio item to check. Can be binded as `v-model`.
|
|
187
|
+
*
|
|
188
|
+
* @default undefined
|
|
189
|
+
*/
|
|
118
190
|
readonly checked: {
|
|
119
191
|
readonly type: PropType<boolean>;
|
|
120
192
|
readonly required: false;
|
|
121
193
|
readonly default: undefined;
|
|
122
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* The name of the input fields in the radio (Useful for form submission).
|
|
197
|
+
*/
|
|
123
198
|
readonly name: {
|
|
124
199
|
readonly type: PropType<string>;
|
|
125
200
|
readonly required: false;
|
|
126
201
|
};
|
|
202
|
+
readonly asChild: {
|
|
203
|
+
readonly type: PropType<boolean>;
|
|
204
|
+
readonly required: false;
|
|
205
|
+
readonly default: false;
|
|
206
|
+
};
|
|
127
207
|
}>> & {
|
|
128
|
-
"onUpdate:checked"?: ((
|
|
208
|
+
"onUpdate:checked"?: ((_value: boolean) => any) | undefined;
|
|
129
209
|
}, {
|
|
130
|
-
readonly as: AsTag | Component;
|
|
131
|
-
readonly asChild: boolean;
|
|
132
210
|
readonly disabled: boolean;
|
|
211
|
+
readonly as: _destyler_primitive.AsTag | vue.Component;
|
|
212
|
+
readonly asChild: boolean;
|
|
133
213
|
readonly checked: boolean;
|
|
134
214
|
}, {}>;
|
|
135
215
|
|
|
136
|
-
export {
|
|
216
|
+
export { Radio, type RadioProps, radioEmits, radioProps };
|