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.mjs CHANGED
@@ -2561,16 +2561,62 @@ const ButtonGroup = ({
2561
2561
  });
2562
2562
  };
2563
2563
 
2564
+ const FormLabel = ({
2565
+ label,
2566
+ required,
2567
+ className,
2568
+ labelPosition = "above",
2569
+ dark,
2570
+ sx,
2571
+ ...other
2572
+ }) => {
2573
+ const labelClasses = cx("ath-form-input-label", labelPosition ? `ath-form-input-label-${labelPosition}` : "", dark ? "ath-form-input-label-dark" : "", className?.label);
2574
+ const requiredClasses = cx("ath-form-input-label-required", dark ? "ath-form-input-label-required-dark" : "", className?.required);
2575
+ return jsxs("label", {
2576
+ className: labelClasses,
2577
+ css: sx?.label,
2578
+ ...other,
2579
+ children: [label, required && jsx("span", {
2580
+ className: requiredClasses,
2581
+ css: sx?.required,
2582
+ "aria-label": "required",
2583
+ children: "*"
2584
+ })]
2585
+ });
2586
+ };
2587
+
2564
2588
  const Carousel = ({
2565
2589
  children,
2566
2590
  className,
2567
2591
  emptyMessage = "Nothing here yet",
2592
+ label,
2568
2593
  sx
2569
2594
  }) => {
2570
2595
  const [isHovered, setIsHovered] = useState(false);
2596
+ const [showLeftArrow, setShowLeftArrow] = useState(false);
2597
+ const [showRightArrow, setShowRightArrow] = useState(false);
2571
2598
  const carouselRef = useRef(null);
2572
- const carouselClasses = cx("ath-carousel", isHovered ? "ath-carousel-hover" : "", className?.carousel);
2573
- const hasItems = Children.count(children) > 0;
2599
+ const carouselClasses = cx("ath-carousel", className?.carousel);
2600
+ const itemCount = Children.count(children);
2601
+ useLayoutEffect(() => {
2602
+ const el = carouselRef.current;
2603
+ if (!el) return;
2604
+ const updateArrows = () => {
2605
+ const hidden = el.scrollWidth - el.clientWidth;
2606
+ setShowLeftArrow(el.scrollLeft > 1);
2607
+ setShowRightArrow(hidden - el.scrollLeft > 1);
2608
+ };
2609
+ updateArrows();
2610
+ el.addEventListener("scroll", updateArrows, {
2611
+ passive: true
2612
+ });
2613
+ const observer = new ResizeObserver(updateArrows);
2614
+ observer.observe(el);
2615
+ return () => {
2616
+ el.removeEventListener("scroll", updateArrows);
2617
+ observer.disconnect();
2618
+ };
2619
+ }, [itemCount]);
2574
2620
  const scrollByPage = direction => {
2575
2621
  const el = carouselRef.current;
2576
2622
  if (!el) return;
@@ -2579,53 +2625,52 @@ const Carousel = ({
2579
2625
  behavior: "smooth"
2580
2626
  });
2581
2627
  };
2582
- const handleLeftArrowClick = () => {
2583
- scrollByPage(-1);
2584
- };
2585
- const handleRightArrowClick = () => {
2586
- scrollByPage(1);
2587
- };
2588
2628
  const handleMouseEnter = () => {
2589
2629
  setIsHovered(true);
2590
2630
  };
2591
2631
  const handleMouseLeave = () => {
2592
2632
  setIsHovered(false);
2593
2633
  };
2594
- return jsx("div", {
2595
- className: "ath-carousel-wrapper",
2596
- children: jsxs("div", {
2597
- className: carouselClasses,
2598
- css: sx?.carousel,
2634
+ return jsxs("div", {
2635
+ className: "ath-carousel-container",
2636
+ style: {
2637
+ minWidth: itemCount === 1 ? "" : 0
2638
+ },
2639
+ children: [label && jsx(FormLabel, {
2640
+ label: label,
2641
+ dark: true
2642
+ }), jsxs("div", {
2643
+ className: cx("ath-carousel-wrapper", isHovered && "ath-carousel-hover", label && "ath-carousel-label"),
2599
2644
  onMouseEnter: handleMouseEnter,
2600
2645
  onMouseLeave: handleMouseLeave,
2601
- ref: carouselRef,
2602
- children: [jsx(Button, {
2646
+ children: [showLeftArrow && jsx(Button, {
2603
2647
  className: {
2604
2648
  button: "ath-carousel-arrow ath-carousel-left-arrow"
2605
2649
  },
2606
- onClick: handleLeftArrowClick,
2607
- onMouseEnter: handleMouseEnter,
2608
- onMouseLeave: handleMouseLeave,
2650
+ onClick: () => scrollByPage(-1),
2609
2651
  icon: jsx(HugeiconsIcon, {
2610
2652
  icon: Qt,
2611
2653
  size: 36
2612
2654
  })
2613
- }), hasItems ? children : jsx("div", {
2614
- className: "ath-carousel-empty",
2615
- children: emptyMessage
2616
- }), jsx(Button, {
2655
+ }), jsx("div", {
2656
+ className: carouselClasses,
2657
+ css: sx?.carousel,
2658
+ ref: carouselRef,
2659
+ children: itemCount > 0 ? children : jsx("div", {
2660
+ className: "ath-carousel-empty",
2661
+ children: emptyMessage
2662
+ })
2663
+ }), showRightArrow && jsx(Button, {
2617
2664
  className: {
2618
2665
  button: "ath-carousel-arrow ath-carousel-right-arrow"
2619
2666
  },
2620
- onClick: handleRightArrowClick,
2621
- onMouseEnter: handleMouseEnter,
2622
- onMouseLeave: handleMouseLeave,
2667
+ onClick: () => scrollByPage(1),
2623
2668
  icon: jsx(HugeiconsIcon, {
2624
2669
  icon: un,
2625
2670
  size: 36
2626
2671
  })
2627
2672
  })]
2628
- })
2673
+ })]
2629
2674
  });
2630
2675
  };
2631
2676
 
@@ -2658,30 +2703,6 @@ const Dropdown = ({
2658
2703
  });
2659
2704
  };
2660
2705
 
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
2706
  const FormTextInput = ({
2686
2707
  autoComplete,
2687
2708
  autoFocus,
@@ -2867,10 +2888,11 @@ const Header = ({
2867
2888
  const Main = ({
2868
2889
  children,
2869
2890
  className,
2870
- sx
2891
+ sx,
2892
+ width = "wide"
2871
2893
  }) => {
2872
2894
  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 : "");
2895
+ 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
2896
  return jsx("main", {
2875
2897
  css: sx?.main,
2876
2898
  className: mainClasses,
@@ -3028,7 +3050,7 @@ const Modal = ({
3028
3050
  children: [(title || showCloseButton) && jsxs("div", {
3029
3051
  css: sx?.header,
3030
3052
  className: headerClasses,
3031
- children: [title && jsx("h1", {
3053
+ children: [title && jsx("h2", {
3032
3054
  css: sx?.title,
3033
3055
  className: titleClasses,
3034
3056
  id: titleId,
@@ -3206,192 +3228,182 @@ const breakpoints = {
3206
3228
  };
3207
3229
  const minWidth = width => `@media (min-width: ${width}px)`;
3208
3230
  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"
3231
+ const media = {
3232
+ min: {
3233
+ xs: minWidth(breakpoints.xs),
3234
+ sm: minWidth(breakpoints.sm),
3235
+ md: minWidth(breakpoints.md),
3236
+ lg: minWidth(breakpoints.lg),
3237
+ xl: minWidth(breakpoints.xl),
3238
+ "2xl": minWidth(breakpoints["2xl"]),
3239
+ "3xl": minWidth(breakpoints["3xl"]),
3240
+ "4xl": minWidth(breakpoints["4xl"])
3241
+ },
3242
+ max: {
3243
+ xs: maxWidth(breakpoints.xs),
3244
+ sm: maxWidth(breakpoints.sm),
3245
+ md: maxWidth(breakpoints.md),
3246
+ lg: maxWidth(breakpoints.lg),
3247
+ xl: maxWidth(breakpoints.xl),
3248
+ "2xl": maxWidth(breakpoints["2xl"]),
3249
+ "3xl": maxWidth(breakpoints["3xl"]),
3250
+ "4xl": maxWidth(breakpoints["4xl"])
3251
+ }
3252
+ };
3253
+ const font = {
3254
+ family: {
3255
+ sans: "Montserrat, sans-serif",
3256
+ serif: "Libre Baskerville, serif"
3257
+ },
3258
+ size: {
3259
+ xs: "0.75rem",
3260
+ sm: "0.875rem",
3261
+ md: "1rem",
3262
+ lg: "1.25rem",
3263
+ xl: "1.5rem",
3264
+ "2xl": "2rem",
3265
+ "3xl": "2.5rem",
3266
+ "4xl": "3rem",
3267
+ "5xl": "3.5rem"
3268
+ }
3269
+ };
3270
+ const color = {
3271
+ primary: {
3272
+ "50": "#f0f2f5",
3273
+ "100": "#d9dee6",
3274
+ "200": "#b8c3d1",
3275
+ "300": "#8a9bae",
3276
+ "400": "#4a5f7a",
3277
+ "500": "#0b1828",
3278
+ "600": "#081320",
3279
+ "700": "#060e18",
3280
+ "800": "#04090f",
3281
+ "900": "#020407",
3282
+ default: "#0b1828",
3283
+ vibrant: {
3284
+ "300": "#8ab6ff",
3285
+ "500": "#4f86f7",
3286
+ "700": "#1e3a8a"
3242
3287
  }
3243
3288
  },
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",
3289
+ secondary: {
3290
+ "50": "#e6f7f6",
3291
+ "100": "#b3e8e5",
3292
+ "200": "#80d9d4",
3293
+ "300": "#4dcac3",
3294
+ "400": "#2aa39b",
3295
+ "500": "#146b68",
3296
+ "600": "#125a57",
3297
+ "700": "#0f4a47",
3298
+ "800": "#0c3835",
3299
+ "900": "#081f1c",
3300
+ default: "#146b68",
3301
+ vibrant: {
3302
+ "300": "#75dac7",
3303
+ "500": "#1abc9c",
3304
+ "700": "#138f6e"
3305
+ }
3306
+ },
3307
+ tertiary: {
3308
+ "50": "#f7f4f0",
3309
+ "100": "#eedecc",
3310
+ "200": "#e5c8a8",
3311
+ "300": "#dcb184",
3312
+ "400": "#d19b60",
3313
+ "500": "#bfa081",
3314
+ "600": "#a68965",
3315
+ "700": "#7d6748",
3316
+ "800": "#54442c",
3317
+ "900": "#2b2216",
3318
+ default: "#bfa081",
3319
+ vibrant: {
3320
+ "300": "#f7c873",
3323
3321
  "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"
3322
+ "700": "#c9780e"
3360
3323
  }
3361
3324
  },
3362
- padding: {
3363
- xs: "2px",
3364
- sm: "4px",
3365
- md: "6px",
3366
- lg: "10px",
3367
- xl: "16px"
3325
+ error: {
3326
+ "50": "#fee6e6",
3327
+ "100": "#fbb3b3",
3328
+ "200": "#f88080",
3329
+ "300": "#f54d4d",
3330
+ "400": "#f21a1a",
3331
+ "500": "#9f0001",
3332
+ "600": "#800001",
3333
+ "700": "#600001",
3334
+ "800": "#400000",
3335
+ "900": "#200000",
3336
+ default: "#9f0001",
3337
+ vibrant: {
3338
+ "300": "#f48a6f",
3339
+ "500": "#e74c3c",
3340
+ "700": "#c0392b"
3341
+ }
3368
3342
  },
3369
- radius: {
3370
- sm: "3px",
3371
- md: "5px",
3372
- lg: "8px"
3343
+ warning: {
3344
+ "50": "#fef5ec",
3345
+ "100": "#fdebda",
3346
+ "200": "#fad8b3",
3347
+ "300": "#f8c48c",
3348
+ "400": "#f5b065",
3349
+ "500": "#f39c12",
3350
+ "600": "#c27d0e",
3351
+ "700": "#925e0b",
3352
+ "800": "#613e07",
3353
+ "900": "#311f04",
3354
+ default: "#f39c12",
3355
+ vibrant: {
3356
+ "300": "#fce705",
3357
+ "500": "#fbc306",
3358
+ "700": "#f8950a"
3359
+ }
3373
3360
  },
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)"
3361
+ success: {
3362
+ "50": "#e8f5f2",
3363
+ "100": "#d1ece4",
3364
+ "200": "#a3d8ca",
3365
+ "300": "#76c5af",
3366
+ "400": "#48b195",
3367
+ "500": "#1a9e7a",
3368
+ "600": "#157e62",
3369
+ "700": "#105f49",
3370
+ "800": "#0a3f31",
3371
+ "900": "#052018",
3372
+ default: "#1a9e7a",
3373
+ vibrant: {
3374
+ "300": "#07e71f",
3375
+ "500": "#08e27e",
3376
+ "700": "#26b656"
3392
3377
  }
3378
+ },
3379
+ text: {
3380
+ dark: "#040a0c",
3381
+ light: "#fcfbf7"
3382
+ },
3383
+ background: {
3384
+ light: "#fcfbf7",
3385
+ dark: "#040a0c"
3393
3386
  }
3394
3387
  };
3388
+ const padding = {
3389
+ xs: "2px",
3390
+ sm: "4px",
3391
+ md: "6px",
3392
+ lg: "10px",
3393
+ xl: "16px"
3394
+ };
3395
+ const radius = {
3396
+ sm: "3px",
3397
+ md: "5px",
3398
+ lg: "8px"
3399
+ };
3400
+ const tokens = {
3401
+ font,
3402
+ color,
3403
+ media,
3404
+ padding,
3405
+ radius
3406
+ };
3395
3407
 
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 };
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 };
3397
3409
  //# sourceMappingURL=athameui.mjs.map