@cypress-design/vue-checkbox 0.3.0 → 0.3.1
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/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +108 -0
- package/Checkbox.rootstory.tsx +9 -0
- package/Checkbox.vue +54 -25
- package/CheckboxVue.cy.tsx +43 -4
- package/ReadMe.md +13 -0
- package/dist/Checkbox.vue.d.ts +21 -6
- package/dist/Checkbox.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +116 -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 +10 -5
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +10 -1
- package/Checkbox.stories.mdx +0 -75
- package/dist/index.es.js +0 -102
- package/dist/index.es.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$ yarn build:module && yarn build:types
|
|
2
|
+
$ yarn vite build
|
|
3
|
+
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
|
|
4
|
+
[36mvite v4.2.2 [32mbuilding for production...[36m[39m
|
|
5
|
+
transforming...
|
|
6
|
+
[32m✓[39m 5 modules transformed.
|
|
7
|
+
rendering chunks...
|
|
8
|
+
computing gzip size...
|
|
9
|
+
[2mdist/[22m[36mindex.es.mjs [39m[1m[2m3.71 kB[22m[1m[22m[2m │ gzip: 1.72 kB[22m[2m │ map: 262.14 kB[22m
|
|
10
|
+
[2mdist/[22m[36mindex.umd.js [39m[1m[2m3.39 kB[22m[1m[22m[2m │ gzip: 1.67 kB[22m[2m │ map: 261.92 kB[22m
|
|
11
|
+
[32m✓[39m built in 9.75s
|
|
12
|
+
$ yarn vue-tsc --project ./tsconfig.build.json
|
|
13
|
+
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vue-tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# @cypress-design/vue-checkbox
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`63ea78a`](https://github.com/cypress-io/cypress-design/commit/63ea78af2062fd5e3fb8c61fa4bcf85fd95e803b) Thanks [@elevatebart](https://github.com/elevatebart)! - add constants package to dependencies
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#196](https://github.com/cypress-io/cypress-design/pull/196) [`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: avoid constants relative imports
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0)]:
|
|
18
|
+
- @cypress-design/react-icon@0.20.0
|
|
19
|
+
|
|
20
|
+
## 0.2.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [#178](https://github.com/cypress-io/cypress-design/pull/178) [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650) Thanks [@elevatebart](https://github.com/elevatebart)! - deliver new docs and improved components
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
|
|
29
|
+
- @cypress-design/react-icon@0.19.0
|
|
30
|
+
|
|
31
|
+
## 0.1.1
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [#164](https://github.com/cypress-io/cypress-design/pull/164) [`4fd951a`](https://github.com/cypress-io/cypress-design/commit/4fd951a39335900da2508beef9b3565a6f8f9518) Thanks [@elevatebart](https://github.com/elevatebart)! - fix: update active buttons borders
|
|
36
|
+
|
|
37
|
+
## 0.1.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- [#162](https://github.com/cypress-io/cypress-design/pull/162) [`76d4e60`](https://github.com/cypress-io/cypress-design/commit/76d4e601687d28578cdee0ddc67cd04b286ae2c3) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: functionalize classes used
|
|
42
|
+
|
|
43
|
+
## 0.5.0
|
|
44
|
+
|
|
45
|
+
### Minor Changes
|
|
46
|
+
|
|
47
|
+
- [#151](https://github.com/cypress-io/cypress-design/pull/151) [`8b0e735`](https://github.com/cypress-io/cypress-design/commit/8b0e7356eb64a6b3583d3486dda8ecbb11c34cca) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: use clases compatible with both windi and tailwind
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`106b61a`](https://github.com/cypress-io/cypress-design/commit/106b61a97888f956a4c9d235fde5efb4243e1445), [`7b4f416`](https://github.com/cypress-io/cypress-design/commit/7b4f4162a0d150aa8cab7ec239faebb58c39464d)]:
|
|
52
|
+
- @cypress-design/vue-icon@0.18.0
|
|
53
|
+
|
|
54
|
+
## 0.4.6
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- [#112](https://github.com/cypress-io/cypress-design/pull/112) [`d229b48`](https://github.com/cypress-io/cypress-design/commit/d229b48a3806a882abe83c9ebf9c32ed18d2c47f) Thanks [@elevatebart](https://github.com/elevatebart)! - fix: when label is too big avoid checkbox shrinking
|
|
59
|
+
|
|
60
|
+
## 0.4.5
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- [#105](https://github.com/cypress-io/cypress-design/pull/105) [`2f54f5b`](https://github.com/cypress-io/cypress-design/commit/2f54f5b867b60ba5ce2e40fd38870bd65187ba30) Thanks [@elevatebart](https://github.com/elevatebart)! - checkbox should not contain a div to be added inside an inline only tag (<p>)
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`2f54f5b`](https://github.com/cypress-io/cypress-design/commit/2f54f5b867b60ba5ce2e40fd38870bd65187ba30), [`e82d8cb`](https://github.com/cypress-io/cypress-design/commit/e82d8cb60882a379d89f86d1ff7b8f1d5b56ce66)]:
|
|
67
|
+
- @cypress-design/vue-icon@0.12.0
|
|
68
|
+
|
|
69
|
+
## 0.4.4
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- [#101](https://github.com/cypress-io/cypress-design/pull/101) [`1630e4c`](https://github.com/cypress-io/cypress-design/commit/1630e4c4200944cf6414cee9e92dcce6b4d8a576) Thanks [@mapsandapps](https://github.com/mapsandapps)! - Fix styles for Checkbox
|
|
74
|
+
|
|
75
|
+
## 0.4.3
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- [#71](https://github.com/cypress-io/cypress-design/pull/71) [`379079e`](https://github.com/cypress-io/cypress-design/commit/379079e08802b6c3fae243925e3b9e8881e8ef54) Thanks [@elevatebart](https://github.com/elevatebart)! - allow users to click the checkbox instead of the label
|
|
80
|
+
|
|
81
|
+
## 0.4.2
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- [#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`
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [[`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13)]:
|
|
88
|
+
- @cypress-design/vue-icon@0.5.2
|
|
89
|
+
|
|
90
|
+
## 0.4.1
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- [`2afa4d5`](https://github.com/cypress-io/cypress-design/commit/2afa4d54a2373692f82bee35ae40446bc9bb3f91) Thanks [@elevatebart](https://github.com/elevatebart)! - avoid duplicate ids in checkboxes
|
|
95
|
+
|
|
96
|
+
## 0.4.0
|
|
97
|
+
|
|
98
|
+
### Minor Changes
|
|
99
|
+
|
|
100
|
+
- [#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
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- [#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
|
|
105
|
+
|
|
106
|
+
Source: https://www.a11ymatters.com/pattern/checkbox/
|
|
107
|
+
|
|
108
|
+
- 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)]:
|
|
109
|
+
- @cypress-design/vue-icon@0.5.0
|
|
110
|
+
|
|
3
111
|
## 0.3.0
|
|
4
112
|
|
|
5
113
|
### Minor Changes
|
package/Checkbox.vue
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
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'
|
|
13
|
+
import { CheckboxColors, Classes } from '@cypress-design/constants-checkbox'
|
|
4
14
|
|
|
5
15
|
const props = withDefaults(
|
|
6
16
|
defineProps<{
|
|
@@ -9,6 +19,10 @@ const props = withDefaults(
|
|
|
9
19
|
* It will be used to give match label with input for a11y.
|
|
10
20
|
*/
|
|
11
21
|
id?: string
|
|
22
|
+
/**
|
|
23
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
24
|
+
*/
|
|
25
|
+
name?: string
|
|
12
26
|
/**
|
|
13
27
|
* Is the checkbox checked when it is first rendered.
|
|
14
28
|
*/
|
|
@@ -24,14 +38,13 @@ const props = withDefaults(
|
|
|
24
38
|
disabled?: boolean
|
|
25
39
|
modelValue?: boolean
|
|
26
40
|
/**
|
|
27
|
-
* Label for the checkbox.
|
|
41
|
+
* Label for the checkbox.
|
|
28
42
|
* It is very important to set this to make the checkbox accessible.
|
|
29
43
|
*/
|
|
30
44
|
label?: string
|
|
31
45
|
}>(),
|
|
32
46
|
{
|
|
33
|
-
|
|
34
|
-
id: crypto.randomUUID(),
|
|
47
|
+
id: () => uid(),
|
|
35
48
|
color: 'indigo',
|
|
36
49
|
}
|
|
37
50
|
)
|
|
@@ -39,6 +52,10 @@ const props = withDefaults(
|
|
|
39
52
|
const localChecked = ref(props.modelValue || props.checked)
|
|
40
53
|
|
|
41
54
|
const emit = defineEmits<{
|
|
55
|
+
/**
|
|
56
|
+
* Fired when the checkbox changes value
|
|
57
|
+
* @arg value - The next value of the checkbox
|
|
58
|
+
*/
|
|
42
59
|
(event: 'update:modelValue', value: boolean): void
|
|
43
60
|
}>()
|
|
44
61
|
|
|
@@ -47,32 +64,44 @@ function updated() {
|
|
|
47
64
|
emit('update:modelValue', localChecked.value)
|
|
48
65
|
}
|
|
49
66
|
|
|
50
|
-
const checkboxClasses = computed(() =>
|
|
51
|
-
'block border-1 rounded h-16px w-16px',
|
|
67
|
+
const checkboxClasses = computed(() =>
|
|
52
68
|
props.disabled
|
|
53
|
-
?
|
|
69
|
+
? CheckboxColors.disabled
|
|
54
70
|
: localChecked.value
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'border-jade-500 bg-jade-400': props.color === 'jade',
|
|
58
|
-
'border-red-500 bg-red-400': props.color === 'red',
|
|
59
|
-
}
|
|
60
|
-
: 'border-gray-200 bg-white']
|
|
71
|
+
? CheckboxColors[props.color]
|
|
72
|
+
: CheckboxColors.empty
|
|
61
73
|
)
|
|
62
|
-
|
|
63
74
|
</script>
|
|
64
75
|
|
|
65
76
|
<template>
|
|
66
|
-
<
|
|
67
|
-
<input
|
|
68
|
-
:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
<span class="relative flex items-center">
|
|
78
|
+
<input
|
|
79
|
+
:id="id"
|
|
80
|
+
:class="Classes.hiddenInput"
|
|
81
|
+
:name="name || id"
|
|
82
|
+
type="checkbox"
|
|
83
|
+
@change="updated"
|
|
84
|
+
:disabled="props.disabled"
|
|
85
|
+
:checked="localChecked"
|
|
86
|
+
/>
|
|
87
|
+
<label :class="Classes.labelTag" :for="id">
|
|
88
|
+
<IconCheckmarkSmall
|
|
89
|
+
v-if="localChecked"
|
|
90
|
+
strokeColor="white"
|
|
91
|
+
class="absolute"
|
|
92
|
+
/>
|
|
93
|
+
<span :class="[checkboxClasses, Classes.visibleCheckbox]" />
|
|
94
|
+
<slot name="label">
|
|
95
|
+
<span
|
|
96
|
+
v-if="label"
|
|
97
|
+
:class="[
|
|
98
|
+
Classes.trueLabel,
|
|
99
|
+
disabled ? 'text-gray-500' : 'text-gray-800 dark:text-gray-200',
|
|
100
|
+
]"
|
|
101
|
+
>
|
|
102
|
+
{{ label }}
|
|
103
|
+
</span>
|
|
104
|
+
</slot>
|
|
105
|
+
</label>
|
|
106
|
+
</span>
|
|
78
107
|
</template>
|
package/CheckboxVue.cy.tsx
CHANGED
|
@@ -5,21 +5,60 @@ import { mount } from 'cypress/vue'
|
|
|
5
5
|
import Checkbox from './Checkbox.vue'
|
|
6
6
|
|
|
7
7
|
describe('<Checkbox />', () => {
|
|
8
|
-
it('
|
|
8
|
+
it('changes when the label is clicked', () => {
|
|
9
9
|
mount(() => {
|
|
10
10
|
return (
|
|
11
11
|
<Checkbox
|
|
12
12
|
label="Welcome guide settings"
|
|
13
13
|
id="welcome-opt-out"
|
|
14
14
|
checked
|
|
15
|
-
class="
|
|
15
|
+
class="px-2 py-1 m-2 border border-gray-300 rounded"
|
|
16
16
|
/>
|
|
17
17
|
)
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
cy.get('input[type="checkbox"]').should('be.checked')
|
|
21
|
+
cy.percySnapshot()
|
|
21
22
|
cy.contains('Welcome guide settings').click()
|
|
22
23
|
cy.get('input[type="checkbox"]').should('not.be.checked')
|
|
24
|
+
cy.percySnapshot()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('changes when checkbox is clicked', () => {
|
|
28
|
+
mount(() => {
|
|
29
|
+
return (
|
|
30
|
+
<Checkbox
|
|
31
|
+
label="Welcome guide settings"
|
|
32
|
+
id="welcome-opt-out"
|
|
33
|
+
checked
|
|
34
|
+
class="px-2 py-1 m-2 border border-gray-300 rounded"
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
cy.get('input[type="checkbox"]').should('be.checked')
|
|
40
|
+
cy.get('svg').click()
|
|
41
|
+
cy.get('input[type="checkbox"]').should('not.be.checked')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('keeps its width when label is long', () => {
|
|
45
|
+
mount(() => {
|
|
46
|
+
return (
|
|
47
|
+
<Checkbox
|
|
48
|
+
label={[
|
|
49
|
+
'lorem ipsum dolor sit amet, consectetur adipiscing elit,',
|
|
50
|
+
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
51
|
+
'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip',
|
|
52
|
+
'ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse',
|
|
53
|
+
'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,',
|
|
54
|
+
'sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
55
|
+
].join(' ')}
|
|
56
|
+
id="lorem-checkbox"
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
cy.get('label span:first-child').invoke('outerWidth').should('equal', 16)
|
|
23
62
|
})
|
|
24
63
|
|
|
25
64
|
it('renders vModel', () => {
|
|
@@ -30,10 +69,10 @@ describe('<Checkbox />', () => {
|
|
|
30
69
|
<Checkbox
|
|
31
70
|
label="Welcome guide settings"
|
|
32
71
|
vModel={isChecked.value}
|
|
33
|
-
class="
|
|
72
|
+
class="px-2 py-1 m-2 border border-gray-300 rounded"
|
|
34
73
|
/>
|
|
35
74
|
<div
|
|
36
|
-
class="
|
|
75
|
+
class="px-2 py-1 m-2 border border-gray-300 rounded"
|
|
37
76
|
data-cy="result"
|
|
38
77
|
>
|
|
39
78
|
isChecked = {isChecked.value.toString()}
|
package/ReadMe.md
ADDED
package/dist/Checkbox.vue.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
2
|
/**
|
|
3
3
|
* A unique identifier for the checkbox on the whole page.
|
|
4
4
|
* It will be used to give match label with input for a11y.
|
|
5
5
|
*/
|
|
6
6
|
id?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
9
|
+
*/
|
|
10
|
+
name?: string | undefined;
|
|
7
11
|
/**
|
|
8
12
|
* Is the checkbox checked when it is first rendered.
|
|
9
13
|
*/
|
|
@@ -24,7 +28,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
24
28
|
*/
|
|
25
29
|
label?: string | undefined;
|
|
26
30
|
}>, {
|
|
27
|
-
id:
|
|
31
|
+
id: () => string;
|
|
28
32
|
color: string;
|
|
29
33
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
34
|
"update:modelValue": (value: boolean) => void;
|
|
@@ -34,6 +38,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
34
38
|
* It will be used to give match label with input for a11y.
|
|
35
39
|
*/
|
|
36
40
|
id?: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Name attribute of the <input type="checkbox"/>.
|
|
43
|
+
*/
|
|
44
|
+
name?: string | undefined;
|
|
37
45
|
/**
|
|
38
46
|
* Is the checkbox checked when it is first rendered.
|
|
39
47
|
*/
|
|
@@ -54,17 +62,19 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
54
62
|
*/
|
|
55
63
|
label?: string | undefined;
|
|
56
64
|
}>, {
|
|
57
|
-
id:
|
|
65
|
+
id: () => string;
|
|
58
66
|
color: string;
|
|
59
67
|
}>>> & {
|
|
60
68
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
61
69
|
}, {
|
|
62
70
|
id: string;
|
|
63
71
|
color: 'red' | 'indigo' | 'jade';
|
|
72
|
+
}>, {
|
|
73
|
+
label: (_: {}) => any;
|
|
64
74
|
}>;
|
|
65
75
|
export default _default;
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
77
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
68
78
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
69
79
|
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
70
80
|
} : {
|
|
@@ -72,9 +82,14 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
72
82
|
required: true;
|
|
73
83
|
};
|
|
74
84
|
};
|
|
75
|
-
|
|
85
|
+
type __VLS_WithDefaults<P, D> = {
|
|
76
86
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
77
87
|
default: D[K];
|
|
78
88
|
} : P[K];
|
|
79
89
|
};
|
|
90
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
91
|
+
new (): {
|
|
92
|
+
$slots: S;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
80
95
|
//# sourceMappingURL=Checkbox.vue.d.ts.map
|
|
@@ -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":";IA+EI;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;;IAGH;;;OAGG;;;;;;;;IA1BH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;;IAGH;;;OAGG;;;;;;;;QAtBE,MAAM;WAaH,KAAK,GAAG,QAAQ,GAAG,MAAM;;sBA8GP,GAAG;;AAlMjC,wBAqNc;AACd,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,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,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,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;AAWN,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { h as f, defineComponent as x, ref as C, computed as y, openBlock as u, createElementBlock as g, createElementVNode as b, normalizeClass as i, unref as a, createBlock as v, createCommentVNode as k, renderSlot as w, toDisplayString as B } from "vue";
|
|
2
|
+
import * as S from "@cypress-design/icon-registry";
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as j } from "@cypress-design/icon-registry";
|
|
4
|
+
const z = ({
|
|
5
|
+
body: e,
|
|
6
|
+
compiledClasses: o,
|
|
7
|
+
size: l,
|
|
8
|
+
class: t,
|
|
9
|
+
interactiveColorsOnGroup: h,
|
|
10
|
+
...n
|
|
11
|
+
}) => {
|
|
12
|
+
const d = Object.keys(n).reduce(
|
|
13
|
+
(p, s) => (!j.includes(s) && s !== "name" && (p[s] = n[s]), p),
|
|
14
|
+
{}
|
|
15
|
+
), c = {
|
|
16
|
+
width: l,
|
|
17
|
+
height: l,
|
|
18
|
+
viewBox: `0 0 ${l} ${l}`,
|
|
19
|
+
fill: "none",
|
|
20
|
+
innerHTML: e,
|
|
21
|
+
...d
|
|
22
|
+
// add all standard attributes back to the svg tag
|
|
23
|
+
};
|
|
24
|
+
return o.length && (c.class = o.join(" ")), c;
|
|
25
|
+
}, O = (e) => {
|
|
26
|
+
const { sizeWithDefault: o, compiledClasses: l } = S.getComponentAttributes({ ...e, availableSizes: ["16"] }), t = {
|
|
27
|
+
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8.5 7.5 11 11 5" class="icon-dark"/>'
|
|
28
|
+
}[o];
|
|
29
|
+
if (!t)
|
|
30
|
+
throw Error(`Icon "checkmark-small" is not available in size ${o}`);
|
|
31
|
+
return f("svg", z({
|
|
32
|
+
...e,
|
|
33
|
+
size: o,
|
|
34
|
+
body: t,
|
|
35
|
+
compiledClasses: l
|
|
36
|
+
}));
|
|
37
|
+
}, r = {
|
|
38
|
+
wrapper: "relative flex items-center",
|
|
39
|
+
hiddenInput: "absolute inset-0 w-0 h-0 opacity-0",
|
|
40
|
+
labelTag: "flex items-center",
|
|
41
|
+
visibleCheckbox: "border border-solid rounded h-[16px] w-[16px] flex flex-shrink-0 items-center text-white",
|
|
42
|
+
trueLabel: "block ml-[8px] text-[16px] leading-[24px] font-light select-none"
|
|
43
|
+
}, m = {
|
|
44
|
+
indigo: "border-indigo-500 bg-indigo-400",
|
|
45
|
+
jade: "border-jade-500 bg-jade-400",
|
|
46
|
+
red: "border-red-500 bg-red-400",
|
|
47
|
+
disabled: "border-gray-200 bg-gray-100",
|
|
48
|
+
empty: "border-gray-200 bg-white"
|
|
49
|
+
}, V = { class: "relative flex items-center" }, E = ["id", "name", "disabled", "checked"], I = ["for"];
|
|
50
|
+
function L() {
|
|
51
|
+
return String(Date.now().toString(32) + Math.random().toString(16)).replace(
|
|
52
|
+
/\./g,
|
|
53
|
+
""
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const $ = /* @__PURE__ */ x({
|
|
57
|
+
__name: "Checkbox",
|
|
58
|
+
props: {
|
|
59
|
+
id: { default: () => L() },
|
|
60
|
+
name: null,
|
|
61
|
+
checked: { type: Boolean },
|
|
62
|
+
color: { default: "indigo" },
|
|
63
|
+
disabled: { type: Boolean },
|
|
64
|
+
modelValue: { type: Boolean },
|
|
65
|
+
label: null
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:modelValue"],
|
|
68
|
+
setup(e, { emit: o }) {
|
|
69
|
+
const l = e, t = C(l.modelValue || l.checked);
|
|
70
|
+
function h() {
|
|
71
|
+
t.value = !t.value, o("update:modelValue", t.value);
|
|
72
|
+
}
|
|
73
|
+
const n = y(
|
|
74
|
+
() => l.disabled ? m.disabled : t.value ? m[l.color] : m.empty
|
|
75
|
+
);
|
|
76
|
+
return (d, c) => (u(), g("span", V, [
|
|
77
|
+
b("input", {
|
|
78
|
+
id: e.id,
|
|
79
|
+
class: i(a(r).hiddenInput),
|
|
80
|
+
name: e.name || e.id,
|
|
81
|
+
type: "checkbox",
|
|
82
|
+
onChange: h,
|
|
83
|
+
disabled: l.disabled,
|
|
84
|
+
checked: t.value
|
|
85
|
+
}, null, 42, E),
|
|
86
|
+
b("label", {
|
|
87
|
+
class: i(a(r).labelTag),
|
|
88
|
+
for: e.id
|
|
89
|
+
}, [
|
|
90
|
+
t.value ? (u(), v(a(O), {
|
|
91
|
+
key: 0,
|
|
92
|
+
strokeColor: "white",
|
|
93
|
+
class: "absolute"
|
|
94
|
+
})) : k("", !0),
|
|
95
|
+
b("span", {
|
|
96
|
+
class: i([a(n), a(r).visibleCheckbox])
|
|
97
|
+
}, null, 2),
|
|
98
|
+
w(d.$slots, "label", {}, () => [
|
|
99
|
+
e.label ? (u(), g("span", {
|
|
100
|
+
key: 0,
|
|
101
|
+
class: i([
|
|
102
|
+
a(r).trueLabel,
|
|
103
|
+
e.disabled ? "text-gray-500" : "text-gray-800 dark:text-gray-200"
|
|
104
|
+
])
|
|
105
|
+
}, B(e.label), 3)) : k("", !0)
|
|
106
|
+
])
|
|
107
|
+
], 10, I)
|
|
108
|
+
]));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
export {
|
|
112
|
+
$ as default
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=index.es.mjs.map
|
|
115
|
+
|
|
116
|
+
/* <windicss-keep class="relative flex items-center absolute text-gray-500 text-gray-800 dark:text-gray-200 icon-dark-white"> */
|