@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.
Files changed (128) hide show
  1. package/dist/components/Button/Button.css +259 -0
  2. package/dist/components/Button/Button.d.ts +37 -0
  3. package/dist/components/Button/Button.d.ts.map +1 -0
  4. package/dist/components/Button/Button.js +52 -0
  5. package/dist/components/Button/index.d.ts +3 -0
  6. package/dist/components/Button/index.d.ts.map +1 -0
  7. package/dist/components/Button/index.js +1 -0
  8. package/dist/components/DataTable/DataTable.css +132 -0
  9. package/dist/components/DataTable/DataTable.d.ts +71 -0
  10. package/dist/components/DataTable/DataTable.d.ts.map +1 -0
  11. package/dist/components/DataTable/DataTable.js +122 -0
  12. package/dist/components/DataTable/index.d.ts +3 -0
  13. package/dist/components/DataTable/index.d.ts.map +1 -0
  14. package/dist/components/DataTable/index.js +1 -0
  15. package/dist/components/Form/Checkbox.css +46 -0
  16. package/dist/components/Form/Checkbox.d.ts +36 -0
  17. package/dist/components/Form/Checkbox.d.ts.map +1 -0
  18. package/dist/components/Form/Checkbox.js +39 -0
  19. package/dist/components/Form/Fieldset.css +43 -0
  20. package/dist/components/Form/Fieldset.d.ts +33 -0
  21. package/dist/components/Form/Fieldset.d.ts.map +1 -0
  22. package/dist/components/Form/Fieldset.js +34 -0
  23. package/dist/components/Form/Input.css +76 -0
  24. package/dist/components/Form/Input.d.ts +37 -0
  25. package/dist/components/Form/Input.d.ts.map +1 -0
  26. package/dist/components/Form/Input.js +41 -0
  27. package/dist/components/Form/Label.css +13 -0
  28. package/dist/components/Form/Label.d.ts +30 -0
  29. package/dist/components/Form/Label.d.ts.map +1 -0
  30. package/dist/components/Form/Label.js +30 -0
  31. package/dist/components/Form/Radio.css +81 -0
  32. package/dist/components/Form/Radio.d.ts +53 -0
  33. package/dist/components/Form/Radio.d.ts.map +1 -0
  34. package/dist/components/Form/Radio.js +39 -0
  35. package/dist/components/Form/Select.css +69 -0
  36. package/dist/components/Form/Select.d.ts +51 -0
  37. package/dist/components/Form/Select.d.ts.map +1 -0
  38. package/dist/components/Form/Select.js +49 -0
  39. package/dist/components/Form/Textarea.css +79 -0
  40. package/dist/components/Form/Textarea.d.ts +44 -0
  41. package/dist/components/Form/Textarea.d.ts.map +1 -0
  42. package/dist/components/Form/Textarea.js +43 -0
  43. package/dist/components/Form/index.d.ts +8 -0
  44. package/dist/components/Form/index.d.ts.map +1 -0
  45. package/dist/components/Form/index.js +7 -0
  46. package/dist/components/Link/Link.css +70 -0
  47. package/dist/components/Link/Link.d.ts +34 -0
  48. package/dist/components/Link/Link.d.ts.map +1 -0
  49. package/dist/components/Link/Link.js +48 -0
  50. package/dist/components/Link/index.d.ts +3 -0
  51. package/dist/components/Link/index.d.ts.map +1 -0
  52. package/dist/components/Link/index.js +1 -0
  53. package/dist/components/Modal/Modal.css +118 -0
  54. package/dist/components/Modal/Modal.d.ts +64 -0
  55. package/dist/components/Modal/Modal.d.ts.map +1 -0
  56. package/dist/components/Modal/Modal.js +108 -0
  57. package/dist/components/Modal/index.d.ts +3 -0
  58. package/dist/components/Modal/index.d.ts.map +1 -0
  59. package/dist/components/Modal/index.js +1 -0
  60. package/dist/components/Tabs/Tabs.css +132 -0
  61. package/dist/components/Tabs/Tabs.d.ts +63 -0
  62. package/dist/components/Tabs/Tabs.d.ts.map +1 -0
  63. package/dist/components/Tabs/Tabs.js +134 -0
  64. package/dist/components/Tabs/index.d.ts +3 -0
  65. package/dist/components/Tabs/index.d.ts.map +1 -0
  66. package/dist/components/Tabs/index.js +1 -0
  67. package/dist/components/Toast/Toast.css +100 -0
  68. package/dist/components/Toast/Toast.d.ts +59 -0
  69. package/dist/components/Toast/Toast.d.ts.map +1 -0
  70. package/dist/components/Toast/Toast.js +91 -0
  71. package/dist/components/Toast/ToastProvider.css +48 -0
  72. package/dist/components/Toast/ToastProvider.d.ts +22 -0
  73. package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
  74. package/dist/components/Toast/ToastProvider.js +33 -0
  75. package/dist/components/Toast/index.d.ts +5 -0
  76. package/dist/components/Toast/index.d.ts.map +1 -0
  77. package/dist/components/Toast/index.js +2 -0
  78. package/dist/hooks/useAriaLive.d.ts +9 -0
  79. package/dist/hooks/useAriaLive.d.ts.map +1 -0
  80. package/dist/hooks/useAriaLive.js +39 -0
  81. package/dist/hooks/useFocusReturn.d.ts +9 -0
  82. package/dist/hooks/useFocusReturn.d.ts.map +1 -0
  83. package/dist/hooks/useFocusReturn.js +33 -0
  84. package/dist/hooks/useFocusTrap.d.ts +9 -0
  85. package/dist/hooks/useFocusTrap.d.ts.map +1 -0
  86. package/dist/hooks/useFocusTrap.js +68 -0
  87. package/dist/index.d.ts +22 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +25 -0
  90. package/dist/styles/components.css +33 -0
  91. package/dist/styles/global.css +289 -0
  92. package/dist/styles/index.d.ts +3 -0
  93. package/dist/styles/index.d.ts.map +1 -0
  94. package/dist/styles/index.js +1 -0
  95. package/dist/tokens/breakpoints.d.ts +25 -0
  96. package/dist/tokens/breakpoints.d.ts.map +1 -0
  97. package/dist/tokens/breakpoints.js +23 -0
  98. package/dist/tokens/colors.d.ts +81 -0
  99. package/dist/tokens/colors.d.ts.map +1 -0
  100. package/dist/tokens/colors.js +86 -0
  101. package/dist/tokens/index.d.ts +6 -0
  102. package/dist/tokens/index.d.ts.map +1 -0
  103. package/dist/tokens/index.js +5 -0
  104. package/dist/tokens/motion.d.ts +30 -0
  105. package/dist/tokens/motion.d.ts.map +1 -0
  106. package/dist/tokens/motion.js +34 -0
  107. package/dist/tokens/spacing.d.ts +22 -0
  108. package/dist/tokens/spacing.d.ts.map +1 -0
  109. package/dist/tokens/spacing.js +20 -0
  110. package/dist/tokens/theme.d.ts +159 -0
  111. package/dist/tokens/theme.d.ts.map +1 -0
  112. package/dist/tokens/theme.js +15 -0
  113. package/dist/tokens/typography.d.ts +45 -0
  114. package/dist/tokens/typography.d.ts.map +1 -0
  115. package/dist/tokens/typography.js +56 -0
  116. package/dist/utils/aria.d.ts +60 -0
  117. package/dist/utils/aria.d.ts.map +1 -0
  118. package/dist/utils/aria.js +86 -0
  119. package/dist/utils/focus.d.ts +30 -0
  120. package/dist/utils/focus.d.ts.map +1 -0
  121. package/dist/utils/focus.js +80 -0
  122. package/dist/utils/index.d.ts +4 -0
  123. package/dist/utils/index.d.ts.map +1 -0
  124. package/dist/utils/index.js +3 -0
  125. package/dist/utils/keyboard.d.ts +38 -0
  126. package/dist/utils/keyboard.d.ts.map +1 -0
  127. package/dist/utils/keyboard.js +59 -0
  128. package/package.json +68 -0
