File tree Expand file tree Collapse file tree 2 files changed +94
-0
lines changed 
src/features/common/components/checkbox Expand file tree Collapse file tree 2 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1+ import  {  Checkbox ,  type  CheckboxProps  }  from  "react-aria-components" ; 
2+ import  styles  from  './checkbox.module.scss' 
3+ 
4+ export  function  CheckboxComponent ( { 
5+   children, 
6+   ...props 
7+ } : Omit < CheckboxProps ,  "children" >  &  { 
8+   children ?: React . ReactNode ; 
9+ } )  { 
10+   return  ( 
11+     < Checkbox  { ...props }  className = { styles . checkbox__component } > 
12+       { ( {  isIndeterminate } )  =>  ( 
13+         < > 
14+           < div  className = { styles . checkbox } > 
15+             < svg  viewBox = "0 0 18 18"  aria-hidden = "true" > 
16+               { isIndeterminate  ? ( 
17+                 < rect  x = { 1 }  y = { 7.5 }  width = { 15 }  height = { 3 }  /> 
18+               )  : ( 
19+                 < polyline  points = "1 9 7 14 15 4"  /> 
20+               ) } 
21+             </ svg > 
22+           </ div > 
23+           { children } 
24+         </ > 
25+       ) } 
26+     </ Checkbox > 
27+   ) ; 
28+ } 
Original file line number Diff line number Diff line change 1+ .checkbox__component  {
2+   --selected-color : var (--color_bg_state_success );
3+   --selected-color-pressed : var (--color_fg_on_state_success_subtle );
4+   --checkmark-color : var (--color_border_state_success );
5+ 
6+   display flex ;
7+   /*  This is needed so the HiddenInput is positioned correctly */ 
8+   position relative ;
9+   align-items center ;
10+   gap 0.571rem  ;
11+   font-size 1.143rem  ;
12+   color white ;
13+   forced-color-adjust : none ;
14+ 
15+   .checkbox  {
16+     width 1.143rem  ;
17+     height 1.143rem  ;
18+     border 2px   solid  var (--color_fg_default );
19+     border-radius 4px  ;
20+     transition all  200ms  ;
21+     display flex ;
22+     align-items center ;
23+     justify-content center ;
24+     flex-shrink 0 ;
25+   }
26+ 
27+   svg  {
28+     width 1rem  ;
29+     height 1rem  ;
30+     fill none ;
31+     stroke var (--functional-gray-0 );
32+     stroke-width 3px  ;
33+     stroke-dasharray 22px  ;
34+     stroke-dashoffset 66 ;
35+     transition all  200ms  ;
36+   }
37+ 
38+   & [data-focus-visible ] .checkbox  {
39+     outline 2px   solid  var (--color_fg_selected );
40+     outline-offset 2px  ;
41+   }
42+ 
43+   & [data-selected ],
44+   & [data-indeterminate ] {
45+     .checkbox  {
46+       border-color var (--selected-color );
47+       background var (--selected-color );
48+     }
49+ 
50+     & [data-pressed ] .checkbox  {
51+       border-color var (--selected-color-pressed );
52+       background var (--selected-color-pressed );
53+     }
54+ 
55+     svg  {
56+       stroke-dashoffset 44 ;
57+     }
58+   }
59+ 
60+   & [data-indeterminate ] {
61+     &  svg  {
62+       stroke none ;
63+       fill var (--checkmark-color );
64+     }
65+   }
66+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments