@fiscozen/checkbox 0.1.6 → 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.
Files changed (44) hide show
  1. package/.eslintrc.cjs +19 -0
  2. package/.prettierrc.js +6 -0
  3. package/README.md +514 -0
  4. package/coverage/clover.xml +789 -215
  5. package/coverage/coverage-final.json +6 -6
  6. package/coverage/index.html +32 -32
  7. package/coverage/src/FzCheckbox.vue.html +1099 -151
  8. package/coverage/src/FzCheckboxGroup.vue.html +444 -81
  9. package/coverage/src/common.ts.html +79 -19
  10. package/coverage/src/components/ErrorAlert.vue.html +268 -0
  11. package/coverage/src/components/FzCheckboxGroupOption.vue.html +343 -70
  12. package/coverage/src/components/index.html +22 -22
  13. package/coverage/src/index.html +45 -45
  14. package/coverage/src/utils.ts.html +265 -0
  15. package/package.json +13 -11
  16. package/src/FzCheckbox.vue +411 -95
  17. package/src/FzCheckboxGroup.vue +179 -58
  18. package/src/__test__/FzCheckbox.test.ts +91 -19
  19. package/src/__test__/FzCheckboxGroup.test.ts +167 -4
  20. package/src/common.ts +20 -0
  21. package/src/components/ErrorAlert.vue +61 -0
  22. package/src/components/FzCheckboxGroupOption.vue +137 -46
  23. package/src/index.ts +1 -0
  24. package/src/types.ts +166 -23
  25. package/src/utils.ts +60 -0
  26. package/tsconfig.json +1 -1
  27. package/coverage/.tmp/coverage-0.json +0 -1
  28. package/coverage/.tmp/coverage-1.json +0 -1
  29. package/coverage/src/components/FzCheckboxErrorText.vue.html +0 -145
  30. package/coverage/src/types.ts.html +0 -310
  31. package/dist/checkbox.js +0 -301
  32. package/dist/checkbox.umd.cjs +0 -1
  33. package/dist/index.d.ts +0 -1
  34. package/dist/src/FzCheckbox.vue.d.ts +0 -95
  35. package/dist/src/FzCheckboxGroup.vue.d.ts +0 -70
  36. package/dist/src/__test__/FzCheckbox.test.d.ts +0 -1
  37. package/dist/src/__test__/FzCheckboxGroup.test.d.ts +0 -1
  38. package/dist/src/common.d.ts +0 -4
  39. package/dist/src/components/FzCheckboxErrorText.vue.d.ts +0 -24
  40. package/dist/src/components/FzCheckboxGroupOption.vue.d.ts +0 -82
  41. package/dist/src/index.d.ts +0 -3
  42. package/dist/src/types.d.ts +0 -76
  43. package/dist/style.css +0 -1
  44. package/src/components/FzCheckboxErrorText.vue +0 -20
@@ -1,68 +1,145 @@
1
- <template>
2
- <div class="flex justify-center flex-col w-fit">
3
- <input
4
- type="checkbox"
5
- :id="id"
6
- :disabled="disabled"
7
- :checked="checked"
8
- :class="staticInputClass"
9
- :required="required"
10
- :value="value"
11
- @change="emit('change', $event)"
12
- v-model="model"
13
- :indeterminate="indeterminate"
14
- ref="refCheckbox"
15
- />
16
- <label :for="id" :class="[staticLabelClass, computedLabelClass]">
17
- <FzIcon
18
- :name="computedName"
19
- :size="size"
20
- :class="[staticIconClass, computedIconClasses]"
21
- :variant="computedVariant"
22
- />
23
- {{ standalone ? "" : label }}
24
- </label>
25
- <FzRadioErrorText :size="size" v-if="error && $slots.error">
26
- <slot name="error" />
27
- </FzRadioErrorText>
28
- <slot name="children" />
29
- </div>
30
- </template>
31
-
32
1
  <script setup lang="ts">
33
- import { computed, onMounted, ref } from "vue";
2
+ /**
3
+ * FzCheckbox Component
4
+ *
5
+ * A fully accessible checkbox component with support for single selection (boolean),
6
+ * multi-selection (array), indeterminate states, and hierarchical relationships.
7
+ *
8
+ * @component
9
+ * @example
10
+ * // Single checkbox (boolean)
11
+ * <FzCheckbox v-model="accepted" label="I accept terms" />
12
+ *
13
+ * @example
14
+ * // Multi-select checkbox (array)
15
+ * <FzCheckbox v-model="selectedItems" value="item1" label="Item 1" />
16
+ *
17
+ * @example
18
+ * // Indeterminate checkbox (parent with children)
19
+ * <FzCheckbox v-model="selection" :indeterminate="true" label="Select All" />
20
+ */
21
+ import { computed, onMounted, shallowRef, watch } from "vue";
34
22
  import { FzCheckboxProps } from "./types";
