@a11ypros/a11y-ui-components 1.0.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/Button/Button.css +259 -0
- package/dist/components/Button/Button.d.ts +37 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +52 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/DataTable/DataTable.css +132 -0
- package/dist/components/DataTable/DataTable.d.ts +71 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +122 -0
- package/dist/components/DataTable/index.d.ts +3 -0
- package/dist/components/DataTable/index.d.ts.map +1 -0
- package/dist/components/DataTable/index.js +1 -0
- package/dist/components/Form/Checkbox.css +46 -0
- package/dist/components/Form/Checkbox.d.ts +36 -0
- package/dist/components/Form/Checkbox.d.ts.map +1 -0
- package/dist/components/Form/Checkbox.js +39 -0
- package/dist/components/Form/Fieldset.css +43 -0
- package/dist/components/Form/Fieldset.d.ts +33 -0
- package/dist/components/Form/Fieldset.d.ts.map +1 -0
- package/dist/components/Form/Fieldset.js +34 -0
- package/dist/components/Form/Input.css +76 -0
- package/dist/components/Form/Input.d.ts +37 -0
- package/dist/components/Form/Input.d.ts.map +1 -0
- package/dist/components/Form/Input.js +41 -0
- package/dist/components/Form/Label.css +13 -0
- package/dist/components/Form/Label.d.ts +30 -0
- package/dist/components/Form/Label.d.ts.map +1 -0
- package/dist/components/Form/Label.js +30 -0
- package/dist/components/Form/Radio.css +81 -0
- package/dist/components/Form/Radio.d.ts +53 -0
- package/dist/components/Form/Radio.d.ts.map +1 -0
- package/dist/components/Form/Radio.js +39 -0
- package/dist/components/Form/Select.css +69 -0
- package/dist/components/Form/Select.d.ts +51 -0
- package/dist/components/Form/Select.d.ts.map +1 -0
- package/dist/components/Form/Select.js +49 -0
- package/dist/components/Form/Textarea.css +79 -0
- package/dist/components/Form/Textarea.d.ts +44 -0
- package/dist/components/Form/Textarea.d.ts.map +1 -0
- package/dist/components/Form/Textarea.js +43 -0
- package/dist/components/Form/index.d.ts +8 -0
- package/dist/components/Form/index.d.ts.map +1 -0
- package/dist/components/Form/index.js +7 -0
- package/dist/components/Link/Link.css +70 -0
- package/dist/components/Link/Link.d.ts +34 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +48 -0
- package/dist/components/Link/index.d.ts +3 -0
- package/dist/components/Link/index.d.ts.map +1 -0
- package/dist/components/Link/index.js +1 -0
- package/dist/components/Modal/Modal.css +118 -0
- package/dist/components/Modal/Modal.d.ts +64 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +108 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Tabs/Tabs.css +132 -0
- package/dist/components/Tabs/Tabs.d.ts +63 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +134 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +1 -0
- package/dist/components/Toast/Toast.css +100 -0
- package/dist/components/Toast/Toast.d.ts +59 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.js +91 -0
- package/dist/components/Toast/ToastProvider.css +48 -0
- package/dist/components/Toast/ToastProvider.d.ts +22 -0
- package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/Toast/ToastProvider.js +33 -0
- package/dist/components/Toast/index.d.ts +5 -0
- package/dist/components/Toast/index.d.ts.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/hooks/useAriaLive.d.ts +9 -0
- package/dist/hooks/useAriaLive.d.ts.map +1 -0
- package/dist/hooks/useAriaLive.js +39 -0
- package/dist/hooks/useFocusReturn.d.ts +9 -0
- package/dist/hooks/useFocusReturn.d.ts.map +1 -0
- package/dist/hooks/useFocusReturn.js +33 -0
- package/dist/hooks/useFocusTrap.d.ts +9 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/hooks/useFocusTrap.js +68 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/styles/components.css +33 -0
- package/dist/styles/global.css +289 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/tokens/breakpoints.d.ts +25 -0
- package/dist/tokens/breakpoints.d.ts.map +1 -0
- package/dist/tokens/breakpoints.js +23 -0
- package/dist/tokens/colors.d.ts +81 -0
- package/dist/tokens/colors.d.ts.map +1 -0
- package/dist/tokens/colors.js +86 -0
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +5 -0
- package/dist/tokens/motion.d.ts +30 -0
- package/dist/tokens/motion.d.ts.map +1 -0
- package/dist/tokens/motion.js +34 -0
- package/dist/tokens/spacing.d.ts +22 -0
- package/dist/tokens/spacing.d.ts.map +1 -0
- package/dist/tokens/spacing.js +20 -0
- package/dist/tokens/theme.d.ts +159 -0
- package/dist/tokens/theme.d.ts.map +1 -0
- package/dist/tokens/theme.js +15 -0
- package/dist/tokens/typography.d.ts +45 -0
- package/dist/tokens/typography.d.ts.map +1 -0
- package/dist/tokens/typography.js +56 -0
- package/dist/utils/aria.d.ts +60 -0
- package/dist/utils/aria.d.ts.map +1 -0
- package/dist/utils/aria.js +86 -0
- package/dist/utils/focus.d.ts +30 -0
- package/dist/utils/focus.d.ts.map +1 -0
- package/dist/utils/focus.js +80 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/keyboard.d.ts +38 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/keyboard.js +59 -0
- package/package.json +68 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.form-select-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--spacing-2, 0.5rem);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.form-select {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: var(--spacing-3, 0.75rem) var(--spacing-4, 1rem);
|
|
10
|
+
padding-right: var(--spacing-10, 2.5rem);
|
|
11
|
+
font-size: var(--font-size-base, 1rem);
|
|
12
|
+
line-height: var(--line-height-normal, 1.5);
|
|
13
|
+
color: var(--color-text-primary, #171717);
|
|
14
|
+
background-color: var(--color-background-default, #ffffff);
|
|
15
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23525252' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
|
|
16
|
+
background-repeat: no-repeat;
|
|
17
|
+
background-position: right var(--spacing-3, 0.75rem) center;
|
|
18
|
+
background-size: 12px;
|
|
19
|
+
border: 1px solid var(--color-border-default, #bbbbbb);
|
|
20
|
+
border-radius: 0.375rem;
|
|
21
|
+
appearance: none;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
transition: border-color var(--motion-duration-normal, 200ms) var(--motion-easing-ease-out, cubic-bezier(0, 0, 0.2, 1));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Respect reduced motion */
|
|
27
|
+
@media (prefers-reduced-motion: reduce) {
|
|
28
|
+
.form-select {
|
|
29
|
+
transition: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.form-select:focus {
|
|
34
|
+
outline: none;
|
|
35
|
+
border-color: var(--color-border-focus, #0ea5e9);
|
|
36
|
+
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.form-select:focus-visible {
|
|
40
|
+
outline: 2px solid var(--color-border-focus, #0ea5e9);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.form-select--error {
|
|
45
|
+
border-color: var(--color-error-500, #ef4444);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.form-select--error:focus {
|
|
49
|
+
border-color: var(--color-error-500, #ef4444);
|
|
50
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.form-select--disabled {
|
|
54
|
+
opacity: 0.6;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
background-color: var(--color-background-secondary, #fafafa);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* High contrast mode support */
|
|
60
|
+
@media (prefers-contrast: high) {
|
|
61
|
+
.form-select {
|
|
62
|
+
border-width: 2px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.form-select:focus-visible {
|
|
66
|
+
outline-width: 3px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Select.css';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'children'> {
|
|
9
|
+
/**
|
|
10
|
+
* Options for the select
|
|
11
|
+
*/
|
|
12
|
+
options: SelectOption[];
|
|
13
|
+
/**
|
|
14
|
+
* Error message to display
|
|
15
|
+
*/
|
|
16
|
+
error?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Helper text to display below the select
|
|
19
|
+
*/
|
|
20
|
+
helperText?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Label for the select
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Placeholder option text
|
|
27
|
+
*/
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Accessible Select component
|
|
32
|
+
*
|
|
33
|
+
* WCAG Compliance:
|
|
34
|
+
* - 1.3.1 Info and Relationships: Proper label-select association
|
|
35
|
+
* - 2.1.1 Keyboard: Full keyboard navigation
|
|
36
|
+
* - 4.1.2 Name, Role, Value: Proper ARIA attributes
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Select
|
|
41
|
+
* id="country"
|
|
42
|
+
* label="Country"
|
|
43
|
+
* options={[
|
|
44
|
+
* { value: 'us', label: 'United States' },
|
|
45
|
+
* { value: 'ca', label: 'Canada' },
|
|
46
|
+
* ]}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
51
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAErB,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAClG;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAA;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,uFAgGlB,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { combineAriaDescribedBy } from '../../utils/aria';
|
|
5
|
+
import './Select.css';
|
|
6
|
+
/**
|
|
7
|
+
* Accessible Select component
|
|
8
|
+
*
|
|
9
|
+
* WCAG Compliance:
|
|
10
|
+
* - 1.3.1 Info and Relationships: Proper label-select association
|
|
11
|
+
* - 2.1.1 Keyboard: Full keyboard navigation
|
|
12
|
+
* - 4.1.2 Name, Role, Value: Proper ARIA attributes
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Select
|
|
17
|
+
* id="country"
|
|
18
|
+
* label="Country"
|
|
19
|
+
* options={[
|
|
20
|
+
* { value: 'us', label: 'United States' },
|
|
21
|
+
* { value: 'ca', label: 'Canada' },
|
|
22
|
+
* ]}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const Select = React.forwardRef(({ id, options, error, helperText, label, placeholder, className = '', 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
|
|
27
|
+
const selectId = React.useId();
|
|
28
|
+
const finalId = id || `select-${selectId}`;
|
|
29
|
+
const errorId = error ? `${finalId}-error` : undefined;
|
|
30
|
+
const helperId = helperText ? `${finalId}-helper` : undefined;
|
|
31
|
+
const describedBy = combineAriaDescribedBy(ariaDescribedBy, errorId, helperId);
|
|
32
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
33
|
+
// Arrow keys are handled natively by select
|
|
34
|
+
// But we can add custom handling if needed
|
|
35
|
+
if (props.onKeyDown) {
|
|
36
|
+
props.onKeyDown(event);
|
|
37
|
+
}
|
|
38
|
+
}, [props.onKeyDown]);
|
|
39
|
+
const classes = [
|
|
40
|
+
'form-select',
|
|
41
|
+
error && 'form-select--error',
|
|
42
|
+
props.disabled && 'form-select--disabled',
|
|
43
|
+
className,
|
|
44
|
+
]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join(' ');
|
|
47
|
+
return (_jsxs("div", { className: "form-select-wrapper", children: [label && (_jsxs("label", { htmlFor: finalId, className: "form-label", children: [label, props.required && (_jsxs("span", { className: "form-label__required", "aria-hidden": "true", children: [' ', "*"] }))] })), _jsxs("select", { ref: ref, id: finalId, className: classes, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy, onKeyDown: handleKeyDown, required: props.required ? true : undefined, ...props, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), options.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value)))] }), helperText && !error && (_jsx("span", { id: helperId, className: "form-helper-text", children: helperText })), error && (_jsx("span", { id: errorId, className: "form-error-text", role: "alert", children: error }))] }));
|
|
48
|
+
});
|
|
49
|
+
Select.displayName = 'Select';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.form-textarea-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--spacing-2, 0.5rem);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.form-textarea {
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-height: 6rem;
|
|
10
|
+
padding: var(--spacing-3, 0.75rem) var(--spacing-4, 1rem);
|
|
11
|
+
font-size: var(--font-size-base, 1rem);
|
|
12
|
+
line-height: var(--line-height-normal, 1.5);
|
|
13
|
+
font-family: var(--font-family-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
14
|
+
color: var(--color-text-primary, #171717);
|
|
15
|
+
background-color: var(--color-background-default, #ffffff);
|
|
16
|
+
border: 1px solid var(--color-border-default, #bbbbbb);
|
|
17
|
+
border-radius: 0.375rem;
|
|
18
|
+
resize: vertical;
|
|
19
|
+
transition: border-color var(--motion-duration-normal, 200ms) var(--motion-easing-ease-out, cubic-bezier(0, 0, 0.2, 1));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Respect reduced motion */
|
|
23
|
+
@media (prefers-reduced-motion: reduce) {
|
|
24
|
+
.form-textarea {
|
|
25
|
+
transition: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.form-textarea:focus {
|
|
30
|
+
outline: none;
|
|
31
|
+
border-color: var(--color-border-focus, #0ea5e9);
|
|
32
|
+
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.form-textarea:focus-visible {
|
|
36
|
+
outline: 2px solid var(--color-border-focus, #0ea5e9);
|
|
37
|
+
outline-offset: 2px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.form-textarea--error {
|
|
41
|
+
border-color: var(--color-error-500, #ef4444);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.form-textarea--error:focus {
|
|
45
|
+
border-color: var(--color-error-500, #ef4444);
|
|
46
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.form-textarea--disabled {
|
|
50
|
+
opacity: 0.6;
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
background-color: var(--color-background-secondary, #fafafa);
|
|
53
|
+
resize: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.form-textarea-footer {
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: var(--spacing-2, 0.5rem);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.form-character-count {
|
|
64
|
+
font-size: var(--font-size-sm, 0.875rem);
|
|
65
|
+
color: var(--color-text-secondary, #525252);
|
|
66
|
+
margin-left: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* High contrast mode support */
|
|
70
|
+
@media (prefers-contrast: high) {
|
|
71
|
+
.form-textarea {
|
|
72
|
+
border-width: 2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.form-textarea:focus-visible {
|
|
76
|
+
outline-width: 3px;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Textarea.css';
|
|
3
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Error message to display
|
|
6
|
+
*/
|
|
7
|
+
error?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Helper text to display below the textarea
|
|
10
|
+
*/
|
|
11
|
+
helperText?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Label for the textarea
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum character count (shows counter)
|
|
18
|
+
*/
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to show character count
|
|
22
|
+
*/
|
|
23
|
+
showCount?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Accessible Textarea component
|
|
27
|
+
*
|
|
28
|
+
* WCAG Compliance:
|
|
29
|
+
* - 1.3.1 Info and Relationships: Proper label-textarea association
|
|
30
|
+
* - 4.1.2 Name, Role, Value: Proper ARIA attributes
|
|
31
|
+
* - 4.1.3 Status Messages: Error messages announced
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Textarea
|
|
36
|
+
* id="message"
|
|
37
|
+
* label="Message"
|
|
38
|
+
* maxLength={500}
|
|
39
|
+
* showCount
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
44
|
+
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,gBAAgB,CAAA;AAEvB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC;IACtF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,2FA0FpB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { combineAriaDescribedBy } from '../../utils/aria';
|
|
5
|
+
import './Textarea.css';
|
|
6
|
+
/**
|
|
7
|
+
* Accessible Textarea component
|
|
8
|
+
*
|
|
9
|
+
* WCAG Compliance:
|
|
10
|
+
* - 1.3.1 Info and Relationships: Proper label-textarea association
|
|
11
|
+
* - 4.1.2 Name, Role, Value: Proper ARIA attributes
|
|
12
|
+
* - 4.1.3 Status Messages: Error messages announced
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Textarea
|
|
17
|
+
* id="message"
|
|
18
|
+
* label="Message"
|
|
19
|
+
* maxLength={500}
|
|
20
|
+
* showCount
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const Textarea = React.forwardRef(({ id, error, helperText, label, maxLength, showCount = false, className = '', value, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
|
|
25
|
+
const textareaId = React.useId();
|
|
26
|
+
const finalId = id || `textarea-${textareaId}`;
|
|
27
|
+
const errorId = error ? `${finalId}-error` : undefined;
|
|
28
|
+
const helperId = helperText ? `${finalId}-helper` : undefined;
|
|
29
|
+
const countId = showCount ? `${finalId}-count` : undefined;
|
|
30
|
+
const describedBy = combineAriaDescribedBy(ariaDescribedBy, errorId, helperId, countId);
|
|
31
|
+
const currentLength = typeof value === 'string' ? value.length : 0;
|
|
32
|
+
const remainingChars = maxLength ? maxLength - currentLength : undefined;
|
|
33
|
+
const classes = [
|
|
34
|
+
'form-textarea',
|
|
35
|
+
error && 'form-textarea--error',
|
|
36
|
+
props.disabled && 'form-textarea--disabled',
|
|
37
|
+
className,
|
|
38
|
+
]
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.join(' ');
|
|
41
|
+
return (_jsxs("div", { className: "form-textarea-wrapper", children: [label && (_jsxs("label", { htmlFor: finalId, className: "form-label", children: [label, props.required && (_jsxs("span", { className: "form-label__required", "aria-hidden": "true", children: [' ', "*"] }))] })), _jsx("textarea", { ref: ref, id: finalId, className: classes, maxLength: maxLength, value: value, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy, required: props.required ? true : undefined, ...props }), (showCount || helperText) && (_jsxs("div", { className: "form-textarea-footer", children: [helperText && !error && (_jsx("span", { id: helperId, className: "form-helper-text", children: helperText })), error && (_jsx("span", { id: errorId, className: "form-error-text", role: "alert", children: error })), showCount && maxLength && (_jsxs("span", { id: countId, className: "form-character-count", "aria-live": "polite", children: [currentLength, " / ", maxLength] }))] }))] }));
|
|
42
|
+
});
|
|
43
|
+
Textarea.displayName = 'Textarea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* Link component styles */
|
|
2
|
+
.link {
|
|
3
|
+
color: var(--color-primary-700, #0369a1);
|
|
4
|
+
text-decoration: underline;
|
|
5
|
+
text-underline-offset: 0.125em;
|
|
6
|
+
transition: color var(--motion-duration-normal, 200ms) var(--motion-easing-ease-out, cubic-bezier(0, 0, 0.2, 1));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Respect reduced motion */
|
|
10
|
+
@media (prefers-reduced-motion: reduce) {
|
|
11
|
+
.link {
|
|
12
|
+
transition: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Focus styles - WCAG 2.4.7 Focus Visible */
|
|
17
|
+
.link:focus-visible {
|
|
18
|
+
outline: 2px solid var(--color-border-focus, #0ea5e9);
|
|
19
|
+
outline-offset: 2px;
|
|
20
|
+
border-radius: 2px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.link:focus:not(:focus-visible) {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Hover state */
|
|
28
|
+
.link:hover:not(:disabled) {
|
|
29
|
+
color: var(--color-primary-800, #075985);
|
|
30
|
+
text-decoration-thickness: 2px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* High contrast mode support */
|
|
34
|
+
@media (prefers-contrast: high) {
|
|
35
|
+
.link {
|
|
36
|
+
text-decoration-thickness: 2px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.link:focus-visible {
|
|
40
|
+
outline-width: 3px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Skip link styles (for keyboard navigation) */
|
|
45
|
+
.link--skip {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: -100px;
|
|
48
|
+
left: 0;
|
|
49
|
+
z-index: 1000;
|
|
50
|
+
padding: var(--spacing-3, 0.75rem) var(--spacing-4, 1rem);
|
|
51
|
+
background-color: var(--color-background-default, #ffffff);
|
|
52
|
+
color: var(--color-text-primary, #171717);
|
|
53
|
+
border: 2px solid var(--color-border-focus, #0ea5e9);
|
|
54
|
+
border-radius: 0.375rem;
|
|
55
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
56
|
+
text-decoration: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.link--skip:focus {
|
|
60
|
+
top: var(--spacing-4, 1rem);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* External link icon */
|
|
64
|
+
.link__external-icon {
|
|
65
|
+
display: inline-block;
|
|
66
|
+
margin-left: 0.25em;
|
|
67
|
+
font-size: 0.875em;
|
|
68
|
+
vertical-align: baseline;
|
|
69
|
+
}
|
|
70
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Link.css';
|
|
3
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether this is an external link
|
|
6
|
+
* Automatically adds rel="noopener noreferrer" for security
|
|
7
|
+
*/
|
|
8
|
+
external?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether this is a skip link (for keyboard navigation)
|
|
11
|
+
*/
|
|
12
|
+
skip?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* ARIA label for the link (required if no visible text)
|
|
15
|
+
*/
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Accessible Link component
|
|
20
|
+
*
|
|
21
|
+
* WCAG Compliance:
|
|
22
|
+
* - 2.4.4 Link Purpose: Clear link text or aria-label
|
|
23
|
+
* - 2.4.7 Focus Visible: Clear focus indicators
|
|
24
|
+
* - 4.1.2 Name, Role, Value: Proper semantic HTML
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Link href="/about" external>
|
|
29
|
+
* Learn more
|
|
30
|
+
* </Link>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
34
|
+
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,YAAY,CAAA;AAEnB,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,qFA2EhB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import './Link.css';
|
|
5
|
+
/**
|
|
6
|
+
* Accessible Link component
|
|
7
|
+
*
|
|
8
|
+
* WCAG Compliance:
|
|
9
|
+
* - 2.4.4 Link Purpose: Clear link text or aria-label
|
|
10
|
+
* - 2.4.7 Focus Visible: Clear focus indicators
|
|
11
|
+
* - 4.1.2 Name, Role, Value: Proper semantic HTML
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Link href="/about" external>
|
|
16
|
+
* Learn more
|
|
17
|
+
* </Link>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const Link = React.forwardRef(({ external = false, skip = false, href, rel, target, className = '', children, 'aria-label': ariaLabel, ...props }, ref) => {
|
|
21
|
+
// Determine if link is external based on href or explicit prop
|
|
22
|
+
const isExternal = external ||
|
|
23
|
+
(href && (href.startsWith('http') || href.startsWith('//')));
|
|
24
|
+
// Build rel attribute
|
|
25
|
+
const relAttributes = React.useMemo(() => {
|
|
26
|
+
const attrs = new Set(rel?.split(' ') || []);
|
|
27
|
+
if (isExternal) {
|
|
28
|
+
attrs.add('noopener');
|
|
29
|
+
attrs.add('noreferrer');
|
|
30
|
+
}
|
|
31
|
+
return Array.from(attrs).join(' ');
|
|
32
|
+
}, [isExternal, rel]);
|
|
33
|
+
// Set target for external links
|
|
34
|
+
const linkTarget = isExternal && !target ? '_blank' : target;
|
|
35
|
+
const classes = [
|
|
36
|
+
'link',
|
|
37
|
+
skip && 'link--skip',
|
|
38
|
+
className,
|
|
39
|
+
]
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.join(' ');
|
|
42
|
+
// Skip links should use button semantics if no href
|
|
43
|
+
if (skip && !href) {
|
|
44
|
+
return (_jsx("button", { ref: ref, className: classes, "aria-label": ariaLabel, ...props, children: children }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs("a", { ref: ref, href: href, rel: relAttributes || undefined, target: linkTarget, className: classes, "aria-label": ariaLabel, ...props, children: [children, isExternal && (_jsxs("span", { className: "link__external-icon", "aria-hidden": "true", children: [' ', _jsx("span", { "aria-label": "(opens in new tab)", children: "\u2197" })] }))] }));
|
|
47
|
+
});
|
|
48
|
+
Link.displayName = 'Link';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Link } from './Link';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* Dialog backdrop (native HTML5 dialog element) */
|
|
2
|
+
.modal::backdrop {
|
|
3
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
4
|
+
backdrop-filter: blur(2px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.modal {
|
|
8
|
+
background-color: var(--color-background-default, #ffffff);
|
|
9
|
+
border-radius: 0.5rem;
|
|
10
|
+
border: none;
|
|
11
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
12
|
+
max-height: 90vh;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
max-width: 90vw;
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: 0;
|
|
18
|
+
margin: auto;
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.modal:not([open]) {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.modal--sm {
|
|
28
|
+
max-width: 24rem; /* 384px */
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.modal--md {
|
|
32
|
+
max-width: 32rem; /* 512px */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.modal--lg {
|
|
36
|
+
max-width: 48rem; /* 768px */
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.modal--full {
|
|
40
|
+
max-width: 90vw;
|
|
41
|
+
max-height: 90vh;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.modal-header {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
padding: var(--spacing-4, 1rem) var(--spacing-6, 1.5rem);
|
|
49
|
+
border-bottom: 1px solid var(--color-border-default, #bbbbbb);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.modal-title {
|
|
53
|
+
margin: 0;
|
|
54
|
+
font-size: var(--font-size-xl, 1.25rem);
|
|
55
|
+
font-weight: var(--font-weight-semibold, 600);
|
|
56
|
+
color: var(--color-text-primary, #171717);
|
|
57
|
+
line-height: var(--line-height-tight, 1.25);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.modal-close {
|
|
61
|
+
margin-left: var(--spacing-4, 1rem);
|
|
62
|
+
font-size: var(--font-size-2xl, 1.5rem);
|
|
63
|
+
line-height: 1;
|
|
64
|
+
padding: var(--spacing-1, 0.25rem);
|
|
65
|
+
min-width: auto;
|
|
66
|
+
width: 2rem;
|
|
67
|
+
height: 2rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.modal-content-wrapper {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
max-height: 90vh;
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.modal-content {
|
|
78
|
+
padding: var(--spacing-6, 1.5rem);
|
|
79
|
+
overflow-y: auto;
|
|
80
|
+
flex: 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Focus styles */
|
|
84
|
+
.modal:focus {
|
|
85
|
+
outline: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.modal:focus-visible {
|
|
89
|
+
outline: 2px solid var(--color-border-focus, #0ea5e9);
|
|
90
|
+
outline-offset: 2px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* High contrast mode support */
|
|
94
|
+
@media (prefers-contrast: high) {
|
|
95
|
+
.modal::backdrop {
|
|
96
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.modal {
|
|
100
|
+
border: 2px solid var(--color-text-primary, #171717);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.modal:focus-visible {
|
|
104
|
+
outline-width: 3px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Reduced motion */
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
.modal {
|
|
111
|
+
animation: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.modal::backdrop {
|
|
115
|
+
animation: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|