athameui 0.0.12 → 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.
Files changed (64) hide show
  1. package/components/Accordion/Accordion.tsx +23 -23
  2. package/components/Accordion/AccordionItem.tsx +7 -1
  3. package/components/Avatar/Avatar.tsx +6 -1
  4. package/components/Button/Button.tsx +11 -0
  5. package/components/Button/ScrollToTopButton.tsx +2 -1
  6. package/components/Carousel/Carousel.tsx +159 -37
  7. package/components/Checkbox/Checkbox.tsx +51 -0
  8. package/components/Checkbox/index.ts +1 -0
  9. package/components/FormField/FormField.tsx +24 -0
  10. package/components/FormTextInput/FormTextInput.tsx +11 -0
  11. package/components/Layout/Main.tsx +11 -2
  12. package/components/Modal/Modal.tsx +9 -2
  13. package/components/SlideOut/SlideOut.tsx +31 -2
  14. package/components/index.ts +1 -0
  15. package/dist/athameui.cjs +410 -262
  16. package/dist/athameui.cjs.map +1 -1
  17. package/dist/athameui.mjs +406 -248
  18. package/dist/athameui.mjs.map +1 -1
  19. package/dist/components/Accordion/AccordionItem.d.ts.map +1 -1
  20. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  21. package/dist/components/Button/Button.d.ts +5 -0
  22. package/dist/components/Button/Button.d.ts.map +1 -1
  23. package/dist/components/Button/ScrollToTopButton.d.ts.map +1 -1
  24. package/dist/components/Carousel/Carousel.d.ts +5 -1
  25. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  26. package/dist/components/Checkbox/Checkbox.d.ts +14 -0
  27. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
  28. package/dist/components/Checkbox/index.d.ts +2 -0
  29. package/dist/components/Checkbox/index.d.ts.map +1 -0
  30. package/dist/components/FormField/FormField.d.ts +3 -0
  31. package/dist/components/FormField/FormField.d.ts.map +1 -1
  32. package/dist/components/FormTextInput/FormTextInput.d.ts +6 -1
  33. package/dist/components/FormTextInput/FormTextInput.d.ts.map +1 -1
  34. package/dist/components/Layout/Main.d.ts +2 -1
  35. package/dist/components/Layout/Main.d.ts.map +1 -1
  36. package/dist/components/Modal/Modal.d.ts.map +1 -1
  37. package/dist/components/SlideOut/SlideOut.d.ts.map +1 -1
  38. package/dist/components/index.d.ts +1 -0
  39. package/dist/components/index.d.ts.map +1 -1
  40. package/dist/styles/components/carousel.css +28 -4
  41. package/dist/styles/components/checkbox.css +60 -0
  42. package/dist/styles/components/form-input.css +2 -1
  43. package/dist/styles/components/main.css +17 -2
  44. package/dist/styles/index.d.ts +0 -1
  45. package/dist/styles/index.d.ts.map +1 -1
  46. package/dist/styles/index.ts +0 -1
  47. package/dist/styles/theme.css +1 -0
  48. package/dist/styles/tokens.css +16 -17
  49. package/dist/styles/tokens.d.ts +209 -26
  50. package/dist/styles/tokens.d.ts.map +1 -1
  51. package/dist/styles/tokens.ts +190 -165
  52. package/package.json +1 -1
  53. package/styles/components/carousel.css +28 -4
  54. package/styles/components/checkbox.css +60 -0
  55. package/styles/components/form-input.css +2 -1
  56. package/styles/components/main.css +17 -2
  57. package/styles/index.ts +0 -1
  58. package/styles/theme.css +1 -0
  59. package/styles/tokens.css +16 -17
  60. package/styles/tokens.ts +190 -165
  61. package/dist/styles/breakpoints.d.ts +0 -29
  62. package/dist/styles/breakpoints.d.ts.map +0 -1
  63. package/dist/styles/breakpoints.ts +0 -34
  64. package/styles/breakpoints.ts +0 -34
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("div", {
2336
- children: CustomAccordionItem ? jsx(CustomAccordionItem, {
2337
- expanded: expandedItems.includes(item.id),
2338
- onToggle: expandToggle,
2339
- ...item
2340
- }) : jsx(AccordionItem, {
2341
- sx: sx,
2342
- item: item,
2343
- expanded: expandedItems.includes(item.id),
2344
- onToggle: expandToggle,
2345
- className: className?.accordionItem ? {
2346
- ...className.accordionItem
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 Top",
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,
@@ -2561,16 +2571,96 @@ const ButtonGroup = ({
2561
2571
  });
2562
2572
  };
2563
2573
 
2574
+ const FormLabel = ({
2575
+ label,
2576
+ required,
2577
+ className,
2578
+ labelPosition = "above",
2579
+ dark,
2580
+ sx,
2581
+ ...other
2582
+ }) => {
2583
+ const labelClasses = cx("ath-form-input-label", labelPosition ? `ath-form-input-label-${labelPosition}` : "", dark ? "ath-form-input-label-dark" : "", className?.label);
2584
+ const requiredClasses = cx("ath-form-input-label-required", dark ? "ath-form-input-label-required-dark" : "", className?.required);
2585
+ return jsxs("label", {
2586
+ className: labelClasses,
2587
+ css: sx?.label,
2588
+ ...other,
2589
+ children: [label, required && jsx("span", {
2590
+ className: requiredClasses,
2591
+ css: sx?.required,
2592
+ "aria-label": "required",
2593
+ children: "*"
2594
+ })]
2595
+ });
2596
+ };
2597
+
2564
2598
  const Carousel = ({
2565
2599
  children,
2566
2600
  className,
2567
2601
  emptyMessage = "Nothing here yet",
2602
+ label,
2603
+ onRemove,
2604
+ onReorder,
2605
+ removeLabel = "Remove item",
2568
2606
  sx
2569
2607
  }) => {
2570
2608
  const [isHovered, setIsHovered] = useState(false);
2609
+ const [showLeftArrow, setShowLeftArrow] = useState(false);
2610
+ const [showRightArrow, setShowRightArrow] = useState(false);
2611
+ const [dropIndex, setDropIndex] = useState(null);
2571
2612
  const carouselRef = useRef(null);
2572
- const carouselClasses = cx("ath-carousel", isHovered ? "ath-carousel-hover" : "", className?.carousel);
2573
- const hasItems = Children.count(children) > 0;
2613
+ const dragIndex = useRef(null);
2614
+ const carouselClasses = cx("ath-carousel", className?.carousel);
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
+ };
2645
+ useLayoutEffect(() => {
2646
+ const el = carouselRef.current;
2647
+ if (!el) return;
2648
+ const updateArrows = () => {
2649
+ const hidden = el.scrollWidth - el.clientWidth;
2650
+ setShowLeftArrow(el.scrollLeft > 1);
2651
+ setShowRightArrow(hidden - el.scrollLeft > 1);
2652
+ };
2653
+ updateArrows();
2654
+ el.addEventListener("scroll", updateArrows, {
2655
+ passive: true
2656
+ });
2657
+ const observer = new ResizeObserver(updateArrows);
2658
+ observer.observe(el);
2659
+ return () => {
2660
+ el.removeEventListener("scroll", updateArrows);
2661
+ observer.disconnect();
2662
+ };
2663
+ }, [itemCount]);
2574
2664
  const scrollByPage = direction => {
2575
2665
  const el = carouselRef.current;
2576
2666
  if (!el) return;
@@ -2579,53 +2669,109 @@ const Carousel = ({
2579
2669
  behavior: "smooth"
2580
2670
  });
2581
2671
  };
2582
- const handleLeftArrowClick = () => {
2583
- scrollByPage(-1);
2584
- };
2585
- const handleRightArrowClick = () => {
2586
- scrollByPage(1);
2587
- };
2588
2672
  const handleMouseEnter = () => {
2589
2673
  setIsHovered(true);
2590
2674
  };
2591
2675
  const handleMouseLeave = () => {
2592
2676
  setIsHovered(false);
2593
2677
  };
2594
- return jsx("div", {
2595
- className: "ath-carousel-wrapper",
2596
- children: jsxs("div", {
2597
- className: carouselClasses,
2598
- css: sx?.carousel,
2678
+ return jsxs("div", {
2679
+ className: "ath-carousel-container",
2680
+ style: {
2681
+ minWidth: itemCount === 1 ? "" : 0
2682
+ },
2683
+ children: [label && jsx(FormLabel, {
2684
+ label: label,
2685
+ dark: true
2686
+ }), jsxs("div", {
2687
+ className: cx("ath-carousel-wrapper", isHovered && "ath-carousel-hover", label && "ath-carousel-label"),
2599
2688
  onMouseEnter: handleMouseEnter,
2600
2689
  onMouseLeave: handleMouseLeave,
2601
- ref: carouselRef,
2602
- children: [jsx(Button, {
2690
+ children: [showLeftArrow && jsx(Button, {
2603
2691
  className: {
2604
2692
  button: "ath-carousel-arrow ath-carousel-left-arrow"
2605
2693
  },
2606
- onClick: handleLeftArrowClick,
2607
- onMouseEnter: handleMouseEnter,
2608
- onMouseLeave: handleMouseLeave,
2694
+ onClick: () => scrollByPage(-1),
2695
+ "aria-label": label ? `Scroll ${label} backward` : "Scroll backward",
2609
2696
  icon: jsx(HugeiconsIcon, {
2610
2697
  icon: Qt,
2611
2698
  size: 36
2612
2699
  })
2613
- }), hasItems ? children : jsx("div", {
2614
- className: "ath-carousel-empty",
2615
- children: emptyMessage
2616
- }), jsx(Button, {
2700
+ }), jsx("div", {
2701
+ className: carouselClasses,
2702
+ css: sx?.carousel,
2703
+ ref: carouselRef,
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", {
2730
+ className: "ath-carousel-empty",
2731
+ children: emptyMessage
2732
+ })
2733
+ }), showRightArrow && jsx(Button, {
2617
2734
  className: {
2618
2735
  button: "ath-carousel-arrow ath-carousel-right-arrow"
2619
2736
  },
2620
- onClick: handleRightArrowClick,
2621
- onMouseEnter: handleMouseEnter,
2622
- onMouseLeave: handleMouseLeave,
2737
+ onClick: () => scrollByPage(1),
2738
+ "aria-label": label ? `Scroll ${label} forward` : "Scroll forward",
2623
2739
  icon: jsx(HugeiconsIcon, {
2624
2740
  icon: un,
2625
2741
  size: 36
2626
2742
  })
2627
2743
  })]
2628
- })
2744
+ })]
2745
+ });
2746
+ };
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
+ })]
2629
2775
  });
2630
2776
  };
