@rufous/ui 0.1.43 → 0.1.47
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/Buttons/index.cjs +33 -19
- package/dist/Buttons/index.js +1 -1
- package/dist/Buttons/submitButton.cjs +33 -19
- package/dist/Buttons/submitButton.d.cts +2 -2
- package/dist/Buttons/submitButton.d.ts +2 -2
- package/dist/Buttons/submitButton.js +1 -1
- package/dist/Dialogs/BaseDialog.css +2 -1
- package/dist/Dialogs/BaseDialog.js +1 -1
- package/dist/Dialogs/index.css +2 -1
- package/dist/Dialogs/index.js +1 -1
- package/dist/chunk-N4DJIU6C.js +67 -0
- package/dist/main.cjs +33 -19
- package/dist/main.css +2 -1
- package/dist/main.js +1 -1
- package/dist/style.css +2 -1
- package/dist/styles/button.css +2 -1
- package/package.json +1 -1
- package/dist/chunk-VJUSHVAE.js +0 -53
package/dist/Buttons/index.cjs
CHANGED
|
@@ -85,37 +85,51 @@ var SubmitButton = ({
|
|
|
85
85
|
...props
|
|
86
86
|
}) => {
|
|
87
87
|
const [loading, setLoading] = React3.useState(false);
|
|
88
|
-
const
|
|
88
|
+
const clickTimeout = React3.useRef(null);
|
|
89
|
+
const handleClick = async () => {
|
|
89
90
|
if (loading) return;
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await onClick(e);
|
|
94
|
-
} finally {
|
|
95
|
-
setLoading(false);
|
|
96
|
-
}
|
|
91
|
+
if (clickTimeout.current) {
|
|
92
|
+
clearTimeout(clickTimeout.current);
|
|
93
|
+
clickTimeout.current = null;
|
|
97
94
|
}
|
|
95
|
+
clickTimeout.current = setTimeout(async () => {
|
|
96
|
+
if (onClick) {
|
|
97
|
+
setLoading(true);
|
|
98
|
+
try {
|
|
99
|
+
await onClick();
|
|
100
|
+
} finally {
|
|
101
|
+
setLoading(false);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, 250);
|
|
98
105
|
};
|
|
99
|
-
const handleDoubleClick = async (
|
|
106
|
+
const handleDoubleClick = async () => {
|
|
100
107
|
if (loading) return;
|
|
108
|
+
if (clickTimeout.current) {
|
|
109
|
+
clearTimeout(clickTimeout.current);
|
|
110
|
+
clickTimeout.current = null;
|
|
111
|
+
}
|
|
101
112
|
if (onDoubleClick) {
|
|
102
113
|
setLoading(true);
|
|
103
114
|
try {
|
|
104
|
-
await onDoubleClick(
|
|
115
|
+
await onDoubleClick();
|
|
105
116
|
} finally {
|
|
106
117
|
setLoading(false);
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
return /* @__PURE__ */ React3.createElement(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
...props,
|
|
125
|
+
type: onClick ? void 0 : type,
|
|
126
|
+
className: `submit-btn ${bgGradiant ? "submit-btn-gradiant" : ""} ${props.className ?? ""}`,
|
|
127
|
+
disabled: props.disabled || loading || isLoading,
|
|
128
|
+
onClick: handleClick,
|
|
129
|
+
onDoubleClick: handleDoubleClick
|
|
130
|
+
},
|
|
131
|
+
/* @__PURE__ */ React3.createElement("span", { className: "btn-content" }, children, (loading || isLoading) && /* @__PURE__ */ React3.createElement("span", { className: "btn-loader" }, /* @__PURE__ */ React3.createElement(circularProgress_default, { size: 18, color: props.disabled || loading || isLoading ? "#00000042" : void 0 })))
|
|
132
|
+
);
|
|
119
133
|
};
|
|
120
134
|
var submitButton_default = SubmitButton;
|
|
121
135
|
|
package/dist/Buttons/index.js
CHANGED
|
@@ -73,36 +73,50 @@ var SubmitButton = ({
|
|
|
73
73
|
...props
|
|
74
74
|
}) => {
|
|
75
75
|
const [loading, setLoading] = React2.useState(false);
|
|
76
|
-
const
|
|
76
|
+
const clickTimeout = React2.useRef(null);
|
|
77
|
+
const handleClick = async () => {
|
|
77
78
|
if (loading) return;
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
await onClick(e);
|
|
82
|
-
} finally {
|
|
83
|
-
setLoading(false);
|
|
84
|
-
}
|
|
79
|
+
if (clickTimeout.current) {
|
|
80
|
+
clearTimeout(clickTimeout.current);
|
|
81
|
+
clickTimeout.current = null;
|
|
85
82
|
}
|
|
83
|
+
clickTimeout.current = setTimeout(async () => {
|
|
84
|
+
if (onClick) {
|
|
85
|
+
setLoading(true);
|
|
86
|
+
try {
|
|
87
|
+
await onClick();
|
|
88
|
+
} finally {
|
|
89
|
+
setLoading(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, 250);
|
|
86
93
|
};
|
|
87
|
-
const handleDoubleClick = async (
|
|
94
|
+
const handleDoubleClick = async () => {
|
|
88
95
|
if (loading) return;
|
|
96
|
+
if (clickTimeout.current) {
|
|
97
|
+
clearTimeout(clickTimeout.current);
|
|
98
|
+
clickTimeout.current = null;
|
|
99
|
+
}
|
|
89
100
|
if (onDoubleClick) {
|
|
90
101
|
setLoading(true);
|
|
91
102
|
try {
|
|
92
|
-
await onDoubleClick(
|
|
103
|
+
await onDoubleClick();
|
|
93
104
|
} finally {
|
|
94
105
|
setLoading(false);
|
|
95
106
|
}
|
|
96
107
|
}
|
|
97
108
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
return /* @__PURE__ */ React2.createElement(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
...props,
|
|
113
|
+
type: onClick ? void 0 : type,
|
|
114
|
+
className: `submit-btn ${bgGradiant ? "submit-btn-gradiant" : ""} ${props.className ?? ""}`,
|
|
115
|
+
disabled: props.disabled || loading || isLoading,
|
|
116
|
+
onClick: handleClick,
|
|
117
|
+
onDoubleClick: handleDoubleClick
|
|
118
|
+
},
|
|
119
|
+
/* @__PURE__ */ React2.createElement("span", { className: "btn-content" }, children, (loading || isLoading) && /* @__PURE__ */ React2.createElement("span", { className: "btn-loader" }, /* @__PURE__ */ React2.createElement(circularProgress_default, { size: 18, color: props.disabled || loading || isLoading ? "#00000042" : void 0 })))
|
|
120
|
+
);
|
|
107
121
|
};
|
|
108
122
|
var submitButton_default = SubmitButton;
|
|
@@ -4,8 +4,8 @@ interface SubmitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
type?: "button" | "submit" | "reset";
|
|
6
6
|
bgGradiant?: boolean;
|
|
7
|
-
onClick?:
|
|
8
|
-
onDoubleClick?:
|
|
7
|
+
onClick?: () => Promise<void> | void;
|
|
8
|
+
onDoubleClick?: () => Promise<void> | void;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
}
|
|
11
11
|
declare const SubmitButton: React.FC<SubmitButtonProps>;
|
|
@@ -4,8 +4,8 @@ interface SubmitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
type?: "button" | "submit" | "reset";
|
|
6
6
|
bgGradiant?: boolean;
|
|
7
|
-
onClick?:
|
|
8
|
-
onDoubleClick?:
|
|
7
|
+
onClick?: () => Promise<void> | void;
|
|
8
|
+
onDoubleClick?: () => Promise<void> | void;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
}
|
|
11
11
|
declare const SubmitButton: React.FC<SubmitButtonProps>;
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
align-items: center;
|
|
63
63
|
justify-content: center;
|
|
64
64
|
gap: 8px;
|
|
65
|
+
border: none;
|
|
65
66
|
}
|
|
66
67
|
.submit-btn:hover:not(:disabled) {
|
|
67
68
|
background-color: #9b1906;
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
}
|
|
76
77
|
.submit-btn:disabled {
|
|
77
78
|
background-color: #e0e0e0;
|
|
78
|
-
color: #
|
|
79
|
+
color: #00000042;
|
|
79
80
|
cursor: not-allowed;
|
|
80
81
|
}
|
|
81
82
|
.btn-content {
|
|
@@ -61,7 +61,7 @@ import "../chunk-QPGJCRBS.js";
|
|
|
61
61
|
import "../chunk-U7SARO5B.js";
|
|
62
62
|
import "../chunk-BMMDUQDJ.js";
|
|
63
63
|
import "../chunk-R3GARAVJ.js";
|
|
64
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-N4DJIU6C.js";
|
|
65
65
|
import "../chunk-YRFUVQDN.js";
|
|
66
66
|
export {
|
|
67
67
|
BaseDialog_default as default
|
package/dist/Dialogs/index.css
CHANGED
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
align-items: center;
|
|
63
63
|
justify-content: center;
|
|
64
64
|
gap: 8px;
|
|
65
|
+
border: none;
|
|
65
66
|
}
|
|
66
67
|
.submit-btn:hover:not(:disabled) {
|
|
67
68
|
background-color: #9b1906;
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
}
|
|
76
77
|
.submit-btn:disabled {
|
|
77
78
|
background-color: #e0e0e0;
|
|
78
|
-
color: #
|
|
79
|
+
color: #00000042;
|
|
79
80
|
cursor: not-allowed;
|
|
80
81
|
}
|
|
81
82
|
.btn-content {
|
package/dist/Dialogs/index.js
CHANGED
|
@@ -61,7 +61,7 @@ import "../chunk-QPGJCRBS.js";
|
|
|
61
61
|
import "../chunk-U7SARO5B.js";
|
|
62
62
|
import "../chunk-BMMDUQDJ.js";
|
|
63
63
|
import "../chunk-R3GARAVJ.js";
|
|
64
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-N4DJIU6C.js";
|
|
65
65
|
import "../chunk-YRFUVQDN.js";
|
|
66
66
|
export {
|
|
67
67
|
BaseDialog_default as BaseDialog
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
circularProgress_default
|
|
3
|
+
} from "./chunk-YRFUVQDN.js";
|
|
4
|
+
|
|
5
|
+
// lib/Buttons/submitButton.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
var SubmitButton = ({
|
|
8
|
+
children,
|
|
9
|
+
type = "submit",
|
|
10
|
+
onClick,
|
|
11
|
+
onDoubleClick,
|
|
12
|
+
isLoading = false,
|
|
13
|
+
bgGradiant = false,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const [loading, setLoading] = React.useState(false);
|
|
17
|
+
const clickTimeout = React.useRef(null);
|
|
18
|
+
const handleClick = async () => {
|
|
19
|
+
if (loading) return;
|
|
20
|
+
if (clickTimeout.current) {
|
|
21
|
+
clearTimeout(clickTimeout.current);
|
|
22
|
+
clickTimeout.current = null;
|
|
23
|
+
}
|
|
24
|
+
clickTimeout.current = setTimeout(async () => {
|
|
25
|
+
if (onClick) {
|
|
26
|
+
setLoading(true);
|
|
27
|
+
try {
|
|
28
|
+
await onClick();
|
|
29
|
+
} finally {
|
|
30
|
+
setLoading(false);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, 250);
|
|
34
|
+
};
|
|
35
|
+
const handleDoubleClick = async () => {
|
|
36
|
+
if (loading) return;
|
|
37
|
+
if (clickTimeout.current) {
|
|
38
|
+
clearTimeout(clickTimeout.current);
|
|
39
|
+
clickTimeout.current = null;
|
|
40
|
+
}
|
|
41
|
+
if (onDoubleClick) {
|
|
42
|
+
setLoading(true);
|
|
43
|
+
try {
|
|
44
|
+
await onDoubleClick();
|
|
45
|
+
} finally {
|
|
46
|
+
setLoading(false);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ React.createElement(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
type: onClick ? void 0 : type,
|
|
55
|
+
className: `submit-btn ${bgGradiant ? "submit-btn-gradiant" : ""} ${props.className ?? ""}`,
|
|
56
|
+
disabled: props.disabled || loading || isLoading,
|
|
57
|
+
onClick: handleClick,
|
|
58
|
+
onDoubleClick: handleDoubleClick
|
|
59
|
+
},
|
|
60
|
+
/* @__PURE__ */ React.createElement("span", { className: "btn-content" }, children, (loading || isLoading) && /* @__PURE__ */ React.createElement("span", { className: "btn-loader" }, /* @__PURE__ */ React.createElement(circularProgress_default, { size: 18, color: props.disabled || loading || isLoading ? "#00000042" : void 0 })))
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
var submitButton_default = SubmitButton;
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
submitButton_default
|
|
67
|
+
};
|
package/dist/main.cjs
CHANGED
|
@@ -1135,37 +1135,51 @@ var SubmitButton = ({
|
|
|
1135
1135
|
...props
|
|
1136
1136
|
}) => {
|
|
1137
1137
|
const [loading, setLoading] = React56.useState(false);
|
|
1138
|
-
const
|
|
1138
|
+
const clickTimeout = React56.useRef(null);
|
|
1139
|
+
const handleClick = async () => {
|
|
1139
1140
|
if (loading) return;
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
await onClick(e);
|
|
1144
|
-
} finally {
|
|
1145
|
-
setLoading(false);
|
|
1146
|
-
}
|
|
1141
|
+
if (clickTimeout.current) {
|
|
1142
|
+
clearTimeout(clickTimeout.current);
|
|
1143
|
+
clickTimeout.current = null;
|
|
1147
1144
|
}
|
|
1145
|
+
clickTimeout.current = setTimeout(async () => {
|
|
1146
|
+
if (onClick) {
|
|
1147
|
+
setLoading(true);
|
|
1148
|
+
try {
|
|
1149
|
+
await onClick();
|
|
1150
|
+
} finally {
|
|
1151
|
+
setLoading(false);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}, 250);
|
|
1148
1155
|
};
|
|
1149
|
-
const handleDoubleClick = async (
|
|
1156
|
+
const handleDoubleClick = async () => {
|
|
1150
1157
|
if (loading) return;
|
|
1158
|
+
if (clickTimeout.current) {
|
|
1159
|
+
clearTimeout(clickTimeout.current);
|
|
1160
|
+
clickTimeout.current = null;
|
|
1161
|
+
}
|
|
1151
1162
|
if (onDoubleClick) {
|
|
1152
1163
|
setLoading(true);
|
|
1153
1164
|
try {
|
|
1154
|
-
await onDoubleClick(
|
|
1165
|
+
await onDoubleClick();
|
|
1155
1166
|
} finally {
|
|
1156
1167
|
setLoading(false);
|
|
1157
1168
|
}
|
|
1158
1169
|
}
|
|
1159
1170
|
};
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1171
|
+
return /* @__PURE__ */ React56.createElement(
|
|
1172
|
+
"button",
|
|
1173
|
+
{
|
|
1174
|
+
...props,
|
|
1175
|
+
type: onClick ? void 0 : type,
|
|
1176
|
+
className: `submit-btn ${bgGradiant ? "submit-btn-gradiant" : ""} ${props.className ?? ""}`,
|
|
1177
|
+
disabled: props.disabled || loading || isLoading,
|
|
1178
|
+
onClick: handleClick,
|
|
1179
|
+
onDoubleClick: handleDoubleClick
|
|
1180
|
+
},
|
|
1181
|
+
/* @__PURE__ */ React56.createElement("span", { className: "btn-content" }, children, (loading || isLoading) && /* @__PURE__ */ React56.createElement("span", { className: "btn-loader" }, /* @__PURE__ */ React56.createElement(circularProgress_default, { size: 18, color: props.disabled || loading || isLoading ? "#00000042" : void 0 })))
|
|
1182
|
+
);
|
|
1169
1183
|
};
|
|
1170
1184
|
var submitButton_default = SubmitButton;
|
|
1171
1185
|
|
package/dist/main.css
CHANGED
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
align-items: center;
|
|
63
63
|
justify-content: center;
|
|
64
64
|
gap: 8px;
|
|
65
|
+
border: none;
|
|
65
66
|
}
|
|
66
67
|
.submit-btn:hover:not(:disabled) {
|
|
67
68
|
background-color: #9b1906;
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
}
|
|
76
77
|
.submit-btn:disabled {
|
|
77
78
|
background-color: #e0e0e0;
|
|
78
|
-
color: #
|
|
79
|
+
color: #00000042;
|
|
79
80
|
cursor: not-allowed;
|
|
80
81
|
}
|
|
81
82
|
.btn-content {
|
package/dist/main.js
CHANGED
package/dist/style.css
CHANGED
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
align-items: center;
|
|
63
63
|
justify-content: center;
|
|
64
64
|
gap: 8px;
|
|
65
|
+
border: none;
|
|
65
66
|
}
|
|
66
67
|
.submit-btn:hover:not(:disabled) {
|
|
67
68
|
background-color: #9b1906;
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
}
|
|
76
77
|
.submit-btn:disabled {
|
|
77
78
|
background-color: #e0e0e0;
|
|
78
|
-
color: #
|
|
79
|
+
color: #00000042;
|
|
79
80
|
cursor: not-allowed;
|
|
80
81
|
}
|
|
81
82
|
.btn-content {
|
package/dist/styles/button.css
CHANGED
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
align-items: center;
|
|
63
63
|
justify-content: center;
|
|
64
64
|
gap: 8px;
|
|
65
|
+
border: none;
|
|
65
66
|
}
|
|
66
67
|
.submit-btn:hover:not(:disabled) {
|
|
67
68
|
background-color: #9b1906;
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
}
|
|
76
77
|
.submit-btn:disabled {
|
|
77
78
|
background-color: #e0e0e0;
|
|
78
|
-
color: #
|
|
79
|
+
color: #00000042;
|
|
79
80
|
cursor: not-allowed;
|
|
80
81
|
}
|
|
81
82
|
.btn-content {
|
package/package.json
CHANGED
package/dist/chunk-VJUSHVAE.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
circularProgress_default
|
|
3
|
-
} from "./chunk-YRFUVQDN.js";
|
|
4
|
-
|
|
5
|
-
// lib/Buttons/submitButton.tsx
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
var SubmitButton = ({
|
|
8
|
-
children,
|
|
9
|
-
type = "submit",
|
|
10
|
-
onClick,
|
|
11
|
-
onDoubleClick,
|
|
12
|
-
isLoading = false,
|
|
13
|
-
bgGradiant = false,
|
|
14
|
-
...props
|
|
15
|
-
}) => {
|
|
16
|
-
const [loading, setLoading] = React.useState(false);
|
|
17
|
-
const handleClick = async (e) => {
|
|
18
|
-
if (loading) return;
|
|
19
|
-
if (onClick) {
|
|
20
|
-
setLoading(true);
|
|
21
|
-
try {
|
|
22
|
-
await onClick(e);
|
|
23
|
-
} finally {
|
|
24
|
-
setLoading(false);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const handleDoubleClick = async (e) => {
|
|
29
|
-
if (loading) return;
|
|
30
|
-
if (onDoubleClick) {
|
|
31
|
-
setLoading(true);
|
|
32
|
-
try {
|
|
33
|
-
await onDoubleClick(e);
|
|
34
|
-
} finally {
|
|
35
|
-
setLoading(false);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const buttonProps = {
|
|
40
|
-
...props,
|
|
41
|
-
className: `btn submit-btn ${bgGradiant ? "submit-btn-gradiant" : ""} ${props.className ?? ""}`,
|
|
42
|
-
disabled: props.disabled || loading || isLoading,
|
|
43
|
-
...onClick ? {} : { type },
|
|
44
|
-
onClick: handleClick,
|
|
45
|
-
onDoubleClick: handleDoubleClick
|
|
46
|
-
};
|
|
47
|
-
return /* @__PURE__ */ React.createElement("button", { ...buttonProps }, /* @__PURE__ */ React.createElement("span", { className: "btn-content" }, children, (loading || isLoading) && /* @__PURE__ */ React.createElement("span", { className: "btn-loader" }, /* @__PURE__ */ React.createElement(circularProgress_default, { size: 18 }))));
|
|
48
|
-
};
|
|
49
|
-
var submitButton_default = SubmitButton;
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
submitButton_default
|
|
53
|
-
};
|