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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as ReactJSXRuntime from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { forwardRef, useContext, useRef, useState, createElement, useEffect, Children, useLayoutEffect } from 'react';
|
|
4
|
+
import React__default, { forwardRef, useContext, useRef, useState, createElement, useEffect, Children, useLayoutEffect, isValidElement } from 'react';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
|
|
@@ -2180,6 +2180,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2180
2180
|
onClick,
|
|
2181
2181
|
onFocus,
|
|
2182
2182
|
onKeyDown,
|
|
2183
|
+
onMouseDown,
|
|
2183
2184
|
onMouseEnter,
|
|
2184
2185
|
onMouseLeave,
|
|
2185
2186
|
...other
|
|
@@ -2199,6 +2200,9 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2199
2200
|
const onBlurHandler = e => {
|
|
2200
2201
|
onBlur?.(e);
|
|
2201
2202
|
};
|
|
2203
|
+
const onMouseDownHandler = e => {
|
|
2204
|
+
onMouseDown?.(e);
|
|
2205
|
+
};
|
|
2202
2206
|
const onMouseEnterHandler = e => {
|
|
2203
2207
|
onMouseEnter?.(e);
|
|
2204
2208
|
};
|
|
@@ -2218,6 +2222,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2218
2222
|
onBlur: onBlurHandler,
|
|
2219
2223
|
onMouseEnter: onMouseEnterHandler,
|
|
2220
2224
|
onMouseLeave: onMouseLeaveHandler,
|
|
2225
|
+
onMouseDown: onMouseDownHandler,
|
|
2221
2226
|
...other,
|
|
2222
2227
|
children: icon ? jsxs(Fragment, {
|
|
2223
2228
|
children: [icon, !isIconOnly && children]
|
|
@@ -2264,6 +2269,8 @@ const AccordionItem = ({
|
|
|
2264
2269
|
textPosition: headingTextPosition,
|
|
2265
2270
|
onClick: onToggleHandler,
|
|
2266
2271
|
disabled: disabled,
|
|
2272
|
+
"aria-expanded": expanded,
|
|
2273
|
+
"aria-controls": `accordion-content-${item.id}`,
|
|
2267
2274
|
sx: sx?.accordionHeading,
|
|
2268
2275
|
dark: true,
|
|
2269
2276
|
children: jsx("div", {
|
|
@@ -2271,9 +2278,11 @@ const AccordionItem = ({
|
|
|
2271
2278
|
children: item.heading
|
|
2272
2279
|
})
|
|
2273
2280
|
}), jsx("div", {
|
|
2281
|
+
id: `accordion-content-${item.id}`,
|
|
2274
2282
|
className: expansionClasses,
|
|
2275
2283
|
style: {
|
|
2276
|
-
height: expanded ? contentHeight : 0
|
|
2284
|
+
height: expanded ? contentHeight : 0,
|
|
2285
|
+
visibility: expanded ? "visible" : "hidden"
|
|
2277
2286
|
},
|
|
2278
2287
|
children: jsx("div", {
|
|
2279
2288
|
ref: contentRef,
|
|
@@ -2332,20 +2341,18 @@ const Accordion = ({
|
|
|
2332
2341
|
className: accordionClasses,
|
|
2333
2342
|
css: sx?.accordion,
|
|
2334
2343
|
children: [childrenFirst && children, jsx(List, {
|
|
2335
|
-
children: items.map(item => jsx(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
className
|
|
2346
|
-
|
|
2347
|
-
} : undefined
|
|
2348
|
-
})
|
|
2344
|
+
children: items.map(item => CustomAccordionItem ? jsx(CustomAccordionItem, {
|
|
2345
|
+
expanded: expandedItems.includes(item.id),
|
|
2346
|
+
onToggle: expandToggle,
|
|
2347
|
+
...item
|
|
2348
|
+
}, item.id) : jsx(AccordionItem, {
|
|
2349
|
+
sx: sx,
|
|
2350
|
+
item: item,
|
|
2351
|
+
expanded: expandedItems.includes(item.id),
|
|
2352
|
+
onToggle: expandToggle,
|
|
2353
|
+
className: className?.accordionItem ? {
|
|
2354
|
+
...className.accordionItem
|
|
2355
|
+
} : undefined
|
|
2349
2356
|
}, item.id))
|
|
2350
2357
|
}), !childrenFirst && children]
|
|
2351
2358
|
});
|
|
@@ -2365,6 +2372,8 @@ const Avatar = ({
|
|
|
2365
2372
|
return jsx("div", {
|
|
2366
2373
|
css: sx?.avatar,
|
|
2367
2374
|
className: avatarClasses,
|
|
2375
|
+
role: "img",
|
|
2376
|
+
"aria-label": displayName,
|
|
2368
2377
|
children: jsxs("div", {
|
|
2369
2378
|
css: sx?.initials,
|
|
2370
2379
|
className: initialsClasses,
|
|
@@ -2443,7 +2452,7 @@ const HugeiconsIcon = forwardRef(({ color = 'currentColor', size = 24, strokeWid
|
|
|
2443
2452
|
});
|
|
2444
2453
|
HugeiconsIcon.displayName = 'HugeiconsIcon';
|
|
2445
2454
|
|
|
2446
|
-
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"}]];
|
|
2455
|
+
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"}]];
|
|
2447
2456
|
|
|
2448
2457
|
const ScrollToTopButton = ({
|
|
2449
2458
|
className,
|
|
@@ -2481,7 +2490,8 @@ const ScrollToTopButton = ({
|
|
|
2481
2490
|
"data-testid": "ath-scroll-to-top-button",
|
|
2482
2491
|
onClick: scrollToTop,
|
|
2483
2492
|
variant: variant ?? "secondary",
|
|
2484
|
-
title: title ?? "Back to
|
|
2493
|
+
title: title ?? "Back to top",
|
|
2494
|
+
"aria-label": "Back to top",
|
|
2485
2495
|
dark: dark,
|
|
2486
2496
|
children: jsx(HugeiconsIcon, {
|
|
2487
2497
|
icon: ll,
|
|
@@ -2590,14 +2600,48 @@ const Carousel = ({
|
|
|
2590
2600
|
className,
|
|
2591
2601
|
emptyMessage = "Nothing here yet",
|
|
2592
2602
|
label,
|
|
2603
|
+
onRemove,
|
|
2604
|
+
onReorder,
|
|
2605
|
+
removeLabel = "Remove item",
|
|
2593
2606
|
sx
|
|
2594
2607
|
}) => {
|
|
2595
2608
|
const [isHovered, setIsHovered] = useState(false);
|
|
2596
2609
|
const [showLeftArrow, setShowLeftArrow] = useState(false);
|
|
2597
2610
|
const [showRightArrow, setShowRightArrow] = useState(false);
|
|
2611
|
+
const [dropIndex, setDropIndex] = useState(null);
|
|
2598
2612
|
const carouselRef = useRef(null);
|
|
2613
|
+
const dragIndex = useRef(null);
|
|
2599
2614
|
const carouselClasses = cx("ath-carousel", className?.carousel);
|
|
2600
|
-
const
|
|
2615
|
+
const items = Children.toArray(children);
|
|
2616
|
+
const itemCount = items.length;
|
|
2617
|
+
const interactive = Boolean(onRemove || onReorder);
|
|
2618
|
+
const finishDrag = () => {
|
|
2619
|
+
dragIndex.current = null;
|
|
2620
|
+
setDropIndex(null);
|
|
2621
|
+
};
|
|
2622
|
+
const handleDragStart = index => event => {
|
|
2623
|
+
const target = event.target;
|
|
2624
|
+
if (target instanceof Element && target.closest(".ath-carousel-remove, .ath-carousel-remove-button")) {
|
|
2625
|
+
event.preventDefault();
|
|
2626
|
+
return;
|
|
2627
|
+
}
|
|
2628
|
+
dragIndex.current = index;
|
|
2629
|
+
event.dataTransfer.effectAllowed = "move";
|
|
2630
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
2631
|
+
};
|
|
2632
|
+
const handleDragOver = index => event => {
|
|
2633
|
+
if (!onReorder) return;
|
|
2634
|
+
event.preventDefault();
|
|
2635
|
+
event.dataTransfer.dropEffect = "move";
|
|
2636
|
+
if (dropIndex !== index) setDropIndex(index);
|
|
2637
|
+
};
|
|
2638
|
+
const handleDrop = index => event => {
|
|
2639
|
+
event.preventDefault();
|
|
2640
|
+
const from = dragIndex.current;
|
|
2641
|
+
finishDrag();
|
|
2642
|
+
if (from == null || !onReorder) return;
|
|
2643
|
+
onReorder(from, index);
|
|
2644
|
+
};
|
|
2601
2645
|
useLayoutEffect(() => {
|
|
2602
2646
|
const el = carouselRef.current;
|
|
2603
2647
|
if (!el) return;
|
|
@@ -2648,6 +2692,7 @@ const Carousel = ({
|
|
|
2648
2692
|
button: "ath-carousel-arrow ath-carousel-left-arrow"
|
|
2649
2693
|
},
|
|
2650
2694
|
onClick: () => scrollByPage(-1),
|
|
2695
|
+
"aria-label": label ? `Scroll ${label} backward` : "Scroll backward",
|
|
2651
2696
|
icon: jsx(HugeiconsIcon, {
|
|
2652
2697
|
icon: Qt,
|
|
2653
2698
|
size: 36
|
|
@@ -2656,7 +2701,32 @@ const Carousel = ({
|
|
|
2656
2701
|
className: carouselClasses,
|
|
2657
2702
|
css: sx?.carousel,
|
|
2658
2703
|
ref: carouselRef,
|
|
2659
|
-
children: itemCount > 0 ?
|
|
2704
|
+
children: itemCount > 0 ? interactive ? items.map((child, index) => jsxs("div", {
|
|
2705
|
+
className: cx("ath-carousel-slot", onReorder && dropIndex === index && "ath-carousel-slot-target"),
|
|
2706
|
+
draggable: Boolean(onReorder),
|
|
2707
|
+
onDragStart: onReorder ? handleDragStart(index) : undefined,
|
|
2708
|
+
onDragOver: onReorder ? handleDragOver(index) : undefined,
|
|
2709
|
+
onDrop: onReorder ? handleDrop(index) : undefined,
|
|
2710
|
+
onDragEnd: onReorder ? finishDrag : undefined,
|
|
2711
|
+
children: [onRemove && jsx(Button, {
|
|
2712
|
+
variant: "ghost",
|
|
2713
|
+
size: "small",
|
|
2714
|
+
type: "button",
|
|
2715
|
+
className: {
|
|
2716
|
+
button: "ath-carousel-remove-button"
|
|
2717
|
+
},
|
|
2718
|
+
icon: jsx(HugeiconsIcon, {
|
|
2719
|
+
icon: eI,
|
|
2720
|
+
size: 16
|
|
2721
|
+
}),
|
|
2722
|
+
"aria-label": typeof removeLabel === "function" ? removeLabel(index) : removeLabel,
|
|
2723
|
+
onMouseDown: event => event.stopPropagation(),
|
|
2724
|
+
onClick: event => {
|
|
2725
|
+
event.stopPropagation();
|
|
2726
|
+
onRemove(index);
|
|
2727
|
+
}
|
|
2728
|
+
}), child]
|
|
2729
|
+
}, /*#__PURE__*/isValidElement(child) ? child.key ?? index : index)) : children : jsx("div", {
|
|
2660
2730
|
className: "ath-carousel-empty",
|
|
2661
2731
|
children: emptyMessage
|
|
2662
2732
|
})
|
|
@@ -2665,6 +2735,7 @@ const Carousel = ({
|
|
|
2665
2735
|
button: "ath-carousel-arrow ath-carousel-right-arrow"
|
|
2666
2736
|
},
|
|
2667
2737
|
onClick: () => scrollByPage(1),
|
|
2738
|
+
"aria-label": label ? `Scroll ${label} forward` : "Scroll forward",
|
|
2668
2739
|
icon: jsx(HugeiconsIcon, {
|
|
2669
2740
|
icon: un,
|
|
2670
2741
|
size: 36
|
|
@@ -2674,6 +2745,36 @@ const Carousel = ({
|
|
|
2674
2745
|
});
|
|
2675
2746
|
};
|
|
2676
2747
|
|
|
2748
|
+
const Checkbox = ({
|
|
2749
|
+
checked,
|
|
2750
|
+
className,
|
|
2751
|
+
dark = false,
|
|
2752
|
+
disabled = false,
|
|
2753
|
+
id,
|
|
2754
|
+
label,
|
|
2755
|
+
name,
|
|
2756
|
+
sx,
|
|
2757
|
+
onChange
|
|
2758
|
+
}) => {
|
|
2759
|
+
return jsxs("label", {
|
|
2760
|
+
className: cx("ath-checkbox", dark && "ath-checkbox-dark", disabled && "ath-checkbox-disabled", className),
|
|
2761
|
+
css: sx,
|
|
2762
|
+
htmlFor: id,
|
|
2763
|
+
children: [jsx("input", {
|
|
2764
|
+
id: id,
|
|
2765
|
+
className: "ath-checkbox-input",
|
|
2766
|
+
type: "checkbox",
|
|
2767
|
+
name: name,
|
|
2768
|
+
checked: checked,
|
|
2769
|
+
disabled: disabled,
|
|
2770
|
+
onChange: event => onChange(event.target.checked)
|
|
2771
|
+
}), label && jsx("span", {
|
|
2772
|
+
className: "ath-checkbox-label",
|
|
2773
|
+
children: label
|
|
2774
|
+
})]
|
|
2775
|
+
});
|
|
2776
|
+
};
|
|
2777
|
+
|
|
2677
2778
|
const Dropdown = ({
|
|
2678
2779
|
children,
|
|
2679
2780
|
className,
|
|
@@ -2711,6 +2812,7 @@ const FormTextInput = ({
|
|
|
2711
2812
|
error,
|
|
2712
2813
|
disabled,
|
|
2713
2814
|
id,
|
|
2815
|
+
inputMode,
|
|
2714
2816
|
name,
|
|
2715
2817
|
placeholder,
|
|
2716
2818
|
readOnly,
|
|
@@ -2720,6 +2822,8 @@ const FormTextInput = ({
|
|
|
2720
2822
|
type = "text",
|
|
2721
2823
|
value,
|
|
2722
2824
|
onChange,
|
|
2825
|
+
onBlur,
|
|
2826
|
+
onFocus,
|
|
2723
2827
|
onKeyDown,
|
|
2724
2828
|
...other
|
|
2725
2829
|
}) => {
|
|
@@ -2736,12 +2840,15 @@ const FormTextInput = ({
|
|
|
2736
2840
|
css: sx?.input,
|
|
2737
2841
|
disabled: disabled,
|
|
2738
2842
|
name: name,
|
|
2843
|
+
inputMode: inputMode,
|
|
2739
2844
|
placeholder: placeholder,
|
|
2740
2845
|
readOnly: readOnly,
|
|
2741
2846
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2742
2847
|
type: type,
|
|
2743
2848
|
value: value,
|
|
2744
2849
|
onChange: onChangeHandler,
|
|
2850
|
+
onBlur: onBlur,
|
|
2851
|
+
onFocus: onFocus,
|
|
2745
2852
|
onKeyDown: onKeyDown,
|
|
2746
2853
|
id: id,
|
|
2747
2854
|
...other
|
|
@@ -2758,6 +2865,7 @@ const FormField = ({
|
|
|
2758
2865
|
error,
|
|
2759
2866
|
helperText,
|
|
2760
2867
|
id,
|
|
2868
|
+
inputMode,
|
|
2761
2869
|
label,
|
|
2762
2870
|
labelPosition = "above",
|
|
2763
2871
|
name,
|
|
@@ -2770,6 +2878,8 @@ const FormField = ({
|
|
|
2770
2878
|
type = "text",
|
|
2771
2879
|
value,
|
|
2772
2880
|
onChange,
|
|
2881
|
+
onBlur,
|
|
2882
|
+
onFocus,
|
|
2773
2883
|
onKeyDown,
|
|
2774
2884
|
...other
|
|
2775
2885
|
}) => {
|
|
@@ -2814,14 +2924,20 @@ const FormField = ({
|
|
|
2814
2924
|
labelPosition: labelPosition,
|
|
2815
2925
|
dark: dark
|
|
2816
2926
|
}) : null;
|
|
2927
|
+
const describedBy = [error && name ? `${name}-error` : "", helperText && name ? `${name}-helper` : ""].filter(Boolean).join(" ") || undefined;
|
|
2817
2928
|
const inputElement = type === "textarea" ? jsx("textarea", {
|
|
2818
2929
|
autoComplete: autoComplete,
|
|
2819
2930
|
autoFocus: autoFocus,
|
|
2820
2931
|
ref: textAreaRef,
|
|
2932
|
+
id: id,
|
|
2821
2933
|
name: name,
|
|
2934
|
+
"aria-invalid": error ? true : undefined,
|
|
2935
|
+
"aria-describedby": describedBy,
|
|
2822
2936
|
onChange: handleTextAreaChange,
|
|
2823
2937
|
disabled: disabled,
|
|
2824
2938
|
readOnly: readOnly,
|
|
2939
|
+
onBlur: onBlur,
|
|
2940
|
+
onFocus: onFocus,
|
|
2825
2941
|
onKeyDown: onKeyDown,
|
|
2826
2942
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2827
2943
|
className: textAreaClasses,
|
|
@@ -2833,10 +2949,13 @@ const FormField = ({
|
|
|
2833
2949
|
autoComplete: autoComplete,
|
|
2834
2950
|
autoFocus: autoFocus,
|
|
2835
2951
|
name: name,
|
|
2952
|
+
inputMode: inputMode,
|
|
2836
2953
|
type: type,
|
|
2837
2954
|
onChange: handleInputChange,
|
|
2838
2955
|
disabled: disabled,
|
|
2839
2956
|
readOnly: readOnly,
|
|
2957
|
+
onBlur: onBlur,
|
|
2958
|
+
onFocus: onFocus,
|
|
2840
2959
|
onKeyDown: onKeyDown,
|
|
2841
2960
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2842
2961
|
className: {
|
|
@@ -2847,6 +2966,8 @@ const FormField = ({
|
|
|
2847
2966
|
placeholder: placeholder,
|
|
2848
2967
|
size: size,
|
|
2849
2968
|
id: id,
|
|
2969
|
+
"aria-invalid": error ? true : undefined,
|
|
2970
|
+
"aria-describedby": describedBy,
|
|
2850
2971
|
...other
|
|
2851
2972
|
});
|
|
2852
2973
|
const errorElement = error ? jsx("div", {
|
|
@@ -2958,6 +3079,9 @@ const Modal = ({
|
|
|
2958
3079
|
trapFocus = true,
|
|
2959
3080
|
initialFocusRef,
|
|
2960
3081
|
finalFocusRef,
|
|
3082
|
+
ariaLabel,
|
|
3083
|
+
ariaLabelledBy,
|
|
3084
|
+
ariaDescribedBy,
|
|
2961
3085
|
sx,
|
|
2962
3086
|
onClose,
|
|
2963
3087
|
...other
|
|
@@ -3046,6 +3170,10 @@ const Modal = ({
|
|
|
3046
3170
|
css: sx?.modal,
|
|
3047
3171
|
className: modalClasses,
|
|
3048
3172
|
role: "dialog",
|
|
3173
|
+
"aria-modal": "true",
|
|
3174
|
+
"aria-labelledby": ariaLabelledBy || titleId,
|
|
3175
|
+
"aria-label": ariaLabelledBy || titleId ? undefined : ariaLabel,
|
|
3176
|
+
"aria-describedby": ariaDescribedBy,
|
|
3049
3177
|
...other,
|
|
3050
3178
|
children: [(title || showCloseButton) && jsxs("div", {
|
|
3051
3179
|
css: sx?.header,
|
|
@@ -3184,7 +3312,22 @@ const SlideOut = ({
|
|
|
3184
3312
|
const overlayClasses = cx("ath-slide-out-overlay", isOpen && "ath-slide-out-overlay-open", className?.overlay);
|
|
3185
3313
|
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);
|
|
3186
3314
|
const closeButtonClasses = cx("ath-slide-out-close-button", className?.closeButton);
|
|
3315
|
+
const slideOutRef = useRef(null);
|
|
3316
|
+
useEffect(() => {
|
|
3317
|
+
const element = slideOutRef.current;
|
|
3318
|
+
if (!element) return;
|
|
3319
|
+
if (isOpen) element.removeAttribute("inert");else element.setAttribute("inert", "");
|
|
3320
|
+
}, [isOpen]);
|
|
3321
|
+
useEffect(() => {
|
|
3322
|
+
if (!isOpen) return;
|
|
3323
|
+
const handleKeyDown = event => {
|
|
3324
|
+
if (event.key === "Escape") onClose();
|
|
3325
|
+
};
|
|
3326
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
3327
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
3328
|
+
}, [isOpen, onClose]);
|
|
3187
3329
|
return jsxs("div", {
|
|
3330
|
+
ref: slideOutRef,
|
|
3188
3331
|
className: slideOutClasses,
|
|
3189
3332
|
css: sx?.slideOut,
|
|
3190
3333
|
"data-testid": "slide-out",
|
|
@@ -3195,6 +3338,9 @@ const SlideOut = ({
|
|
|
3195
3338
|
}), jsxs("div", {
|
|
3196
3339
|
className: panelClasses,
|
|
3197
3340
|
css: sx?.panel,
|
|
3341
|
+
role: "dialog",
|
|
3342
|
+
"aria-modal": "true",
|
|
3343
|
+
"aria-label": "Menu",
|
|
3198
3344
|
children: [jsx(Button, {
|
|
3199
3345
|
className: {
|
|
3200
3346
|
button: closeButtonClasses
|
|
@@ -3405,5 +3551,5 @@ const tokens = {
|
|
|
3405
3551
|
radius
|
|
3406
3552
|
};
|
|
3407
3553
|
|
|
3408
|
-
export { Accordion, AccordionItem, Avatar, Block, Button, ButtonGroup, Carousel, ContainerScalingText, Dropdown, Footer, FormField, FormLabel, FormTextInput, Header, List, ListItem, Main, Modal, ScrollToTopButton, Search, SlideOut, breakpoints, color, cx, font, media, padding, radius, tokens };
|
|
3554
|
+
export { Accordion, AccordionItem, Avatar, Block, Button, ButtonGroup, Carousel, Checkbox, ContainerScalingText, Dropdown, Footer, FormField, FormLabel, FormTextInput, Header, List, ListItem, Main, Modal, ScrollToTopButton, Search, SlideOut, breakpoints, color, cx, font, media, padding, radius, tokens };
|
|
3409
3555
|
//# sourceMappingURL=athameui.mjs.map
|