@fpkit/acss 3.8.0 → 3.9.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 (38) hide show
  1. package/libs/components/form/checkbox.css +1 -0
  2. package/libs/components/form/checkbox.css.map +1 -0
  3. package/libs/components/form/checkbox.min.css +3 -0
  4. package/libs/components/form/form.css +1 -1
  5. package/libs/components/form/form.css.map +1 -1
  6. package/libs/components/form/form.min.css +2 -2
  7. package/libs/index.cjs +25 -25
  8. package/libs/index.cjs.map +1 -1
  9. package/libs/index.css +1 -1
  10. package/libs/index.css.map +1 -1
  11. package/libs/index.d.cts +142 -292
  12. package/libs/index.d.ts +142 -292
  13. package/libs/index.js +6 -5
  14. package/libs/index.js.map +1 -1
  15. package/package.json +2 -2
  16. package/src/components/form/checkbox.scss +129 -0
  17. package/src/components/form/checkbox.tsx +302 -0
  18. package/src/components/form/form.scss +59 -20
  19. package/src/components/form/form.types.ts +6 -0
  20. package/src/components/form/input.stories.tsx +258 -1
  21. package/src/index.scss +1 -1
  22. package/src/index.ts +13 -8
  23. package/src/styles/form/checkbox.css +97 -0
  24. package/src/styles/form/checkbox.css.map +1 -0
  25. package/src/styles/form/form.css +138 -22
  26. package/src/styles/form/form.css.map +1 -1
  27. package/src/styles/index.css +138 -393
  28. package/src/styles/index.css.map +1 -1
  29. package/libs/components/checkbox/checkbox.css +0 -1
  30. package/libs/components/checkbox/checkbox.css.map +0 -1
  31. package/libs/components/checkbox/checkbox.min.css +0 -3
  32. package/src/components/checkbox/README.mdx +0 -263
  33. package/src/components/checkbox/STYLES.mdx +0 -434
  34. package/src/components/checkbox/checkbox.scss +0 -432
  35. package/src/components/checkbox/checkbox.stories.tsx +0 -607
  36. package/src/components/checkbox/checkbox.test.tsx +0 -535
  37. package/src/components/checkbox/checkbox.tsx +0 -575
  38. package/src/styles/checkbox/checkbox.css +0 -372