@@ -0,0 +1,3 @@
1
+ export { DataTable } from './DataTable';
2
+ export type { DataTableProps, DataTableColumn } from './DataTable';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1 @@
1
+ export { DataTable } from './DataTable';
@@ -0,0 +1,46 @@
1
+ .form-checkbox-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--spacing-2, 0.5rem);
5
+ }
6
+
7
+ .form-checkbox-input-wrapper {
8
+ display: flex;
9
+ align-items: flex-start;
10
+ gap: var(--spacing-2, 0.5rem);
11
+ }
12
+
13
+ .form-checkbox {
14
+ width: 1.25rem;
15
+ height: 1.25rem;
16
+ margin-top: 0.125rem;
17
+ cursor: pointer;
18
+ accent-color: var(--color-primary-500, #0ea5e9);
19
+ flex-shrink: 0;
20
+ }
21
+
22
+ .form-checkbox:focus-visible {
23
+ outline: 2px solid var(--color-border-focus, #0ea5e9);
24
+ outline-offset: 2px;
25
+ border-radius: 2px;
26
+ }
27
+
28
+ .form-checkbox-label {
29
+ font-size: var(--font-size-base, 1rem);
30
+ line-height: var(--line-height-normal, 1.5);
31
+ color: var(--color-text-primary, #171717);
32
+ cursor: pointer;
33
+ user-select: none;
34
+ }
35
+
36
+ .form-checkbox--error {
37
+ accent-color: var(--color-error-500, #ef4444);
38
+ }
39
+
40
+ /* High contrast mode support */
41
+ @media (prefers-contrast: high) {
42
+ .form-checkbox:focus-visible {
43
+ outline-width: 3px;
44
+ }
45
+ }
46
+
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import './Checkbox.css';
3
+ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
+ /**
5
+ * Label for the checkbox
6
+ */
7
+ label?: string;
8
+ /**
9
+ * Error message to display
10
+ */
11
+ error?: string;
12
+ /**
13
+ * Helper text to display
14
+ */
15
+ helperText?: string;
16
+ }
17
+ /**
18
+ * Accessible Checkbox component
19
+ *
20
+ * WCAG Compliance:
21
+ * - 1.3.1 Info and Relationships: Proper label-input association
22
+ * - 2.5.3 Label in Name: Label text matches accessible name
23
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * <Checkbox
28
+ * id="agree"
29
+ * label="I agree to the terms"
30
+ * checked={checked}
31
+ * onChange={handleChange}
32
+ * />
33
+ * ```
34
+ */
35
+ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
36
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,gBAAgB,CAAA;AAEvB,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC9F;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,wFAqEpB,CAAA"}
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { combineAriaDescribedBy } from '../../utils/aria';
5
+ import './Checkbox.css';
6
+ /**
7
+ * Accessible Checkbox component
8
+ *
9
+ * WCAG Compliance:
10
+ * - 1.3.1 Info and Relationships: Proper label-input association
11
+ * - 2.5.3 Label in Name: Label text matches accessible name
12
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <Checkbox
17
+ * id="agree"
18
+ * label="I agree to the terms"
19
+ * checked={checked}
20
+ * onChange={handleChange}
21
+ * />
22
+ * ```
23
+ */
24
+ export const Checkbox = React.forwardRef(({ id, label, error, helperText, className = '', 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
25
+ const checkboxId = React.useId();
26
+ const finalId = id || `checkbox-${checkboxId}`;
27
+ const errorId = error ? `${finalId}-error` : undefined;
28
+ const helperId = helperText ? `${finalId}-helper` : undefined;
29
+ const describedBy = combineAriaDescribedBy(ariaDescribedBy, errorId, helperId);
30
+ const classes = [
31
+ 'form-checkbox',
32
+ error && 'form-checkbox--error',
33
+ className,
34
+ ]
35
+ .filter(Boolean)
36
+ .join(' ');
37
+ return (_jsxs("div", { className: "form-checkbox-wrapper", children: [_jsxs("div", { className: "form-checkbox-input-wrapper", children: [_jsx("input", { ref: ref, id: finalId, type: "checkbox", className: classes, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy, required: props.required ? true : undefined, ...props }), label && (_jsxs("label", { htmlFor: finalId, className: "form-checkbox-label", children: [label, props.required && (_jsxs("span", { className: "form-label__required", "aria-hidden": "true", 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 }))] }));
38
+ });
39
+ Checkbox.displayName = 'Checkbox';
@@ -0,0 +1,43 @@
1
+ .form-fieldset {
2
+ border: 1px solid var(--color-border-default, #bbbbbb);
3
+ border-radius: 0.375rem;
4
+ padding: var(--spacing-4, 1rem);
5
+ margin: 0;
6
+ }
7
+
8
+ .fieldset__required {
9
+ font-size: var(--font-size-sm, 0.875rem);
10
+ font-weight: var(--font-weight-normal, 400);
11
+ color: var(--color-text-secondary, #6b7280);
12
+ margin-block-end: var(--spacing-3, 0.75rem);
13
+ }
14
+
15
+ .fieldset__required-indicator {
16
+ color: var(--color-error-500, #ef4444);
17
+ }
18
+ .form-legend {
19
+ font-size: var(--font-size-base, 1rem);
20
+ font-weight: var(--font-weight-semibold, 600);
21
+ color: var(--color-text-primary, #171717);
22
+ padding: 0 var(--spacing-2, 0.5rem);
23
+ }
24
+
25
+ .form-legend--hidden {
26
+ position: absolute;
27
+ width: 1px;
28
+ height: 1px;
29
+ padding: 0;
30
+ margin: -1px;
31
+ overflow: hidden;
32
+ clip: rect(0, 0, 0, 0);
33
+ white-space: nowrap;
34
+ border-width: 0;
35
+ }
36
+
37
+ /* High contrast mode support */
38
+ @media (prefers-contrast: high) {
39
+ .form-fieldset {
40
+ border-width: 2px;
41
+ }
42
+ }
43
+
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import './Fieldset.css';
3
+ export interface FieldsetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {
4
+ /**
5
+ * Legend text for the fieldset
6
+ */
7
+ legend?: string;
8
+ /**
9
+ * Whether the legend is visually hidden (but still accessible)
10
+ */
11
+ legendHidden?: boolean;
12
+ /**
13
+ * Whether to show a required field explanation. Use this if the fieldset contains required fields.
14
+ */
15
+ required?: boolean;
16
+ }
17
+ /**
18
+ * Accessible Fieldset component
19
+ *
20
+ * WCAG Compliance:
21
+ * - 1.3.1 Info and Relationships: Proper fieldset/legend structure
22
+ * - 4.1.2 Name, Role, Value: Proper semantic HTML
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <Fieldset legend="Shipping Address">
27
+ * <Input label="Street" />
28
+ * <Input label="City" />
29
+ * </Fieldset>
30
+ * ```
31
+ */
32
+ export declare const Fieldset: React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<HTMLFieldSetElement>>;
33
+ //# sourceMappingURL=Fieldset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Fieldset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,gBAAgB,CAAA;AAEvB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC;IACtF;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,2FAgCpB,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import './Fieldset.css';
4
+ /**
5
+ * Accessible Fieldset component
6
+ *
7
+ * WCAG Compliance:
8
+ * - 1.3.1 Info and Relationships: Proper fieldset/legend structure
9
+ * - 4.1.2 Name, Role, Value: Proper semantic HTML
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <Fieldset legend="Shipping Address">
14
+ * <Input label="Street" />
15
+ * <Input label="City" />
16
+ * </Fieldset>
17
+ * ```
18
+ */
19
+ export const Fieldset = React.forwardRef(({ legend, legendHidden = false, required = false, className = '', children, ...props }, ref) => {
20
+ const classes = [
21
+ 'form-fieldset',
22
+ className,
23
+ ]
24
+ .filter(Boolean)
25
+ .join(' ');
26
+ const legendClasses = [
27
+ 'form-legend',
28
+ legendHidden && 'form-legend--hidden',
29
+ ]
30
+ .filter(Boolean)
31
+ .join(' ');
32
+ return (_jsxs("fieldset", { ref: ref, className: classes, ...props, children: [legend && (_jsx("legend", { className: legendClasses, children: legend })), required && (_jsxs("p", { className: "fieldset__required", children: [' ', _jsx("span", { className: 'fieldset__required-indicator', children: "*" }), " indicates a required field."] })), children] }));
33
+ });
34
+ Fieldset.displayName = 'Fieldset';
@@ -0,0 +1,76 @@
1
+ .form-input-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--spacing-2, 0.5rem);
5
+ margin-block-end: var(--spacing-3, 0.75rem);
6
+ }
7
+
8
+ .form-input {
9
+ width: 100%;
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
+ color: var(--color-text-primary, #171717);
14
+ background-color: var(--color-background-default, #ffffff);
15
+ border: 1px solid var(--color-border-default, #bbbbbb);
16
+ border-radius: 0.375rem;
17
+ transition: border-color var(--motion-duration-normal, 200ms) var(--motion-easing-ease-out, cubic-bezier(0, 0, 0.2, 1));
18
+ }
19
+
20
+ /* Respect reduced motion */
21
+ @media (prefers-reduced-motion: reduce) {
22
+ .form-input {
23
+ transition: none;
24
+ }
25
+ }
26
+
27
+ .form-input:focus {
28
+ outline: none;
29
+ border-color: var(--color-border-focus, #0ea5e9);
30
+ box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
31
+ }
32
+
33
+ .form-input:focus-visible {
34
+ outline: 2px solid var(--color-border-focus, #0ea5e9);
35
+ outline-offset: 2px;
36
+ }
37
+
38
+ .form-input--error {
39
+ border-color: var(--color-error-500, #ef4444);
40
+ }
41
+
42
+ .form-input--error:focus {
43
+ border-color: var(--color-error-500, #ef4444);
44
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
45
+ box-shadow: 0 0 0 2px var(--color-background-default, #ffffff), 0 0 0 4px var(--color-error-500, #ef4444);
46
+ outline: none;
47
+ }
48
+
49
+ .form-input--disabled {
50
+ opacity: 0.6;
51
+ cursor: not-allowed;
52
+ background-color: var(--color-background-secondary, #fafafa);
53
+ }
54
+
55
+ .form-helper-text {
56
+ font-size: var(--font-size-sm, 0.875rem);
57
+ color: var(--color-text-secondary, #525252);
58
+ }
59
+
60
+ .form-error-text {
61
+ font-size: var(--font-size-sm, 0.875rem);
62
+ color: var(--color-error-600, #dc2626);
63
+ font-weight: var(--font-weight-medium, 500);
64
+ }
65
+
66
+ /* High contrast mode support */
67
+ @media (prefers-contrast: high) {
68
+ .form-input {
69
+ border-width: 2px;
70
+ }
71
+
72
+ .form-input:focus-visible {
73
+ outline-width: 3px;
74
+ }
75
+ }
76
+
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import './Input.css';
3
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
+ /**
5
+ * Error message to display
6
+ */
7
+ error?: string;
8
+ /**
9
+ * Helper text to display below the input
10
+ */
11
+ helperText?: string;
12
+ /**
13
+ * Label for the input (creates associated label)
14
+ */
15
+ label?: string;
16
+ }
17
+ /**
18
+ * Accessible Input component
19
+ *
20
+ * WCAG Compliance:
21
+ * - 1.3.1 Info and Relationships: Proper label-input association
22
+ * - 2.5.3 Label in Name: Label text matches accessible name
23
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
24
+ * - 4.1.3 Status Messages: Error messages announced
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <Input
29
+ * id="email"
30
+ * type="email"
31
+ * label="Email address"
32
+ * error="Please enter a valid email"
33
+ * />
34
+ * ```
35
+ */
36
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
37
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAEpB,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IAC7E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,qFAmEjB,CAAA"}
@@ -0,0 +1,41 @@
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 './Input.css';
6
+ /**
7
+ * Accessible Input component
8
+ *
9
+ * WCAG Compliance:
10
+ * - 1.3.1 Info and Relationships: Proper label-input association
11
+ * - 2.5.3 Label in Name: Label text matches accessible name
12
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
13
+ * - 4.1.3 Status Messages: Error messages announced
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <Input
18
+ * id="email"
19
+ * type="email"
20
+ * label="Email address"
21
+ * error="Please enter a valid email"
22
+ * />
23
+ * ```
24
+ */
25
+ export const Input = React.forwardRef(({ id, error, helperText, label, className = '', 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
26
+ const inputId = React.useId();
27
+ const finalId = id || `input-${inputId}`;
28
+ const errorId = error ? `${finalId}-error` : undefined;
29
+ const helperId = helperText ? `${finalId}-helper` : undefined;
30
+ const describedBy = combineAriaDescribedBy(ariaDescribedBy, errorId, helperId);
31
+ const classes = [
32
+ 'form-input',
33
+ error && 'form-input--error',
34
+ props.disabled && 'form-input--disabled',
35
+ className,
36
+ ]
37
+ .filter(Boolean)
38
+ .join(' ');
39
+ return (_jsxs("div", { className: "form-input-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("input", { ref: ref, id: finalId, className: classes, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy, required: props.required ? true : undefined, ...props }), 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 }))] }));
40
+ });
41
+ Input.displayName = 'Input';
@@ -0,0 +1,13 @@
1
+ .form-label {
2
+ display: block;
3
+ font-size: var(--font-size-base, 1rem);
4
+ font-weight: var(--font-weight-medium, 500);
5
+ color: var(--color-text-primary, #171717);
6
+ margin-bottom: var(--spacing-2, 0.5rem);
7
+ line-height: var(--line-height-normal, 1.5);
8
+ }
9
+
10
+ .form-label__required {
11
+ color: var(--color-error-500, #ef4444);
12
+ }
13
+
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import './Label.css';
3
+ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
4
+ /**
5
+ * Whether this label is required (shows asterisk)
6
+ */
7
+ required?: boolean;
8
+ /**
9
+ * ID of the input this label is associated with
10
+ */
11
+ htmlFor?: string;
12
+ }
13
+ /**
14
+ * Accessible Label component
15
+ *
16
+ * WCAG Compliance:
17
+ * - 1.3.1 Info and Relationships: Proper label-input association
18
+ * - 2.5.3 Label in Name: Label text matches accessible name
19
+ * - 4.1.2 Name, Role, Value: Proper semantic HTML
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <Label htmlFor="email" required>
24
+ * Email address
25
+ * </Label>
26
+ * <Input id="email" type="email" />
27
+ * ```
28
+ */
29
+ export declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
30
+ //# sourceMappingURL=Label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,aAAa,CAAA;AAEpB,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK,qFAqBjB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import './Label.css';
4
+ /**
5
+ * Accessible Label component
6
+ *
7
+ * WCAG Compliance:
8
+ * - 1.3.1 Info and Relationships: Proper label-input association
9
+ * - 2.5.3 Label in Name: Label text matches accessible name
10
+ * - 4.1.2 Name, Role, Value: Proper semantic HTML
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * <Label htmlFor="email" required>
15
+ * Email address
16
+ * </Label>
17
+ * <Input id="email" type="email" />
18
+ * ```
19
+ */
20
+ export const Label = React.forwardRef(({ required = false, className = '', children, ...props }, ref) => {
21
+ const classes = [
22
+ 'form-label',
23
+ required && 'form-label--required',
24
+ className,
25
+ ]
26
+ .filter(Boolean)
27
+ .join(' ');
28
+ return (_jsxs("label", { ref: ref, className: classes, ...props, children: [children, required && (_jsxs("span", { className: "form-label__required", "aria-hidden": "true", children: [' ', "*"] }))] }));
29
+ });
30
+ Label.displayName = 'Label';
@@ -0,0 +1,81 @@
1
+ .form-radio-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--spacing-2, 0.5rem);
5
+ }
6
+
7
+ .form-radio-group {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: var(--spacing-3, 0.75rem);
11
+ }
12
+
13
+ .form-radio-option {
14
+ display: flex;
15
+ align-items: flex-start;
16
+ gap: var(--spacing-2, 0.5rem);
17
+ }
18
+
19
+ .form-radio {
20
+ width: 1.25rem;
21
+ height: 1.25rem;
22
+ margin-top: 0.125rem;
23
+ cursor: pointer;
24
+ accent-color: var(--color-primary-500, #0ea5e9);
25
+ flex-shrink: 0;
26
+ appearance: none;
27
+ -webkit-appearance: none;
28
+ border: 2px solid var(--color-border-default, #d4d4d4);
29
+ border-radius: 50%;
30
+ background-color: var(--color-background, #ffffff);
31
+ position: relative;
32
+ transition: border-color 0.2s ease;
33
+ }
34
+
35
+ .form-radio:checked {
36
+ border-color: var(--color-primary-500, #0ea5e9);
37
+ background-color: var(--color-background, #ffffff);
38
+ }
39
+
40
+ .form-radio:checked::after {
41
+ content: '';
42
+ position: absolute;
43
+ top: 50%;
44
+ left: 50%;
45
+ transform: translate(-50%, -50%);
46
+ width: 0.5rem;
47
+ height: 0.5rem;
48
+ border-radius: 50%;
49
+ background-color: var(--color-primary-500, #0ea5e9);
50
+ }
51
+
52
+ .form-radio:hover:not(:disabled) {
53
+ border-color: var(--color-primary-600, #0284c7);
54
+ }
55
+
56
+ .form-radio:disabled {
57
+ opacity: 0.5;
58
+ cursor: not-allowed;
59
+ }
60
+
61
+ .form-radio:focus-visible {
62
+ outline: 2px solid var(--color-border-focus, #0ea5e9);
63
+ outline-offset: 2px;
64
+ border-radius: 50%;
65
+ }
66
+
67
+ .form-radio-label {
68
+ font-size: var(--font-size-base, 1rem);
69
+ line-height: var(--line-height-normal, 1.5);
70
+ color: var(--color-text-primary, #171717);
71
+ cursor: pointer;
72
+ user-select: none;
73
+ }
74
+
75
+ /* High contrast mode support */
76
+ @media (prefers-contrast: high) {
77
+ .form-radio:focus-visible {
78
+ outline-width: 3px;
79
+ }
80
+ }
81
+
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import './Radio.css';
3
+ export interface RadioOption {
4
+ value: string;
5
+ label: string;
6
+ disabled?: boolean;
7
+ }
8
+ export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
9
+ /**
10
+ * Options for the radio group
11
+ */
12
+ options: RadioOption[];
13
+ /**
14
+ * Name attribute for the radio group (required)
15
+ */
16
+ name: string;
17
+ /**
18
+ * Label for the radio group
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Error message to display
23
+ */
24
+ error?: string;
25
+ /**
26
+ * Helper text to display
27
+ */
28
+ helperText?: string;
29
+ }
30
+ /**
31
+ * Accessible Radio component (radio group)
32
+ *
33
+ * WCAG Compliance:
34
+ * - 1.3.1 Info and Relationships: Proper fieldset/legend structure
35
+ * - 2.1.1 Keyboard: Full keyboard navigation
36
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <Radio
41
+ * name="size"
42
+ * label="Size"
43
+ * options={[
44
+ * { value: 's', label: 'Small' },
45
+ * { value: 'm', label: 'Medium' },
46
+ * ]}
47
+ * value={selected}
48
+ * onChange={handleChange}
49
+ * />
50
+ * ```
51
+ */
52
+ export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
53
+ //# sourceMappingURL=Radio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAEpB,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC3F;;OAEG;IACH,OAAO,EAAE,WAAW,EAAE,CAAA;IAEtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,qFAkFjB,CAAA"}
@@ -0,0 +1,39 @@
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 './Radio.css';
6
+ /**
7
+ * Accessible Radio component (radio group)
8
+ *
9
+ * WCAG Compliance:
10
+ * - 1.3.1 Info and Relationships: Proper fieldset/legend structure
11
+ * - 2.1.1 Keyboard: Full keyboard navigation
12
+ * - 4.1.2 Name, Role, Value: Proper ARIA attributes
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <Radio
17
+ * name="size"
18
+ * label="Size"
19
+ * options={[
20
+ * { value: 's', label: 'Small' },
21
+ * { value: 'm', label: 'Medium' },
22
+ * ]}
23
+ * value={selected}
24
+ * onChange={handleChange}
25
+ * />
26
+ * ```
27
+ */
28
+ export const Radio = React.forwardRef(({ name, options, label, error, helperText, className = '', value, onChange, disabled, required, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
29
+ const groupId = React.useId();
30
+ const errorId = error ? `radio-${groupId}-error` : undefined;
31
+ const helperId = helperText ? `radio-${groupId}-helper` : undefined;
32
+ const describedBy = combineAriaDescribedBy(ariaDescribedBy, errorId, helperId);
33
+ return (_jsxs("div", { className: "form-radio-wrapper", children: [label && (_jsx("div", { className: "form-radio-label", role: "group", "aria-labelledby": label ? `radio-label-${groupId}` : undefined, children: _jsxs("span", { id: `radio-label-${groupId}`, className: "form-label", children: [label, required && (_jsxs("span", { className: "form-label__required", "aria-hidden": "true", children: [' ', "*"] }))] }) })), _jsx("div", { className: "form-radio-group", role: "radiogroup", "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, children: options.map((option, index) => {
34
+ const optionId = `radio-${groupId}-${index}`;
35
+ const isChecked = value === option.value;
36
+ return (_jsxs("div", { className: "form-radio-option", children: [_jsx("input", { ref: index === 0 ? ref : undefined, id: optionId, type: "radio", name: name, value: option.value, checked: isChecked, onChange: onChange, disabled: option.disabled || disabled, required: required, className: "form-radio", ...props }), _jsx("label", { htmlFor: optionId, className: "form-radio-label", children: option.label })] }, option.value));
37
+ }) }), 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 }))] }));
38
+ });
39
+ Radio.displayName = 'Radio';