athameui 0.0.9-c → 0.0.11

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 (40) hide show
  1. package/components/Avatar/Avatar.tsx +0 -1
  2. package/components/Button/Button.tsx +18 -0
  3. package/components/Button/button.variants.ts +1 -0
  4. package/components/Carousel/Carousel.tsx +84 -0
  5. package/components/Carousel/index.ts +1 -0
  6. package/components/DropDown/Dropdown.tsx +0 -1
  7. package/components/index.ts +1 -0
  8. package/dist/athameui.cjs +118 -6
  9. package/dist/athameui.cjs.map +1 -1
  10. package/dist/athameui.mjs +103 -8
  11. package/dist/athameui.mjs.map +1 -1
  12. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  13. package/dist/components/Button/Button.d.ts +3 -0
  14. package/dist/components/Button/Button.d.ts.map +1 -1
  15. package/dist/components/Button/button.variants.d.ts +1 -0
  16. package/dist/components/Button/button.variants.d.ts.map +1 -1
  17. package/dist/components/Carousel/Carousel.d.ts +14 -0
  18. package/dist/components/Carousel/Carousel.d.ts.map +1 -0
  19. package/dist/components/Carousel/index.d.ts +2 -0
  20. package/dist/components/Carousel/index.d.ts.map +1 -0
  21. package/dist/components/DropDown/Dropdown.d.ts.map +1 -1
  22. package/dist/components/index.d.ts +1 -0
  23. package/dist/components/index.d.ts.map +1 -1
  24. package/dist/styles/breakpoints.d.ts +16 -0
  25. package/dist/styles/breakpoints.d.ts.map +1 -1
  26. package/dist/styles/breakpoints.ts +21 -0
  27. package/dist/styles/components/button.css +4 -1
  28. package/dist/styles/components/carousel.css +43 -0
  29. package/dist/styles/components/form-input.css +10 -1
  30. package/dist/styles/components/main.css +3 -1
  31. package/dist/styles/theme.css +1 -0
  32. package/dist/styles/tokens.css +6 -10
  33. package/package.json +1 -1
  34. package/styles/breakpoints.ts +21 -0
  35. package/styles/components/button.css +4 -1
  36. package/styles/components/carousel.css +43 -0
  37. package/styles/components/form-input.css +10 -1
  38. package/styles/components/main.css +3 -1
  39. package/styles/theme.css +1 -0
  40. package/styles/tokens.css +6 -10
