athameui 0.0.8 → 0.0.10

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 (77) hide show
  1. package/components/Avatar/Avatar.tsx +0 -2
  2. package/components/Block/Block.tsx +22 -0
  3. package/components/Block/index.ts +1 -0
  4. package/components/Button/Button.tsx +14 -0
  5. package/components/Carousel/Carousel.tsx +84 -0
  6. package/components/Carousel/index.ts +1 -0
  7. package/components/DropDown/Dropdown.tsx +60 -0
  8. package/components/DropDown/index.ts +1 -0
  9. package/components/Layout/Main.tsx +21 -14
  10. package/components/Modal/Modal.tsx +1 -1
  11. package/components/SlideOut/SlideOut.tsx +71 -0
  12. package/components/SlideOut/index.ts +1 -0
  13. package/components/index.ts +4 -0
  14. package/dist/athameui.cjs +200 -39
  15. package/dist/athameui.cjs.map +1 -1
  16. package/dist/athameui.mjs +198 -41
  17. package/dist/athameui.mjs.map +1 -1
  18. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  19. package/dist/components/Block/Block.d.ts +13 -0
  20. package/dist/components/Block/Block.d.ts.map +1 -0
  21. package/dist/components/Block/index.d.ts +2 -0
  22. package/dist/components/Block/index.d.ts.map +1 -0
  23. package/dist/components/Button/Button.d.ts +2 -0
  24. package/dist/components/Button/Button.d.ts.map +1 -1
  25. package/dist/components/Carousel/Carousel.d.ts +14 -0
  26. package/dist/components/Carousel/Carousel.d.ts.map +1 -0
  27. package/dist/components/Carousel/index.d.ts +2 -0
  28. package/dist/components/Carousel/index.d.ts.map +1 -0
  29. package/dist/components/DropDown/Dropdown.d.ts +14 -0
  30. package/dist/components/DropDown/Dropdown.d.ts.map +1 -0
  31. package/dist/components/DropDown/index.d.ts +2 -0
  32. package/dist/components/DropDown/index.d.ts.map +1 -0
  33. package/dist/components/Layout/Main.d.ts +7 -3
  34. package/dist/components/Layout/Main.d.ts.map +1 -1
  35. package/dist/components/SlideOut/SlideOut.d.ts +21 -0
  36. package/dist/components/SlideOut/SlideOut.d.ts.map +1 -0
  37. package/dist/components/SlideOut/index.d.ts +2 -0
  38. package/dist/components/SlideOut/index.d.ts.map +1 -0
  39. package/dist/components/index.d.ts +4 -0
  40. package/dist/components/index.d.ts.map +1 -1
  41. package/dist/styles/breakpoints.d.ts +13 -0
  42. package/dist/styles/breakpoints.d.ts.map +1 -0
  43. package/dist/styles/breakpoints.ts +13 -0
  44. package/dist/styles/components/accordion.css +8 -5
  45. package/dist/styles/components/block.css +8 -0
  46. package/dist/styles/components/button.css +1 -1
  47. package/dist/styles/components/carousel.css +43 -0
  48. package/dist/styles/components/dropdown.css +18 -0
  49. package/dist/styles/components/form-input.css +10 -1
  50. package/dist/styles/components/main.css +14 -3
  51. package/dist/styles/components/slide-out.css +69 -0
  52. package/dist/styles/index.d.ts +1 -1
  53. package/dist/styles/index.d.ts.map +1 -1
  54. package/dist/styles/index.ts +1 -1
  55. package/dist/styles/theme.css +4 -0
  56. package/dist/styles/tokens.css +44 -28
  57. package/dist/styles/tokens.d.ts +0 -10
  58. package/dist/styles/tokens.d.ts.map +1 -1
  59. package/dist/styles/tokens.ts +16 -26
  60. package/package.json +1 -1
  61. package/styles/breakpoints.ts +13 -0
  62. package/styles/components/accordion.css +8 -5
  63. package/styles/components/block.css +8 -0
  64. package/styles/components/button.css +1 -1
  65. package/styles/components/carousel.css +43 -0
  66. package/styles/components/dropdown.css +18 -0
  67. package/styles/components/form-input.css +10 -1
  68. package/styles/components/main.css +14 -3
  69. package/styles/components/slide-out.css +69 -0
  70. package/styles/index.ts +1 -1
  71. package/styles/theme.css +4 -0
  72. package/styles/tokens.css +44 -28
  73. package/styles/tokens.ts +16 -26
  74. package/dist/styles/mediaQueries.d.ts +0 -11
  75. package/dist/styles/mediaQueries.d.ts.map +0 -1
  76. package/dist/styles/mediaQueries.ts +0 -10
  77. package/styles/mediaQueries.ts +0 -10
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { CSSObject } from "@emotion/react";
3
2
  import { cx } from "../../utils/cx";
4
3
 
