@optigrit/optigrit-ui 0.0.1 → 0.0.2
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/{chunk-2LJSVQ6B.js → chunk-EUAKUHDG.js} +109 -16
- package/dist/components/index.d.ts +94 -2
- package/dist/components/index.js +499 -102
- package/dist/core/index.d.ts +55 -1
- package/dist/core/index.js +7 -3
- package/index.css +165 -125
- package/package.json +3 -3
- package/tailwind.preset.js +1 -1
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-EUAKUHDG.js";
|
|
6
10
|
import "../chunk-MCQS3QNN.js";
|
|
7
11
|
import {
|
|
8
12
|
useKeyboardShortcuts
|
|
@@ -12,81 +16,49 @@ 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
22
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
23
|
var variantClasses = {
|
|
19
|
-
primary: "bg-primary text-
|
|
20
|
-
secondary: "bg-secondary text-
|
|
21
|
-
outline: "border border-
|
|
22
|
-
ghost: "
|
|
23
|
-
destructive: "bg-
|
|
24
|
+
primary: "bg-primary text-white shadow-xl",
|
|
25
|
+
secondary: "bg-secondary text-white shadow-xl",
|
|
26
|
+
outline: "border border-primary/70 text-primary hover:border-primary hover:bg-primary/[0.04]",
|
|
27
|
+
ghost: "text-primary hover:bg-primary/[0.04]",
|
|
28
|
+
destructive: "bg-error text-white shadow-lg",
|
|
24
29
|
link: "text-primary underline-offset-4 hover:underline"
|
|
25
30
|
};
|
|
26
31
|
var sizeClasses = {
|
|
27
|
-
xs: "
|
|
28
|
-
sm: "
|
|
29
|
-
md: "
|
|
30
|
-
lg: "
|
|
31
|
-
xl: "
|
|
32
|
+
xs: "h-7 px-[10px] text-[13px] gap-[8px]",
|
|
33
|
+
sm: "h-[30px] px-[10px] text-[13px] gap-[8px]",
|
|
34
|
+
md: "h-9 px-6 py-3 text-[14px] gap-[8px]",
|
|
35
|
+
lg: "h-11 px-[22px] text-[16px] gap-[8px]",
|
|
36
|
+
xl: "h-14 px-[22px] text-[16px] gap-[8px]"
|
|
32
37
|
};
|
|
33
38
|
var iconOnlySizeClasses = {
|
|
34
|
-
xs: "text-xs
|
|
35
|
-
sm: "text-sm
|
|
36
|
-
md: "text-
|
|
37
|
-
lg: "text-base
|
|
38
|
-
xl: "text-lg
|
|
39
|
+
xs: "text-xs h-7 w-7",
|
|
40
|
+
sm: "text-sm h-9 w-9",
|
|
41
|
+
md: "text-base h-11 w-11",
|
|
42
|
+
lg: "text-base h-13 w-13",
|
|
43
|
+
xl: "text-lg h-15 w-15"
|
|
39
44
|
};
|
|
40
45
|
var roundnessClasses = {
|
|
41
46
|
none: "rounded-none",
|
|
42
|
-
sm: "rounded-
|
|
43
|
-
md: "rounded-
|
|
44
|
-
lg: "rounded-
|
|
47
|
+
sm: "rounded-[2px]",
|
|
48
|
+
md: "rounded-[12px]",
|
|
49
|
+
lg: "rounded-[16px]",
|
|
45
50
|
full: "rounded-full"
|
|
46
51
|
};
|
|
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
52
|
function cn2(...classes) {
|
|
81
53
|
return classes.filter(Boolean).join(" ");
|
|
82
54
|
}
|
|
83
55
|
var rippleColor = {
|
|
84
|
-
primary: "rgba(255, 255, 255, 0.
|
|
85
|
-
secondary: "rgba(
|
|
86
|
-
outline: "rgba(
|
|
87
|
-
ghost: "rgba(
|
|
88
|
-
destructive: "rgba(255, 255, 255, 0.
|
|
89
|
-
link: "rgba(
|
|
56
|
+
primary: "rgba(255, 255, 255, 0.3)",
|
|
57
|
+
secondary: "rgba(255, 255, 255, 0.3)",
|
|
58
|
+
outline: "rgba(25, 118, 210, 0.1)",
|
|
59
|
+
ghost: "rgba(25, 118, 210, 0.1)",
|
|
60
|
+
destructive: "rgba(255, 255, 255, 0.3)",
|
|
61
|
+
link: "rgba(25, 118, 210, 0.1)"
|
|
90
62
|
};
|
|
91
63
|
var Button = forwardRef(
|
|
92
64
|
({
|
|
@@ -106,43 +78,23 @@ var Button = forwardRef(
|
|
|
106
78
|
onClick,
|
|
107
79
|
...rest
|
|
108
80
|
}, ref) => {
|
|
81
|
+
const rippleRef = useRef(null);
|
|
109
82
|
const isDisabled = disabled || loading;
|
|
110
83
|
const spinnerSize = {
|
|
111
|
-
xs:
|
|
112
|
-
sm:
|
|
113
|
-
md:
|
|
114
|
-
lg:
|
|
115
|
-
xl:
|
|
84
|
+
xs: 12,
|
|
85
|
+
sm: 14,
|
|
86
|
+
md: 16,
|
|
87
|
+
lg: 20,
|
|
88
|
+
xl: 24
|
|
116
89
|
};
|
|
117
90
|
const handleClick = useCallback(
|
|
118
91
|
(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();
|
|
92
|
+
if (!disableRipple && !isDisabled) {
|
|
93
|
+
rippleRef.current?.addRipple(e);
|
|
142
94
|
}
|
|
143
95
|
onClick?.(e);
|
|
144
96
|
},
|
|
145
|
-
[disableRipple,
|
|
97
|
+
[disableRipple, isDisabled, onClick]
|
|
146
98
|
);
|
|
147
99
|
return /* @__PURE__ */ jsxs(
|
|
148
100
|
"button",
|
|
@@ -163,10 +115,11 @@ var Button = forwardRef(
|
|
|
163
115
|
),
|
|
164
116
|
...rest,
|
|
165
117
|
children: [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
children,
|
|
169
|
-
|
|
118
|
+
/* @__PURE__ */ jsx(Ripple, { ref: rippleRef, color: rippleColor[variant] }),
|
|
119
|
+
loading && /* @__PURE__ */ jsx(Spinner, { size: spinnerSize[size], color: "inherit" }),
|
|
120
|
+
!loading && leftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 z-10", children: leftIcon }),
|
|
121
|
+
/* @__PURE__ */ jsx("span", { className: "z-10", children }),
|
|
122
|
+
!loading && rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 z-10", children: rightIcon })
|
|
170
123
|
]
|
|
171
124
|
}
|
|
172
125
|
);
|
|
@@ -176,7 +129,7 @@ Button.displayName = "Button";
|
|
|
176
129
|
var Button_default = Button;
|
|
177
130
|
|
|
178
131
|
// src/components/Feedback/Tooltip/Tooltip.tsx
|
|
179
|
-
import { useRef, useState } from "react";
|
|
132
|
+
import { useRef as useRef2, useState } from "react";
|
|
180
133
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
181
134
|
function Tooltip(props) {
|
|
182
135
|
const {
|
|
@@ -189,7 +142,7 @@ function Tooltip(props) {
|
|
|
189
142
|
popoverProps = {},
|
|
190
143
|
...containerProps
|
|
191
144
|
} = props;
|
|
192
|
-
const container =
|
|
145
|
+
const container = useRef2(null);
|
|
193
146
|
const [open, setOpen] = useState(false);
|
|
194
147
|
return /* @__PURE__ */ jsxs2(
|
|
195
148
|
"div",
|
|
@@ -237,7 +190,7 @@ function Tooltip(props) {
|
|
|
237
190
|
}
|
|
238
191
|
|
|
239
192
|
// src/components/Forms/InputField/InputField.tsx
|
|
240
|
-
import { useLayoutEffect, useRef as
|
|
193
|
+
import { useLayoutEffect, useRef as useRef3, useState as useState2 } from "react";
|
|
241
194
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
242
195
|
function InputField(props) {
|
|
243
196
|
const {
|
|
@@ -247,7 +200,7 @@ function InputField(props) {
|
|
|
247
200
|
errorColor = "rgb(240, 70, 70)",
|
|
248
201
|
...inputProps
|
|
249
202
|
} = props;
|
|
250
|
-
const initRef =
|
|
203
|
+
const initRef = useRef3({ isUserTyped: false });
|
|
251
204
|
const [error, setError] = useState2("");
|
|
252
205
|
function handleError(value) {
|
|
253
206
|
if (!initRef.current.isUserTyped) return;
|
|
@@ -296,7 +249,7 @@ function InputField(props) {
|
|
|
296
249
|
}
|
|
297
250
|
|
|
298
251
|
// src/components/Forms/Select/index.tsx
|
|
299
|
-
import { Fragment, useRef as
|
|
252
|
+
import { Fragment, useRef as useRef4, useState as useState3 } from "react";
|
|
300
253
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
301
254
|
function Select(props) {
|
|
302
255
|
const {
|
|
@@ -305,8 +258,8 @@ function Select(props) {
|
|
|
305
258
|
optionsPosition = "bottom-start",
|
|
306
259
|
...inputProps
|
|
307
260
|
} = props;
|
|
308
|
-
const container =
|
|
309
|
-
const optionsContainer =
|
|
261
|
+
const container = useRef4(null);
|
|
262
|
+
const optionsContainer = useRef4(null);
|
|
310
263
|
const [isOpen, setIsOpen] = useState3(false);
|
|
311
264
|
const [activeOption, setActiveOption] = useState3("");
|
|
312
265
|
useKeyboardShortcuts([
|
|
@@ -427,7 +380,7 @@ function Select(props) {
|
|
|
427
380
|
}
|
|
428
381
|
|
|
429
382
|
// src/components/Forms/MultiSelect/index.tsx
|
|
430
|
-
import { Fragment as Fragment2, useRef as
|
|
383
|
+
import { Fragment as Fragment2, useRef as useRef5, useState as useState4 } from "react";
|
|
431
384
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
432
385
|
function MultiSelect(props) {
|
|
433
386
|
const {
|
|
@@ -439,8 +392,8 @@ function MultiSelect(props) {
|
|
|
439
392
|
...inputProps
|
|
440
393
|
} = props;
|
|
441
394
|
const labelMap = new Map(options.map((option) => [option.value, option.label]));
|
|
442
|
-
const container =
|
|
443
|
-
const optionsContainer =
|
|
395
|
+
const container = useRef5(null);
|
|
396
|
+
const optionsContainer = useRef5(null);
|
|
444
397
|
const [isOpen, setIsOpen] = useState4(false);
|
|
445
398
|
const [activeOption, setActiveOption] = useState4("");
|
|
446
399
|
useKeyboardShortcuts([
|
|
@@ -566,10 +519,454 @@ function MultiSelect(props) {
|
|
|
566
519
|
)
|
|
567
520
|
] });
|
|
568
521
|
}
|
|
522
|
+
|
|
523
|
+
// src/components/DataDisplay/Table/Table.tsx
|
|
524
|
+
import { forwardRef as forwardRef2, useMemo } from "react";
|
|
525
|
+
|
|
526
|
+
// src/components/DataDisplay/Table/TableContext.tsx
|
|
527
|
+
import { createContext, useContext } from "react";
|
|
528
|
+
var TableContext = createContext({
|
|
529
|
+
size: "medium",
|
|
530
|
+
stickyHeader: false
|
|
531
|
+
});
|
|
532
|
+
var useTableContext = () => useContext(TableContext);
|
|
533
|
+
|
|
534
|
+
// src/components/DataDisplay/Table/Table.tsx
|
|
535
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
536
|
+
var Table = forwardRef2(
|
|
537
|
+
({ className = "", children, stickyHeader = false, size = "medium", ...props }, ref) => {
|
|
538
|
+
const value = useMemo(() => ({ size, stickyHeader }), [size, stickyHeader]);
|
|
539
|
+
return /* @__PURE__ */ jsx6(TableContext.Provider, { value, children: /* @__PURE__ */ jsx6(
|
|
540
|
+
"table",
|
|
541
|
+
{
|
|
542
|
+
ref,
|
|
543
|
+
className: `w-full caption-bottom text-sm border-collapse ${stickyHeader ? "relative" : ""} ${className}`,
|
|
544
|
+
...props,
|
|
545
|
+
children
|
|
546
|
+
}
|
|
547
|
+
) });
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
Table.displayName = "Table";
|
|
551
|
+
var Table_default = Table;
|
|
552
|
+
|
|
553
|
+
// src/components/DataDisplay/Table/TableBody.tsx
|
|
554
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
555
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
556
|
+
var TableBody = forwardRef3(
|
|
557
|
+
({ className = "", children, ...props }, ref) => {
|
|
558
|
+
return /* @__PURE__ */ jsx7(
|
|
559
|
+
"tbody",
|
|
560
|
+
{
|
|
561
|
+
ref,
|
|
562
|
+
className: `[&_tr:last-child]:border-0 ${className}`,
|
|
563
|
+
...props,
|
|
564
|
+
children
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
TableBody.displayName = "TableBody";
|
|
570
|
+
var TableBody_default = TableBody;
|
|
571
|
+
|
|
572
|
+
// src/components/DataDisplay/Table/TableCell.tsx
|
|
573
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
574
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
575
|
+
var TableCell = forwardRef4(
|
|
576
|
+
({ className = "", align = "left", padding, variant, component, children, ...props }, ref) => {
|
|
577
|
+
const { size, stickyHeader } = useTableContext();
|
|
578
|
+
const isHead = variant === "head";
|
|
579
|
+
const Component = component || (isHead ? "th" : "td");
|
|
580
|
+
const alignClasses = {
|
|
581
|
+
left: "text-left",
|
|
582
|
+
center: "text-center",
|
|
583
|
+
right: "text-right",
|
|
584
|
+
justify: "text-justify",
|
|
585
|
+
inherit: "text-inherit"
|
|
586
|
+
};
|
|
587
|
+
const paddingClasses = {
|
|
588
|
+
normal: size === "small" ? "p-2" : "p-4",
|
|
589
|
+
none: "p-0",
|
|
590
|
+
checkbox: "p-0 w-[48px] text-center"
|
|
591
|
+
};
|
|
592
|
+
const effectivePadding = padding || "normal";
|
|
593
|
+
return /* @__PURE__ */ jsx8(
|
|
594
|
+
Component,
|
|
595
|
+
{
|
|
596
|
+
ref,
|
|
597
|
+
className: `align-middle transition-colors [&:has([role=checkbox])]:pr-0 ${isHead ? "font-semibold text-slate-700 bg-slate-50" : "text-slate-600"} ${stickyHeader && isHead ? "sticky top-0 z-10 shadow-[inset_0_-1px_0_rgba(226,232,240,1)]" : ""} ${alignClasses[align]} ${paddingClasses[effectivePadding]} ${className}`,
|
|
598
|
+
...props,
|
|
599
|
+
children
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
TableCell.displayName = "TableCell";
|
|
605
|
+
var TableCell_default = TableCell;
|
|
606
|
+
|
|
607
|
+
// src/components/DataDisplay/Table/TableContainer.tsx
|
|
608
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
609
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
610
|
+
var TableContainer = forwardRef5(
|
|
611
|
+
({ className = "", children, ...props }, ref) => {
|
|
612
|
+
return /* @__PURE__ */ jsx9(
|
|
613
|
+
"div",
|
|
614
|
+
{
|
|
615
|
+
ref,
|
|
616
|
+
className: `w-full overflow-auto rounded-lg border border-slate-200 bg-white shadow-sm ${className}`,
|
|
617
|
+
...props,
|
|
618
|
+
children
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
);
|
|
623
|
+
TableContainer.displayName = "TableContainer";
|
|
624
|
+
var TableContainer_default = TableContainer;
|
|
625
|
+
|
|
626
|
+
// src/components/DataDisplay/Table/TableFooter.tsx
|
|
627
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
628
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
629
|
+
var TableFooter = forwardRef6(
|
|
630
|
+
({ className = "", children, ...props }, ref) => {
|
|
631
|
+
return /* @__PURE__ */ jsx10(
|
|
632
|
+
"tfoot",
|
|
633
|
+
{
|
|
634
|
+
ref,
|
|
635
|
+
className: `border-t bg-slate-50/50 font-medium [&>tr]:last:border-b-0 ${className}`,
|
|
636
|
+
...props,
|
|
637
|
+
children
|
|
638
|
+
}
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
);
|
|
642
|
+
TableFooter.displayName = "TableFooter";
|
|
643
|
+
var TableFooter_default = TableFooter;
|
|
644
|
+
|
|
645
|
+
// src/components/DataDisplay/Table/TableHead.tsx
|
|
646
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
647
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
648
|
+
var TableHead = forwardRef7(
|
|
649
|
+
({ className = "", children, ...props }, ref) => {
|
|
650
|
+
return /* @__PURE__ */ jsx11(
|
|
651
|
+
"thead",
|
|
652
|
+
{
|
|
653
|
+
ref,
|
|
654
|
+
className: `[&_tr]:border-b bg-slate-50/50 ${className}`,
|
|
655
|
+
...props,
|
|
656
|
+
children
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
TableHead.displayName = "TableHead";
|
|
662
|
+
var TableHead_default = TableHead;
|
|
663
|
+
|
|
664
|
+
// src/components/DataDisplay/Table/TableRow.tsx
|
|
665
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
666
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
667
|
+
var TableRow = forwardRef8(
|
|
668
|
+
({ className = "", children, hover = false, selected = false, ...props }, ref) => {
|
|
669
|
+
return /* @__PURE__ */ jsx12(
|
|
670
|
+
"tr",
|
|
671
|
+
{
|
|
672
|
+
ref,
|
|
673
|
+
className: `border-b transition-colors ${hover ? "hover:bg-slate-100/50" : ""} ${selected ? "bg-slate-100/80" : ""} ${className}`,
|
|
674
|
+
...props,
|
|
675
|
+
children
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
TableRow.displayName = "TableRow";
|
|
681
|
+
var TableRow_default = TableRow;
|
|
682
|
+
|
|
683
|
+
// src/components/Overlay/Dialog/Dialog.tsx
|
|
684
|
+
import { createPortal } from "react-dom";
|
|
685
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
686
|
+
function Dialog(props) {
|
|
687
|
+
const {
|
|
688
|
+
open,
|
|
689
|
+
onClose,
|
|
690
|
+
children,
|
|
691
|
+
className,
|
|
692
|
+
size = "auto",
|
|
693
|
+
closeOnEsc = true,
|
|
694
|
+
backdropClose = true,
|
|
695
|
+
animationDuration = 220
|
|
696
|
+
} = props;
|
|
697
|
+
const sizeClasses2 = {
|
|
698
|
+
xs: "max-w-xs",
|
|
699
|
+
sm: "max-w-sm",
|
|
700
|
+
md: "max-w-md",
|
|
701
|
+
lg: "max-w-lg",
|
|
702
|
+
xl: "max-w-xl",
|
|
703
|
+
full: "max-w-full",
|
|
704
|
+
auto: "max-w-lg"
|
|
705
|
+
};
|
|
706
|
+
useKeyboardShortcuts([
|
|
707
|
+
{
|
|
708
|
+
key: "escape",
|
|
709
|
+
options: { preventDefault: true },
|
|
710
|
+
callback: () => {
|
|
711
|
+
if (closeOnEsc && open && onClose) onClose();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
]);
|
|
715
|
+
if (typeof window === "undefined") return null;
|
|
716
|
+
return createPortal(
|
|
717
|
+
/* @__PURE__ */ jsx13(
|
|
718
|
+
ShowWithAnimation,
|
|
719
|
+
{
|
|
720
|
+
when: open,
|
|
721
|
+
removeOnHide: true,
|
|
722
|
+
containerProps: {
|
|
723
|
+
style: { position: "fixed" },
|
|
724
|
+
className: "fixed inset-0 w-screen h-screen flex items-center justify-center"
|
|
725
|
+
},
|
|
726
|
+
animationDuration: 1.5 * animationDuration,
|
|
727
|
+
animationStyle: {
|
|
728
|
+
children: {
|
|
729
|
+
from: {
|
|
730
|
+
opacity: 0,
|
|
731
|
+
backdropFilter: "blur(0)"
|
|
732
|
+
},
|
|
733
|
+
active: {
|
|
734
|
+
opacity: 1,
|
|
735
|
+
backdropFilter: "blur(10px)"
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
className: "w-full h-full bg-[#0004] flex items-center justify-center",
|
|
740
|
+
onClick: (event) => {
|
|
741
|
+
if (backdropClose && event.target === event.currentTarget) {
|
|
742
|
+
onClose?.();
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
children: /* @__PURE__ */ jsx13(
|
|
746
|
+
ShowWithAnimation,
|
|
747
|
+
{
|
|
748
|
+
when: open,
|
|
749
|
+
animationDuration,
|
|
750
|
+
role: "dialog",
|
|
751
|
+
"aria-modal": "true",
|
|
752
|
+
className: cn(
|
|
753
|
+
"relative z-10 w-full mx-4 bg-white rounded-lg shadow-lg overflow-hidden",
|
|
754
|
+
sizeClasses2[size],
|
|
755
|
+
className
|
|
756
|
+
),
|
|
757
|
+
children
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
document.body
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// src/components/Overlay/Dialog/DialogHeader.tsx
|
|
767
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
768
|
+
function DialogHeader(props) {
|
|
769
|
+
const { title, children, ...rest } = props;
|
|
770
|
+
return /* @__PURE__ */ jsxs6("div", { ...rest, className: "px-6 py-4 border-b", children: [
|
|
771
|
+
/* @__PURE__ */ jsx14(Show, { when: !!title, children: /* @__PURE__ */ jsx14("h1", { className: "text-lg font-medium", children: title }) }),
|
|
772
|
+
children
|
|
773
|
+
] });
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/components/Overlay/Dialog/DialogFooter.tsx
|
|
777
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
778
|
+
function DialogFooter(props) {
|
|
779
|
+
return /* @__PURE__ */ jsx15(
|
|
780
|
+
"div",
|
|
781
|
+
{
|
|
782
|
+
...props,
|
|
783
|
+
className: cn("px-6 py-4 border-t flex items-center justify-end", props.className)
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// src/components/Overlay/Dialog/DialogContent.tsx
|
|
789
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
790
|
+
function DialogContent(props) {
|
|
791
|
+
return /* @__PURE__ */ jsx16(
|
|
792
|
+
"div",
|
|
793
|
+
{
|
|
794
|
+
...props,
|
|
795
|
+
className: cn("p-6", props.className)
|
|
796
|
+
}
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// src/components/Overlay/Drawer/Drawer.tsx
|
|
801
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
802
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
803
|
+
function Drawer(props) {
|
|
804
|
+
const {
|
|
805
|
+
open,
|
|
806
|
+
onClose,
|
|
807
|
+
children,
|
|
808
|
+
rounded = 0,
|
|
809
|
+
side = "right",
|
|
810
|
+
closeOnEsc = true,
|
|
811
|
+
size: _size = "md",
|
|
812
|
+
backdropClose = true,
|
|
813
|
+
animationDuration = 220
|
|
814
|
+
} = props;
|
|
815
|
+
useKeyboardShortcuts([
|
|
816
|
+
{
|
|
817
|
+
key: "escape",
|
|
818
|
+
options: { preventDefault: true },
|
|
819
|
+
callback: () => {
|
|
820
|
+
if (closeOnEsc && open && onClose) onClose?.();
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
]);
|
|
824
|
+
if (typeof window === "undefined") return null;
|
|
825
|
+
const isHorizontal = side === "left" || side === "right";
|
|
826
|
+
const size = (() => {
|
|
827
|
+
if (typeof _size === "number") return _size + "px";
|
|
828
|
+
return {
|
|
829
|
+
"xs": "20",
|
|
830
|
+
"sm": "35",
|
|
831
|
+
"md": "50",
|
|
832
|
+
"lg": "75",
|
|
833
|
+
"xl": "90"
|
|
834
|
+
}[_size] + (isHorizontal ? "vw" : "vh");
|
|
835
|
+
})();
|
|
836
|
+
return createPortal2(
|
|
837
|
+
/* @__PURE__ */ jsx17(
|
|
838
|
+
ShowWithAnimation,
|
|
839
|
+
{
|
|
840
|
+
when: open,
|
|
841
|
+
removeOnHide: true,
|
|
842
|
+
containerProps: {
|
|
843
|
+
style: { position: "fixed" },
|
|
844
|
+
className: `fixed inset-0 w-screen h-screen flex`
|
|
845
|
+
},
|
|
846
|
+
animationDuration: 1.5 * animationDuration,
|
|
847
|
+
animationStyle: {
|
|
848
|
+
children: {
|
|
849
|
+
from: { opacity: 0, backdropFilter: "blur(0)" },
|
|
850
|
+
active: { opacity: 1, backdropFilter: "blur(8px)" }
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
className: cn(
|
|
854
|
+
"w-full h-full bg-[#0004] flex",
|
|
855
|
+
{
|
|
856
|
+
"left": "justify-start items-center",
|
|
857
|
+
"right": "justify-end items-center ",
|
|
858
|
+
"top": "justify-center items-start",
|
|
859
|
+
"bottom": "justify-center items-end"
|
|
860
|
+
}[side]
|
|
861
|
+
),
|
|
862
|
+
onClick: (event) => {
|
|
863
|
+
if (backdropClose && event.target === event.currentTarget) {
|
|
864
|
+
onClose?.();
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
children: /* @__PURE__ */ jsx17(
|
|
868
|
+
ShowWithAnimation,
|
|
869
|
+
{
|
|
870
|
+
when: open,
|
|
871
|
+
role: "dialog",
|
|
872
|
+
"aria-modal": "true",
|
|
873
|
+
containerProps: {
|
|
874
|
+
className: "w-full h-full",
|
|
875
|
+
style: {
|
|
876
|
+
maxWidth: isHorizontal ? size : "100%",
|
|
877
|
+
maxHeight: !isHorizontal ? size : "100%"
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
className: "w-full h-full bg-white flex flex-col overflow-hidden",
|
|
881
|
+
style: {
|
|
882
|
+
borderRadius: {
|
|
883
|
+
left: `0 ${rounded}px ${rounded}px 0`,
|
|
884
|
+
right: `${rounded}px 0 0 ${rounded}px`,
|
|
885
|
+
top: `0 0 ${rounded}px ${rounded}px`,
|
|
886
|
+
bottom: `${rounded}px ${rounded}px 0 0`
|
|
887
|
+
}[side]
|
|
888
|
+
},
|
|
889
|
+
animationDuration,
|
|
890
|
+
animationStyle: {
|
|
891
|
+
children: {
|
|
892
|
+
active: { transform: "translateX(0) translateY(0)", opacity: 1 },
|
|
893
|
+
from: {
|
|
894
|
+
opacity: 0,
|
|
895
|
+
transform: {
|
|
896
|
+
left: "translateX(-100%)",
|
|
897
|
+
right: "translateX(100%)",
|
|
898
|
+
top: "translateY(-100%)",
|
|
899
|
+
bottom: "translateY(100%)"
|
|
900
|
+
}[side]
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
children
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
document.body
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// src/components/Overlay/Drawer/DrawerContent.tsx
|
|
914
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
915
|
+
function DrawerContent({ children, className, style }) {
|
|
916
|
+
return /* @__PURE__ */ jsx18(
|
|
917
|
+
"div",
|
|
918
|
+
{
|
|
919
|
+
className: cn("overflow-auto flex-1 p-4 relative hide-scrollbar", className),
|
|
920
|
+
style,
|
|
921
|
+
children
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// src/components/Overlay/Drawer/DrawerHeader.tsx
|
|
927
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
928
|
+
function DrawerHeader({ children, className, style }) {
|
|
929
|
+
return /* @__PURE__ */ jsx19(
|
|
930
|
+
"div",
|
|
931
|
+
{
|
|
932
|
+
className: cn("sticky top-0 z-20 backdrop-blur-sm bg-white/60 px-4 py-3 border-b", className),
|
|
933
|
+
style,
|
|
934
|
+
children
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/components/Overlay/Drawer/DrawerFooter.tsx
|
|
940
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
941
|
+
function DrawerFooter({ children, className, style }) {
|
|
942
|
+
return /* @__PURE__ */ jsx20(
|
|
943
|
+
"div",
|
|
944
|
+
{
|
|
945
|
+
className: cn("sticky bottom-0 z-20 backdrop-blur-sm bg-white/60 px-4 py-3 border-t", className),
|
|
946
|
+
style,
|
|
947
|
+
children
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
}
|
|
569
951
|
export {
|
|
570
952
|
Button_default as Button,
|
|
953
|
+
Dialog,
|
|
954
|
+
DialogContent,
|
|
955
|
+
DialogFooter,
|
|
956
|
+
DialogHeader,
|
|
957
|
+
Drawer,
|
|
958
|
+
DrawerContent,
|
|
959
|
+
DrawerFooter,
|
|
960
|
+
DrawerHeader,
|
|
571
961
|
InputField,
|
|
572
962
|
MultiSelect,
|
|
573
963
|
Select,
|
|
964
|
+
Table_default as Table,
|
|
965
|
+
TableBody_default as TableBody,
|
|
966
|
+
TableCell_default as TableCell,
|
|
967
|
+
TableContainer_default as TableContainer,
|
|
968
|
+
TableFooter_default as TableFooter,
|
|
969
|
+
TableHead_default as TableHead,
|
|
970
|
+
TableRow_default as TableRow,
|
|
574
971
|
Tooltip
|
|
575
972
|
};
|