@@ -24,7 +24,6 @@ export const Avatar = ({
24
24
  sx,
25
25
  size = "medium",
26
26
  }: AvatarProps) => {
27
- console.log(className?.avatar);
28
27
  const initials = displayName.split(" ").map((n) => n[0].toUpperCase());
29
28
  const avatarClasses = cx(
30
29
  "ath-avatar",
@@ -29,11 +29,14 @@ export type ButtonProps = {
29
29
  textPosition?: "left" | "center" | "right";
30
30
  type?: "button" | "submit" | "reset";
31
31
  variant?: ButtonVariant;
32
+ wrap?: boolean;
32
33
 
33
34
  onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
34
35
  onClick?: MouseEventHandler<HTMLButtonElement>;
35
36
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
36
37
  onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
38
+ onMouseEnter?: MouseEventHandler<HTMLButtonElement>;
39
+ onMouseLeave?: MouseEventHandler<HTMLButtonElement>;
37
40
  };
38
41
 
39
42
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
@@ -50,15 +53,19 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
50
53
  type = "button",
51
54
  textPosition = "center",
52
55
  variant = "secondary",
56
+ wrap = false,
53
57
 
54
58
  onBlur,
55
59
  onClick,
56
60
  onFocus,
57
61
  onKeyDown,
62
+ onMouseEnter,
63
+ onMouseLeave,
58
64
  ...other
59
65
  },
60
66
  ref,
61
67
  ) => {
68
+ console.log(sx);
62
69
  const isIconOnly = icon && !children;
63
70
 
64
71
  const sharedClasses = cx(
@@ -67,6 +74,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
67
74
  buttonVariants.variant[variant],
68
75
  isIconOnly ? "ath-button-icon-only" : "",
69
76
  dark ? buttonVariants.dark : "",
77
+ wrap ? buttonVariants.wrap : "",
70
78
  );
71
79
 
72
80
  const buttonClasses = cx(
@@ -93,6 +101,14 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
93
101
  onBlur?.(e);
94
102
  };
95
103
 
104
+ const onMouseEnterHandler: MouseEventHandler<HTMLButtonElement> = (e) => {
105
+ onMouseEnter?.(e);
106
+ };
107
+
108
+ const onMouseLeaveHandler: MouseEventHandler<HTMLButtonElement> = (e) => {
109
+ onMouseLeave?.(e);
110
+ };
111
+
96
112
  return (
97
113
  <button
98
114
  ref={ref}
@@ -105,6 +121,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
105
121
  onKeyDown={onKeyDownHandler}
106
122
  onFocus={onFocusHandler}
107
123
  onBlur={onBlurHandler}
124
+ onMouseEnter={onMouseEnterHandler}
125
+ onMouseLeave={onMouseLeaveHandler}
108
126
  {...other}
109
127
  >
110
128
  {icon ? (
@@ -21,6 +21,7 @@ export const buttonVariants = {
21
21
  ghost: "ath-button-ghost",
22
22
  },
23
23
  dark: "ath-button-dark",
24
+ wrap: "ath-button-wrap",
24
25
  } as const;
25
26
 
26
27
  export type ButtonSize = keyof typeof buttonVariants.size;
@@ -0,0 +1,84 @@
1
+ import { Children, useState, useRef, type ReactNode } from "react";
2
+ import { CSSObject } from "@emotion/react";
3
+ import { cx } from "../../utils/cx";
4
+ import { Button } from "../Button/Button";
5
+ import { HugeiconsIcon } from "@hugeicons/react";
6
+ import { ArrowLeftIcon, ArrowRightIcon } from "@hugeicons/core-free-icons";
7
+
8
+ export type CarouselProps = {
9
+ children?: ReactNode;
10
+ className?: {
11
+ carousel?: string | false | null | undefined;
12
+ };
13
+ emptyMessage?: string;
14
+ sx?: {
15
+ carousel?: CSSObject;
16
+ };
17
+ };
18
+
19
+ export const Carousel = ({
20
+ children,
21
+ className,
22
+ emptyMessage,
23
+ sx,
24
+ }: CarouselProps) => {
25
+ const [isHovered, setIsHovered] = useState(false);
26
+ const carouselRef = useRef<HTMLDivElement>(null);
27
+ const carouselClasses = cx(
28
+ "ath-carousel",
29
+ isHovered ? "ath-carousel-hover" : "",
30
+ className?.carousel,
31
+ );
32
+ const hasItems = Children.count(children) > 0;
33
+
34
+ const scrollByPage = (direction: -1 | 1) => {
35
+ const el = carouselRef.current;
36
+ if (!el) return;
37
+ el.scrollBy({
38
+ left: direction * el.clientWidth,
39
+ behavior: "smooth",
40
+ });
41
+ };
42
+
43
+ const handleLeftArrowClick = () => {
44
+ scrollByPage(-1);
45
+ };
46
+ const handleRightArrowClick = () => {
47
+ scrollByPage(1);
48
+ };
49
+
50
+ const handleMouseEnter = () => {
51
+ setIsHovered(true);
52
+ };
53
+ const handleMouseLeave = () => {
54
+ setIsHovered(false);
55
+ };
56
+
57
+ return (
58
+ <div className="ath-carousel-wrapper">
59
+ <div
60
+ className={carouselClasses}
61
+ css={sx?.carousel}
62
+ onMouseEnter={handleMouseEnter}
63
+ onMouseLeave={handleMouseLeave}
64
+ ref={carouselRef}
65
+ >
66
+ <Button
67
+ className={{ button: "ath-carousel-arrow ath-carousel-left-arrow" }}
68
+ onClick={handleLeftArrowClick}
69
+ onMouseEnter={handleMouseEnter}
70
+ onMouseLeave={handleMouseLeave}
71
+ icon={<HugeiconsIcon icon={ArrowLeftIcon} size={36} />}
72
+ />
73
+ {hasItems ? children : emptyMessage}
74
+ <Button
75
+ className={{ button: "ath-carousel-arrow ath-carousel-right-arrow" }}
76
+ onClick={handleRightArrowClick}
77
+ onMouseEnter={handleMouseEnter}
78
+ onMouseLeave={handleMouseLeave}
79
+ icon={<HugeiconsIcon icon={ArrowRightIcon} size={36} />}
80
+ />
81
+ </div>
82
+ </div>
83
+ );
84
+ };
@@ -0,0 +1 @@
1
+ export * from "./Carousel";
@@ -54,7 +54,6 @@ export const Dropdown = ({
54
54
  css={sx?.dropdown}
55
55
  data-testid="dropdown"
56
56
  >
57
- fdpdsugfpoidsuy
58
57
  {children}
59
58
  </div>
60
59
  );
@@ -3,6 +3,7 @@ export * from "./Avatar";
3
3
  export * from "./Block";
4
4
  export * from "./Button";
5
5
  export * from "./ButtonGroup";
6
+ export * from "./Carousel";
6
7
  export * from "./DropDown";
7
8
  export * from "./ContainerScalingText";
8
9
  export * from "./FormField";
package/dist/athameui.cjs CHANGED
@@ -2180,7 +2180,8 @@ const buttonVariants = {
2180
2180
  outline: "ath-button-outline",
2181
2181
  ghost: "ath-button-ghost"
2182
2182
  },
2183
- dark: "ath-button-dark"
2183
+ dark: "ath-button-dark",
2184
+ wrap: "ath-button-wrap"
2184
2185
  };
2185
2186
 
2186
2187
  const Button = /*#__PURE__*/React.forwardRef(({
@@ -2195,14 +2196,18 @@ const Button = /*#__PURE__*/React.forwardRef(({
2195
2196
  type = "button",
2196
2197
  textPosition = "center",
2197
2198
  variant = "secondary",
2199
+ wrap = false,
2198
2200
  onBlur,
2199
2201
  onClick,
2200
2202
  onFocus,
2201
2203
  onKeyDown,
2204
+ onMouseEnter,
2205
+ onMouseLeave,
2202
2206
  ...other
2203
2207
  }, ref) => {
2208
+ console.log(sx);
2204
2209
  const isIconOnly = icon && !children;
2205
- const sharedClasses = cx("ath-button", buttonVariants.size[size], buttonVariants.variant[variant], isIconOnly ? "ath-button-icon-only" : "", dark ? buttonVariants.dark : "");
2210
+ const sharedClasses = cx("ath-button", buttonVariants.size[size], buttonVariants.variant[variant], isIconOnly ? "ath-button-icon-only" : "", dark ? buttonVariants.dark : "", wrap ? buttonVariants.wrap : "");
2206
2211
  const buttonClasses = cx(sharedClasses, buttonVariants.textPosition[textPosition], typeof className === "object" && className !== null ? className.button : className);
2207
2212
  const onClickHandler = e => {
2208
2213
  onClick?.(e);
@@ -2216,6 +2221,12 @@ const Button = /*#__PURE__*/React.forwardRef(({
2216
2221
  const onBlurHandler = e => {
2217
2222
  onBlur?.(e);
2218
2223
  };
2224
+ const onMouseEnterHandler = e => {
2225
+ onMouseEnter?.(e);
2226
+ };
2227
+ const onMouseLeaveHandler = e => {
2228
+ onMouseLeave?.(e);
2229
+ };
2219
2230
  return jsx("button", {
2220
2231
  ref: ref,
2221
2232
  className: buttonClasses,
@@ -2227,6 +2238,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
2227
2238
  onKeyDown: onKeyDownHandler,
2228
2239
  onFocus: onFocusHandler,
2229
2240
  onBlur: onBlurHandler,
2241
+ onMouseEnter: onMouseEnterHandler,
2242
+ onMouseLeave: onMouseLeaveHandler,
2230
2243
  ...other,
2231
2244
  children: icon ? jsxs(Fragment, {
2232
2245
  children: [icon, !isIconOnly && children]
@@ -2367,7 +2380,6 @@ const Avatar = ({
2367
2380
  sx,
2368
2381
  size = "medium"
2369
2382
  }) => {
2370
- console.log(className?.avatar);
2371
2383
  const initials = displayName.split(" ").map(n => n[0].toUpperCase());
2372
2384
  const avatarClasses = cx("ath-avatar", `ath-avatar-${size}`, className?.avatar);
2373
2385
  const initialsClasses = cx(`ath-avatar-initials`, className?.initials);
@@ -2453,7 +2465,7 @@ const HugeiconsIcon = React.forwardRef(({ color = 'currentColor', size = 24, str
2453
2465
  });
2454
2466
  HugeiconsIcon.displayName = 'HugeiconsIcon';
2455
2467
 
2456
- const 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"}]];
2468
+ 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"}]];
2457
2469
 
2458
2470
  const ScrollToTopButton = ({
2459
2471
  className,
@@ -2571,6 +2583,71 @@ const ButtonGroup = ({
2571
2583
  });
2572
2584
  };
2573
2585
 
2586
+ const Carousel = ({
2587
+ children,
2588
+ className,
2589
+ emptyMessage,
2590
+ sx
2591
+ }) => {
2592
+ const [isHovered, setIsHovered] = React.useState(false);
2593
+ const carouselRef = React.useRef(null);
2594
+ const carouselClasses = cx("ath-carousel", isHovered ? "ath-carousel-hover" : "", className?.carousel);
2595
+ const hasItems = React.Children.count(children) > 0;
2596
+ const scrollByPage = direction => {
2597
+ const el = carouselRef.current;
2598
+ if (!el) return;
2599
+ el.scrollBy({
2600
+ left: direction * el.clientWidth,
2601
+ behavior: "smooth"
2602
+ });
2603
+ };
2604
+ const handleLeftArrowClick = () => {
2605
+ scrollByPage(-1);
2606
+ };
2607
+ const handleRightArrowClick = () => {
2608
+ scrollByPage(1);
2609
+ };
2610
+ const handleMouseEnter = () => {
2611
+ setIsHovered(true);
2612
+ };
2613
+ const handleMouseLeave = () => {
2614
+ setIsHovered(false);
2615
+ };
2616
+ return jsx("div", {
2617
+ className: "ath-carousel-wrapper",
2618
+ children: jsxs("div", {
2619
+ className: carouselClasses,
2620
+ css: sx?.carousel,
2621
+ onMouseEnter: handleMouseEnter,
2622
+ onMouseLeave: handleMouseLeave,
2623
+ ref: carouselRef,
2624
+ children: [jsx(Button, {
2625
+ className: {
2626
+ button: "ath-carousel-arrow ath-carousel-left-arrow"
2627
+ },
2628
+ onClick: handleLeftArrowClick,
2629
+ onMouseEnter: handleMouseEnter,
2630
+ onMouseLeave: handleMouseLeave,
2631
+ icon: jsx(HugeiconsIcon, {
2632
+ icon: Qt,
2633
+ size: 36
2634
+ })
2635
+ }), hasItems ? children : emptyMessage, jsx(Button, {
2636
+ className: {
2637
+ button: "ath-carousel-arrow ath-carousel-right-arrow"
2638
+ },
2639
+ onClick: handleRightArrowClick,
2640
+ onMouseEnter: handleMouseEnter,
2641
+ onMouseLeave: handleMouseLeave,
2642
+ icon: jsx(HugeiconsIcon, {
2643
+ icon: un,
2644
+ size: 36
2645
+ })
2646
+ })]
2647
+ })
2648
+ });
2649
+ };
2650
+
2574
2651
  const Dropdown = ({
2575
2652
  children,
2576
2653
  className,
@@ -2591,12 +2668,12 @@ const Dropdown = ({
2591
2668
  document.removeEventListener("mousedown", handleOutsideClick);
2592
2669
  };
2593
2670
  }, [onClose]);
2594
- return jsxs("div", {
2671
+ return jsx("div", {
2595
2672
  ref: dropdownRef,
2596
2673
  className: dropdownClasses,
2597
2674
  css: sx?.dropdown,
2598
2675
  "data-testid": "dropdown",
2599
- children: ["fdpdsugfpoidsuy", children]
2676
+ children: children
2600
2677
  });
2601
2678
  };
2602
2679
 
@@ -3146,6 +3223,24 @@ const breakpoints = {
3146
3223
  "3xl": 1280,
3147
3224
  "4xl": 1536
3148
3225
  };
3226
+ const minWidth = width => `@media (min-width: ${width}px)`;
3227
+ const maxWidth = width => `@media (max-width: ${width - 1}px)`;
3228
+ const minXs = minWidth(breakpoints.xs);
3229
+ const minSm = minWidth(breakpoints.sm);
3230
+ const minMd = minWidth(breakpoints.md);
3231
+ const minLg = minWidth(breakpoints.lg);
3232
+ const minXl = minWidth(breakpoints.xl);
3233
+ const min2xl = minWidth(breakpoints["2xl"]);
3234
+ const min3xl = minWidth(breakpoints["3xl"]);
3235
+ const min4xl = minWidth(breakpoints["4xl"]);
3236
+ const maxXs = maxWidth(breakpoints.xs);
3237
+ const maxSm = maxWidth(breakpoints.sm);
3238
+ const maxMd = maxWidth(breakpoints.md);
3239
+ const maxLg = maxWidth(breakpoints.lg);
3240
+ const maxXl = maxWidth(breakpoints.xl);
3241
+ const max2xl = maxWidth(breakpoints["2xl"]);
3242
+ const max3xl = maxWidth(breakpoints["3xl"]);
3243
+ const max4xl = maxWidth(breakpoints["4xl"]);
3149
3244
 
3150
3245
  const tokens = {
3151
3246
  font: {
@@ -3323,6 +3418,7 @@ exports.Avatar = Avatar;
3323
3418
  exports.Block = Block;
3324
3419
  exports.Button = Button;
3325
3420
  exports.ButtonGroup = ButtonGroup;
3421
+ exports.Carousel = Carousel;
3326
3422
  exports.ContainerScalingText = ContainerScalingText;
3327
3423
  exports.Dropdown = Dropdown;
3328
3424
  exports.Footer = Footer;
@@ -3339,5 +3435,21 @@ exports.Search = Search;
3339
3435
  exports.SlideOut = SlideOut;
3340
3436
  exports.breakpoints = breakpoints;
3341
3437
  exports.cx = cx;
3438
+ exports.max2xl = max2xl;
3439
+ exports.max3xl = max3xl;
3440
+ exports.max4xl = max4xl;
3441
+ exports.maxLg = maxLg;
3442
+ exports.maxMd = maxMd;
3443
+ exports.maxSm = maxSm;
3444
+ exports.maxXl = maxXl;
3445
+ exports.maxXs = maxXs;
3446
+ exports.min2xl = min2xl;
3447
+ exports.min3xl = min3xl;
3448
+ exports.min4xl = min4xl;
3449
+ exports.minLg = minLg;
3450
+ exports.minMd = minMd;
3451
+ exports.minSm = minSm;
3452
+ exports.minXl = minXl;
3453
+ exports.minXs = minXs;
3342
3454
  exports.tokens = tokens;
3343
3455
  //# sourceMappingURL=athameui.cjs.map