athameui 0.0.8 → 0.0.9-c

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/Avatar/Avatar.tsx +0 -1
  2. package/components/Block/Block.tsx +22 -0
  3. package/components/Block/index.ts +1 -0
  4. package/components/DropDown/Dropdown.tsx +61 -0
  5. package/components/DropDown/index.ts +1 -0
  6. package/components/Layout/Main.tsx +21 -14
  7. package/components/Modal/Modal.tsx +1 -1
  8. package/components/SlideOut/SlideOut.tsx +71 -0
  9. package/components/SlideOut/index.ts +1 -0
  10. package/components/index.ts +3 -0
  11. package/dist/athameui.cjs +123 -37
  12. package/dist/athameui.cjs.map +1 -1
  13. package/dist/athameui.mjs +121 -38
  14. package/dist/athameui.mjs.map +1 -1
  15. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  16. package/dist/components/Block/Block.d.ts +13 -0
  17. package/dist/components/Block/Block.d.ts.map +1 -0
  18. package/dist/components/Block/index.d.ts +2 -0
  19. package/dist/components/Block/index.d.ts.map +1 -0
  20. package/dist/components/DropDown/Dropdown.d.ts +14 -0
  21. package/dist/components/DropDown/Dropdown.d.ts.map +1 -0
  22. package/dist/components/DropDown/index.d.ts +2 -0
  23. package/dist/components/DropDown/index.d.ts.map +1 -0
  24. package/dist/components/Layout/Main.d.ts +7 -3
  25. package/dist/components/Layout/Main.d.ts.map +1 -1
  26. package/dist/components/SlideOut/SlideOut.d.ts +21 -0
  27. package/dist/components/SlideOut/SlideOut.d.ts.map +1 -0
  28. package/dist/components/SlideOut/index.d.ts +2 -0
  29. package/dist/components/SlideOut/index.d.ts.map +1 -0
  30. package/dist/components/index.d.ts +3 -0
  31. package/dist/components/index.d.ts.map +1 -1
  32. package/dist/styles/breakpoints.d.ts +13 -0
  33. package/dist/styles/breakpoints.d.ts.map +1 -0
  34. package/dist/styles/breakpoints.ts +13 -0
  35. package/dist/styles/components/accordion.css +8 -5
  36. package/dist/styles/components/block.css +8 -0
  37. package/dist/styles/components/button.css +1 -1
  38. package/dist/styles/components/dropdown.css +18 -0
  39. package/dist/styles/components/main.css +11 -2
  40. package/dist/styles/components/slide-out.css +69 -0
  41. package/dist/styles/index.d.ts +1 -1
  42. package/dist/styles/index.d.ts.map +1 -1
  43. package/dist/styles/index.ts +1 -1
  44. package/dist/styles/theme.css +3 -0
  45. package/dist/styles/tokens.css +45 -25
  46. package/dist/styles/tokens.d.ts +0 -10
  47. package/dist/styles/tokens.d.ts.map +1 -1
  48. package/dist/styles/tokens.ts +16 -26
  49. package/package.json +1 -1
  50. package/styles/breakpoints.ts +13 -0
  51. package/styles/components/accordion.css +8 -5
  52. package/styles/components/block.css +8 -0
  53. package/styles/components/button.css +1 -1
  54. package/styles/components/dropdown.css +18 -0
  55. package/styles/components/main.css +11 -2
  56. package/styles/components/slide-out.css +69 -0
  57. package/styles/index.ts +1 -1
  58. package/styles/theme.css +3 -0
  59. package/styles/tokens.css +45 -25
  60. package/styles/tokens.ts +16 -26
  61. package/dist/styles/mediaQueries.d.ts +0 -11
  62. package/dist/styles/mediaQueries.d.ts.map +0 -1
  63. package/dist/styles/mediaQueries.ts +0 -10
  64. 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
 
@@ -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";
@@ -0,0 +1,61 @@
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
+ fdpdsugfpoidsuy
58
+ {children}
59
+ </div>
60
+ );
61
+ };
@@ -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,9 @@
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 "./DropDown";
5
7
  export * from "./ContainerScalingText";
6
8
  export * from "./FormField";
7
9
  export * from "./FormLabel";
@@ -11,3 +13,4 @@ export * from "./Layout";
11
13
  export * from "./List";
12
14
  export * from "./Modal";
13
15
  export * from "./Search";
