@destyler/switch 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/dist/index.d.mts CHANGED
@@ -1,97 +1,152 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, Component, Ref } from 'vue';
3
- import { AsTag } from '@destyler/primitive';
2
+ import { PropType, Ref } from 'vue';
3
+ import * as _destyler_primitive from '@destyler/primitive';
4
4
  import { ExtractPublicPropTypes } from '@destyler/shared';
5
5
 
6
- declare const destylerSwitchRootProps: {
6
+ declare const switchRootProps: {
7
+ /**
8
+ * @default button
9
+ */
7
10
  readonly as: {
8
- readonly type: PropType<AsTag | Component>;
9
- readonly required: false;
10
11
  readonly default: "button";
11
- };
12
- readonly asChild: {
13
- readonly type: PropType<boolean>;
12
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
14
13
  readonly required: false;
15
- readonly default: false;
16
14
  };
15
+ /**
16
+ * The state of the switch when it is initially rendered.
17
+ * Use when you do not need to control its state.
18
+ */
17
19
  readonly defaultChecked: {
18
20
  readonly type: PropType<boolean>;
19
21
  readonly required: false;
20
22
  };
23
+ /**
24
+ * The controlled state of the switch.
25
+ * Can be bind as `v-model:checked`.
26
+ */
21
27
  readonly checked: {
22
28
  readonly type: PropType<boolean>;
23
29
  readonly required: false;
24
30
  readonly default: undefined;
25
31
  };
32
+ /**
33
+ * When `true`, prevents the user from interacting with the switch.
34
+ */
26
35
  readonly disabled: {
27
36
  readonly type: PropType<boolean>;
28
37
  readonly required: false;
29
38
  };
39
+ /**
40
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
41
+ */
30
42
  readonly required: {
31
43
  readonly type: PropType<boolean>;
32
44
  readonly required: false;
33
45
  };
46
+ /**
47
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
48
+ */
34
49
  readonly name: {
35
50
  readonly type: PropType<string>;
36
51
  readonly required: false;
37
52
  };
53
+ /**
54
+ * Id of the element
55
+ */
38
56
  readonly id: {
39
57
  readonly type: PropType<string>;
40
58
  readonly required: false;
41
59
  };
60
+ /**
61
+ * The value given as data when submitted with a `name`.
62
+ */
42
63
  readonly value: {
43
64
  readonly type: PropType<string>;
44
65
  readonly required: false;
45
66
  readonly default: "on";
46
67
  };
68
+ readonly asChild: {
69
+ readonly type: PropType<boolean>;
70
+ readonly required: false;
71
+ readonly default: false;
72
+ };
73
+ };
74
+ type SwitchRootProps = ExtractPublicPropTypes<typeof switchRootProps>;
75
+ declare const switchRootEmits: {
76
+ 'update:checked': (_checked: boolean) => boolean;
47
77
  };
48
- type DestylerSwitchRootProps = ExtractPublicPropTypes<typeof destylerSwitchRootProps>;
49
78
  interface SwitchRootContext {
50
79
  checked?: Ref<boolean>;
51
80
  toggleCheck: () => void;
52
81
  disabled: Ref<boolean | undefined>;
53
82
  }
54
- declare const DestylerSwitchRoot: vue.DefineComponent<{
83
+ declare const SwitchRoot: vue.DefineComponent<{
84
+ /**
85
+ * @default button
86
+ */
55
87
  readonly as: {
56
- readonly type: PropType<AsTag | Component>;
57
- readonly required: false;
58
88
  readonly default: "button";
59
- };
60
- readonly asChild: {
61
- readonly type: PropType<boolean>;
89
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
62
90
  readonly required: false;
63
- readonly default: false;
64
91
  };
92
+ /**
93
+ * The state of the switch when it is initially rendered.
94
+ * Use when you do not need to control its state.
95
+ */
65
96
  readonly defaultChecked: {
66
97
  readonly type: PropType<boolean>;
67
98
  readonly required: false;
68
99
  };
100
+ /**
101
+ * The controlled state of the switch.
102
+ * Can be bind as `v-model:checked`.
103
+ */
69
104
  readonly checked: {
70
105
  readonly type: PropType<boolean>;
71
106
  readonly required: false;
72
107
  readonly default: undefined;
73
108
  };
109
+ /**
110
+ * When `true`, prevents the user from interacting with the switch.
111
+ */
74
112
  readonly disabled: {
75
113
  readonly type: PropType<boolean>;
76
114
  readonly required: false;
77
115
  };
116
+ /**
117
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
118
+ */
78
119
  readonly required: {
79
120
  readonly type: PropType<boolean>;
80
121
  readonly required: false;
81
122
  };
123
+ /**
124
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
125
+ */
82
126
  readonly name: {
83
127
  readonly type: PropType<string>;
84
128
  readonly required: false;
85
129
  };
130
+ /**
131
+ * Id of the element
132
+ */
86
133
  readonly id: {
87
134
  readonly type: PropType<string>;
88
135
  readonly required: false;
89
136
  };
137
+ /**
138
+ * The value given as data when submitted with a `name`.
139
+ */
90
140
  readonly value: {
91
141
  readonly type: PropType<string>;
92
142
  readonly required: false;
93
143
  readonly default: "on";
94
144
  };
145
+ readonly asChild: {
146
+ readonly type: PropType<boolean>;
147
+ readonly required: false;
148
+ readonly default: false;
149
+ };
95
150
  }, {
96
151
  forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
97
152
  toggleCheck: () => void;
@@ -99,96 +154,133 @@ declare const DestylerSwitchRoot: vue.DefineComponent<{
99
154
  ariaLabel: vue.ComputedRef<string | null | undefined>;
100
155
  checked: Ref<boolean>;
101
156
  disabled: Ref<boolean | undefined>;
102
- }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "update:checked"[], "update:checked", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
157
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
158
+ 'update:checked': (_checked: boolean) => boolean;
159
+ }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
160
+ /**
161
+ * @default button
162
+ */
103
163
  readonly as: {
104
- readonly type: PropType<AsTag | Component>;
105
- readonly required: false;
106
164
  readonly default: "button";
107
- };
108
- readonly asChild: {
109
- readonly type: PropType<boolean>;
165
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
110
166
  readonly required: false;
111
- readonly default: false;
112
167
  };
168
+ /**
169
+ * The state of the switch when it is initially rendered.
170
+ * Use when you do not need to control its state.
171
+ */
113
172
  readonly defaultChecked: {
114
173
  readonly type: PropType<boolean>;
115
174
  readonly required: false;
116
175
  };
176
+ /**
177
+ * The controlled state of the switch.
178
+ * Can be bind as `v-model:checked`.
179
+ */
117
180
  readonly checked: {
118
181
  readonly type: PropType<boolean>;
119
182
  readonly required: false;
120
183
  readonly default: undefined;
121
184
  };
185
+ /**
186
+ * When `true`, prevents the user from interacting with the switch.
187
+ */
122
188
  readonly disabled: {
123
189
  readonly type: PropType<boolean>;
124
190
  readonly required: false;
125
191
  };
192
+ /**
193
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
194
+ */
126
195
  readonly required: {
127
196
  readonly type: PropType<boolean>;
128
197
  readonly required: false;
129
198
  };
199
+ /**
200
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
201
+ */
130
202
  readonly name: {
131
203
  readonly type: PropType<string>;
132
204
  readonly required: false;
133
205
  };
206
+ /**
207
+ * Id of the element
208
+ */
134
209
  readonly id: {
135
210
  readonly type: PropType<string>;
136
211
  readonly required: false;
137
212
  };
213
+ /**
214
+ * The value given as data when submitted with a `name`.
215
+ */
138
216
  readonly value: {
139
217
  readonly type: PropType<string>;
140
218
  readonly required: false;
141
219
  readonly default: "on";
142
220
  };
221
+ readonly asChild: {
222
+ readonly type: PropType<boolean>;
223
+ readonly required: false;
224
+ readonly default: false;
225
+ };
143
226
  }>> & {
144
- "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
227
+ "onUpdate:checked"?: ((_checked: boolean) => any) | undefined;
145
228
  }, {
146
- readonly as: AsTag | Component;
147
- readonly asChild: boolean;
229
+ readonly as: _destyler_primitive.AsTag | vue.Component;
148
230
  readonly checked: boolean;
149
231
  readonly value: string;
232
+ readonly asChild: boolean;
150
233
  }, {}>;
151
234
 
152
- declare const destylerSwitchThumpProps: {
235
+ declare const switchThumbProps: {
236
+ /**
237
+ * @default span
238
+ */
153
239
  readonly as: {
154
- readonly type: PropType<AsTag | Component>;
155
- readonly required: false;
156
240
  readonly default: "span";
241
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
242
+ readonly required: false;
157
243
  };
158
244
  readonly asChild: {
159
- readonly type: PropType<boolean>;
245
+ readonly type: vue.PropType<boolean>;
160
246
  readonly required: false;
161
247
  readonly default: false;
162
248
  };
163
249
  };
164
- type DestylerSwitchThumpProps = ExtractPublicPropTypes<typeof destylerSwitchThumpProps>;
165
- declare const DestylerSwitchThump: vue.DefineComponent<{
250
+ type SwitchThumbProps = ExtractPublicPropTypes<typeof switchThumbProps>;
251
+ declare const SwitchThumb: vue.DefineComponent<{
252
+ /**
253
+ * @default span
254
+ */
166
255
  readonly as: {
167
- readonly type: PropType<AsTag | Component>;
168
- readonly required: false;
169
256
  readonly default: "span";
257
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
258
+ readonly required: false;
170
259
  };
171
260
  readonly asChild: {
172
- readonly type: PropType<boolean>;
261
+ readonly type: vue.PropType<boolean>;
173
262
  readonly required: false;
174
263
  readonly default: false;
175
264
  };
176
265
  }, {
177
266
  rootContext: SwitchRootContext;
178
267
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
268
+ /**
269
+ * @default span
270
+ */
179
271
  readonly as: {
180
- readonly type: PropType<AsTag | Component>;
181
- readonly required: false;
182
272
  readonly default: "span";
273
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
274
+ readonly required: false;
183
275
  };
184
276
  readonly asChild: {
185
- readonly type: PropType<boolean>;
277
+ readonly type: vue.PropType<boolean>;
186
278
  readonly required: false;
187
279
  readonly default: false;
188
280
  };
189
281
  }>>, {
190
- readonly as: AsTag | Component;
282
+ readonly as: _destyler_primitive.AsTag | vue.Component;
191
283
  readonly asChild: boolean;
192
284
  }, {}>;
193
285
 
194
- export { DestylerSwitchRoot, type DestylerSwitchRootProps, DestylerSwitchThump, type DestylerSwitchThumpProps };
286
+ export { SwitchRoot, type SwitchRootProps, SwitchThumb, type SwitchThumbProps, switchRootEmits, switchRootProps, switchThumbProps };
package/dist/index.d.ts CHANGED
@@ -1,97 +1,152 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, Component, Ref } from 'vue';
3
- import { AsTag } from '@destyler/primitive';
2
+ import { PropType, Ref } from 'vue';
3
+ import * as _destyler_primitive from '@destyler/primitive';
4
4
  import { ExtractPublicPropTypes } from '@destyler/shared';
5
5
 
6
- declare const destylerSwitchRootProps: {
6
+ declare const switchRootProps: {
7
+ /**
8
+ * @default button
9
+ */
7
10
  readonly as: {
8
- readonly type: PropType<AsTag | Component>;
9
- readonly required: false;
10
11
  readonly default: "button";
11
- };
12
- readonly asChild: {
13
- readonly type: PropType<boolean>;
12
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
14
13
  readonly required: false;
15
- readonly default: false;
16
14
  };
15
+ /**
16
+ * The state of the switch when it is initially rendered.
17
+ * Use when you do not need to control its state.
18
+ */
17
19
  readonly defaultChecked: {
18
20
  readonly type: PropType<boolean>;
19
21
  readonly required: false;
20
22
  };
23
+ /**
24
+ * The controlled state of the switch.
25
+ * Can be bind as `v-model:checked`.
26
+ */
21
27
  readonly checked: {
22
28
  readonly type: PropType<boolean>;
23
29
  readonly required: false;
24
30
  readonly default: undefined;
25
31
  };
32
+ /**
33
+ * When `true`, prevents the user from interacting with the switch.
34
+ */
26
35
  readonly disabled: {
27
36
  readonly type: PropType<boolean>;
28
37
  readonly required: false;
29
38
  };
39
+ /**
40
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
41
+ */
30
42
  readonly required: {
31
43
  readonly type: PropType<boolean>;
32
44
  readonly required: false;
33
45
  };
46
+ /**
47
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
48
+ */
34
49
  readonly name: {
35
50
  readonly type: PropType<string>;
36
51
  readonly required: false;
37
52
  };
53
+ /**
54
+ * Id of the element
55
+ */
38
56
  readonly id: {
39
57
  readonly type: PropType<string>;
40
58
  readonly required: false;
41
59
  };
60
+ /**
61
+ * The value given as data when submitted with a `name`.
62
+ */
42
63
  readonly value: {
43
64
  readonly type: PropType<string>;
44
65
  readonly required: false;
45
66
  readonly default: "on";
46
67
  };
68
+ readonly asChild: {
69
+ readonly type: PropType<boolean>;
70
+ readonly required: false;
71
+ readonly default: false;
72
+ };
73
+ };
74
+ type SwitchRootProps = ExtractPublicPropTypes<typeof switchRootProps>;
75
+ declare const switchRootEmits: {
76
+ 'update:checked': (_checked: boolean) => boolean;
47
77
  };
48
- type DestylerSwitchRootProps = ExtractPublicPropTypes<typeof destylerSwitchRootProps>;
49
78
  interface SwitchRootContext {
50
79
  checked?: Ref<boolean>;
51
80
  toggleCheck: () => void;
52
81
  disabled: Ref<boolean | undefined>;
53
82
  }
54
- declare const DestylerSwitchRoot: vue.DefineComponent<{
83
+ declare const SwitchRoot: vue.DefineComponent<{
84
+ /**
85
+ * @default button
86
+ */
55
87
  readonly as: {
56
- readonly type: PropType<AsTag | Component>;
57
- readonly required: false;
58
88
  readonly default: "button";
59
- };
60
- readonly asChild: {
61
- readonly type: PropType<boolean>;
89
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
62
90
  readonly required: false;
63
- readonly default: false;
64
91
  };
92
+ /**
93
+ * The state of the switch when it is initially rendered.
94
+ * Use when you do not need to control its state.
95
+ */
65
96
  readonly defaultChecked: {
66
97
  readonly type: PropType<boolean>;
67
98
  readonly required: false;
68
99
  };
100
+ /**
101
+ * The controlled state of the switch.
102
+ * Can be bind as `v-model:checked`.
103
+ */
69
104
  readonly checked: {
70
105
  readonly type: PropType<boolean>;
71
106
  readonly required: false;
72
107
  readonly default: undefined;
73
108
  };
109
+ /**
110
+ * When `true`, prevents the user from interacting with the switch.
111
+ */
74
112
  readonly disabled: {
75
113
  readonly type: PropType<boolean>;
76
114
  readonly required: false;
77
115
  };
116
+ /**
117
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
118
+ */
78
119
  readonly required: {
79
120
  readonly type: PropType<boolean>;
80
121
  readonly required: false;
81
122
  };
123
+ /**
124
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
125
+ */
82
126
  readonly name: {
83
127
  readonly type: PropType<string>;
84
128
  readonly required: false;
85
129
  };
130
+ /**
131
+ * Id of the element
132
+ */
86
133
  readonly id: {
87
134
  readonly type: PropType<string>;
88
135
  readonly required: false;
89
136
  };
137
+ /**
138
+ * The value given as data when submitted with a `name`.
139
+ */
90
140
  readonly value: {
91
141
  readonly type: PropType<string>;
92
142
  readonly required: false;
93
143
  readonly default: "on";
94
144
  };
145
+ readonly asChild: {
146
+ readonly type: PropType<boolean>;
147
+ readonly required: false;
148
+ readonly default: false;
149
+ };
95
150
  }, {
96
151
  forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
97
152
  toggleCheck: () => void;
@@ -99,96 +154,133 @@ declare const DestylerSwitchRoot: vue.DefineComponent<{
99
154
  ariaLabel: vue.ComputedRef<string | null | undefined>;
100
155
  checked: Ref<boolean>;
101
156
  disabled: Ref<boolean | undefined>;
102
- }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "update:checked"[], "update:checked", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
157
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
158
+ 'update:checked': (_checked: boolean) => boolean;
159
+ }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
160
+ /**
161
+ * @default button
162
+ */
103
163
  readonly as: {
104
- readonly type: PropType<AsTag | Component>;
105
- readonly required: false;
106
164
  readonly default: "button";
107
- };
108
- readonly asChild: {
109
- readonly type: PropType<boolean>;
165
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
110
166
  readonly required: false;
111
- readonly default: false;
112
167
  };
168
+ /**
169
+ * The state of the switch when it is initially rendered.
170
+ * Use when you do not need to control its state.
171
+ */
113
172
  readonly defaultChecked: {
114
173
  readonly type: PropType<boolean>;
115
174
  readonly required: false;
116
175
  };
176
+ /**
177
+ * The controlled state of the switch.
178
+ * Can be bind as `v-model:checked`.
179
+ */
117
180
  readonly checked: {
118
181
  readonly type: PropType<boolean>;
119
182
  readonly required: false;
120
183
  readonly default: undefined;
121
184
  };
185
+ /**
186
+ * When `true`, prevents the user from interacting with the switch.
187
+ */
122
188
  readonly disabled: {
123
189
  readonly type: PropType<boolean>;
124
190
  readonly required: false;
125
191
  };
192
+ /**
193
+ * When `true`, indicates that the user must check the switch before the owning form can be submitted.
194
+ */
126
195
  readonly required: {
127
196
  readonly type: PropType<boolean>;
128
197
  readonly required: false;
129
198
  };
199
+ /**
200
+ * The name of the switch. Submitted with its owning form as part of a name/value pair.
201
+ */
130
202
  readonly name: {
131
203
  readonly type: PropType<string>;
132
204
  readonly required: false;
133
205
  };
206
+ /**
207
+ * Id of the element
208
+ */
134
209
  readonly id: {
135
210
  readonly type: PropType<string>;
136
211
  readonly required: false;
137
212
  };
213
+ /**
214
+ * The value given as data when submitted with a `name`.
215
+ */
138
216
  readonly value: {
139
217
  readonly type: PropType<string>;
140
218
  readonly required: false;
141
219
  readonly default: "on";
142
220
  };
221
+ readonly asChild: {
222
+ readonly type: PropType<boolean>;
223
+ readonly required: false;
224
+ readonly default: false;
225
+ };
143
226
  }>> & {
144
- "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
227
+ "onUpdate:checked"?: ((_checked: boolean) => any) | undefined;
145
228
  }, {
146
- readonly as: AsTag | Component;
147
- readonly asChild: boolean;
229
+ readonly as: _destyler_primitive.AsTag | vue.Component;
148
230
  readonly checked: boolean;
149
231
  readonly value: string;
232
+ readonly asChild: boolean;
150
233
  }, {}>;
151
234
 
152
- declare const destylerSwitchThumpProps: {
235
+ declare const switchThumbProps: {
236
+ /**
237
+ * @default span
238
+ */
153
239
  readonly as: {
154
- readonly type: PropType<AsTag | Component>;
155
- readonly required: false;
156
240
  readonly default: "span";
241
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
242
+ readonly required: false;
157
243
  };
158
244
  readonly asChild: {
159
- readonly type: PropType<boolean>;
245
+ readonly type: vue.PropType<boolean>;
160
246
  readonly required: false;
161
247
  readonly default: false;
162
248
  };
163
249
  };
164
- type DestylerSwitchThumpProps = ExtractPublicPropTypes<typeof destylerSwitchThumpProps>;
165
- declare const DestylerSwitchThump: vue.DefineComponent<{
250
+ type SwitchThumbProps = ExtractPublicPropTypes<typeof switchThumbProps>;
251
+ declare const SwitchThumb: vue.DefineComponent<{
252
+ /**
253
+ * @default span
254
+ */
166
255
  readonly as: {
167
- readonly type: PropType<AsTag | Component>;
168
- readonly required: false;
169
256
  readonly default: "span";
257
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
258
+ readonly required: false;
170
259
  };
171
260
  readonly asChild: {
172
- readonly type: PropType<boolean>;
261
+ readonly type: vue.PropType<boolean>;
173
262
  readonly required: false;
174
263
  readonly default: false;
175
264
  };
176
265
  }, {
177
266
  rootContext: SwitchRootContext;
178
267
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
268
+ /**
269
+ * @default span
270
+ */
179
271
  readonly as: {
180
- readonly type: PropType<AsTag | Component>;
181
- readonly required: false;
182
272
  readonly default: "span";
273
+ readonly type: vue.PropType<_destyler_primitive.AsTag | vue.Component>;
274
+ readonly required: false;
183
275
  };
184
276
  readonly asChild: {
185
- readonly type: PropType<boolean>;
277
+ readonly type: vue.PropType<boolean>;
186
278
  readonly required: false;
187
279
  readonly default: false;
188
280
  };
189
281
  }>>, {
190
- readonly as: AsTag | Component;
282
+ readonly as: _destyler_primitive.AsTag | vue.Component;
191
283
  readonly asChild: boolean;
192
284
  }, {}>;
193
285
 
194
- export { DestylerSwitchRoot, type DestylerSwitchRootProps, DestylerSwitchThump, type DestylerSwitchThumpProps };
286
+ export { SwitchRoot, type SwitchRootProps, SwitchThumb, type SwitchThumbProps, switchRootEmits, switchRootProps, switchThumbProps };