athameui 0.0.9-c → 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.
- package/components/Avatar/Avatar.tsx +0 -1
- package/components/Button/Button.tsx +14 -0
- package/components/Carousel/Carousel.tsx +84 -0
- package/components/Carousel/index.ts +1 -0
- package/components/DropDown/Dropdown.tsx +0 -1
- package/components/index.ts +1 -0
- package/dist/athameui.cjs +79 -4
- package/dist/athameui.cjs.map +1 -1
- package/dist/athameui.mjs +80 -6
- package/dist/athameui.mjs.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +14 -0
- package/dist/components/Carousel/Carousel.d.ts.map +1 -0
- package/dist/components/Carousel/index.d.ts +2 -0
- package/dist/components/Carousel/index.d.ts.map +1 -0
- package/dist/components/DropDown/Dropdown.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/styles/components/carousel.css +43 -0
- package/dist/styles/components/form-input.css +10 -1
- package/dist/styles/components/main.css +3 -1
- package/dist/styles/theme.css +1 -0
- package/dist/styles/tokens.css +6 -10
- package/package.json +1 -1
- package/styles/components/carousel.css +43 -0
- package/styles/components/form-input.css +10 -1
- package/styles/components/main.css +3 -1
- package/styles/theme.css +1 -0
- package/styles/tokens.css +6 -10
|
@@ -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";
|
package/components/index.ts
CHANGED
package/dist/athameui.cjs
CHANGED
|
@@ -2199,6 +2199,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2199
2199
|
onClick,
|
|
2200
2200
|
onFocus,
|
|
2201
2201
|
onKeyDown,
|
|
2202
|
+
onMouseEnter,
|
|
2203
|
+
onMouseLeave,
|
|
2202
2204
|
...other
|
|
2203
2205
|
}, ref) => {
|
|
2204
2206
|
const isIconOnly = icon && !children;
|
|
@@ -2216,6 +2218,12 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2216
2218
|
const onBlurHandler = e => {
|
|
2217
2219
|
onBlur?.(e);
|
|
2218
2220
|
};
|
|
2221
|
+
const onMouseEnterHandler = e => {
|
|
2222
|
+
onMouseEnter?.(e);
|
|
2223
|
+
};
|
|
2224
|
+
const onMouseLeaveHandler = e => {
|
|
2225
|
+
onMouseLeave?.(e);
|
|
2226
|
+
};
|
|
2219
2227
|
return jsx("button", {
|
|
2220
2228
|
ref: ref,
|
|
2221
2229
|
className: buttonClasses,
|
|
@@ -2227,6 +2235,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2227
2235
|
onKeyDown: onKeyDownHandler,
|
|
2228
2236
|
onFocus: onFocusHandler,
|
|
2229
2237
|
onBlur: onBlurHandler,
|
|
2238
|
+
onMouseEnter: onMouseEnterHandler,
|
|
2239
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
2230
2240
|
...other,
|
|
2231
2241
|
children: icon ? jsxs(Fragment, {
|
|
2232
2242
|
children: [icon, !isIconOnly && children]
|
|
@@ -2367,7 +2377,6 @@ const Avatar = ({
|
|
|
2367
2377
|
sx,
|
|
2368
2378
|
size = "medium"
|
|
2369
2379
|
}) => {
|
|
2370
|
-
console.log(className?.avatar);
|
|
2371
2380
|
const initials = displayName.split(" ").map(n => n[0].toUpperCase());
|
|
2372
2381
|
const avatarClasses = cx("ath-avatar", `ath-avatar-${size}`, className?.avatar);
|
|
2373
2382
|
const initialsClasses = cx(`ath-avatar-initials`, className?.initials);
|
|
@@ -2453,7 +2462,7 @@ const HugeiconsIcon = React.forwardRef(({ color = 'currentColor', size = 24, str
|
|
|
2453
2462
|
});
|
|
2454
2463
|
HugeiconsIcon.displayName = 'HugeiconsIcon';
|
|
2455
2464
|
|
|
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"}]];
|
|
2465
|
+
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
2466
|
|
|
2458
2467
|
const ScrollToTopButton = ({
|
|
2459
2468
|
className,
|
|
@@ -2571,6 +2580,71 @@ const ButtonGroup = ({
|
|
|
2571
2580
|
});
|
|
2572
2581
|
};
|
|
2573
2582
|
|
|
2583
|
+
const Carousel = ({
|
|
2584
|
+
children,
|
|
2585
|
+
className,
|
|
2586
|
+
emptyMessage,
|
|
2587
|
+
sx
|
|
2588
|
+
}) => {
|
|
2589
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
2590
|
+
const carouselRef = React.useRef(null);
|
|
2591
|
+
const carouselClasses = cx("ath-carousel", isHovered ? "ath-carousel-hover" : "", className?.carousel);
|
|
2592
|
+
const hasItems = React.Children.count(children) > 0;
|
|
2593
|
+
const scrollByPage = direction => {
|
|
2594
|
+
const el = carouselRef.current;
|
|
2595
|
+
if (!el) return;
|
|
2596
|
+
el.scrollBy({
|
|
2597
|
+
left: direction * el.clientWidth,
|
|
2598
|
+
behavior: "smooth"
|
|
2599
|
+
});
|
|
2600
|
+
};
|
|
2601
|
+
const handleLeftArrowClick = () => {
|
|
2602
|
+
scrollByPage(-1);
|
|
2603
|
+
};
|
|
2604
|
+
const handleRightArrowClick = () => {
|
|
2605
|
+
scrollByPage(1);
|
|
2606
|
+
};
|
|
2607
|
+
const handleMouseEnter = () => {
|
|
2608
|
+
setIsHovered(true);
|
|
2609
|
+
};
|
|
2610
|
+
const handleMouseLeave = () => {
|
|
2611
|
+
setIsHovered(false);
|
|
2612
|
+
};
|
|
2613
|
+
return jsx("div", {
|
|
2614
|
+
className: "ath-carousel-wrapper",
|
|
2615
|
+
children: jsxs("div", {
|
|
2616
|
+
className: carouselClasses,
|
|
2617
|
+
css: sx?.carousel,
|
|
2618
|
+
onMouseEnter: handleMouseEnter,
|
|
2619
|
+
onMouseLeave: handleMouseLeave,
|
|
2620
|
+
ref: carouselRef,
|
|
2621
|
+
children: [jsx(Button, {
|
|
2622
|
+
className: {
|
|
2623
|
+
button: "ath-carousel-arrow ath-carousel-left-arrow"
|
|
2624
|
+
},
|
|
2625
|
+
onClick: handleLeftArrowClick,
|
|
2626
|
+
onMouseEnter: handleMouseEnter,
|
|
2627
|
+
onMouseLeave: handleMouseLeave,
|
|
2628
|
+
icon: jsx(HugeiconsIcon, {
|
|
2629
|
+
icon: Qt,
|
|
2630
|
+
size: 36
|
|
2631
|
+
})
|
|
2632
|
+
}), hasItems ? children : emptyMessage, jsx(Button, {
|
|
2633
|
+
className: {
|
|
2634
|
+
button: "ath-carousel-arrow ath-carousel-right-arrow"
|
|
2635
|
+
},
|
|
2636
|
+
onClick: handleRightArrowClick,
|
|
2637
|
+
onMouseEnter: handleMouseEnter,
|
|
2638
|
+
onMouseLeave: handleMouseLeave,
|
|
2639
|
+
icon: jsx(HugeiconsIcon, {
|
|
2640
|
+
icon: un,
|
|
2641
|
+
size: 36
|
|
2642
|
+
})
|
|
2643
|
+
})]
|
|
2644
|
+
})
|
|
2645
|
+
});
|
|
2646
|
+
};
|
|
2647
|
+
|
|
2574
2648
|
const Dropdown = ({
|
|
2575
2649
|
children,
|
|
2576
2650
|
className,
|
|
@@ -2591,12 +2665,12 @@ const Dropdown = ({
|
|
|
2591
2665
|
document.removeEventListener("mousedown", handleOutsideClick);
|
|
2592
2666
|
};
|
|
2593
2667
|
}, [onClose]);
|
|
2594
|
-
return
|
|
2668
|
+
return jsx("div", {
|
|
2595
2669
|
ref: dropdownRef,
|
|
2596
2670
|
className: dropdownClasses,
|
|
2597
2671
|
css: sx?.dropdown,
|
|
2598
2672
|
"data-testid": "dropdown",
|
|
2599
|
-
children:
|
|
2673
|
+
children: children
|
|
2600
2674
|
});
|
|
2601
2675
|
};
|
|
2602
2676
|
|
|
@@ -3323,6 +3397,7 @@ exports.Avatar = Avatar;
|
|
|
3323
3397
|
exports.Block = Block;
|
|
3324
3398
|
exports.Button = Button;
|
|
3325
3399
|
exports.ButtonGroup = ButtonGroup;
|
|
3400
|
+
exports.Carousel = Carousel;
|
|
3326
3401
|
exports.ContainerScalingText = ContainerScalingText;
|
|
3327
3402
|
exports.Dropdown = Dropdown;
|
|
3328
3403
|
exports.Footer = Footer;
|