@aristobyte-ui/utils 1.0.21 → 1.0.24
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/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;
|
|
@@ -8,6 +9,10 @@ type RippleParams<HTMLElementType extends RippleParamsRef> = {
|
|
|
8
9
|
};
|
|
9
10
|
declare const renderRipple: <HTMLElementType extends RippleParamsRef>({ ref, clientX, clientY, }: RippleParams<HTMLElementType>) => void;
|
|
10
11
|
|
|
12
|
+
declare const Portal: React$1.FC<{
|
|
13
|
+
children: React$1.ReactNode;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
11
16
|
type IconProps = {
|
|
12
17
|
size?: number;
|
|
13
18
|
color?: string;
|
|
@@ -21,4 +26,4 @@ declare const Icons: {
|
|
|
21
26
|
Warning: ({ size, color }: IconProps) => react_jsx_runtime.JSX.Element;
|
|
22
27
|
};
|
|
23
28
|
|
|
24
|
-
export { Icons, type RippleParams, renderRipple };
|
|
29
|
+
export { Icons, Portal, type RippleParams, renderRipple };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;
|
|
@@ -8,6 +9,10 @@ type RippleParams<HTMLElementType extends RippleParamsRef> = {
|
|
|
8
9
|
};
|
|
9
10
|
declare const renderRipple: <HTMLElementType extends RippleParamsRef>({ ref, clientX, clientY, }: RippleParams<HTMLElementType>) => void;
|
|
10
11
|
|
|
12
|
+
declare const Portal: React$1.FC<{
|
|
13
|
+
children: React$1.ReactNode;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
11
16
|
type IconProps = {
|
|
12
17
|
size?: number;
|
|
13
18
|
color?: string;
|
|
@@ -21,4 +26,4 @@ declare const Icons: {
|
|
|
21
26
|
Warning: ({ size, color }: IconProps) => react_jsx_runtime.JSX.Element;
|
|
22
27
|
};
|
|
23
28
|
|
|
24
|
-
export { Icons, type RippleParams, renderRipple };
|
|
29
|
+
export { Icons, Portal, type RippleParams, renderRipple };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./index.css";
|
|
3
3
|
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
10
|
var __export = (target, all) => {
|
|
9
11
|
for (var name in all)
|
|
@@ -17,12 +19,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
19
|
}
|
|
18
20
|
return to;
|
|
19
21
|
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
20
30
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
31
|
|
|
22
32
|
// index.ts
|
|
23
33
|
var index_exports = {};
|
|
24
34
|
__export(index_exports, {
|
|
25
35
|
Icons: () => Icons,
|
|
36
|
+
Portal: () => Portal,
|
|
26
37
|
renderRipple: () => renderRipple
|
|
27
38
|
});
|
|
28
39
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -70,6 +81,20 @@ var renderRipple = ({
|
|
|
70
81
|
});
|
|
71
82
|
};
|
|
72
83
|
|
|
84
|
+
// Portal.tsx
|
|
85
|
+
var React = __toESM(require("react"));
|
|
86
|
+
var import_react_dom = require("react-dom");
|
|
87
|
+
var Portal = ({
|
|
88
|
+
children
|
|
89
|
+
}) => {
|
|
90
|
+
const [mounted, setMounted] = React.useState(false);
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
setMounted(true);
|
|
93
|
+
}, []);
|
|
94
|
+
if (!mounted || typeof window === "undefined") return null;
|
|
95
|
+
return (0, import_react_dom.createPortal)(children, document.body);
|
|
96
|
+
};
|
|
97
|
+
|
|
73
98
|
// icons/Copy.tsx
|
|
74
99
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
100
|
var Copy = ({ size = 24, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -184,6 +209,7 @@ var Icons = {
|
|
|
184
209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
185
210
|
0 && (module.exports = {
|
|
186
211
|
Icons,
|
|
212
|
+
Portal,
|
|
187
213
|
renderRipple
|
|
188
214
|
});
|
|
189
215
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts","../ripple.tsx","../icons/Copy.tsx","../icons/Error.tsx","../icons/Info.tsx","../icons/Success.tsx","../icons/Warning.tsx","../icons/index.ts"],"sourcesContent":["export * from \"./ripple\";\nexport * from \"./icons\";\n","type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;\n\nexport type RippleParams<HTMLElementType extends RippleParamsRef> = {\n ref: React.RefObject<HTMLElementType | null>;\n clientX: number;\n clientY: number;\n};\n\nexport const renderRipple = <HTMLElementType extends RippleParamsRef>({\n ref,\n clientX,\n clientY,\n}: RippleParams<HTMLElementType>) => {\n const button = ref.current;\n if (!button) return;\n\n const circle = document.createElement(\"span\");\n const diameter = Math.max(button.clientWidth, button.clientHeight);\n const radius = diameter / 2;\n\n circle.id = \"ripple\";\n\n const style = document.createElement(\"style\");\n style.innerHTML = `\n #ripple {\n animation: ripple 300ms linear;\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n height: ${diameter}px;\n left: ${clientX - button.getBoundingClientRect().left - radius}px;\n pointer-events: none;\n position: absolute;\n top: ${clientY - button.getBoundingClientRect().top - radius}px;\n transform: scale(0);\n width: ${diameter}px;\n z-index: 0;\n }\n \n @keyframes ripple {\n to {\n opacity: 0;\n transform: scale(2);\n }\n }\n `;\n\n button.appendChild(style);\n button.appendChild(circle);\n\n circle.addEventListener(\"animationend\", () => {\n circle.remove();\n style.remove();\n });\n};\n","import { IconProps } from \"./type\";\n\nexport const Copy = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Error = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 9-6 6\" />\n <path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Info = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Success = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Warning = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" />\n </svg>\n);\n","import { Copy } from \"./Copy\";\nimport { Error } from \"./Error\";\nimport { Info } from \"./Info\";\nimport { Success } from \"./Success\";\nimport { Warning } from \"./Warning\";\n\nexport const Icons = {\n Copy,\n Error,\n Info,\n Success,\n Warning,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../index.ts","../ripple.tsx","../Portal.tsx","../icons/Copy.tsx","../icons/Error.tsx","../icons/Info.tsx","../icons/Success.tsx","../icons/Warning.tsx","../icons/index.ts"],"sourcesContent":["export * from \"./ripple\";\nexport * from \"./Portal\";\nexport * from \"./icons\";\n","type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;\n\nexport type RippleParams<HTMLElementType extends RippleParamsRef> = {\n ref: React.RefObject<HTMLElementType | null>;\n clientX: number;\n clientY: number;\n};\n\nexport const renderRipple = <HTMLElementType extends RippleParamsRef>({\n ref,\n clientX,\n clientY,\n}: RippleParams<HTMLElementType>) => {\n const button = ref.current;\n if (!button) return;\n\n const circle = document.createElement(\"span\");\n const diameter = Math.max(button.clientWidth, button.clientHeight);\n const radius = diameter / 2;\n\n circle.id = \"ripple\";\n\n const style = document.createElement(\"style\");\n style.innerHTML = `\n #ripple {\n animation: ripple 300ms linear;\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n height: ${diameter}px;\n left: ${clientX - button.getBoundingClientRect().left - radius}px;\n pointer-events: none;\n position: absolute;\n top: ${clientY - button.getBoundingClientRect().top - radius}px;\n transform: scale(0);\n width: ${diameter}px;\n z-index: 0;\n }\n \n @keyframes ripple {\n to {\n opacity: 0;\n transform: scale(2);\n }\n }\n `;\n\n button.appendChild(style);\n button.appendChild(circle);\n\n circle.addEventListener(\"animationend\", () => {\n circle.remove();\n style.remove();\n });\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport const Portal: React.FC<{ children: React.ReactNode }> = ({\n children,\n}) => {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted || typeof window === \"undefined\") return null;\n return createPortal(children, document.body);\n};\n","import { IconProps } from \"./type\";\n\nexport const Copy = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Error = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 9-6 6\" />\n <path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Info = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Success = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Warning = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" />\n </svg>\n);\n","import { Copy } from \"./Copy\";\nimport { Error } from \"./Error\";\nimport { Info } from \"./Info\";\nimport { Success } from \"./Success\";\nimport { Warning } from \"./Warning\";\n\nexport const Icons = {\n Copy,\n Error,\n Info,\n Success,\n Warning,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,eAAe,CAA0C;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MAAqC;AACnC,QAAM,SAAS,IAAI;AACnB,MAAI,CAAC,OAAQ;AAEb,QAAM,SAAS,SAAS,cAAc,MAAM;AAC5C,QAAM,WAAW,KAAK,IAAI,OAAO,aAAa,OAAO,YAAY;AACjE,QAAM,SAAS,WAAW;AAE1B,SAAO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AK;AAAA,IACL,QAAQ;AAAA,IACR,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IAEf;AAAA,mDAAC,UAAK,GAAE,cAAa;AAAA,MACrB,6CAAC,UAAK,GAAE,WAAU;AAAA,MAClB,6CAAC,UAAK,GAAE,iPAAgP;AAAA;AAAA;AAC1P;;;ACVK,IAAM,QAAQ;AAAA,EACnB;AAAA,EACA,OAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["import_jsx_runtime","Error","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","Error"]}
|
package/dist/index.mjs
CHANGED
|
@@ -44,6 +44,20 @@ var renderRipple = ({
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
// Portal.tsx
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { createPortal } from "react-dom";
|
|
50
|
+
var Portal = ({
|
|
51
|
+
children
|
|
52
|
+
}) => {
|
|
53
|
+
const [mounted, setMounted] = React.useState(false);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
setMounted(true);
|
|
56
|
+
}, []);
|
|
57
|
+
if (!mounted || typeof window === "undefined") return null;
|
|
58
|
+
return createPortal(children, document.body);
|
|
59
|
+
};
|
|
60
|
+
|
|
47
61
|
// icons/Copy.tsx
|
|
48
62
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
49
63
|
var Copy = ({ size = 24, color = "currentColor" }) => /* @__PURE__ */ jsxs(
|
|
@@ -157,6 +171,7 @@ var Icons = {
|
|
|
157
171
|
};
|
|
158
172
|
export {
|
|
159
173
|
Icons,
|
|
174
|
+
Portal,
|
|
160
175
|
renderRipple
|
|
161
176
|
};
|
|
162
177
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../ripple.tsx","../icons/Copy.tsx","../icons/Error.tsx","../icons/Info.tsx","../icons/Success.tsx","../icons/Warning.tsx","../icons/index.ts"],"sourcesContent":["type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;\n\nexport type RippleParams<HTMLElementType extends RippleParamsRef> = {\n ref: React.RefObject<HTMLElementType | null>;\n clientX: number;\n clientY: number;\n};\n\nexport const renderRipple = <HTMLElementType extends RippleParamsRef>({\n ref,\n clientX,\n clientY,\n}: RippleParams<HTMLElementType>) => {\n const button = ref.current;\n if (!button) return;\n\n const circle = document.createElement(\"span\");\n const diameter = Math.max(button.clientWidth, button.clientHeight);\n const radius = diameter / 2;\n\n circle.id = \"ripple\";\n\n const style = document.createElement(\"style\");\n style.innerHTML = `\n #ripple {\n animation: ripple 300ms linear;\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n height: ${diameter}px;\n left: ${clientX - button.getBoundingClientRect().left - radius}px;\n pointer-events: none;\n position: absolute;\n top: ${clientY - button.getBoundingClientRect().top - radius}px;\n transform: scale(0);\n width: ${diameter}px;\n z-index: 0;\n }\n \n @keyframes ripple {\n to {\n opacity: 0;\n transform: scale(2);\n }\n }\n `;\n\n button.appendChild(style);\n button.appendChild(circle);\n\n circle.addEventListener(\"animationend\", () => {\n circle.remove();\n style.remove();\n });\n};\n","import { IconProps } from \"./type\";\n\nexport const Copy = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Error = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 9-6 6\" />\n <path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Info = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Success = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Warning = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" />\n </svg>\n);\n","import { Copy } from \"./Copy\";\nimport { Error } from \"./Error\";\nimport { Info } from \"./Info\";\nimport { Success } from \"./Success\";\nimport { Warning } from \"./Warning\";\n\nexport const Icons = {\n Copy,\n Error,\n Info,\n Success,\n Warning,\n};\n"],"mappings":";;;;AAQO,IAAM,eAAe,CAA0C;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MAAqC;AACnC,QAAM,SAAS,IAAI;AACnB,MAAI,CAAC,OAAQ;AAEb,QAAM,SAAS,SAAS,cAAc,MAAM;AAC5C,QAAM,WAAW,KAAK,IAAI,OAAO,aAAa,OAAO,YAAY;AACjE,QAAM,SAAS,WAAW;AAE1B,SAAO,KAAK;AAEZ,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKF,QAAQ;AAAA,gBACV,UAAU,OAAO,sBAAsB,EAAE,OAAO,MAAM;AAAA;AAAA;AAAA,eAGvD,UAAU,OAAO,sBAAsB,EAAE,MAAM,MAAM;AAAA;AAAA,iBAEnD,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYvB,SAAO,YAAY,KAAK;AACxB,SAAO,YAAY,MAAM;AAEzB,SAAO,iBAAiB,gBAAgB,MAAM;AAC5C,WAAO,OAAO;AACd,UAAM,OAAO;AAAA,EACf,CAAC;AACH;;;
|
|
1
|
+
{"version":3,"sources":["../ripple.tsx","../Portal.tsx","../icons/Copy.tsx","../icons/Error.tsx","../icons/Info.tsx","../icons/Success.tsx","../icons/Warning.tsx","../icons/index.ts"],"sourcesContent":["type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;\n\nexport type RippleParams<HTMLElementType extends RippleParamsRef> = {\n ref: React.RefObject<HTMLElementType | null>;\n clientX: number;\n clientY: number;\n};\n\nexport const renderRipple = <HTMLElementType extends RippleParamsRef>({\n ref,\n clientX,\n clientY,\n}: RippleParams<HTMLElementType>) => {\n const button = ref.current;\n if (!button) return;\n\n const circle = document.createElement(\"span\");\n const diameter = Math.max(button.clientWidth, button.clientHeight);\n const radius = diameter / 2;\n\n circle.id = \"ripple\";\n\n const style = document.createElement(\"style\");\n style.innerHTML = `\n #ripple {\n animation: ripple 300ms linear;\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n height: ${diameter}px;\n left: ${clientX - button.getBoundingClientRect().left - radius}px;\n pointer-events: none;\n position: absolute;\n top: ${clientY - button.getBoundingClientRect().top - radius}px;\n transform: scale(0);\n width: ${diameter}px;\n z-index: 0;\n }\n \n @keyframes ripple {\n to {\n opacity: 0;\n transform: scale(2);\n }\n }\n `;\n\n button.appendChild(style);\n button.appendChild(circle);\n\n circle.addEventListener(\"animationend\", () => {\n circle.remove();\n style.remove();\n });\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport const Portal: React.FC<{ children: React.ReactNode }> = ({\n children,\n}) => {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted || typeof window === \"undefined\") return null;\n return createPortal(children, document.body);\n};\n","import { IconProps } from \"./type\";\n\nexport const Copy = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Error = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 9-6 6\" />\n <path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Info = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Success = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n);\n","import { IconProps } from \"./type\";\n\nexport const Warning = ({ size = 24, color = \"currentColor\" }: IconProps) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" />\n </svg>\n);\n","import { Copy } from \"./Copy\";\nimport { Error } from \"./Error\";\nimport { Info } from \"./Info\";\nimport { Success } from \"./Success\";\nimport { Warning } from \"./Warning\";\n\nexport const Icons = {\n Copy,\n Error,\n Info,\n Success,\n Warning,\n};\n"],"mappings":";;;;AAQO,IAAM,eAAe,CAA0C;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MAAqC;AACnC,QAAM,SAAS,IAAI;AACnB,MAAI,CAAC,OAAQ;AAEb,QAAM,SAAS,SAAS,cAAc,MAAM;AAC5C,QAAM,WAAW,KAAK,IAAI,OAAO,aAAa,OAAO,YAAY;AACjE,QAAM,SAAS,WAAW;AAE1B,SAAO,KAAK;AAEZ,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKF,QAAQ;AAAA,gBACV,UAAU,OAAO,sBAAsB,EAAE,OAAO,MAAM;AAAA;AAAA;AAAA,eAGvD,UAAU,OAAO,sBAAsB,EAAE,MAAM,MAAM;AAAA;AAAA,iBAEnD,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYvB,SAAO,YAAY,KAAK;AACxB,SAAO,YAAY,MAAM;AAEzB,SAAO,iBAAiB,gBAAgB,MAAM;AAC5C,WAAO,OAAO;AACd,UAAM,OAAO;AAAA,EACf,CAAC;AACH;;;ACnDA,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAEtB,IAAM,SAAkD,CAAC;AAAA,EAC9D;AACF,MAAM;AACJ,QAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAElD,EAAM,gBAAU,MAAM;AACpB,eAAW,IAAI;AAAA,EACjB,GA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
"description": "A collection of shared utility functions for AristoByte projects, designed to provide reusable helpers, streamline common operations, and ensure consistency across applications and packages.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"tsup": "^8.5.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@aristobyte-ui/eslint-config": "^1.0.
|
|
66
|
-
"@aristobyte-ui/typescript-config": "^1.0.
|
|
65
|
+
"@aristobyte-ui/eslint-config": "^1.0.24",
|
|
66
|
+
"@aristobyte-ui/typescript-config": "^1.0.24",
|
|
67
67
|
"@turbo/gen": "^2.5.0",
|
|
68
68
|
"@types/node": "^24.3.0",
|
|
69
69
|
"@types/react": "19.1.0",
|