@@ -25,7 +24,6 @@ export const Avatar = ({
25
24
  sx,
26
25
  size = "medium",
27
26
  }: AvatarProps) => {
28
- console.log(className?.avatar);
29
27
  const initials = displayName.split(" ").map((n) => n[0].toUpperCase());
30
28
  const avatarClasses = cx(
31
29
  "ath-avatar",
@@ -0,0 +1,22 @@
1
+ import { CSSObject } from "@emotion/react";
2
+ import { cx } from "../../utils/cx";
3
+
4
+ type BlockProps = {
5
+ children: React.ReactNode;
6
+ className?: {
7
+ block?: string | false | null | undefined;
8
+ };
9
+ sx?: {
10
+ block: CSSObject;
11
+ };
12
+ };
13
+
14
+ export const Block = ({ children, className, sx }: BlockProps) => {
15
+ const blockClasses = cx("ath-block", className?.block);
16
+
17
+ return (
18
+ <div className={blockClasses} data-testid="block" css={sx?.block}>
19
+ {children}
20
+ </div>
21
+ );
22
+ };
@@ -0,0 +1 @@
1
+ export * from "./Block";
@@ -34,6 +34,8 @@ export type ButtonProps = {
34
34
  onClick?: MouseEventHandler<HTMLButtonElement>;
35
35
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
36
36
  onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
37
+ onMouseEnter?: MouseEventHandler<HTMLButtonElement>;
38
+ onMouseLeave?: MouseEventHandler<HTMLButtonElement>;
37
39
  };
38
40
 
39
41
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
@@ -55,6 +57,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
55
57
  onClick,
56
58
  onFocus,
57
59
  onKeyDown,
60
+ onMouseEnter,
61
+ onMouseLeave,
58
62
  ...other
59
63
  },
60
64
  ref,
@@ -93,6 +97,14 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
93
97
  onBlur?.(e);
94
98
  };
95
99
 
