@omer-x/tailwind-ui-kit 1.0.0-alpha.7 → 1.0.0-alpha.9
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.
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentProps
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
3
|
import { Button } from '@base-ui/react/button';
|
|
4
4
|
|
|
5
|
-
type PulseButtonProps = ComponentProps<typeof Button> & {
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
declare const PulseButton: ({ children, onClick, ...otherProps }: PulseButtonProps) => react.JSX.Element;
|
|
5
|
+
type PulseButtonProps = ComponentProps<typeof Button> & {};
|
|
6
|
+
declare const PulseButton: ({ type, disabled, onClick, children, ...otherProps }: PulseButtonProps) => react.JSX.Element;
|
|
9
7
|
|
|
10
8
|
export { PulseButton as default };
|
|
@@ -2,21 +2,38 @@
|
|
|
2
2
|
import { jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button } from "@base-ui/react/button";
|
|
4
4
|
import {} from "react";
|
|
5
|
+
import { useFormStatus } from "react-dom";
|
|
5
6
|
import { useRipples } from "../../hooks/useRipples.js";
|
|
6
7
|
const PulseButton = ({
|
|
7
|
-
|
|
8
|
+
type,
|
|
9
|
+
disabled,
|
|
8
10
|
onClick,
|
|
11
|
+
children,
|
|
9
12
|
...otherProps
|
|
10
13
|
}) => {
|
|
14
|
+
const { pending } = useFormStatus();
|
|
11
15
|
const [triggerRippleEffect, ripples] = useRipples();
|
|
16
|
+
const submitting = type === "submit" && pending;
|
|
12
17
|
const handleClick = (e) => {
|
|
13
|
-
triggerRippleEffect(e);
|
|
14
18
|
onClick?.(e);
|
|
19
|
+
if (!e.defaultPrevented) {
|
|
20
|
+
triggerRippleEffect(e);
|
|
21
|
+
}
|
|
15
22
|
};
|
|
16
|
-
return /* @__PURE__ */ jsxs(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
);
|
|
20
37
|
};
|
|
21
38
|
var PulseButton_default = PulseButton;
|
|
22
39
|
export {
|
|
@@ -27,7 +27,6 @@ const Form = ({
|
|
|
27
27
|
return key.startsWith("[") && key.endsWith("]");
|
|
28
28
|
}));
|
|
29
29
|
return /* @__PURE__ */ jsxs(BaseForm, { action: formAction, className, errors: state, children: [
|
|
30
|
-
JSON.stringify(Array.from(fieldsRef.current)),
|
|
31
30
|
Object.entries(globalErrors).map(([key, value]) => /* @__PURE__ */ jsx("div", { className: "bg-red-500/50", children: value }, key)),
|
|
32
31
|
/* @__PURE__ */ jsx(FormContext, { value: { getError, registerField, unregisterField }, children })
|
|
33
32
|
] });
|