2631
2777
 
@@ -2658,30 +2804,6 @@ const Dropdown = ({
2658
2804
  });
2659
2805
  };
2660
2806
 
2661
- const FormLabel = ({
2662
- label,
2663
- required,
2664
- className,
2665
- labelPosition = "above",
2666
- dark,
2667
- sx,
2668
- ...other
2669
- }) => {
2670
- const labelClasses = cx("ath-form-input-label", labelPosition ? `ath-form-input-label-${labelPosition}` : "", dark ? "ath-form-input-label-dark" : "", className?.label);
2671
- const requiredClasses = cx("ath-form-input-label-required", dark ? "ath-form-input-label-required-dark" : "", className?.required);
2672
- return jsxs("label", {
2673
- className: labelClasses,
2674
- css: sx?.label,
2675
- ...other,
2676
- children: [label, required && jsx("span", {
2677
- className: requiredClasses,
2678
- css: sx?.required,
2679
- "aria-label": "required",
2680
- children: "*"
2681
- })]
2682
- });
2683
- };
2684
-
2685
2807
  const FormTextInput = ({
2686
2808
  autoComplete,
2687
2809
  autoFocus,
@@ -2690,6 +2812,7 @@ const FormTextInput = ({
2690
2812
  error,
2691
2813
  disabled,
2692
2814
  id,
2815
+ inputMode,
2693
2816
  name,
2694
2817
  placeholder,
2695
2818
  readOnly,
@@ -2699,6 +2822,8 @@ const FormTextInput = ({
2699
2822
  type = "text",
2700
2823
  value,
2701
2824
  onChange,
2825
+ onBlur,
2826
+ onFocus,
2702
2827
  onKeyDown,
2703
2828
  ...other
2704
2829
  }) => {
@@ -2715,12 +2840,15 @@ const FormTextInput = ({
2715
2840
  css: sx?.input,
2716
2841
  disabled: disabled,
2717
2842
  name: name,
2843
+ inputMode: inputMode,
2718
2844
  placeholder: placeholder,
2719
2845
  readOnly: readOnly,
2720
2846
  tabIndex: disabled ? -1 : tabIndex,
2721
2847
  type: type,
2722
2848
  value: value,
2723
2849
  onChange: onChangeHandler,
2850
+ onBlur: onBlur,
2851
+ onFocus: onFocus,
2724
2852
  onKeyDown: onKeyDown,
2725
2853
  id: id,
2726
2854
  ...other
@@ -2737,6 +2865,7 @@ const FormField = ({
2737
2865
  error,
2738
2866
  helperText,
2739
2867
  id,
2868
+ inputMode,
2740
2869
  label,
2741
2870
  labelPosition = "above",
2742
2871
  name,
@@ -2749,6 +2878,8 @@ const FormField = ({
2749
2878
  type = "text",
2750
2879
  value,
2751
2880
  onChange,
2881
+ onBlur,
2882
+ onFocus,
2752
2883
  onKeyDown,
2753
2884
  ...other
2754
2885
  }) => {
@@ -2793,14 +2924,20 @@ const FormField = ({
2793
2924
  labelPosition: labelPosition,
2794
2925
  dark: dark
2795
2926
  }) : null;
2927
+ const describedBy = [error && name ? `${name}-error` : "", helperText && name ? `${name}-helper` : ""].filter(Boolean).join(" ") || undefined;
2796
2928
  const inputElement = type === "textarea" ? jsx("textarea", {
2797
2929
  autoComplete: autoComplete,
2798
2930
  autoFocus: autoFocus,
2799
2931
  ref: textAreaRef,
2932
+ id: id,
2800
2933
  name: name,
2934
+ "aria-invalid": error ? true : undefined,
2935
+ "aria-describedby": describedBy,
2801
2936
  onChange: handleTextAreaChange,
2802
2937
  disabled: disabled,
2803
2938
  readOnly: readOnly,
2939
+ onBlur: onBlur,
2940
+ onFocus: onFocus,
2804
2941
  onKeyDown: onKeyDown,
2805
2942
  tabIndex: disabled ? -1 : tabIndex,
2806
2943
  className: textAreaClasses,
@@ -2812,10 +2949,13 @@ const FormField = ({
2812
2949
  autoComplete: autoComplete,
2813
2950
  autoFocus: autoFocus,
2814
2951
  name: name,
2952
+ inputMode: inputMode,
2815
2953
  type: type,
2816
2954
  onChange: handleInputChange,
2817
2955
  disabled: disabled,
2818
2956
  readOnly: readOnly,
2957
+ onBlur: onBlur,
2958
+ onFocus: onFocus,
2819
2959
  onKeyDown: onKeyDown,
2820
2960
  tabIndex: disabled ? -1 : tabIndex,
2821
2961
  className: {
@@ -2826,6 +2966,8 @@ const FormField = ({
2826
2966
  placeholder: placeholder,
2827
2967
  size: size,
2828
2968
  id: id,
2969
+ "aria-invalid": error ? true : undefined,
2970
+ "aria-describedby": describedBy,
2829
2971
  ...other
2830
2972
  });
2831
2973
  const errorElement = error ? jsx("div", {
@@ -2867,10 +3009,11 @@ const Header = ({
2867
3009
  const Main = ({
2868
3010
  children,
2869
3011
  className,
2870
- sx
3012
+ sx,
3013
+ width = "wide"
2871
3014
  }) => {
2872
3015
  const mainClasses = cx("ath-main", typeof className === "object" && className !== null ? className.main : "");
2873
- const mainContentClasses = cx("ath-main-content", typeof className === "object" && className !== null ? className.mainContent : "");
3016
+ const mainContentClasses = cx("ath-main-content", typeof className === "object" && className !== null ? className.mainContent : "", width === "full" ? "full" : "", width === "wide" ? "wide" : "", width === "medium" ? "medium" : "", width === "narrow" ? "narrow" : "");
2874
3017
  return jsx("main", {
2875
3018
  css: sx?.main,
2876
3019
  className: mainClasses,
@@ -2936,6 +3079,9 @@ const Modal = ({
2936
3079
  trapFocus = true,
2937
3080
  initialFocusRef,
2938
3081
  finalFocusRef,
3082
+ ariaLabel,
3083
+ ariaLabelledBy,
3084
+ ariaDescribedBy,
2939
3085
  sx,
2940
3086
  onClose,
2941
3087
  ...other
@@ -3024,11 +3170,15 @@ const Modal = ({
3024
3170
  css: sx?.modal,
3025
3171
  className: modalClasses,
3026
3172
  role: "dialog",
3173
+ "aria-modal": "true",
3174
+ "aria-labelledby": ariaLabelledBy || titleId,
3175
+ "aria-label": ariaLabelledBy || titleId ? undefined : ariaLabel,
3176
+ "aria-describedby": ariaDescribedBy,
3027
3177
  ...other,
3028
3178
  children: [(title || showCloseButton) && jsxs("div", {
3029
3179
  css: sx?.header,
3030
3180
  className: headerClasses,
3031
- children: [title && jsx("h1", {
3181
+ children: [title && jsx("h2", {
3032
3182
  css: sx?.title,
3033
3183
  className: titleClasses,
3034
3184
  id: titleId,
@@ -3162,7 +3312,22 @@ const SlideOut = ({
3162
3312
  const overlayClasses = cx("ath-slide-out-overlay", isOpen && "ath-slide-out-overlay-open", className?.overlay);
3163
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);
3164
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]);
3165
3329
  return jsxs("div", {
3330
+ ref: slideOutRef,
3166
3331
  className: slideOutClasses,
3167
3332
  css: sx?.slideOut,
3168
3333
  "data-testid": "slide-out",
@@ -3173,6 +3338,9 @@ const SlideOut = ({
3173
3338
  }), jsxs("div", {
3174
3339
  className: panelClasses,
3175
3340
  css: sx?.panel,
3341
+ role: "dialog",
3342
+ "aria-modal": "true",
3343
+ "aria-label": "Menu",
3176
3344
  children: [jsx(Button, {
3177
3345
  className: {
3178
3346
  button: closeButtonClasses
@@ -3206,192 +3374,182 @@ const breakpoints = {
3206
3374
  };
3207
3375
  const minWidth = width => `@media (min-width: ${width}px)`;
3208
3376
  const maxWidth = width => `@media (max-width: ${width - 1}px)`;
3209
- const minXs = minWidth(breakpoints.xs);
3210
- const minSm = minWidth(breakpoints.sm);
3211
- const minMd = minWidth(breakpoints.md);
3212
- const minLg = minWidth(breakpoints.lg);
3213
- const minXl = minWidth(breakpoints.xl);
3214
- const min2xl = minWidth(breakpoints["2xl"]);
3215
- const min3xl = minWidth(breakpoints["3xl"]);
3216
- const min4xl = minWidth(breakpoints["4xl"]);
3217
- const maxXs = maxWidth(breakpoints.xs);
3218
- const maxSm = maxWidth(breakpoints.sm);
3219
- const maxMd = maxWidth(breakpoints.md);
3220
- const maxLg = maxWidth(breakpoints.lg);
3221
- const maxXl = maxWidth(breakpoints.xl);
3222
- const max2xl = maxWidth(breakpoints["2xl"]);
3223
- const max3xl = maxWidth(breakpoints["3xl"]);
3224
- const max4xl = maxWidth(breakpoints["4xl"]);
3225
-
3226
- const tokens = {
3227
- font: {
3228
- family: {
3229
- sans: "Montserrat, sans-serif",
3230
- serif: "Libre Baskerville, serif"
3231
- },
3232
- size: {
3233
- xs: "0.75rem",
3234
- sm: "0.875rem",
3235
- md: "1rem",
3236
- lg: "1.25rem",
3237
- xl: "1.5rem",
3238
- "2xl": "2rem",
3239
- "3xl": "2.5rem",
3240
- "4xl": "3rem",
3241
- "5xl": "3.5rem"
3377
+ const media = {
3378
+ min: {
3379
+ xs: minWidth(breakpoints.xs),
3380
+ sm: minWidth(breakpoints.sm),
3381
+ md: minWidth(breakpoints.md),
3382
+ lg: minWidth(breakpoints.lg),
3383
+ xl: minWidth(breakpoints.xl),
3384
+ "2xl": minWidth(breakpoints["2xl"]),
3385
+ "3xl": minWidth(breakpoints["3xl"]),
3386
+ "4xl": minWidth(breakpoints["4xl"])
3387
+ },
3388
+ max: {
3389
+ xs: maxWidth(breakpoints.xs),
3390
+ sm: maxWidth(breakpoints.sm),
3391
+ md: maxWidth(breakpoints.md),
3392
+ lg: maxWidth(breakpoints.lg),
3393
+ xl: maxWidth(breakpoints.xl),
3394
+ "2xl": maxWidth(breakpoints["2xl"]),
3395
+ "3xl": maxWidth(breakpoints["3xl"]),
3396
+ "4xl": maxWidth(breakpoints["4xl"])
3397
+ }
3398
+ };
3399
+ const font = {
3400
+ family: {
3401
+ sans: "Montserrat, sans-serif",
3402
+ serif: "Libre Baskerville, serif"
3403
+ },
3404
+ size: {
3405
+ xs: "0.75rem",
3406
+ sm: "0.875rem",
3407
+ md: "1rem",
3408
+ lg: "1.25rem",
3409
+ xl: "1.5rem",
3410
+ "2xl": "2rem",
3411
+ "3xl": "2.5rem",
3412
+ "4xl": "3rem",
3413
+ "5xl": "3.5rem"
3414
+ }
3415
+ };
3416
+ const color = {
3417
+ primary: {
3418
+ "50": "#f0f2f5",
3419
+ "100": "#d9dee6",
3420
+ "200": "#b8c3d1",
3421
+ "300": "#8a9bae",
3422
+ "400": "#4a5f7a",
3423
+ "500": "#0b1828",
3424
+ "600": "#081320",
3425
+ "700": "#060e18",
3426
+ "800": "#04090f",
3427
+ "900": "#020407",
3428
+ default: "#0b1828",
3429
+ vibrant: {
3430
+ "300": "#8ab6ff",
3431
+ "500": "#4f86f7",
3432
+ "700": "#1e3a8a"
3242
3433
  }
3243
3434
  },
3244
- color: {
3245
- primary: {
3246
- "50": "#f0f2f5",
3247
- "100": "#d9dee6",
3248
- "200": "#b8c3d1",
3249
- "300": "#8a9bae",
3250
- "400": "#4a5f7a",
3251
- "500": "#0b1828",
3252
- "600": "#081320",
3253
- "700": "#060e18",
3254
- "800": "#04090f",
3255
- "900": "#020407",
3256
- "default": "#0b1828",
3257
- vibrant: {
3258
- "300": "#8ab6ff",
3259
- "500": "#4f86f7",
3260
- "700": "#1e3a8a"
3261
- }
3262
- },
3263
- secondary: {
3264
- "50": "#e6f7f6",
3265
- "100": "#b3e8e5",
3266
- "200": "#80d9d4",
3267
- "300": "#4dcac3",
3268
- "400": "#2aa39b",
3269
- "500": "#146b68",
3270
- "600": "#125a57",
3271
- "700": "#0f4a47",
3272
- "800": "#0c3835",
3273
- "900": "#081f1c",
3274
- "default": "#146b68",
3275
- vibrant: {
3276
- "300": "#75dac7",
3277
- "500": "#1abc9c",
3278
- "700": "#138f6e"
3279
- }
3280
- },
3281
- tertiary: {
3282
- "50": "#f7f4f0",
3283
- "100": "#eedecc",
3284
- "200": "#e5c8a8",
3285
- "300": "#dcb184",
3286
- "400": "#d19b60",
3287
- "500": "#bfa081",
3288
- "600": "#a68965",
3289
- "700": "#7d6748",
3290
- "800": "#54442c",
3291
- "900": "#2b2216",
3292
- "default": "#bfa081",
3293
- vibrant: {
3294
- "300": "#f7c873",
3295
- "500": "#f39c12",
3296
- "700": "#c9780e"
3297
- }
3298
- },
3299
- error: {
3300
- "50": "#fee6e6",
3301
- "100": "#fbb3b3",
3302
- "200": "#f88080",
3303
- "300": "#f54d4d",
3304
- "400": "#f21a1a",
3305
- "500": "#9f0001",
3306
- "600": "#800001",
3307
- "700": "#600001",
3308
- "800": "#400000",
3309
- "900": "#200000",
3310
- "default": "#9f0001",
3311
- vibrant: {
3312
- "300": "#f48a6f",
3313
- "500": "#e74c3c",
3314
- "700": "#c0392b"
3315
- }
3316
- },
3317
- warning: {
3318
- "50": "#fef5ec",
3319
- "100": "#fdebda",
3320
- "200": "#fad8b3",
3321
- "300": "#f8c48c",
3322
- "400": "#f5b065",
3435
+ secondary: {
3436
+ "50": "#e6f7f6",
3437
+ "100": "#b3e8e5",
3438
+ "200": "#80d9d4",
3439
+ "300": "#4dcac3",
3440
+ "400": "#2aa39b",
3441
+ "500": "#146b68",
3442
+ "600": "#125a57",
3443
+ "700": "#0f4a47",
3444
+ "800": "#0c3835",
3445
+ "900": "#081f1c",
3446
+ default: "#146b68",
3447
+ vibrant: {
3448
+ "300": "#75dac7",
3449
+ "500": "#1abc9c",
3450
+ "700": "#138f6e"
3451
+ }
3452
+ },
3453
+ tertiary: {
3454
+ "50": "#f7f4f0",
3455
+ "100": "#eedecc",
3456
+ "200": "#e5c8a8",
3457
+ "300": "#dcb184",
3458
+ "400": "#d19b60",
3459
+ "500": "#bfa081",
3460
+ "600": "#a68965",
3461
+ "700": "#7d6748",
3462
+ "800": "#54442c",
3463
+ "900": "#2b2216",
3464
+ default: "#bfa081",
3465
+ vibrant: {
3466
+ "300": "#f7c873",
3323
3467
  "500": "#f39c12",
3324
- "600": "#c27d0e",
3325
- "700": "#925e0b",
3326
- "800": "#613e07",
3327
- "900": "#311f04",
3328
- "default": "#f39c12",
3329
- vibrant: {
3330
- "300": "#fce705",
3331
- "500": "#fbc306",
3332
- "700": "#f8950a"
3333
- }
3334
- },
3335
- success: {
3336
- "50": "#e8f5f2",
3337
- "100": "#d1ece4",
3338
- "200": "#a3d8ca",
3339
- "300": "#76c5af",
3340
- "400": "#48b195",
3341
- "500": "#1a9e7a",
3342
- "600": "#157e62",
3343
- "700": "#105f49",
3344
- "800": "#0a3f31",
3345
- "900": "#052018",
3346
- "default": "#1a9e7a",
3347
- vibrant: {
3348
- "300": "#07e71f",
3349
- "500": "#08e27e",
3350
- "700": "#26b656"
3351
- }
3352
- },
3353
- text: {
3354
- dark: "#040a0c",
3355
- light: "#fcfbf7"
3356
- },
3357
- background: {
3358
- light: "#fcfbf7",
3359
- dark: "#040a0c"
3468
+ "700": "#c9780e"
3360
3469
  }
3361
3470
  },
3362
- padding: {
3363
- xs: "2px",
3364
- sm: "4px",
3365
- md: "6px",
3366
- lg: "10px",
3367
- xl: "16px"
3471
+ error: {
3472
+ "50": "#fee6e6",
3473
+ "100": "#fbb3b3",
3474
+ "200": "#f88080",
3475
+ "300": "#f54d4d",
3476
+ "400": "#f21a1a",
3477
+ "500": "#9f0001",
3478
+ "600": "#800001",
3479
+ "700": "#600001",
3480
+ "800": "#400000",
3481
+ "900": "#200000",
3482
+ default: "#9f0001",
3483
+ vibrant: {
3484
+ "300": "#f48a6f",
3485
+ "500": "#e74c3c",
3486
+ "700": "#c0392b"
3487
+ }
3368
3488
  },
3369
- radius: {
3370
- sm: "3px",
3371
- md: "5px",
3372
- lg: "8px"
3489
+ warning: {
3490
+ "50": "#fef5ec",
3491
+ "100": "#fdebda",
3492
+ "200": "#fad8b3",
3493
+ "300": "#f8c48c",
3494
+ "400": "#f5b065",
3495
+ "500": "#f39c12",
3496
+ "600": "#c27d0e",
3497
+ "700": "#925e0b",
3498
+ "800": "#613e07",
3499
+ "900": "#311f04",
3500
+ default: "#f39c12",
3501
+ vibrant: {
3502
+ "300": "#fce705",
3503
+ "500": "#fbc306",
3504
+ "700": "#f8950a"
3505
+ }
3373
3506
  },
3374
- media: {
3375
- min: {
3376
- xs: "@media (min-width: 320px)",
3377
- sm: "@media (min-width: 480px)",
3378
- md: "@media (min-width: 620px)",
3379
- lg: "@media (min-width: 768px)",
3380
- xl: "@media (min-width: 896px)",
3381
- "2xl": "@media (min-width: 1024px)",
3382
- "3xl": "@media (min-width: 1280px)"
3383
- },
3384
- max: {
3385
- xs: "@media (max-width: 319px)",
3386
- sm: "@media (max-width: 479px)",
3387
- md: "@media (max-width: 767px)",
3388
- lg: "@media (max-width: 895px)",
3389
- xl: "@media (max-width: 1023px)",
3390
- "2xl": "@media (max-width: 1279px)",
3391
- "3xl": "@media (max-width: 1535px)"
3507
+ success: {
3508
+ "50": "#e8f5f2",
3509
+ "100": "#d1ece4",
3510
+ "200": "#a3d8ca",
3511
+ "300": "#76c5af",
3512
+ "400": "#48b195",
3513
+ "500": "#1a9e7a",
3514
+ "600": "#157e62",
3515
+ "700": "#105f49",
3516
+ "800": "#0a3f31",
3517
+ "900": "#052018",
3518
+ default: "#1a9e7a",
3519
+ vibrant: {
3520
+ "300": "#07e71f",
3521
+ "500": "#08e27e",
3522
+ "700": "#26b656"
3392
3523
  }
3524
+ },
3525
+ text: {
3526
+ dark: "#040a0c",
3527
+ light: "#fcfbf7"
3528
+ },
3529
+ background: {
3530
+ light: "#fcfbf7",
3531
+ dark: "#040a0c"
3393
3532
  }
3394
3533
  };
3534
+ const padding = {
3535
+ xs: "2px",
3536
+ sm: "4px",
3537
+ md: "6px",
3538
+ lg: "10px",
3539
+ xl: "16px"
3540
+ };
3541
+ const radius = {
3542
+ sm: "3px",
3543
+ md: "5px",
3544
+ lg: "8px"
3545
+ };
3546
+ const tokens = {
3547
+ font,
3548
+ color,
3549
+ media,
3550
+ padding,
3551
+ radius
3552
+ };
3395
3553
 
3396
- export { Accordion, AccordionItem, Avatar, Block, Button, ButtonGroup, Carousel, ContainerScalingText, Dropdown, Footer, FormField, FormLabel, FormTextInput, Header, List, ListItem, Main, Modal, ScrollToTopButton, Search, SlideOut, breakpoints, cx, max2xl, max3xl, max4xl, maxLg, maxMd, maxSm, maxXl, maxXs, min2xl, min3xl, min4xl, minLg, minMd, minSm, minXl, minXs, 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 };
3397
3555
  //# sourceMappingURL=athameui.mjs.map