@destyler/checkbox 0.0.1 → 0.0.3
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.cjs +8 -9
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +9 -10
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -101,9 +101,7 @@ const DestylerCheckboxRoot = vue.defineComponent({
|
|
|
101
101
|
"onClick": () => {
|
|
102
102
|
this.checked = !this.checked;
|
|
103
103
|
}
|
|
104
|
-
}),
|
|
105
|
-
default: () => this.$slots.default?.()
|
|
106
|
-
}), [
|
|
104
|
+
}), () => this.$slots.default?.()), [
|
|
107
105
|
[directives.BindOnceDirective, { id: this.$props.id }]
|
|
108
106
|
]),
|
|
109
107
|
useVShow ? vue.h("input", {
|
|
@@ -136,7 +134,7 @@ const destylerCheckboxIndicatorProps = {
|
|
|
136
134
|
as: {
|
|
137
135
|
type: [String, Object],
|
|
138
136
|
required: false,
|
|
139
|
-
default: "
|
|
137
|
+
default: "span"
|
|
140
138
|
},
|
|
141
139
|
forceMount: {
|
|
142
140
|
type: Boolean,
|
|
@@ -149,14 +147,17 @@ const DestylerCheckboxIndicator = vue.defineComponent({
|
|
|
149
147
|
props: destylerCheckboxIndicatorProps,
|
|
150
148
|
setup() {
|
|
151
149
|
const rootContext = injectCheckboxRootContext();
|
|
150
|
+
const { forwardRef } = composition.useForwardExpose();
|
|
152
151
|
return {
|
|
153
|
-
rootContext
|
|
152
|
+
rootContext,
|
|
153
|
+
forwardRef
|
|
154
154
|
};
|
|
155
155
|
},
|
|
156
156
|
render() {
|
|
157
157
|
return vue.h(presence.DestylerPresence, {
|
|
158
158
|
present: this.$props.forceMount || isIndeterminate(this.rootContext.state.value) || this.rootContext.state.value === true
|
|
159
|
-
}, vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$attrs, {
|
|
159
|
+
}, () => vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$attrs, {
|
|
160
|
+
"ref": (el) => this.forwardRef(el),
|
|
160
161
|
"data-state": getState(this.rootContext.state.value),
|
|
161
162
|
"data-disabled": this.rootContext.disabled.value ? "" : void 0,
|
|
162
163
|
"asChild": this.$props.asChild,
|
|
@@ -164,9 +165,7 @@ const DestylerCheckboxIndicator = vue.defineComponent({
|
|
|
164
165
|
"style": {
|
|
165
166
|
pointerEvents: "none"
|
|
166
167
|
}
|
|
167
|
-
}),
|
|
168
|
-
default: () => this.$slots.default?.()
|
|
169
|
-
}));
|
|
168
|
+
}), () => vue.renderSlot(this.$slots, "default")));
|
|
170
169
|
}
|
|
171
170
|
});
|
|
172
171
|
|
package/dist/index.d.cts
CHANGED
|
@@ -162,7 +162,7 @@ declare const destylerCheckboxIndicatorProps: {
|
|
|
162
162
|
readonly as: {
|
|
163
163
|
readonly type: PropType<AsTag | Component>;
|
|
164
164
|
readonly required: false;
|
|
165
|
-
readonly default: "
|
|
165
|
+
readonly default: "span";
|
|
166
166
|
};
|
|
167
167
|
readonly forceMount: {
|
|
168
168
|
readonly type: PropType<boolean>;
|
|
@@ -180,7 +180,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
180
180
|
readonly as: {
|
|
181
181
|
readonly type: PropType<AsTag | Component>;
|
|
182
182
|
readonly required: false;
|
|
183
|
-
readonly default: "
|
|
183
|
+
readonly default: "span";
|
|
184
184
|
};
|
|
185
185
|
readonly forceMount: {
|
|
186
186
|
readonly type: PropType<boolean>;
|
|
@@ -189,6 +189,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
189
189
|
};
|
|
190
190
|
}, {
|
|
191
191
|
rootContext: CheckboxRootContext;
|
|
192
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
192
193
|
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
193
194
|
readonly asChild: {
|
|
194
195
|
readonly type: PropType<boolean>;
|
|
@@ -198,7 +199,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
198
199
|
readonly as: {
|
|
199
200
|
readonly type: PropType<AsTag | Component>;
|
|
200
201
|
readonly required: false;
|
|
201
|
-
readonly default: "
|
|
202
|
+
readonly default: "span";
|
|
202
203
|
};
|
|
203
204
|
readonly forceMount: {
|
|
204
205
|
readonly type: PropType<boolean>;
|
package/dist/index.d.mts
CHANGED
|
@@ -162,7 +162,7 @@ declare const destylerCheckboxIndicatorProps: {
|
|
|
162
162
|
readonly as: {
|
|
163
163
|
readonly type: PropType<AsTag | Component>;
|
|
164
164
|
readonly required: false;
|
|
165
|
-
readonly default: "
|
|
165
|
+
readonly default: "span";
|
|
166
166
|
};
|
|
167
167
|
readonly forceMount: {
|
|
168
168
|
readonly type: PropType<boolean>;
|
|
@@ -180,7 +180,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
180
180
|
readonly as: {
|
|
181
181
|
readonly type: PropType<AsTag | Component>;
|
|
182
182
|
readonly required: false;
|
|
183
|
-
readonly default: "
|
|
183
|
+
readonly default: "span";
|
|
184
184
|
};
|
|
185
185
|
readonly forceMount: {
|
|
186
186
|
readonly type: PropType<boolean>;
|
|
@@ -189,6 +189,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
189
189
|
};
|
|
190
190
|
}, {
|
|
191
191
|
rootContext: CheckboxRootContext;
|
|
192
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
192
193
|
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
193
194
|
readonly asChild: {
|
|
194
195
|
readonly type: PropType<boolean>;
|
|
@@ -198,7 +199,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
198
199
|
readonly as: {
|
|
199
200
|
readonly type: PropType<AsTag | Component>;
|
|
200
201
|
readonly required: false;
|
|
201
|
-
readonly default: "
|
|
202
|
+
readonly default: "span";
|
|
202
203
|
};
|
|
203
204
|
readonly forceMount: {
|
|
204
205
|
readonly type: PropType<boolean>;
|
package/dist/index.d.ts
CHANGED
|
@@ -162,7 +162,7 @@ declare const destylerCheckboxIndicatorProps: {
|
|
|
162
162
|
readonly as: {
|
|
163
163
|
readonly type: PropType<AsTag | Component>;
|
|
164
164
|
readonly required: false;
|
|
165
|
-
readonly default: "
|
|
165
|
+
readonly default: "span";
|
|
166
166
|
};
|
|
167
167
|
readonly forceMount: {
|
|
168
168
|
readonly type: PropType<boolean>;
|
|
@@ -180,7 +180,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
180
180
|
readonly as: {
|
|
181
181
|
readonly type: PropType<AsTag | Component>;
|
|
182
182
|
readonly required: false;
|
|
183
|
-
readonly default: "
|
|
183
|
+
readonly default: "span";
|
|
184
184
|
};
|
|
185
185
|
readonly forceMount: {
|
|
186
186
|
readonly type: PropType<boolean>;
|
|
@@ -189,6 +189,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
189
189
|
};
|
|
190
190
|
}, {
|
|
191
191
|
rootContext: CheckboxRootContext;
|
|
192
|
+
forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
|
|
192
193
|
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
193
194
|
readonly asChild: {
|
|
194
195
|
readonly type: PropType<boolean>;
|
|
@@ -198,7 +199,7 @@ declare const DestylerCheckboxIndicator: vue.DefineComponent<{
|
|
|
198
199
|
readonly as: {
|
|
199
200
|
readonly type: PropType<AsTag | Component>;
|
|
200
201
|
readonly required: false;
|
|
201
|
-
readonly default: "
|
|
202
|
+
readonly default: "span";
|
|
202
203
|
};
|
|
203
204
|
readonly forceMount: {
|
|
204
205
|
readonly type: PropType<boolean>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, toRef, computed, withDirectives, h, mergeProps } from 'vue';
|
|
1
|
+
import { defineComponent, toRef, computed, withDirectives, h, mergeProps, renderSlot } from 'vue';
|
|
2
2
|
import { DestylerPrimitive } from '@destyler/primitive';
|
|
3
3
|
import { useVModel, useForwardExpose, useFormControl } from '@destyler/composition';
|
|
4
4
|
import { createContext } from '@destyler/shared';
|
|
@@ -99,9 +99,7 @@ const DestylerCheckboxRoot = defineComponent({
|
|
|
99
99
|
"onClick": () => {
|
|
100
100
|
this.checked = !this.checked;
|
|
101
101
|
}
|
|
102
|
-
}),
|
|
103
|
-
default: () => this.$slots.default?.()
|
|
104
|
-
}), [
|
|
102
|
+
}), () => this.$slots.default?.()), [
|
|
105
103
|
[BindOnceDirective, { id: this.$props.id }]
|
|
106
104
|
]),
|
|
107
105
|
useVShow ? h("input", {
|
|
@@ -134,7 +132,7 @@ const destylerCheckboxIndicatorProps = {
|
|
|
134
132
|
as: {
|
|
135
133
|
type: [String, Object],
|
|
136
134
|
required: false,
|
|
137
|
-
default: "
|
|
135
|
+
default: "span"
|
|
138
136
|
},
|
|
139
137
|
forceMount: {
|
|
140
138
|
type: Boolean,
|
|
@@ -147,14 +145,17 @@ const DestylerCheckboxIndicator = defineComponent({
|
|
|
147
145
|
props: destylerCheckboxIndicatorProps,
|
|
148
146
|
setup() {
|
|
149
147
|
const rootContext = injectCheckboxRootContext();
|
|
148
|
+
const { forwardRef } = useForwardExpose();
|
|
150
149
|
return {
|
|
151
|
-
rootContext
|
|
150
|
+
rootContext,
|
|
151
|
+
forwardRef
|
|
152
152
|
};
|
|
153
153
|
},
|
|
154
154
|
render() {
|
|
155
155
|
return h(DestylerPresence, {
|
|
156
156
|
present: this.$props.forceMount || isIndeterminate(this.rootContext.state.value) || this.rootContext.state.value === true
|
|
157
|
-
}, h(DestylerPrimitive, mergeProps(this.$attrs, {
|
|
157
|
+
}, () => h(DestylerPrimitive, mergeProps(this.$attrs, {
|
|
158
|
+
"ref": (el) => this.forwardRef(el),
|
|
158
159
|
"data-state": getState(this.rootContext.state.value),
|
|
159
160
|
"data-disabled": this.rootContext.disabled.value ? "" : void 0,
|
|
160
161
|
"asChild": this.$props.asChild,
|
|
@@ -162,9 +163,7 @@ const DestylerCheckboxIndicator = defineComponent({
|
|
|
162
163
|
"style": {
|
|
163
164
|
pointerEvents: "none"
|
|
164
165
|
}
|
|
165
|
-
}),
|
|
166
|
-
default: () => this.$slots.default?.()
|
|
167
|
-
}));
|
|
166
|
+
}), () => renderSlot(this.$slots, "default")));
|
|
168
167
|
}
|
|
169
168
|
});
|
|
170
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@destyler/checkbox",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.3",
|
|
4
5
|
"description": "unstyled checkbox component for vue",
|
|
5
6
|
"author": "Elone Hoo <elonehoo@gmail.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -33,11 +34,11 @@
|
|
|
33
34
|
"vue": ">=3.3.4"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@destyler/
|
|
37
|
-
"@destyler/
|
|
38
|
-
"@destyler/primitive": "0.0.
|
|
39
|
-
"@destyler/
|
|
40
|
-
"@destyler/
|
|
37
|
+
"@destyler/composition": "0.0.3",
|
|
38
|
+
"@destyler/shared": "0.0.3",
|
|
39
|
+
"@destyler/primitive": "0.0.3",
|
|
40
|
+
"@destyler/presence": "0.0.3",
|
|
41
|
+
"@destyler/directives": "0.0.3"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
44
|
"clear": "rimraf ./dist",
|