@common-origin/design-system 1.10.0 → 1.11.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/dist/components/molecules/Checkbox/Checkbox.d.ts +64 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.d.ts +33 -0
- package/dist/components/molecules/Checkbox/index.d.ts +3 -0
- package/dist/components/molecules/index.d.ts +1 -0
- package/dist/index.esm.js +261 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +260 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
3
|
+
/**
|
|
4
|
+
* The label text for the checkbox
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the checkbox is checked
|
|
9
|
+
*/
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the checkbox is in an indeterminate state
|
|
13
|
+
* Useful for "select all" scenarios where some but not all items are selected
|
|
14
|
+
*/
|
|
15
|
+
indeterminate?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Position of the label relative to the checkbox
|
|
18
|
+
* @default 'right'
|
|
19
|
+
*/
|
|
20
|
+
labelPosition?: 'left' | 'right';
|
|
21
|
+
/**
|
|
22
|
+
* Helper text displayed below the checkbox
|
|
23
|
+
*/
|
|
24
|
+
helperText?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Error message to display. When provided, checkbox enters error state
|
|
27
|
+
*/
|
|
28
|
+
error?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the checkbox is disabled
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Callback fired when the checkbox state changes
|
|
35
|
+
*/
|
|
36
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Additional ARIA description for accessibility
|
|
39
|
+
*/
|
|
40
|
+
'aria-describedby'?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checkbox component for binary selection with WCAG 2.2 AA compliance
|
|
44
|
+
*
|
|
45
|
+
* Features:
|
|
46
|
+
* - Custom styled checkbox with clear visual states
|
|
47
|
+
* - Integrated label with configurable positioning
|
|
48
|
+
* - Helper text and error messaging
|
|
49
|
+
* - Indeterminate state support
|
|
50
|
+
* - Full keyboard navigation (Space to toggle)
|
|
51
|
+
* - ARIA attributes for screen readers
|
|
52
|
+
* - 8px grid aligned (48px touch target)
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Checkbox
|
|
57
|
+
* label="Accept terms and conditions"
|
|
58
|
+
* checked={accepted}
|
|
59
|
+
* onChange={(e) => setAccepted(e.target.checked)}
|
|
60
|
+
* required
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type SelectableInputState = 'default' | 'error' | 'disabled';
|
|
3
|
+
interface StyledCheckboxInputProps {
|
|
4
|
+
$state: SelectableInputState;
|
|
5
|
+
$checked: boolean;
|
|
6
|
+
$indeterminate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hidden native checkbox input for accessibility
|
|
10
|
+
* Maintains keyboard navigation and screen reader support
|
|
11
|
+
*/
|
|
12
|
+
export declare const HiddenCheckboxInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, StyledCheckboxInputProps>> & string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom checkbox visual component
|
|
15
|
+
* 24px × 24px for 8px grid alignment
|
|
16
|
+
* Uses component.input.* tokens for consistency with TextField
|
|
17
|
+
*/
|
|
18
|
+
export declare const StyledCheckbox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledCheckboxInputProps>> & string;
|
|
19
|
+
/**
|
|
20
|
+
* Container for checkbox with proper spacing and alignment
|
|
21
|
+
* 48px min-height for touch target (8px grid aligned)
|
|
22
|
+
*/
|
|
23
|
+
export declare const StyledCheckboxContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
|
|
24
|
+
$disabled: boolean;
|
|
25
|
+
$labelPosition: 'left' | 'right';
|
|
26
|
+
}>> & string;
|
|
27
|
+
/**
|
|
28
|
+
* Label text with proper typography
|
|
29
|
+
*/
|
|
30
|
+
export declare const StyledCheckboxLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
31
|
+
$disabled: boolean;
|
|
32
|
+
}>> & string;
|
|
33
|
+
export {};
|