@optigrit/optigrit-ui 0.0.1 → 0.0.3
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/README.md +66 -0
- package/dist/{Input-CL3wQvR_.d.ts → Input-CWxBHfX8.d.ts} +1 -0
- package/dist/{chunk-2LJSVQ6B.js → chunk-F6GWYCMR.js} +149 -48
- package/dist/components/index.d.ts +108 -5
- package/dist/components/index.js +685 -183
- package/dist/core/index.d.ts +59 -5
- package/dist/core/index.js +7 -3
- package/index.css +75 -125
- package/package.json +7 -6
- package/tailwind.preset.js +18 -69
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Input,
|
|
3
3
|
Popover,
|
|
4
|
+
Ripple,
|
|
5
|
+
Show,
|
|
6
|
+
ShowWithAnimation,
|
|
7
|
+
Spinner,
|
|
4
8
|
cn
|
|
5
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-F6GWYCMR.js";
|
|
6
10
|
import "../chunk-MCQS3QNN.js";
|
|
7
11
|
import {
|
|
8
12
|
useKeyboardShortcuts
|
|
@@ -12,92 +16,81 @@ import "../chunk-U65NGM6F.js";
|
|
|
12
16
|
// src/components/Buttons/Button/index.tsx
|
|
13
17
|
import {
|
|
14
18
|
forwardRef,
|
|
15
|
-
useCallback
|
|
19
|
+
useCallback,
|
|
20
|
+
useRef
|
|
16
21
|
} from "react";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
// src/components/Buttons/utils.ts
|
|
24
|
+
var getVariantClasses = (variant, color) => {
|
|
25
|
+
const styles = {
|
|
26
|
+
contained: {
|
|
27
|
+
primary: "bg-primary text-primary-contrastText shadow-sm hover:shadow",
|
|
28
|
+
secondary: "bg-secondary text-secondary-contrastText shadow-sm hover:shadow",
|
|
29
|
+
error: "bg-error text-error-contrastText shadow-sm hover:shadow",
|
|
30
|
+
success: "bg-success text-success-contrastText shadow-sm hover:shadow",
|
|
31
|
+
warning: "bg-warning text-warning-contrastText shadow-sm hover:shadow",
|
|
32
|
+
info: "bg-info text-info-contrastText shadow-sm hover:shadow"
|
|
33
|
+
},
|
|
34
|
+
outlined: {
|
|
35
|
+
primary: "border border-[color-mix(in_srgb,var(--primary-main)_50%,transparent)] text-primary hover:border-primary hover:bg-[color-mix(in_srgb,var(--primary-main)_4%,transparent)]",
|
|
36
|
+
secondary: "border border-[color-mix(in_srgb,var(--secondary-main)_50%,transparent)] text-secondary hover:border-secondary hover:bg-[color-mix(in_srgb,var(--secondary-main)_4%,transparent)]",
|
|
37
|
+
error: "border border-[color-mix(in_srgb,var(--error-main)_50%,transparent)] text-error hover:border-error hover:bg-[color-mix(in_srgb,var(--error-main)_4%,transparent)]",
|
|
38
|
+
success: "border border-[color-mix(in_srgb,var(--success-main)_50%,transparent)] text-success hover:border-success hover:bg-[color-mix(in_srgb,var(--success-main)_4%,transparent)]",
|
|
39
|
+
warning: "border border-[color-mix(in_srgb,var(--warning-main)_50%,transparent)] text-warning hover:border-warning hover:bg-[color-mix(in_srgb,var(--warning-main)_4%,transparent)]",
|
|
40
|
+
info: "border border-[color-mix(in_srgb,var(--info-main)_50%,transparent)] text-info hover:border-info hover:bg-[color-mix(in_srgb,var(--info-main)_4%,transparent)]"
|
|
41
|
+
},
|
|
42
|
+
soft: {
|
|
43
|
+
primary: "bg-[color-mix(in_srgb,var(--primary-main)_10%,transparent)] text-primary hover:bg-[color-mix(in_srgb,var(--primary-main)_15%,transparent)]",
|
|
44
|
+
secondary: "bg-[color-mix(in_srgb,var(--secondary-main)_10%,transparent)] text-secondary hover:bg-[color-mix(in_srgb,var(--secondary-main)_15%,transparent)]",
|
|
45
|
+
error: "bg-[color-mix(in_srgb,var(--error-main)_10%,transparent)] text-error hover:bg-[color-mix(in_srgb,var(--error-main)_15%,transparent)]",
|
|
46
|
+
success: "bg-[color-mix(in_srgb,var(--success-main)_10%,transparent)] text-success hover:bg-[color-mix(in_srgb,var(--success-main)_15%,transparent)]",
|
|
47
|
+
warning: "bg-[color-mix(in_srgb,var(--warning-main)_10%,transparent)] text-warning hover:bg-[color-mix(in_srgb,var(--warning-main)_15%,transparent)]",
|
|
48
|
+
info: "bg-[color-mix(in_srgb,var(--info-main)_10%,transparent)] text-info hover:bg-[color-mix(in_srgb,var(--info-main)_15%,transparent)]"
|
|
49
|
+
},
|
|
50
|
+
text: {
|
|
51
|
+
primary: "text-primary hover:bg-[color-mix(in_srgb,var(--primary-main)_4%,transparent)]",
|
|
52
|
+
secondary: "text-secondary hover:bg-[color-mix(in_srgb,var(--secondary-main)_4%,transparent)]",
|
|
53
|
+
error: "text-error hover:bg-[color-mix(in_srgb,var(--error-main)_4%,transparent)]",
|
|
54
|
+
success: "text-success hover:bg-[color-mix(in_srgb,var(--success-main)_4%,transparent)]",
|
|
55
|
+
warning: "text-warning hover:bg-[color-mix(in_srgb,var(--warning-main)_4%,transparent)]",
|
|
56
|
+
info: "text-info hover:bg-[color-mix(in_srgb,var(--info-main)_4%,transparent)]"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return styles[variant][color];
|
|
25
60
|
};
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
xl: "text-lg px-6 py-3 gap-3"
|
|
61
|
+
var getRippleColor = (variant, color) => {
|
|
62
|
+
if (variant === "contained") {
|
|
63
|
+
return "rgba(255, 255, 255, 0.3)";
|
|
64
|
+
}
|
|
65
|
+
return `color-mix(in srgb, var(--${color}-main) 30%, transparent)`;
|
|
32
66
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
67
|
+
|
|
68
|
+
// src/components/Buttons/Button/index.tsx
|
|
69
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
70
|
+
var sizeClasses = {
|
|
71
|
+
xs: "h-7 px-[10px] text-[13px] gap-[8px]",
|
|
72
|
+
sm: "h-[30px] px-[10px] text-[13px] gap-[8px]",
|
|
73
|
+
md: "h-9 px-6 py-3 text-[14px] gap-[8px]",
|
|
74
|
+
lg: "h-11 px-[22px] text-[16px] gap-[8px]",
|
|
75
|
+
xl: "h-14 px-[22px] text-[16px] gap-[8px]"
|
|
39
76
|
};
|
|
40
77
|
var roundnessClasses = {
|
|
41
78
|
none: "rounded-none",
|
|
42
|
-
sm: "rounded-
|
|
43
|
-
md: "rounded-
|
|
44
|
-
lg: "rounded-
|
|
79
|
+
sm: "rounded-[2px]",
|
|
80
|
+
md: "rounded-[12px]",
|
|
81
|
+
lg: "rounded-[16px]",
|
|
45
82
|
full: "rounded-full"
|
|
46
83
|
};
|
|
47
|
-
function Spinner({ className = "" }) {
|
|
48
|
-
return /* @__PURE__ */ jsxs(
|
|
49
|
-
"svg",
|
|
50
|
-
{
|
|
51
|
-
className: `animate-spin ${className}`,
|
|
52
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
53
|
-
fill: "none",
|
|
54
|
-
viewBox: "0 0 24 24",
|
|
55
|
-
"aria-hidden": "true",
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
"circle",
|
|
59
|
-
{
|
|
60
|
-
className: "opacity-25",
|
|
61
|
-
cx: "12",
|
|
62
|
-
cy: "12",
|
|
63
|
-
r: "10",
|
|
64
|
-
stroke: "currentColor",
|
|
65
|
-
strokeWidth: "4"
|
|
66
|
-
}
|
|
67
|
-
),
|
|
68
|
-
/* @__PURE__ */ jsx(
|
|
69
|
-
"path",
|
|
70
|
-
{
|
|
71
|
-
className: "opacity-75",
|
|
72
|
-
fill: "currentColor",
|
|
73
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
function cn2(...classes) {
|
|
81
|
-
return classes.filter(Boolean).join(" ");
|
|
82
|
-
}
|
|
83
|
-
var rippleColor = {
|
|
84
|
-
primary: "rgba(255, 255, 255, 0.45)",
|
|
85
|
-
secondary: "rgba(0, 0, 0, 0.12)",
|
|
86
|
-
outline: "rgba(0, 0, 0, 0.10)",
|
|
87
|
-
ghost: "rgba(0, 0, 0, 0.10)",
|
|
88
|
-
destructive: "rgba(255, 255, 255, 0.45)",
|
|
89
|
-
link: "rgba(0, 0, 0, 0.10)"
|
|
90
|
-
};
|
|
91
84
|
var Button = forwardRef(
|
|
92
85
|
({
|
|
93
|
-
variant = "
|
|
86
|
+
variant = "contained",
|
|
87
|
+
color = "primary",
|
|
94
88
|
size = "md",
|
|
95
89
|
roundness = "md",
|
|
96
90
|
fullWidth = false,
|
|
97
91
|
loading = false,
|
|
98
92
|
leftIcon,
|
|
99
93
|
rightIcon,
|
|
100
|
-
iconOnly = false,
|
|
101
94
|
disableRipple = false,
|
|
102
95
|
disabled,
|
|
103
96
|
className,
|
|
@@ -106,43 +99,23 @@ var Button = forwardRef(
|
|
|
106
99
|
onClick,
|
|
107
100
|
...rest
|
|
108
101
|
}, ref) => {
|
|
102
|
+
const rippleRef = useRef(null);
|
|
109
103
|
const isDisabled = disabled || loading;
|
|
110
104
|
const spinnerSize = {
|
|
111
|
-
xs:
|
|
112
|
-
sm:
|
|
113
|
-
md:
|
|
114
|
-
lg:
|
|
115
|
-
xl:
|
|
105
|
+
xs: 12,
|
|
106
|
+
sm: 14,
|
|
107
|
+
md: 16,
|
|
108
|
+
lg: 20,
|
|
109
|
+
xl: 24
|
|
116
110
|
};
|
|
117
111
|
const handleClick = useCallback(
|
|
118
112
|
(e) => {
|
|
119
|
-
if (!disableRipple) {
|
|
120
|
-
|
|
121
|
-
const rect = button.getBoundingClientRect();
|
|
122
|
-
const diameter = Math.max(button.clientWidth, button.clientHeight);
|
|
123
|
-
const radius = diameter / 2;
|
|
124
|
-
const circle = document.createElement("span");
|
|
125
|
-
circle.style.position = "absolute";
|
|
126
|
-
circle.style.width = `${diameter}px`;
|
|
127
|
-
circle.style.height = `${diameter}px`;
|
|
128
|
-
circle.style.left = `${e.clientX - rect.left - radius}px`;
|
|
129
|
-
circle.style.top = `${e.clientY - rect.top - radius}px`;
|
|
130
|
-
circle.style.borderRadius = "9999px";
|
|
131
|
-
circle.style.pointerEvents = "none";
|
|
132
|
-
circle.style.backgroundColor = rippleColor[variant];
|
|
133
|
-
button.appendChild(circle);
|
|
134
|
-
const anim = circle.animate(
|
|
135
|
-
[
|
|
136
|
-
{ transform: "scale(0)", opacity: "1" },
|
|
137
|
-
{ transform: "scale(4)", opacity: "0" }
|
|
138
|
-
],
|
|
139
|
-
{ duration: 600, easing: "linear" }
|
|
140
|
-
);
|
|
141
|
-
anim.onfinish = () => circle.remove();
|
|
113
|
+
if (!disableRipple && !isDisabled) {
|
|
114
|
+
rippleRef.current?.addRipple(e);
|
|
142
115
|
}
|
|
143
116
|
onClick?.(e);
|
|
144
117
|
},
|
|
145
|
-
[disableRipple,
|
|
118
|
+
[disableRipple, isDisabled, onClick]
|
|
146
119
|
);
|
|
147
120
|
return /* @__PURE__ */ jsxs(
|
|
148
121
|
"button",
|
|
@@ -152,21 +125,22 @@ var Button = forwardRef(
|
|
|
152
125
|
disabled: isDisabled,
|
|
153
126
|
"aria-busy": loading || void 0,
|
|
154
127
|
onClick: handleClick,
|
|
155
|
-
className:
|
|
128
|
+
className: cn(
|
|
156
129
|
"relative overflow-hidden inline-flex items-center justify-center font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
157
130
|
isDisabled && "pointer-events-none opacity-50",
|
|
158
|
-
|
|
159
|
-
|
|
131
|
+
getVariantClasses(variant, color),
|
|
132
|
+
sizeClasses[size],
|
|
160
133
|
roundnessClasses[roundness],
|
|
161
134
|
fullWidth && "w-full",
|
|
162
135
|
className
|
|
163
136
|
),
|
|
164
137
|
...rest,
|
|
165
138
|
children: [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
children,
|
|
169
|
-
|
|
139
|
+
/* @__PURE__ */ jsx(Ripple, { ref: rippleRef, color: getRippleColor(variant, color) }),
|
|
140
|
+
loading && /* @__PURE__ */ jsx(Spinner, { size: spinnerSize[size], color: "inherit" }),
|
|
141
|
+
!loading && leftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 z-10", children: leftIcon }),
|
|
142
|
+
/* @__PURE__ */ jsx("span", { className: "z-10", children }),
|
|
143
|
+
!loading && rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 z-10", children: rightIcon })
|
|
170
144
|
]
|
|
171
145
|
}
|
|
172
146
|
);
|
|
@@ -175,9 +149,91 @@ var Button = forwardRef(
|
|
|
175
149
|
Button.displayName = "Button";
|
|
176
150
|
var Button_default = Button;
|
|
177
151
|
|
|
178
|
-
// src/components/
|
|
179
|
-
import {
|
|
152
|
+
// src/components/Buttons/IconButton/index.tsx
|
|
153
|
+
import {
|
|
154
|
+
forwardRef as forwardRef2,
|
|
155
|
+
useCallback as useCallback2,
|
|
156
|
+
useRef as useRef2
|
|
157
|
+
} from "react";
|
|
180
158
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
159
|
+
var iconOnlySizeClasses = {
|
|
160
|
+
xs: "text-xs h-7 w-7",
|
|
161
|
+
sm: "text-sm h-9 w-9",
|
|
162
|
+
md: "text-base h-11 w-11",
|
|
163
|
+
lg: "text-base h-13 w-13",
|
|
164
|
+
xl: "text-lg h-15 w-15"
|
|
165
|
+
};
|
|
166
|
+
var roundnessClasses2 = {
|
|
167
|
+
none: "rounded-none",
|
|
168
|
+
sm: "rounded-[2px]",
|
|
169
|
+
md: "rounded-[12px]",
|
|
170
|
+
lg: "rounded-[16px]",
|
|
171
|
+
full: "rounded-full"
|
|
172
|
+
};
|
|
173
|
+
var IconButton = forwardRef2(
|
|
174
|
+
({
|
|
175
|
+
variant = "contained",
|
|
176
|
+
color = "primary",
|
|
177
|
+
size = "md",
|
|
178
|
+
roundness = "full",
|
|
179
|
+
loading = false,
|
|
180
|
+
disableRipple = false,
|
|
181
|
+
disabled,
|
|
182
|
+
className,
|
|
183
|
+
children,
|
|
184
|
+
type = "button",
|
|
185
|
+
onClick,
|
|
186
|
+
...rest
|
|
187
|
+
}, ref) => {
|
|
188
|
+
const rippleRef = useRef2(null);
|
|
189
|
+
const isDisabled = disabled || loading;
|
|
190
|
+
const spinnerSize = {
|
|
191
|
+
xs: 12,
|
|
192
|
+
sm: 14,
|
|
193
|
+
md: 16,
|
|
194
|
+
lg: 20,
|
|
195
|
+
xl: 24
|
|
196
|
+
};
|
|
197
|
+
const handleClick = useCallback2(
|
|
198
|
+
(e) => {
|
|
199
|
+
if (!disableRipple && !isDisabled) {
|
|
200
|
+
rippleRef.current?.addRipple(e);
|
|
201
|
+
}
|
|
202
|
+
onClick?.(e);
|
|
203
|
+
},
|
|
204
|
+
[disableRipple, isDisabled, onClick]
|
|
205
|
+
);
|
|
206
|
+
return /* @__PURE__ */ jsxs2(
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
ref,
|
|
210
|
+
type,
|
|
211
|
+
disabled: isDisabled,
|
|
212
|
+
"aria-busy": loading || void 0,
|
|
213
|
+
onClick: handleClick,
|
|
214
|
+
className: cn(
|
|
215
|
+
"relative overflow-hidden inline-flex items-center justify-center font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
216
|
+
isDisabled && "pointer-events-none opacity-50",
|
|
217
|
+
getVariantClasses(variant, color),
|
|
218
|
+
iconOnlySizeClasses[size],
|
|
219
|
+
roundnessClasses2[roundness],
|
|
220
|
+
className
|
|
221
|
+
),
|
|
222
|
+
...rest,
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx2(Ripple, { ref: rippleRef, color: getRippleColor(variant, color) }),
|
|
225
|
+
loading ? /* @__PURE__ */ jsx2(Spinner, { size: spinnerSize[size], color: "inherit" }) : /* @__PURE__ */ jsx2("span", { className: "z-10 inline-flex items-center justify-center shrink-0", children })
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
IconButton.displayName = "IconButton";
|
|
232
|
+
var IconButton_default = IconButton;
|
|
233
|
+
|
|
234
|
+
// src/components/Feedback/Tooltip/Tooltip.tsx
|
|
235
|
+
import { Fragment, useRef as useRef3, useState } from "react";
|
|
236
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
181
237
|
function Tooltip(props) {
|
|
182
238
|
const {
|
|
183
239
|
label,
|
|
@@ -189,56 +245,57 @@ function Tooltip(props) {
|
|
|
189
245
|
popoverProps = {},
|
|
190
246
|
...containerProps
|
|
191
247
|
} = props;
|
|
192
|
-
const container =
|
|
248
|
+
const container = useRef3(null);
|
|
193
249
|
const [open, setOpen] = useState(false);
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
children
|
|
204
|
-
|
|
205
|
-
|
|
250
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
251
|
+
/* @__PURE__ */ jsx3(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
...containerProps,
|
|
255
|
+
ref: container,
|
|
256
|
+
className: cn("cursor-pointer", className),
|
|
257
|
+
onMouseEnter: () => setOpen(true),
|
|
258
|
+
onMouseLeave: () => setOpen(false),
|
|
259
|
+
children
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ jsx3(
|
|
263
|
+
Popover,
|
|
264
|
+
{
|
|
265
|
+
...popoverProps,
|
|
266
|
+
open,
|
|
267
|
+
targetRef: container,
|
|
268
|
+
position: labelPosition,
|
|
269
|
+
closeOnClickOutside: false,
|
|
270
|
+
className: cn("p-1", popoverProps.className),
|
|
271
|
+
children: /* @__PURE__ */ jsx3(
|
|
272
|
+
"div",
|
|
206
273
|
{
|
|
207
|
-
...
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
className: cn("p-1", popoverProps.className),
|
|
212
|
-
children: /* @__PURE__ */ jsx2(
|
|
213
|
-
"div",
|
|
274
|
+
...labelContainerProps,
|
|
275
|
+
className: cn(
|
|
276
|
+
"bg-bg-secondary text-text",
|
|
277
|
+
size !== "none" ? `text-${size} rounded-${size}` : "",
|
|
214
278
|
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
none: "py-0 px-0"
|
|
226
|
-
}[size],
|
|
227
|
-
labelContainerProps.className
|
|
228
|
-
),
|
|
229
|
-
children: label
|
|
230
|
-
}
|
|
231
|
-
)
|
|
279
|
+
xs: "py-1 px-2",
|
|
280
|
+
sm: "py-2 px-4",
|
|
281
|
+
md: "py-3 px-6",
|
|
282
|
+
lg: "py-4 px-8",
|
|
283
|
+
xl: "py-5 px-10",
|
|
284
|
+
none: "py-0 px-0"
|
|
285
|
+
}[size],
|
|
286
|
+
labelContainerProps.className
|
|
287
|
+
),
|
|
288
|
+
children: label
|
|
232
289
|
}
|
|
233
290
|
)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] });
|
|
237
294
|
}
|
|
238
295
|
|
|
239
296
|
// src/components/Forms/InputField/InputField.tsx
|
|
240
|
-
import { useLayoutEffect, useRef as
|
|
241
|
-
import { jsx as
|
|
297
|
+
import { useLayoutEffect, useRef as useRef4, useState as useState2 } from "react";
|
|
298
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
242
299
|
function InputField(props) {
|
|
243
300
|
const {
|
|
244
301
|
validateValue,
|
|
@@ -247,7 +304,7 @@ function InputField(props) {
|
|
|
247
304
|
errorColor = "rgb(240, 70, 70)",
|
|
248
305
|
...inputProps
|
|
249
306
|
} = props;
|
|
250
|
-
const initRef =
|
|
307
|
+
const initRef = useRef4({ isUserTyped: false });
|
|
251
308
|
const [error, setError] = useState2("");
|
|
252
309
|
function handleError(value) {
|
|
253
310
|
if (!initRef.current.isUserTyped) return;
|
|
@@ -278,8 +335,8 @@ function InputField(props) {
|
|
|
278
335
|
handleError(props.value);
|
|
279
336
|
}
|
|
280
337
|
}, [props.value]);
|
|
281
|
-
return /* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
338
|
+
return /* @__PURE__ */ jsxs4("div", { ...containerProps, children: [
|
|
339
|
+
/* @__PURE__ */ jsx4(
|
|
283
340
|
Input,
|
|
284
341
|
{
|
|
285
342
|
...inputProps,
|
|
@@ -291,13 +348,13 @@ function InputField(props) {
|
|
|
291
348
|
onBlur: handleOnBlur
|
|
292
349
|
}
|
|
293
350
|
),
|
|
294
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ jsx4("p", { className: "pl-1 text-xs", style: { color: errorColor, display: error ? "block" : "none" }, children: error })
|
|
295
352
|
] });
|
|
296
353
|
}
|
|
297
354
|
|
|
298
355
|
// src/components/Forms/Select/index.tsx
|
|
299
|
-
import { Fragment, useRef as
|
|
300
|
-
import { jsx as
|
|
356
|
+
import { Fragment as Fragment2, useRef as useRef5, useState as useState3 } from "react";
|
|
357
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
301
358
|
function Select(props) {
|
|
302
359
|
const {
|
|
303
360
|
options = [{ label: "None", value: "" }],
|
|
@@ -305,8 +362,8 @@ function Select(props) {
|
|
|
305
362
|
optionsPosition = "bottom-start",
|
|
306
363
|
...inputProps
|
|
307
364
|
} = props;
|
|
308
|
-
const container =
|
|
309
|
-
const optionsContainer =
|
|
365
|
+
const container = useRef5(null);
|
|
366
|
+
const optionsContainer = useRef5(null);
|
|
310
367
|
const [isOpen, setIsOpen] = useState3(false);
|
|
311
368
|
const [activeOption, setActiveOption] = useState3("");
|
|
312
369
|
useKeyboardShortcuts([
|
|
@@ -362,8 +419,8 @@ function Select(props) {
|
|
|
362
419
|
const input = container.current?.querySelector("input");
|
|
363
420
|
if (input) input.value = options2.label;
|
|
364
421
|
}
|
|
365
|
-
return /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
423
|
+
/* @__PURE__ */ jsx5(
|
|
367
424
|
InputField,
|
|
368
425
|
{
|
|
369
426
|
...inputProps,
|
|
@@ -378,13 +435,13 @@ function Select(props) {
|
|
|
378
435
|
setIsOpen(false);
|
|
379
436
|
inputProps.onBlur?.(event);
|
|
380
437
|
},
|
|
381
|
-
endIcon: props.endIcon ? props.endIcon : /* @__PURE__ */
|
|
438
|
+
endIcon: props.endIcon ? props.endIcon : /* @__PURE__ */ jsx5("div", { className: "relative h-full aspect-square pr-1 flex items-center justify-center", children: /* @__PURE__ */ jsx5("div", { className: cn(
|
|
382
439
|
"w-0 h-0 border-l-[5px] border-r-[5px] border-t-[5px] border-l-transparent border-r-transparent border-t-gray-600",
|
|
383
440
|
isOpen ? "rotate-180" : ""
|
|
384
441
|
) }) })
|
|
385
442
|
}
|
|
386
443
|
),
|
|
387
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ jsx5(
|
|
388
445
|
Popover,
|
|
389
446
|
{
|
|
390
447
|
open: isOpen,
|
|
@@ -397,23 +454,23 @@ function Select(props) {
|
|
|
397
454
|
onOpen: (node) => {
|
|
398
455
|
node.style.minWidth = `${container.current?.offsetWidth ?? 0}px`;
|
|
399
456
|
},
|
|
400
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ jsx5(
|
|
401
458
|
"div",
|
|
402
459
|
{
|
|
403
460
|
ref: optionsContainer,
|
|
404
|
-
className: "w-full max-h-[200px] overflow-y-scroll scrollbar-hide [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden bg-
|
|
461
|
+
className: "w-full max-h-[200px] overflow-y-scroll scrollbar-hide [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden bg-bg-secondary shadow-md border-2 border-border text-text p-1 rounded-md flex flex-col gap-1",
|
|
405
462
|
onMouseDown: (event) => {
|
|
406
463
|
event.preventDefault();
|
|
407
464
|
},
|
|
408
|
-
children: options.map((option) => renderOption ? renderOption(option, activeOption === option.value) : /* @__PURE__ */
|
|
465
|
+
children: options.map((option) => renderOption ? renderOption(option, activeOption === option.value) : /* @__PURE__ */ jsx5(
|
|
409
466
|
"div",
|
|
410
467
|
{
|
|
411
468
|
id: option.value,
|
|
412
469
|
onClick: () => handleOnChange(option),
|
|
413
470
|
className: cn(
|
|
414
|
-
"p-2 hover:bg-
|
|
415
|
-
activeOption === option.value ? "border-2 border-
|
|
416
|
-
option.value === props.value ? "bg-
|
|
471
|
+
"p-2 hover:bg-bg rounded cursor-pointer w-full",
|
|
472
|
+
activeOption === option.value ? "border-2 border-primary" : "",
|
|
473
|
+
option.value === props.value ? "bg-bg" : ""
|
|
417
474
|
),
|
|
418
475
|
children: option.label
|
|
419
476
|
},
|
|
@@ -427,8 +484,8 @@ function Select(props) {
|
|
|
427
484
|
}
|
|
428
485
|
|
|
429
486
|
// src/components/Forms/MultiSelect/index.tsx
|
|
430
|
-
import { Fragment as
|
|
431
|
-
import { jsx as
|
|
487
|
+
import { Fragment as Fragment3, useRef as useRef6, useState as useState4 } from "react";
|
|
488
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
432
489
|
function MultiSelect(props) {
|
|
433
490
|
const {
|
|
434
491
|
renderOption,
|
|
@@ -439,8 +496,8 @@ function MultiSelect(props) {
|
|
|
439
496
|
...inputProps
|
|
440
497
|
} = props;
|
|
441
498
|
const labelMap = new Map(options.map((option) => [option.value, option.label]));
|
|
442
|
-
const container =
|
|
443
|
-
const optionsContainer =
|
|
499
|
+
const container = useRef6(null);
|
|
500
|
+
const optionsContainer = useRef6(null);
|
|
444
501
|
const [isOpen, setIsOpen] = useState4(false);
|
|
445
502
|
const [activeOption, setActiveOption] = useState4("");
|
|
446
503
|
useKeyboardShortcuts([
|
|
@@ -503,8 +560,8 @@ function MultiSelect(props) {
|
|
|
503
560
|
const input = container.current?.querySelector("input");
|
|
504
561
|
if (input) input.value = newValue.map((value2) => labelMap.get(value2)).join(", ") || "";
|
|
505
562
|
}
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
564
|
+
/* @__PURE__ */ jsx6(
|
|
508
565
|
InputField,
|
|
509
566
|
{
|
|
510
567
|
...inputProps,
|
|
@@ -519,13 +576,13 @@ function MultiSelect(props) {
|
|
|
519
576
|
setIsOpen(false);
|
|
520
577
|
inputProps.onBlur?.(event);
|
|
521
578
|
},
|
|
522
|
-
endIcon: props.endIcon ? props.endIcon : /* @__PURE__ */
|
|
579
|
+
endIcon: props.endIcon ? props.endIcon : /* @__PURE__ */ jsx6("div", { className: "relative h-full aspect-square pr-1 flex items-center justify-center", children: /* @__PURE__ */ jsx6("div", { className: cn(
|
|
523
580
|
"w-0 h-0 border-l-[5px] border-r-[5px] border-t-[5px] border-l-transparent border-r-transparent border-t-gray-600",
|
|
524
581
|
isOpen ? "rotate-180" : ""
|
|
525
582
|
) }) })
|
|
526
583
|
}
|
|
527
584
|
),
|
|
528
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ jsx6(
|
|
529
586
|
Popover,
|
|
530
587
|
{
|
|
531
588
|
open: isOpen,
|
|
@@ -538,23 +595,23 @@ function MultiSelect(props) {
|
|
|
538
595
|
onOpen: (node) => {
|
|
539
596
|
node.style.minWidth = `${container.current?.offsetWidth ?? 0}px`;
|
|
540
597
|
},
|
|
541
|
-
children: /* @__PURE__ */
|
|
598
|
+
children: /* @__PURE__ */ jsx6(
|
|
542
599
|
"div",
|
|
543
600
|
{
|
|
544
601
|
ref: optionsContainer,
|
|
545
|
-
className: "w-full max-h-[200px] overflow-y-scroll scrollbar-hide [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden bg-
|
|
602
|
+
className: "w-full max-h-[200px] overflow-y-scroll scrollbar-hide [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden bg-bg-secondary p-1 rounded-md flex flex-col gap-1 border-border border-2",
|
|
546
603
|
onMouseDown: (event) => {
|
|
547
604
|
event.preventDefault();
|
|
548
605
|
},
|
|
549
|
-
children: options.map((option) => renderOption ? renderOption(option, activeOption === option.value) : /* @__PURE__ */
|
|
606
|
+
children: options.map((option) => renderOption ? renderOption(option, activeOption === option.value) : /* @__PURE__ */ jsx6(
|
|
550
607
|
"div",
|
|
551
608
|
{
|
|
552
609
|
id: option.value,
|
|
553
610
|
onClick: () => handleOnChange(option),
|
|
554
611
|
className: cn(
|
|
555
|
-
"p-2 hover:bg-
|
|
556
|
-
activeOption === option.value ? "border-2 border-
|
|
557
|
-
props.value?.includes(option.value) ? "bg-
|
|
612
|
+
"p-2 hover:bg-bg rounded cursor-pointer w-full",
|
|
613
|
+
activeOption === option.value ? "border-2 border-primary" : "",
|
|
614
|
+
props.value?.includes(option.value) ? "bg-bg" : ""
|
|
558
615
|
),
|
|
559
616
|
children: option.label
|
|
560
617
|
},
|
|
@@ -566,10 +623,455 @@ function MultiSelect(props) {
|
|
|
566
623
|
)
|
|
567
624
|
] });
|
|
568
625
|
}
|
|
626
|
+
|
|
627
|
+
// src/components/DataDisplay/Table/Table.tsx
|
|
628
|
+
import { forwardRef as forwardRef3, useMemo } from "react";
|
|
629
|
+
|
|
630
|
+
// src/components/DataDisplay/Table/TableContext.tsx
|
|
631
|
+
import { createContext, useContext } from "react";
|
|
632
|
+
var TableContext = createContext({
|
|
633
|
+
size: "medium",
|
|
634
|
+
stickyHeader: false
|
|
635
|
+
});
|
|
636
|
+
var useTableContext = () => useContext(TableContext);
|
|
637
|
+
|
|
638
|
+
// src/components/DataDisplay/Table/Table.tsx
|
|
639
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
640
|
+
var Table = forwardRef3(
|
|
641
|
+
({ className = "", children, stickyHeader = false, size = "medium", ...props }, ref) => {
|
|
642
|
+
const value = useMemo(() => ({ size, stickyHeader }), [size, stickyHeader]);
|
|
643
|
+
return /* @__PURE__ */ jsx7(TableContext.Provider, { value, children: /* @__PURE__ */ jsx7(
|
|
644
|
+
"table",
|
|
645
|
+
{
|
|
646
|
+
ref,
|
|
647
|
+
className: `w-full caption-bottom text-sm border-collapse text-text ${stickyHeader ? "relative" : ""} ${className}`,
|
|
648
|
+
...props,
|
|
649
|
+
children
|
|
650
|
+
}
|
|
651
|
+
) });
|
|
652
|
+
}
|
|
653
|
+
);
|
|
654
|
+
Table.displayName = "Table";
|
|
655
|
+
var Table_default = Table;
|
|
656
|
+
|
|
657
|
+
// src/components/DataDisplay/Table/TableBody.tsx
|
|
658
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
659
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
660
|
+
var TableBody = forwardRef4(
|
|
661
|
+
({ className = "", children, ...props }, ref) => {
|
|
662
|
+
return /* @__PURE__ */ jsx8(
|
|
663
|
+
"tbody",
|
|
664
|
+
{
|
|
665
|
+
ref,
|
|
666
|
+
className: `[&_tr:last-child]:border-0 [&_tr]:border-border ${className}`,
|
|
667
|
+
...props,
|
|
668
|
+
children
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
TableBody.displayName = "TableBody";
|
|
674
|
+
var TableBody_default = TableBody;
|
|
675
|
+
|
|
676
|
+
// src/components/DataDisplay/Table/TableCell.tsx
|
|
677
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
678
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
679
|
+
var TableCell = forwardRef5(
|
|
680
|
+
({ className = "", align = "left", padding, variant, component, children, ...props }, ref) => {
|
|
681
|
+
const { size, stickyHeader } = useTableContext();
|
|
682
|
+
const isHead = variant === "head";
|
|
683
|
+
const Component = component || (isHead ? "th" : "td");
|
|
684
|
+
const alignClasses = {
|
|
685
|
+
left: "text-left",
|
|
686
|
+
center: "text-center",
|
|
687
|
+
right: "text-right",
|
|
688
|
+
justify: "text-justify",
|
|
689
|
+
inherit: "text-inherit"
|
|
690
|
+
};
|
|
691
|
+
const paddingClasses = {
|
|
692
|
+
normal: size === "small" ? "p-2" : "p-4",
|
|
693
|
+
none: "p-0",
|
|
694
|
+
checkbox: "p-0 w-[48px] text-center"
|
|
695
|
+
};
|
|
696
|
+
const effectivePadding = padding || "normal";
|
|
697
|
+
return /* @__PURE__ */ jsx9(
|
|
698
|
+
Component,
|
|
699
|
+
{
|
|
700
|
+
ref,
|
|
701
|
+
className: `align-middle transition-colors [&:has([role=checkbox])]:pr-0 ${isHead ? "font-semibold text-text bg-bg-secondary" : "text-text-secondary"} ${stickyHeader && isHead ? "sticky top-0 z-10 shadow-[inset_0_-1px_0_var(--border)]" : ""} ${alignClasses[align]} ${paddingClasses[effectivePadding]} ${className}`,
|
|
702
|
+
...props,
|
|
703
|
+
children
|
|
704
|
+
}
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
);
|
|
708
|
+
TableCell.displayName = "TableCell";
|
|
709
|
+
var TableCell_default = TableCell;
|
|
710
|
+
|
|
711
|
+
// src/components/DataDisplay/Table/TableContainer.tsx
|
|
712
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
713
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
714
|
+
var TableContainer = forwardRef6(
|
|
715
|
+
({ className = "", children, ...props }, ref) => {
|
|
716
|
+
return /* @__PURE__ */ jsx10(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
ref,
|
|
720
|
+
className: `w-full overflow-auto rounded-lg border border-border bg-bg-secondary shadow-sm ${className}`,
|
|
721
|
+
...props,
|
|
722
|
+
children
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
TableContainer.displayName = "TableContainer";
|
|
728
|
+
var TableContainer_default = TableContainer;
|
|
729
|
+
|
|
730
|
+
// src/components/DataDisplay/Table/TableFooter.tsx
|
|
731
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
732
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
733
|
+
var TableFooter = forwardRef7(
|
|
734
|
+
({ className = "", children, ...props }, ref) => {
|
|
735
|
+
return /* @__PURE__ */ jsx11(
|
|
736
|
+
"tfoot",
|
|
737
|
+
{
|
|
738
|
+
ref,
|
|
739
|
+
className: `border-t border-border bg-bg-secondary/50 font-medium [&>tr]:last:border-b-0 ${className}`,
|
|
740
|
+
...props,
|
|
741
|
+
children
|
|
742
|
+
}
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
TableFooter.displayName = "TableFooter";
|
|
747
|
+
var TableFooter_default = TableFooter;
|
|
748
|
+
|
|
749
|
+
// src/components/DataDisplay/Table/TableHead.tsx
|
|
750
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
751
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
752
|
+
var TableHead = forwardRef8(
|
|
753
|
+
({ className = "", children, ...props }, ref) => {
|
|
754
|
+
return /* @__PURE__ */ jsx12(
|
|
755
|
+
"thead",
|
|
756
|
+
{
|
|
757
|
+
ref,
|
|
758
|
+
className: `[&_tr]:border-b [&_tr]:border-border bg-bg-secondary/50 ${className}`,
|
|
759
|
+
...props,
|
|
760
|
+
children
|
|
761
|
+
}
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
TableHead.displayName = "TableHead";
|
|
766
|
+
var TableHead_default = TableHead;
|
|
767
|
+
|
|
768
|
+
// src/components/DataDisplay/Table/TableRow.tsx
|
|
769
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
770
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
771
|
+
var TableRow = forwardRef9(
|
|
772
|
+
({ className = "", children, hover = false, selected = false, ...props }, ref) => {
|
|
773
|
+
return /* @__PURE__ */ jsx13(
|
|
774
|
+
"tr",
|
|
775
|
+
{
|
|
776
|
+
ref,
|
|
777
|
+
className: `border-b border-border transition-colors ${hover ? "hover:bg-bg/50" : ""} ${selected ? "bg-bg/80" : ""} ${className}`,
|
|
778
|
+
...props,
|
|
779
|
+
children
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
);
|
|
784
|
+
TableRow.displayName = "TableRow";
|
|
785
|
+
var TableRow_default = TableRow;
|
|
786
|
+
|
|
787
|
+
// src/components/Overlay/Dialog/Dialog.tsx
|
|
788
|
+
import { createPortal } from "react-dom";
|
|
789
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
790
|
+
function Dialog(props) {
|
|
791
|
+
const {
|
|
792
|
+
open,
|
|
793
|
+
onClose,
|
|
794
|
+
children,
|
|
795
|
+
className,
|
|
796
|
+
size = "auto",
|
|
797
|
+
closeOnEsc = true,
|
|
798
|
+
backdropClose = true,
|
|
799
|
+
animationDuration = 220
|
|
800
|
+
} = props;
|
|
801
|
+
const sizeClasses2 = {
|
|
802
|
+
xs: "max-w-xs",
|
|
803
|
+
sm: "max-w-sm",
|
|
804
|
+
md: "max-w-md",
|
|
805
|
+
lg: "max-w-lg",
|
|
806
|
+
xl: "max-w-xl",
|
|
807
|
+
full: "max-w-full",
|
|
808
|
+
auto: "max-w-lg"
|
|
809
|
+
};
|
|
810
|
+
useKeyboardShortcuts([
|
|
811
|
+
{
|
|
812
|
+
key: "escape",
|
|
813
|
+
options: { preventDefault: true },
|
|
814
|
+
callback: () => {
|
|
815
|
+
if (closeOnEsc && open && onClose) onClose();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
]);
|
|
819
|
+
if (typeof window === "undefined") return null;
|
|
820
|
+
return createPortal(
|
|
821
|
+
/* @__PURE__ */ jsx14(
|
|
822
|
+
ShowWithAnimation,
|
|
823
|
+
{
|
|
824
|
+
when: open,
|
|
825
|
+
removeOnHide: true,
|
|
826
|
+
containerProps: {
|
|
827
|
+
style: { position: "fixed" },
|
|
828
|
+
className: "fixed inset-0 w-screen h-screen flex items-center justify-center z-[9999]"
|
|
829
|
+
},
|
|
830
|
+
animationDuration: 1.5 * animationDuration,
|
|
831
|
+
animationStyle: {
|
|
832
|
+
children: {
|
|
833
|
+
from: {
|
|
834
|
+
opacity: 0,
|
|
835
|
+
backdropFilter: "blur(0)"
|
|
836
|
+
},
|
|
837
|
+
active: {
|
|
838
|
+
opacity: 1,
|
|
839
|
+
backdropFilter: "blur(10px)"
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
className: "w-full h-full bg-[#0004] flex items-center justify-center",
|
|
844
|
+
onClick: (event) => {
|
|
845
|
+
if (backdropClose && event.target === event.currentTarget) {
|
|
846
|
+
onClose?.();
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
children: /* @__PURE__ */ jsx14(
|
|
850
|
+
ShowWithAnimation,
|
|
851
|
+
{
|
|
852
|
+
when: open,
|
|
853
|
+
animationDuration,
|
|
854
|
+
role: "dialog",
|
|
855
|
+
"aria-modal": "true",
|
|
856
|
+
className: cn(
|
|
857
|
+
"relative z-10 w-full mx-4 bg-bg rounded-lg shadow-lg overflow-hidden",
|
|
858
|
+
sizeClasses2[size],
|
|
859
|
+
className
|
|
860
|
+
),
|
|
861
|
+
children
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
document.body
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/components/Overlay/Dialog/DialogHeader.tsx
|
|
871
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
872
|
+
function DialogHeader(props) {
|
|
873
|
+
const { title, children, ...rest } = props;
|
|
874
|
+
return /* @__PURE__ */ jsxs7("div", { ...rest, className: "px-6 py-4 border-b border-border", children: [
|
|
875
|
+
/* @__PURE__ */ jsx15(Show, { when: !!title, children: /* @__PURE__ */ jsx15("h1", { className: "text-lg font-medium", children: title }) }),
|
|
876
|
+
children
|
|
877
|
+
] });
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/components/Overlay/Dialog/DialogFooter.tsx
|
|
881
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
882
|
+
function DialogFooter(props) {
|
|
883
|
+
return /* @__PURE__ */ jsx16(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
...props,
|
|
887
|
+
className: cn("px-6 py-4 border-t flex items-center justify-end border-border", props.className)
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/components/Overlay/Dialog/DialogContent.tsx
|
|
893
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
894
|
+
function DialogContent(props) {
|
|
895
|
+
return /* @__PURE__ */ jsx17(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
...props,
|
|
899
|
+
className: cn("p-6", props.className)
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// src/components/Overlay/Drawer/Drawer.tsx
|
|
905
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
906
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
907
|
+
function Drawer(props) {
|
|
908
|
+
const {
|
|
909
|
+
open,
|
|
910
|
+
onClose,
|
|
911
|
+
children,
|
|
912
|
+
rounded = 0,
|
|
913
|
+
side = "right",
|
|
914
|
+
closeOnEsc = true,
|
|
915
|
+
size: _size = "md",
|
|
916
|
+
backdropClose = true,
|
|
917
|
+
animationDuration = 220
|
|
918
|
+
} = props;
|
|
919
|
+
useKeyboardShortcuts([
|
|
920
|
+
{
|
|
921
|
+
key: "escape",
|
|
922
|
+
options: { preventDefault: true },
|
|
923
|
+
callback: () => {
|
|
924
|
+
if (closeOnEsc && open && onClose) onClose?.();
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
]);
|
|
928
|
+
if (typeof window === "undefined") return null;
|
|
929
|
+
const isHorizontal = side === "left" || side === "right";
|
|
930
|
+
const size = (() => {
|
|
931
|
+
if (typeof _size === "number") return _size + "px";
|
|
932
|
+
return {
|
|
933
|
+
"xs": "20",
|
|
934
|
+
"sm": "35",
|
|
935
|
+
"md": "50",
|
|
936
|
+
"lg": "75",
|
|
937
|
+
"xl": "90"
|
|
938
|
+
}[_size] + (isHorizontal ? "vw" : "vh");
|
|
939
|
+
})();
|
|
940
|
+
return createPortal2(
|
|
941
|
+
/* @__PURE__ */ jsx18(
|
|
942
|
+
ShowWithAnimation,
|
|
943
|
+
{
|
|
944
|
+
when: open,
|
|
945
|
+
removeOnHide: true,
|
|
946
|
+
containerProps: {
|
|
947
|
+
style: { position: "fixed" },
|
|
948
|
+
className: `fixed inset-0 w-screen h-screen flex`
|
|
949
|
+
},
|
|
950
|
+
animationDuration: 1.5 * animationDuration,
|
|
951
|
+
animationStyle: {
|
|
952
|
+
children: {
|
|
953
|
+
from: { opacity: 0, backdropFilter: "blur(0)" },
|
|
954
|
+
active: { opacity: 1, backdropFilter: "blur(8px)" }
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
className: cn(
|
|
958
|
+
"w-full h-full bg-[#0004] flex",
|
|
959
|
+
{
|
|
960
|
+
"left": "justify-start items-center",
|
|
961
|
+
"right": "justify-end items-center ",
|
|
962
|
+
"top": "justify-center items-start",
|
|
963
|
+
"bottom": "justify-center items-end"
|
|
964
|
+
}[side]
|
|
965
|
+
),
|
|
966
|
+
onClick: (event) => {
|
|
967
|
+
if (backdropClose && event.target === event.currentTarget) {
|
|
968
|
+
onClose?.();
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
children: /* @__PURE__ */ jsx18(
|
|
972
|
+
ShowWithAnimation,
|
|
973
|
+
{
|
|
974
|
+
when: open,
|
|
975
|
+
role: "dialog",
|
|
976
|
+
"aria-modal": "true",
|
|
977
|
+
containerProps: {
|
|
978
|
+
className: "w-full h-full",
|
|
979
|
+
style: {
|
|
980
|
+
maxWidth: isHorizontal ? size : "100%",
|
|
981
|
+
maxHeight: !isHorizontal ? size : "100%"
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
className: "w-full h-full bg-bg flex flex-col overflow-hidden",
|
|
985
|
+
style: {
|
|
986
|
+
borderRadius: {
|
|
987
|
+
left: `0 ${rounded}px ${rounded}px 0`,
|
|
988
|
+
right: `${rounded}px 0 0 ${rounded}px`,
|
|
989
|
+
top: `0 0 ${rounded}px ${rounded}px`,
|
|
990
|
+
bottom: `${rounded}px ${rounded}px 0 0`
|
|
991
|
+
}[side]
|
|
992
|
+
},
|
|
993
|
+
animationDuration,
|
|
994
|
+
animationStyle: {
|
|
995
|
+
children: {
|
|
996
|
+
active: { transform: "translateX(0) translateY(0)", opacity: 1 },
|
|
997
|
+
from: {
|
|
998
|
+
opacity: 0,
|
|
999
|
+
transform: {
|
|
1000
|
+
left: "translateX(-100%)",
|
|
1001
|
+
right: "translateX(100%)",
|
|
1002
|
+
top: "translateY(-100%)",
|
|
1003
|
+
bottom: "translateY(100%)"
|
|
1004
|
+
}[side]
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
children
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
document.body
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// src/components/Overlay/Drawer/DrawerContent.tsx
|
|
1018
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1019
|
+
function DrawerContent({ children, className, style }) {
|
|
1020
|
+
return /* @__PURE__ */ jsx19(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
className: cn("overflow-auto flex-1 p-4 relative hide-scrollbar", className),
|
|
1024
|
+
style,
|
|
1025
|
+
children
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/components/Overlay/Drawer/DrawerHeader.tsx
|
|
1031
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1032
|
+
function DrawerHeader({ children, className, style }) {
|
|
1033
|
+
return /* @__PURE__ */ jsx20(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
className: cn("sticky top-0 z-20 backdrop-blur-sm bg-white/60 px-4 py-3 border-b border-border", className),
|
|
1037
|
+
style,
|
|
1038
|
+
children
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// src/components/Overlay/Drawer/DrawerFooter.tsx
|
|
1044
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1045
|
+
function DrawerFooter({ children, className, style }) {
|
|
1046
|
+
return /* @__PURE__ */ jsx21(
|
|
1047
|
+
"div",
|
|
1048
|
+
{
|
|
1049
|
+
className: cn("sticky bottom-0 z-20 backdrop-blur-sm bg-white/60 px-4 py-3 border-t border-border", className),
|
|
1050
|
+
style,
|
|
1051
|
+
children
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
569
1055
|
export {
|
|
570
1056
|
Button_default as Button,
|
|
1057
|
+
Dialog,
|
|
1058
|
+
DialogContent,
|
|
1059
|
+
DialogFooter,
|
|
1060
|
+
DialogHeader,
|
|
1061
|
+
Drawer,
|
|
1062
|
+
DrawerContent,
|
|
1063
|
+
DrawerFooter,
|
|
1064
|
+
DrawerHeader,
|
|
1065
|
+
IconButton_default as IconButton,
|
|
571
1066
|
InputField,
|
|
572
1067
|
MultiSelect,
|
|
573
1068
|
Select,
|
|
1069
|
+
Table_default as Table,
|
|
1070
|
+
TableBody_default as TableBody,
|
|
1071
|
+
TableCell_default as TableCell,
|
|
1072
|
+
TableContainer_default as TableContainer,
|
|
1073
|
+
TableFooter_default as TableFooter,
|
|
1074
|
+
TableHead_default as TableHead,
|
|
1075
|
+
TableRow_default as TableRow,
|
|
574
1076
|
Tooltip
|
|
575
1077
|
};
|