16
+ export * from "./SlideOut";
package/dist/athameui.cjs CHANGED
@@ -2383,6 +2383,20 @@ const Avatar = ({
2383
2383
  });
2384
2384
  };
2385
2385
 
2386
+ const Block = ({
2387
+ children,
2388
+ className,
2389
+ sx
2390
+ }) => {
2391
+ const blockClasses = cx("ath-block", className?.block);
2392
+ return jsx("div", {
2393
+ className: blockClasses,
2394
+ "data-testid": "block",
2395
+ css: sx?.block,
2396
+ children: children
2397
+ });
2398
+ };
2399
+
2386
2400
  const defaultAttributes = {
2387
2401
  xmlns: 'http://www.w3.org/2000/svg',
2388
2402
  width: 24,
@@ -2557,6 +2571,35 @@ const ButtonGroup = ({
2557
2571
  });
2558
2572
  };
2559
2573
 
2574
+ const Dropdown = ({
2575
+ children,
2576
+ className,
2577
+ isOpen,
2578
+ sx,
2579
+ onClose
2580
+ }) => {
2581
+ const dropdownRef = React.useRef(null);
2582
+ const dropdownClasses = cx("ath-dropdown", isOpen && "ath-dropdown-open", className?.dropdown);
2583
+ React.useEffect(() => {
2584
+ const handleOutsideClick = event => {
2585
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2586
+ onClose();
2587
+ }
2588
+ };
2589
+ document.addEventListener("mousedown", handleOutsideClick);
2590
+ return () => {
2591
+ document.removeEventListener("mousedown", handleOutsideClick);
2592
+ };
2593
+ }, [onClose]);
2594
+ return jsxs("div", {
2595
+ ref: dropdownRef,
2596
+ className: dropdownClasses,
2597
+ css: sx?.dropdown,
2598
+ "data-testid": "dropdown",
2599
+ children: ["fdpdsugfpoidsuy", children]
2600
+ });
2601
+ };
2602
+
2560
2603
  const FormLabel = ({
2561
2604
  label,
2562
2605
  required,
@@ -2768,11 +2811,16 @@ const Main = ({
2768
2811
  className,
2769
2812
  sx
2770
2813
  }) => {
2771
- const classes = cx("ath-main", typeof className === "object" && className !== null ? className.main : className);
2814
+ const mainClasses = cx("ath-main", typeof className === "object" && className !== null ? className.main : "");
2815
+ const mainContentClasses = cx("ath-main-content", typeof className === "object" && className !== null ? className.mainContent : "");
2772
2816
  return jsx("main", {
2773
- css: sx,
2774
- className: classes,
2775
- children: children
2817
+ css: sx?.main,
2818
+ className: mainClasses,
2819
+ children: jsx("div", {
2820
+ css: sx?.mainContent,
2821
+ className: mainContentClasses,
2822
+ children: children
2823
+ })
2776
2824
  });
2777
2825
  };
2778
2826
 
@@ -3044,15 +3092,59 @@ const Search = ({
3044
3092
  });
3045
3093
  };
3046
3094
 
3095
+ const SlideOut = ({
3096
+ children,
3097
+ className,
3098
+ from = "right",
3099
+ isOpen = false,
3100
+ sx,
3101
+ onClose
3102
+ }) => {
3103
+ const slideOutClasses = cx("ath-slide-out", className?.slideOut);
3104
+ const overlayClasses = cx("ath-slide-out-overlay", isOpen && "ath-slide-out-overlay-open", className?.overlay);
3105
+ 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);
3106
+ const closeButtonClasses = cx("ath-slide-out-close-button", className?.closeButton);
3107
+ return jsxs("div", {
3108
+ className: slideOutClasses,
3109
+ css: sx?.slideOut,
3110
+ "data-testid": "slide-out",
3111
+ children: [jsx("div", {
3112
+ className: overlayClasses,
3113
+ css: sx?.overlay,
3114
+ onClick: onClose
3115
+ }), jsxs("div", {
3116
+ className: panelClasses,
3117
+ css: sx?.panel,
3118
+ children: [jsx(Button, {
3119
+ className: {
3120
+ button: closeButtonClasses
3121
+ },
3122
+ sx: {
3123
+ button: sx?.closeButton
3124
+ },
3125
+ onClick: onClose,
3126
+ "aria-label": "Close menu",
3127
+ variant: "ghost",
3128
+ dark: true,
3129
+ size: "medium",
3130
+ icon: jsx(HugeiconsIcon, {
3131
+ icon: uL,
3132
+ size: 24
3133
+ })
3134
+ }), children]
3135
+ })]
3136
+ });
3137
+ };
3138
+
3047
3139
  const breakpoints = {
3048
- xs: "360px",
3049
- sm: "480px",
3050
- md: "640px",
3051
- lg: "768px",
3052
- xl: "896px",
3053
- "2xl": "1024px",
3054
- "3xl": "1280px",
3055
- "4xl": "1536px"
3140
+ xs: 320,
3141
+ sm: 480,
3142
+ md: 620,
3143
+ lg: 768,
3144
+ xl: 896,
3145
+ "2xl": 1024,
3146
+ "3xl": 1280,
3147
+ "4xl": 1536
3056
3148
  };