@@ -1,432 +0,0 @@
1
- /* ============================================================================
2
- Checkbox Component Styles
3
- ============================================================================
4
-
5
- Accessible checkbox component with size and color variants.
6
- All measurements use rem units (1rem = 16px).
7
- All color variants meet WCAG 2.1 AA contrast requirements (4.5:1 minimum).
8
-
9
- CSS Variable Naming Convention:
10
- --checkbox-{element}-{variant}-{property}-{modifier}
11
-
12
- Approved abbreviations: bg, fs, fw, radius, gap
13
- Full words for: padding, margin, color, border, display, width, height
14
- ========================================================================= */
15
-
16
- :root {
17
- /* ==========================================================================
18
- Size Tokens
19
- ========================================================================== */
20
-
21
- --checkbox-size-sm: 1rem; /* 16px */
22
- --checkbox-size-md: 1.25rem; /* 20px */
23
- --checkbox-size-lg: 1.5rem; /* 24px */
24
-
25
- /* ==========================================================================
26
- Base Properties
27
- ========================================================================== */
28
-
29
- --checkbox-size: var(--checkbox-size-md);
30
- --checkbox-bg: #ffffff;
31
- --checkbox-border: 0.125rem solid #6b7280; /* 2px border */
32
- --checkbox-border-color: #6b7280; /* Gray 500 */
33
- --checkbox-radius: 0.25rem; /* 4px */
34
- --checkbox-cursor: pointer;
35
- --checkbox-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
36
-
37
- /* ==========================================================================
38
- Checkmark Indicator
39
- ========================================================================== */
40
-
41
- --checkbox-checkmark-color: #ffffff;
42
- --checkbox-checkmark-opacity: 0;
43
- --checkbox-checkmark-transform: scale(0.7);
44
-
45
- /* ==========================================================================
46
- Label Properties
47
- ========================================================================== */
48
-
49
- --checkbox-label-gap: 0.5rem; /* 8px */
50
- --checkbox-label-fs: 1rem; /* 16px */
51
- --checkbox-label-color: inherit;
52
- --checkbox-label-cursor: pointer;
53
- --checkbox-label-fw: 400;
54
-
55
- /* ==========================================================================
56
- Description Properties
57
- ========================================================================== */
58
-
59
- --checkbox-description-fs: 0.875rem; /* 14px */
60
- --checkbox-description-color: #6b7280; /* Gray 500 */
61
- --checkbox-description-margin-block-start: 0.25rem; /* 4px */
62
- --checkbox-description-padding-inline-start: calc(
63
- var(--checkbox-size) + var(--checkbox-label-gap)
64
- );
65
-
66
- /* ==========================================================================
67
- Error Message Properties
68
- ========================================================================== */
69
-
70
- --checkbox-error-fs: 0.875rem; /* 14px */
71
- --checkbox-error-color: #dc2626; /* Red 600 */
72
- --checkbox-error-margin-block-start: 0.25rem; /* 4px */
73
- --checkbox-error-padding-inline-start: calc(
74
- var(--checkbox-size) + var(--checkbox-label-gap)
75
- );
76
-
77
- /* ==========================================================================
78
- Required Indicator
79
- ========================================================================== */
80
-
81
- --checkbox-required-color: #dc2626; /* Red 600 */
82
- --checkbox-required-fw: 600;
83
-
84
- /* ==========================================================================
85
- Color Variants - WCAG AA Compliant
86
- ========================================================================== */
87
-
88
- /* Primary Variant (Blue) */
89
- --checkbox-primary-checked-bg: #2563eb; /* Blue 600 - 4.68:1 contrast */
90
- --checkbox-primary-checked-border: #2563eb;
91
- --checkbox-primary-hover-border: #3b82f6; /* Blue 500 */
92
- --checkbox-primary-focus-outline-color: #93c5fd; /* Blue 300 */
93
-
94
- /* Secondary Variant (Gray) */
95
- --checkbox-secondary-checked-bg: #4b5563; /* Gray 600 - 7.56:1 contrast */
96
- --checkbox-secondary-checked-border: #4b5563;
97
- --checkbox-secondary-hover-border: #6b7280; /* Gray 500 */
98
- --checkbox-secondary-focus-outline-color: #9ca3af; /* Gray 400 */
99
-
100
- /* Error Variant (Red) */
101
- --checkbox-error-checked-bg: #dc2626; /* Red 600 - 5.14:1 contrast */
102
- --checkbox-error-checked-border: #dc2626;
103
- --checkbox-error-hover-border: #ef4444; /* Red 500 */
104
- --checkbox-error-focus-outline-color: #fca5a5; /* Red 300 */
105
-
106
- /* Success Variant (Green) */
107
- --checkbox-success-checked-bg: #16a34a; /* Green 600 - 4.54:1 contrast */
108
- --checkbox-success-checked-border: #16a34a;
109
- --checkbox-success-hover-border: #22c55e; /* Green 500 */
110
- --checkbox-success-focus-outline-color: #86efac; /* Green 300 */
111
-
112
- /* ==========================================================================
113
- State Variables
114
- ========================================================================== */
115
-
116
- /* Hover State */
117
- --checkbox-hover-border-color: #9ca3af; /* Gray 400 */
118
- --checkbox-hover-bg: #f9fafb; /* Gray 50 */
119
-
120
- /* Focus State */
121
- --checkbox-focus-outline: 0.125rem solid; /* 2px */
122
- --checkbox-focus-outline-offset: 0.125rem; /* 2px */
123
- --checkbox-focus-outline-color: var(--checkbox-primary-focus-outline-color);
124
-
125
- /* Checked State */
126
- --checkbox-checked-bg: var(--checkbox-primary-checked-bg);
127
- --checkbox-checked-border: var(--checkbox-primary-checked-border);
128
- --checkbox-checked-checkmark-opacity: 1;
129
- --checkbox-checked-checkmark-transform: scale(1);
130
-
131
- /* Indeterminate State */
132
- --checkbox-indeterminate-bg: var(--checkbox-primary-checked-bg);
133
- --checkbox-indeterminate-border: var(--checkbox-primary-checked-border);
134
- --checkbox-indeterminate-dash-width: 0.625rem; /* 10px */
135
- --checkbox-indeterminate-dash-height: 0.125rem; /* 2px */
136
- --checkbox-indeterminate-dash-opacity: 1;
137
-
138
- /* Disabled State */
139
- --checkbox-disabled-bg: #f3f4f6; /* Gray 100 */
140
- --checkbox-disabled-border-color: #d1d5db; /* Gray 300 */
141
- --checkbox-disabled-opacity: 0.6;
142
- --checkbox-disabled-cursor: not-allowed;
143
-
144
- /* Invalid State */
145
- --checkbox-invalid-border-color: #dc2626; /* Red 600 */
146
- --checkbox-invalid-focus-outline-color: #fca5a5; /* Red 300 */
147
- }
148
-
149
- /* ============================================================================
150
- Wrapper Element
151
- ============================================================================ */
152
-
153
- [data-checkbox] {
154
- display: inline-flex;
155
- flex-direction: column;
156
- gap: var(--checkbox-label-gap);
157
-
158
- /* Size Variants */
159
- &[data-checkbox~="sm"] {
160
- --checkbox-size: var(--checkbox-size-sm);
161
- --checkbox-label-fs: 0.875rem; /* 14px */
162
- }
163
-
164
- &[data-checkbox~="md"] {
165
- --checkbox-size: var(--checkbox-size-md);
166
- --checkbox-label-fs: 1rem; /* 16px */
167
- }
168
-
169
- &[data-checkbox~="lg"] {
170
- --checkbox-size: var(--checkbox-size-lg);
171
- --checkbox-label-fs: 1.125rem; /* 18px */
172
- }
173
-
174
- /* Color Variants */
175
- &[data-checkbox~="primary"] {
176
- --checkbox-checked-bg: var(--checkbox-primary-checked-bg);
177
- --checkbox-checked-border: var(--checkbox-primary-checked-border);
178
- --checkbox-hover-border-color: var(--checkbox-primary-hover-border);
179
- --checkbox-focus-outline-color: var(--checkbox-primary-focus-outline-color);
180
- --checkbox-indeterminate-bg: var(--checkbox-primary-checked-bg);
181
- --checkbox-indeterminate-border: var(--checkbox-primary-checked-border);
182
- }
183
-
184
- &[data-checkbox~="secondary"] {
185
- --checkbox-checked-bg: var(--checkbox-secondary-checked-bg);
186
- --checkbox-checked-border: var(--checkbox-secondary-checked-border);
187
- --checkbox-hover-border-color: var(--checkbox-secondary-hover-border);
188
- --checkbox-focus-outline-color: var(
189
- --checkbox-secondary-focus-outline-color
190
- );
191
- --checkbox-indeterminate-bg: var(--checkbox-secondary-checked-bg);
192
- --checkbox-indeterminate-border: var(--checkbox-secondary-checked-border);
193
- }
194
-
195
- &[data-checkbox~="error"] {
196
- --checkbox-checked-bg: var(--checkbox-error-checked-bg);
197
- --checkbox-checked-border: var(--checkbox-error-checked-border);
198
- --checkbox-hover-border-color: var(--checkbox-error-hover-border);
199
- --checkbox-focus-outline-color: var(--checkbox-error-focus-outline-color);
200
- --checkbox-indeterminate-bg: var(--checkbox-error-checked-bg);
201
- --checkbox-indeterminate-border: var(--checkbox-error-checked-border);
202
- }
203
-
204
- &[data-checkbox~="success"] {
205
- --checkbox-checked-bg: var(--checkbox-success-checked-bg);
206
- --checkbox-checked-border: var(--checkbox-success-checked-border);
207
- --checkbox-hover-border-color: var(--checkbox-success-hover-border);
208
- --checkbox-focus-outline-color: var(
209
- --checkbox-success-focus-outline-color
210
- );
211
- --checkbox-indeterminate-bg: var(--checkbox-success-checked-bg);
212
- --checkbox-indeterminate-border: var(--checkbox-success-checked-border);
213
- }
214
- }
215
-
216
- /* ============================================================================
217
- Container (Input + Label)
218
- ============================================================================ */
219
-
220
- .checkbox-container {
221
- display: inline-flex;
222
- align-items: flex-start;
223
- gap: var(--checkbox-label-gap);
224
- cursor: var(--checkbox-cursor);
225
- }
226
-
227
- /* ============================================================================
228
- Input Wrapper (Contains native input + custom indicator)
229
- ============================================================================ */
230
-
231
- .checkbox-input-wrapper {
232
- position: relative;
233
- display: inline-flex;
234
- align-items: center;
235
- justify-content: center;
236
- flex-shrink: 0; /* Prevent checkbox from shrinking */
237
- }
238
-
239
- /* ============================================================================
240
- Native Checkbox Input (Hidden but accessible)
241
- ============================================================================ */
242
-
243
- .checkbox-input {
244
- position: absolute;
245
- opacity: 0;
246
- width: var(--checkbox-size);
247
- height: var(--checkbox-size);
248
- margin: 0;
249
- cursor: var(--checkbox-cursor);
250
- z-index: 1;
251
-
252
- /* Focus State */
253
- &:focus-visible + .checkbox-indicator {
254
- outline: var(--checkbox-focus-outline);
255
- outline-color: var(--checkbox-focus-outline-color);
256
- outline-offset: var(--checkbox-focus-outline-offset);
257
- }
258
-
259
- /* Hover State */
260
- &:hover:not(:disabled):not([aria-disabled="true"]) + .checkbox-indicator {
261
- background-color: var(--checkbox-hover-bg);
262
- border-color: var(--checkbox-hover-border-color);
263
- }
264
-
265
- /* Checked State */
266
- &:checked + .checkbox-indicator {
267
- background-color: var(--checkbox-checked-bg);
268
- border-color: var(--checkbox-checked-border);
269
-
270
- .checkbox-checkmark {
271
- opacity: var(--checkbox-checked-checkmark-opacity);
272
- transform: var(--checkbox-checked-checkmark-transform);
273
- }
274
-
275
- .checkbox-indeterminate-dash {
276
- opacity: 0;
277
- }
278
- }
279
-
280
- /* Indeterminate State */
281
- &:indeterminate + .checkbox-indicator {
282
- background-color: var(--checkbox-indeterminate-bg);
283
- border-color: var(--checkbox-indeterminate-border);
284
-
285
- .checkbox-checkmark {
286
- opacity: 0;
287
- }
288
-
289
- .checkbox-indeterminate-dash {
290
- opacity: var(--checkbox-indeterminate-dash-opacity);
291
- }
292
- }
293
-
294
- /* Disabled State */
295
- &:disabled,
296
- &[aria-disabled="true"] {
297
- cursor: var(--checkbox-disabled-cursor);
298
-
299
- & + .checkbox-indicator {
300
- background-color: var(--checkbox-disabled-bg);
301
- border-color: var(--checkbox-disabled-border-color);
302
- opacity: var(--checkbox-disabled-opacity);
303
- cursor: var(--checkbox-disabled-cursor);
304
- }
305
- }
306
-
307
- /* Invalid State */
308
- &[aria-invalid="true"]:not(:checked):not(:indeterminate) + .checkbox-indicator {
309
- border-color: var(--checkbox-invalid-border-color);
310
- }
311
-
312
- &[aria-invalid="true"]:focus-visible + .checkbox-indicator {
313
- outline-color: var(--checkbox-invalid-focus-outline-color);
314
- }
315
- }
316
-
317
- /* ============================================================================
318
- Custom Checkbox Indicator
319
- ============================================================================ */
320
-
321
- .checkbox-indicator {
322
- position: relative;
323
- display: inline-flex;
324
- align-items: center;
325
- justify-content: center;
326
- width: var(--checkbox-size);
327
- height: var(--checkbox-size);
328
- min-width: var(--checkbox-size); /* Prevent shrinking */
329
- min-height: var(--checkbox-size);
330
- background-color: var(--checkbox-bg);
331
- border: var(--checkbox-border);
332
- border-radius: var(--checkbox-radius);
333
- transition: var(--checkbox-transition);
334
- pointer-events: none; /* Let clicks pass through to input */
335
- }
336
-
337
- /* ============================================================================
338
- Checkmark SVG (Checked State)
339
- ============================================================================ */
340
-
341
- .checkbox-checkmark {
342
- width: 75%; /* Scale relative to checkbox size */
343
- height: 75%;
344
- color: var(--checkbox-checkmark-color);
345
- opacity: var(--checkbox-checkmark-opacity);
346
- transform: var(--checkbox-checkmark-transform);
347
- transition: var(--checkbox-transition);
348
- pointer-events: none;
349
- }
350
-
351
- /* ============================================================================
352
- Indeterminate Dash (Indeterminate State)
353
- ============================================================================ */
354
-
355
- .checkbox-indeterminate-dash {
356
- position: absolute;
357
- width: var(--checkbox-indeterminate-dash-width);
358
- height: var(--checkbox-indeterminate-dash-height);
359
- background-color: var(--checkbox-checkmark-color);
360
- border-radius: calc(var(--checkbox-indeterminate-dash-height) / 2);
361
- opacity: 0;
362
- transition: var(--checkbox-transition);
363
- pointer-events: none;
364
- }
365
-
366
- /* ============================================================================
367
- Label
368
- ============================================================================ */
369
-
370
- .checkbox-label {
371
- display: inline-flex;
372
- align-items: flex-start;
373
- font-size: var(--checkbox-label-fs);
374
- font-weight: var(--checkbox-label-fw);
375
- color: var(--checkbox-label-color);
376
- cursor: var(--checkbox-label-cursor);
377
- user-select: none;
378
- line-height: 1.5;
379
-
380
- /* Match checkbox vertical alignment */
381
- padding-block-start: calc((var(--checkbox-size) - var(--checkbox-label-fs) * 1.5) / 2);
382
- }
383
-
384
- /* Required Indicator */
385
- .checkbox-required {
386
- color: var(--checkbox-required-color);
387
- font-weight: var(--checkbox-required-fw);
388
- }
389
-
390
- /* ============================================================================
391
- Description Text
392
- ============================================================================ */
393
-
394
- .checkbox-description {
395
- font-size: var(--checkbox-description-fs);
396
- color: var(--checkbox-description-color);
397
- margin-block-start: var(--checkbox-description-margin-block-start);
398
- padding-inline-start: var(--checkbox-description-padding-inline-start);
399
- line-height: 1.5;
400
- }
401
-
402
- /* ============================================================================
403
- Error Message
404
- ============================================================================ */
405
-
406
- .checkbox-error {
407
- font-size: var(--checkbox-error-fs);
408
- color: var(--checkbox-error-color);
409
- margin-block-start: var(--checkbox-error-margin-block-start);
410
- padding-inline-start: var(--checkbox-error-padding-inline-start);
411
- line-height: 1.5;
412
- }
413
-
414
- /* ============================================================================
415
- Disabled State on Wrapper
416
- ============================================================================ */
417
-
418
- [data-checkbox].is-disabled {
419
- .checkbox-label {
420
- cursor: var(--checkbox-disabled-cursor);
421
- opacity: var(--checkbox-disabled-opacity);
422
- }
423
-
424
- .checkbox-container {
425
- cursor: var(--checkbox-disabled-cursor);
426
- }
427
-
428
- .checkbox-description,
429
- .checkbox-error {
430
- opacity: var(--checkbox-disabled-opacity);
431
- }
432
- }