@cypress-design/vue-checkbox 0.5.0 → 1.1.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.
@@ -0,0 +1,9 @@
1
+ The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
2
+ vite v5.4.19 building for production...
3
+ transforming...
4
+ ✓ 4 modules transformed.
5
+ rendering chunks...
6
+ computing gzip size...
7
+ dist/index.es.mjs 3.35 kB │ gzip: 1.43 kB │ map: 6.32 kB
8
+ dist/index.umd.js 2.85 kB │ gzip: 1.32 kB │ map: 6.18 kB
9
+ ✓ built in 2.13s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,94 @@
1
1
  # @cypress-design/vue-checkbox
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#733](https://github.com/cypress-io/cypress-design/pull/733) [`5e916fb`](https://github.com/cypress-io/cypress-design/commit/5e916fbe2b83d1503ed80820a85a8705bdcaeef1) Thanks [@jennifer-shehane](https://github.com/jennifer-shehane)! - Depend on `@cypress-design/vue-icon` and `@cypress-design/react-icon` 3.x. These packages were last published against icon 1.x, so installs stayed on 1.x and missed the 3.x fixes, including tree-shakable named icon imports. None of the icons these components use were renamed or removed in 2.0 or 3.0, so there are no API changes. `@cypress-design/vue-modal` now also lists `@cypress-design/vue-icon` as a dependency instead of a devDependency, since its build imports it at runtime.
8
+
9
+ ## 1.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87) Thanks [@elevatebart](https://github.com/elevatebart)! - Create 1.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87)]:
18
+ - @cypress-design/constants-checkbox@1.0.0
19
+ - @cypress-design/vue-icon@1.0.0
20
+
21
+ ## 0.5.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [#272](https://github.com/cypress-io/cypress-design/pull/272) [`9a3e358`](https://github.com/cypress-io/cypress-design/commit/9a3e3582b8ca2dfdadd9198054042c9f0083be01) Thanks [@elevatebart](https://github.com/elevatebart)! - remove dark mode implementation to avoid wrong side effects
26
+
27
+ ## 0.4.0
28
+
29
+ ### Minor Changes
30
+
31
+ - [#258](https://github.com/cypress-io/cypress-design/pull/258) [`aac2e95`](https://github.com/cypress-io/cypress-design/commit/aac2e95c78a7dc41673101def2f7d185bc6e6d0e) Thanks [@elevatebart](https://github.com/elevatebart)! - handle array v-model with more than one checkboxes
32
+ - add the 'change' event to reflect the input checkbox's change event
33
+
34
+ ## 0.3.3
35
+
36
+ ### Patch Changes
37
+
38
+ - [#245](https://github.com/cypress-io/cypress-design/pull/245) [`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171) Thanks [@elevatebart](https://github.com/elevatebart)! - use tailwind to rollup classes in the final package
39
+
40
+ - Updated dependencies [[`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171)]:
41
+ - @cypress-design/vue-icon@0.23.1
42
+
43
+ ## 0.3.2
44
+
45
+ ### Patch Changes
46
+
47
+ - [`08ba16d`](https://github.com/cypress-io/cypress-design/commit/08ba16da4a8663676ee96ac4950938857bd0d9a3) Thanks [@elevatebart](https://github.com/elevatebart)! - fix wind-keep plugin
48
+
49
+ - Updated dependencies [[`08ba16d`](https://github.com/cypress-io/cypress-design/commit/08ba16da4a8663676ee96ac4950938857bd0d9a3)]:
50
+ - @cypress-design/vue-icon@0.22.1
51
+
52
+ ## 0.3.1
53
+
54
+ ### Patch Changes
55
+
56
+ - [`63ea78a`](https://github.com/cypress-io/cypress-design/commit/63ea78af2062fd5e3fb8c61fa4bcf85fd95e803b) Thanks [@elevatebart](https://github.com/elevatebart)! - add constants package to dependencies
57
+
58
+ ## 0.3.0
59
+
60
+ ### Minor Changes
61
+
62
+ - [#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
63
+
64
+ ### Patch Changes
65
+
66
+ - Updated dependencies [[`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0)]:
67
+ - @cypress-design/react-icon@0.20.0
68
+
69
+ ## 0.2.0
70
+
71
+ ### Minor Changes
72
+
73
+ - [#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
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
78
+ - @cypress-design/react-icon@0.19.0
79
+
80
+ ## 0.1.1
81
+
82
+ ### Patch Changes
83
+
84
+ - [#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
85
+
86
+ ## 0.1.0
87
+
88
+ ### Minor Changes
89
+
90
+ - [#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
91
+
3
92
  ## 0.5.0
4
93
 
5
94
  ### Minor Changes
package/Checkbox.vue CHANGED
@@ -2,7 +2,7 @@
2
2
  function uid() {
3
3
  return String(Date.now().toString(32) + Math.random().toString(16)).replace(
4
4
  /\./g,
5
- ''
5
+ '',
6
6
  )
7
7
  }
8
8
  </script>
@@ -10,6 +10,10 @@ function uid() {
10
10
  <script lang="ts" setup>
11
11
  import { ref, computed } from 'vue'
12
12
  import { IconCheckmarkSmall } from '@cypress-design/vue-icon'
13
+ import {
14
+ CssCheckboxColors,
15
+ CssClasses,
16
+ } from '@cypress-design/constants-checkbox'
13
17
 
14
18
  const props = withDefaults(
15
19
  defineProps<{
@@ -35,69 +39,107 @@ const props = withDefaults(
35
39
  * If the checkbox is disabled, it will not be clickable.
36
40
  */
37
41
  disabled?: boolean
38
- modelValue?: boolean
42
+ modelValue?: boolean | Array<string>
39
43
  /**
40
44
  * Label for the checkbox.
41
45
  * It is very important to set this to make the checkbox accessible.
42
46
  */
43
47
  label?: string
48
+ /**
49
+ * Forwarded to the underlying `<input type="checkbox">`. Use `-1`
50
+ * when the checkbox is a decorative affordance inside a wider
51
+ * interactive row (e.g. Select's checkbox-row) — the wrapping row
52
+ * carries the interactive role and keyboard nav, and the input
53
+ * must not be independently focusable to satisfy axe's
54
+ * `nested-interactive` rule.
55
+ */
56
+ inputTabIndex?: number
57
+ /**
58
+ * When true, the real `<input>` is removed from the accessibility
59
+ * tree and the layout with `display: none`. Use inside a wider
60
+ * interactive row (e.g. Select's checkbox-row) where the row itself
61
+ * is the option — axe's `nested-interactive` rule flags a focusable
62
+ * input inside a clickable row even when the input carries
63
+ * `aria-hidden` / `tabindex="-1"`; `display: none` is the one form
64
+ * axe accepts.
65
+ */
66
+ hideInput?: boolean
44
67
  }>(),
45
68
  {
46
69
  id: () => uid(),
47
70
  color: 'indigo',
48
- }
71
+ hideInput: false,
72
+ },
49
73
  )
50
74
 
51
- const localChecked = ref(props.modelValue || props.checked)
75
+ const localChecked = ref(
76
+ (Array.isArray(props.modelValue)
77
+ ? props.name
78
+ ? props.modelValue.includes(props.name)
79
+ : false
80
+ : props.modelValue) || props.checked,
81
+ )
52
82
 
53
83
  const emit = defineEmits<{
54
- (event: 'update:modelValue', value: boolean): void
84
+ 'update:modelValue': [value: boolean | Array<string>]
85
+ change: [value: boolean]
55
86
  }>()
56
87
 
57
88
  function updated() {
58
89
  localChecked.value = !localChecked.value
59
- emit('update:modelValue', localChecked.value)
90
+ if (Array.isArray(props.modelValue)) {
91
+ const arrayModelValue = [...props.modelValue]
92
+ if (!props.name) {
93
+ return
94
+ }
95
+ const index = arrayModelValue.indexOf(props.name)
96
+ if (index === -1) {
97
+ arrayModelValue.push(props.name)
98
+ } else {
99
+ arrayModelValue.splice(index, 1)
100
+ }
101
+ emit('update:modelValue', arrayModelValue)
102
+ } else {
103
+ emit('update:modelValue', localChecked.value)
104
+ }
105
+ emit('change', localChecked.value)
60
106
  }
61
107
 
62
- const checkboxClasses = computed(() => [
108
+ const checkboxClasses = computed(() =>
63
109
  props.disabled
64
- ? 'border-gray-200 bg-gray-100'
110
+ ? CssCheckboxColors.disabled
65
111
  : localChecked.value
66
- ? {
67
- 'border-indigo-500 bg-indigo-400': props.color === 'indigo',
68
- 'border-jade-500 bg-jade-400': props.color === 'jade',
69
- 'border-red-500 bg-red-400': props.color === 'red',
70
- }
71
- : 'border-gray-200 bg-white',
72
- ])
112
+ ? CssCheckboxColors[props.color]
113
+ : CssCheckboxColors.empty,
114
+ )
73
115
  </script>
74
116
 
75
117
  <template>
76
- <span class="block relative flex items-center">
118
+ <span class="relative flex items-center">
77
119
  <input
78
120
  :id="id"
79
- class="absolute inset-0 w-0 h-0 opacity-0"
121
+ :class="CssClasses.hiddenInput"
80
122
  :name="name || id"
81
123
  type="checkbox"
82
- @change="updated"
83
124
  :disabled="props.disabled"
84
125
  :checked="localChecked"
126
+ :tabindex="inputTabIndex"
127
+ :aria-hidden="hideInput || undefined"
128
+ :style="hideInput ? { display: 'none' } : undefined"
129
+ @change="updated"
85
130
  />
86
- <label className="flex items-center" :for="id">
131
+ <label :class="CssClasses.labelTag" :for="id">
87
132
  <IconCheckmarkSmall
88
133
  v-if="localChecked"
89
134
  strokeColor="white"
90
135
  class="absolute"
91
136
  />
92
- <span
93
- :class="checkboxClasses"
94
- class="block border border-solid rounded h-[16px] w-[16px] flex-shrink-0"
95
- />
137
+ <span :class="[checkboxClasses, CssClasses.visibleCheckbox]" />
96
138
  <slot name="label">
97
139
  <span
98
140
  v-if="label"
99
141
  :class="[
100
- 'ml-[8px] text-[16px] leading-[24px] font-light select-none',
142
+ CssClasses.trueLabel,
101
143
  disabled ? 'text-gray-500' : 'text-gray-800',
102
144
  ]"
103
145
  >
@@ -12,7 +12,7 @@ describe('<Checkbox />', () => {
12
12
  label="Welcome guide settings"
13
13
  id="welcome-opt-out"
14
14
  checked
15
- class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
15
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
16
16
  />
17
17
  )
18
18
  })
@@ -31,7 +31,7 @@ describe('<Checkbox />', () => {
31
31
  label="Welcome guide settings"
32
32
  id="welcome-opt-out"
33
33
  checked
34
- class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
34
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
35
35
  />
36
36
  )
37
37
  })
@@ -45,7 +45,14 @@ describe('<Checkbox />', () => {
45
45
  mount(() => {
46
46
  return (
47
47
  <Checkbox
48
- label="lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
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(' ')}
49
56
  id="lorem-checkbox"
50
57
  />
51
58
  )
@@ -61,11 +68,11 @@ describe('<Checkbox />', () => {
61
68
  <div>
62
69
  <Checkbox
63
70
  label="Welcome guide settings"
64
- vModel={isChecked.value}
65
- class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
71
+ v-model={isChecked.value}
72
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
66
73
  />
67
74
  <div
68
- class="m-2 px-2 py-1 border-1 border-gray-300 rounded"
75
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
69
76
  data-cy="result"
70
77
  >
71
78
  isChecked = {isChecked.value.toString()}
@@ -79,4 +86,50 @@ describe('<Checkbox />', () => {
79
86
  cy.get('input[type="checkbox"]').should('be.checked')
80
87
  cy.get('[data-cy="result"]').should('contain', 'isChecked = true')
81
88
  })
89
+
90
+ it("renders vModel when it's an array", () => {
91
+ const checkedValues = ref([])
92
+ mount(() => {
93
+ return (
94
+ <div>
95
+ <Checkbox
96
+ name="first-checkbox"
97
+ label="First checkbox"
98
+ v-model={checkedValues.value}
99
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
100
+ />
101
+ <Checkbox
102
+ name="second-checkbox"
103
+ label="Second checkbox"
104
+ v-model={checkedValues.value}
105
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
106
+ />
107
+ <Checkbox
108
+ name="third-checkbox"
109
+ label="Third checkbox"
110
+ v-model={checkedValues.value}
111
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
112
+ />
113
+ <div
114
+ class="px-2 py-1 m-2 border border-gray-300 rounded"
115
+ data-cy="result"
116
+ >
117
+ {JSON.stringify(checkedValues.value)}
118
+ </div>
119
+ </div>
120
+ )
121
+ })
122
+
123
+ cy.get('[data-cy="result"]').should('contain', '[]')
124
+ cy.contains('First checkbox').click()
125
+ cy.get('input[type="checkbox"]').should('be.checked')
126
+ cy.get('[data-cy="result"]').should('contain', '["first-checkbox"]')
127
+ cy.contains('Second checkbox').click()
128
+ cy.get('[data-cy="result"]').should(
129
+ 'contain',
130
+ '["first-checkbox","second-checkbox"]',
131
+ )
132
+ cy.contains('Second checkbox').click()
133
+ cy.get('[data-cy="result"]').should('contain', '["first-checkbox"]')
134
+ })
82
135
  })
package/ReadMe.md ADDED
@@ -0,0 +1,19 @@
1
+ # Checkbox
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install @cypress-design/vue-checkbox
7
+ ```
8
+
9
+ or with yarn
10
+
11
+ ```bash
12
+ yarn add @cypress-design/vue-checkbox
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import Checkbox from '@cypress-design/vue-checkbox'
19
+ ```
@@ -1,156 +1,4 @@
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<{
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
154
2
  /**
155
3
  * A unique identifier for the checkbox on the whole page.
156
4
  * It will be used to give match label with input for a11y.
@@ -173,30 +21,117 @@ declare const _default: {
173
21
  * If the checkbox is disabled, it will not be clickable.
174
22
  */
175
23
  disabled?: boolean | undefined;
176
- modelValue?: boolean | undefined;
24
+ modelValue?: boolean | string[] | undefined;
177
25
  /**
178
26
  * Label for the checkbox.
179
27
  * It is very important to set this to make the checkbox accessible.
180
28
  */
181
29
  label?: string | undefined;
30
+ /**
31
+ * Forwarded to the underlying `<input type="checkbox">`. Use `-1`
32
+ * when the checkbox is a decorative affordance inside a wider
33
+ * interactive row (e.g. Select's checkbox-row) — the wrapping row
34
+ * carries the interactive role and keyboard nav, and the input
35
+ * must not be independently focusable to satisfy axe's
36
+ * `nested-interactive` rule.
37
+ */
38
+ inputTabIndex?: number | undefined;
39
+ /**
40
+ * When true, the real `<input>` is removed from the accessibility
41
+ * tree and the layout with `display: none`. Use inside a wider
42
+ * interactive row (e.g. Select's checkbox-row) where the row itself
43
+ * is the option — axe's `nested-interactive` rule flags a focusable
44
+ * input inside a clickable row even when the input carries
45
+ * `aria-hidden` / `tabindex="-1"`; `display: none` is the one form
46
+ * axe accepts.
47
+ */
48
+ hideInput?: boolean | undefined;
182
49
  }>, {
183
50
  id: () => string;
184
51
  color: string;
52
+ hideInput: boolean;
53
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
54
+ "update:modelValue": (value: boolean | string[]) => void;
55
+ change: (value: boolean) => void;
56
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
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 | string[] | 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
+ * Forwarded to the underlying `<input type="checkbox">`. Use `-1`
87
+ * when the checkbox is a decorative affordance inside a wider
88
+ * interactive row (e.g. Select's checkbox-row) — the wrapping row
89
+ * carries the interactive role and keyboard nav, and the input
90
+ * must not be independently focusable to satisfy axe's
91
+ * `nested-interactive` rule.
92
+ */
93
+ inputTabIndex?: number | undefined;
94
+ /**
95
+ * When true, the real `<input>` is removed from the accessibility
96
+ * tree and the layout with `display: none`. Use inside a wider
97
+ * interactive row (e.g. Select's checkbox-row) where the row itself
98
+ * is the option — axe's `nested-interactive` rule flags a focusable
99
+ * input inside a clickable row even when the input carries
100
+ * `aria-hidden` / `tabindex="-1"`; `display: none` is the one form
101
+ * axe accepts.
102
+ */
103
+ hideInput?: boolean | undefined;
104
+ }>, {
105
+ id: () => string;
106
+ color: string;
107
+ hideInput: boolean;
185
108
  }>>> & {
186
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
187
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
188
- "update:modelValue": (value: boolean) => void;
189
- }, string, {
109
+ "onUpdate:modelValue"?: ((value: boolean | string[]) => any) | undefined;
110
+ onChange?: ((value: boolean) => any) | undefined;
111
+ }, {
190
112
  id: string;
191
113
  color: 'red' | 'indigo' | 'jade';
192
- }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
193
- $slots: {
194
- label: (_: {}) => any;
195
- };
196
- });
114
+ hideInput: boolean;
115
+ }, {}>, {
116
+ label?(_: {}): any;
117
+ }>;
197
118
  export default _default;
198
- declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
199
- declare type __VLS_TypePropsToRuntimeProps<T> = {
119
+
120
+ type __VLS_WithDefaults<P, D> = {
121
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
122
+ default: D[K];
123
+ }> : P[K];
124
+ };
125
+ type __VLS_Prettify<T> = {
126
+ [K in keyof T]: T[K];
127
+ } & {};
128
+ type __VLS_WithTemplateSlots<T, S> = T & {
129
+ new (): {
130
+ $slots: S;
131
+ };
132
+ };
133
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
134
+ type __VLS_TypePropsToOption<T> = {
200
135
  [K in keyof T]-?: {} extends Pick<T, K> ? {
201
136
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
202
137
  } : {
@@ -204,9 +139,4 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
204
139
  required: true;
205
140
  };
206
141
  };
207
- declare type __VLS_WithDefaults<P, D> = {
208
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
209
- default: D[K];
210
- } : P[K];
211
- };
212
142
  //# sourceMappingURL=Checkbox.vue.d.ts.map