@omer-x/tailwind-ui-kit 1.0.0-alpha.17 → 1.0.0-alpha.19
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/MIGRATION.md +164 -0
- package/README.md +390 -0
- package/dist/components/button/BaseButton.d.ts +27 -11
- package/dist/components/button/BaseButton.js +57 -51
- package/dist/components/button/index.d.ts +2 -4
- package/dist/components/button/index.js +1 -4
- package/dist/components/dialog/AnimatedPopup.d.ts +3 -6
- package/dist/components/dialog/AnimatedPopup.js +6 -31
- package/dist/components/dialog/DialogBackdrop.d.ts +3 -6
- package/dist/components/dialog/DialogBackdrop.js +6 -22
- package/dist/components/dialog/DialogTitle.d.ts +3 -6
- package/dist/components/dialog/DialogTitle.js +6 -15
- package/dist/components/dialog/index.d.ts +4 -5
- package/dist/components/dialog/index.js +4 -8
- package/dist/components/elements/JustAnchor.d.ts +3 -6
- package/dist/components/elements/JustAnchor.js +8 -13
- package/dist/components/elements/JustButton.d.ts +3 -6
- package/dist/components/elements/JustButton.js +8 -13
- package/dist/components/elements/JustDiv.d.ts +3 -6
- package/dist/components/elements/JustDiv.js +8 -13
- package/dist/components/elements/JustInput.d.ts +3 -6
- package/dist/components/elements/JustInput.js +8 -13
- package/dist/components/form/BaseForm.d.ts +12 -15
- package/dist/components/form/BaseForm.js +72 -70
- package/dist/components/form/BaseFormField.d.ts +12 -19
- package/dist/components/form/BaseFormField.js +29 -24
- package/dist/components/form/BaseInput.d.ts +5 -9
- package/dist/components/form/BaseInput.js +20 -31
- package/dist/components/form/BaseSwitch.d.ts +6 -9
- package/dist/components/form/BaseSwitch.js +18 -51
- package/dist/components/form/ClientSideError.d.ts +9 -0
- package/dist/components/form/ClientSideError.js +39 -0
- package/dist/components/form/FieldRoot.d.ts +6 -9
- package/dist/components/form/FieldRoot.js +16 -18
- package/dist/components/form/FormContext.d.ts +26 -9
- package/dist/components/form/FormContext.js +9 -7
- package/dist/components/form/ServerSideError.d.ts +6 -10
- package/dist/components/form/ServerSideError.js +10 -14
- package/dist/components/form/index.d.ts +7 -11
- package/dist/components/form/index.js +6 -10
- package/dist/components/form/useFormMessages.d.ts +10 -0
- package/dist/components/form/useFormMessages.js +16 -0
- package/dist/components/layout/Container.d.ts +5 -8
- package/dist/components/layout/Container.js +8 -10
- package/dist/components/layout/index.d.ts +2 -2
- package/dist/components/layout/index.js +1 -4
- package/dist/components/page/Pagination.d.ts +11 -15
- package/dist/components/page/Pagination.js +60 -48
- package/dist/components/page/index.d.ts +2 -5
- package/dist/components/page/index.js +1 -4
- package/dist/components/table/Tdx.d.ts +5 -8
- package/dist/components/table/Tdx.js +13 -9
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +1 -4
- package/dist/hooks/useRipples.d.ts +2 -5
- package/dist/hooks/useRipples.js +46 -33
- package/dist/styles/ripple.module.css +1 -0
- package/dist/utils/cn.d.ts +6 -5
- package/dist/utils/cn.js +8 -6
- package/dist/utils/dirty-form.d.ts +1 -3
- package/dist/utils/dirty-form.js +24 -39
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +1 -4
- package/package.json +27 -24
- package/dist/components/button/PulseButton.d.ts +0 -8
- package/dist/components/button/PulseButton.js +0 -41
- package/dist/styles/ripple.module.d.ts +0 -2
|
@@ -1,51 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {} from "react";
|
|
1
|
+
import "react";
|
|
3
2
|
import JustAnchor from "../elements/JustAnchor.js";
|
|
4
3
|
import JustButton from "../elements/JustButton.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/page/Pagination.tsx
|
|
6
|
+
const Pagination = ({ totalItems, itemsPerPage, currentPage, queryParams, renderButton, renderLink }) => {
|
|
7
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
8
|
+
const buildHref = (page) => {
|
|
9
|
+
const searchParams = new URLSearchParams();
|
|
10
|
+
for (const [key, value] of Object.entries(queryParams)) searchParams.append(key, `${value}`);
|
|
11
|
+
if (page === 1) searchParams.delete("page");
|
|
12
|
+
else searchParams.set("page", page.toString());
|
|
13
|
+
return `?${searchParams}`;
|
|
14
|
+
};
|
|
15
|
+
const Item = (props) => {
|
|
16
|
+
if (props.active || props.disabled || typeof props.page === "undefined") return /* @__PURE__ */ jsx(JustButton, {
|
|
17
|
+
render: renderButton,
|
|
18
|
+
disabled: true,
|
|
19
|
+
children: /* @__PURE__ */ jsx(Fragment$1, { children: props.children || props.page })
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsx(JustAnchor, {
|
|
22
|
+
render: renderLink,
|
|
23
|
+
href: buildHref(props.page),
|
|
24
|
+
children: /* @__PURE__ */ jsx(Fragment$1, { children: props.children || props.page })
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "flex gap-3",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Item, {
|
|
31
|
+
page: currentPage - 1,
|
|
32
|
+
disabled: currentPage <= 1,
|
|
33
|
+
children: "«"
|
|
34
|
+
}),
|
|
35
|
+
currentPage > 3 && /* @__PURE__ */ jsx(Item, { page: 1 }),
|
|
36
|
+
currentPage === 5 && /* @__PURE__ */ jsx(Item, { page: 2 }),
|
|
37
|
+
currentPage > 5 && /* @__PURE__ */ jsx(Item, {
|
|
38
|
+
disabled: true,
|
|
39
|
+
children: "…"
|
|
40
|
+
}),
|
|
41
|
+
currentPage > 2 && /* @__PURE__ */ jsx(Item, { page: currentPage - 2 }),
|
|
42
|
+
currentPage > 1 && /* @__PURE__ */ jsx(Item, { page: currentPage - 1 }),
|
|
43
|
+
/* @__PURE__ */ jsx(Item, {
|
|
44
|
+
active: true,
|
|
45
|
+
children: currentPage
|
|
46
|
+
}),
|
|
47
|
+
currentPage <= totalPages - 1 && /* @__PURE__ */ jsx(Item, { page: currentPage + 1 }),
|
|
48
|
+
currentPage <= totalPages - 2 && /* @__PURE__ */ jsx(Item, { page: currentPage + 2 }),
|
|
49
|
+
currentPage <= totalPages - 5 && /* @__PURE__ */ jsx(Item, {
|
|
50
|
+
disabled: true,
|
|
51
|
+
children: "…"
|
|
52
|
+
}),
|
|
53
|
+
currentPage === totalPages - 4 && /* @__PURE__ */ jsx(Item, { page: totalPages - 1 }),
|
|
54
|
+
currentPage <= totalPages - 3 && /* @__PURE__ */ jsx(Item, { page: totalPages }),
|
|
55
|
+
/* @__PURE__ */ jsx(Item, {
|
|
56
|
+
page: currentPage + 1,
|
|
57
|
+
disabled: currentPage >= totalPages,
|
|
58
|
+
children: "»"
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
51
62
|
};
|
|
63
|
+
export { Pagination as default };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
4
2
|
type TdxProps = {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
className?: string;
|
|
4
|
+
children?: ReactNode;
|
|
7
5
|
};
|
|
8
|
-
declare const Tdx: ({ className, children
|
|
9
|
-
|
|
10
|
-
export { Tdx as default };
|
|
6
|
+
declare const Tdx: ({ className, children }: TdxProps) => import("react").JSX.Element;
|
|
7
|
+
export { Tdx as default };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import "react";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
const Tdx = ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
// src/components/table/Tdx.tsx
|
|
4
|
+
const Tdx = ({ className, children }) => /* @__PURE__ */ jsx("td", {
|
|
5
|
+
className,
|
|
6
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: "table w-full table-fixed",
|
|
8
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
9
|
+
className: "table-cell truncate",
|
|
10
|
+
children
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
export { Tdx as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Tdx from "./Tdx.js";
|
|
2
|
+
export { Tdx };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare function useRipples(): readonly [(e: React.MouseEvent<Element>) => void, react.JSX.Element];
|
|
4
|
-
|
|
5
|
-
export { useRipples };
|
|
1
|
+
import { MouseEvent } from "react";
|
|
2
|
+
export declare function useRipples(): readonly [(e: MouseEvent<Element>) => void, import("react").JSX.Element];
|
package/dist/hooks/useRipples.js
CHANGED
|
@@ -1,36 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState } from "react";
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import styles from "../styles/ripple.module.css";
|
|
4
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/hooks/useRipples.tsx
|
|
6
|
+
const RIPPLE_DURATION = 600;
|
|
5
7
|
function useRipples() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
const [ripples, setRipples] = useState([]);
|
|
9
|
+
const nextId = useRef(0);
|
|
10
|
+
const timeouts = useRef(/* @__PURE__ */ new Set());
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const pending = timeouts.current;
|
|
13
|
+
return () => {
|
|
14
|
+
pending.forEach(clearTimeout);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
const handleClick = (e) => {
|
|
18
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
19
|
+
const size = Math.max(rect.width, rect.height);
|
|
20
|
+
const fromKeyboard = e.detail === 0;
|
|
21
|
+
const x = fromKeyboard ? rect.width / 2 - size / 2 : e.clientX - rect.left - size / 2;
|
|
22
|
+
const y = fromKeyboard ? rect.height / 2 - size / 2 : e.clientY - rect.top - size / 2;
|
|
23
|
+
const id = nextId.current++;
|
|
24
|
+
setRipples((prev) => [...prev, {
|
|
25
|
+
x,
|
|
26
|
+
y,
|
|
27
|
+
size,
|
|
28
|
+
id
|
|
29
|
+
}]);
|
|
30
|
+
const timeout = setTimeout(() => {
|
|
31
|
+
timeouts.current.delete(timeout);
|
|
32
|
+
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
33
|
+
}, RIPPLE_DURATION);
|
|
34
|
+
timeouts.current.add(timeout);
|
|
35
|
+
};
|
|
36
|
+
return [handleClick, /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit] motion-reduce:hidden",
|
|
38
|
+
children: ripples.map((ripple) => /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: cn(styles.animation, "absolute rounded-full bg-current opacity-10"),
|
|
40
|
+
style: {
|
|
41
|
+
left: ripple.x,
|
|
42
|
+
top: ripple.y,
|
|
43
|
+
width: ripple.size,
|
|
44
|
+
height: ripple.size
|
|
45
|
+
}
|
|
46
|
+
}, ripple.id))
|
|
47
|
+
})];
|
|
33
48
|
}
|
|
34
|
-
export {
|
|
35
|
-
useRipples
|
|
36
|
-
};
|
|
49
|
+
export { useRipples };
|
package/dist/utils/cn.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { cn as cn$1 } from "cn";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `cn` from the `cn` package directly instead:
|
|
4
|
+
* `import { cn } from "cn";`
|
|
5
|
+
*/
|
|
6
|
+
export declare function cn(...inputs: Parameters<typeof cn$1>): string;
|
package/dist/utils/cn.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { cn as cn$1 } from "cn";
|
|
2
|
+
// src/utils/cn.ts
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `cn` from the `cn` package directly instead:
|
|
5
|
+
* `import { cn } from "cn";`
|
|
6
|
+
*/
|
|
3
7
|
function cn(...inputs) {
|
|
4
|
-
|
|
8
|
+
return cn$1(...inputs);
|
|
5
9
|
}
|
|
6
|
-
export {
|
|
7
|
-
cn
|
|
8
|
-
};
|
|
10
|
+
export { cn };
|
package/dist/utils/dirty-form.js
CHANGED
|
@@ -1,45 +1,30 @@
|
|
|
1
|
+
// src/utils/dirty-form.ts
|
|
1
2
|
function getCurrentValue(el) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (el.type === "checkbox" || el.type === "radio") {
|
|
6
|
-
return el.checked;
|
|
7
|
-
}
|
|
8
|
-
return el.value;
|
|
3
|
+
if (el instanceof HTMLSelectElement) return Array.from(el.options).filter((o) => o.selected).map((o) => o.value).join(",");
|
|
4
|
+
if (el.type === "checkbox" || el.type === "radio") return el.checked;
|
|
5
|
+
return el.value;
|
|
9
6
|
}
|
|
10
7
|
function isDirty(defaultValue, currentValue) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return JSON.stringify(defaultValue) !== currentValue;
|
|
21
|
-
default:
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
8
|
+
switch (typeof defaultValue) {
|
|
9
|
+
case "undefined": return currentValue !== "";
|
|
10
|
+
case "string":
|
|
11
|
+
case "boolean": return defaultValue !== currentValue;
|
|
12
|
+
case "bigint":
|
|
13
|
+
case "number":
|
|
14
|
+
case "object": return JSON.stringify(defaultValue) !== currentValue;
|
|
15
|
+
default: return true;
|
|
16
|
+
}
|
|
24
17
|
}
|
|
25
18
|
function getDirtyFormData(form, defaultValues) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
dirty.append(e.name, e.value);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return dirty;
|
|
19
|
+
const dirty = new FormData();
|
|
20
|
+
for (const e of Array.from(form.elements)) if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) {
|
|
21
|
+
if (!e.name) continue;
|
|
22
|
+
if (isDirty(defaultValues[e.name], getCurrentValue(e))) {
|
|
23
|
+
if (e.type === "checkbox" || e.type === "radio") {
|
|
24
|
+
if (e.checked) dirty.append(e.name, e.value);
|
|
25
|
+
} else dirty.append(e.name, e.value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return dirty;
|
|
42
29
|
}
|
|
43
|
-
export {
|
|
44
|
-
getDirtyFormData
|
|
45
|
-
};
|
|
30
|
+
export { getDirtyFormData };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { cn } from "./cn.js";
|
|
2
|
+
export { cn };
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/tailwind-ui-kit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
4
|
"description": "Tailwind CSS-based React component library for building user interfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwind",
|
|
7
7
|
"ui-kit",
|
|
8
|
-
"font-awesome",
|
|
9
8
|
"typescript"
|
|
10
9
|
],
|
|
11
10
|
"repository": {
|
|
@@ -30,7 +29,8 @@
|
|
|
30
29
|
"main": "./dist/index.js",
|
|
31
30
|
"types": "./dist/index.d.ts",
|
|
32
31
|
"files": [
|
|
33
|
-
"dist/"
|
|
32
|
+
"dist/",
|
|
33
|
+
"MIGRATION.md"
|
|
34
34
|
],
|
|
35
35
|
"exports": {
|
|
36
36
|
"./layout": {
|
|
@@ -67,39 +67,42 @@
|
|
|
67
67
|
"lint:fix": "eslint --fix --flag unstable_native_nodejs_ts_config",
|
|
68
68
|
"test": "vitest run --coverage",
|
|
69
69
|
"test:watch": "vitest --coverage",
|
|
70
|
-
"dev": "
|
|
71
|
-
"build": "
|
|
70
|
+
"dev": "storybook dev -p 3000",
|
|
71
|
+
"build": "tsdown",
|
|
72
|
+
"build-storybook": "storybook build"
|
|
72
73
|
},
|
|
73
74
|
"dependencies": {
|
|
74
|
-
"@omer-x/zod-to-form-constraints": "^1.1.
|
|
75
|
+
"@omer-x/zod-to-form-constraints": "^1.1.3",
|
|
76
|
+
"cn": "^0.5.2"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
79
|
"@base-ui/react": "^1",
|
|
78
|
-
"@
|
|
79
|
-
"@fortawesome/free-solid-svg-icons": "^7",
|
|
80
|
-
"@fortawesome/react-fontawesome": "^3",
|
|
81
|
-
"clsx": "^2",
|
|
80
|
+
"@omer-x/next-form-actions": "^2.0.0-alpha.1",
|
|
82
81
|
"react": "^19",
|
|
83
82
|
"react-dom": "^19",
|
|
84
|
-
"tailwind-merge": "^3",
|
|
85
83
|
"tailwindcss": "^4"
|
|
86
84
|
},
|
|
87
85
|
"devDependencies": {
|
|
88
|
-
"@omer-x/eslint-config": "^2.3.
|
|
89
|
-
"@
|
|
90
|
-
"@
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"
|
|
86
|
+
"@omer-x/eslint-config": "^2.3.3",
|
|
87
|
+
"@omer-x/next-form-actions": "^2.0.0-alpha.1",
|
|
88
|
+
"@storybook/addon-vitest": "^10.6.9",
|
|
89
|
+
"@storybook/react-vite": "^10.6.9",
|
|
90
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
91
|
+
"@types/node": "^26.6.11",
|
|
92
|
+
"@types/react": "^19.3.3",
|
|
93
|
+
"@types/react-dom": "^19.3.0",
|
|
94
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
95
|
+
"@vitest/browser-playwright": "^5.1.2",
|
|
96
|
+
"@vitest/coverage-v8": "^5.1.2",
|
|
96
97
|
"eslint": "^9.37.0",
|
|
97
98
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
98
99
|
"eslint-plugin-react": "^7.37.5",
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
100
|
+
"playwright": "^1.65.1",
|
|
101
|
+
"semantic-release": "^26.0.1",
|
|
102
|
+
"storybook": "^10.6.9",
|
|
103
|
+
"tsdown": "^0.23.7",
|
|
104
|
+
"typescript": "^6.0.3",
|
|
105
|
+
"vite": "^8.4.0",
|
|
106
|
+
"vitest": "^5.1.2"
|
|
104
107
|
}
|
|
105
108
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ComponentProps } from 'react';
|
|
3
|
-
import { Button } from '@base-ui/react/button';
|
|
4
|
-
|
|
5
|
-
type PulseButtonProps = ComponentProps<typeof Button> & {};
|
|
6
|
-
declare const PulseButton: ({ type, disabled, onClick, children, ...otherProps }: PulseButtonProps) => react.JSX.Element;
|
|
7
|
-
|
|
8
|
-
export { PulseButton as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from "@base-ui/react/button";
|
|
4
|
-
import {} from "react";
|
|
5
|
-
import { useFormStatus } from "react-dom";
|
|
6
|
-
import { useRipples } from "../../hooks/useRipples.js";
|
|
7
|
-
const PulseButton = ({
|
|
8
|
-
type,
|
|
9
|
-
disabled,
|
|
10
|
-
onClick,
|
|
11
|
-
children,
|
|
12
|
-
...otherProps
|
|
13
|
-
}) => {
|
|
14
|
-
const { pending } = useFormStatus();
|
|
15
|
-
const [triggerRippleEffect, ripples] = useRipples();
|
|
16
|
-
const submitting = type === "submit" && pending;
|
|
17
|
-
const handleClick = (e) => {
|
|
18
|
-
onClick?.(e);
|
|
19
|
-
if (!e.defaultPrevented) {
|
|
20
|
-
triggerRippleEffect(e);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */ jsxs(
|
|
24
|
-
Button,
|
|
25
|
-
{
|
|
26
|
-
...otherProps,
|
|
27
|
-
type,
|
|
28
|
-
disabled: submitting || disabled,
|
|
29
|
-
onClick: handleClick,
|
|
30
|
-
"data-submitting": submitting ? "" : void 0,
|
|
31
|
-
children: [
|
|
32
|
-
ripples,
|
|
33
|
-
children
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
var PulseButton_default = PulseButton;
|
|
39
|
-
export {
|
|
40
|
-
PulseButton_default as default
|
|
41
|
-
};
|