@a11y-core/react 0.1.0-alpha.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/README.md +252 -0
- package/dist/chunk-3WBTHTVK.js +41 -0
- package/dist/chunk-3WBTHTVK.js.map +1 -0
- package/dist/chunk-47MFBHV6.js +85 -0
- package/dist/chunk-47MFBHV6.js.map +1 -0
- package/dist/chunk-7A3IDIUB.cjs +89 -0
- package/dist/chunk-7A3IDIUB.cjs.map +1 -0
- package/dist/chunk-AZFZWGI6.cjs +383 -0
- package/dist/chunk-AZFZWGI6.cjs.map +1 -0
- package/dist/chunk-CTW5D77X.cjs +220 -0
- package/dist/chunk-CTW5D77X.cjs.map +1 -0
- package/dist/chunk-EY73HQNR.js +380 -0
- package/dist/chunk-EY73HQNR.js.map +1 -0
- package/dist/chunk-FJABCNFE.js +215 -0
- package/dist/chunk-FJABCNFE.js.map +1 -0
- package/dist/chunk-FTZ5KCOO.js +326 -0
- package/dist/chunk-FTZ5KCOO.js.map +1 -0
- package/dist/chunk-GS3H4T2O.cjs +106 -0
- package/dist/chunk-GS3H4T2O.cjs.map +1 -0
- package/dist/chunk-N6L4GLFC.cjs +45 -0
- package/dist/chunk-N6L4GLFC.cjs.map +1 -0
- package/dist/chunk-N774QCHE.js +234 -0
- package/dist/chunk-N774QCHE.js.map +1 -0
- package/dist/chunk-OSHIYZCZ.cjs +386 -0
- package/dist/chunk-OSHIYZCZ.cjs.map +1 -0
- package/dist/chunk-SRJSGDIA.js +373 -0
- package/dist/chunk-SRJSGDIA.js.map +1 -0
- package/dist/chunk-THB5U7YC.cjs +338 -0
- package/dist/chunk-THB5U7YC.cjs.map +1 -0
- package/dist/chunk-U6DUSMEA.js +99 -0
- package/dist/chunk-U6DUSMEA.js.map +1 -0
- package/dist/chunk-WDCYEMBO.cjs +245 -0
- package/dist/chunk-WDCYEMBO.cjs.map +1 -0
- package/dist/components/combobox/index.cjs +31 -0
- package/dist/components/combobox/index.cjs.map +1 -0
- package/dist/components/combobox/index.d.cts +55 -0
- package/dist/components/combobox/index.d.ts +55 -0
- package/dist/components/combobox/index.js +6 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/dialog/index.cjs +46 -0
- package/dist/components/dialog/index.cjs.map +1 -0
- package/dist/components/dialog/index.d.cts +84 -0
- package/dist/components/dialog/index.d.ts +84 -0
- package/dist/components/dialog/index.js +5 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/menu/index.cjs +46 -0
- package/dist/components/menu/index.cjs.map +1 -0
- package/dist/components/menu/index.d.cts +80 -0
- package/dist/components/menu/index.d.ts +80 -0
- package/dist/components/menu/index.js +5 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/tabs/index.cjs +35 -0
- package/dist/components/tabs/index.cjs.map +1 -0
- package/dist/components/tabs/index.d.cts +65 -0
- package/dist/components/tabs/index.d.ts +65 -0
- package/dist/components/tabs/index.js +6 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/toast/index.cjs +24 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +49 -0
- package/dist/components/toast/index.d.ts +49 -0
- package/dist/components/toast/index.js +3 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/index.cjs +698 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +402 -0
- package/dist/index.d.ts +402 -0
- package/dist/index.js +426 -0
- package/dist/index.js.map +1 -0
- package/package.json +89 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
export { DialogCompound as Dialog, DialogActions, Dialog as DialogBase, DialogClose, DialogContent, DialogDescription, DialogTitle, DialogTrigger, useDialogContext, useFocusTrap, useFocusTrapControls } from './chunk-FTZ5KCOO.js';
|
|
2
|
+
export { ActionMenuCompound as ActionMenu, ActionMenu as ActionMenuBase, ActionMenuContent, ActionMenuItem, ActionMenuLabel, ActionMenuSeparator, ActionMenuTrigger, useActionMenuContext } from './chunk-SRJSGDIA.js';
|
|
3
|
+
export { Tab, TabList, TabPanel, TabsCompound as Tabs, Tabs as TabsBase, useTabsContext } from './chunk-N774QCHE.js';
|
|
4
|
+
export { ToastProvider, ToastViewport, useToast, useToastHelpers } from './chunk-FJABCNFE.js';
|
|
5
|
+
export { ComboboxCompound as Combobox, Combobox as ComboboxBase, ComboboxInput, ComboboxListbox, ComboboxOption } from './chunk-EY73HQNR.js';
|
|
6
|
+
import { useAnnouncer } from './chunk-47MFBHV6.js';
|
|
7
|
+
export { useAnnounceLoading, useAnnounceOnChange, useAnnouncer } from './chunk-47MFBHV6.js';
|
|
8
|
+
import { useKeyboard } from './chunk-U6DUSMEA.js';
|
|
9
|
+
export { useGridKeyboard, useKeyPressed, useKeyboard, useMenuKeyboard, useTabsKeyboard, useTypeAhead } from './chunk-U6DUSMEA.js';
|
|
10
|
+
import { useId } from './chunk-3WBTHTVK.js';
|
|
11
|
+
export { useId, useIdScope, useIds } from './chunk-3WBTHTVK.js';
|
|
12
|
+
import { forwardRef, useState, useEffect, useCallback, useRef } from 'react';
|
|
13
|
+
import { createComponentWarnings, initFocusVisible, isFocusVisible, focusWithVisibleRing } from '@a11y-core/core';
|
|
14
|
+
export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, aria, buildAriaProps, checks, createComponentWarnings, hasAccessibleName, isAndroid, isBrowser, isIOS, isMac, mergeAriaIds, prefersDarkMode, prefersHighContrast, prefersReducedMotion, setWarningHandler, warn } from '@a11y-core/core';
|
|
15
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
function useFocusVisible() {
|
|
18
|
+
const [isFocusVisible$1, setIsFocusVisible] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const cleanup = initFocusVisible();
|
|
21
|
+
return cleanup;
|
|
22
|
+
}, []);
|
|
23
|
+
const handleFocus = useCallback(() => {
|
|
24
|
+
setIsFocusVisible(isFocusVisible());
|
|
25
|
+
}, []);
|
|
26
|
+
const handleBlur = useCallback(() => {
|
|
27
|
+
setIsFocusVisible(false);
|
|
28
|
+
}, []);
|
|
29
|
+
return {
|
|
30
|
+
isFocusVisible: isFocusVisible$1,
|
|
31
|
+
focusProps: {
|
|
32
|
+
onFocus: handleFocus,
|
|
33
|
+
onBlur: handleBlur
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function useFocusManager(options = {}) {
|
|
38
|
+
const { autoFocus = false, restoreFocus = false, focusVisible = true } = options;
|
|
39
|
+
const elementRef = useCallback(
|
|
40
|
+
(node) => {
|
|
41
|
+
if (node && autoFocus) {
|
|
42
|
+
requestAnimationFrame(() => {
|
|
43
|
+
if (focusVisible) {
|
|
44
|
+
focusWithVisibleRing(node);
|
|
45
|
+
} else {
|
|
46
|
+
node.focus();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[autoFocus, focusVisible]
|
|
52
|
+
);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!restoreFocus) return;
|
|
55
|
+
const previousElement = document.activeElement;
|
|
56
|
+
return () => {
|
|
57
|
+
if (previousElement && previousElement.focus) {
|
|
58
|
+
previousElement.focus();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}, [restoreFocus]);
|
|
62
|
+
return elementRef;
|
|
63
|
+
}
|
|
64
|
+
function useFocusControl() {
|
|
65
|
+
const elementRef = useCallback((_node) => {
|
|
66
|
+
}, []);
|
|
67
|
+
const focus = useCallback((options) => {
|
|
68
|
+
const element = elementRef;
|
|
69
|
+
if (element.current) {
|
|
70
|
+
if (options?.visible) {
|
|
71
|
+
focusWithVisibleRing(element.current);
|
|
72
|
+
} else {
|
|
73
|
+
element.current.focus();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, []);
|
|
77
|
+
return { ref: elementRef, focus };
|
|
78
|
+
}
|
|
79
|
+
function useFocusWithin() {
|
|
80
|
+
const [hasFocus, setHasFocus] = useState(false);
|
|
81
|
+
const containerRef = useCallback((_node) => {
|
|
82
|
+
}, []);
|
|
83
|
+
const handleFocusIn = useCallback(() => {
|
|
84
|
+
setHasFocus(true);
|
|
85
|
+
}, []);
|
|
86
|
+
const handleFocusOut = useCallback((event) => {
|
|
87
|
+
const container = event.currentTarget;
|
|
88
|
+
const relatedTarget = event.relatedTarget;
|
|
89
|
+
if (!relatedTarget || !container.contains(relatedTarget)) {
|
|
90
|
+
setHasFocus(false);
|
|
91
|
+
}
|
|
92
|
+
}, []);
|
|
93
|
+
return {
|
|
94
|
+
ref: containerRef,
|
|
95
|
+
hasFocus,
|
|
96
|
+
focusWithinProps: {
|
|
97
|
+
onFocus: handleFocusIn,
|
|
98
|
+
onBlur: handleFocusOut
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function useRovingTabindex(options) {
|
|
103
|
+
const {
|
|
104
|
+
itemCount,
|
|
105
|
+
initialIndex = 0,
|
|
106
|
+
wrap = true,
|
|
107
|
+
orientation = "both",
|
|
108
|
+
onChange
|
|
109
|
+
} = options;
|
|
110
|
+
const [activeIndex, setActiveIndex] = useState(initialIndex);
|
|
111
|
+
const itemRefs = useRef([]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (activeIndex >= itemCount) {
|
|
114
|
+
setActiveIndex(Math.max(0, itemCount - 1));
|
|
115
|
+
}
|
|
116
|
+
}, [itemCount, activeIndex]);
|
|
117
|
+
const moveTo = useCallback(
|
|
118
|
+
(index) => {
|
|
119
|
+
let newIndex = index;
|
|
120
|
+
if (newIndex < 0) {
|
|
121
|
+
newIndex = wrap ? itemCount - 1 : 0;
|
|
122
|
+
} else if (newIndex >= itemCount) {
|
|
123
|
+
newIndex = wrap ? 0 : itemCount - 1;
|
|
124
|
+
}
|
|
125
|
+
setActiveIndex(newIndex);
|
|
126
|
+
onChange?.(newIndex);
|
|
127
|
+
const element = itemRefs.current[newIndex];
|
|
128
|
+
element?.focus();
|
|
129
|
+
},
|
|
130
|
+
[itemCount, wrap, onChange]
|
|
131
|
+
);
|
|
132
|
+
const handleKeyDown = useCallback(
|
|
133
|
+
(event, index) => {
|
|
134
|
+
let handled = false;
|
|
135
|
+
switch (event.key) {
|
|
136
|
+
case "ArrowRight":
|
|
137
|
+
if (orientation === "horizontal" || orientation === "both") {
|
|
138
|
+
moveTo(index + 1);
|
|
139
|
+
handled = true;
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
case "ArrowLeft":
|
|
143
|
+
if (orientation === "horizontal" || orientation === "both") {
|
|
144
|
+
moveTo(index - 1);
|
|
145
|
+
handled = true;
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case "ArrowDown":
|
|
149
|
+
if (orientation === "vertical" || orientation === "both") {
|
|
150
|
+
moveTo(index + 1);
|
|
151
|
+
handled = true;
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case "ArrowUp":
|
|
155
|
+
if (orientation === "vertical" || orientation === "both") {
|
|
156
|
+
moveTo(index - 1);
|
|
157
|
+
handled = true;
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case "Home":
|
|
161
|
+
moveTo(0);
|
|
162
|
+
handled = true;
|
|
163
|
+
break;
|
|
164
|
+
case "End":
|
|
165
|
+
moveTo(itemCount - 1);
|
|
166
|
+
handled = true;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
if (handled) {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
[orientation, moveTo, itemCount]
|
|
175
|
+
);
|
|
176
|
+
const getItemProps = useCallback(
|
|
177
|
+
(index) => ({
|
|
178
|
+
ref: (el) => {
|
|
179
|
+
itemRefs.current[index] = el;
|
|
180
|
+
},
|
|
181
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
182
|
+
onKeyDown: (event) => handleKeyDown(event, index),
|
|
183
|
+
onFocus: () => {
|
|
184
|
+
if (index !== activeIndex) {
|
|
185
|
+
setActiveIndex(index);
|
|
186
|
+
onChange?.(index);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
[activeIndex, handleKeyDown, onChange]
|
|
191
|
+
);
|
|
192
|
+
return {
|
|
193
|
+
activeIndex,
|
|
194
|
+
setActiveIndex: moveTo,
|
|
195
|
+
getItemProps,
|
|
196
|
+
first: () => moveTo(0),
|
|
197
|
+
last: () => moveTo(itemCount - 1),
|
|
198
|
+
next: () => moveTo(activeIndex + 1),
|
|
199
|
+
previous: () => moveTo(activeIndex - 1)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function useRovingTabindexMap(ids, options = {}) {
|
|
203
|
+
const roving = useRovingTabindex({
|
|
204
|
+
...options,
|
|
205
|
+
itemCount: ids.length
|
|
206
|
+
});
|
|
207
|
+
const getItemProps = useCallback(
|
|
208
|
+
(id) => {
|
|
209
|
+
const index = ids.indexOf(id);
|
|
210
|
+
if (index === -1) {
|
|
211
|
+
throw new Error(`Unknown item ID: ${id}`);
|
|
212
|
+
}
|
|
213
|
+
return roving.getItemProps(index);
|
|
214
|
+
},
|
|
215
|
+
[ids, roving]
|
|
216
|
+
);
|
|
217
|
+
const activeId = ids[roving.activeIndex];
|
|
218
|
+
return {
|
|
219
|
+
...roving,
|
|
220
|
+
activeId,
|
|
221
|
+
getItemProps,
|
|
222
|
+
setActiveId: (id) => {
|
|
223
|
+
const index = ids.indexOf(id);
|
|
224
|
+
if (index !== -1) {
|
|
225
|
+
roving.setActiveIndex(index);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
var warnings = createComponentWarnings("Switch");
|
|
231
|
+
var Switch = forwardRef(
|
|
232
|
+
function Switch2({
|
|
233
|
+
checked: controlledChecked,
|
|
234
|
+
defaultChecked = false,
|
|
235
|
+
onCheckedChange,
|
|
236
|
+
label,
|
|
237
|
+
disabled = false,
|
|
238
|
+
unstyled = false,
|
|
239
|
+
className,
|
|
240
|
+
size = "md",
|
|
241
|
+
"aria-label": ariaLabel,
|
|
242
|
+
"aria-labelledby": ariaLabelledby,
|
|
243
|
+
onClick,
|
|
244
|
+
...props
|
|
245
|
+
}, ref) {
|
|
246
|
+
const id = useId("switch");
|
|
247
|
+
const labelId = `${id}-label`;
|
|
248
|
+
const { announce: announce2 } = useAnnouncer();
|
|
249
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked);
|
|
250
|
+
const isControlled = controlledChecked !== void 0;
|
|
251
|
+
const checked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (!label && !ariaLabel && !ariaLabelledby) {
|
|
254
|
+
warnings.warning(
|
|
255
|
+
"Switch has no accessible label. Screen readers need this to identify the switch.",
|
|
256
|
+
'Add label="Description", aria-label="...", or aria-labelledby="..."'
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}, [label, ariaLabel, ariaLabelledby]);
|
|
260
|
+
const toggleSwitch = useCallback(() => {
|
|
261
|
+
if (disabled) return;
|
|
262
|
+
const newChecked = !checked;
|
|
263
|
+
if (!isControlled) {
|
|
264
|
+
setUncontrolledChecked(newChecked);
|
|
265
|
+
}
|
|
266
|
+
onCheckedChange?.(newChecked);
|
|
267
|
+
const labelText = label || ariaLabel || "Switch";
|
|
268
|
+
announce2(`${labelText} ${newChecked ? "on" : "off"}`);
|
|
269
|
+
}, [
|
|
270
|
+
checked,
|
|
271
|
+
disabled,
|
|
272
|
+
isControlled,
|
|
273
|
+
onCheckedChange,
|
|
274
|
+
label,
|
|
275
|
+
ariaLabel,
|
|
276
|
+
announce2
|
|
277
|
+
]);
|
|
278
|
+
const handleClick = useCallback(
|
|
279
|
+
(event) => {
|
|
280
|
+
onClick?.(event);
|
|
281
|
+
if (!event.defaultPrevented) {
|
|
282
|
+
toggleSwitch();
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
[onClick, toggleSwitch]
|
|
286
|
+
);
|
|
287
|
+
const keyboardProps = useKeyboard(
|
|
288
|
+
{
|
|
289
|
+
" ": () => {
|
|
290
|
+
toggleSwitch();
|
|
291
|
+
},
|
|
292
|
+
Enter: () => {
|
|
293
|
+
toggleSwitch();
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{ preventDefault: true }
|
|
297
|
+
);
|
|
298
|
+
const handleKeyDown = (event) => {
|
|
299
|
+
props.onKeyDown?.(event);
|
|
300
|
+
if (!event.defaultPrevented) {
|
|
301
|
+
keyboardProps.onKeyDown(event);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const computedAriaLabel = ariaLabel;
|
|
305
|
+
const computedAriaLabelledby = ariaLabelledby || (label ? labelId : void 0);
|
|
306
|
+
const wrapperStructuralStyles = {
|
|
307
|
+
display: "inline-flex",
|
|
308
|
+
alignItems: "center"
|
|
309
|
+
};
|
|
310
|
+
const sizes = {
|
|
311
|
+
sm: { width: 32, height: 18, thumb: 14, translate: 14 },
|
|
312
|
+
md: { width: 44, height: 24, thumb: 20, translate: 20 },
|
|
313
|
+
lg: { width: 56, height: 30, thumb: 26, translate: 26 }
|
|
314
|
+
};
|
|
315
|
+
const sizeConfig = sizes[size];
|
|
316
|
+
const trackStructuralStyles = {
|
|
317
|
+
position: "relative",
|
|
318
|
+
display: "inline-flex",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
flexShrink: 0,
|
|
321
|
+
width: sizeConfig.width,
|
|
322
|
+
height: sizeConfig.height,
|
|
323
|
+
border: "none",
|
|
324
|
+
padding: 2,
|
|
325
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
326
|
+
};
|
|
327
|
+
const trackVisualStyles = unstyled ? {} : {
|
|
328
|
+
backgroundColor: checked ? "#0066cc" : "#d1d5db",
|
|
329
|
+
borderRadius: sizeConfig.height / 2,
|
|
330
|
+
transition: "background-color 0.2s ease",
|
|
331
|
+
opacity: disabled ? 0.5 : 1
|
|
332
|
+
};
|
|
333
|
+
const thumbStructuralStyles = {
|
|
334
|
+
position: "absolute",
|
|
335
|
+
left: 2,
|
|
336
|
+
width: sizeConfig.thumb,
|
|
337
|
+
height: sizeConfig.thumb,
|
|
338
|
+
pointerEvents: "none",
|
|
339
|
+
transform: checked ? `translateX(${sizeConfig.translate}px)` : "translateX(0)"
|
|
340
|
+
};
|
|
341
|
+
const thumbVisualStyles = unstyled ? {} : {
|
|
342
|
+
backgroundColor: "white",
|
|
343
|
+
borderRadius: "50%",
|
|
344
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.2)",
|
|
345
|
+
transition: "transform 0.2s ease"
|
|
346
|
+
};
|
|
347
|
+
const labelStyles = unstyled ? {
|
|
348
|
+
marginLeft: 8,
|
|
349
|
+
userSelect: "none",
|
|
350
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
351
|
+
} : {
|
|
352
|
+
marginLeft: 8,
|
|
353
|
+
userSelect: "none",
|
|
354
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
355
|
+
opacity: disabled ? 0.5 : 1
|
|
356
|
+
};
|
|
357
|
+
return /* @__PURE__ */ jsxs(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
style: wrapperStructuralStyles,
|
|
361
|
+
"data-a11y-core-switch-wrapper": true,
|
|
362
|
+
"data-size": size,
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsx(
|
|
365
|
+
"button",
|
|
366
|
+
{
|
|
367
|
+
ref,
|
|
368
|
+
type: "button",
|
|
369
|
+
role: "switch",
|
|
370
|
+
"aria-checked": checked,
|
|
371
|
+
"aria-label": computedAriaLabel,
|
|
372
|
+
"aria-labelledby": computedAriaLabelledby,
|
|
373
|
+
disabled,
|
|
374
|
+
onClick: handleClick,
|
|
375
|
+
onKeyDown: handleKeyDown,
|
|
376
|
+
className,
|
|
377
|
+
style: { ...trackStructuralStyles, ...trackVisualStyles },
|
|
378
|
+
tabIndex: disabled ? -1 : 0,
|
|
379
|
+
"data-a11y-core-switch": true,
|
|
380
|
+
"data-checked": checked,
|
|
381
|
+
"data-disabled": disabled || void 0,
|
|
382
|
+
"data-size": size,
|
|
383
|
+
...props,
|
|
384
|
+
onFocus: (e) => {
|
|
385
|
+
if (!unstyled) {
|
|
386
|
+
e.currentTarget.style.outline = "2px solid #0066cc";
|
|
387
|
+
e.currentTarget.style.outlineOffset = "2px";
|
|
388
|
+
}
|
|
389
|
+
props.onFocus?.(e);
|
|
390
|
+
},
|
|
391
|
+
onBlur: (e) => {
|
|
392
|
+
if (!unstyled) {
|
|
393
|
+
e.currentTarget.style.outline = "none";
|
|
394
|
+
}
|
|
395
|
+
props.onBlur?.(e);
|
|
396
|
+
},
|
|
397
|
+
children: /* @__PURE__ */ jsx(
|
|
398
|
+
"span",
|
|
399
|
+
{
|
|
400
|
+
style: { ...thumbStructuralStyles, ...thumbVisualStyles },
|
|
401
|
+
"data-a11y-core-switch-thumb": true,
|
|
402
|
+
"aria-hidden": "true"
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
label && /* @__PURE__ */ jsx(
|
|
408
|
+
"label",
|
|
409
|
+
{
|
|
410
|
+
id: labelId,
|
|
411
|
+
onClick: disabled ? void 0 : () => toggleSwitch(),
|
|
412
|
+
style: labelStyles,
|
|
413
|
+
"data-a11y-core-switch-label": true,
|
|
414
|
+
children: label
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
Switch.displayName = "Switch";
|
|
423
|
+
|
|
424
|
+
export { Switch, useFocusControl, useFocusManager, useFocusVisible, useFocusWithin, useRovingTabindex, useRovingTabindexMap };
|
|
425
|
+
//# sourceMappingURL=index.js.map
|
|
426
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-focus-visible.ts","../src/hooks/use-roving-tabindex.ts","../src/components/switch/switch.tsx"],"names":["isFocusVisible","checkFocusVisible","useState","useEffect","useCallback","Switch","announce"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAAS,eAAA,GAAkB;AAChC,EAAA,MAAM,CAACA,gBAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAS,KAAK,CAAA;AAG1D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,UAAU,gBAAA,EAAiB;AACjC,IAAA,OAAO,OAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,iBAAA,CAAkBC,gBAAmB,CAAA;AAAA,EACvC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,UAAA,GAAa,YAAY,MAAM;AACnC,IAAA,iBAAA,CAAkB,KAAK,CAAA;AAAA,EACzB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO;AAAA,oBACLD,gBAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,OAAA,EAAS,WAAA;AAAA,MACT,MAAA,EAAQ;AAAA;AACV,GACF;AACF;AAgBO,SAAS,eAAA,CAAqD,OAAA,GAIjE,EAAC,EAAG;AACN,EAAA,MAAM,EAAE,SAAA,GAAY,KAAA,EAAO,eAAe,KAAA,EAAO,YAAA,GAAe,MAAK,GAAI,OAAA;AAEzE,EAAA,MAAM,UAAA,GAAa,WAAA;AAAA,IACjB,CAAC,IAAA,KAAmB;AAClB,MAAA,IAAI,QAAQ,SAAA,EAAW;AAErB,QAAA,qBAAA,CAAsB,MAAM;AAC1B,UAAA,IAAI,YAAA,EAAc;AAChB,YAAA,oBAAA,CAAqB,IAAI,CAAA;AAAA,UAC3B,CAAA,MAAO;AACL,YAAA,IAAA,CAAK,KAAA,EAAM;AAAA,UACb;AAAA,QACF,CAAC,CAAA;AAAA,MACH;AAAA,IACF,CAAA;AAAA,IACA,CA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AA,CAAA,CAAE,aAAA,CAAc,MAAM,OAAA,GAAU,mBAAA;AAChC,kBAAA,CAAA,CAAE,aAAA,CAAc,MAAM,aAAA,GAAgB,KAAA;AAAA,gBACxC;AACA,gBAAA,KAAA,CAAM,UAAU,CAAC,CAAA;AAAA,cACnB,CAAA;AAAA,cACA,MAAA,EAAQ,CAAC,CAAA,KAAM;AAEb,gBAAA,IAAI,CAAC,QAAA,EAAU;AACb,kBAAA,CAAA,CAAE,aAAA,CAAc,MAAM,OAAA,GAAU,MAAA;AAAA,gBAClC;AACA,gBAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA,cAClB,CAAA;AAAA,cAEA,QAAA,kBAAA,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAO,EAAE,GAAG,qBAAA,EAAuB,GAAG,iBAAA,EAAkB;AAAA,kBACxD,6BAAA,EAA2B,IAAA;AAAA,kBAC3B,aAAA,EAAY;AAAA;AAAA;AACd;AAAA,WACF;AAAA,UACC,KAAA,oBACC,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,EAAA,EAAI,OAAA;AAAA,cACJ,OAAA,EAAS,QAAA,GAAW,MAAA,GAAY,MAAM,YAAA,EAAa;AAAA,cACnD,KAAA,EAAO,WAAA;AAAA,cACP,6BAAA,EAA2B,IAAA;AAAA,cAE1B,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"index.js","sourcesContent":["import { useEffect, useState, useCallback } from 'react';\nimport {\n initFocusVisible,\n isFocusVisible as checkFocusVisible,\n focusWithVisibleRing,\n} from '@a11y-core/core';\n\n/**\n * Hook to detect if focus should be visible (keyboard navigation)\n *\n * @example\n * ```tsx\n * function Button({ children }) {\n * const { isFocusVisible, focusProps } = useFocusVisible();\n *\n * return (\n * <button\n * {...focusProps}\n * className={isFocusVisible ? 'focus-ring' : ''}\n * >\n * {children}\n * </button>\n * );\n * }\n * ```\n */\nexport function useFocusVisible() {\n const [isFocusVisible, setIsFocusVisible] = useState(false);\n\n // Initialize focus-visible tracking\n useEffect(() => {\n const cleanup = initFocusVisible();\n return cleanup;\n }, []);\n\n const handleFocus = useCallback(() => {\n setIsFocusVisible(checkFocusVisible());\n }, []);\n\n const handleBlur = useCallback(() => {\n setIsFocusVisible(false);\n }, []);\n\n return {\n isFocusVisible,\n focusProps: {\n onFocus: handleFocus,\n onBlur: handleBlur,\n },\n };\n}\n\n/**\n * Hook for managing focus on a specific element\n *\n * @example\n * ```tsx\n * function Combobox() {\n * const inputRef = useFocusManager<HTMLInputElement>({\n * autoFocus: true,\n * });\n *\n * return <input ref={inputRef} />;\n * }\n * ```\n */\nexport function useFocusManager<T extends HTMLElement = HTMLElement>(options: {\n autoFocus?: boolean;\n restoreFocus?: boolean;\n focusVisible?: boolean;\n} = {}) {\n const { autoFocus = false, restoreFocus = false, focusVisible = true } = options;\n\n const elementRef = useCallback(\n (node: T | null) => {\n if (node && autoFocus) {\n // Delay focus to ensure DOM is ready\n requestAnimationFrame(() => {\n if (focusVisible) {\n focusWithVisibleRing(node);\n } else {\n node.focus();\n }\n });\n }\n },\n [autoFocus, focusVisible]\n );\n\n // Store ref for restore focus\n useEffect(() => {\n if (!restoreFocus) return;\n\n const previousElement = document.activeElement as HTMLElement;\n\n return () => {\n if (previousElement && previousElement.focus) {\n previousElement.focus();\n }\n };\n }, [restoreFocus]);\n\n return elementRef;\n}\n\n/**\n * Focus an element programmatically with proper focus-visible handling\n */\nexport function useFocusControl<T extends HTMLElement = HTMLElement>() {\n const elementRef = useCallback((_node: T | null) => {\n // Just store the ref\n }, []);\n\n const focus = useCallback((options?: { visible?: boolean }) => {\n const element = elementRef as unknown as { current: T | null };\n if (element.current) {\n if (options?.visible) {\n focusWithVisibleRing(element.current);\n } else {\n element.current.focus();\n }\n }\n }, []);\n\n return { ref: elementRef, focus };\n}\n\n/**\n * Track if an element has focus\n */\nexport function useFocusWithin<T extends HTMLElement = HTMLElement>() {\n const [hasFocus, setHasFocus] = useState(false);\n const containerRef = useCallback<React.RefCallback<T>>((_node) => {\n // Element ref callback\n }, []);\n\n const handleFocusIn = useCallback(() => {\n setHasFocus(true);\n }, []);\n\n const handleFocusOut = useCallback((event: React.FocusEvent) => {\n const container = event.currentTarget;\n const relatedTarget = event.relatedTarget as Node | null;\n\n // Check if focus moved outside the container\n if (!relatedTarget || !container.contains(relatedTarget)) {\n setHasFocus(false);\n }\n }, []);\n\n return {\n ref: containerRef,\n hasFocus,\n focusWithinProps: {\n onFocus: handleFocusIn,\n onBlur: handleFocusOut,\n },\n };\n}\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport interface UseRovingTabindexOptions {\n /** Initial active index */\n initialIndex?: number;\n /** Whether navigation wraps around */\n wrap?: boolean;\n /** Orientation for arrow keys */\n orientation?: 'horizontal' | 'vertical' | 'both';\n /** Called when active index changes */\n onChange?: (index: number) => void;\n}\n\nexport interface RovingTabindexItem {\n /** Props to spread on the item element */\n props: {\n tabIndex: number;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onFocus: () => void;\n };\n /** Whether this item is the active/focusable one */\n isActive: boolean;\n}\n\n/**\n * Hook for roving tabindex pattern\n *\n * @example\n * ```tsx\n * function Toolbar() {\n * const { getItemProps, activeIndex } = useRovingTabindex({\n * itemCount: 3,\n * orientation: 'horizontal',\n * });\n *\n * return (\n * <div role=\"toolbar\">\n * <button {...getItemProps(0)}>Cut</button>\n * <button {...getItemProps(1)}>Copy</button>\n * <button {...getItemProps(2)}>Paste</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useRovingTabindex(options: UseRovingTabindexOptions & { itemCount: number }) {\n const {\n itemCount,\n initialIndex = 0,\n wrap = true,\n orientation = 'both',\n onChange,\n } = options;\n\n const [activeIndex, setActiveIndex] = useState(initialIndex);\n const itemRefs = useRef<(HTMLElement | null)[]>([]);\n\n // Reset if item count changes\n useEffect(() => {\n if (activeIndex >= itemCount) {\n setActiveIndex(Math.max(0, itemCount - 1));\n }\n }, [itemCount, activeIndex]);\n\n const moveTo = useCallback(\n (index: number) => {\n let newIndex = index;\n if (newIndex < 0) {\n newIndex = wrap ? itemCount - 1 : 0;\n } else if (newIndex >= itemCount) {\n newIndex = wrap ? 0 : itemCount - 1;\n }\n\n setActiveIndex(newIndex);\n onChange?.(newIndex);\n\n // Focus the element\n const element = itemRefs.current[newIndex];\n element?.focus();\n },\n [itemCount, wrap, onChange]\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent, index: number) => {\n let handled = false;\n\n switch (event.key) {\n case 'ArrowRight':\n if (orientation === 'horizontal' || orientation === 'both') {\n moveTo(index + 1);\n handled = true;\n }\n break;\n case 'ArrowLeft':\n if (orientation === 'horizontal' || orientation === 'both') {\n moveTo(index - 1);\n handled = true;\n }\n break;\n case 'ArrowDown':\n if (orientation === 'vertical' || orientation === 'both') {\n moveTo(index + 1);\n handled = true;\n }\n break;\n case 'ArrowUp':\n if (orientation === 'vertical' || orientation === 'both') {\n moveTo(index - 1);\n handled = true;\n }\n break;\n case 'Home':\n moveTo(0);\n handled = true;\n break;\n case 'End':\n moveTo(itemCount - 1);\n handled = true;\n break;\n }\n\n if (handled) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [orientation, moveTo, itemCount]\n );\n\n const getItemProps = useCallback(\n (index: number) => ({\n ref: (el: HTMLElement | null) => {\n itemRefs.current[index] = el;\n },\n tabIndex: index === activeIndex ? 0 : -1,\n onKeyDown: (event: React.KeyboardEvent) => handleKeyDown(event, index),\n onFocus: () => {\n if (index !== activeIndex) {\n setActiveIndex(index);\n onChange?.(index);\n }\n },\n }),\n [activeIndex, handleKeyDown, onChange]\n );\n\n return {\n activeIndex,\n setActiveIndex: moveTo,\n getItemProps,\n first: () => moveTo(0),\n last: () => moveTo(itemCount - 1),\n next: () => moveTo(activeIndex + 1),\n previous: () => moveTo(activeIndex - 1),\n };\n}\n\n/**\n * Simplified roving tabindex for items with known IDs\n */\nexport function useRovingTabindexMap<T extends string>(\n ids: T[],\n options: Omit<UseRovingTabindexOptions, 'itemCount'> = {}\n) {\n const roving = useRovingTabindex({\n ...options,\n itemCount: ids.length,\n });\n\n const getItemProps = useCallback(\n (id: T) => {\n const index = ids.indexOf(id);\n if (index === -1) {\n throw new Error(`Unknown item ID: ${id}`);\n }\n return roving.getItemProps(index);\n },\n [ids, roving]\n );\n\n const activeId = ids[roving.activeIndex];\n\n return {\n ...roving,\n activeId,\n getItemProps,\n setActiveId: (id: T) => {\n const index = ids.indexOf(id);\n if (index !== -1) {\n roving.setActiveIndex(index);\n }\n },\n };\n}\n","import React, { forwardRef, useCallback, useEffect, useState } from 'react';\nimport { createComponentWarnings } from '@a11y-core/core';\nimport { useId } from '../../hooks/use-id';\nimport { useKeyboard } from '../../hooks/use-keyboard';\nimport { useAnnouncer } from '../../hooks/use-announcer';\n\nconst warnings = createComponentWarnings('Switch');\n\nexport interface SwitchProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onChange' | 'role'\n> {\n /** Controlled checked state */\n checked?: boolean;\n /** Default checked state (uncontrolled) */\n defaultChecked?: boolean;\n /** Called when the switch state changes */\n onCheckedChange?: (checked: boolean) => void;\n /** Accessible label for the switch (renders visible label next to switch) */\n label?: string;\n /** Whether the switch is disabled */\n disabled?: boolean;\n /** Remove default styles to allow full customization via className */\n unstyled?: boolean;\n /** Custom class name */\n className?: string;\n /** Size variant */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * Switch component - An accessible toggle switch (on/off control)\n *\n * Follows WAI-ARIA Switch pattern with proper keyboard support and screen reader announcements.\n *\n * @example\n * ```tsx\n * // Uncontrolled\n * <Switch defaultChecked={true} label=\"Enable notifications\" />\n *\n * // Controlled\n * <Switch\n * checked={enabled}\n * onCheckedChange={setEnabled}\n * aria-label=\"Dark mode\"\n * />\n *\n * // With visible label\n * <Switch checked={enabled} onCheckedChange={setEnabled} label=\"Dark mode\" />\n * ```\n */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(\n function Switch(\n {\n checked: controlledChecked,\n defaultChecked = false,\n onCheckedChange,\n label,\n disabled = false,\n unstyled = false,\n className,\n size = 'md',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n onClick,\n ...props\n },\n ref\n ) {\n const id = useId('switch');\n const labelId = `${id}-label`;\n const { announce } = useAnnouncer();\n\n // Support both controlled and uncontrolled modes\n const [uncontrolledChecked, setUncontrolledChecked] =\n useState(defaultChecked);\n const isControlled = controlledChecked !== undefined;\n const checked = isControlled ? controlledChecked : uncontrolledChecked;\n\n // Warn if no accessible label is provided\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledby) {\n warnings.warning(\n 'Switch has no accessible label. Screen readers need this to identify the switch.',\n 'Add label=\"Description\", aria-label=\"...\", or aria-labelledby=\"...\"'\n );\n }\n }, [label, ariaLabel, ariaLabelledby]);\n\n const toggleSwitch = useCallback(() => {\n if (disabled) return;\n\n const newChecked = !checked;\n\n if (!isControlled) {\n setUncontrolledChecked(newChecked);\n }\n\n onCheckedChange?.(newChecked);\n\n // Announce state change to screen readers\n const labelText = label || ariaLabel || 'Switch';\n announce(`${labelText} ${newChecked ? 'on' : 'off'}`);\n }, [\n checked,\n disabled,\n isControlled,\n onCheckedChange,\n label,\n ariaLabel,\n announce,\n ]);\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n toggleSwitch();\n }\n },\n [onClick, toggleSwitch]\n );\n\n // Keyboard handling: Space and Enter should toggle\n const keyboardProps = useKeyboard(\n {\n ' ': () => {\n // Space toggles the switch\n toggleSwitch();\n },\n Enter: () => {\n // Enter also toggles (some users prefer Enter over Space)\n toggleSwitch();\n },\n },\n { preventDefault: true }\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n props.onKeyDown?.(event);\n if (!event.defaultPrevented) {\n keyboardProps.onKeyDown(event);\n }\n };\n\n // Compute ARIA label\n const computedAriaLabel = ariaLabel;\n const computedAriaLabelledby =\n ariaLabelledby || (label ? labelId : undefined);\n\n // Structural styles (always applied)\n const wrapperStructuralStyles: React.CSSProperties = {\n display: 'inline-flex',\n alignItems: 'center',\n };\n\n // Size dimensions for structural styles\n const sizes = {\n sm: { width: 32, height: 18, thumb: 14, translate: 14 },\n md: { width: 44, height: 24, thumb: 20, translate: 20 },\n lg: { width: 56, height: 30, thumb: 26, translate: 26 },\n };\n\n const sizeConfig = sizes[size];\n\n const trackStructuralStyles: React.CSSProperties = {\n position: 'relative',\n display: 'inline-flex',\n alignItems: 'center',\n flexShrink: 0,\n width: sizeConfig.width,\n height: sizeConfig.height,\n border: 'none',\n padding: 2,\n cursor: disabled ? 'not-allowed' : 'pointer',\n };\n\n const trackVisualStyles: React.CSSProperties = unstyled\n ? {}\n : {\n backgroundColor: checked ? '#0066cc' : '#d1d5db',\n borderRadius: sizeConfig.height / 2,\n transition: 'background-color 0.2s ease',\n opacity: disabled ? 0.5 : 1,\n };\n\n const thumbStructuralStyles: React.CSSProperties = {\n position: 'absolute',\n left: 2,\n width: sizeConfig.thumb,\n height: sizeConfig.thumb,\n pointerEvents: 'none',\n transform: checked\n ? `translateX(${sizeConfig.translate}px)`\n : 'translateX(0)',\n };\n\n const thumbVisualStyles: React.CSSProperties = unstyled\n ? {}\n : {\n backgroundColor: 'white',\n borderRadius: '50%',\n boxShadow: '0 1px 3px rgba(0, 0, 0, 0.2)',\n transition: 'transform 0.2s ease',\n };\n\n const labelStyles: React.CSSProperties = unstyled\n ? {\n marginLeft: 8,\n userSelect: 'none',\n cursor: disabled ? 'not-allowed' : 'pointer',\n }\n : {\n marginLeft: 8,\n userSelect: 'none',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.5 : 1,\n };\n\n return (\n <div\n style={wrapperStructuralStyles}\n data-a11y-core-switch-wrapper\n data-size={size}\n >\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={computedAriaLabel}\n aria-labelledby={computedAriaLabelledby}\n disabled={disabled}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n className={className}\n style={{ ...trackStructuralStyles, ...trackVisualStyles }}\n tabIndex={disabled ? -1 : 0}\n data-a11y-core-switch\n data-checked={checked}\n data-disabled={disabled || undefined}\n data-size={size}\n {...props}\n // CSS-in-JS focus-visible styles\n onFocus={(e) => {\n // Add focus-visible indicator\n if (!unstyled) {\n e.currentTarget.style.outline = '2px solid #0066cc';\n e.currentTarget.style.outlineOffset = '2px';\n }\n props.onFocus?.(e);\n }}\n onBlur={(e) => {\n // Remove focus indicator on blur\n if (!unstyled) {\n e.currentTarget.style.outline = 'none';\n }\n props.onBlur?.(e);\n }}\n >\n <span\n style={{ ...thumbStructuralStyles, ...thumbVisualStyles }}\n data-a11y-core-switch-thumb\n aria-hidden=\"true\"\n />\n </button>\n {label && (\n <label\n id={labelId}\n onClick={disabled ? undefined : () => toggleSwitch()}\n style={labelStyles}\n data-a11y-core-switch-label\n >\n {label}\n </label>\n )}\n </div>\n );\n }\n);\n\nSwitch.displayName = 'Switch';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@a11y-core/react",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Accessible React components that just work",
|
|
5
|
+
"author": "Ivan Trajkovski",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./dialog": {
|
|
21
|
+
"types": "./dist/components/dialog/index.d.ts",
|
|
22
|
+
"import": "./dist/components/dialog/index.js",
|
|
23
|
+
"require": "./dist/components/dialog/index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./menu": {
|
|
26
|
+
"types": "./dist/components/menu/index.d.ts",
|
|
27
|
+
"import": "./dist/components/menu/index.js",
|
|
28
|
+
"require": "./dist/components/menu/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./tabs": {
|
|
31
|
+
"types": "./dist/components/tabs/index.d.ts",
|
|
32
|
+
"import": "./dist/components/tabs/index.js",
|
|
33
|
+
"require": "./dist/components/tabs/index.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./toast": {
|
|
36
|
+
"types": "./dist/components/toast/index.d.ts",
|
|
37
|
+
"import": "./dist/components/toast/index.js",
|
|
38
|
+
"require": "./dist/components/toast/index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./combobox": {
|
|
41
|
+
"types": "./dist/components/combobox/index.d.ts",
|
|
42
|
+
"import": "./dist/components/combobox/index.js",
|
|
43
|
+
"require": "./dist/components/combobox/index.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"dev": "tsup --watch",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:watch": "vitest",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"clean": "rm -rf dist node_modules"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@a11y-core/core": "workspace:*"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"react": ">=18.0.0",
|
|
63
|
+
"react-dom": ">=18.0.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@testing-library/react": "^14.1.0",
|
|
67
|
+
"@types/react": "^18.2.0",
|
|
68
|
+
"@types/react-dom": "^18.2.0",
|
|
69
|
+
"jsdom": "^23.0.0",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"react-dom": "^18.2.0",
|
|
72
|
+
"tsup": "^8.0.0",
|
|
73
|
+
"typescript": "^5.3.0",
|
|
74
|
+
"vitest": "^1.2.0"
|
|
75
|
+
},
|
|
76
|
+
"sideEffects": false,
|
|
77
|
+
"keywords": [
|
|
78
|
+
"accessibility",
|
|
79
|
+
"a11y",
|
|
80
|
+
"react",
|
|
81
|
+
"components",
|
|
82
|
+
"dialog",
|
|
83
|
+
"modal",
|
|
84
|
+
"menu",
|
|
85
|
+
"tabs",
|
|
86
|
+
"wcag",
|
|
87
|
+
"aria"
|
|
88
|
+
]
|
|
89
|
+
}
|