@codelitdev/design-system 0.1.0-alpha.6 → 0.1.0-alpha.7

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.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import React from "react";
3
+ import type React from "react";
4
4
 
5
5
  export interface SwitchProps {
6
6
  label?: React.ReactNode;
@@ -12,10 +12,25 @@ export interface SwitchProps {
12
12
  }
13
13
 
14
14
  /** Toggle switch with trailing label. */
15
- export function Switch({ label, checked, defaultChecked, disabled, onChange, style }: SwitchProps) {
15
+ export function Switch({
16
+ label,
17
+ checked,
18
+ defaultChecked,
19
+ disabled,
20
+ onChange,
21
+ style,
22
+ }: SwitchProps) {
16
23
  return (
17
24
  <label className="cl-switch" style={{ opacity: disabled ? 0.5 : 1, ...style }}>
18
- <input type="checkbox" role="switch" checked={checked} defaultChecked={defaultChecked} disabled={disabled} onChange={onChange} />
25
+ <input
26
+ type="checkbox"
27
+ role="switch"
28
+ aria-checked={checked ?? defaultChecked ?? false}
29
+ checked={checked}
30
+ defaultChecked={defaultChecked}
31
+ disabled={disabled}
32
+ onChange={onChange}
33
+ />
19
34
  <span className="cl-switch__track">
20
35
  <span className="cl-switch__thumb"></span>
21
36
  </span>