35
- import { mapSizeToClasses } from "./common";
36
- import FzRadioErrorText from "./components/FzCheckboxErrorText.vue";
37
- import { FzIcon } from "@fiscozen/icons";
23
+ import { generateCheckboxId } from "./utils";
24
+ import { FzIcon, type IconVariant } from "@fiscozen/icons";
25
+ import { FzTooltip } from "@fiscozen/tooltip";
26
+ import ErrorAlert from "./components/ErrorAlert.vue";
38
27
 
39
28
  const props = withDefaults(defineProps<FzCheckboxProps>(), {
40
- size: "md",
41
29
  indeterminate: false,
42
30
  });
43
31
 
44
- const currentValue = computed(() => props.value ?? props.label);
32
+ /**
33
+ * Deprecation warning for size prop.
34
+ * Watches the size prop and warns once on mount if it's provided.
35
+ * Using watch with immediate:true ensures the warning only fires once per component instance.
36
+ */
37
+ watch(
38
+ () => props.size,
39
+ (size) => {
40
+ if (size !== undefined) {
41
+ console.warn(
42
+ '[FzCheckbox] The "size" prop is deprecated and will be removed in a future version. Checkboxes now have a fixed size.'
43
+ );
44
+ }
45
+ },
46
+ { immediate: true }
47
+ );
48
+
49
+ /**
50
+ * FontAwesome icon names for different checkbox states.
51
+ * Frozen for optimal memory usage - string literals are interned once and reused.
52
+ *
53
+ * @constant
54
+ *
55
+ * @example
56
+ * const icon = isChecked ? CHECKBOX_ICONS.CHECKED : CHECKBOX_ICONS.UNCHECKED;
57
+ */
58
+ const CHECKBOX_ICONS = Object.freeze({
59
+ /** Icon for indeterminate state (partial selection) */
60
+ INDETERMINATE: "square-minus",
61
+ /** Icon for checked state */
62
+ CHECKED: "square-check",
63
+ /** Icon for unchecked state */
64
+ UNCHECKED: "square",
65
+ } as const);
45
66
 
