@n3wth/ui 0.7.0 → 0.9.0
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/atoms/AnimatedText/AnimatedText.js +65 -0
- package/dist/atoms/AnimatedText/AnimatedText.js.map +1 -0
- package/dist/atoms/Avatar/Avatar.js +55 -0
- package/dist/atoms/Avatar/Avatar.js.map +1 -0
- package/dist/atoms/Badge/Badge.js +57 -0
- package/dist/atoms/Badge/Badge.js.map +1 -0
- package/dist/atoms/Button/Button.js +92 -0
- package/dist/atoms/Button/Button.js.map +1 -0
- package/dist/atoms/Character/Character.js +155 -0
- package/dist/atoms/Character/Character.js.map +1 -0
- package/dist/atoms/CodeBlock/CodeBlock.js +75 -0
- package/dist/atoms/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/atoms/HamburgerIcon/HamburgerIcon.js +50 -0
- package/dist/atoms/HamburgerIcon/HamburgerIcon.js.map +1 -0
- package/dist/atoms/Icon/Icon.js +199 -0
- package/dist/atoms/Icon/Icon.js.map +1 -0
- package/dist/atoms/Input/Input.js +80 -0
- package/dist/atoms/Input/Input.js.map +1 -0
- package/dist/atoms/Label/Label.js +32 -0
- package/dist/atoms/Label/Label.js.map +1 -0
- package/dist/atoms/NoiseOverlay/NoiseOverlay.js +32 -0
- package/dist/atoms/NoiseOverlay/NoiseOverlay.js.map +1 -0
- package/dist/atoms/Progress/Progress.js +63 -0
- package/dist/atoms/Progress/Progress.js.map +1 -0
- package/dist/atoms/ScrollIndicator/ScrollIndicator.js +51 -0
- package/dist/atoms/ScrollIndicator/ScrollIndicator.js.map +1 -0
- package/dist/atoms/Separator/Separator.js +28 -0
- package/dist/atoms/Separator/Separator.js.map +1 -0
- package/dist/atoms/Shape/Shape.js +110 -0
- package/dist/atoms/Shape/Shape.js.map +1 -0
- package/dist/atoms/Shape/patterns.js +66 -0
- package/dist/atoms/Shape/patterns.js.map +1 -0
- package/dist/atoms/Skeleton/Skeleton.js +77 -0
- package/dist/atoms/Skeleton/Skeleton.js.map +1 -0
- package/dist/atoms/SpeechBubble/SpeechBubble.js +98 -0
- package/dist/atoms/SpeechBubble/SpeechBubble.js.map +1 -0
- package/dist/atoms/Switch/Switch.js +78 -0
- package/dist/atoms/Switch/Switch.js.map +1 -0
- package/dist/atoms/Textarea/Textarea.js +40 -0
- package/dist/atoms/Textarea/Textarea.js.map +1 -0
- package/dist/atoms/Tooltip/Tooltip.js +153 -0
- package/dist/atoms/Tooltip/Tooltip.js.map +1 -0
- package/dist/hooks/useButtonPulse.js +43 -0
- package/dist/hooks/useButtonPulse.js.map +1 -0
- package/dist/hooks/useCountUp.js +52 -0
- package/dist/hooks/useCountUp.js.map +1 -0
- package/dist/hooks/useKeyboardShortcuts.js +37 -0
- package/dist/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/hooks/useMediaQuery.js +59 -0
- package/dist/hooks/useMediaQuery.js.map +1 -0
- package/dist/hooks/usePageTransition.js +39 -0
- package/dist/hooks/usePageTransition.js.map +1 -0
- package/dist/hooks/useReducedMotion.js +57 -0
- package/dist/hooks/useReducedMotion.js.map +1 -0
- package/dist/hooks/useScrollReveal.js +61 -0
- package/dist/hooks/useScrollReveal.js.map +1 -0
- package/dist/hooks/useStaggerList.js +54 -0
- package/dist/hooks/useStaggerList.js.map +1 -0
- package/dist/hooks/useTextReveal.js +59 -0
- package/dist/hooks/useTextReveal.js.map +1 -0
- package/dist/hooks/useTheme.js +37 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/hooks/useToast.js +84 -0
- package/dist/hooks/useToast.js.map +1 -0
- package/dist/index.js +147 -7925
- package/dist/index.js.map +1 -1
- package/dist/molecules/Accordion/Accordion.js +178 -0
- package/dist/molecules/Accordion/Accordion.js.map +1 -0
- package/dist/molecules/Card/Card.js +104 -0
- package/dist/molecules/Card/Card.js.map +1 -0
- package/dist/molecules/CommandBox/CommandBox.js +65 -0
- package/dist/molecules/CommandBox/CommandBox.js.map +1 -0
- package/dist/molecules/CompositeShape/CompositeShape.js +69 -0
- package/dist/molecules/CompositeShape/CompositeShape.js.map +1 -0
- package/dist/molecules/CompositeShape/presets.js +71 -0
- package/dist/molecules/CompositeShape/presets.js.map +1 -0
- package/dist/molecules/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/molecules/Dropdown/Dropdown.js +530 -0
- package/dist/molecules/Dropdown/Dropdown.js.map +1 -0
- package/dist/molecules/ErrorBoundary/ErrorBoundary.js +128 -0
- package/dist/molecules/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/dist/molecules/MobileDrawer/MobileDrawer.js +78 -0
- package/dist/molecules/MobileDrawer/MobileDrawer.js.map +1 -0
- package/dist/molecules/Modal/Modal.js +262 -0
- package/dist/molecules/Modal/Modal.js.map +1 -0
- package/dist/molecules/NavLink/NavLink.js +38 -0
- package/dist/molecules/NavLink/NavLink.js.map +1 -0
- package/dist/molecules/Tabs/Tabs.js +188 -0
- package/dist/molecules/Tabs/Tabs.js.map +1 -0
- package/dist/molecules/ThemeToggle/ThemeToggle.js +48 -0
- package/dist/molecules/ThemeToggle/ThemeToggle.js.map +1 -0
- package/dist/molecules/Toast/Toast.js +156 -0
- package/dist/molecules/Toast/Toast.js.map +1 -0
- package/dist/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/IconoirContext.js +6 -0
- package/dist/node_modules/iconoir-react/dist/esm/IconoirContext.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowDown.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowDown.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowLeft.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowLeft.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowRight.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowRight.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowUp.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowUp.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowUpRight.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ArrowUpRight.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Bell.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Bell.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Calendar.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Calendar.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Check.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Check.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/CheckCircle.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/CheckCircle.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Clock.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Clock.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Code.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Code.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Copy.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Copy.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Download.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Download.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/EditPencil.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/EditPencil.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Eye.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Eye.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/EyeClosed.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/EyeClosed.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Filter.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Filter.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Folder.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Folder.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Github.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Github.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/HalfMoon.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/HalfMoon.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Heart.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Heart.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Home.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Home.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/InfoCircle.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/InfoCircle.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Link.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Link.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/List.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/List.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Lock.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Lock.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/LockSlash.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/LockSlash.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Mail.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Mail.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Menu.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Menu.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Minus.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Minus.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/MoreHoriz.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/MoreHoriz.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/MoreVert.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/MoreVert.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowDown.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowDown.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowLeft.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowLeft.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowRight.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowRight.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowUp.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/NavArrowUp.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/OpenInWindow.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/OpenInWindow.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Page.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Page.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Plus.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Plus.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/RefreshDouble.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/RefreshDouble.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Search.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Search.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Settings.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Settings.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/SortDown.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/SortDown.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Sparks.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Sparks.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Star.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Star.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/SunLight.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/SunLight.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Terminal.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Terminal.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Trash.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Trash.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Upload.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Upload.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/User.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/User.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ViewGrid.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/ViewGrid.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/WarningTriangle.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/WarningTriangle.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Xmark.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/Xmark.js.map +1 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/XmarkCircle.js +17 -0
- package/dist/node_modules/iconoir-react/dist/esm/regular/XmarkCircle.js.map +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2996 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
- package/dist/organisms/Footer/Footer.js +108 -0
- package/dist/organisms/Footer/Footer.js.map +1 -0
- package/dist/organisms/Hero/Hero.d.ts.map +1 -1
- package/dist/organisms/Hero/Hero.js +101 -0
- package/dist/organisms/Hero/Hero.js.map +1 -0
- package/dist/organisms/Nav/Nav.js +177 -0
- package/dist/organisms/Nav/Nav.js.map +1 -0
- package/dist/organisms/Section/Section.js +57 -0
- package/dist/organisms/Section/Section.js.map +1 -0
- package/dist/theme.css +86 -0
- package/dist/tokens/colors.js +105 -0
- package/dist/tokens/colors.js.map +1 -0
- package/dist/tokens/effects.js +26 -0
- package/dist/tokens/effects.js.map +1 -0
- package/dist/tokens/motion.js +25 -0
- package/dist/tokens/motion.js.map +1 -0
- package/dist/tokens/spacing.js +31 -0
- package/dist/tokens/spacing.js.map +1 -0
- package/dist/tokens/typography.js +63 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/utils/cn.js +9 -0
- package/dist/utils/cn.js.map +1 -0
- package/package.json +8 -5
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsxs as S, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { cn as Z } from "../../utils/cn.js";
|
|
3
|
+
import { generatePattern as $ } from "./patterns.js";
|
|
4
|
+
function j(r) {
|
|
5
|
+
switch (r) {
|
|
6
|
+
case "circle":
|
|
7
|
+
return "";
|
|
8
|
+
case "square":
|
|
9
|
+
return "";
|
|
10
|
+
case "triangle":
|
|
11
|
+
return "M12 2L22 20H2L12 2Z";
|
|
12
|
+
case "diamond":
|
|
13
|
+
return "M12 1L23 12L12 23L1 12L12 1Z";
|
|
14
|
+
case "hexagon":
|
|
15
|
+
return "M12 2L21.5 7V17L12 22L2.5 17V7L12 2Z";
|
|
16
|
+
case "semicircle":
|
|
17
|
+
return "M2 12A10 10 0 0 1 22 12Z";
|
|
18
|
+
case "arc":
|
|
19
|
+
return "M4 20A12 12 0 0 1 20 20";
|
|
20
|
+
case "pill":
|
|
21
|
+
return "";
|
|
22
|
+
case "star":
|
|
23
|
+
return "M12 2L14.5 8.5L21.5 9L16.5 13.5L18 21L12 17L6 21L7.5 13.5L2.5 9L9.5 8.5L12 2Z";
|
|
24
|
+
default:
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function i(r) {
|
|
29
|
+
return typeof r == "object" && r !== null && ("base" in r || "sm" in r || "md" in r || "lg" in r);
|
|
30
|
+
}
|
|
31
|
+
function H({
|
|
32
|
+
type: r,
|
|
33
|
+
size: e = 48,
|
|
34
|
+
color: p = "currentColor",
|
|
35
|
+
pattern: u = "solid",
|
|
36
|
+
patternColors: h,
|
|
37
|
+
patternScale: f = 1,
|
|
38
|
+
patternAngle: m = 45,
|
|
39
|
+
rotation: d = 0,
|
|
40
|
+
opacity: L = 1,
|
|
41
|
+
className: g,
|
|
42
|
+
style: x,
|
|
43
|
+
"aria-hidden": b = !0
|
|
44
|
+
}) {
|
|
45
|
+
let t;
|
|
46
|
+
i(e) ? t = e.base ?? e.sm ?? e.md ?? e.lg ?? 48 : t = e;
|
|
47
|
+
const y = typeof t == "number" ? t : t.width, v = typeof t == "number" ? t : t.height, a = {};
|
|
48
|
+
if (i(e)) {
|
|
49
|
+
const n = (l) => {
|
|
50
|
+
if (l)
|
|
51
|
+
return typeof l == "number" ? l : l.width;
|
|
52
|
+
};
|
|
53
|
+
e.base && (a["--shape-size-base"] = `${n(e.base)}px`), e.sm && (a["--shape-size-sm"] = `${n(e.sm)}px`), e.md && (a["--shape-size-md"] = `${n(e.md)}px`), e.lg && (a["--shape-size-lg"] = `${n(e.lg)}px`);
|
|
54
|
+
}
|
|
55
|
+
const o = u !== "solid" && h ? $({
|
|
56
|
+
type: u,
|
|
57
|
+
colors: h,
|
|
58
|
+
scale: f,
|
|
59
|
+
angle: m
|
|
60
|
+
}) : null, c = o?.fill ?? p, w = () => {
|
|
61
|
+
switch (r) {
|
|
62
|
+
case "circle":
|
|
63
|
+
return /* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "10", fill: c });
|
|
64
|
+
case "square":
|
|
65
|
+
return /* @__PURE__ */ s("rect", { x: "2", y: "2", width: "20", height: "20", rx: "2", fill: c });
|
|
66
|
+
case "pill":
|
|
67
|
+
return /* @__PURE__ */ s("rect", { x: "2", y: "6", width: "20", height: "12", rx: "6", fill: c });
|
|
68
|
+
case "arc":
|
|
69
|
+
return /* @__PURE__ */ s(
|
|
70
|
+
"path",
|
|
71
|
+
{
|
|
72
|
+
d: "M4 20A12 12 0 0 1 20 20",
|
|
73
|
+
fill: "none",
|
|
74
|
+
stroke: c,
|
|
75
|
+
strokeWidth: "4",
|
|
76
|
+
strokeLinecap: "round"
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
default: {
|
|
80
|
+
const n = j(r);
|
|
81
|
+
return n ? /* @__PURE__ */ s("path", { d: n, fill: c }) : null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, M = i(e) ? "shape-responsive" : "";
|
|
85
|
+
return /* @__PURE__ */ S(
|
|
86
|
+
"svg",
|
|
87
|
+
{
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
width: y,
|
|
90
|
+
height: v,
|
|
91
|
+
className: Z("shape", M, g),
|
|
92
|
+
style: {
|
|
93
|
+
transform: d ? `rotate(${d}deg)` : void 0,
|
|
94
|
+
opacity: L,
|
|
95
|
+
...a,
|
|
96
|
+
...x
|
|
97
|
+
},
|
|
98
|
+
"aria-hidden": b,
|
|
99
|
+
focusable: "false",
|
|
100
|
+
children: [
|
|
101
|
+
o && /* @__PURE__ */ s("defs", { dangerouslySetInnerHTML: { __html: o.defs } }),
|
|
102
|
+
w()
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
H as Shape
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=Shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shape.js","sources":["../../../src/atoms/Shape/Shape.tsx"],"sourcesContent":["import { cn } from '../../utils/cn'\nimport { generatePattern, PatternType } from './patterns'\n\nexport type ShapeType =\n | 'circle'\n | 'square'\n | 'triangle'\n | 'diamond'\n | 'hexagon'\n | 'semicircle'\n | 'arc'\n | 'pill'\n | 'star'\n\nexport type ResponsiveSize = {\n base?: number | { width: number; height: number }\n sm?: number | { width: number; height: number }\n md?: number | { width: number; height: number }\n lg?: number | { width: number; height: number }\n}\n\nexport interface ShapeProps {\n type: ShapeType\n /**\n * Size of the shape. Can be:\n * - A number (same width/height)\n * - An object { width, height }\n * - A responsive object { base, sm, md, lg }\n */\n size?: number | { width: number; height: number } | ResponsiveSize\n color?: string\n pattern?: PatternType\n patternColors?: string[]\n patternScale?: number\n patternAngle?: number\n rotation?: number\n opacity?: number\n className?: string\n style?: React.CSSProperties\n /** Disable animations when user prefers reduced motion (handled via CSS) */\n 'aria-hidden'?: boolean\n}\n\nfunction getShapePath(type: ShapeType): string {\n switch (type) {\n case 'circle':\n return ''\n case 'square':\n return ''\n case 'triangle':\n return 'M12 2L22 20H2L12 2Z'\n case 'diamond':\n return 'M12 1L23 12L12 23L1 12L12 1Z'\n case 'hexagon':\n return 'M12 2L21.5 7V17L12 22L2.5 17V7L12 2Z'\n case 'semicircle':\n return 'M2 12A10 10 0 0 1 22 12Z'\n case 'arc':\n return 'M4 20A12 12 0 0 1 20 20'\n case 'pill':\n return ''\n case 'star':\n return 'M12 2L14.5 8.5L21.5 9L16.5 13.5L18 21L12 17L6 21L7.5 13.5L2.5 9L9.5 8.5L12 2Z'\n default:\n return ''\n }\n}\n\n// Check if size is a responsive object\nfunction isResponsiveSize(size: ShapeProps['size']): size is ResponsiveSize {\n return (\n typeof size === 'object' &&\n size !== null &&\n ('base' in size || 'sm' in size || 'md' in size || 'lg' in size)\n )\n}\n\nexport function Shape({\n type,\n size = 48,\n color = 'currentColor',\n pattern = 'solid',\n patternColors,\n patternScale = 1,\n patternAngle = 45,\n rotation = 0,\n opacity = 1,\n className,\n style,\n 'aria-hidden': ariaHidden = true,\n}: ShapeProps) {\n // Handle responsive sizes by computing base size\n // CSS custom properties will handle the responsive scaling\n let computedSize: number | { width: number; height: number }\n\n if (isResponsiveSize(size)) {\n // Use base size or fallback to first defined breakpoint\n computedSize = size.base ?? size.sm ?? size.md ?? size.lg ?? 48\n } else {\n computedSize = size\n }\n\n const width = typeof computedSize === 'number' ? computedSize : computedSize.width\n const height = typeof computedSize === 'number' ? computedSize : computedSize.height\n\n // Generate responsive CSS custom properties\n const responsiveStyles: Record<string, string> = {}\n if (isResponsiveSize(size)) {\n const getSize = (s: number | { width: number; height: number } | undefined) => {\n if (!s) return undefined\n return typeof s === 'number' ? s : s.width\n }\n\n if (size.base) responsiveStyles['--shape-size-base'] = `${getSize(size.base)}px`\n if (size.sm) responsiveStyles['--shape-size-sm'] = `${getSize(size.sm)}px`\n if (size.md) responsiveStyles['--shape-size-md'] = `${getSize(size.md)}px`\n if (size.lg) responsiveStyles['--shape-size-lg'] = `${getSize(size.lg)}px`\n }\n\n const patternResult =\n pattern !== 'solid' && patternColors\n ? generatePattern({\n type: pattern,\n colors: patternColors,\n scale: patternScale,\n angle: patternAngle,\n })\n : null\n\n const fill = patternResult?.fill ?? color\n\n const renderShape = () => {\n switch (type) {\n case 'circle':\n return <circle cx=\"12\" cy=\"12\" r=\"10\" fill={fill} />\n case 'square':\n return <rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"2\" fill={fill} />\n case 'pill':\n return <rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"6\" fill={fill} />\n case 'arc':\n return (\n <path\n d=\"M4 20A12 12 0 0 1 20 20\"\n fill=\"none\"\n stroke={fill}\n strokeWidth=\"4\"\n strokeLinecap=\"round\"\n />\n )\n default: {\n const path = getShapePath(type)\n return path ? <path d={path} fill={fill} /> : null\n }\n }\n }\n\n // Determine if we need responsive class\n const responsiveClass = isResponsiveSize(size) ? 'shape-responsive' : ''\n\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width={width}\n height={height}\n className={cn('shape', responsiveClass, className)}\n style={{\n transform: rotation ? `rotate(${rotation}deg)` : undefined,\n opacity,\n ...responsiveStyles,\n ...style,\n }}\n aria-hidden={ariaHidden}\n focusable=\"false\"\n >\n {patternResult && (\n <defs dangerouslySetInnerHTML={{ __html: patternResult.defs }} />\n )}\n {renderShape()}\n </svg>\n )\n}\n"],"names":["getShapePath","type","isResponsiveSize","size","Shape","color","pattern","patternColors","patternScale","patternAngle","rotation","opacity","className","style","ariaHidden","computedSize","width","height","responsiveStyles","getSize","s","patternResult","generatePattern","fill","renderShape","jsx","path","responsiveClass","jsxs","cn"],"mappings":"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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
let h = 0;
|
|
2
|
+
function d() {
|
|
3
|
+
return `pattern-${++h}-${Date.now()}`;
|
|
4
|
+
}
|
|
5
|
+
function c(e, r, n = 1) {
|
|
6
|
+
const i = 10 * n, t = i / 2;
|
|
7
|
+
return `
|
|
8
|
+
<pattern id="${e}" patternUnits="userSpaceOnUse" width="${i}" height="${i}">
|
|
9
|
+
<rect width="${t}" height="${t}" fill="${r[0]}"/>
|
|
10
|
+
<rect x="${t}" y="${t}" width="${t}" height="${t}" fill="${r[0]}"/>
|
|
11
|
+
<rect x="${t}" width="${t}" height="${t}" fill="${r[1]}"/>
|
|
12
|
+
<rect y="${t}" width="${t}" height="${t}" fill="${r[1]}"/>
|
|
13
|
+
</pattern>
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
function u(e, r, n = 1, i = 45) {
|
|
17
|
+
const t = 4 * n, $ = t * r.length, l = r.map(
|
|
18
|
+
(a, s) => `<rect x="${s * t}" width="${t}" height="${$}" fill="${a}"/>`
|
|
19
|
+
).join("");
|
|
20
|
+
return `
|
|
21
|
+
<pattern id="${e}" patternUnits="userSpaceOnUse" width="${$}" height="${$}" patternTransform="rotate(${i})">
|
|
22
|
+
${l}
|
|
23
|
+
</pattern>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
function p(e, r, n, i = 1) {
|
|
27
|
+
const t = 8 * i, $ = 1.5 * i;
|
|
28
|
+
return `
|
|
29
|
+
<pattern id="${e}" patternUnits="userSpaceOnUse" width="${t}" height="${t}">
|
|
30
|
+
<rect width="${t}" height="${t}" fill="${r}"/>
|
|
31
|
+
<circle cx="${t / 2}" cy="${t / 2}" r="${$}" fill="${n}"/>
|
|
32
|
+
</pattern>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
function o(e) {
|
|
36
|
+
if (e.type === "solid" || e.colors.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
const r = d(), n = e.scale ?? 1;
|
|
39
|
+
switch (e.type) {
|
|
40
|
+
case "checkered":
|
|
41
|
+
return {
|
|
42
|
+
defs: c(r, [e.colors[0], e.colors[1] || e.colors[0]], n),
|
|
43
|
+
fill: `url(#${r})`
|
|
44
|
+
};
|
|
45
|
+
case "striped":
|
|
46
|
+
return {
|
|
47
|
+
defs: u(r, e.colors, n, e.angle ?? 45),
|
|
48
|
+
fill: `url(#${r})`
|
|
49
|
+
};
|
|
50
|
+
case "dotted":
|
|
51
|
+
return {
|
|
52
|
+
defs: p(r, e.colors[0], e.colors[1] || "#fff", n),
|
|
53
|
+
fill: `url(#${r})`
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
c as generateCheckeredPattern,
|
|
61
|
+
p as generateDottedPattern,
|
|
62
|
+
o as generatePattern,
|
|
63
|
+
d as generatePatternId,
|
|
64
|
+
u as generateStripedPattern
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.js","sources":["../../../src/atoms/Shape/patterns.ts"],"sourcesContent":["/**\n * SVG pattern generators for shapes\n * Returns pattern definition and pattern ID for use in fills\n */\n\nexport type PatternType = 'solid' | 'checkered' | 'striped' | 'dotted'\n\nexport interface PatternConfig {\n type: PatternType\n colors: string[]\n scale?: number\n angle?: number\n}\n\nlet patternCounter = 0\n\nexport function generatePatternId(): string {\n return `pattern-${++patternCounter}-${Date.now()}`\n}\n\nexport function generateCheckeredPattern(\n id: string,\n colors: [string, string],\n scale: number = 1\n): string {\n const size = 10 * scale\n const half = size / 2\n return `\n <pattern id=\"${id}\" patternUnits=\"userSpaceOnUse\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${half}\" height=\"${half}\" fill=\"${colors[0]}\"/>\n <rect x=\"${half}\" y=\"${half}\" width=\"${half}\" height=\"${half}\" fill=\"${colors[0]}\"/>\n <rect x=\"${half}\" width=\"${half}\" height=\"${half}\" fill=\"${colors[1]}\"/>\n <rect y=\"${half}\" width=\"${half}\" height=\"${half}\" fill=\"${colors[1]}\"/>\n </pattern>\n `\n}\n\nexport function generateStripedPattern(\n id: string,\n colors: string[],\n scale: number = 1,\n angle: number = 45\n): string {\n const stripeWidth = 4 * scale\n const totalWidth = stripeWidth * colors.length\n const stripes = colors\n .map(\n (color, i) =>\n `<rect x=\"${i * stripeWidth}\" width=\"${stripeWidth}\" height=\"${totalWidth}\" fill=\"${color}\"/>`\n )\n .join('')\n return `\n <pattern id=\"${id}\" patternUnits=\"userSpaceOnUse\" width=\"${totalWidth}\" height=\"${totalWidth}\" patternTransform=\"rotate(${angle})\">\n ${stripes}\n </pattern>\n `\n}\n\nexport function generateDottedPattern(\n id: string,\n bgColor: string,\n dotColor: string,\n scale: number = 1\n): string {\n const size = 8 * scale\n const radius = 1.5 * scale\n return `\n <pattern id=\"${id}\" patternUnits=\"userSpaceOnUse\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${size}\" height=\"${size}\" fill=\"${bgColor}\"/>\n <circle cx=\"${size / 2}\" cy=\"${size / 2}\" r=\"${radius}\" fill=\"${dotColor}\"/>\n </pattern>\n `\n}\n\nexport function generatePattern(config: PatternConfig): { defs: string; fill: string } | null {\n if (config.type === 'solid' || config.colors.length === 0) {\n return null\n }\n\n const id = generatePatternId()\n const scale = config.scale ?? 1\n\n switch (config.type) {\n case 'checkered':\n return {\n defs: generateCheckeredPattern(id, [config.colors[0], config.colors[1] || config.colors[0]], scale),\n fill: `url(#${id})`,\n }\n case 'striped':\n return {\n defs: generateStripedPattern(id, config.colors, scale, config.angle ?? 45),\n fill: `url(#${id})`,\n }\n case 'dotted':\n return {\n defs: generateDottedPattern(id, config.colors[0], config.colors[1] || '#fff', scale),\n fill: `url(#${id})`,\n }\n default:\n return null\n }\n}\n"],"names":["patternCounter","generatePatternId","generateCheckeredPattern","id","colors","scale","size","half","generateStripedPattern","angle","stripeWidth","totalWidth","stripes","color","i","generateDottedPattern","bgColor","dotColor","radius","generatePattern","config"],"mappings":"AAcA,IAAIA,IAAiB;AAEd,SAASC,IAA4B;AAC1C,SAAO,WAAW,EAAED,CAAc,IAAI,KAAK,KAAK;AAClD;AAEO,SAASE,EACdC,GACAC,GACAC,IAAgB,GACR;AACR,QAAMC,IAAO,KAAKD,GACZE,IAAOD,IAAO;AACpB,SAAO;AAAA,mBACUH,CAAE,0CAA0CG,CAAI,aAAaA,CAAI;AAAA,qBAC/DC,CAAI,aAAaA,CAAI,WAAWH,EAAO,CAAC,CAAC;AAAA,iBAC7CG,CAAI,QAAQA,CAAI,YAAYA,CAAI,aAAaA,CAAI,WAAWH,EAAO,CAAC,CAAC;AAAA,iBACrEG,CAAI,YAAYA,CAAI,aAAaA,CAAI,WAAWH,EAAO,CAAC,CAAC;AAAA,iBACzDG,CAAI,YAAYA,CAAI,aAAaA,CAAI,WAAWH,EAAO,CAAC,CAAC;AAAA;AAAA;AAG1E;AAEO,SAASI,EACdL,GACAC,GACAC,IAAgB,GAChBI,IAAgB,IACR;AACR,QAAMC,IAAc,IAAIL,GAClBM,IAAaD,IAAcN,EAAO,QAClCQ,IAAUR,EACb;AAAA,IACC,CAACS,GAAOC,MACN,YAAYA,IAAIJ,CAAW,YAAYA,CAAW,aAAaC,CAAU,WAAWE,CAAK;AAAA,EAAA,EAE5F,KAAK,EAAE;AACV,SAAO;AAAA,mBACUV,CAAE,0CAA0CQ,CAAU,aAAaA,CAAU,8BAA8BF,CAAK;AAAA,QAC3HG,CAAO;AAAA;AAAA;AAGf;AAEO,SAASG,EACdZ,GACAa,GACAC,GACAZ,IAAgB,GACR;AACR,QAAMC,IAAO,IAAID,GACXa,IAAS,MAAMb;AACrB,SAAO;AAAA,mBACUF,CAAE,0CAA0CG,CAAI,aAAaA,CAAI;AAAA,qBAC/DA,CAAI,aAAaA,CAAI,WAAWU,CAAO;AAAA,oBACxCV,IAAO,CAAC,SAASA,IAAO,CAAC,QAAQY,CAAM,WAAWD,CAAQ;AAAA;AAAA;AAG9E;AAEO,SAASE,EAAgBC,GAA8D;AAC5F,MAAIA,EAAO,SAAS,WAAWA,EAAO,OAAO,WAAW;AACtD,WAAO;AAGT,QAAMjB,IAAKF,EAAA,GACLI,IAAQe,EAAO,SAAS;AAE9B,UAAQA,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,MAAMlB,EAAyBC,GAAI,CAACiB,EAAO,OAAO,CAAC,GAAGA,EAAO,OAAO,CAAC,KAAKA,EAAO,OAAO,CAAC,CAAC,GAAGf,CAAK;AAAA,QAClG,MAAM,QAAQF,CAAE;AAAA,MAAA;AAAA,IAEpB,KAAK;AACH,aAAO;AAAA,QACL,MAAMK,EAAuBL,GAAIiB,EAAO,QAAQf,GAAOe,EAAO,SAAS,EAAE;AAAA,QACzE,MAAM,QAAQjB,CAAE;AAAA,MAAA;AAAA,IAEpB,KAAK;AACH,aAAO;AAAA,QACL,MAAMY,EAAsBZ,GAAIiB,EAAO,OAAO,CAAC,GAAGA,EAAO,OAAO,CAAC,KAAK,QAAQf,CAAK;AAAA,QACnF,MAAM,QAAQF,CAAE;AAAA,MAAA;AAAA,IAEpB;AACE,aAAO;AAAA,EAAA;AAEb;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "../../utils/cn.js";
|
|
3
|
+
function d({
|
|
4
|
+
variant: t = "text",
|
|
5
|
+
width: r,
|
|
6
|
+
height: s,
|
|
7
|
+
animate: m = !0,
|
|
8
|
+
className: n,
|
|
9
|
+
style: l,
|
|
10
|
+
...a
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ e(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: i([
|
|
16
|
+
"bg-[var(--glass-highlight)]",
|
|
17
|
+
m && "animate-pulse"
|
|
18
|
+
], {
|
|
19
|
+
text: "rounded h-4",
|
|
20
|
+
circular: "rounded-full",
|
|
21
|
+
rectangular: "rounded-lg"
|
|
22
|
+
}[t], n),
|
|
23
|
+
style: {
|
|
24
|
+
width: typeof r == "number" ? `${r}px` : r,
|
|
25
|
+
height: typeof s == "number" ? `${s}px` : s,
|
|
26
|
+
...l
|
|
27
|
+
},
|
|
28
|
+
...a
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function h({
|
|
33
|
+
lines: t = 2,
|
|
34
|
+
showHeader: r = !0,
|
|
35
|
+
showTags: s = !0,
|
|
36
|
+
className: m,
|
|
37
|
+
...n
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ c(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: i(
|
|
43
|
+
"p-5 md:p-6 rounded-2xl border",
|
|
44
|
+
"bg-[var(--glass-bg)] border-[var(--glass-border)]",
|
|
45
|
+
m
|
|
46
|
+
),
|
|
47
|
+
...n,
|
|
48
|
+
children: [
|
|
49
|
+
r && /* @__PURE__ */ e("div", { className: "mb-3 md:mb-4", children: /* @__PURE__ */ e(d, { variant: "circular", width: 12, height: 12 }) }),
|
|
50
|
+
/* @__PURE__ */ e(d, { width: "70%", height: 20, className: "mb-2" }),
|
|
51
|
+
/* @__PURE__ */ e("div", { className: "space-y-2 mb-3 md:mb-4", children: Array.from({ length: t }).map((l, a) => /* @__PURE__ */ e(
|
|
52
|
+
d,
|
|
53
|
+
{
|
|
54
|
+
width: a === t - 1 ? "85%" : "100%",
|
|
55
|
+
height: 14,
|
|
56
|
+
className: "bg-[var(--glass-bg)]"
|
|
57
|
+
},
|
|
58
|
+
a
|
|
59
|
+
)) }),
|
|
60
|
+
s && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2", children: [50, 60, 70].map((l, a) => /* @__PURE__ */ e(
|
|
61
|
+
d,
|
|
62
|
+
{
|
|
63
|
+
width: l,
|
|
64
|
+
height: 12,
|
|
65
|
+
className: "bg-[var(--glass-bg)]"
|
|
66
|
+
},
|
|
67
|
+
a
|
|
68
|
+
)) })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
h as CardSkeleton,
|
|
75
|
+
d as Skeleton
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["../../../src/atoms/Skeleton/Skeleton.tsx"],"sourcesContent":["import { type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n /** Skeleton variant */\n variant?: 'text' | 'circular' | 'rectangular'\n /** Width of the skeleton */\n width?: string | number\n /** Height of the skeleton */\n height?: string | number\n /** Enable shimmer animation */\n animate?: boolean\n}\n\n/**\n * Skeleton loading placeholder\n * Uses CSS custom properties for consistent theming\n */\nexport function Skeleton({\n variant = 'text',\n width,\n height,\n animate = true,\n className,\n style,\n ...props\n}: SkeletonProps) {\n const baseStyles = [\n 'bg-[var(--glass-highlight)]',\n animate && 'animate-pulse',\n ]\n\n const variants = {\n text: 'rounded h-4',\n circular: 'rounded-full',\n rectangular: 'rounded-lg',\n }\n\n return (\n <div\n className={cn(baseStyles, variants[variant], className)}\n style={{\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n ...style,\n }}\n {...props}\n />\n )\n}\n\nexport interface CardSkeletonProps extends HTMLAttributes<HTMLDivElement> {\n /** Number of text lines to show */\n lines?: number\n /** Show header indicator */\n showHeader?: boolean\n /** Show tags row */\n showTags?: boolean\n}\n\n/**\n * Pre-composed card skeleton for common use cases\n */\nexport function CardSkeleton({\n lines = 2,\n showHeader = true,\n showTags = true,\n className,\n ...props\n}: CardSkeletonProps) {\n return (\n <div\n className={cn(\n 'p-5 md:p-6 rounded-2xl border',\n 'bg-[var(--glass-bg)] border-[var(--glass-border)]',\n className\n )}\n {...props}\n >\n {showHeader && (\n <div className=\"mb-3 md:mb-4\">\n <Skeleton variant=\"circular\" width={12} height={12} />\n </div>\n )}\n\n <Skeleton width=\"70%\" height={20} className=\"mb-2\" />\n\n <div className=\"space-y-2 mb-3 md:mb-4\">\n {Array.from({ length: lines }).map((_, i) => (\n <Skeleton\n key={i}\n width={i === lines - 1 ? '85%' : '100%'}\n height={14}\n className=\"bg-[var(--glass-bg)]\"\n />\n ))}\n </div>\n\n {showTags && (\n <div className=\"flex flex-wrap gap-2\">\n {[50, 60, 70].map((width, i) => (\n <Skeleton\n key={i}\n width={width}\n height={12}\n className=\"bg-[var(--glass-bg)]\"\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"names":["Skeleton","variant","width","height","animate","className","style","props","jsx","cn","CardSkeleton","lines","showHeader","showTags","jsxs","_","i"],"mappings":";;AAkBO,SAASA,EAAS;AAAA,EACvB,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAAkB;AAYhB,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAbI;AAAA,QACjB;AAAA,QACAL,KAAW;AAAA,MAAA,GAGI;AAAA,QACf,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MAAA,EAKwBH,CAAO,GAAGI,CAAS;AAAA,MACtD,OAAO;AAAA,QACL,OAAO,OAAOH,KAAU,WAAW,GAAGA,CAAK,OAAOA;AAAA,QAClD,QAAQ,OAAOC,KAAW,WAAW,GAAGA,CAAM,OAAOA;AAAA,QACrD,GAAGG;AAAA,MAAA;AAAA,MAEJ,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAcO,SAASG,EAAa;AAAA,EAC3B,OAAAC,IAAQ;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,WAAAR;AAAA,EACA,GAAGE;AACL,GAAsB;AACpB,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWL;AAAA,QACT;AAAA,QACA;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAK,KACC,gBAAAJ,EAAC,OAAA,EAAI,WAAU,gBACb,UAAA,gBAAAA,EAACR,GAAA,EAAS,SAAQ,YAAW,OAAO,IAAI,QAAQ,GAAA,CAAI,GACtD;AAAA,0BAGDA,GAAA,EAAS,OAAM,OAAM,QAAQ,IAAI,WAAU,QAAO;AAAA,QAEnD,gBAAAQ,EAAC,OAAA,EAAI,WAAU,0BACZ,gBAAM,KAAK,EAAE,QAAQG,EAAA,CAAO,EAAE,IAAI,CAACI,GAAGC,MACrC,gBAAAR;AAAA,UAACR;AAAA,UAAA;AAAA,YAEC,OAAOgB,MAAML,IAAQ,IAAI,QAAQ;AAAA,YACjC,QAAQ;AAAA,YACR,WAAU;AAAA,UAAA;AAAA,UAHLK;AAAA,QAAA,CAKR,GACH;AAAA,QAECH,KACC,gBAAAL,EAAC,OAAA,EAAI,WAAU,wBACZ,UAAA,CAAC,IAAI,IAAI,EAAE,EAAE,IAAI,CAACN,GAAOc,MACxB,gBAAAR;AAAA,UAACR;AAAA,UAAA;AAAA,YAEC,OAAAE;AAAA,YACA,QAAQ;AAAA,YACR,WAAU;AAAA,UAAA;AAAA,UAHLc;AAAA,QAAA,CAKR,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../utils/cn.js";
|
|
3
|
+
const c = {
|
|
4
|
+
sm: "px-2 py-1 text-xs",
|
|
5
|
+
md: "px-3 py-2 text-sm",
|
|
6
|
+
lg: "px-4 py-3 text-base"
|
|
7
|
+
};
|
|
8
|
+
function b({
|
|
9
|
+
children: r,
|
|
10
|
+
direction: o = "bottom",
|
|
11
|
+
variant: n = "speech",
|
|
12
|
+
size: i = "md",
|
|
13
|
+
color: e = "var(--glass-bg, rgba(255, 255, 255, 0.05))",
|
|
14
|
+
borderColor: l = "var(--glass-border, rgba(255, 255, 255, 0.1))",
|
|
15
|
+
className: d,
|
|
16
|
+
style: p
|
|
17
|
+
}) {
|
|
18
|
+
const x = n === "thought", h = {
|
|
19
|
+
bottom: "bottom-0 left-1/2 -translate-x-1/2 translate-y-full",
|
|
20
|
+
top: "top-0 left-1/2 -translate-x-1/2 -translate-y-full rotate-180",
|
|
21
|
+
left: "left-0 top-1/2 -translate-x-full -translate-y-1/2 -rotate-90",
|
|
22
|
+
right: "right-0 top-1/2 translate-x-full -translate-y-1/2 rotate-90"
|
|
23
|
+
}, f = {
|
|
24
|
+
bottom: "bottom-0 left-1/2 -translate-x-1/2 translate-y-[150%]",
|
|
25
|
+
top: "top-0 left-1/2 -translate-x-1/2 -translate-y-[150%]",
|
|
26
|
+
left: "left-0 top-1/2 -translate-x-[150%] -translate-y-1/2",
|
|
27
|
+
right: "right-0 top-1/2 translate-x-[150%] -translate-y-1/2"
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ t(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: a("relative inline-block", d),
|
|
33
|
+
style: p,
|
|
34
|
+
children: /* @__PURE__ */ s(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: a(
|
|
38
|
+
"relative rounded-xl",
|
|
39
|
+
c[i]
|
|
40
|
+
),
|
|
41
|
+
style: {
|
|
42
|
+
backgroundColor: e,
|
|
43
|
+
border: `1px solid ${l}`
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
r,
|
|
47
|
+
x ? /* @__PURE__ */ s("div", { className: a("absolute flex gap-1", f[o]), children: [
|
|
48
|
+
/* @__PURE__ */ t(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: "w-2 h-2 rounded-full",
|
|
52
|
+
style: { backgroundColor: e, border: `1px solid ${l}` }
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ t(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: "w-1.5 h-1.5 rounded-full",
|
|
59
|
+
style: { backgroundColor: e, border: `1px solid ${l}` }
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] }) : /* @__PURE__ */ t("div", { className: a("absolute", h[o]), children: /* @__PURE__ */ s(
|
|
63
|
+
"svg",
|
|
64
|
+
{
|
|
65
|
+
width: "12",
|
|
66
|
+
height: "8",
|
|
67
|
+
viewBox: "0 0 12 8",
|
|
68
|
+
fill: "none",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ t(
|
|
71
|
+
"path",
|
|
72
|
+
{
|
|
73
|
+
d: "M6 8L0 0H12L6 8Z",
|
|
74
|
+
fill: e
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ t(
|
|
78
|
+
"path",
|
|
79
|
+
{
|
|
80
|
+
d: "M0.5 0L6 7L11.5 0",
|
|
81
|
+
stroke: l,
|
|
82
|
+
strokeWidth: "1",
|
|
83
|
+
fill: "none"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
) })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
b as SpeechBubble
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=SpeechBubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpeechBubble.js","sources":["../../../src/atoms/SpeechBubble/SpeechBubble.tsx"],"sourcesContent":["import { cn } from '../../utils/cn'\n\nexport type BubbleDirection = 'left' | 'right' | 'top' | 'bottom'\nexport type BubbleVariant = 'speech' | 'thought'\nexport type BubbleSize = 'sm' | 'md' | 'lg'\n\nexport interface SpeechBubbleProps {\n children: React.ReactNode\n direction?: BubbleDirection\n variant?: BubbleVariant\n size?: BubbleSize\n color?: string\n borderColor?: string\n className?: string\n style?: React.CSSProperties\n}\n\nconst sizeClasses: Record<BubbleSize, string> = {\n sm: 'px-2 py-1 text-xs',\n md: 'px-3 py-2 text-sm',\n lg: 'px-4 py-3 text-base',\n}\n\nexport function SpeechBubble({\n children,\n direction = 'bottom',\n variant = 'speech',\n size = 'md',\n color = 'var(--glass-bg, rgba(255, 255, 255, 0.05))',\n borderColor = 'var(--glass-border, rgba(255, 255, 255, 0.1))',\n className,\n style,\n}: SpeechBubbleProps) {\n const isThought = variant === 'thought'\n\n // Tail positioning\n const tailPosition: Record<BubbleDirection, string> = {\n bottom: 'bottom-0 left-1/2 -translate-x-1/2 translate-y-full',\n top: 'top-0 left-1/2 -translate-x-1/2 -translate-y-full rotate-180',\n left: 'left-0 top-1/2 -translate-x-full -translate-y-1/2 -rotate-90',\n right: 'right-0 top-1/2 translate-x-full -translate-y-1/2 rotate-90',\n }\n\n // Thought bubble dots positioning\n const dotsPosition: Record<BubbleDirection, string> = {\n bottom: 'bottom-0 left-1/2 -translate-x-1/2 translate-y-[150%]',\n top: 'top-0 left-1/2 -translate-x-1/2 -translate-y-[150%]',\n left: 'left-0 top-1/2 -translate-x-[150%] -translate-y-1/2',\n right: 'right-0 top-1/2 translate-x-[150%] -translate-y-1/2',\n }\n\n return (\n <div\n className={cn('relative inline-block', className)}\n style={style}\n >\n <div\n className={cn(\n 'relative rounded-xl',\n sizeClasses[size]\n )}\n style={{\n backgroundColor: color,\n border: `1px solid ${borderColor}`,\n }}\n >\n {children}\n\n {/* Speech tail or thought dots */}\n {isThought ? (\n <div className={cn('absolute flex gap-1', dotsPosition[direction])}>\n <div\n className=\"w-2 h-2 rounded-full\"\n style={{ backgroundColor: color, border: `1px solid ${borderColor}` }}\n />\n <div\n className=\"w-1.5 h-1.5 rounded-full\"\n style={{ backgroundColor: color, border: `1px solid ${borderColor}` }}\n />\n </div>\n ) : (\n <div className={cn('absolute', tailPosition[direction])}>\n <svg\n width=\"12\"\n height=\"8\"\n viewBox=\"0 0 12 8\"\n fill=\"none\"\n >\n <path\n d=\"M6 8L0 0H12L6 8Z\"\n fill={color}\n />\n <path\n d=\"M0.5 0L6 7L11.5 0\"\n stroke={borderColor}\n strokeWidth=\"1\"\n fill=\"none\"\n />\n </svg>\n </div>\n )}\n </div>\n </div>\n )\n}\n"],"names":["sizeClasses","SpeechBubble","children","direction","variant","size","color","borderColor","className","style","isThought","tailPosition","dotsPosition","jsx","cn","jsxs"],"mappings":";;AAiBA,MAAMA,IAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEO,SAASC,EAAa;AAAA,EAC3B,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,OAAAC;AACF,GAAsB;AACpB,QAAMC,IAAYN,MAAY,WAGxBO,IAAgD;AAAA,IACpD,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,EAAA,GAIHC,IAAgD;AAAA,IACpD,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAGT,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAG,yBAAyBN,CAAS;AAAA,MAChD,OAAAC;AAAA,MAEA,UAAA,gBAAAM;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWD;AAAA,YACT;AAAA,YACAd,EAAYK,CAAI;AAAA,UAAA;AAAA,UAElB,OAAO;AAAA,YACL,iBAAiBC;AAAA,YACjB,QAAQ,aAAaC,CAAW;AAAA,UAAA;AAAA,UAGjC,UAAA;AAAA,YAAAL;AAAA,YAGAQ,sBACE,OAAA,EAAI,WAAWI,EAAG,uBAAuBF,EAAaT,CAAS,CAAC,GAC/D,UAAA;AAAA,cAAA,gBAAAU;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,EAAE,iBAAiBP,GAAO,QAAQ,aAAaC,CAAW,GAAA;AAAA,gBAAG;AAAA,cAAA;AAAA,cAEtE,gBAAAM;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,EAAE,iBAAiBP,GAAO,QAAQ,aAAaC,CAAW,GAAA;AAAA,gBAAG;AAAA,cAAA;AAAA,YACtE,EAAA,CACF,sBAEC,OAAA,EAAI,WAAWO,EAAG,YAAYH,EAAaR,CAAS,CAAC,GACpD,UAAA,gBAAAY;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,SAAQ;AAAA,gBACR,MAAK;AAAA,gBAEL,UAAA;AAAA,kBAAA,gBAAAF;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,GAAE;AAAA,sBACF,MAAMP;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAER,gBAAAO;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,GAAE;AAAA,sBACF,QAAQN;AAAA,sBACR,aAAY;AAAA,sBACZ,MAAK;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACP;AAAA,cAAA;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, useState as k, useRef as v, useCallback as c } from "react";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
const y = {
|
|
5
|
+
sm: "w-8 h-[18px]",
|
|
6
|
+
md: "w-10 h-[22px]",
|
|
7
|
+
lg: "w-12 h-[26px]"
|
|
8
|
+
}, S = {
|
|
9
|
+
sm: "w-3.5 h-3.5",
|
|
10
|
+
md: "w-[18px] h-[18px]",
|
|
11
|
+
lg: "w-[22px] h-[22px]"
|
|
12
|
+
}, C = {
|
|
13
|
+
sm: "translate-x-[14px]",
|
|
14
|
+
md: "translate-x-[18px]",
|
|
15
|
+
lg: "translate-x-[22px]"
|
|
16
|
+
}, D = g(
|
|
17
|
+
({
|
|
18
|
+
checked: s,
|
|
19
|
+
defaultChecked: u = !1,
|
|
20
|
+
onChange: l,
|
|
21
|
+
disabled: r = !1,
|
|
22
|
+
size: n = "md",
|
|
23
|
+
label: p,
|
|
24
|
+
className: m
|
|
25
|
+
}, f) => {
|
|
26
|
+
const o = s !== void 0, [h, x] = k(u), e = o ? s : h, w = v(null), a = c(() => {
|
|
27
|
+
if (r) return;
|
|
28
|
+
const t = !e;
|
|
29
|
+
o || x(t), l?.(t);
|
|
30
|
+
}, [r, e, o, l]), b = c(
|
|
31
|
+
(t) => {
|
|
32
|
+
t.key === "Enter" && (t.preventDefault(), a());
|
|
33
|
+
},
|
|
34
|
+
[a]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ i(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
ref: f ?? w,
|
|
40
|
+
type: "button",
|
|
41
|
+
role: "switch",
|
|
42
|
+
"aria-checked": e,
|
|
43
|
+
"aria-label": p,
|
|
44
|
+
disabled: r,
|
|
45
|
+
onClick: a,
|
|
46
|
+
onKeyDown: b,
|
|
47
|
+
className: d(
|
|
48
|
+
"relative inline-flex shrink-0 cursor-pointer items-center rounded-full",
|
|
49
|
+
"border border-transparent",
|
|
50
|
+
"transition-colors duration-200 ease-out",
|
|
51
|
+
"focus-ring",
|
|
52
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
53
|
+
e ? "bg-[var(--color-sage)]" : "bg-[var(--glass-border)]",
|
|
54
|
+
y[n],
|
|
55
|
+
m
|
|
56
|
+
),
|
|
57
|
+
children: /* @__PURE__ */ i(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
className: d(
|
|
62
|
+
"pointer-events-none inline-block rounded-full",
|
|
63
|
+
"bg-[var(--color-white)]",
|
|
64
|
+
"transition-transform duration-200 ease-out",
|
|
65
|
+
S[n],
|
|
66
|
+
e ? C[n] : "translate-x-0.5"
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
D.displayName = "Switch";
|
|
75
|
+
export {
|
|
76
|
+
D as Switch
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../src/atoms/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef, useCallback, useRef, useState, type KeyboardEvent } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface SwitchProps {\n checked?: boolean\n defaultChecked?: boolean\n onChange?: (checked: boolean) => void\n disabled?: boolean\n size?: 'sm' | 'md' | 'lg'\n label?: string\n className?: string\n}\n\nconst trackSizes = {\n sm: 'w-8 h-[18px]',\n md: 'w-10 h-[22px]',\n lg: 'w-12 h-[26px]',\n}\n\nconst thumbSizes = {\n sm: 'w-3.5 h-3.5',\n md: 'w-[18px] h-[18px]',\n lg: 'w-[22px] h-[22px]',\n}\n\nconst thumbTranslate = {\n sm: 'translate-x-[14px]',\n md: 'translate-x-[18px]',\n lg: 'translate-x-[22px]',\n}\n\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(\n (\n {\n checked: controlledChecked,\n defaultChecked = false,\n onChange,\n disabled = false,\n size = 'md',\n label,\n className,\n },\n ref\n ) => {\n const isControlled = controlledChecked !== undefined\n const [internalChecked, setInternalChecked] = useState(defaultChecked)\n const isChecked = isControlled ? controlledChecked : internalChecked\n const internalRef = useRef<HTMLButtonElement>(null)\n\n const toggle = useCallback(() => {\n if (disabled) return\n const next = !isChecked\n if (!isControlled) {\n setInternalChecked(next)\n }\n onChange?.(next)\n }, [disabled, isChecked, isControlled, onChange])\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n toggle()\n }\n },\n [toggle]\n )\n\n return (\n <button\n ref={ref ?? internalRef}\n type=\"button\"\n role=\"switch\"\n aria-checked={isChecked}\n aria-label={label}\n disabled={disabled}\n onClick={toggle}\n onKeyDown={handleKeyDown}\n className={cn(\n 'relative inline-flex shrink-0 cursor-pointer items-center rounded-full',\n 'border border-transparent',\n 'transition-colors duration-200 ease-out',\n 'focus-ring',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n isChecked\n ? 'bg-[var(--color-sage)]'\n : 'bg-[var(--glass-border)]',\n trackSizes[size],\n className\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none inline-block rounded-full',\n 'bg-[var(--color-white)]',\n 'transition-transform duration-200 ease-out',\n thumbSizes[size],\n isChecked ? thumbTranslate[size] : 'translate-x-0.5'\n )}\n />\n </button>\n )\n }\n)\n\nSwitch.displayName = 'Switch'\n"],"names":["trackSizes","thumbSizes","thumbTranslate","Switch","forwardRef","controlledChecked","defaultChecked","onChange","disabled","size","label","className","ref","isControlled","internalChecked","setInternalChecked","useState","isChecked","internalRef","useRef","toggle","useCallback","next","handleKeyDown","e","jsx","cn"],"mappings":";;;AAaA,MAAMA,IAAa;AAAA,EACjB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAa;AAAA,EACjB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAiB;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAASC;AAAA,EACpB,CACE;AAAA,IACE,SAASC;AAAA,IACT,gBAAAC,IAAiB;AAAA,IACjB,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,WAAAC;AAAA,EAAA,GAEFC,MACG;AACH,UAAMC,IAAeR,MAAsB,QACrC,CAACS,GAAiBC,CAAkB,IAAIC,EAASV,CAAc,GAC/DW,IAAYJ,IAAeR,IAAoBS,GAC/CI,IAAcC,EAA0B,IAAI,GAE5CC,IAASC,EAAY,MAAM;AAC/B,UAAIb,EAAU;AACd,YAAMc,IAAO,CAACL;AACd,MAAKJ,KACHE,EAAmBO,CAAI,GAEzBf,IAAWe,CAAI;AAAA,IACjB,GAAG,CAACd,GAAUS,GAAWJ,GAAcN,CAAQ,CAAC,GAE1CgB,IAAgBF;AAAA,MACpB,CAACG,MAAwC;AACvC,QAAIA,EAAE,QAAQ,YACZA,EAAE,eAAA,GACFJ,EAAA;AAAA,MAEJ;AAAA,MACA,CAACA,CAAM;AAAA,IAAA;AAGT,WACE,gBAAAK;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKb,KAAOM;AAAA,QACZ,MAAK;AAAA,QACL,MAAK;AAAA,QACL,gBAAcD;AAAA,QACd,cAAYP;AAAA,QACZ,UAAAF;AAAA,QACA,SAASY;AAAA,QACT,WAAWG;AAAA,QACX,WAAWG;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACAT,IACI,2BACA;AAAA,UACJjB,EAAWS,CAAI;AAAA,UACfE;AAAA,QAAA;AAAA,QAGF,UAAA,gBAAAc;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAWC;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACAzB,EAAWQ,CAAI;AAAA,cACfQ,IAAYf,EAAeO,CAAI,IAAI;AAAA,YAAA;AAAA,UACrC;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEAN,EAAO,cAAc;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { cn as l } from "../../utils/cn.js";
|
|
4
|
+
const n = s(
|
|
5
|
+
({
|
|
6
|
+
resize: e = "vertical",
|
|
7
|
+
error: r = !1,
|
|
8
|
+
className: o,
|
|
9
|
+
...a
|
|
10
|
+
}, t) => /* @__PURE__ */ i(
|
|
11
|
+
"textarea",
|
|
12
|
+
{
|
|
13
|
+
ref: t,
|
|
14
|
+
className: l(
|
|
15
|
+
"min-h-[80px] w-full",
|
|
16
|
+
"bg-transparent",
|
|
17
|
+
"border rounded-lg px-3 py-2",
|
|
18
|
+
"text-sm text-[var(--color-white)]",
|
|
19
|
+
"placeholder:text-[var(--color-grey-400)]",
|
|
20
|
+
"transition-[border-color] duration-200 ease-out",
|
|
21
|
+
"focus:outline-none focus-visible:outline-none",
|
|
22
|
+
"focus-ring",
|
|
23
|
+
r ? "border-[var(--color-coral)]" : "border-[var(--glass-border)] hover:border-[var(--glass-highlight)] focus:border-[var(--glass-highlight)]",
|
|
24
|
+
{
|
|
25
|
+
none: "resize-none",
|
|
26
|
+
vertical: "resize-y",
|
|
27
|
+
both: "resize"
|
|
28
|
+
}[e],
|
|
29
|
+
o
|
|
30
|
+
),
|
|
31
|
+
"aria-invalid": r || void 0,
|
|
32
|
+
...a
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
n.displayName = "Textarea";
|
|
37
|
+
export {
|
|
38
|
+
n as Textarea
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=Textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../../src/atoms/Textarea/Textarea.tsx"],"sourcesContent":["import { forwardRef, type TextareaHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n resize?: 'none' | 'vertical' | 'both'\n error?: boolean\n className?: string\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n resize = 'vertical',\n error = false,\n className,\n ...props\n },\n ref\n ) => {\n const resizeStyles = {\n none: 'resize-none',\n vertical: 'resize-y',\n both: 'resize',\n }\n\n return (\n <textarea\n ref={ref}\n className={cn(\n 'min-h-[80px] w-full',\n 'bg-transparent',\n 'border rounded-lg px-3 py-2',\n 'text-sm text-[var(--color-white)]',\n 'placeholder:text-[var(--color-grey-400)]',\n 'transition-[border-color] duration-200 ease-out',\n 'focus:outline-none focus-visible:outline-none',\n 'focus-ring',\n error\n ? 'border-[var(--color-coral)]'\n : 'border-[var(--glass-border)] hover:border-[var(--glass-highlight)] focus:border-[var(--glass-highlight)]',\n resizeStyles[resize],\n className\n )}\n aria-invalid={error || undefined}\n {...props}\n />\n )\n }\n)\n\nTextarea.displayName = 'Textarea'\n"],"names":["Textarea","forwardRef","resize","error","className","props","ref","jsx","cn"],"mappings":";;;AASO,MAAMA,IAAWC;AAAA,EACtB,CACE;AAAA,IACE,QAAAC,IAAS;AAAA,IACT,OAAAC,IAAQ;AAAA,IACR,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MASE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACAL,IACI,gCACA;AAAA,QApBW;AAAA,UACnB,MAAM;AAAA,UACN,UAAU;AAAA,UACV,MAAM;AAAA,QAAA,EAkBWD,CAAM;AAAA,QACnBE;AAAA,MAAA;AAAA,MAEF,gBAAcD,KAAS;AAAA,MACtB,GAAGE;AAAA,IAAA;AAAA,EAAA;AAIZ;AAEAL,EAAS,cAAc;"}
|