@sikka/hawa 0.25.0-next → 0.25.1-next
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/blocks/auth/index.js +1 -0
- package/dist/blocks/auth/index.mjs +1 -0
- package/dist/blocks/index.js +1 -0
- package/dist/blocks/index.mjs +1 -1
- package/dist/chunk-KNHT2UBG.mjs +150 -0
- package/dist/{chunk-XE3FLWLT.mjs → chunk-MJMQDUCC.mjs} +1 -0
- package/dist/commonTypes-2IGtJ5cq.d.mts +3 -0
- package/dist/commonTypes-2IGtJ5cq.d.ts +3 -0
- package/dist/commonTypes-2k6FnHw5.d.mts +4 -0
- package/dist/commonTypes-2k6FnHw5.d.ts +4 -0
- package/dist/commonTypes-3k5cNB1s.d.mts +4 -0
- package/dist/commonTypes-3k5cNB1s.d.ts +4 -0
- package/dist/{commonTypes-3J1E3b61.d.mts → commonTypes-f_LVO3Sm.d.mts} +1 -2
- package/dist/{commonTypes-3J1E3b61.d.ts → commonTypes-f_LVO3Sm.d.ts} +1 -2
- package/dist/elements/index.js +1 -0
- package/dist/elements/index.mjs +1 -1
- package/dist/glow/index.d.mts +16 -0
- package/dist/glow/index.d.ts +16 -0
- package/dist/glow/index.js +155 -0
- package/dist/glow/index.mjs +117 -0
- package/dist/index.css +212 -206
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/input/index.d.mts +9 -2
- package/dist/input/index.d.ts +9 -2
- package/dist/input/index.mjs +1 -1
- package/dist/interfaceSettings/index.mjs +1 -1
- package/dist/label/index.d.mts +2 -1
- package/dist/label/index.d.ts +2 -1
- package/dist/label/index.mjs +98 -2
- package/dist/navigationMenu/index.d.mts +1 -2
- package/dist/navigationMenu/index.d.ts +1 -2
- package/dist/pagination/index.d.mts +1 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/passwordInput/index.mjs +148 -27
- package/dist/phoneInput/index.d.mts +1 -1
- package/dist/phoneInput/index.d.ts +1 -1
- package/dist/phoneInput/index.mjs +140 -19
- package/dist/pinInput/index.js +1 -0
- package/dist/pinInput/index.mjs +1 -0
- package/dist/popover/index.d.mts +1 -2
- package/dist/popover/index.d.ts +1 -2
- package/dist/radio/index.d.mts +4 -1
- package/dist/radio/index.d.ts +4 -1
- package/dist/scrollArea/index.d.mts +1 -1
- package/dist/scrollArea/index.d.ts +1 -1
- package/dist/separator/index.d.mts +1 -1
- package/dist/separator/index.d.ts +1 -1
- package/dist/simpleTable/index.d.mts +1 -2
- package/dist/simpleTable/index.d.ts +1 -2
- package/dist/simpleTable/index.mjs +45 -21
- package/dist/skeleton/index.mjs +29 -3
- package/dist/sortButton/index.mjs +260 -9
- package/dist/splitButton/index.d.mts +3 -4
- package/dist/splitButton/index.d.ts +3 -4
- package/dist/splitButton/index.mjs +259 -10
- package/dist/switch/index.d.mts +1 -2
- package/dist/switch/index.d.ts +1 -2
- package/dist/tabs/index.d.mts +1 -1
- package/dist/tabs/index.d.ts +1 -1
- package/dist/textarea/index.d.mts +1 -1
- package/dist/textarea/index.d.ts +1 -1
- package/dist/toast/index.d.mts +1 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/toast/index.mjs +9 -139
- package/dist/toaster/index.d.mts +2 -2
- package/dist/toaster/index.d.ts +2 -2
- package/dist/toaster/index.mjs +17 -146
- package/dist/tooltip/index.d.mts +2 -2
- package/dist/tooltip/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-53XBVEMK.mjs +0 -131
- package/dist/chunk-DGWAHQRX.mjs +0 -259
- package/dist/chunk-ND4BWUKH.mjs +0 -34
- package/dist/commonTypes-LrR8QrYP.d.mts +0 -5
- package/dist/commonTypes-LrR8QrYP.d.ts +0 -5
- package/dist/{chunk-ABS2VEET.mjs → chunk-WRZFWCOQ.mjs} +3 -3
package/dist/blocks/index.js
CHANGED
package/dist/blocks/index.mjs
CHANGED
@@ -0,0 +1,150 @@
|
|
1
|
+
import {
|
2
|
+
cn
|
3
|
+
} from "./chunk-TE3BKEXL.mjs";
|
4
|
+
|
5
|
+
// components/elements/toast/Toast.tsx
|
6
|
+
import * as React from "react";
|
7
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
8
|
+
import { cva } from "class-variance-authority";
|
9
|
+
var toastVariants = cva(
|
10
|
+
"hawa-group hawa-z-[900] hawa-pointer-events-auto hawa-relative hawa-flex hawa-w-full hawa-items-center hawa-justify-between hawa-overflow-hidden hawa-rounded-md hawa-border hawa-shadow-lg hawa-transition-all data-[swipe=cancel]:hawa-translate-x-0 data-[swipe=end]:hawa-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:hawa-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:hawa-transition-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[swipe=end]:hawa-animate-out data-[state=closed]:hawa-fade-out-80 data-[state=open]:hawa-slide-in-from-top-full data-[state=open]:sm:hawa-slide-in-from-bottom-full",
|
11
|
+
{
|
12
|
+
variants: {
|
13
|
+
variant: {
|
14
|
+
default: "hawa-border hawa-bg-background hawa-text-foreground",
|
15
|
+
destructive: "hawa-destructive hawa-group hawa-border-destructive hawa-bg-destructive hawa-text-destructive-foreground"
|
16
|
+
},
|
17
|
+
severity: {
|
18
|
+
info: "hawa-info hawa-group hawa-text-info-foreground hawa-bg-info",
|
19
|
+
warning: "hawa-warning hawa-group hawa-text-warning-foreground hawa-bg-warning",
|
20
|
+
error: "hawa-error hawa-group hawa-border-error hawa-bg-error hawa-text-white",
|
21
|
+
success: "hawa-success hawa-group hawa-text-success-foreground hawa-bg-success",
|
22
|
+
none: ""
|
23
|
+
}
|
24
|
+
},
|
25
|
+
defaultVariants: { variant: "default" }
|
26
|
+
}
|
27
|
+
);
|
28
|
+
var sizeStyles = {
|
29
|
+
default: "hawa-text-sm",
|
30
|
+
// Update this based on the desired padding for rtl
|
31
|
+
sm: "hawa-text-xs"
|
32
|
+
};
|
33
|
+
var ToastProvider = ToastPrimitives.Provider;
|
34
|
+
var ToastViewport = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
35
|
+
ToastPrimitives.Viewport,
|
36
|
+
{
|
37
|
+
ref,
|
38
|
+
className: cn(
|
39
|
+
"hawa-fixed hawa-top-0 hawa-z-[100] hawa-flex hawa-max-h-screen hawa-w-full hawa-flex-col-reverse hawa-p-4 sm:hawa-bottom-0 sm:hawa-right-0 sm:hawa-top-auto sm:hawa-flex-col md:hawa-max-w-[420px]",
|
40
|
+
className
|
41
|
+
),
|
42
|
+
...props
|
43
|
+
}
|
44
|
+
));
|
45
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
46
|
+
var Toast = React.forwardRef(({ className, variant, severity = "none", direction, ...props }, ref) => {
|
47
|
+
return /* @__PURE__ */ React.createElement(
|
48
|
+
ToastPrimitives.Root,
|
49
|
+
{
|
50
|
+
ref,
|
51
|
+
className: cn(
|
52
|
+
toastVariants({ variant, severity }),
|
53
|
+
className,
|
54
|
+
direction === "rtl" ? "data-[state=closed]:hawa-slide-out-to-left-full" : "data-[state=closed]:hawa-slide-out-to-right-full"
|
55
|
+
),
|
56
|
+
dir: direction,
|
57
|
+
...props
|
58
|
+
}
|
59
|
+
);
|
60
|
+
});
|
61
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
62
|
+
var ToastAction = React.forwardRef(({ className, ...props }, ref) => {
|
63
|
+
return /* @__PURE__ */ React.createElement(
|
64
|
+
ToastPrimitives.Action,
|
65
|
+
{
|
66
|
+
ref,
|
67
|
+
className: cn(
|
68
|
+
"hawa-inline-flex hawa-h-8 hawa-shrink-0 hawa-items-center hawa-justify-center hawa-rounded-md hawa-border hawa-bg-transparent hawa-px-3 hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-colors hover:hawa-bg-secondary hover:hawa-text-secondary-foreground focus:hawa-outline-none focus:hawa-ring-2 focus:hawa-ring-ring focus:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50",
|
69
|
+
"group-[.info]:hawa-border-muted/40 group-[.info]:hover:hawa-border-info/30 group-[.info]:hover:hawa-bg-info group-[.info]:hover:hawa-text-info-foreground group-[.info]:focus:hawa-ring-info",
|
70
|
+
"group-[.error]:hawa-border-muted/40 group-[.error]:hover:hawa-border-error/30 group-[.error]:hover:hawa-bg-error group-[.error]:hover:hawa-text-error-foreground group-[.error]:focus:hawa-ring-error",
|
71
|
+
"group-[.success]:hawa-border-muted/40 group-[.success]:hover:hawa-border-success/30 group-[.success]:hover:hawa-bg-success group-[.success]:hover:hawa-text-success-foreground group-[.success]:focus:hawa-ring-success",
|
72
|
+
"group-[.warning]:hawa-border-muted/40 group-[.warning]:hover:hawa-border-warning/30 group-[.warning]:hover:hawa-bg-warning group-[.warning]:hover:hawa-text-warning-foreground group-[.warning]:focus:hawa-ring-warning",
|
73
|
+
"hawa-whitespace-nowrap",
|
74
|
+
className
|
75
|
+
),
|
76
|
+
...props
|
77
|
+
}
|
78
|
+
);
|
79
|
+
});
|
80
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
81
|
+
var ToastClose = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
82
|
+
ToastPrimitives.Close,
|
83
|
+
{
|
84
|
+
ref,
|
85
|
+
className: cn(
|
86
|
+
// "hawa-absolute hawa-start-2 hawa-top-2",
|
87
|
+
// "group-hover:hawa-opacity-100",
|
88
|
+
"hawa-opacity-100",
|
89
|
+
"hawa-rounded-md hawa-p-1 hawa-text-foreground/50 hawa-transition-opacity hover:hawa-text-foreground focus:hawa-opacity-100 focus:hawa-outline-none focus:hawa-ring-2 group-[.destructive]:hawa-text-red-300 group-[.destructive]:hover:hawa-text-red-50 group-[.destructive]:focus:hawa-ring-red-400 group-[.destructive]:focus:hawa-ring-offset-red-600",
|
90
|
+
className
|
91
|
+
),
|
92
|
+
"toast-close": "",
|
93
|
+
...props
|
94
|
+
},
|
95
|
+
/* @__PURE__ */ React.createElement(
|
96
|
+
"svg",
|
97
|
+
{
|
98
|
+
"aria-label": "Close Icon",
|
99
|
+
"aria-hidden": "true",
|
100
|
+
className: "hawa-icon",
|
101
|
+
fill: "currentColor",
|
102
|
+
viewBox: "0 0 20 20"
|
103
|
+
},
|
104
|
+
/* @__PURE__ */ React.createElement(
|
105
|
+
"path",
|
106
|
+
{
|
107
|
+
fillRule: "evenodd",
|
108
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
109
|
+
clipRule: "evenodd"
|
110
|
+
}
|
111
|
+
)
|
112
|
+
)
|
113
|
+
));
|
114
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
115
|
+
var ToastTitle = React.forwardRef(({ className, size = "default", ...props }, ref) => /* @__PURE__ */ React.createElement(
|
116
|
+
ToastPrimitives.Title,
|
117
|
+
{
|
118
|
+
ref,
|
119
|
+
className: cn(
|
120
|
+
"hawa-select-text hawa-text-sm hawa-font-semibold",
|
121
|
+
sizeStyles[size],
|
122
|
+
className
|
123
|
+
),
|
124
|
+
...props
|
125
|
+
}
|
126
|
+
));
|
127
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
128
|
+
var ToastDescription = React.forwardRef(({ className, size = "default", ...props }, ref) => /* @__PURE__ */ React.createElement(
|
129
|
+
ToastPrimitives.Description,
|
130
|
+
{
|
131
|
+
ref,
|
132
|
+
className: cn(
|
133
|
+
"hawa-select-text hawa-opacity-90",
|
134
|
+
sizeStyles[size],
|
135
|
+
className
|
136
|
+
),
|
137
|
+
...props
|
138
|
+
}
|
139
|
+
));
|
140
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
141
|
+
|
142
|
+
export {
|
143
|
+
ToastProvider,
|
144
|
+
ToastViewport,
|
145
|
+
Toast,
|
146
|
+
ToastAction,
|
147
|
+
ToastClose,
|
148
|
+
ToastTitle,
|
149
|
+
ToastDescription
|
150
|
+
};
|
@@ -1,6 +1,5 @@
|
|
1
|
-
type DirectionType = "rtl" | "ltr";
|
2
1
|
type PositionType = "top" | "bottom" | "right" | "left";
|
3
2
|
type OrientationType = "vertical" | "horizontal";
|
4
3
|
type RadiusType = "full" | "inherit" | "none";
|
5
4
|
|
6
|
-
export type {
|
5
|
+
export type { OrientationType as O, PositionType as P, RadiusType as R };
|
@@ -1,6 +1,5 @@
|
|
1
|
-
type DirectionType = "rtl" | "ltr";
|
2
1
|
type PositionType = "top" | "bottom" | "right" | "left";
|
3
2
|
type OrientationType = "vertical" | "horizontal";
|
4
3
|
type RadiusType = "full" | "inherit" | "none";
|
5
4
|
|
6
|
-
export type {
|
5
|
+
export type { OrientationType as O, PositionType as P, RadiusType as R };
|
package/dist/elements/index.js
CHANGED
package/dist/elements/index.mjs
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
declare const GlowCapture: ({ className, size, ...rest }: {
|
4
|
+
[x: string]: any;
|
5
|
+
className?: string | undefined;
|
6
|
+
size?: number | undefined;
|
7
|
+
}) => React__default.JSX.Element;
|
8
|
+
declare const Glow: ({ className, style, color, debug, ...rest }: {
|
9
|
+
[x: string]: any;
|
10
|
+
className?: string | undefined;
|
11
|
+
style?: {} | undefined;
|
12
|
+
color?: string | undefined;
|
13
|
+
debug?: boolean | undefined;
|
14
|
+
}) => React__default.JSX.Element;
|
15
|
+
|
16
|
+
export { Glow, GlowCapture };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
declare const GlowCapture: ({ className, size, ...rest }: {
|
4
|
+
[x: string]: any;
|
5
|
+
className?: string | undefined;
|
6
|
+
size?: number | undefined;
|
7
|
+
}) => React__default.JSX.Element;
|
8
|
+
declare const Glow: ({ className, style, color, debug, ...rest }: {
|
9
|
+
[x: string]: any;
|
10
|
+
className?: string | undefined;
|
11
|
+
style?: {} | undefined;
|
12
|
+
color?: string | undefined;
|
13
|
+
debug?: boolean | undefined;
|
14
|
+
}) => React__default.JSX.Element;
|
15
|
+
|
16
|
+
export { Glow, GlowCapture };
|
@@ -0,0 +1,155 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
|
30
|
+
// components/elements/glow/index.ts
|
31
|
+
var glow_exports = {};
|
32
|
+
__export(glow_exports, {
|
33
|
+
Glow: () => Glow,
|
34
|
+
GlowCapture: () => GlowCapture
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(glow_exports);
|
37
|
+
|
38
|
+
// components/elements/glow/Glow.tsx
|
39
|
+
var import_react = __toESM(require("react"));
|
40
|
+
var GlowCapture = ({ className = "", size = 400, ...rest }) => {
|
41
|
+
const element = (0, import_react.useRef)(null);
|
42
|
+
(0, import_react.useEffect)(() => {
|
43
|
+
var _a, _b;
|
44
|
+
const move = (e) => {
|
45
|
+
if (e.pointerType === "mouse") {
|
46
|
+
requestAnimationFrame(() => {
|
47
|
+
var _a2, _b2;
|
48
|
+
(_a2 = element.current) == null ? void 0 : _a2.style.setProperty("--glow-x", `${e.layerX}px`);
|
49
|
+
(_b2 = element.current) == null ? void 0 : _b2.style.setProperty("--glow-y", `${e.layerY}px`);
|
50
|
+
});
|
51
|
+
}
|
52
|
+
};
|
53
|
+
const leave = () => {
|
54
|
+
var _a2, _b2;
|
55
|
+
(_a2 = element.current) == null ? void 0 : _a2.style.removeProperty("--glow-x");
|
56
|
+
(_b2 = element.current) == null ? void 0 : _b2.style.removeProperty("--glow-y");
|
57
|
+
};
|
58
|
+
(_a = element.current) == null ? void 0 : _a.addEventListener("pointermove", move, { passive: true });
|
59
|
+
(_b = element.current) == null ? void 0 : _b.addEventListener("pointerleave", leave, { passive: true });
|
60
|
+
return () => {
|
61
|
+
var _a2, _b2;
|
62
|
+
(_a2 = element.current) == null ? void 0 : _a2.removeEventListener("pointermove", move);
|
63
|
+
(_b2 = element.current) == null ? void 0 : _b2.removeEventListener("pointerleave", leave);
|
64
|
+
};
|
65
|
+
}, []);
|
66
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
67
|
+
"div",
|
68
|
+
{
|
69
|
+
ref: element,
|
70
|
+
className: `hawa-glow-capture ${className}`,
|
71
|
+
style: {
|
72
|
+
position: "relative",
|
73
|
+
"--glow-size": `${size}px`
|
74
|
+
},
|
75
|
+
...rest
|
76
|
+
}
|
77
|
+
);
|
78
|
+
};
|
79
|
+
var mask = `
|
80
|
+
radial-gradient(var(--glow-size) var(--glow-size) at calc(var(--glow-x, -99999px) - var(--glow-left, 0px))
|
81
|
+
calc(var(--glow-y, -99999px) - var(--glow-top, 0px)), #000000 1%, transparent 50%)
|
82
|
+
`;
|
83
|
+
var Glow = ({
|
84
|
+
className = "",
|
85
|
+
style = {},
|
86
|
+
color = "#f50057",
|
87
|
+
debug = false,
|
88
|
+
...rest
|
89
|
+
}) => {
|
90
|
+
const element = (0, import_react.useRef)(null);
|
91
|
+
(0, import_react.useEffect)(() => {
|
92
|
+
var _a, _b, _c, _d;
|
93
|
+
(_b = element.current) == null ? void 0 : _b.style.setProperty(
|
94
|
+
"--glow-top",
|
95
|
+
`${(_a = element.current) == null ? void 0 : _a.offsetTop}px`
|
96
|
+
);
|
97
|
+
(_d = element.current) == null ? void 0 : _d.style.setProperty(
|
98
|
+
"--glow-left",
|
99
|
+
`${(_c = element.current) == null ? void 0 : _c.offsetLeft}px`
|
100
|
+
);
|
101
|
+
});
|
102
|
+
(0, import_react.useEffect)(() => {
|
103
|
+
var _a;
|
104
|
+
const observer = new ResizeObserver(() => {
|
105
|
+
requestAnimationFrame(() => {
|
106
|
+
var _a2, _b, _c, _d;
|
107
|
+
(_b = element.current) == null ? void 0 : _b.style.setProperty(
|
108
|
+
"--glow-top",
|
109
|
+
`${(_a2 = element.current) == null ? void 0 : _a2.offsetTop}px`
|
110
|
+
);
|
111
|
+
(_d = element.current) == null ? void 0 : _d.style.setProperty(
|
112
|
+
"--glow-left",
|
113
|
+
`${(_c = element.current) == null ? void 0 : _c.offsetLeft}px`
|
114
|
+
);
|
115
|
+
});
|
116
|
+
});
|
117
|
+
const capture = (_a = element.current) == null ? void 0 : _a.closest(".glow-capture");
|
118
|
+
if (capture)
|
119
|
+
observer.observe(capture);
|
120
|
+
return () => observer.disconnect();
|
121
|
+
}, []);
|
122
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: element, className: "hawa-glow", style: { display: "grid" } }, /* @__PURE__ */ import_react.default.createElement(
|
123
|
+
"div",
|
124
|
+
{
|
125
|
+
className,
|
126
|
+
style: {
|
127
|
+
...style,
|
128
|
+
gridArea: "1/1/1/1"
|
129
|
+
},
|
130
|
+
...rest
|
131
|
+
},
|
132
|
+
rest.children
|
133
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
134
|
+
"div",
|
135
|
+
{
|
136
|
+
className: `glow-mask ${className}`,
|
137
|
+
glow: "true",
|
138
|
+
style: {
|
139
|
+
...style,
|
140
|
+
"--glow-color": color,
|
141
|
+
gridArea: "1/1/1/1",
|
142
|
+
pointerEvents: "none",
|
143
|
+
mask: debug ? void 0 : mask,
|
144
|
+
WebkitMask: debug ? void 0 : mask
|
145
|
+
},
|
146
|
+
...rest
|
147
|
+
},
|
148
|
+
rest.children
|
149
|
+
));
|
150
|
+
};
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
152
|
+
0 && (module.exports = {
|
153
|
+
Glow,
|
154
|
+
GlowCapture
|
155
|
+
});
|
@@ -0,0 +1,117 @@
|
|
1
|
+
// components/elements/glow/Glow.tsx
|
2
|
+
import React, { useEffect, useRef } from "react";
|
3
|
+
var GlowCapture = ({ className = "", size = 400, ...rest }) => {
|
4
|
+
const element = useRef(null);
|
5
|
+
useEffect(() => {
|
6
|
+
var _a, _b;
|
7
|
+
const move = (e) => {
|
8
|
+
if (e.pointerType === "mouse") {
|
9
|
+
requestAnimationFrame(() => {
|
10
|
+
var _a2, _b2;
|
11
|
+
(_a2 = element.current) == null ? void 0 : _a2.style.setProperty("--glow-x", `${e.layerX}px`);
|
12
|
+
(_b2 = element.current) == null ? void 0 : _b2.style.setProperty("--glow-y", `${e.layerY}px`);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
};
|
16
|
+
const leave = () => {
|
17
|
+
var _a2, _b2;
|
18
|
+
(_a2 = element.current) == null ? void 0 : _a2.style.removeProperty("--glow-x");
|
19
|
+
(_b2 = element.current) == null ? void 0 : _b2.style.removeProperty("--glow-y");
|
20
|
+
};
|
21
|
+
(_a = element.current) == null ? void 0 : _a.addEventListener("pointermove", move, { passive: true });
|
22
|
+
(_b = element.current) == null ? void 0 : _b.addEventListener("pointerleave", leave, { passive: true });
|
23
|
+
return () => {
|
24
|
+
var _a2, _b2;
|
25
|
+
(_a2 = element.current) == null ? void 0 : _a2.removeEventListener("pointermove", move);
|
26
|
+
(_b2 = element.current) == null ? void 0 : _b2.removeEventListener("pointerleave", leave);
|
27
|
+
};
|
28
|
+
}, []);
|
29
|
+
return /* @__PURE__ */ React.createElement(
|
30
|
+
"div",
|
31
|
+
{
|
32
|
+
ref: element,
|
33
|
+
className: `hawa-glow-capture ${className}`,
|
34
|
+
style: {
|
35
|
+
position: "relative",
|
36
|
+
"--glow-size": `${size}px`
|
37
|
+
},
|
38
|
+
...rest
|
39
|
+
}
|
40
|
+
);
|
41
|
+
};
|
42
|
+
var mask = `
|
43
|
+
radial-gradient(var(--glow-size) var(--glow-size) at calc(var(--glow-x, -99999px) - var(--glow-left, 0px))
|
44
|
+
calc(var(--glow-y, -99999px) - var(--glow-top, 0px)), #000000 1%, transparent 50%)
|
45
|
+
`;
|
46
|
+
var Glow = ({
|
47
|
+
className = "",
|
48
|
+
style = {},
|
49
|
+
color = "#f50057",
|
50
|
+
debug = false,
|
51
|
+
...rest
|
52
|
+
}) => {
|
53
|
+
const element = useRef(null);
|
54
|
+
useEffect(() => {
|
55
|
+
var _a, _b, _c, _d;
|
56
|
+
(_b = element.current) == null ? void 0 : _b.style.setProperty(
|
57
|
+
"--glow-top",
|
58
|
+
`${(_a = element.current) == null ? void 0 : _a.offsetTop}px`
|
59
|
+
);
|
60
|
+
(_d = element.current) == null ? void 0 : _d.style.setProperty(
|
61
|
+
"--glow-left",
|
62
|
+
`${(_c = element.current) == null ? void 0 : _c.offsetLeft}px`
|
63
|
+
);
|
64
|
+
});
|
65
|
+
useEffect(() => {
|
66
|
+
var _a;
|
67
|
+
const observer = new ResizeObserver(() => {
|
68
|
+
requestAnimationFrame(() => {
|
69
|
+
var _a2, _b, _c, _d;
|
70
|
+
(_b = element.current) == null ? void 0 : _b.style.setProperty(
|
71
|
+
"--glow-top",
|
72
|
+
`${(_a2 = element.current) == null ? void 0 : _a2.offsetTop}px`
|
73
|
+
);
|
74
|
+
(_d = element.current) == null ? void 0 : _d.style.setProperty(
|
75
|
+
"--glow-left",
|
76
|
+
`${(_c = element.current) == null ? void 0 : _c.offsetLeft}px`
|
77
|
+
);
|
78
|
+
});
|
79
|
+
});
|
80
|
+
const capture = (_a = element.current) == null ? void 0 : _a.closest(".glow-capture");
|
81
|
+
if (capture)
|
82
|
+
observer.observe(capture);
|
83
|
+
return () => observer.disconnect();
|
84
|
+
}, []);
|
85
|
+
return /* @__PURE__ */ React.createElement("div", { ref: element, className: "hawa-glow", style: { display: "grid" } }, /* @__PURE__ */ React.createElement(
|
86
|
+
"div",
|
87
|
+
{
|
88
|
+
className,
|
89
|
+
style: {
|
90
|
+
...style,
|
91
|
+
gridArea: "1/1/1/1"
|
92
|
+
},
|
93
|
+
...rest
|
94
|
+
},
|
95
|
+
rest.children
|
96
|
+
), /* @__PURE__ */ React.createElement(
|
97
|
+
"div",
|
98
|
+
{
|
99
|
+
className: `glow-mask ${className}`,
|
100
|
+
glow: "true",
|
101
|
+
style: {
|
102
|
+
...style,
|
103
|
+
"--glow-color": color,
|
104
|
+
gridArea: "1/1/1/1",
|
105
|
+
pointerEvents: "none",
|
106
|
+
mask: debug ? void 0 : mask,
|
107
|
+
WebkitMask: debug ? void 0 : mask
|
108
|
+
},
|
109
|
+
...rest
|
110
|
+
},
|
111
|
+
rest.children
|
112
|
+
));
|
113
|
+
};
|
114
|
+
export {
|
115
|
+
Glow,
|
116
|
+
GlowCapture
|
117
|
+
};
|