@cypress-design/vue-checkbox 0.1.0 → 0.2.0
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 +11 -0
- package/Checkbox.stories.mdx +75 -0
- package/Checkbox.vue +49 -35
- package/CheckboxVue.cy.tsx +50 -0
- package/dist/Checkbox.vue.d.ts +16 -12
- package/dist/Checkbox.vue.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +119 -33
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +4 -1
- package/tsconfig.build.json +1 -1
- package/vite.config.ts +3 -3
- package/Checkbox.stories.tsx +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @cypress-design/vue-checkbox
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#33](https://github.com/cypress-io/cypress-design/pull/33) [`5f9cf10`](https://github.com/cypress-io/cypress-design/commit/5f9cf10ff4709fcd7d322c2dc5dbc676473b433e) Thanks [@elevatebart](https://github.com/elevatebart)! - fix design and api of checkboxes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5f9cf10`](https://github.com/cypress-io/cypress-design/commit/5f9cf10ff4709fcd7d322c2dc5dbc676473b433e)]:
|
|
12
|
+
- @cypress-design/vue-icon@0.3.0
|
|
13
|
+
|
|
3
14
|
## 0.1.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ArgsTable, Canvas, Meta, Story, Description } from '@storybook/addon-docs'
|
|
2
|
+
import { version } from "./package.json"
|
|
3
|
+
import changelog from "./CHANGELOG.md?raw"
|
|
4
|
+
|
|
5
|
+
import Checkbox from './Checkbox.vue'
|
|
6
|
+
|
|
7
|
+
<h1>Checkbox<span className="text-lg font-normal"> - v{version}</span></h1>
|
|
8
|
+
|
|
9
|
+
<Meta title="Checkbox" component={Checkbox}
|
|
10
|
+
argTypes={{
|
|
11
|
+
color: {
|
|
12
|
+
options: ['indigo', 'red', 'jade'],
|
|
13
|
+
control: {
|
|
14
|
+
type: 'select',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}}
|
|
18
|
+
parameters={{
|
|
19
|
+
design: {
|
|
20
|
+
type: "figma",
|
|
21
|
+
url: 'https://www.figma.com/file/1WJ3GVQyMV5e7xVxPg3yID/Design-System?node-id=1027%3A9825',
|
|
22
|
+
}
|
|
23
|
+
}} />
|
|
24
|
+
|
|
25
|
+
<Canvas withSource="none">
|
|
26
|
+
<Story name="Checkbox">
|
|
27
|
+
{({ color }) => ({
|
|
28
|
+
template: `
|
|
29
|
+
<Checkbox checked label="Checked" :color="color"/>
|
|
30
|
+
<br />
|
|
31
|
+
<Checkbox label="Unchecked" :color="color"/>
|
|
32
|
+
<br />
|
|
33
|
+
<Checkbox chedked disabled label="Disabled & checked" :color="color"/>
|
|
34
|
+
<br />
|
|
35
|
+
<Checkbox disabled label="Disabled & unchecked" :color="color"/>
|
|
36
|
+
`,
|
|
37
|
+
components: { Checkbox },
|
|
38
|
+
data: () => ({
|
|
39
|
+
color
|
|
40
|
+
})
|
|
41
|
+
})}
|
|
42
|
+
</Story>
|
|
43
|
+
</Canvas>
|
|
44
|
+
|
|
45
|
+
<ArgsTable />
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
Install the component
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
yarn add @cypress-design/vue-checkbox
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
In the script, import the component
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import Checkbox from '@cypress-design/vue-checkbox'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
then in the template, use it
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<Checkbox checked label="Checked" color="indigo"/>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
or with the v-model
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<Checkbox v-model="checked" label="Checked" color="indigo"/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<Description>
|
|
74
|
+
{changelog.replace(/^# .+/, '## Changelog')}
|
|
75
|
+
</Description>
|
package/Checkbox.vue
CHANGED
|
@@ -1,48 +1,62 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="relative flex items-center">
|
|
3
|
-
<div class="flex items-center h-5">
|
|
4
|
-
<input :id="id" :checked="modelValue" :aria-describedby="`${id}-description`" :name="id" type="checkbox"
|
|
5
|
-
class="border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500"
|
|
6
|
-
:class="{
|
|
7
|
-
'text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600':
|
|
8
|
-
state === 'default',
|
|
9
|
-
'checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600':
|
|
10
|
-
state === 'success',
|
|
11
|
-
'checked:border-red-300 checked:bg-red-600 checked:text-red-600':
|
|
12
|
-
state === 'danger',
|
|
13
|
-
}" @click="updated()" />
|
|
14
|
-
</div>
|
|
15
|
-
<div class="ml-2 text-16px leading-normal">
|
|
16
|
-
<slot name="label">
|
|
17
|
-
<label v-if="label" :for="id" class="disabled:text-gray-500 text-gray-800 font-light select-none">
|
|
18
|
-
{{ label }}
|
|
19
|
-
</label>
|
|
20
|
-
</slot>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
1
|
<script lang="ts" setup>
|
|
26
|
-
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
import { IconCheckmarkSmall } from '@cypress-design/vue-icon'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type CheckboxColor = 'red' | 'indigo' | 'jade'
|
|
27
7
|
|
|
28
8
|
const props = withDefaults(
|
|
29
9
|
defineProps<{
|
|
30
|
-
id
|
|
31
|
-
modelValue
|
|
32
|
-
|
|
33
|
-
label?: string
|
|
10
|
+
id?: string
|
|
11
|
+
modelValue?: boolean
|
|
12
|
+
color?: CheckboxColor
|
|
13
|
+
label?: string
|
|
14
|
+
disabled?: boolean
|
|
15
|
+
checked?: boolean
|
|
34
16
|
}>(),
|
|
35
17
|
{
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
id: crypto.randomUUID(),
|
|
19
|
+
color: 'indigo',
|
|
38
20
|
}
|
|
39
|
-
)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const localChecked = ref(props.modelValue || props.checked)
|
|
40
24
|
|
|
41
25
|
const emit = defineEmits<{
|
|
42
|
-
(event: 'update:modelValue', value: boolean): void
|
|
43
|
-
}>()
|
|
26
|
+
(event: 'update:modelValue', value: boolean): void
|
|
27
|
+
}>()
|
|
44
28
|
|
|
45
29
|
function updated() {
|
|
46
|
-
|
|
30
|
+
localChecked.value = !localChecked.value
|
|
31
|
+
emit('update:modelValue', localChecked.value)
|
|
47
32
|
}
|
|
33
|
+
|
|
34
|
+
const checkboxClasses = computed(() => [
|
|
35
|
+
'block border-1 rounded h-16px w-16px',
|
|
36
|
+
props.disabled
|
|
37
|
+
? 'border-gray-200 bg-gray-100'
|
|
38
|
+
: localChecked.value
|
|
39
|
+
? {
|
|
40
|
+
'border-indigo-500 bg-indigo-400': props.color === 'indigo',
|
|
41
|
+
'border-jade-500 bg-jade-400': props.color === 'jade',
|
|
42
|
+
'border-red-500 bg-red-400': props.color === 'red',
|
|
43
|
+
}
|
|
44
|
+
: 'border-gray-200 bg-white']
|
|
45
|
+
)
|
|
46
|
+
|
|
48
47
|
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<label class="relative flex items-center">
|
|
51
|
+
<input :id="id" class="absolute inset-0 w-0 h-0 opacity-0" :name="id" type="checkbox" @change="updated"
|
|
52
|
+
:disabled="props.disabled" :checked="localChecked" />
|
|
53
|
+
<IconCheckmarkSmall v-if="localChecked" strokeColor="white" class="absolute" />
|
|
54
|
+
<span :class="checkboxClasses" />
|
|
55
|
+
<slot name="label">
|
|
56
|
+
<span v-if="label"
|
|
57
|
+
:class="['block ml-2 text-16px leading-normal font-light select-none', disabled ? 'text-gray-500' : 'text-gray-800']">
|
|
58
|
+
{{ label }}
|
|
59
|
+
</span>
|
|
60
|
+
</slot>
|
|
61
|
+
</label>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
import { mount } from 'cypress/vue'
|
|
5
|
+
import Checkbox from './Checkbox.vue'
|
|
6
|
+
|
|
7
|
+
describe('<Checkbox />', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
mount(() => {
|
|
10
|
+
return (
|
|
11
|
+
<Checkbox
|
|
12
|
+
label="Welcome guide settings"
|
|
13
|
+
id="welcome-opt-out"
|
|
14
|
+
checked
|
|
15
|
+
class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
cy.get('input[type="checkbox"]').should('be.checked')
|
|
21
|
+
cy.contains('Welcome guide settings').click()
|
|
22
|
+
cy.get('input[type="checkbox"]').should('not.be.checked')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('renders vModel', () => {
|
|
26
|
+
const isChecked = ref(false)
|
|
27
|
+
mount(() => {
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<Checkbox
|
|
31
|
+
label="Welcome guide settings"
|
|
32
|
+
vModel={isChecked.value}
|
|
33
|
+
class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
|
|
34
|
+
/>
|
|
35
|
+
<div
|
|
36
|
+
class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
|
|
37
|
+
data-cy="result"
|
|
38
|
+
>
|
|
39
|
+
isChecked = {isChecked.value.toString()}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
cy.get('[data-cy="result"]').should('contain', 'isChecked = false')
|
|
46
|
+
cy.contains('Welcome guide settings').click()
|
|
47
|
+
cy.get('input[type="checkbox"]').should('be.checked')
|
|
48
|
+
cy.get('[data-cy="result"]').should('contain', 'isChecked = true')
|
|
49
|
+
})
|
|
50
|
+
})
|
package/dist/Checkbox.vue.d.ts
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
-
id
|
|
3
|
-
modelValue
|
|
4
|
-
|
|
2
|
+
id?: string | undefined;
|
|
3
|
+
modelValue?: boolean | undefined;
|
|
4
|
+
color?: ("indigo" | "red" | "jade") | undefined;
|
|
5
5
|
label?: string | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
checked?: boolean | undefined;
|
|
6
8
|
}>, {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
id: string;
|
|
10
|
+
color: string;
|
|
9
11
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
12
|
"update:modelValue": (value: boolean) => void;
|
|
11
13
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
|
-
id
|
|
13
|
-
modelValue
|
|
14
|
-
|
|
14
|
+
id?: string | undefined;
|
|
15
|
+
modelValue?: boolean | undefined;
|
|
16
|
+
color?: ("indigo" | "red" | "jade") | undefined;
|
|
15
17
|
label?: string | undefined;
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
checked?: boolean | undefined;
|
|
16
20
|
}>, {
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
id: string;
|
|
22
|
+
color: string;
|
|
19
23
|
}>>> & {
|
|
20
24
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
21
25
|
}, {
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
id: string;
|
|
27
|
+
color: "indigo" | "red" | "jade";
|
|
24
28
|
}>;
|
|
25
29
|
export default _default;
|
|
26
30
|
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAoGK;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;KAE5B,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"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,47 +1,133 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, toDisplayString
|
|
1
|
+
import { h, defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, createBlock, unref, createCommentVNode, normalizeClass, renderSlot, toDisplayString } from "vue";
|
|
2
|
+
import * as iconsRegistry from "@cypress-design/icon-registry";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
const compileVueIconProperties = (_a) => {
|
|
35
|
+
var _b = _a, {
|
|
36
|
+
body,
|
|
37
|
+
compiledClasses,
|
|
38
|
+
size,
|
|
39
|
+
strokeColor,
|
|
40
|
+
fillColor,
|
|
41
|
+
secondaryStrokeColor,
|
|
42
|
+
secondaryFillColor,
|
|
43
|
+
class: className
|
|
44
|
+
} = _b, attributes = __objRest(_b, [
|
|
45
|
+
"body",
|
|
46
|
+
"compiledClasses",
|
|
47
|
+
"size",
|
|
48
|
+
"strokeColor",
|
|
49
|
+
"fillColor",
|
|
50
|
+
"secondaryStrokeColor",
|
|
51
|
+
"secondaryFillColor",
|
|
52
|
+
"class"
|
|
53
|
+
]);
|
|
54
|
+
const componentProps = __spreadValues({
|
|
55
|
+
width: size,
|
|
56
|
+
height: size,
|
|
57
|
+
fill: "none",
|
|
58
|
+
innerHTML: body
|
|
59
|
+
}, attributes);
|
|
60
|
+
if (compiledClasses.length) {
|
|
61
|
+
componentProps.class = compiledClasses.join(" ");
|
|
62
|
+
}
|
|
63
|
+
return componentProps;
|
|
64
|
+
};
|
|
65
|
+
const IconCheckmarkSmall = (props) => {
|
|
66
|
+
const { sizeWithDefault: size, compiledClasses } = iconsRegistry.getComponentAttributes(__spreadProps(__spreadValues({}, props), { availableSizes: ["16"] }));
|
|
67
|
+
const iconBodies = {
|
|
68
|
+
"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"/>'
|
|
69
|
+
};
|
|
70
|
+
const body = iconBodies[size];
|
|
71
|
+
if (!body) {
|
|
72
|
+
throw Error(`Icon "checkmark-small" is not available in size ${size}`);
|
|
73
|
+
}
|
|
74
|
+
return h("svg", compileVueIconProperties(__spreadProps(__spreadValues({}, props), {
|
|
75
|
+
size,
|
|
76
|
+
body,
|
|
77
|
+
compiledClasses
|
|
78
|
+
})));
|
|
79
|
+
};
|
|
2
80
|
const _hoisted_1 = { class: "relative flex items-center" };
|
|
3
|
-
const _hoisted_2 =
|
|
4
|
-
const _hoisted_3 = ["id", "checked", "aria-describedby", "name"];
|
|
5
|
-
const _hoisted_4 = { class: "ml-2 text-16px leading-normal" };
|
|
6
|
-
const _hoisted_5 = ["for"];
|
|
81
|
+
const _hoisted_2 = ["id", "name", "disabled", "checked"];
|
|
7
82
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
83
|
props: {
|
|
9
|
-
id:
|
|
84
|
+
id: { default: crypto.randomUUID() },
|
|
10
85
|
modelValue: { type: Boolean },
|
|
11
|
-
|
|
12
|
-
label:
|
|
86
|
+
color: { default: "indigo" },
|
|
87
|
+
label: null,
|
|
88
|
+
disabled: { type: Boolean },
|
|
89
|
+
checked: { type: Boolean }
|
|
13
90
|
},
|
|
14
91
|
emits: ["update:modelValue"],
|
|
15
92
|
setup(__props, { emit }) {
|
|
16
93
|
const props = __props;
|
|
94
|
+
const localChecked = ref(props.modelValue || props.checked);
|
|
17
95
|
function updated() {
|
|
18
|
-
|
|
96
|
+
localChecked.value = !localChecked.value;
|
|
97
|
+
emit("update:modelValue", localChecked.value);
|
|
19
98
|
}
|
|
99
|
+
const checkboxClasses = computed(() => [
|
|
100
|
+
"block border-1 rounded h-16px w-16px",
|
|
101
|
+
props.disabled ? "border-gray-200 bg-gray-100" : localChecked.value ? {
|
|
102
|
+
"border-indigo-500 bg-indigo-400": props.color === "indigo",
|
|
103
|
+
"border-jade-500 bg-jade-400": props.color === "jade",
|
|
104
|
+
"border-red-500 bg-red-400": props.color === "red"
|
|
105
|
+
} : "border-gray-200 bg-white"
|
|
106
|
+
]);
|
|
20
107
|
return (_ctx, _cache) => {
|
|
21
|
-
return openBlock(), createElementBlock("
|
|
22
|
-
createElementVNode("
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
])
|
|
108
|
+
return openBlock(), createElementBlock("label", _hoisted_1, [
|
|
109
|
+
createElementVNode("input", {
|
|
110
|
+
id: __props.id,
|
|
111
|
+
class: "absolute inset-0 w-0 h-0 opacity-0",
|
|
112
|
+
name: __props.id,
|
|
113
|
+
type: "checkbox",
|
|
114
|
+
onChange: updated,
|
|
115
|
+
disabled: props.disabled,
|
|
116
|
+
checked: localChecked.value
|
|
117
|
+
}, null, 40, _hoisted_2),
|
|
118
|
+
localChecked.value ? (openBlock(), createBlock(unref(IconCheckmarkSmall), {
|
|
119
|
+
key: 0,
|
|
120
|
+
strokeColor: "white",
|
|
121
|
+
class: "absolute"
|
|
122
|
+
})) : createCommentVNode("", true),
|
|
123
|
+
createElementVNode("span", {
|
|
124
|
+
class: normalizeClass(unref(checkboxClasses))
|
|
125
|
+
}, null, 2),
|
|
126
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
127
|
+
__props.label ? (openBlock(), createElementBlock("span", {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: normalizeClass(["block ml-2 text-16px leading-normal font-light select-none", __props.disabled ? "text-gray-500" : "text-gray-800"])
|
|
130
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
45
131
|
])
|
|
46
132
|
]);
|
|
47
133
|
};
|