100
+ const onMouseEnterHandler: MouseEventHandler<HTMLButtonElement> = (e) => {
101
+ onMouseEnter?.(e);
102
+ };
103
+
104
+ const onMouseLeaveHandler: MouseEventHandler<HTMLButtonElement> = (e) => {
105
+ onMouseLeave?.(e);
106
+ };
107
+
96
108
  return (
97
109
  <button
98
110
  ref={ref}
@@ -105,6 +117,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
105
117
  onKeyDown={onKeyDownHandler}
106
118
  onFocus={onFocusHandler}
107
119
  onBlur={onBlurHandler}
120
+ onMouseEnter={onMouseEnterHandler}
121
+ onMouseLeave={onMouseLeaveHandler}
108
122
  {...other}
109
123
  >
110
124
  {icon ? (
@@ -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";
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ import { CSSObject } from "@emotion/react";
4
+ import { cx } from "../../utils/cx";
5
+
6
+ export type DropdownProps = {
7
+ children: React.ReactNode;
8
+ className?: {
9
+ dropdown?: string | false | null | undefined;
10
+ };
11
+ isOpen: boolean;
12
+ sx?: {
13
+ dropdown?: CSSObject;
14
+ };
15
+
16
+ onClose: () => void;
17
+ };
18
+
19
+ export const Dropdown = ({
20
+ children,
21
+ className,
22
+ isOpen,
23
+ sx,
24
+
25
+ onClose,
26
+ }: DropdownProps) => {
27
+ const dropdownRef = useRef<HTMLDivElement>(null);
28
+ const dropdownClasses = cx(
29
+ "ath-dropdown",
30
+ isOpen && "ath-dropdown-open",
31
+ className?.dropdown,
32
+ );
33
+
34
+ useEffect(() => {
35
+ const handleOutsideClick = (event: MouseEvent) => {
36
+ if (
37
+ dropdownRef.current &&
38
+ !dropdownRef.current.contains(event.target as Node)
39
+ ) {
40
+ onClose();
41
+ }
42
+ };
43
+
44
+ document.addEventListener("mousedown", handleOutsideClick);
45
+ return () => {
46
+ document.removeEventListener("mousedown", handleOutsideClick);
47
+ };
48
+ }, [onClose]);
49
+
50
+ return (
51
+ <div
52
+ ref={dropdownRef}
53
+ className={dropdownClasses}
54
+ css={sx?.dropdown}
55
+ data-testid="dropdown"
56
+ >
57
+ {children}
58
+ </div>
59
+ );
60
+ };
@@ -0,0 +1 @@
1
+ export * from "./Dropdown";
@@ -4,28 +4,35 @@ import { cx } from "../../utils";
4
4
 
5
5
  type MainProps = {
6
6
  children?: React.ReactNode;
7
- className?:
8
- | string
9
- | {
10
- main?: string | false | null | undefined;
11
- }
12
- | false
13
- | undefined
14
- | null;
15
- sx?: CSSObject;
7
+ className?: {
8
+ main?: string | false | null | undefined;
9
+ mainContent?: string | false | null | undefined;
10
+ };
11
+
12
+ sx?: {
13
+ main?: CSSObject;
14
+ mainContent?: CSSObject;
15
+ };
16
16
  };
17
17
 
18
18
  export const Main = ({ children, className, sx }: MainProps) => {
19
- const classes = cx(
19
+ const mainClasses = cx(
20
20
  "ath-main",
21
+ typeof className === "object" && className !== null ? className.main : "",
22
+ );
23
+
24
+ const mainContentClasses = cx(
25
+ "ath-main-content",
21
26
  typeof className === "object" && className !== null
22
- ? className.main
23
- : className,
27
+ ? className.mainContent
28
+ : "",
24
29
  );
25
30
 
26
31
  return (
27
- <main css={sx} className={classes}>
28
- {children}
32
+ <main css={sx?.main} className={mainClasses}>
33
+ <div css={sx?.mainContent} className={mainContentClasses}>
34
+ {children}
35
+ </div>
29
36
  </main>
30
37
  );
31
38
  };
@@ -4,7 +4,7 @@ import { CSSObject } from "@emotion/react";
4
4
  import { HugeiconsIcon } from "@hugeicons/react";
5
5
  import { CancelCircleIcon } from "@hugeicons/core-free-icons";
6
6
  import { Button } from "../Button/Button";
7
- import { cx } from "../../main";
7
+ import { cx } from "../../utils/cx";
8
8
 
9
9
  export type ModalProps = {
10
10
  isOpen: boolean;
@@ -0,0 +1,71 @@
1
+ import { CSSObject } from "@emotion/react";
2
+ import { HugeiconsIcon } from "@hugeicons/react";
3
+ import { CancelCircleIcon } from "@hugeicons/core-free-icons";
4
+ import { cx } from "../../utils/cx";
5
+ import { Button } from "../Button/Button";
6
+
7
+ export type SlideOutProps = {
8
+ children: React.ReactNode;
9
+ className?: {
10
+ slideOut?: string | false | null | undefined;
11
+ overlay?: string | false | null | undefined;
12
+ panel?: string | false | null | undefined;
13
+ closeButton?: string | false | null | undefined;
14
+ };
15
+ from?: "left" | "right";
16
+ isOpen?: boolean;
17
+ sx?: {
18
+ slideOut?: CSSObject;
19
+ overlay?: CSSObject;
20
+ panel?: CSSObject;
21
+ closeButton?: CSSObject;
22
+ };
23
+
24
+ onClose: () => void;
25
+ };
26
+
27
+ export const SlideOut = ({
28
+ children,
29
+ className,
30
+ from = "right",
31
+ isOpen = false,
32
+ sx,
33
+
34
+ onClose,
35
+ }: SlideOutProps) => {
36
+ const slideOutClasses = cx("ath-slide-out", className?.slideOut);
37
+ const overlayClasses = cx(
38
+ "ath-slide-out-overlay",
39
+ isOpen && "ath-slide-out-overlay-open",
40
+ className?.overlay,
41
+ );
42
+ const panelClasses = cx(
43
+ "ath-slide-out-panel",
44
+ from === "left" ? "ath-slide-out-from-left" : "ath-slide-out-from-right",
45
+ isOpen && "ath-slide-out-panel-open",
46
+ className?.panel,
47
+ );
48
+ const closeButtonClasses = cx(
49
+ "ath-slide-out-close-button",
50
+ className?.closeButton,
51
+ );
52
+
53
+ return (
54
+ <div className={slideOutClasses} css={sx?.slideOut} data-testid="slide-out">
55
+ <div className={overlayClasses} css={sx?.overlay} onClick={onClose} />
56
+ <div className={panelClasses} css={sx?.panel}>
57
+ <Button
58
+ className={{ button: closeButtonClasses }}
59
+ sx={{ button: sx?.closeButton }}
60
+ onClick={onClose}
61
+ aria-label="Close menu"
62
+ variant="ghost"
63
+ dark
64
+ size="medium"
65
+ icon={<HugeiconsIcon icon={CancelCircleIcon} size={24} />}
66
+ />
67
+ {children}
68
+ </div>
69
+ </div>
70
+ );
71
+ };
@@ -0,0 +1 @@
1
+ export * from "./SlideOut";
@@ -1,7 +1,10 @@
1
1
  export * from "./Accordion";
2
2
  export * from "./Avatar";
3
+ export * from "./Block";
3
4
  export * from "./Button";
4
5
  export * from "./ButtonGroup";
6
+ export * from "./Carousel";
7
+ export * from "./DropDown";
5
8
  export * from "./ContainerScalingText";
6
9
  export * from "./FormField";
7
10
  export * from "./FormLabel";
@@ -11,3 +14,4 @@ export * from "./Layout";
11
14
  export * from "./List";
12
15
  export * from "./Modal";
13
16
  export * from "./Search";
17
+ export * from "./SlideOut";