46
- const id = computed(
47
- () => `fz-checkbox-${Math.random().toString(36).slice(2, 9)}`,
67
+ /**
68
+ * FontAwesome icon variant prefixes for checkbox icons.
69
+ *
70
+ * @constant
71
+ */
72
+ const CHECKBOX_ICON_VARIANTS = Object.freeze({
73
+ /** Solid variant (filled) - used for checked and indeterminate states */
74
+ SOLID: "fas",
75
+ /** Regular variant (outline) - used for unchecked state */
76
+ REGULAR: "far",
77
+ } as const);
78
+
79
+ /**
80
+ * Computes the actual value to use for the checkbox.
81
+ * Falls back to label if no explicit value is provided.
82
+ */
83
+ const currentValue = computed<string | number | boolean>(
84
+ () => props.value ?? props.label
48
85
  );
49
86
 
87
+ /**
88
+ * Unique identifier for the checkbox input.
89
+ * Uses provided checkboxId prop if available, otherwise generates unique ID
90
+ * using timestamp + random suffix strategy.
91
+ * Deterministic IDs are important for aria-owns relationships in hierarchical structures.
92
+ */
93
+ const id: string = props.checkboxId || generateCheckboxId();
94
+
95
+ /**
96
+ * Two-way binding for checkbox state.
97
+ * Supports three modes:
98
+ * - null/undefined: Uncontrolled state
99
+ * - boolean: Single checkbox (true/false)
100
+ * - array: Multi-select checkbox group (contains values of checked items)
101
+ */
50
102
  const model = defineModel<
51
103
  null | undefined | boolean | (string | number | boolean)[]
52
104
  >({
53
105
  required: true,
54
106
  });
55
107
 
56
- const emit = defineEmits(["change"]);
57
- const refCheckbox = ref<HTMLInputElement | null>(null);
108
+ const emit = defineEmits<{
109
+ change: [event: Event];
110
+ }>();
111
+
112
+ /**
113
+ * Reference to the native checkbox input element.
114
+ * Uses shallowRef for optimal performance with DOM element references.
115
+ * ShallowRef avoids deep reactivity tracking of all DOM element properties.
116
+ *
117
+ * @see https://vuejs.org/api/reactivity-advanced.html#shallowref
118
+ * @note When upgrading to Vue 3.5+, consider migrating to useTemplateRef()
119
+ */
120
+ const refCheckbox = shallowRef<HTMLInputElement | null>(null);
58
121
 
59
- const staticInputClass = "w-0 h-0 peer fz-hidden-input";
60
- const staticLabelClass = `
61
- flex gap-4 hover:cursor-pointer
122
+ /**
123
+ * CSS classes for the hidden native checkbox input.
124
+ * Uses "peer" for Tailwind's peer selector to style adjacent elements based on input state.
125
+ * Input is visually hidden but remains accessible to screen readers and keyboard navigation.
126
+ */
127
+ const staticInputClass: string = "w-0 h-0 peer fz-hidden-input";
128
+
129
+ /**
130
+ * CSS classes for the label element.
131
+ * Includes focus ring styles.
132
+ *
133
+ * Focus: blue-200 border appears around checkbox icon
134
+ *
135
+ * Items aligned to start (top) for proper alignment with long multi-line labels.
136
+ */
137
+ const staticLabelClass: string = `
138
+ flex gap-6 items-start hover:cursor-pointer text-core-black
62
139
  peer-focus:[&_div]:after:border-1
63
140
  peer-focus:[&_div]:after:border-solid
64
- peer-focus:[&_div]:after:rounded-[3px]
65
- peer-focus:[&_div]:after:border-blue-500
141
+ peer-focus:[&_div]:after:rounded-[2px]
142
+ peer-focus:[&_div]:after:border-blue-200
66
143
  peer-focus:[&_div]:after:content-['']
67
144
  peer-focus:[&_div]:after:top-0
68
145
  peer-focus:[&_div]:after:left-0
@@ -70,78 +147,261 @@ const staticLabelClass = `
70
147
  peer-focus:[&_div]:after:bottom-0
71
148
  peer-focus:[&_div]:after:absolute
72
149
  `;
73
- const staticIconClass = "relative";
74
150
 
75
- const computedLabelClass = computed(() => [
76
- mapSizeToClasses[props.size],
77
- getTextClassForLabel(),
78
- ]);
151
+ /** Position context for the focus ring pseudo-element */
152
+ const staticIconClass: string = "relative";
79
153
 
80
- const computedIconClasses = computed(() => [
81
- props.size === "sm" ? "mt-1" : "",
82
- getTextClassForIcon(),
83
- ]);
154
+ /**
155
+ * Determines if the checkbox is currently checked.
156
+ * Handles both boolean and array models:
157
+ * - Boolean model: Returns the boolean value directly
158
+ * - Array model: Returns true if the array contains this checkbox's value
159
+ * - Null/undefined: Returns false
160
+ */
161
+ const isChecked = computed<boolean>(() => {
162
+ if (model.value == null) return false;
84
163
 
85
- const computedName = computed(() => {
86
- if (props.indeterminate) {
87
- return "square-minus";
164
+ if (typeof model.value === "boolean") {
165
+ return model.value;
166
+ } else {
167
+ return model.value.includes(currentValue.value);
88
168
  }
89
-
90
- return checkValueIsInModel() ? "square-check" : "square";
91
169
  });
92
170
 
93
- const computedVariant = computed(() => {
94
- return !props.indeterminate && !checkValueIsInModel() ? "far" : "fas";
171
+ /**
172
+ * Computes text color classes for the label and checkbox icon.
173
+ *
174
+ * Uses peer-checked and peer-indeterminate selectors to apply colors based on input state.
175
+ *
176
+ * Priority order (highest to lowest):
177
+ * 1. Disabled: grey-300 (label + checkbox)
178
+ * 2. Error: semantic-error-200 (label + checkbox, all states)
179
+ * 3. Emphasis: blue-500 (checkbox when checked/indeterminate)
180
+ * 4. Checked/Indeterminate: grey-500 (checkbox only)
181
+ * 5. Unchecked: grey-400 (checkbox only, handled by textClassForIcon)
182
+ *
183
+ * @returns Tailwind CSS classes for label text and checkbox icon
184
+ */
185
+ const textClassForLabel = computed<string>(() => {
186
+ // Priority 1: Disabled
187
+ if (props.disabled) {
188
+ return "text-grey-300 [&_div]:text-grey-300";
189
+ }
190
+
191
+ // Priority 2: Error (overrides everything except disabled)
192
+ // Red for checkbox icon AND label text (all states: unchecked, checked, indeterminate)
193
+ if (props.error) {
194
+ return "text-semantic-error-200 [&_div]:text-semantic-error-200 peer-checked:[&_div]:text-semantic-error-200 peer-indeterminate:[&_div]:text-semantic-error-200";
195
+ }
196
+
197
+ // Priority 3: Emphasis (blue-500 when checked/indeterminate)
198
+ // Force blue color even for indeterminate state
199
+ if (props.emphasis) {
200
+ return "text-core-black [&_div]:text-blue-500 peer-checked:[&_div]:text-blue-500 peer-indeterminate:[&_div]:text-blue-500";
201
+ }
202
+
203
+ // Priority 4-5: Default (grey-500 when checked/indeterminate, grey-400 when unchecked)
204
+ // Hover: implemented in CSS (see <style> section)
205
+ return "text-core-black peer-checked:[&_div]:text-grey-500 peer-indeterminate:[&_div]:text-grey-500";
95
206
  });
96
207
 
97
- const checkValueIsInModel = () => {
98
- if (model.value == null) return false;
208
+ /**
209
+ * Computes base text color for the checkbox icon.
210
+ *
211
+ * Handles disabled, error, and emphasis states. Default unchecked color is grey-400.
212
+ * Checked/indeterminate colors are controlled by textClassForLabel via peer-checked/peer-indeterminate.
213
+ *
214
+ * Priority order:
215
+ * 1. Disabled: grey-300
216
+ * 2. Error: semantic-error-200
217
+ * 3. Emphasis: blue-500 (all states)
218
+ * 4-5. Default: grey-400 (unchecked)
219
+ *
220
+ * @returns Tailwind CSS class for checkbox icon color
221
+ */
222
+ const textClassForIcon = computed<string>(() => {
223
+ // Priority 1: Disabled
224
+ if (props.disabled) {
225
+ return "text-grey-300";
226
+ }
99
227
 
100
- if (typeof model.value === "boolean") {
101
- return model.value;
102
- } else {
103
- return model.value.includes(currentValue.value);
228
+ // Priority 2: Error
229
+ if (props.error) {
230
+ return "text-semantic-error-200";
104
231
  }
105
- };
106
-
107
- const getTextClassForLabel = () => {
108
- switch (true) {
109
- case props.disabled:
110
- return "text-grey-300";
111
- case props.error:
112
- return "text-semantic-error";
113
- case props.emphasis:
114
- return "text-core-black peer-checked:[&_div]:text-blue-500 peer-indeterminate:[&_div]:text-blue-500";
115
- default:
116
- return "text-core-black";
232
+
233
+ // Priority 3: Emphasis (blue-500 for all states)
234
+ if (props.emphasis) {
235
+ return "text-blue-500";
117
236
  }
118
- };
119
-
120
- const getTextClassForIcon = () => {
121
- switch (true) {
122
- case props.disabled:
123
- return "text-grey-300";
124
- case props.error:
125
- return "text-semantic-error";
126
- case props.emphasis:
127
- default:
128
- return "text-grey-500";
237
+
238
+ // Priority 4-5: Default unchecked (grey-400)
239
+ // Checked/indeterminate colors are controlled by textClassForLabel
240
+ return "text-grey-400";
241
+ });
242
+
243
+ /** Dynamic label classes based on state (disabled, error, emphasis) */
244
+ const computedLabelClass = computed<string[]>(() => [
245
+ "text-base",
246
+ textClassForLabel.value,
247
+ ]);
248
+
249
+ /** Dynamic icon classes based on size and state */
250
+ const computedIconClasses = computed<string[]>(() => [textClassForIcon.value]);
251
+
252
+ /**
253
+ * Determines which FontAwesome icon to display:
254
+ * - Indeterminate: square with minus (partial selection)
255
+ * - Checked: square with check
256
+ * - Unchecked: empty square
257
+ */
258
+ const computedIconName = computed<string>(() => {
259
+ if (props.indeterminate) {
260
+ return CHECKBOX_ICONS.INDETERMINATE;
129
261
  }
130
- };
131
262
 
263
+ return isChecked.value ? CHECKBOX_ICONS.CHECKED : CHECKBOX_ICONS.UNCHECKED;
264
+ });
265
+
266
+ /**
267
+ * FontAwesome icon variant:
268
+ * - "fas" (solid): For checked or indeterminate states
269
+ * - "far" (regular): For unchecked state
270
+ */
271
+ const computedVariant = computed<IconVariant>(() => {
272
+ return props.indeterminate || isChecked.value
273
+ ? CHECKBOX_ICON_VARIANTS.SOLID
274
+ : CHECKBOX_ICON_VARIANTS.REGULAR;
275
+ });
276
+
277
+ /**
278
+ * Lifecycle hook: Triggers change event on mount if checkbox is initially checked.
279
+ * This ensures that any parent components listening to change events receive
280
+ * initial state, which is particularly important for parent checkboxes that need
281
+ * to synchronize with their children's initial state.
282
+ */
132
283
  onMounted(() => {
133
284
  if (model.value == null) return;
285
+
286
+ // Boolean model: dispatch change if true
134
287
  if (typeof model.value === "boolean") {
135
288
  if (model.value) refCheckbox.value?.dispatchEvent(new Event("change"));
136
- else if (props.checked !== undefined) model.value = props.checked;
137
- } else {
289
+ }
290
+ // Array model: dispatch change if this checkbox's value is in the array
291
+ else {
138
292
  if (model.value.includes(currentValue.value))
139
293
  refCheckbox.value?.dispatchEvent(new Event("change"));
140
- else if (props.checked) model.value.push(currentValue.value);
141
294
  }
142
295
  });
143
296
  </script>
297
+
298
+ <template>
299
+ <!-- Root container: vertical layout with consistent spacing -->
300
+ <div class="flex justify-center flex-col w-fit gap-4">
301
+ <!-- Checkbox row: input + label + optional tooltip, aligned to top for long labels -->
302
+ <!-- Hover effects are handled in CSS using data attributes -->
303
+ <div
304
+ class="flex items-start group"
305
+ :data-emphasis="emphasis || undefined"
306
+ :data-error="error || undefined"
307
+ :data-disabled="disabled || undefined"
308
+ >
309
+ <!--
310
+ Native checkbox input (visually hidden but functionally present)
311
+ - Maintains native keyboard navigation and form behavior
312
+ - Screen readers can interact with it normally
313
+ - Styled via adjacent label and icon using Tailwind's "peer" selector
314
+ -->
315
+ <input
316
+ type="checkbox"
317
+ :id="id"
318
+ :disabled="disabled"
319
+ :class="staticInputClass"
320
+ :required="required"
321
+ :value="value"
322
+ @change="emit('change', $event)"
323
+ v-model="model"
324
+ :aria-checked="indeterminate ? 'mixed' : isChecked"
325
+ :aria-label="standalone ? label : undefined"
326
+ :aria-required="required ? 'true' : 'false'"
327
+ :aria-invalid="error ? 'true' : 'false'"
328
+ :aria-describedby="error && $slots.error ? `${id}-error` : undefined"
329
+ :aria-labelledby="standalone ? undefined : `${id}-label`"
330
+ :aria-owns="props.ariaOwns"
331
+ ref="refCheckbox"
332
+ />
333
+ <!--
334
+ Label element: provides click target and visual representation
335
+ Connected to hidden input via "for" attribute
336
+ -->
337
+ <label
338
+ :id="`${id}-label`"
339
+ :for="id"
340
+ :class="[staticLabelClass, computedLabelClass]"
341
+ >
342
+ <!--
343
+ Visual checkbox icon (replaces hidden native checkbox)
344
+ aria-hidden because it's purely decorative - the native input conveys state
345
+ @TODO: When FzIcon natively supports ariaHidden prop, remove aria-hidden as HTML attribute and use :aria-hidden as prop
346
+ -->
347
+ <FzIcon
348
+ :name="computedIconName"
349
+ size="md"
350
+ :class="[staticIconClass, computedIconClasses]"
351
+ :variant="computedVariant"
352
+ aria-hidden="true"
353
+ />
354
+ <!-- Label text (hidden in standalone mode for checkbox-only display) -->
355
+ <template v-if="!standalone">{{ label }}</template>
356
+ </label>
357
+
358
+ <!--
359
+ Optional tooltip for additional context
360
+ @TODO: When FzTooltip supports keyboard accessibility and ARIA attributes (role="tooltip", aria-describedby), update implementation
361
+ -->
362
+ <FzTooltip v-if="tooltip" v-bind="tooltip" class="ml-6">
363
+ <!--
364
+ Info icon (informative, not decorative)
365
+ Has role="img" and aria-label because it conveys meaning
366
+ @TODO: When FzIcon natively supports role and ariaLabel props, use them instead of HTML attributes
367
+ -->
368
+ <FzIcon
369
+ name="info-circle"
370
+ size="md"
371
+ class="text-semantic-info"
372
+ role="img"
373
+ aria-label="Informazioni aggiuntive"
374
+ />
375
+ </FzTooltip>
376
+ </div>
377
+ <!-- Error message display with accessible ARIA live region -->
378
+ <ErrorAlert v-if="error && $slots.error" :id="`${id}-error`">
379
+ <slot name="error" />
380
+ </ErrorAlert>
381
+
382
+ <!--
383
+ Children slot for nested checkboxes
384
+ Used by FzCheckboxGroupOption to render child checkboxes
385
+ -->
386
+ <slot name="children" />
387
+ </div>
388
+ </template>
389
+
144
390
  <style scoped>
391
+ /**
392
+ * Visually hides the native checkbox input while keeping it accessible.
393
+ *
394
+ * Why not display:none or visibility:hidden?
395
+ * - Those would remove the input from the accessibility tree
396
+ * - Screen readers couldn't interact with it
397
+ * - Keyboard navigation would be broken
398
+ *
399
+ * This approach:
400
+ * - Maintains accessibility tree presence
401
+ * - Preserves keyboard focus capability
402
+ * - Allows screen reader interaction
403
+ * - Enables form submission behavior
404
+ */
145
405
  .fz-hidden-input {
146
406
  opacity: 0;
147
407
  margin: 0;
@@ -149,4 +409,60 @@ onMounted(() => {
149
409
  border: 0 none;
150
410
  appearance: none;
151
411
  }
412
+
413
+ /**
414
+ * Hover effects for checkbox icon and label.
415
+ *
416
+ * Uses data attributes (data-emphasis, data-error, data-disabled) and pseudo-classes
417
+ * (:checked, :indeterminate) to apply hover colors based on state.
418
+ *
419
+ * Priority order (highest to lowest):
420
+ * 1. Disabled: no hover effect
421
+ * 2. Error: semantic-error-300 (checkbox + label, all states)
422
+ * 3. Emphasis: blue-600 (checkbox only, all states)
423
+ * 4. Checked/Indeterminate: core-black (checkbox only, no emphasis/error)
424
+ * 5. Unchecked: blue-600 (checkbox only, no emphasis/error)
425
+ */
426
+
427
+ /* Priority 1: Disabled - no hover (no rule needed) */
428
+
429
+ /* Priority 2: Error hover (all states): semantic-error-300 for checkbox AND label */
430
+ .group[data-error]:hover:not([data-disabled]) .peer ~ label > div {
431
+ color: var(--semantic-error-300) !important;
432
+ }
433
+ .group[data-error]:hover:not([data-disabled]) .peer ~ label {
434
+ color: var(--semantic-error-300) !important;
435
+ }
436
+
437
+ /* Priority 3: Emphasis hover (all states): blue-600 */
438
+ .group[data-emphasis]:hover:not([data-disabled]):not([data-error])
439
+ .peer
440
+ ~ label
441
+ > div {
442
+ color: var(--blue-600) !important;
443
+ }
444
+
445
+ /* Priority 4: Checked hover (no emphasis, no error): core-black */
446
+ .group:hover:not([data-emphasis]):not([data-error]):not([data-disabled])
447
+ .peer:checked
448
+ ~ label
449
+ > div {
450
+ color: var(--core-black) !important;
451
+ }
452
+
453
+ /* Priority 4: Indeterminate hover (no emphasis, no error): core-black */
454
+ .group:hover:not([data-emphasis]):not([data-error]):not([data-disabled])
455
+ .peer:indeterminate
456
+ ~ label
457
+ > div {
458
+ color: var(--core-black) !important;
459
+ }
460
+
461
+ /* Priority 5: Unchecked hover (no emphasis, no error): blue-600 */
462
+ .group:hover:not([data-emphasis]):not([data-error]):not([data-disabled])
463
+ .peer:not(:checked):not(:indeterminate)
464
+ ~ label
465
+ > div {
466
+ color: var(--blue-600) !important;
467
+ }
152
468
  </style>