@cypress-design/vue-checkbox 0.3.0 → 0.4.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.
- package/CHANGELOG.md +30 -0
- package/Checkbox.stories.mdx +1 -1
- package/Checkbox.vue +27 -11
- package/dist/Checkbox.vue.d.ts +164 -32
- package/dist/Checkbox.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +98 -0
- package/dist/index.es.mjs.map +1 -0
- package/dist/index.umd.js +3 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.es.js +0 -102
- package/dist/index.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @cypress-design/vue-checkbox
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#68](https://github.com/cypress-io/cypress-design/pull/68) [`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13) Thanks [@elevatebart](https://github.com/elevatebart)! - feat: publish `.mjs` files for esm intead of `.js`
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13)]:
|
|
10
|
+
- @cypress-design/vue-icon@0.5.2
|
|
11
|
+
|
|
12
|
+
## 0.4.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`2afa4d5`](https://github.com/cypress-io/cypress-design/commit/2afa4d54a2373692f82bee35ae40446bc9bb3f91) Thanks [@elevatebart](https://github.com/elevatebart)! - avoid duplicate ids in checkboxes
|
|
17
|
+
|
|
18
|
+
## 0.4.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#51](https://github.com/cypress-io/cypress-design/pull/51) [`ccd8f9a`](https://github.com/cypress-io/cypress-design/commit/ccd8f9a8feb624c0a52deaa9754c76969f43fc1e) Thanks [@elevatebart](https://github.com/elevatebart)! - in the build asset, add a comment containing all used windicss classes in the component
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#57](https://github.com/cypress-io/cypress-design/pull/57) [`6fa7d52`](https://github.com/cypress-io/cypress-design/commit/6fa7d52e409762bd1b32a8b04edaf78765830754) Thanks [@elevatebart](https://github.com/elevatebart)! - fix: move the input for checkboxes outside of label for accessibility
|
|
27
|
+
|
|
28
|
+
Source: https://www.a11ymatters.com/pattern/checkbox/
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`ccd8f9a`](https://github.com/cypress-io/cypress-design/commit/ccd8f9a8feb624c0a52deaa9754c76969f43fc1e), [`0866c65`](https://github.com/cypress-io/cypress-design/commit/0866c654f24c36951c98468d789462748606b428), [`43b53eb`](https://github.com/cypress-io/cypress-design/commit/43b53eb6bd10111629239a87374cfcc894eda0e3)]:
|
|
31
|
+
- @cypress-design/vue-icon@0.5.0
|
|
32
|
+
|
|
3
33
|
## 0.3.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
package/Checkbox.stories.mdx
CHANGED
|
@@ -30,7 +30,7 @@ import Checkbox from './Checkbox.vue'
|
|
|
30
30
|
<br />
|
|
31
31
|
<Checkbox label="Unchecked" :color="color"/>
|
|
32
32
|
<br />
|
|
33
|
-
<Checkbox
|
|
33
|
+
<Checkbox checked disabled label="Disabled & checked" :color="color"/>
|
|
34
34
|
<br />
|
|
35
35
|
<Checkbox disabled label="Disabled & unchecked" :color="color"/>
|
|
36
36
|
`,
|
package/Checkbox.vue
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
function uid() {
|
|
3
|
+
return String(Date.now().toString(32) + Math.random().toString(16)).replace(
|
|
4
|
+
/\./g,
|
|
5
|
+
''
|
|
6
|
+
)
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
1
10
|
<script lang="ts" setup>
|
|
2
11
|
import { ref, computed } from 'vue'
|
|
3
12
|
import { IconCheckmarkSmall } from '@cypress-design/vue-icon'
|
|
@@ -9,6 +18,10 @@ const props = withDefaults(
|
|
|
9
18
|
* It will be used to give match label with input for a11y.
|
|
10
19
|
*/
|
|
11
20
|
id?: string
|
|
21
|
+
/**
|
|
22
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
23
|
+
*/
|
|
24
|
+
name?: string
|
|
12
25
|
/**
|
|
13
26
|
* Is the checkbox checked when it is first rendered.
|
|
14
27
|
*/
|
|
@@ -30,12 +43,13 @@ const props = withDefaults(
|
|
|
30
43
|
label?: string
|
|
31
44
|
}>(),
|
|
32
45
|
{
|
|
33
|
-
|
|
34
|
-
id: crypto.randomUUID(),
|
|
46
|
+
id: () => uid(),
|
|
35
47
|
color: 'indigo',
|
|
36
48
|
}
|
|
37
49
|
)
|
|
38
50
|
|
|
51
|
+
|
|
52
|
+
|
|
39
53
|
const localChecked = ref(props.modelValue || props.checked)
|
|
40
54
|
|
|
41
55
|
const emit = defineEmits<{
|
|
@@ -63,16 +77,18 @@ const checkboxClasses = computed(() => [
|
|
|
63
77
|
</script>
|
|
64
78
|
|
|
65
79
|
<template>
|
|
66
|
-
<
|
|
67
|
-
<input :id="id" class="absolute inset-0 w-0 h-0 opacity-0" :name="id" type="checkbox" @change="updated"
|
|
80
|
+
<div class="relative flex items-center">
|
|
81
|
+
<input :id="id" class="absolute inset-0 w-0 h-0 opacity-0" :name="name || id" type="checkbox" @change="updated"
|
|
68
82
|
:disabled="props.disabled" :checked="localChecked" />
|
|
69
83
|
<IconCheckmarkSmall v-if="localChecked" strokeColor="white" class="absolute" />
|
|
70
84
|
<span :class="checkboxClasses" />
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
<label class="block" :for="id">
|
|
86
|
+
<slot name="label">
|
|
87
|
+
<span v-if="label"
|
|
88
|
+
:class="['ml-2 text-16px leading-normal font-light select-none', disabled ? 'text-gray-500' : 'text-gray-800']">
|
|
89
|
+
{{ label }}
|
|
90
|
+
</span>
|
|
91
|
+
</slot>
|
|
92
|
+
</label>
|
|
93
|
+
</div>
|
|
78
94
|
</template>
|
package/dist/Checkbox.vue.d.ts
CHANGED
|
@@ -1,39 +1,165 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: {
|
|
2
|
+
new (...args: any[]): {
|
|
3
|
+
$: import("vue").ComponentInternalInstance;
|
|
4
|
+
$data: {};
|
|
5
|
+
$props: Partial<{
|
|
6
|
+
id: string;
|
|
7
|
+
color: 'red' | 'indigo' | 'jade';
|
|
8
|
+
}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
|
+
/**
|
|
10
|
+
* A unique identifier for the checkbox on the whole page.
|
|
11
|
+
* It will be used to give match label with input for a11y.
|
|
12
|
+
*/
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
16
|
+
*/
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Is the checkbox checked when it is first rendered.
|
|
20
|
+
*/
|
|
21
|
+
checked?: boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The color of the background in the checkbox.
|
|
24
|
+
* The checkmark will always be white.
|
|
25
|
+
*/
|
|
26
|
+
color?: "indigo" | "red" | "jade" | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* If the checkbox is disabled, it will not be clickable.
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean | undefined;
|
|
31
|
+
modelValue?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Label for the checkbox.
|
|
34
|
+
* It is very important to set this to make the checkbox accessible.
|
|
35
|
+
*/
|
|
36
|
+
label?: string | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
id: () => string;
|
|
39
|
+
color: string;
|
|
40
|
+
}>>> & {
|
|
41
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
42
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "id" | "color">;
|
|
43
|
+
$attrs: {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
$refs: {
|
|
47
|
+
[x: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
$slots: Readonly<{
|
|
50
|
+
[name: string]: import("vue").Slot | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
53
|
+
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
54
|
+
$emit: (event: "update:modelValue", value: boolean) => void;
|
|
55
|
+
$el: any;
|
|
56
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
57
|
+
/**
|
|
58
|
+
* A unique identifier for the checkbox on the whole page.
|
|
59
|
+
* It will be used to give match label with input for a11y.
|
|
60
|
+
*/
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
64
|
+
*/
|
|
65
|
+
name?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Is the checkbox checked when it is first rendered.
|
|
68
|
+
*/
|
|
69
|
+
checked?: boolean | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The color of the background in the checkbox.
|
|
72
|
+
* The checkmark will always be white.
|
|
73
|
+
*/
|
|
74
|
+
color?: "indigo" | "red" | "jade" | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* If the checkbox is disabled, it will not be clickable.
|
|
77
|
+
*/
|
|
78
|
+
disabled?: boolean | undefined;
|
|
79
|
+
modelValue?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Label for the checkbox.
|
|
82
|
+
* It is very important to set this to make the checkbox accessible.
|
|
83
|
+
*/
|
|
84
|
+
label?: string | undefined;
|
|
85
|
+
}>, {
|
|
86
|
+
id: () => string;
|
|
87
|
+
color: string;
|
|
88
|
+
}>>> & {
|
|
89
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
90
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
91
|
+
"update:modelValue": (value: boolean) => void;
|
|
92
|
+
}, string, {
|
|
93
|
+
id: string;
|
|
94
|
+
color: 'red' | 'indigo' | 'jade';
|
|
95
|
+
}> & {
|
|
96
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
97
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
98
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
99
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
100
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
101
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
102
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
103
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
104
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
105
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
106
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
107
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
108
|
+
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
109
|
+
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
110
|
+
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
|
|
111
|
+
};
|
|
112
|
+
$forceUpdate: () => void;
|
|
113
|
+
$nextTick: typeof import("vue").nextTick;
|
|
114
|
+
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
115
|
+
} & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
116
|
+
/**
|
|
117
|
+
* A unique identifier for the checkbox on the whole page.
|
|
118
|
+
* It will be used to give match label with input for a11y.
|
|
119
|
+
*/
|
|
120
|
+
id?: string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
123
|
+
*/
|
|
124
|
+
name?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Is the checkbox checked when it is first rendered.
|
|
127
|
+
*/
|
|
128
|
+
checked?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The color of the background in the checkbox.
|
|
131
|
+
* The checkmark will always be white.
|
|
132
|
+
*/
|
|
133
|
+
color?: "indigo" | "red" | "jade" | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* If the checkbox is disabled, it will not be clickable.
|
|
136
|
+
*/
|
|
137
|
+
disabled?: boolean | undefined;
|
|
138
|
+
modelValue?: boolean | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Label for the checkbox.
|
|
141
|
+
* It is very important to set this to make the checkbox accessible.
|
|
142
|
+
*/
|
|
143
|
+
label?: string | undefined;
|
|
144
|
+
}>, {
|
|
145
|
+
id: () => string;
|
|
146
|
+
color: string;
|
|
147
|
+
}>>> & {
|
|
148
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
149
|
+
} & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
|
|
150
|
+
__isFragment?: undefined;
|
|
151
|
+
__isTeleport?: undefined;
|
|
152
|
+
__isSuspense?: undefined;
|
|
153
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
154
|
/**
|
|
3
155
|
* A unique identifier for the checkbox on the whole page.
|
|
4
156
|
* It will be used to give match label with input for a11y.
|
|
5
157
|
*/
|
|
6
158
|
id?: string | undefined;
|
|
7
159
|
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
checked?: boolean | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* The color of the background in the checkbox.
|
|
13
|
-
* The checkmark will always be white.
|
|
14
|
-
*/
|
|
15
|
-
color?: "indigo" | "red" | "jade" | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* If the checkbox is disabled, it will not be clickable.
|
|
160
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
18
161
|
*/
|
|
19
|
-
|
|
20
|
-
modelValue?: boolean | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Label for the checkbox.
|
|
23
|
-
* It is very important to set this to make the checkbox accessible.
|
|
24
|
-
*/
|
|
25
|
-
label?: string | undefined;
|
|
26
|
-
}>, {
|
|
27
|
-
id: any;
|
|
28
|
-
color: string;
|
|
29
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
-
"update:modelValue": (value: boolean) => void;
|
|
31
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
32
|
-
/**
|
|
33
|
-
* A unique identifier for the checkbox on the whole page.
|
|
34
|
-
* It will be used to give match label with input for a11y.
|
|
35
|
-
*/
|
|
36
|
-
id?: string | undefined;
|
|
162
|
+
name?: string | undefined;
|
|
37
163
|
/**
|
|
38
164
|
* Is the checkbox checked when it is first rendered.
|
|
39
165
|
*/
|
|
@@ -54,14 +180,20 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
54
180
|
*/
|
|
55
181
|
label?: string | undefined;
|
|
56
182
|
}>, {
|
|
57
|
-
id:
|
|
183
|
+
id: () => string;
|
|
58
184
|
color: string;
|
|
59
185
|
}>>> & {
|
|
60
186
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
61
|
-
}, {
|
|
187
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
188
|
+
"update:modelValue": (value: boolean) => void;
|
|
189
|
+
}, string, {
|
|
62
190
|
id: string;
|
|
63
191
|
color: 'red' | 'indigo' | 'jade';
|
|
64
|
-
}
|
|
192
|
+
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
193
|
+
$slots: {
|
|
194
|
+
label: (_: {}) => any;
|
|
195
|
+
};
|
|
196
|
+
});
|
|
65
197
|
export default _default;
|
|
66
198
|
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
67
199
|
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.vue.d.ts","sourceRoot":"","sources":["../Checkbox.vue.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Checkbox.vue.d.ts","sourceRoot":"","sources":["../Checkbox.vue.ts"],"names":[],"mappings":";;;;;gBAqFS,MAAM;mBAaH,KAAK,GAAG,QAAQ,GAAG,MAAM;;YAjBjC;;;eAGG;;YAEH;;eAEG;;YAEH;;eAEG;;YAEH;;;eAGG;;YAEH;;eAEG;;;YAGH;;;eAGG;;;;;;;;;;;;;;;;;;;;;;YA1BH;;;eAGG;;YAEH;;eAEG;;YAEH;;eAEG;;YAEH;;;eAGG;;YAEH;;eAEG;;;YAGH;;;eAGG;;;;;;;;;;gBAtBE,MAAM;mBAaH,KAAK,GAAG,QAAQ,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;QAjBjC;;;WAGG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;;WAGG;;QAEH;;WAEG;;;QAGH;;;WAGG;;;;;;;;;;;;IA1BH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;;IAGH;;;OAGG;;;;;;;;;;QAtBE,MAAM;WAaH,KAAK,GAAG,QAAQ,GAAG,MAAM;;;;;;AAvFrC,wBAmHK;AACL,aAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,aAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,aAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE3B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;QACzD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,GAAG,CAAC,CAAC,CAAC,CAAC;CACR,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { h as k, defineComponent as p, ref as f, computed as y, openBlock as i, createElementBlock as b, createElementVNode as s, createBlock as C, unref as m, createCommentVNode as h, normalizeClass as g, renderSlot as v, toDisplayString as x } from "vue";
|
|
2
|
+
import * as w from "@cypress-design/icon-registry";
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as S } from "@cypress-design/icon-registry";
|
|
4
|
+
const j = ({
|
|
5
|
+
body: e,
|
|
6
|
+
compiledClasses: t,
|
|
7
|
+
size: o,
|
|
8
|
+
class: l,
|
|
9
|
+
interactiveColorsOnGroup: c,
|
|
10
|
+
...a
|
|
11
|
+
}) => {
|
|
12
|
+
const n = Object.keys(a).reduce((u, d) => (S.includes(d) || (u[d] = a[d]), u), {}), r = {
|
|
13
|
+
width: o,
|
|
14
|
+
height: o,
|
|
15
|
+
fill: "none",
|
|
16
|
+
innerHTML: e,
|
|
17
|
+
...n
|
|
18
|
+
};
|
|
19
|
+
return t.length && (r.class = t.join(" ")), r;
|
|
20
|
+
}, z = (e) => {
|
|
21
|
+
const { sizeWithDefault: t, compiledClasses: o } = w.getComponentAttributes({ ...e, availableSizes: ["16"] }), l = {
|
|
22
|
+
16: '<path d="M5 8.5 7.5 11 11 5" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
23
|
+
}[t];
|
|
24
|
+
if (!l)
|
|
25
|
+
throw Error(`Icon "checkmark-small" is not available in size ${t}`);
|
|
26
|
+
return k("svg", j({
|
|
27
|
+
...e,
|
|
28
|
+
size: t,
|
|
29
|
+
body: l,
|
|
30
|
+
compiledClasses: o
|
|
31
|
+
}));
|
|
32
|
+
}, B = { class: "relative flex items-center" }, O = ["id", "name", "disabled", "checked"], V = ["for"];
|
|
33
|
+
function E() {
|
|
34
|
+
return String(Date.now().toString(32) + Math.random().toString(16)).replace(/\./g, "");
|
|
35
|
+
}
|
|
36
|
+
const D = /* @__PURE__ */ p({
|
|
37
|
+
__name: "Checkbox",
|
|
38
|
+
props: {
|
|
39
|
+
id: { default: () => E() },
|
|
40
|
+
name: null,
|
|
41
|
+
checked: { type: Boolean },
|
|
42
|
+
color: { default: "indigo" },
|
|
43
|
+
disabled: { type: Boolean },
|
|
44
|
+
modelValue: { type: Boolean },
|
|
45
|
+
label: null
|
|
46
|
+
},
|
|
47
|
+
emits: ["update:modelValue"],
|
|
48
|
+
setup(e, { emit: t }) {
|
|
49
|
+
const o = e, l = f(o.modelValue || o.checked);
|
|
50
|
+
function c() {
|
|
51
|
+
l.value = !l.value, t("update:modelValue", l.value);
|
|
52
|
+
}
|
|
53
|
+
const a = y(() => [
|
|
54
|
+
"block border-1 rounded h-16px w-16px",
|
|
55
|
+
o.disabled ? "border-gray-200 bg-gray-100" : l.value ? {
|
|
56
|
+
"border-indigo-500 bg-indigo-400": o.color === "indigo",
|
|
57
|
+
"border-jade-500 bg-jade-400": o.color === "jade",
|
|
58
|
+
"border-red-500 bg-red-400": o.color === "red"
|
|
59
|
+
} : "border-gray-200 bg-white"
|
|
60
|
+
]);
|
|
61
|
+
return (n, r) => (i(), b("div", B, [
|
|
62
|
+
s("input", {
|
|
63
|
+
id: e.id,
|
|
64
|
+
class: "absolute inset-0 w-0 h-0 opacity-0",
|
|
65
|
+
name: e.name || e.id,
|
|
66
|
+
type: "checkbox",
|
|
67
|
+
onChange: c,
|
|
68
|
+
disabled: o.disabled,
|
|
69
|
+
checked: l.value
|
|
70
|
+
}, null, 40, O),
|
|
71
|
+
l.value ? (i(), C(m(z), {
|
|
72
|
+
key: 0,
|
|
73
|
+
strokeColor: "white",
|
|
74
|
+
class: "absolute"
|
|
75
|
+
})) : h("", !0),
|
|
76
|
+
s("span", {
|
|
77
|
+
class: g(m(a))
|
|
78
|
+
}, null, 2),
|
|
79
|
+
s("label", {
|
|
80
|
+
class: "block",
|
|
81
|
+
for: e.id
|
|
82
|
+
}, [
|
|
83
|
+
v(n.$slots, "label", {}, () => [
|
|
84
|
+
e.label ? (i(), b("span", {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: g(["ml-2 text-16px leading-normal font-light select-none", e.disabled ? "text-gray-500" : "text-gray-800"])
|
|
87
|
+
}, x(e.label), 3)) : h("", !0)
|
|
88
|
+
])
|
|
89
|
+
], 8, V)
|
|
90
|
+
]));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
export {
|
|
94
|
+
D as default
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/* <windicss-keep class="block border-1 rounded h-16px w-16px border-gray-200 bg-gray-100 border-indigo-500 bg-indigo-400 border-jade-500 bg-jade-400 border-red-500 bg-red-400 bg-white relative flex items-center absolute inset-0 w-0 h-0 opacity-0 ml-2 text-16px leading-normal font-light select-none text-gray-500 text-gray-800 icon-dark-white"> */
|
|
98
|
+
//# sourceMappingURL=index.es.mjs.map
|