3057
3149
 
3058
3150
  const tokens = {
@@ -3062,15 +3154,15 @@ const tokens = {
3062
3154
  serif: "Libre Baskerville, serif"
3063
3155
  },
3064
3156
  size: {
3065
- xs: "0.625rem",
3066
- sm: "0.75rem",
3067
- md: "0.875rem",
3068
- lg: "1rem",
3069
- xl: "1.25rem",
3070
- "2xl": "1.5rem",
3071
- "3xl": "2rem",
3072
- "4xl": "2.5rem",
3073
- "5xl": "3rem"
3157
+ xs: "0.75rem",
3158
+ sm: "0.875rem",
3159
+ md: "1rem",
3160
+ lg: "1.25rem",
3161
+ xl: "1.5rem",
3162
+ "2xl": "2rem",
3163
+ "3xl": "2.5rem",
3164
+ "4xl": "3rem",
3165
+ "5xl": "3.5rem"
3074
3166
  }
3075
3167
  },
3076
3168
  color: {
@@ -3203,27 +3295,18 @@ const tokens = {
3203
3295
  md: "5px",
3204
3296
  lg: "8px"
3205
3297
  },
3206
- screen: {
3207
- xs: "360px",
3208
- sm: "480px",
3209
- md: "768px",
3210
- lg: "896px",
3211
- xl: "1024px",
3212
- "2xl": "1280px",
3213
- "3xl": "1536px"
3214
- },
3215
3298
  media: {
3216
3299
  min: {
3217
- xs: "@media (min-width: 360px)",
3300
+ xs: "@media (min-width: 320px)",
3218
3301
  sm: "@media (min-width: 480px)",
3219
- md: "@media (min-width: 768px)",
3220
- lg: "@media (min-width: 896px)",
3221
- xl: "@media (min-width: 1024px)",
3222
- "2xl": "@media (min-width: 1280px)",
3223
- "3xl": "@media (min-width: 1536px)"
3302
+ md: "@media (min-width: 620px)",
3303
+ lg: "@media (min-width: 768px)",
3304
+ xl: "@media (min-width: 896px)",
3305
+ "2xl": "@media (min-width: 1024px)",
3306
+ "3xl": "@media (min-width: 1280px)"
3224
3307
  },
3225
3308
  max: {
3226
- xs: "@media (max-width: 359px)",
3309
+ xs: "@media (max-width: 319px)",
3227
3310
  sm: "@media (max-width: 479px)",
3228
3311
  md: "@media (max-width: 767px)",
3229
3312
  lg: "@media (max-width: 895px)",
@@ -3237,9 +3320,11 @@ const tokens = {
3237
3320
  exports.Accordion = Accordion;
3238
3321
  exports.AccordionItem = AccordionItem;
3239
3322
  exports.Avatar = Avatar;
3323
+ exports.Block = Block;
3240
3324
  exports.Button = Button;
3241
3325
  exports.ButtonGroup = ButtonGroup;
3242
3326
  exports.ContainerScalingText = ContainerScalingText;
3327
+ exports.Dropdown = Dropdown;
3243
3328
  exports.Footer = Footer;
3244
3329
  exports.FormField = FormField;
3245
3330
  exports.FormLabel = FormLabel;
@@ -3251,6 +3336,7 @@ exports.Main = Main;
3251
3336
  exports.Modal = Modal;
3252
3337
  exports.ScrollToTopButton = ScrollToTopButton;
3253
3338
  exports.Search = Search;
3339
+ exports.SlideOut = SlideOut;
3254
3340
  exports.breakpoints = breakpoints;
3255
3341
  exports.cx = cx;
3256
3342
  exports.tokens = tokens;