athameui 0.0.13 → 0.0.14
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/components/Accordion/Accordion.tsx +23 -23
- package/components/Accordion/AccordionItem.tsx +7 -1
- package/components/Avatar/Avatar.tsx +6 -1
- package/components/Button/Button.tsx +11 -0
- package/components/Button/ScrollToTopButton.tsx +2 -1
- package/components/Carousel/Carousel.tsx +95 -3
- package/components/Checkbox/Checkbox.tsx +51 -0
- package/components/Checkbox/index.ts +1 -0
- package/components/FormField/FormField.tsx +24 -0
- package/components/FormTextInput/FormTextInput.tsx +11 -0
- package/components/Modal/Modal.tsx +7 -0
- package/components/SlideOut/SlideOut.tsx +31 -2
- package/components/index.ts +1 -0
- package/dist/athameui.cjs +166 -19
- package/dist/athameui.cjs.map +1 -1
- package/dist/athameui.mjs +167 -21
- package/dist/athameui.mjs.map +1 -1
- package/dist/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +5 -0
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/ScrollToTopButton.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +4 -1
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/FormField/FormField.d.ts +3 -0
- package/dist/components/FormField/FormField.d.ts.map +1 -1
- package/dist/components/FormTextInput/FormTextInput.d.ts +6 -1
- package/dist/components/FormTextInput/FormTextInput.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/SlideOut/SlideOut.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/styles/components/carousel.css +22 -2
- package/dist/styles/components/checkbox.css +60 -0
- package/dist/styles/theme.css +1 -0
- package/package.json +1 -1
- package/styles/components/carousel.css +22 -2
- package/styles/components/checkbox.css +60 -0
- package/styles/theme.css +1 -0
package/dist/athameui.cjs
CHANGED
|
@@ -2201,6 +2201,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2201
2201
|
onClick,
|
|
2202
2202
|
onFocus,
|
|
2203
2203
|
onKeyDown,
|
|
2204
|
+
onMouseDown,
|
|
2204
2205
|
onMouseEnter,
|
|
2205
2206
|
onMouseLeave,
|
|
2206
2207
|
...other
|
|
@@ -2220,6 +2221,9 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2220
2221
|
const onBlurHandler = e => {
|
|
2221
2222
|
onBlur?.(e);
|
|
2222
2223
|
};
|
|
2224
|
+
const onMouseDownHandler = e => {
|
|
2225
|
+
onMouseDown?.(e);
|
|
2226
|
+
};
|
|
2223
2227
|
const onMouseEnterHandler = e => {
|
|
2224
2228
|
onMouseEnter?.(e);
|
|
2225
2229
|
};
|
|
@@ -2239,6 +2243,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2239
2243
|
onBlur: onBlurHandler,
|
|
2240
2244
|
onMouseEnter: onMouseEnterHandler,
|
|
2241
2245
|
onMouseLeave: onMouseLeaveHandler,
|
|
2246
|
+
onMouseDown: onMouseDownHandler,
|
|
2242
2247
|
...other,
|
|
2243
2248
|
children: icon ? jsxs(Fragment, {
|
|
2244
2249
|
children: [icon, !isIconOnly && children]
|
|
@@ -2285,6 +2290,8 @@ const AccordionItem = ({
|
|
|
2285
2290
|
textPosition: headingTextPosition,
|
|
2286
2291
|
onClick: onToggleHandler,
|
|
2287
2292
|
disabled: disabled,
|
|
2293
|
+
"aria-expanded": expanded,
|
|
2294
|
+
"aria-controls": `accordion-content-${item.id}`,
|
|
2288
2295
|
sx: sx?.accordionHeading,
|
|
2289
2296
|
dark: true,
|
|
2290
2297
|
children: jsx("div", {
|
|
@@ -2292,9 +2299,11 @@ const AccordionItem = ({
|
|
|
2292
2299
|
children: item.heading
|
|
2293
2300
|
})
|
|
2294
2301
|
}), jsx("div", {
|
|
2302
|
+
id: `accordion-content-${item.id}`,
|
|
2295
2303
|
className: expansionClasses,
|
|
2296
2304
|
style: {
|
|
2297
|
-
height: expanded ? contentHeight : 0
|
|
2305
|
+
height: expanded ? contentHeight : 0,
|
|
2306
|
+
visibility: expanded ? "visible" : "hidden"
|
|
2298
2307
|
},
|
|
2299
2308
|
children: jsx("div", {
|
|
2300
2309
|
ref: contentRef,
|
|
@@ -2353,20 +2362,18 @@ const Accordion = ({
|
|
|
2353
2362
|
className: accordionClasses,
|
|
2354
2363
|
css: sx?.accordion,
|
|
2355
2364
|
children: [childrenFirst && children, jsx(List, {
|
|
2356
|
-
children: items.map(item => jsx(
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
className
|
|
2367
|
-
|
|
2368
|
-
} : undefined
|
|
2369
|
-
})
|
|
2365
|
+
children: items.map(item => CustomAccordionItem ? jsx(CustomAccordionItem, {
|
|
2366
|
+
expanded: expandedItems.includes(item.id),
|
|
2367
|
+
onToggle: expandToggle,
|
|
2368
|
+
...item
|
|
2369
|
+
}, item.id) : jsx(AccordionItem, {
|
|
2370
|
+
sx: sx,
|
|
2371
|
+
item: item,
|
|
2372
|
+
expanded: expandedItems.includes(item.id),
|
|
2373
|
+
onToggle: expandToggle,
|
|
2374
|
+
className: className?.accordionItem ? {
|
|
2375
|
+
...className.accordionItem
|
|
2376
|
+
} : undefined
|
|
2370
2377
|
}, item.id))
|
|
2371
2378
|
}), !childrenFirst && children]
|
|
2372
2379
|
});
|
|
@@ -2386,6 +2393,8 @@ const Avatar = ({
|
|
|
2386
2393
|
return jsx("div", {
|
|
2387
2394
|
css: sx?.avatar,
|
|
2388
2395
|
className: avatarClasses,
|
|
2396
|
+
role: "img",
|
|
2397
|
+
"aria-label": displayName,
|
|
2389
2398
|
children: jsxs("div", {
|
|
2390
2399
|
css: sx?.initials,
|
|
2391
2400
|
className: initialsClasses,
|
|
@@ -2464,7 +2473,7 @@ const HugeiconsIcon = React.forwardRef(({ color = 'currentColor', size = 24, str
|
|
|
2464
2473
|
});
|
|
2465
2474
|
HugeiconsIcon.displayName = 'HugeiconsIcon';
|
|
2466
2475
|
|
|
2467
|
-
const Qt=[["path",{d:"M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],un=[["path",{d:"M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],uL=[["path",{d:"M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M14.9994 15L9 9M9.00064 15L15 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],ll=[["path",{d:"M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M12 9.00014V16.0002M15.5 11.5C15.5 11.5 12.9223 8.00001 12 8C11.0777 7.99999 8.50003 11.5 8.50003 11.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];
|
|
2476
|
+
const Qt=[["path",{d:"M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],un=[["path",{d:"M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],uL=[["path",{d:"M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M14.9994 15L9 9M9.00064 15L15 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],ll=[["path",{d:"M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M12 9.00014V16.0002M15.5 11.5C15.5 11.5 12.9223 8.00001 12 8C11.0777 7.99999 8.50003 11.5 8.50003 11.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],eI=[["path",{d:"M19.5 5.5L18.8803 15.5251C18.7219 18.0864 18.6428 19.3671 18.0008 20.2879C17.6833 20.7431 17.2747 21.1273 16.8007 21.416C15.8421 22 14.559 22 11.9927 22C9.42312 22 8.1383 22 7.17905 21.4149C6.7048 21.1257 6.296 20.7408 5.97868 20.2848C5.33688 19.3626 5.25945 18.0801 5.10461 15.5152L4.5 5.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M3 5.5H21M16.0557 5.5L15.3731 4.09173C14.9196 3.15626 14.6928 2.68852 14.3017 2.39681C14.215 2.3321 14.1231 2.27454 14.027 2.2247C13.5939 2 13.0741 2 12.0345 2C10.9688 2 10.436 2 9.99568 2.23412C9.8981 2.28601 9.80498 2.3459 9.71729 2.41317C9.32164 2.7167 9.10063 3.20155 8.65861 4.17126L8.05292 5.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M9.5 16.5L9.5 10.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"2"}],["path",{d:"M14.5 16.5L14.5 10.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"3"}]];
|
|
2468
2477
|
|
|
2469
2478
|
const ScrollToTopButton = ({
|
|
2470
2479
|
className,
|
|
@@ -2502,7 +2511,8 @@ const ScrollToTopButton = ({
|
|
|
2502
2511
|
"data-testid": "ath-scroll-to-top-button",
|
|
2503
2512
|
onClick: scrollToTop,
|
|
2504
2513
|
variant: variant ?? "secondary",
|
|
2505
|
-
title: title ?? "Back to
|
|
2514
|
+
title: title ?? "Back to top",
|
|
2515
|
+
"aria-label": "Back to top",
|
|
2506
2516
|
dark: dark,
|
|
2507
2517
|
children: jsx(HugeiconsIcon, {
|
|
2508
2518
|
icon: ll,
|
|
@@ -2611,14 +2621,48 @@ const Carousel = ({
|
|
|
2611
2621
|
className,
|
|
2612
2622
|
emptyMessage = "Nothing here yet",
|
|
2613
2623
|
label,
|
|
2624
|
+
onRemove,
|
|
2625
|
+
onReorder,
|
|
2626
|
+
removeLabel = "Remove item",
|
|
2614
2627
|
sx
|
|
2615
2628
|
}) => {
|
|
2616
2629
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
2617
2630
|
const [showLeftArrow, setShowLeftArrow] = React.useState(false);
|
|
2618
2631
|
const [showRightArrow, setShowRightArrow] = React.useState(false);
|
|
2632
|
+
const [dropIndex, setDropIndex] = React.useState(null);
|
|
2619
2633
|
const carouselRef = React.useRef(null);
|
|
2634
|
+
const dragIndex = React.useRef(null);
|
|
2620
2635
|
const carouselClasses = cx("ath-carousel", className?.carousel);
|
|
2621
|
-
const
|
|
2636
|
+
const items = React.Children.toArray(children);
|
|
2637
|
+
const itemCount = items.length;
|
|
2638
|
+
const interactive = Boolean(onRemove || onReorder);
|
|
2639
|
+
const finishDrag = () => {
|
|
2640
|
+
dragIndex.current = null;
|
|
2641
|
+
setDropIndex(null);
|
|
2642
|
+
};
|
|
2643
|
+
const handleDragStart = index => event => {
|
|
2644
|
+
const target = event.target;
|
|
2645
|
+
if (target instanceof Element && target.closest(".ath-carousel-remove, .ath-carousel-remove-button")) {
|
|
2646
|
+
event.preventDefault();
|
|
2647
|
+
return;
|
|
2648
|
+
}
|
|
2649
|
+
dragIndex.current = index;
|
|
2650
|
+
event.dataTransfer.effectAllowed = "move";
|
|
2651
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
2652
|
+
};
|
|
2653
|
+
const handleDragOver = index => event => {
|
|
2654
|
+
if (!onReorder) return;
|
|
2655
|
+
event.preventDefault();
|
|
2656
|
+
event.dataTransfer.dropEffect = "move";
|
|
2657
|
+
if (dropIndex !== index) setDropIndex(index);
|
|
2658
|
+
};
|
|
2659
|
+
const handleDrop = index => event => {
|
|
2660
|
+
event.preventDefault();
|
|
2661
|
+
const from = dragIndex.current;
|
|
2662
|
+
finishDrag();
|
|
2663
|
+
if (from == null || !onReorder) return;
|
|
2664
|
+
onReorder(from, index);
|
|
2665
|
+
};
|
|
2622
2666
|
React.useLayoutEffect(() => {
|
|
2623
2667
|
const el = carouselRef.current;
|
|
2624
2668
|
if (!el) return;
|
|
@@ -2669,6 +2713,7 @@ const Carousel = ({
|
|
|
2669
2713
|
button: "ath-carousel-arrow ath-carousel-left-arrow"
|
|
2670
2714
|
},
|
|
2671
2715
|
onClick: () => scrollByPage(-1),
|
|
2716
|
+
"aria-label": label ? `Scroll ${label} backward` : "Scroll backward",
|
|
2672
2717
|
icon: jsx(HugeiconsIcon, {
|
|
2673
2718
|
icon: Qt,
|
|
2674
2719
|
size: 36
|
|
@@ -2677,7 +2722,32 @@ const Carousel = ({
|
|
|
2677
2722
|
className: carouselClasses,
|
|
2678
2723
|
css: sx?.carousel,
|
|
2679
2724
|
ref: carouselRef,
|
|
2680
|
-
children: itemCount > 0 ?
|
|
2725
|
+
children: itemCount > 0 ? interactive ? items.map((child, index) => jsxs("div", {
|
|
2726
|
+
className: cx("ath-carousel-slot", onReorder && dropIndex === index && "ath-carousel-slot-target"),
|
|
2727
|
+
draggable: Boolean(onReorder),
|
|
2728
|
+
onDragStart: onReorder ? handleDragStart(index) : undefined,
|
|
2729
|
+
onDragOver: onReorder ? handleDragOver(index) : undefined,
|
|
2730
|
+
onDrop: onReorder ? handleDrop(index) : undefined,
|
|
2731
|
+
onDragEnd: onReorder ? finishDrag : undefined,
|
|
2732
|
+
children: [onRemove && jsx(Button, {
|
|
2733
|
+
variant: "ghost",
|
|
2734
|
+
size: "small",
|
|
2735
|
+
type: "button",
|
|
2736
|
+
className: {
|
|
2737
|
+
button: "ath-carousel-remove-button"
|
|
2738
|
+
},
|
|
2739
|
+
icon: jsx(HugeiconsIcon, {
|
|
2740
|
+
icon: eI,
|
|
2741
|
+
size: 16
|
|
2742
|
+
}),
|
|
2743
|
+
"aria-label": typeof removeLabel === "function" ? removeLabel(index) : removeLabel,
|
|
2744
|
+
onMouseDown: event => event.stopPropagation(),
|
|
2745
|
+
onClick: event => {
|
|
2746
|
+
event.stopPropagation();
|
|
2747
|
+
onRemove(index);
|
|
2748
|
+
}
|
|
2749
|
+
}), child]
|
|
2750
|
+
}, /*#__PURE__*/React.isValidElement(child) ? child.key ?? index : index)) : children : jsx("div", {
|
|
2681
2751
|
className: "ath-carousel-empty",
|
|
2682
2752
|
children: emptyMessage
|
|
2683
2753
|
})
|
|
@@ -2686,6 +2756,7 @@ const Carousel = ({
|
|
|
2686
2756
|
button: "ath-carousel-arrow ath-carousel-right-arrow"
|
|
2687
2757
|
},
|
|
2688
2758
|
onClick: () => scrollByPage(1),
|
|
2759
|
+
"aria-label": label ? `Scroll ${label} forward` : "Scroll forward",
|
|
2689
2760
|
icon: jsx(HugeiconsIcon, {
|
|
2690
2761
|
icon: un,
|
|
2691
2762
|
size: 36
|
|
@@ -2695,6 +2766,36 @@ const Carousel = ({
|
|
|
2695
2766
|
});
|
|
2696
2767
|
};
|
|
2697
2768
|
|
|
2769
|
+
const Checkbox = ({
|
|
2770
|
+
checked,
|
|
2771
|
+
className,
|
|
2772
|
+
dark = false,
|
|
2773
|
+
disabled = false,
|
|
2774
|
+
id,
|
|
2775
|
+
label,
|
|
2776
|
+
name,
|
|
2777
|
+
sx,
|
|
2778
|
+
onChange
|
|
2779
|
+
}) => {
|
|
2780
|
+
return jsxs("label", {
|
|
2781
|
+
className: cx("ath-checkbox", dark && "ath-checkbox-dark", disabled && "ath-checkbox-disabled", className),
|
|
2782
|
+
css: sx,
|
|
2783
|
+
htmlFor: id,
|
|
2784
|
+
children: [jsx("input", {
|
|
2785
|
+
id: id,
|
|
2786
|
+
className: "ath-checkbox-input",
|
|
2787
|
+
type: "checkbox",
|
|
2788
|
+
name: name,
|
|
2789
|
+
checked: checked,
|
|
2790
|
+
disabled: disabled,
|
|
2791
|
+
onChange: event => onChange(event.target.checked)
|
|
2792
|
+
}), label && jsx("span", {
|
|
2793
|
+
className: "ath-checkbox-label",
|
|
2794
|
+
children: label
|
|
2795
|
+
})]
|
|
2796
|
+
});
|
|
2797
|
+
};
|
|
2798
|
+
|
|
2698
2799
|
const Dropdown = ({
|
|
2699
2800
|
children,
|
|
2700
2801
|
className,
|
|
@@ -2732,6 +2833,7 @@ const FormTextInput = ({
|
|
|
2732
2833
|
error,
|
|
2733
2834
|
disabled,
|
|
2734
2835
|
id,
|
|
2836
|
+
inputMode,
|
|
2735
2837
|
name,
|
|
2736
2838
|
placeholder,
|
|
2737
2839
|
readOnly,
|
|
@@ -2741,6 +2843,8 @@ const FormTextInput = ({
|
|
|
2741
2843
|
type = "text",
|
|
2742
2844
|
value,
|
|
2743
2845
|
onChange,
|
|
2846
|
+
onBlur,
|
|
2847
|
+
onFocus,
|
|
2744
2848
|
onKeyDown,
|
|
2745
2849
|
...other
|
|
2746
2850
|
}) => {
|
|
@@ -2757,12 +2861,15 @@ const FormTextInput = ({
|
|
|
2757
2861
|
css: sx?.input,
|
|
2758
2862
|
disabled: disabled,
|
|
2759
2863
|
name: name,
|
|
2864
|
+
inputMode: inputMode,
|
|
2760
2865
|
placeholder: placeholder,
|
|
2761
2866
|
readOnly: readOnly,
|
|
2762
2867
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2763
2868
|
type: type,
|
|
2764
2869
|
value: value,
|
|
2765
2870
|
onChange: onChangeHandler,
|
|
2871
|
+
onBlur: onBlur,
|
|
2872
|
+
onFocus: onFocus,
|
|
2766
2873
|
onKeyDown: onKeyDown,
|
|
2767
2874
|
id: id,
|
|
2768
2875
|
...other
|
|
@@ -2779,6 +2886,7 @@ const FormField = ({
|
|
|
2779
2886
|
error,
|
|
2780
2887
|
helperText,
|
|
2781
2888
|
id,
|
|
2889
|
+
inputMode,
|
|
2782
2890
|
label,
|
|
2783
2891
|
labelPosition = "above",
|
|
2784
2892
|
name,
|
|
@@ -2791,6 +2899,8 @@ const FormField = ({
|
|
|
2791
2899
|
type = "text",
|
|
2792
2900
|
value,
|
|
2793
2901
|
onChange,
|
|
2902
|
+
onBlur,
|
|
2903
|
+
onFocus,
|
|
2794
2904
|
onKeyDown,
|
|
2795
2905
|
...other
|
|
2796
2906
|
}) => {
|
|
@@ -2835,14 +2945,20 @@ const FormField = ({
|
|
|
2835
2945
|
labelPosition: labelPosition,
|
|
2836
2946
|
dark: dark
|
|
2837
2947
|
}) : null;
|
|
2948
|
+
const describedBy = [error && name ? `${name}-error` : "", helperText && name ? `${name}-helper` : ""].filter(Boolean).join(" ") || undefined;
|
|
2838
2949
|
const inputElement = type === "textarea" ? jsx("textarea", {
|
|
2839
2950
|
autoComplete: autoComplete,
|
|
2840
2951
|
autoFocus: autoFocus,
|
|
2841
2952
|
ref: textAreaRef,
|
|
2953
|
+
id: id,
|
|
2842
2954
|
name: name,
|
|
2955
|
+
"aria-invalid": error ? true : undefined,
|
|
2956
|
+
"aria-describedby": describedBy,
|
|
2843
2957
|
onChange: handleTextAreaChange,
|
|
2844
2958
|
disabled: disabled,
|
|
2845
2959
|
readOnly: readOnly,
|
|
2960
|
+
onBlur: onBlur,
|
|
2961
|
+
onFocus: onFocus,
|
|
2846
2962
|
onKeyDown: onKeyDown,
|
|
2847
2963
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2848
2964
|
className: textAreaClasses,
|
|
@@ -2854,10 +2970,13 @@ const FormField = ({
|
|
|
2854
2970
|
autoComplete: autoComplete,
|
|
2855
2971
|
autoFocus: autoFocus,
|
|
2856
2972
|
name: name,
|
|
2973
|
+
inputMode: inputMode,
|
|
2857
2974
|
type: type,
|
|
2858
2975
|
onChange: handleInputChange,
|
|
2859
2976
|
disabled: disabled,
|
|
2860
2977
|
readOnly: readOnly,
|
|
2978
|
+
onBlur: onBlur,
|
|
2979
|
+
onFocus: onFocus,
|
|
2861
2980
|
onKeyDown: onKeyDown,
|
|
2862
2981
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2863
2982
|
className: {
|
|
@@ -2868,6 +2987,8 @@ const FormField = ({
|
|
|
2868
2987
|
placeholder: placeholder,
|
|
2869
2988
|
size: size,
|
|
2870
2989
|
id: id,
|
|
2990
|
+
"aria-invalid": error ? true : undefined,
|
|
2991
|
+
"aria-describedby": describedBy,
|
|
2871
2992
|
...other
|
|
2872
2993
|
});
|
|
2873
2994
|
const errorElement = error ? jsx("div", {
|
|
@@ -2979,6 +3100,9 @@ const Modal = ({
|
|
|
2979
3100
|
trapFocus = true,
|
|
2980
3101
|
initialFocusRef,
|
|
2981
3102
|
finalFocusRef,
|
|
3103
|
+
ariaLabel,
|
|
3104
|
+
ariaLabelledBy,
|
|
3105
|
+
ariaDescribedBy,
|
|
2982
3106
|
sx,
|
|
2983
3107
|
onClose,
|
|
2984
3108
|
...other
|
|
@@ -3067,6 +3191,10 @@ const Modal = ({
|
|
|
3067
3191
|
css: sx?.modal,
|
|
3068
3192
|
className: modalClasses,
|
|
3069
3193
|
role: "dialog",
|
|
3194
|
+
"aria-modal": "true",
|
|
3195
|
+
"aria-labelledby": ariaLabelledBy || titleId,
|
|
3196
|
+
"aria-label": ariaLabelledBy || titleId ? undefined : ariaLabel,
|
|
3197
|
+
"aria-describedby": ariaDescribedBy,
|
|
3070
3198
|
...other,
|
|
3071
3199
|
children: [(title || showCloseButton) && jsxs("div", {
|
|
3072
3200
|
css: sx?.header,
|
|
@@ -3205,7 +3333,22 @@ const SlideOut = ({
|
|
|
3205
3333
|
const overlayClasses = cx("ath-slide-out-overlay", isOpen && "ath-slide-out-overlay-open", className?.overlay);
|
|
3206
3334
|
const panelClasses = cx("ath-slide-out-panel", from === "left" ? "ath-slide-out-from-left" : "ath-slide-out-from-right", isOpen && "ath-slide-out-panel-open", className?.panel);
|
|
3207
3335
|
const closeButtonClasses = cx("ath-slide-out-close-button", className?.closeButton);
|
|
3336
|
+
const slideOutRef = React.useRef(null);
|
|
3337
|
+
React.useEffect(() => {
|
|
3338
|
+
const element = slideOutRef.current;
|
|
3339
|
+
if (!element) return;
|
|
3340
|
+
if (isOpen) element.removeAttribute("inert");else element.setAttribute("inert", "");
|
|
3341
|
+
}, [isOpen]);
|
|
3342
|
+
React.useEffect(() => {
|
|
3343
|
+
if (!isOpen) return;
|
|
3344
|
+
const handleKeyDown = event => {
|
|
3345
|
+
if (event.key === "Escape") onClose();
|
|
3346
|
+
};
|
|
3347
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
3348
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
3349
|
+
}, [isOpen, onClose]);
|
|
3208
3350
|
return jsxs("div", {
|
|
3351
|
+
ref: slideOutRef,
|
|
3209
3352
|
className: slideOutClasses,
|
|
3210
3353
|
css: sx?.slideOut,
|
|
3211
3354
|
"data-testid": "slide-out",
|
|
@@ -3216,6 +3359,9 @@ const SlideOut = ({
|
|
|
3216
3359
|
}), jsxs("div", {
|
|
3217
3360
|
className: panelClasses,
|
|
3218
3361
|
css: sx?.panel,
|
|
3362
|
+
role: "dialog",
|
|
3363
|
+
"aria-modal": "true",
|
|
3364
|
+
"aria-label": "Menu",
|
|
3219
3365
|
children: [jsx(Button, {
|
|
3220
3366
|
className: {
|
|
3221
3367
|
button: closeButtonClasses
|
|
@@ -3433,6 +3579,7 @@ exports.Block = Block;
|
|
|
3433
3579
|
exports.Button = Button;
|
|
3434
3580
|
exports.ButtonGroup = ButtonGroup;
|
|
3435
3581
|
exports.Carousel = Carousel;
|
|
3582
|
+
exports.Checkbox = Checkbox;
|
|
3436
3583
|
exports.ContainerScalingText = ContainerScalingText;
|
|
3437
3584
|
exports.Dropdown = Dropdown;
|
|
3438
3585
|
exports.Footer = Footer;
|