athameui 0.0.12 → 0.0.13

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/dist/athameui.cjs CHANGED
@@ -2582,16 +2582,62 @@ const ButtonGroup = ({
2582
2582
  });
2583
2583
  };
2584
2584
 
2585
+ const FormLabel = ({
2586
+ label,
2587
+ required,
2588
+ className,
2589
+ labelPosition = "above",
2590
+ dark,
2591
+ sx,
2592
+ ...other
2593
+ }) => {
2594
+ const labelClasses = cx("ath-form-input-label", labelPosition ? `ath-form-input-label-${labelPosition}` : "", dark ? "ath-form-input-label-dark" : "", className?.label);
2595
+ const requiredClasses = cx("ath-form-input-label-required", dark ? "ath-form-input-label-required-dark" : "", className?.required);
2596
+ return jsxs("label", {
2597
+ className: labelClasses,
2598
+ css: sx?.label,
2599
+ ...other,
2600
+ children: [label, required && jsx("span", {
2601
+ className: requiredClasses,
2602
+ css: sx?.required,
2603
+ "aria-label": "required",
2604
+ children: "*"
2605
+ })]
2606
+ });
2607
+ };
2608
+
2585
2609
  const Carousel = ({
2586
2610
  children,
2587
2611
  className,
2588
2612
  emptyMessage = "Nothing here yet",
2613
+ label,
2589
2614
  sx
2590
2615
  }) => {
2591
2616
  const [isHovered, setIsHovered] = React.useState(false);
2617
+ const [showLeftArrow, setShowLeftArrow] = React.useState(false);
2618
+ const [showRightArrow, setShowRightArrow] = React.useState(false);
2592
2619
  const carouselRef = React.useRef(null);
2593
- const carouselClasses = cx("ath-carousel", isHovered ? "ath-carousel-hover" : "", className?.carousel);
2594
- const hasItems = React.Children.count(children) > 0;
2620
+ const carouselClasses = cx("ath-carousel", className?.carousel);
2621
+ const itemCount = React.Children.count(children);
2622
+ React.useLayoutEffect(() => {
2623
+ const el = carouselRef.current;
2624
+ if (!el) return;
2625
+ const updateArrows = () => {
2626
+ const hidden = el.scrollWidth - el.clientWidth;
2627
+ setShowLeftArrow(el.scrollLeft > 1);
2628
+ setShowRightArrow(hidden - el.scrollLeft > 1);
2629
+ };
2630
+ updateArrows();
2631
+ el.addEventListener("scroll", updateArrows, {
2632
+ passive: true
2633
+ });
2634
+ const observer = new ResizeObserver(updateArrows);
2635
+ observer.observe(el);
2636
+ return () => {
2637
+ el.removeEventListener("scroll", updateArrows);
2638
+ observer.disconnect();
2639
+ };
2640
+ }, [itemCount]);
2595
2641
  const scrollByPage = direction => {
2596
2642
  const el = carouselRef.current;
2597
2643
  if (!el) return;
@@ -2600,53 +2646,52 @@ const Carousel = ({
2600
2646
  behavior: "smooth"
2601
2647
  });
2602
2648
  };
2603
- const handleLeftArrowClick = () => {
2604
- scrollByPage(-1);
2605
- };
2606
- const handleRightArrowClick = () => {
2607
- scrollByPage(1);
2608
- };
2609
2649
  const handleMouseEnter = () => {
2610
2650
  setIsHovered(true);
2611
2651
  };
2612
2652
  const handleMouseLeave = () => {
2613
2653
  setIsHovered(false);
2614
2654
  };
2615
- return jsx("div", {
2616
- className: "ath-carousel-wrapper",
2617
- children: jsxs("div", {
2618
- className: carouselClasses,
2619
- css: sx?.carousel,
2655
+ return jsxs("div", {
2656
+ className: "ath-carousel-container",
2657
+ style: {
2658
+ minWidth: itemCount === 1 ? "" : 0
2659
+ },
2660
+ children: [label && jsx(FormLabel, {
2661
+ label: label,
2662
+ dark: true
2663
+ }), jsxs("div", {
2664
+ className: cx("ath-carousel-wrapper", isHovered && "ath-carousel-hover", label && "ath-carousel-label"),
2620
2665
  onMouseEnter: handleMouseEnter,
2621
2666
  onMouseLeave: handleMouseLeave,
2622
- ref: carouselRef,
2623
- children: [jsx(Button, {
2667
+ children: [showLeftArrow && jsx(Button, {
2624
2668
  className: {
2625
2669
  button: "ath-carousel-arrow ath-carousel-left-arrow"
2626
2670
  },
2627
- onClick: handleLeftArrowClick,
2628
- onMouseEnter: handleMouseEnter,
2629
- onMouseLeave: handleMouseLeave,
2671
+ onClick: () => scrollByPage(-1),
2630
2672
  icon: jsx(HugeiconsIcon, {
2631
2673
  icon: Qt,
2632
2674
  size: 36
2633
2675
  })
2634
- }), hasItems ? children : jsx("div", {
2635
- className: "ath-carousel-empty",
2636
- children: emptyMessage
2637
- }), jsx(Button, {
2676
+ }), jsx("div", {
2677
+ className: carouselClasses,
2678
+ css: sx?.carousel,
2679
+ ref: carouselRef,
2680
+ children: itemCount > 0 ? children : jsx("div", {
2681
+ className: "ath-carousel-empty",
2682
+ children: emptyMessage
2683
+ })
2684
+ }), showRightArrow && jsx(Button, {
2638
2685
  className: {
2639
2686
  button: "ath-carousel-arrow ath-carousel-right-arrow"
2640
2687
  },
2641
- onClick: handleRightArrowClick,
2642
- onMouseEnter: handleMouseEnter,
2643
- onMouseLeave: handleMouseLeave,
2688
+ onClick: () => scrollByPage(1),
2644
2689
  icon: jsx(HugeiconsIcon, {
2645
2690
  icon: un,
2646
2691
  size: 36
2647
2692
  })
2648
2693
  })]
2649
- })
2694
+ })]
2650
2695
  });
2651
2696
  };
2652
2697
 
@@ -2679,30 +2724,6 @@ const Dropdown = ({
2679
2724
  });
2680
2725
  };
2681
2726
 
2682
- const FormLabel = ({
2683
- label,
2684
- required,
2685
- className,
2686
- labelPosition = "above",
2687
- dark,
2688
- sx,
2689
- ...other
2690
- }) => {
2691
- const labelClasses = cx("ath-form-input-label", labelPosition ? `ath-form-input-label-${labelPosition}` : "", dark ? "ath-form-input-label-dark" : "", className?.label);
2692
- const requiredClasses = cx("ath-form-input-label-required", dark ? "ath-form-input-label-required-dark" : "", className?.required);
2693
- return jsxs("label", {
2694
- className: labelClasses,
2695
- css: sx?.label,
2696
- ...other,
2697
- children: [label, required && jsx("span", {
2698
- className: requiredClasses,
2699
- css: sx?.required,
2700
- "aria-label": "required",
2701
- children: "*"
2702
- })]
2703
- });
2704
- };
2705
-
2706
2727
  const FormTextInput = ({
2707
2728
  autoComplete,
2708
2729
  autoFocus,
@@ -2888,10 +2909,11 @@ const Header = ({
2888
2909
  const Main = ({
2889
2910
  children,
2890
2911
  className,
2891
- sx
2912
+ sx,
2913
+ width = "wide"
2892
2914
  }) => {
2893
2915
  const mainClasses = cx("ath-main", typeof className === "object" && className !== null ? className.main : "");
2894
- const mainContentClasses = cx("ath-main-content", typeof className === "object" && className !== null ? className.mainContent : "");
2916
+ 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" : "");
2895
2917
  return jsx("main", {
2896
2918
  css: sx?.main,
2897
2919
  className: mainClasses,
@@ -3049,7 +3071,7 @@ const Modal = ({
3049
3071
  children: [(title || showCloseButton) && jsxs("div", {
3050
3072
  css: sx?.header,
3051
3073
  className: headerClasses,
3052
- children: [title && jsx("h1", {
3074
+ children: [title && jsx("h2", {
3053
3075
  css: sx?.title,
3054
3076
  className: titleClasses,
3055
3077
  id: titleId,
@@ -3227,192 +3249,182 @@ const breakpoints = {
3227
3249
  };
3228
3250
  const minWidth = width => `@media (min-width: ${width}px)`;
3229
3251
  const maxWidth = width => `@media (max-width: ${width - 1}px)`;
3230
- const minXs = minWidth(breakpoints.xs);
3231
- const minSm = minWidth(breakpoints.sm);
3232
- const minMd = minWidth(breakpoints.md);
3233
- const minLg = minWidth(breakpoints.lg);
3234
- const minXl = minWidth(breakpoints.xl);
3235
- const min2xl = minWidth(breakpoints["2xl"]);
3236
- const min3xl = minWidth(breakpoints["3xl"]);
3237
- const min4xl = minWidth(breakpoints["4xl"]);
3238
- const maxXs = maxWidth(breakpoints.xs);
3239
- const maxSm = maxWidth(breakpoints.sm);
3240
- const maxMd = maxWidth(breakpoints.md);
3241
- const maxLg = maxWidth(breakpoints.lg);
3242
- const maxXl = maxWidth(breakpoints.xl);
3243
- const max2xl = maxWidth(breakpoints["2xl"]);
3244
- const max3xl = maxWidth(breakpoints["3xl"]);
3245
- const max4xl = maxWidth(breakpoints["4xl"]);
3246
-
3247
- const tokens = {
3248
- font: {
3249
- family: {
3250
- sans: "Montserrat, sans-serif",
3251
- serif: "Libre Baskerville, serif"
3252
- },
3253
- size: {
3254
- xs: "0.75rem",
3255
- sm: "0.875rem",
3256
- md: "1rem",
3257
- lg: "1.25rem",
3258
- xl: "1.5rem",
3259
- "2xl": "2rem",
3260
- "3xl": "2.5rem",
3261
- "4xl": "3rem",
3262
- "5xl": "3.5rem"
3252
+ const media = {
3253
+ min: {
3254
+ xs: minWidth(breakpoints.xs),
3255
+ sm: minWidth(breakpoints.sm),
3256
+ md: minWidth(breakpoints.md),
3257
+ lg: minWidth(breakpoints.lg),
3258
+ xl: minWidth(breakpoints.xl),
3259
+ "2xl": minWidth(breakpoints["2xl"]),
3260
+ "3xl": minWidth(breakpoints["3xl"]),
3261
+ "4xl": minWidth(breakpoints["4xl"])
3262
+ },
3263
+ max: {
3264
+ xs: maxWidth(breakpoints.xs),
3265
+ sm: maxWidth(breakpoints.sm),
3266
+ md: maxWidth(breakpoints.md),
3267
+ lg: maxWidth(breakpoints.lg),
3268
+ xl: maxWidth(breakpoints.xl),
3269
+ "2xl": maxWidth(breakpoints["2xl"]),
3270
+ "3xl": maxWidth(breakpoints["3xl"]),
3271
+ "4xl": maxWidth(breakpoints["4xl"])
3272
+ }
3273
+ };
3274
+ const font = {
3275
+ family: {
3276
+ sans: "Montserrat, sans-serif",
3277
+ serif: "Libre Baskerville, serif"
3278
+ },
3279
+ size: {
3280
+ xs: "0.75rem",
3281
+ sm: "0.875rem",
3282
+ md: "1rem",
3283
+ lg: "1.25rem",
3284
+ xl: "1.5rem",
3285
+ "2xl": "2rem",
3286
+ "3xl": "2.5rem",
3287
+ "4xl": "3rem",
3288
+ "5xl": "3.5rem"
3289
+ }
3290
+ };
3291
+ const color = {
3292
+ primary: {
3293
+ "50": "#f0f2f5",
3294
+ "100": "#d9dee6",
3295
+ "200": "#b8c3d1",
3296
+ "300": "#8a9bae",
3297
+ "400": "#4a5f7a",
3298
+ "500": "#0b1828",
3299
+ "600": "#081320",
3300
+ "700": "#060e18",
3301
+ "800": "#04090f",
3302
+ "900": "#020407",
3303
+ default: "#0b1828",
3304
+ vibrant: {
3305
+ "300": "#8ab6ff",
3306
+ "500": "#4f86f7",
3307
+ "700": "#1e3a8a"
3263
3308
  }
3264
3309
  },
3265
- color: {
3266
- primary: {
3267
- "50": "#f0f2f5",
3268
- "100": "#d9dee6",
3269
- "200": "#b8c3d1",
3270
- "300": "#8a9bae",
3271
- "400": "#4a5f7a",
3272
- "500": "#0b1828",
3273
- "600": "#081320",
3274
- "700": "#060e18",
3275
- "800": "#04090f",
3276
- "900": "#020407",
3277
- "default": "#0b1828",
3278
- vibrant: {
3279
- "300": "#8ab6ff",
3280
- "500": "#4f86f7",
3281
- "700": "#1e3a8a"
3282
- }
3283
- },
3284
- secondary: {
3285
- "50": "#e6f7f6",
3286
- "100": "#b3e8e5",
3287
- "200": "#80d9d4",
3288
- "300": "#4dcac3",
3289
- "400": "#2aa39b",
3290
- "500": "#146b68",
3291
- "600": "#125a57",
3292
- "700": "#0f4a47",
3293
- "800": "#0c3835",
3294
- "900": "#081f1c",
3295
- "default": "#146b68",
3296
- vibrant: {
3297
- "300": "#75dac7",
3298
- "500": "#1abc9c",
3299
- "700": "#138f6e"
3300
- }
3301
- },
3302
- tertiary: {
3303
- "50": "#f7f4f0",
3304
- "100": "#eedecc",
3305
- "200": "#e5c8a8",
3306
- "300": "#dcb184",
3307
- "400": "#d19b60",
3308
- "500": "#bfa081",
3309
- "600": "#a68965",
3310
- "700": "#7d6748",
3311
- "800": "#54442c",
3312
- "900": "#2b2216",
3313
- "default": "#bfa081",
3314
- vibrant: {
3315
- "300": "#f7c873",
3316
- "500": "#f39c12",
3317
- "700": "#c9780e"
3318
- }
3319
- },
3320
- error: {
3321
- "50": "#fee6e6",
3322
- "100": "#fbb3b3",
3323
- "200": "#f88080",
3324
- "300": "#f54d4d",
3325
- "400": "#f21a1a",
3326
- "500": "#9f0001",
3327
- "600": "#800001",
3328
- "700": "#600001",
3329
- "800": "#400000",
3330
- "900": "#200000",
3331
- "default": "#9f0001",
3332
- vibrant: {
3333
- "300": "#f48a6f",
3334
- "500": "#e74c3c",
3335
- "700": "#c0392b"
3336
- }
3337
- },
3338
- warning: {
3339
- "50": "#fef5ec",
3340
- "100": "#fdebda",
3341
- "200": "#fad8b3",
3342
- "300": "#f8c48c",
3343
- "400": "#f5b065",
3310
+ secondary: {
3311
+ "50": "#e6f7f6",
3312
+ "100": "#b3e8e5",
3313
+ "200": "#80d9d4",
3314
+ "300": "#4dcac3",
3315
+ "400": "#2aa39b",
3316
+ "500": "#146b68",
3317
+ "600": "#125a57",
3318
+ "700": "#0f4a47",
3319
+ "800": "#0c3835",
3320
+ "900": "#081f1c",
3321
+ default: "#146b68",
3322
+ vibrant: {
3323
+ "300": "#75dac7",
3324
+ "500": "#1abc9c",
3325
+ "700": "#138f6e"
3326
+ }
3327
+ },
3328
+ tertiary: {
3329
+ "50": "#f7f4f0",
3330
+ "100": "#eedecc",
3331
+ "200": "#e5c8a8",
3332
+ "300": "#dcb184",
3333
+ "400": "#d19b60",
3334
+ "500": "#bfa081",
3335
+ "600": "#a68965",
3336
+ "700": "#7d6748",
3337
+ "800": "#54442c",
3338
+ "900": "#2b2216",
3339
+ default: "#bfa081",
3340
+ vibrant: {
3341
+ "300": "#f7c873",
3344
3342
  "500": "#f39c12",
3345
- "600": "#c27d0e",
3346
- "700": "#925e0b",
3347
- "800": "#613e07",
3348
- "900": "#311f04",
3349
- "default": "#f39c12",
3350
- vibrant: {
3351
- "300": "#fce705",
3352
- "500": "#fbc306",
3353
- "700": "#f8950a"
3354
- }
3355
- },
3356
- success: {
3357
- "50": "#e8f5f2",
3358
- "100": "#d1ece4",
3359
- "200": "#a3d8ca",
3360
- "300": "#76c5af",
3361
- "400": "#48b195",
3362
- "500": "#1a9e7a",
3363
- "600": "#157e62",
3364
- "700": "#105f49",
3365
- "800": "#0a3f31",
3366
- "900": "#052018",
3367
- "default": "#1a9e7a",
3368
- vibrant: {
3369
- "300": "#07e71f",
3370
- "500": "#08e27e",
3371
- "700": "#26b656"
3372
- }
3373
- },
3374
- text: {
3375
- dark: "#040a0c",
3376
- light: "#fcfbf7"
3377
- },
3378
- background: {
3379
- light: "#fcfbf7",
3380
- dark: "#040a0c"
3343
+ "700": "#c9780e"
3381
3344
  }
3382
3345
  },
3383
- padding: {
3384
- xs: "2px",
3385
- sm: "4px",
3386
- md: "6px",
3387
- lg: "10px",
3388
- xl: "16px"
3346
+ error: {
3347
+ "50": "#fee6e6",
3348
+ "100": "#fbb3b3",
3349
+ "200": "#f88080",
3350
+ "300": "#f54d4d",
3351
+ "400": "#f21a1a",
3352
+ "500": "#9f0001",
3353
+ "600": "#800001",
3354
+ "700": "#600001",
3355
+ "800": "#400000",
3356
+ "900": "#200000",
3357
+ default: "#9f0001",
3358
+ vibrant: {
3359
+ "300": "#f48a6f",
3360
+ "500": "#e74c3c",
3361
+ "700": "#c0392b"
3362
+ }
3389
3363
  },
3390
- radius: {
3391
- sm: "3px",
3392
- md: "5px",
3393
- lg: "8px"
3364
+ warning: {
3365
+ "50": "#fef5ec",
3366
+ "100": "#fdebda",
3367
+ "200": "#fad8b3",
3368
+ "300": "#f8c48c",
3369
+ "400": "#f5b065",
3370
+ "500": "#f39c12",
3371
+ "600": "#c27d0e",
3372
+ "700": "#925e0b",
3373
+ "800": "#613e07",
3374
+ "900": "#311f04",
3375
+ default: "#f39c12",
3376
+ vibrant: {
3377
+ "300": "#fce705",
3378
+ "500": "#fbc306",
3379
+ "700": "#f8950a"
3380
+ }
3394
3381
  },
3395
- media: {
3396
- min: {
3397
- xs: "@media (min-width: 320px)",
3398
- sm: "@media (min-width: 480px)",
3399
- md: "@media (min-width: 620px)",
3400
- lg: "@media (min-width: 768px)",
3401
- xl: "@media (min-width: 896px)",
3402
- "2xl": "@media (min-width: 1024px)",
3403
- "3xl": "@media (min-width: 1280px)"
3404
- },
3405
- max: {
3406
- xs: "@media (max-width: 319px)",
3407
- sm: "@media (max-width: 479px)",
3408
- md: "@media (max-width: 767px)",
3409
- lg: "@media (max-width: 895px)",
3410
- xl: "@media (max-width: 1023px)",
3411
- "2xl": "@media (max-width: 1279px)",
3412
- "3xl": "@media (max-width: 1535px)"
3382
+ success: {
3383
+ "50": "#e8f5f2",
3384
+ "100": "#d1ece4",
3385
+ "200": "#a3d8ca",
3386
+ "300": "#76c5af",
3387
+ "400": "#48b195",
3388
+ "500": "#1a9e7a",
3389
+ "600": "#157e62",
3390
+ "700": "#105f49",
3391
+ "800": "#0a3f31",
3392
+ "900": "#052018",
3393
+ default: "#1a9e7a",
3394
+ vibrant: {
3395
+ "300": "#07e71f",
3396
+ "500": "#08e27e",
3397
+ "700": "#26b656"
3413
3398
  }
3399
+ },
3400
+ text: {
3401
+ dark: "#040a0c",
3402
+ light: "#fcfbf7"
3403
+ },
3404
+ background: {
3405
+ light: "#fcfbf7",
3406
+ dark: "#040a0c"
3414
3407
  }
3415
3408
  };
3409
+ const padding = {
3410
+ xs: "2px",
3411
+ sm: "4px",
3412
+ md: "6px",
3413
+ lg: "10px",
3414
+ xl: "16px"
3415
+ };
3416
+ const radius = {
3417
+ sm: "3px",
3418
+ md: "5px",
3419
+ lg: "8px"
3420
+ };
3421
+ const tokens = {
3422
+ font,
3423
+ color,
3424
+ media,
3425
+ padding,
3426
+ radius
3427
+ };
3416
3428
 
3417
3429
  exports.Accordion = Accordion;
3418
3430
  exports.AccordionItem = AccordionItem;
@@ -3436,22 +3448,11 @@ exports.ScrollToTopButton = ScrollToTopButton;
3436
3448
  exports.Search = Search;
3437
3449
  exports.SlideOut = SlideOut;
3438
3450
  exports.breakpoints = breakpoints;
3451
+ exports.color = color;
3439
3452
  exports.cx = cx;
3440
- exports.max2xl = max2xl;
3441
- exports.max3xl = max3xl;
3442
- exports.max4xl = max4xl;
3443
- exports.maxLg = maxLg;
3444
- exports.maxMd = maxMd;
3445
- exports.maxSm = maxSm;
3446
- exports.maxXl = maxXl;
3447
- exports.maxXs = maxXs;
3448
- exports.min2xl = min2xl;
3449
- exports.min3xl = min3xl;
3450
- exports.min4xl = min4xl;
3451
- exports.minLg = minLg;
3452
- exports.minMd = minMd;
3453
- exports.minSm = minSm;
3454
- exports.minXl = minXl;
3455
- exports.minXs = minXs;
3453
+ exports.font = font;
3454
+ exports.media = media;
3455
+ exports.padding = padding;
3456
+ exports.radius = radius;
3456
3457
  exports.tokens = tokens;
3457
3458
  //# sourceMappingURL=athameui.cjs.map