@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.
- package/libs/components/form/checkbox.css +1 -0
- package/libs/components/form/checkbox.css.map +1 -0
- package/libs/components/form/checkbox.min.css +3 -0
- package/libs/components/form/form.css +1 -1
- package/libs/components/form/form.css.map +1 -1
- package/libs/components/form/form.min.css +2 -2
- package/libs/index.cjs +25 -25
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +142 -292
- package/libs/index.d.ts +142 -292
- package/libs/index.js +6 -5
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/form/checkbox.scss +129 -0
- package/src/components/form/checkbox.tsx +302 -0
- package/src/components/form/form.scss +59 -20
- package/src/components/form/form.types.ts +6 -0
- package/src/components/form/input.stories.tsx +258 -1
- package/src/index.scss +1 -1
- package/src/index.ts +13 -8
- package/src/styles/form/checkbox.css +97 -0
- package/src/styles/form/checkbox.css.map +1 -0
- package/src/styles/form/form.css +138 -22
- package/src/styles/form/form.css.map +1 -1
- package/src/styles/index.css +138 -393
- package/src/styles/index.css.map +1 -1
- package/libs/components/checkbox/checkbox.css +0 -1
- package/libs/components/checkbox/checkbox.css.map +0 -1
- package/libs/components/checkbox/checkbox.min.css +0 -3
- package/src/components/checkbox/README.mdx +0 -263
- package/src/components/checkbox/STYLES.mdx +0 -434
- package/src/components/checkbox/checkbox.scss +0 -432
- package/src/components/checkbox/checkbox.stories.tsx +0 -607
- package/src/components/checkbox/checkbox.test.tsx +0 -535
- package/src/components/checkbox/checkbox.tsx +0 -575
- package/src/styles/checkbox/checkbox.css +0 -372
package/libs/index.d.cts
CHANGED
|
@@ -5,6 +5,8 @@ import { I as IconProps } from './icons-df8e744f.js';
|
|
|
5
5
|
export { a as Icon, b as IconProps } from './icons-df8e744f.js';
|
|
6
6
|
export { default as Field, FieldProps } from './components/form/fields.cjs';
|
|
7
7
|
export { default as Input } from './components/form/inputs.cjs';
|
|
8
|
+
import { I as InputProps } from './form.types-d25ebfac.js';
|
|
9
|
+
export { T as TextareaProps } from './form.types-d25ebfac.js';
|
|
8
10
|
export { _ as Link, L as LinkProps, _ as To } from './link-59ad884f.js';
|
|
9
11
|
export { default as List } from './components/list/list.cjs';
|
|
10
12
|
export { Modal, ModalProps } from './components/modal.cjs';
|
|
@@ -18,7 +20,6 @@ export { default as Text, TextProps } from './components/text/text.cjs';
|
|
|
18
20
|
export { b as Heading, H as HeadingLevel, T as Title, a as TitleProps } from './heading-81eef89a.js';
|
|
19
21
|
export { default as Textarea } from './components/form/textarea.cjs';
|
|
20
22
|
export { default as Breadcrumb, BreadcrumbProps, CustomRoute, useBreadcrumbSegments } from './components/breadcrumbs/breadcrumb.cjs';
|
|
21
|
-
export { I as InputProps, T as TextareaProps } from './form.types-d25ebfac.js';
|
|
22
23
|
export { L as ListItemProps, a as ListProps } from './list.types-d26de310.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -177,357 +178,206 @@ type AlertProps = {
|
|
|
177
178
|
declare const Alert: React$1.FC<AlertProps>;
|
|
178
179
|
|
|
179
180
|
/**
|
|
180
|
-
*
|
|
181
|
+
* Props for the Checkbox component
|
|
181
182
|
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* - sm: 1rem checkbox, 0.875rem label (16px / 14px)
|
|
185
|
-
* - md: 1.25rem checkbox, 1rem label (20px / 16px)
|
|
186
|
-
* - lg: 1.5rem checkbox, 1.125rem label (24px / 18px)
|
|
187
|
-
*/
|
|
188
|
-
type CheckboxSize = "sm" | "md" | "lg";
|
|
189
|
-
/**
|
|
190
|
-
* Color variants for checkbox component.
|
|
191
|
-
* All variants meet WCAG 2.1 AA contrast requirements (4.5:1 minimum).
|
|
192
|
-
*
|
|
193
|
-
* @remarks
|
|
194
|
-
* Color variants:
|
|
195
|
-
* - primary: Blue (#2563eb) - 4.68:1 contrast
|
|
196
|
-
* - secondary: Gray (#4b5563) - 7.56:1 contrast
|
|
197
|
-
* - error: Red (#dc2626) - 5.14:1 contrast
|
|
198
|
-
* - success: Green (#16a34a) - 4.54:1 contrast
|
|
199
|
-
*/
|
|
200
|
-
type CheckboxColor = "primary" | "secondary" | "error" | "success";
|
|
201
|
-
/**
|
|
202
|
-
* Label positioning relative to the checkbox.
|
|
203
|
-
*
|
|
204
|
-
* @remarks
|
|
205
|
-
* - left: Label appears before the checkbox
|
|
206
|
-
* - right: Label appears after the checkbox (default)
|
|
207
|
-
*/
|
|
208
|
-
type CheckboxLabelPosition = "left" | "right";
|
|
209
|
-
/**
|
|
210
|
-
* Props for the Checkbox component.
|
|
183
|
+
* A simplified, checkbox-specific interface that wraps the Input component.
|
|
184
|
+
* Provides a boolean onChange API and automatic label association.
|
|
211
185
|
*
|
|
212
|
-
* @
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* // Controlled mode
|
|
189
|
+
* <Checkbox
|
|
190
|
+
* id="terms"
|
|
191
|
+
* label="I accept the terms"
|
|
192
|
+
* checked={accepted}
|
|
193
|
+
* onChange={setAccepted}
|
|
194
|
+
* required
|
|
195
|
+
* />
|
|
196
|
+
* ```
|
|
216
197
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```tsx
|
|
200
|
+
* // Uncontrolled mode with default
|
|
201
|
+
* <Checkbox
|
|
202
|
+
* id="newsletter"
|
|
203
|
+
* label="Subscribe to newsletter"
|
|
204
|
+
* defaultChecked={true}
|
|
205
|
+
* />
|
|
206
|
+
* ```
|
|
219
207
|
*/
|
|
220
|
-
interface CheckboxProps extends Omit<
|
|
208
|
+
interface CheckboxProps extends Omit<InputProps, 'type' | 'value' | 'onChange' | 'defaultValue' | 'placeholder'> {
|
|
221
209
|
/**
|
|
222
210
|
* Unique identifier for the checkbox input.
|
|
211
|
+
* Required for proper label association via htmlFor attribute.
|
|
223
212
|
*
|
|
224
|
-
* @
|
|
225
|
-
*
|
|
226
|
-
* Used to generate IDs for description and error messages.
|
|
213
|
+
* @required
|
|
214
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
227
215
|
*/
|
|
228
216
|
id: string;
|
|
229
217
|
/**
|
|
230
|
-
* Label text
|
|
231
|
-
*
|
|
232
|
-
* @remarks
|
|
233
|
-
* Alternative to `children` prop. Rendered as text content.
|
|
234
|
-
* Automatically associates with input via htmlFor.
|
|
235
|
-
*/
|
|
236
|
-
label?: React$1.ReactNode;
|
|
237
|
-
/**
|
|
238
|
-
* Child content displayed as the label.
|
|
239
|
-
*
|
|
240
|
-
* @remarks
|
|
241
|
-
* Alternative to `label` prop. Allows for more complex label content.
|
|
242
|
-
* Takes precedence over `label` prop if both are provided.
|
|
243
|
-
*/
|
|
244
|
-
children?: React$1.ReactNode;
|
|
245
|
-
/**
|
|
246
|
-
* Size variant of the checkbox.
|
|
247
|
-
*
|
|
248
|
-
* @default "md"
|
|
218
|
+
* Label text or React node displayed next to the checkbox.
|
|
219
|
+
* Automatically associated with the checkbox via htmlFor.
|
|
249
220
|
*
|
|
250
|
-
* @
|
|
251
|
-
*
|
|
252
|
-
* All sizes maintain proper touch target size (44x44px minimum).
|
|
253
|
-
*/
|
|
254
|
-
size?: CheckboxSize;
|
|
255
|
-
/**
|
|
256
|
-
* Color variant of the checkbox when checked.
|
|
257
|
-
*
|
|
258
|
-
* @default "primary"
|
|
259
|
-
*
|
|
260
|
-
* @remarks
|
|
261
|
-
* All color variants meet WCAG 2.1 AA contrast requirements.
|
|
262
|
-
* Use semantic colors (error, success) for validation states.
|
|
263
|
-
*/
|
|
264
|
-
color?: CheckboxColor;
|
|
265
|
-
/**
|
|
266
|
-
* Position of the label relative to the checkbox.
|
|
267
|
-
*
|
|
268
|
-
* @default "right"
|
|
269
|
-
*
|
|
270
|
-
* @remarks
|
|
271
|
-
* - "left": Label before checkbox (useful for RTL layouts)
|
|
272
|
-
* - "right": Label after checkbox (standard pattern)
|
|
273
|
-
*/
|
|
274
|
-
labelPosition?: CheckboxLabelPosition;
|
|
275
|
-
/**
|
|
276
|
-
* Helper text displayed below the checkbox.
|
|
277
|
-
*
|
|
278
|
-
* @remarks
|
|
279
|
-
* Provides additional context or instructions.
|
|
280
|
-
* Linked to input via aria-describedby for screen readers.
|
|
281
|
-
* Automatically generates ID: `${id}-description`.
|
|
282
|
-
*/
|
|
283
|
-
description?: string;
|
|
284
|
-
/**
|
|
285
|
-
* Error message displayed when validation fails.
|
|
286
|
-
*
|
|
287
|
-
* @remarks
|
|
288
|
-
* Displayed below the checkbox in error color.
|
|
289
|
-
* Linked to input via aria-errormessage when validationState="invalid".
|
|
290
|
-
* Automatically generates ID: `${id}-error`.
|
|
291
|
-
*/
|
|
292
|
-
errorMessage?: string;
|
|
293
|
-
/**
|
|
294
|
-
* Validation state of the checkbox.
|
|
295
|
-
*
|
|
296
|
-
* @default "none"
|
|
297
|
-
*
|
|
298
|
-
* @remarks
|
|
299
|
-
* - "valid": Checkbox passes validation
|
|
300
|
-
* - "invalid": Checkbox fails validation (sets aria-invalid)
|
|
301
|
-
* - "none": No validation applied
|
|
221
|
+
* @required
|
|
222
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/labels-or-instructions.html|WCAG 3.3.2 Labels or Instructions}
|
|
302
223
|
*/
|
|
303
|
-
|
|
224
|
+
label: React$1.ReactNode;
|
|
304
225
|
/**
|
|
305
|
-
*
|
|
226
|
+
* Controlled mode: Current checked state.
|
|
227
|
+
* When provided, component becomes controlled and requires onChange handler.
|
|
306
228
|
*
|
|
307
|
-
* @
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* const [checked, setChecked] = useState(false);
|
|
232
|
+
* <Checkbox id="opt" label="Option" checked={checked} onChange={setChecked} />
|
|
233
|
+
* ```
|
|
311
234
|
*/
|
|
312
235
|
checked?: boolean;
|
|
313
236
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* @remarks
|
|
317
|
-
* When provided without `checked` prop, component operates in uncontrolled mode.
|
|
318
|
-
* Browser manages state internally.
|
|
319
|
-
* Do not combine with checked.
|
|
320
|
-
*/
|
|
321
|
-
defaultChecked?: boolean;
|
|
322
|
-
/**
|
|
323
|
-
* Indeterminate state for partially selected groups.
|
|
324
|
-
*
|
|
325
|
-
* @default false
|
|
326
|
-
*
|
|
327
|
-
* @remarks
|
|
328
|
-
* Common for "select all" checkboxes where some but not all items are selected.
|
|
329
|
-
* Cannot be set via HTML - requires JavaScript.
|
|
330
|
-
* Visually displays a dash instead of a checkmark.
|
|
331
|
-
*/
|
|
332
|
-
indeterminate?: boolean;
|
|
333
|
-
/**
|
|
334
|
-
* Whether the checkbox is disabled.
|
|
335
|
-
*
|
|
336
|
-
* @remarks
|
|
337
|
-
* Uses aria-disabled pattern to maintain keyboard focusability.
|
|
338
|
-
* Prevents all interactions while keeping element in tab order.
|
|
339
|
-
* Essential for screen reader users to discover disabled controls.
|
|
340
|
-
*/
|
|
341
|
-
disabled?: boolean;
|
|
342
|
-
/**
|
|
343
|
-
* Whether the checkbox is required for form submission.
|
|
237
|
+
* Uncontrolled mode: Initial checked state.
|
|
238
|
+
* Use this for forms where React doesn't need to track the checkbox state.
|
|
344
239
|
*
|
|
345
240
|
* @default false
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* Does NOT prevent form submission - use validation instead.
|
|
351
|
-
*/
|
|
352
|
-
required?: boolean;
|
|
353
|
-
/**
|
|
354
|
-
* Name attribute for form submission.
|
|
355
|
-
*
|
|
356
|
-
* @remarks
|
|
357
|
-
* Used when checkbox is part of a form.
|
|
358
|
-
* Multiple checkboxes can share the same name for checkbox groups.
|
|
241
|
+
* @example
|
|
242
|
+
* ```tsx
|
|
243
|
+
* <Checkbox id="opt" label="Option" defaultChecked={true} />
|
|
244
|
+
* ```
|
|
359
245
|
*/
|
|
360
|
-
|
|
246
|
+
defaultChecked?: boolean;
|
|
361
247
|
/**
|
|
362
|
-
*
|
|
248
|
+
* Form submission value when checkbox is checked.
|
|
249
|
+
* This is the value submitted with the form when the checkbox is checked.
|
|
363
250
|
*
|
|
364
|
-
* @
|
|
365
|
-
* Submitted with form when checkbox is checked.
|
|
366
|
-
* Defaults to "on" if not specified.
|
|
251
|
+
* @default "on"
|
|
367
252
|
*/
|
|
368
253
|
value?: string;
|
|
369
254
|
/**
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* @remarks
|
|
373
|
-
* Applied to the outermost div wrapper.
|
|
374
|
-
* Merged with disabled class from useDisabledState hook.
|
|
375
|
-
*/
|
|
376
|
-
classes?: string;
|
|
377
|
-
/**
|
|
378
|
-
* Inline styles to apply to the wrapper element.
|
|
255
|
+
* Change handler with simplified boolean API.
|
|
256
|
+
* Receives true when checked, false when unchecked.
|
|
379
257
|
*
|
|
380
|
-
* @
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
258
|
+
* @param checked - The new checked state
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* <Checkbox
|
|
262
|
+
* id="opt"
|
|
263
|
+
* label="Option"
|
|
264
|
+
* onChange={(checked) => console.log('Checked:', checked)}
|
|
265
|
+
* />
|
|
266
|
+
* ```
|
|
386
267
|
*/
|
|
387
|
-
|
|
268
|
+
onChange?: (checked: boolean) => void;
|
|
388
269
|
/**
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* @param event - Change event from the input element
|
|
392
|
-
*
|
|
393
|
-
* @remarks
|
|
394
|
-
* Required when using controlled mode (with `checked` prop).
|
|
395
|
-
* Prevented when checkbox is disabled (via useDisabledState hook).
|
|
270
|
+
* Optional custom CSS classes for the wrapper div.
|
|
271
|
+
* Applied alongside automatic checkbox wrapper styling.
|
|
396
272
|
*/
|
|
397
|
-
|
|
273
|
+
classes?: string;
|
|
398
274
|
/**
|
|
399
|
-
*
|
|
275
|
+
* Optional custom CSS classes for the input element.
|
|
400
276
|
*
|
|
401
|
-
* @
|
|
277
|
+
* @default "checkbox-input"
|
|
402
278
|
*/
|
|
403
|
-
|
|
279
|
+
inputClasses?: string;
|
|
404
280
|
/**
|
|
405
|
-
*
|
|
281
|
+
* CSS custom properties for theming.
|
|
406
282
|
*
|
|
407
|
-
*
|
|
283
|
+
* Available variables:
|
|
284
|
+
* - --checkbox-gap: Space between checkbox and label (default: 0.5rem)
|
|
285
|
+
* - --checkbox-disabled-opacity: Opacity for disabled state (default: 0.6)
|
|
286
|
+
* - --checkbox-disabled-color: Label color when disabled (default: #6b7280)
|
|
287
|
+
* - --checkbox-label-fs: Label font size (default: 1rem)
|
|
288
|
+
* - --checkbox-label-lh: Label line height (default: 1.5)
|
|
289
|
+
* - --color-required: Required indicator color (default: #dc2626)
|
|
290
|
+
* - --checkbox-focus-ring-color: Focus ring color (default: #2563eb)
|
|
291
|
+
* - --checkbox-focus-ring-width: Focus ring width (default: 0.125rem)
|
|
292
|
+
* - --checkbox-focus-ring-offset: Focus ring offset (default: 0.125rem)
|
|
293
|
+
* - --checkbox-hover-label-color: Label color on hover
|
|
294
|
+
* - --checkbox-error-label-color: Label color when invalid (default: #dc2626)
|
|
295
|
+
* - --checkbox-valid-label-color: Label color when valid (default: #16a34a)
|
|
408
296
|
*
|
|
409
|
-
* @
|
|
410
|
-
*
|
|
411
|
-
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Checkbox
|
|
300
|
+
* id="custom"
|
|
301
|
+
* label="Custom styled"
|
|
302
|
+
* styles={{
|
|
303
|
+
* '--checkbox-gap': '1rem',
|
|
304
|
+
* '--checkbox-focus-ring-color': '#ff0000'
|
|
305
|
+
* }}
|
|
306
|
+
* />
|
|
307
|
+
* ```
|
|
412
308
|
*/
|
|
413
|
-
|
|
309
|
+
styles?: React$1.CSSProperties;
|
|
414
310
|
}
|
|
415
311
|
/**
|
|
416
|
-
* Checkbox - Accessible checkbox input with
|
|
312
|
+
* Checkbox - Accessible checkbox input with automatic label association
|
|
417
313
|
*
|
|
418
|
-
* A
|
|
419
|
-
*
|
|
314
|
+
* A thin wrapper around the Input component that provides a checkbox-specific API
|
|
315
|
+
* with simplified boolean onChange and automatic label rendering. Leverages all
|
|
316
|
+
* validation, disabled state, and ARIA logic from the base Input component.
|
|
420
317
|
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
* -
|
|
424
|
-
* -
|
|
425
|
-
* -
|
|
426
|
-
* -
|
|
427
|
-
* -
|
|
428
|
-
* -
|
|
429
|
-
* -
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
* ### WCAG 2.1 AA Compliance
|
|
434
|
-
*
|
|
435
|
-
* - **3.2.2 On Input (Level A)**: onChange events don't cause unexpected context changes
|
|
436
|
-
* - **4.1.2 Name, Role, Value (Level A)**: Proper ARIA attributes communicate state
|
|
437
|
-
* - **1.4.3 Contrast (Minimum) (Level AA)**: All color variants meet 4.5:1 contrast
|
|
438
|
-
* - **2.4.7 Focus Visible (Level AA)**: Clear focus indicators on keyboard navigation
|
|
439
|
-
*
|
|
440
|
-
* ### Best Practices
|
|
441
|
-
*
|
|
442
|
-
* 1. **Always provide labels**: Use `label` or `children` prop for accessible name
|
|
443
|
-
* 2. **Use semantic colors**: error variant for validation failures
|
|
444
|
-
* 3. **Provide descriptions**: Use `description` prop for additional context
|
|
445
|
-
* 4. **Group related checkboxes**: Use fieldset/legend for checkbox groups
|
|
446
|
-
* 5. **Don't mix modes**: Use either controlled or uncontrolled, not both
|
|
447
|
-
*
|
|
448
|
-
* ## Usage Examples
|
|
318
|
+
* **Key Features:**
|
|
319
|
+
* - ✅ Boolean onChange API (`onChange={(checked) => ...}`)
|
|
320
|
+
* - ✅ Automatic label association via htmlFor
|
|
321
|
+
* - ✅ WCAG 2.1 AA compliant (uses aria-disabled pattern)
|
|
322
|
+
* - ✅ Supports both controlled and uncontrolled modes
|
|
323
|
+
* - ✅ Required indicator with asterisk
|
|
324
|
+
* - ✅ Validation states (invalid, valid, none)
|
|
325
|
+
* - ✅ Error messages and hint text via Input component
|
|
326
|
+
* - ✅ Customizable via CSS custom properties
|
|
327
|
+
* - ✅ Keyboard accessible (Space to toggle)
|
|
328
|
+
* - ✅ Focus-visible indicators
|
|
329
|
+
* - ✅ High contrast mode support
|
|
449
330
|
*
|
|
331
|
+
* @component
|
|
450
332
|
* @example
|
|
333
|
+
* ```tsx
|
|
451
334
|
* // Basic checkbox
|
|
452
335
|
* <Checkbox id="terms" label="I accept the terms and conditions" />
|
|
336
|
+
* ```
|
|
453
337
|
*
|
|
454
338
|
* @example
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* id="newsletter"
|
|
459
|
-
* label="Subscribe to newsletter"
|
|
460
|
-
* checked={checked}
|
|
461
|
-
* onChange={(e) => setChecked(e.target.checked)}
|
|
462
|
-
* />
|
|
463
|
-
*
|
|
464
|
-
* @example
|
|
465
|
-
* // Checkbox with validation error
|
|
339
|
+
* ```tsx
|
|
340
|
+
* // Controlled checkbox with validation
|
|
341
|
+
* const [agreed, setAgreed] = useState(false);
|
|
466
342
|
* <Checkbox
|
|
467
|
-
* id="
|
|
468
|
-
* label="
|
|
343
|
+
* id="terms"
|
|
344
|
+
* label="I accept the terms"
|
|
345
|
+
* checked={agreed}
|
|
346
|
+
* onChange={setAgreed}
|
|
469
347
|
* required
|
|
470
|
-
* validationState="invalid"
|
|
471
|
-
* errorMessage="
|
|
472
|
-
* />
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* // Checkbox with description
|
|
476
|
-
* <Checkbox
|
|
477
|
-
* id="notifications"
|
|
478
|
-
* label="Enable notifications"
|
|
479
|
-
* description="Receive email notifications about important updates"
|
|
348
|
+
* validationState={agreed ? "valid" : "invalid"}
|
|
349
|
+
* errorMessage={!agreed ? "You must accept the terms" : undefined}
|
|
480
350
|
* />
|
|
351
|
+
* ```
|
|
481
352
|
*
|
|
482
353
|
* @example
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* const allSelected = selectedItems.length === totalItems;
|
|
486
|
-
* const someSelected = selectedItems.length > 0 && !allSelected;
|
|
487
|
-
*
|
|
354
|
+
* ```tsx
|
|
355
|
+
* // Disabled checkbox
|
|
488
356
|
* <Checkbox
|
|
489
|
-
* id="
|
|
490
|
-
* label="
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
* onChange={(e) => {
|
|
494
|
-
* if (e.target.checked) {
|
|
495
|
-
* setSelectedItems(allItemIds);
|
|
496
|
-
* } else {
|
|
497
|
-
* setSelectedItems([]);
|
|
498
|
-
* }
|
|
499
|
-
* }}
|
|
357
|
+
* id="disabled"
|
|
358
|
+
* label="Disabled option"
|
|
359
|
+
* disabled
|
|
360
|
+
* defaultChecked
|
|
500
361
|
* />
|
|
362
|
+
* ```
|
|
501
363
|
*
|
|
502
364
|
* @example
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
* <Checkbox id="md" label="Medium secondary" size="md" color="secondary" />
|
|
506
|
-
* <Checkbox id="lg" label="Large success" size="lg" color="success" />
|
|
507
|
-
*
|
|
508
|
-
* @example
|
|
509
|
-
* // Label positioning
|
|
510
|
-
* <Checkbox id="left" label="Label on left" labelPosition="left" />
|
|
511
|
-
* <Checkbox id="right" label="Label on right" labelPosition="right" />
|
|
512
|
-
*
|
|
513
|
-
* @example
|
|
514
|
-
* // Custom styling with CSS variables
|
|
365
|
+
* ```tsx
|
|
366
|
+
* // Custom styling
|
|
515
367
|
* <Checkbox
|
|
516
368
|
* id="custom"
|
|
517
|
-
* label="
|
|
518
|
-
* styles={{
|
|
519
|
-
* "--checkbox-size": "2rem",
|
|
520
|
-
* "--checkbox-checked-bg": "#7c3aed",
|
|
521
|
-
* "--checkbox-radius": "0.5rem",
|
|
522
|
-
* }}
|
|
369
|
+
* label="Large checkbox"
|
|
370
|
+
* styles={{ '--checkbox-gap': '1rem' }}
|
|
523
371
|
* />
|
|
372
|
+
* ```
|
|
524
373
|
*
|
|
525
374
|
* @param {CheckboxProps} props - Component props
|
|
526
|
-
* @
|
|
375
|
+
* @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the input element
|
|
376
|
+
* @returns {JSX.Element} Checkbox wrapper with input and label
|
|
527
377
|
*
|
|
528
|
-
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/
|
|
529
|
-
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/
|
|
530
|
-
* @see {@link https://www.w3.org/WAI/
|
|
378
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html|WCAG 4.1.2 Name, Role, Value}
|
|
379
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/focus-visible.html|WCAG 2.4.7 Focus Visible}
|
|
380
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html|WCAG 3.3.1 Error Identification}
|
|
531
381
|
*/
|
|
532
382
|
declare const Checkbox: React$1.ForwardRefExoticComponent<CheckboxProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
533
383
|
|
|
@@ -2901,4 +2751,4 @@ type FPComponent = {
|
|
|
2901
2751
|
*/
|
|
2902
2752
|
declare const FP: FPComponent;
|
|
2903
2753
|
|
|
2904
|
-
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Checkbox,
|
|
2754
|
+
export { Alert, AlertProps, Article, Aside, Badge, BadgeProps, Box, BoxProps, Caption, Checkbox, CheckboxProps, Cluster, ClusterProps, Col, ColProps, ComponentProps$1 as ComponentProps, Details, FP, Flex, FlexAlign, FlexAlignContent, FlexAlignSelf, FlexContainerElement, FlexDirection, FlexGap, FlexItemElement, FlexItemProps, FlexJustify, FlexProps, FlexSpacerProps, FlexVariant, FlexWrap, Footer, GridWithItem as Grid, GridItem, GridItemProps, GridProps, Header, Img, ImgProps, InputProps, Landmarks, Main, ResponsiveFlexProps, Row, RowProps, Section, Stack, StackProps, Table, Tag, TagProps, TagVariant, Tbody, Td, TextToSpeech, Thead, Tr, UI };
|