@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,159 @@
1
+ export declare const theme: {
2
+ readonly colors: {
3
+ readonly primary: {
4
+ readonly 50: "#f0f9ff";
5
+ readonly 100: "#e0f2fe";
6
+ readonly 200: "#bae6fd";
7
+ readonly 300: "#7dd3fc";
8
+ readonly 400: "#38bdf8";
9
+ readonly 500: "#0ea5e9";
10
+ readonly 600: "#0284c7";
11
+ readonly 700: "#0369a1";
12
+ readonly 800: "#075985";
13
+ readonly 900: "#0c4a6e";
14
+ };
15
+ readonly neutral: {
16
+ readonly 50: "#fafafa";
17
+ readonly 100: "#f5f5f5";
18
+ readonly 200: "#bbbbbb";
19
+ readonly 300: "#d4d4d4";
20
+ readonly 400: "#a3a3a3";
21
+ readonly 500: "#737373";
22
+ readonly 600: "#525252";
23
+ readonly 700: "#404040";
24
+ readonly 800: "#262626";
25
+ readonly 900: "#171717";
26
+ };
27
+ readonly success: {
28
+ readonly 50: "#f0fdf4";
29
+ readonly 100: "#dcfce7";
30
+ readonly 200: "#bbf7d0";
31
+ readonly 300: "#86efac";
32
+ readonly 400: "#4ade80";
33
+ readonly 500: "#22c55e";
34
+ readonly 600: "#16a34a";
35
+ readonly 700: "#15803d";
36
+ };
37
+ readonly warning: {
38
+ readonly 50: "#fffbeb";
39
+ readonly 100: "#fef3c7";
40
+ readonly 200: "#fde68a";
41
+ readonly 300: "#fcd34d";
42
+ readonly 400: "#fbbf24";
43
+ readonly 500: "#f59e0b";
44
+ readonly 600: "#d97706";
45
+ readonly 700: "#b45309";
46
+ };
47
+ readonly error: {
48
+ readonly 50: "#fef2f2";
49
+ readonly 100: "#fee2e2";
50
+ readonly 200: "#fecaca";
51
+ readonly 300: "#fca5a5";
52
+ readonly 400: "#f87171";
53
+ readonly 500: "#ef4444";
54
+ readonly 600: "#dc2626";
55
+ readonly 700: "#b91c1c";
56
+ };
57
+ readonly white: "#ffffff";
58
+ readonly black: "#000000";
59
+ readonly background: {
60
+ readonly default: "#ffffff";
61
+ readonly secondary: "#fafafa";
62
+ readonly tertiary: "#f5f5f5";
63
+ };
64
+ readonly text: {
65
+ readonly primary: "#171717";
66
+ readonly secondary: "#525252";
67
+ readonly tertiary: "#737373";
68
+ readonly inverse: "#ffffff";
69
+ readonly disabled: "#a3a3a3";
70
+ };
71
+ readonly border: {
72
+ readonly default: "#bbbbbb";
73
+ readonly focus: "#0ea5e9";
74
+ readonly error: "#ef4444";
75
+ };
76
+ };
77
+ readonly spacing: {
78
+ readonly 0: "0";
79
+ readonly 1: "0.25rem";
80
+ readonly 2: "0.5rem";
81
+ readonly 3: "0.75rem";
82
+ readonly 4: "1rem";
83
+ readonly 5: "1.25rem";
84
+ readonly 6: "1.5rem";
85
+ readonly 8: "2rem";
86
+ readonly 10: "2.5rem";
87
+ readonly 12: "3rem";
88
+ readonly 16: "4rem";
89
+ readonly 20: "5rem";
90
+ readonly 24: "6rem";
91
+ readonly 32: "8rem";
92
+ };
93
+ readonly typography: {
94
+ readonly fontFamily: {
95
+ readonly sans: string;
96
+ readonly mono: string;
97
+ };
98
+ readonly fontSize: {
99
+ readonly xs: "0.75rem";
100
+ readonly sm: "0.875rem";
101
+ readonly base: "1rem";
102
+ readonly lg: "1.125rem";
103
+ readonly xl: "1.25rem";
104
+ readonly '2xl': "1.5rem";
105
+ readonly '3xl': "1.875rem";
106
+ readonly '4xl': "2.25rem";
107
+ readonly '5xl': "3rem";
108
+ };
109
+ readonly lineHeight: {
110
+ readonly none: "1";
111
+ readonly tight: "1.25";
112
+ readonly snug: "1.375";
113
+ readonly normal: "1.5";
114
+ readonly relaxed: "1.625";
115
+ readonly loose: "2";
116
+ };
117
+ readonly fontWeight: {
118
+ readonly normal: "400";
119
+ readonly medium: "500";
120
+ readonly semibold: "600";
121
+ readonly bold: "700";
122
+ };
123
+ readonly letterSpacing: {
124
+ readonly tighter: "-0.05em";
125
+ readonly tight: "-0.025em";
126
+ readonly normal: "0";
127
+ readonly wide: "0.025em";
128
+ readonly wider: "0.05em";
129
+ readonly widest: "0.1em";
130
+ };
131
+ };
132
+ readonly motion: {
133
+ readonly duration: {
134
+ readonly fast: "150ms";
135
+ readonly normal: "200ms";
136
+ readonly slow: "300ms";
137
+ readonly slower: "400ms";
138
+ };
139
+ readonly easing: {
140
+ readonly easeIn: "cubic-bezier(0.4, 0, 1, 1)";
141
+ readonly easeOut: "cubic-bezier(0, 0, 0.2, 1)";
142
+ readonly easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)";
143
+ readonly linear: "linear";
144
+ };
145
+ readonly reduced: {
146
+ readonly duration: "0ms";
147
+ readonly easing: "linear";
148
+ };
149
+ };
150
+ readonly breakpoints: {
151
+ readonly sm: "640px";
152
+ readonly md: "768px";
153
+ readonly lg: "1024px";
154
+ readonly xl: "1280px";
155
+ readonly '2xl': "1536px";
156
+ };
157
+ };
158
+ export type Theme = typeof theme;
159
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/tokens/theme.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMR,CAAA;AAEV,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Central theme export combining all design tokens
3
+ */
4
+ import { colors } from './colors';
5
+ import { spacing } from './spacing';
6
+ import { typography } from './typography';
7
+ import { motion } from './motion';
8
+ import { breakpoints } from './breakpoints';
9
+ export const theme = {
10
+ colors,
11
+ spacing,
12
+ typography,
13
+ motion,
14
+ breakpoints,
15
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Typography scale with accessible line heights and font sizes
3
+ * Line heights ensure readability (minimum 1.5 for body text)
4
+ */
5
+ export declare const typography: {
6
+ readonly fontFamily: {
7
+ readonly sans: string;
8
+ readonly mono: string;
9
+ };
10
+ readonly fontSize: {
11
+ readonly xs: "0.75rem";
12
+ readonly sm: "0.875rem";
13
+ readonly base: "1rem";
14
+ readonly lg: "1.125rem";
15
+ readonly xl: "1.25rem";
16
+ readonly '2xl': "1.5rem";
17
+ readonly '3xl': "1.875rem";
18
+ readonly '4xl': "2.25rem";
19
+ readonly '5xl': "3rem";
20
+ };
21
+ readonly lineHeight: {
22
+ readonly none: "1";
23
+ readonly tight: "1.25";
24
+ readonly snug: "1.375";
25
+ readonly normal: "1.5";
26
+ readonly relaxed: "1.625";
27
+ readonly loose: "2";
28
+ };
29
+ readonly fontWeight: {
30
+ readonly normal: "400";
31
+ readonly medium: "500";
32
+ readonly semibold: "600";
33
+ readonly bold: "700";
34
+ };
35
+ readonly letterSpacing: {
36
+ readonly tighter: "-0.05em";
37
+ readonly tight: "-0.025em";
38
+ readonly normal: "0";
39
+ readonly wide: "0.025em";
40
+ readonly wider: "0.05em";
41
+ readonly widest: "0.1em";
42
+ };
43
+ };
44
+ export type TypographyToken = typeof typography;
45
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/tokens/typography.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDb,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,OAAO,UAAU,CAAA"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Typography scale with accessible line heights and font sizes
3
+ * Line heights ensure readability (minimum 1.5 for body text)
4
+ */
5
+ export const typography = {
6
+ fontFamily: {
7
+ sans: [
8
+ '-apple-system',
9
+ 'BlinkMacSystemFont',
10
+ '"Segoe UI"',
11
+ 'Roboto',
12
+ '"Helvetica Neue"',
13
+ 'Arial',
14
+ 'sans-serif',
15
+ ].join(', '),
16
+ mono: [
17
+ 'Menlo',
18
+ 'Monaco',
19
+ '"Courier New"',
20
+ 'monospace',
21
+ ].join(', '),
22
+ },
23
+ fontSize: {
24
+ xs: '0.75rem', // 12px
25
+ sm: '0.875rem', // 14px
26
+ base: '1rem', // 16px
27
+ lg: '1.125rem', // 18px
28
+ xl: '1.25rem', // 20px
29
+ '2xl': '1.5rem', // 24px
30
+ '3xl': '1.875rem', // 30px
31
+ '4xl': '2.25rem', // 36px
32
+ '5xl': '3rem', // 48px
33
+ },
34
+ lineHeight: {
35
+ none: '1',
36
+ tight: '1.25',
37
+ snug: '1.375',
38
+ normal: '1.5', // Minimum for accessibility
39
+ relaxed: '1.625',
40
+ loose: '2',
41
+ },
42
+ fontWeight: {
43
+ normal: '400',
44
+ medium: '500',
45
+ semibold: '600',
46
+ bold: '700',
47
+ },
48
+ letterSpacing: {
49
+ tighter: '-0.05em',
50
+ tight: '-0.025em',
51
+ normal: '0',
52
+ wide: '0.025em',
53
+ wider: '0.05em',
54
+ widest: '0.1em',
55
+ },
56
+ };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * ARIA utility functions
3
+ * Helpers for managing ARIA attributes and roles
4
+ */
5
+ export declare function generateId(prefix?: string): string;
6
+ /**
7
+ * Get ARIA label from props, preferring aria-label over aria-labelledby
8
+ */
9
+ export declare function getAriaLabel(ariaLabel?: string, ariaLabelledBy?: string): {
10
+ 'aria-label'?: string;
11
+ 'aria-labelledby'?: string;
12
+ };
13
+ /**
14
+ * Get ARIA describedby attributes
15
+ */
16
+ export declare function getAriaDescribedBy(describedBy?: string): {
17
+ 'aria-describedby'?: string;
18
+ };
19
+ /**
20
+ * Combine multiple ARIA describedby IDs
21
+ */
22
+ export declare function combineAriaDescribedBy(...ids: (string | undefined)[]): string | undefined;
23
+ /**
24
+ * Get live region attributes
25
+ */
26
+ export declare function getLiveRegionAttributes(live?: 'polite' | 'assertive' | 'off'): {
27
+ 'aria-live': 'polite' | 'assertive' | 'off';
28
+ 'aria-atomic'?: boolean;
29
+ };
30
+ /**
31
+ * Get busy state attributes
32
+ */
33
+ export declare function getBusyAttributes(busy: boolean): {
34
+ 'aria-busy': boolean;
35
+ };
36
+ /**
37
+ * Get expanded state attributes
38
+ */
39
+ export declare function getExpandedAttributes(expanded: boolean | undefined): {
40
+ 'aria-expanded'?: boolean;
41
+ };
42
+ /**
43
+ * Get pressed state attributes (for toggle buttons)
44
+ */
45
+ export declare function getPressedAttributes(pressed: boolean | undefined): {
46
+ 'aria-pressed'?: boolean;
47
+ };
48
+ /**
49
+ * Get selected state attributes
50
+ */
51
+ export declare function getSelectedAttributes(selected: boolean | undefined): {
52
+ 'aria-selected'?: boolean;
53
+ };
54
+ /**
55
+ * Get current state attributes (for navigation)
56
+ */
57
+ export declare function getCurrentAttributes(current: boolean | 'page' | 'step' | 'location' | 'date' | 'time' | undefined): {
58
+ 'aria-current'?: boolean | 'page' | 'step' | 'location' | 'date' | 'time';
59
+ };
60
+ //# sourceMappingURL=aria.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../src/utils/aria.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wBAAgB,UAAU,CAAC,MAAM,SAAO,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GACtB;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAQvD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,CAAC,EAAE,MAAM,GACnB;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAKjC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,GAAG,SAAS,CAGzF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,GAAE,QAAQ,GAAG,WAAW,GAAG,KAAgB,GAC9C;IAAE,WAAW,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAK1E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAEzE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC5B;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAG/B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAG9B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC5B;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAG/B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAC5E;IAAE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAG/E"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * ARIA utility functions
3
+ * Helpers for managing ARIA attributes and roles
4
+ */
5
+ /**
6
+ * Generate a unique ID for ARIA attributes
7
+ */
8
+ let idCounter = 0;
9
+ export function generateId(prefix = 'id') {
10
+ return `${prefix}-${++idCounter}`;
11
+ }
12
+ /**
13
+ * Get ARIA label from props, preferring aria-label over aria-labelledby
14
+ */
15
+ export function getAriaLabel(ariaLabel, ariaLabelledBy) {
16
+ if (ariaLabel) {
17
+ return { 'aria-label': ariaLabel };
18
+ }
19
+ if (ariaLabelledBy) {
20
+ return { 'aria-labelledby': ariaLabelledBy };
21
+ }
22
+ return {};
23
+ }
24
+ /**
25
+ * Get ARIA describedby attributes
26
+ */
27
+ export function getAriaDescribedBy(describedBy) {
28
+ if (describedBy) {
29
+ return { 'aria-describedby': describedBy };
30
+ }
31
+ return {};
32
+ }
33
+ /**
34
+ * Combine multiple ARIA describedby IDs
35
+ */
36
+ export function combineAriaDescribedBy(...ids) {
37
+ const validIds = ids.filter((id) => Boolean(id));
38
+ return validIds.length > 0 ? validIds.join(' ') : undefined;
39
+ }
40
+ /**
41
+ * Get live region attributes
42
+ */
43
+ export function getLiveRegionAttributes(live = 'polite') {
44
+ return {
45
+ 'aria-live': live,
46
+ 'aria-atomic': live !== 'off',
47
+ };
48
+ }
49
+ /**
50
+ * Get busy state attributes
51
+ */
52
+ export function getBusyAttributes(busy) {
53
+ return { 'aria-busy': busy };
54
+ }
55
+ /**
56
+ * Get expanded state attributes
57
+ */
58
+ export function getExpandedAttributes(expanded) {
59
+ if (expanded === undefined)
60
+ return {};
61
+ return { 'aria-expanded': expanded };
62
+ }
63
+ /**
64
+ * Get pressed state attributes (for toggle buttons)
65
+ */
66
+ export function getPressedAttributes(pressed) {
67
+ if (pressed === undefined)
68
+ return {};
69
+ return { 'aria-pressed': pressed };
70
+ }
71
+ /**
72
+ * Get selected state attributes
73
+ */
74
+ export function getSelectedAttributes(selected) {
75
+ if (selected === undefined)
76
+ return {};
77
+ return { 'aria-selected': selected };
78
+ }
79
+ /**
80
+ * Get current state attributes (for navigation)
81
+ */
82
+ export function getCurrentAttributes(current) {
83
+ if (current === undefined)
84
+ return {};
85
+ return { 'aria-current': current };
86
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Focus management utilities
3
+ * Helpers for programmatic focus control
4
+ */
5
+ /**
6
+ * Get all focusable elements within a container
7
+ */
8
+ export declare function getFocusableElements(container: HTMLElement): HTMLElement[];
9
+ /**
10
+ * Get the first focusable element in a container
11
+ */
12
+ export declare function getFirstFocusable(container: HTMLElement): HTMLElement | null;
13
+ /**
14
+ * Get the last focusable element in a container
15
+ */
16
+ export declare function getLastFocusable(container: HTMLElement): HTMLElement | null;
17
+ /**
18
+ * Check if an element is focusable
19
+ */
20
+ export declare function isFocusable(element: HTMLElement): boolean;
21
+ export declare function saveFocus(): void;
22
+ /**
23
+ * Restore focus to the previously saved element
24
+ */
25
+ export declare function restoreFocus(): void;
26
+ /**
27
+ * Focus an element safely (with error handling)
28
+ */
29
+ export declare function safeFocus(element: HTMLElement | null): void;
30
+ //# sourceMappingURL=focus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/utils/focus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,WAAW,GACrB,WAAW,EAAE,CAWf;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAG5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAG3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAQzD;AAOD,wBAAgB,SAAS,IAAI,IAAI,CAIhC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAKnC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAS3D"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Focus management utilities
3
+ * Helpers for programmatic focus control
4
+ */
5
+ /**
6
+ * Get all focusable elements within a container
7
+ */
8
+ export function getFocusableElements(container) {
9
+ const focusableSelectors = [
10
+ 'a[href]',
11
+ 'button:not([disabled])',
12
+ 'textarea:not([disabled])',
13
+ 'input:not([disabled])',
14
+ 'select:not([disabled])',
15
+ '[tabindex]:not([tabindex="-1"])',
16
+ ].join(', ');
17
+ return Array.from(container.querySelectorAll(focusableSelectors));
18
+ }
19
+ /**
20
+ * Get the first focusable element in a container
21
+ */
22
+ export function getFirstFocusable(container) {
23
+ const focusable = getFocusableElements(container);
24
+ return focusable[0] || null;
25
+ }
26
+ /**
27
+ * Get the last focusable element in a container
28
+ */
29
+ export function getLastFocusable(container) {
30
+ const focusable = getFocusableElements(container);
31
+ return focusable[focusable.length - 1] || null;
32
+ }
33
+ /**
34
+ * Check if an element is focusable
35
+ */
36
+ export function isFocusable(element) {
37
+ if (element.tabIndex < 0)
38
+ return false;
39
+ if (element.hasAttribute('disabled'))
40
+ return false;
41
+ if (element.hasAttribute('hidden'))
42
+ return false;
43
+ if (element.style.display === 'none')
44
+ return false;
45
+ if (element.style.visibility === 'hidden')
46
+ return false;
47
+ return true;
48
+ }
49
+ /**
50
+ * Save the currently focused element
51
+ */
52
+ let savedFocusElement = null;
53
+ export function saveFocus() {
54
+ if (document.activeElement instanceof HTMLElement) {
55
+ savedFocusElement = document.activeElement;
56
+ }
57
+ }
58
+ /**
59
+ * Restore focus to the previously saved element
60
+ */
61
+ export function restoreFocus() {
62
+ if (savedFocusElement) {
63
+ savedFocusElement.focus();
64
+ savedFocusElement = null;
65
+ }
66
+ }
67
+ /**
68
+ * Focus an element safely (with error handling)
69
+ */
70
+ export function safeFocus(element) {
71
+ if (element && typeof element.focus === 'function') {
72
+ try {
73
+ element.focus();
74
+ }
75
+ catch (error) {
76
+ // Silently fail if focus fails
77
+ console.warn('Failed to focus element:', error);
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,4 @@
1
+ export * from './aria';
2
+ export * from './keyboard';
3
+ export * from './focus';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './aria';
2
+ export * from './keyboard';
3
+ export * from './focus';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Keyboard event utilities
3
+ * Helpers for handling keyboard interactions
4
+ */
5
+ export type KeyboardHandler = (event: React.KeyboardEvent) => void;
6
+ /**
7
+ * Check if a key is an activation key (Enter or Space)
8
+ */
9
+ export declare function isActivationKey(key: string): boolean;
10
+ /**
11
+ * Check if a key is an arrow key
12
+ */
13
+ export declare function isArrowKey(key: string): boolean;
14
+ /**
15
+ * Check if a key is a navigation key (Home, End, PageUp, PageDown)
16
+ */
17
+ export declare function isNavigationKey(key: string): boolean;
18
+ /**
19
+ * Check if a key is an escape key
20
+ */
21
+ export declare function isEscapeKey(key: string): boolean;
22
+ /**
23
+ * Check if modifier keys are pressed
24
+ */
25
+ export declare function hasModifierKey(event: React.KeyboardEvent): boolean;
26
+ /**
27
+ * Create a keyboard handler that only fires on specific keys
28
+ */
29
+ export declare function createKeyHandler(keys: string[], handler: KeyboardHandler): KeyboardHandler;
30
+ /**
31
+ * Create a keyboard handler for activation keys (Enter/Space)
32
+ */
33
+ export declare function createActivationHandler(handler: KeyboardHandler): KeyboardHandler;
34
+ /**
35
+ * Create a keyboard handler for arrow keys
36
+ */
37
+ export declare function createArrowKeyHandler(handler: KeyboardHandler): KeyboardHandler;
38
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/utils/keyboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAA;AAElE;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,OAAO,CAElE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,eAAe,GACvB,eAAe,CAMjB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,eAAe,GACvB,eAAe,CAKjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,GACvB,eAAe,CAEjB"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Keyboard event utilities
3
+ * Helpers for handling keyboard interactions
4
+ */
5
+ /**
6
+ * Check if a key is an activation key (Enter or Space)
7
+ */
8
+ export function isActivationKey(key) {
9
+ return key === 'Enter' || key === ' ';
10
+ }
11
+ /**
12
+ * Check if a key is an arrow key
13
+ */
14
+ export function isArrowKey(key) {
15
+ return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key);
16
+ }
17
+ /**
18
+ * Check if a key is a navigation key (Home, End, PageUp, PageDown)
19
+ */
20
+ export function isNavigationKey(key) {
21
+ return ['Home', 'End', 'PageUp', 'PageDown'].includes(key);
22
+ }
23
+ /**
24
+ * Check if a key is an escape key
25
+ */
26
+ export function isEscapeKey(key) {
27
+ return key === 'Escape';
28
+ }
29
+ /**
30
+ * Check if modifier keys are pressed
31
+ */
32
+ export function hasModifierKey(event) {
33
+ return event.ctrlKey || event.metaKey || event.altKey || event.shiftKey;
34
+ }
35
+ /**
36
+ * Create a keyboard handler that only fires on specific keys
37
+ */
38
+ export function createKeyHandler(keys, handler) {
39
+ return (event) => {
40
+ if (keys.includes(event.key)) {
41
+ handler(event);
42
+ }
43
+ };
44
+ }
45
+ /**
46
+ * Create a keyboard handler for activation keys (Enter/Space)
47
+ */
48
+ export function createActivationHandler(handler) {
49
+ return createKeyHandler(['Enter', ' '], (event) => {
50
+ event.preventDefault();
51
+ handler(event);
52
+ });
53
+ }
54
+ /**
55
+ * Create a keyboard handler for arrow keys
56
+ */
57
+ export function createArrowKeyHandler(handler) {
58
+ return createKeyHandler(['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'], handler);
59
+ }