tailwind-ux-kit 1.0.18 â 1.0.20
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 +85 -45
- package/lib/components/Badge.d.ts +4 -0
- package/lib/components/modal/Modal.d.ts +5 -3
- package/lib/components/modal/ModalActionContext.d.ts +7 -0
- package/lib/components/modal/ModalContext.d.ts +2 -1
- package/lib/components/modal/ModalProvider.d.ts +3 -6
- package/lib/components/modal/ModalStateContext.d.ts +7 -0
- package/lib/components/modal/useModalInstance.d.ts +6 -0
- package/lib/index.d.ts +4 -1
- package/lib/tailwind-ux-kit.es.js +293 -213
- package/lib/tailwind-ux-kit.umd.js +4 -4
- package/lib/types/BadgeTypes.d.ts +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,6 +86,38 @@ Or for tailwind > 4, add the following to your `.css` file:
|
|
|
86
86
|
### 6. Modals & Popups
|
|
87
87
|
|
|
88
88
|
- Basic Modal
|
|
89
|
+
|
|
90
|
+
##### Features
|
|
91
|
+
|
|
92
|
+
- Global modal state management with React Context
|
|
93
|
+
- Separate context for modal actions and modal state to reduce unnecessary re-renders
|
|
94
|
+
- Pass arbitrary data to modals when opening them
|
|
95
|
+
- TypeScript-ready with strong typings
|
|
96
|
+
- Easy to use API (`openModal`, `closeModal`, `isOpen`, `getModalData`)
|
|
97
|
+
- Supports standalone or context-controlled modals
|
|
98
|
+
- Clean modular structure with centralized exports
|
|
99
|
+
- Compatible with React 18+, Vite, Next.js
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### 1. Wrap your app with `ModalProvider`
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { ModalProvider } from "@/components/modals";
|
|
107
|
+
|
|
108
|
+
export default function RootLayout({ children }) {
|
|
109
|
+
return <ModalProvider>{children}</ModalProvider>;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Hook / Component | Description |
|
|
114
|
+
| ---------------------- | --------------------------------------------------- |
|
|
115
|
+
| `ModalProvider` | Context provider to wrap your app |
|
|
116
|
+
| `Modal` | Modal component that renders UI based on open state |
|
|
117
|
+
| `useModalActions()` | Returns `{ openModal(id, data?), closeModal(id) }` |
|
|
118
|
+
| `useModalState()` | Returns `{ isOpen(id), getModalData(id) }` |
|
|
119
|
+
| `useModalInstance(id)` | Convenience hook for modal state + actions by ID |
|
|
120
|
+
|
|
89
121
|
- Confirmation Dialog
|
|
90
122
|
- Form Modal
|
|
91
123
|
- Slide-over Panels
|
|
@@ -94,51 +126,55 @@ Or for tailwind > 4, add the following to your `.css` file:
|
|
|
94
126
|
|
|
95
127
|
- Toast Notifications
|
|
96
128
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
import { ToastContainer, showToast, setToastDefaults } from 'my-toast-lib';
|
|
132
|
+
// Optional: Global theming
|
|
133
|
+
setToastDefaults({
|
|
134
|
+
icons: {
|
|
135
|
+
success: 'đ',
|
|
136
|
+
error: 'đ',
|
|
137
|
+
},
|
|
138
|
+
colors: {
|
|
139
|
+
success: { bg: 'bg-green-200', text: 'text-green-900' },
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
// Trigger anywhere
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
showToast('success', 'Operation completed!');
|
|
150
|
+
showToast('success', 'Your file was saved!', 4000, {
|
|
151
|
+
title: 'Success',
|
|
152
|
+
description: 'Everything worked perfectly.',
|
|
153
|
+
icon: <RiCheckFill />,
|
|
154
|
+
iconContainerClass: 'bg-green-200 text-green-900 rounded-full p-2',
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
##### showToast(type, message, duration?, config?)
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Description |
|
|
162
|
+
| ---------- | --------------------------------------------- | ----------------------------------------------------- |
|
|
163
|
+
| `type` | `'success' \| 'error' \| 'warning' \| 'info'` | Toast type, controls default styling |
|
|
164
|
+
| `message` | `string` | Main message, shown if title/description not provided |
|
|
165
|
+
| `duration` | `number` (optional) | Time in ms to auto-dismiss the toast (default: 3000) |
|
|
166
|
+
| `config` | `ToastConfig` (optional) | Extra customization options |
|
|
167
|
+
|
|
168
|
+
##### ToastConfig
|
|
169
|
+
|
|
170
|
+
| Property | Type | Description |
|
|
171
|
+
| --------------------- | --------------------- | ------------------------------------- |
|
|
172
|
+
| `title?` | `string \| null` | Optional toast title |
|
|
173
|
+
| `description?` | `string \| null` | Optional detailed description |
|
|
174
|
+
| `icon?` | `string \| ReactNode` | Custom icon (string or React element) |
|
|
175
|
+
| `iconContainerClass?` | `string` | CSS classes for the icon container |
|
|
176
|
+
| `bgColor?` | `string` | Override background color class |
|
|
177
|
+
| `textColor?` | `string` | Override text color class |
|
|
142
178
|
|
|
143
179
|
- Success / Error / Warning Alerts
|
|
144
180
|
- Banners
|
|
@@ -197,3 +233,7 @@ Or for tailwind > 4, add the following to your `.css` file:
|
|
|
197
233
|
- Loaders / Spinners
|
|
198
234
|
- Timeline
|
|
199
235
|
- Tags / Chips
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
```
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
type ModalProps = {
|
|
3
3
|
id: string;
|
|
4
4
|
title?: string;
|
|
5
|
-
children?: ReactNode;
|
|
6
5
|
standalone?: boolean;
|
|
7
6
|
showFloatingClose?: boolean;
|
|
8
7
|
containerClasses?: string;
|
|
9
8
|
onClose?: () => void;
|
|
9
|
+
children: ReactNode | ((params: {
|
|
10
|
+
modalData: any;
|
|
11
|
+
}) => ReactNode);
|
|
10
12
|
};
|
|
11
|
-
export default function Modal({ id, title, children, standalone, showFloatingClose, containerClasses, onClose, }: ModalProps):
|
|
13
|
+
export default function Modal({ id, title, children, standalone, showFloatingClose, containerClasses, onClose, }: ModalProps): ReactElement | null;
|
|
12
14
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ModalActions = {
|
|
2
|
+
openModal: (id: string, data?: any) => void;
|
|
3
|
+
closeModal: (id: string) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const ModalActionContext: import('react').Context<ModalActions | null>;
|
|
6
|
+
export declare const useModalActions: () => ModalActions | null;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
type ModalContextType = {
|
|
2
|
-
openModal: (id: string) => void;
|
|
2
|
+
openModal: (id: string, data?: any) => void;
|
|
3
3
|
closeModal: (id: string) => void;
|
|
4
4
|
isOpen: (id: string) => boolean;
|
|
5
|
+
getModalData: (id: string) => any;
|
|
5
6
|
} | null;
|
|
6
7
|
export declare const ModalContext: import('react').Context<ModalContextType>;
|
|
7
8
|
export declare const useModal: () => ModalContextType;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export default function ModalProvider({ children }: ModalProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
export default function ModalProvider({ children, }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ export { default as Input } from './components/Input';
|
|
|
2
2
|
export { default as Button } from './components/Button';
|
|
3
3
|
export { default as Dropdown } from './components/Dropdown';
|
|
4
4
|
export { default as Tooltip } from './components/ToolTip';
|
|
5
|
+
export { default as Badge } from './components/Badge';
|
|
5
6
|
export { default as Modal } from './components/modal/Modal';
|
|
6
7
|
export { default as ModalProvider } from './components/modal/ModalProvider';
|
|
7
|
-
export
|
|
8
|
+
export { useModalActions } from './components/modal/ModalActionContext';
|
|
9
|
+
export { useModalState } from './components/modal/ModalStateContext';
|
|
10
|
+
export { useModalInstance } from './components/modal/useModalInstance';
|
|
8
11
|
export { default as Toast } from './components/Toast';
|
|
9
12
|
export { showToast, setToastDefaults } from './utils/toast';
|
|
10
13
|
export type { ToastType, ToastConfig, ToastDefaults } from './utils/toast';
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsxs as x, jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import y, { forwardRef as re, useState as w, useRef as $, useMemo as I, useCallback as h, useEffect as k, createContext as B, useContext as F } from "react";
|
|
4
|
+
const ne = re((e, n) => {
|
|
5
5
|
const {
|
|
6
6
|
label: r,
|
|
7
7
|
id: t,
|
|
8
|
-
inputSize:
|
|
9
|
-
shape:
|
|
10
|
-
validate:
|
|
11
|
-
onValidatedChange:
|
|
12
|
-
className:
|
|
13
|
-
icon:
|
|
8
|
+
inputSize: o = "md",
|
|
9
|
+
shape: d = "rounded",
|
|
10
|
+
validate: u,
|
|
11
|
+
onValidatedChange: s,
|
|
12
|
+
className: a = "",
|
|
13
|
+
icon: i,
|
|
14
14
|
iconPosition: l = "left",
|
|
15
|
-
floatingLabelStyle:
|
|
16
|
-
onChange:
|
|
17
|
-
isValid:
|
|
15
|
+
floatingLabelStyle: c,
|
|
16
|
+
onChange: p,
|
|
17
|
+
isValid: f,
|
|
18
18
|
isInvalid: b,
|
|
19
|
-
feedback:
|
|
20
|
-
feedbackType:
|
|
19
|
+
feedback: m,
|
|
20
|
+
feedbackType: v = "invalid",
|
|
21
21
|
...C
|
|
22
|
-
} = e, [
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
22
|
+
} = e, [S, j] = w("default"), P = (O) => {
|
|
23
|
+
const T = O.target.value, E = (u == null ? void 0 : u(T)) ?? "default";
|
|
24
|
+
j(E), s == null || s(O, E), p == null || p(O);
|
|
25
|
+
}, L = {
|
|
26
26
|
xs: "text-xs px-2 py-1",
|
|
27
27
|
sm: "text-sm px-3 py-1.5",
|
|
28
28
|
md: "text-sm px-3 py-3",
|
|
29
29
|
lg: "text-lg px-5 py-3"
|
|
30
|
-
},
|
|
30
|
+
}, M = {
|
|
31
31
|
flat: "rounded-none",
|
|
32
32
|
rounded: "rounded-md",
|
|
33
33
|
pill: "rounded-full"
|
|
34
|
-
},
|
|
34
|
+
}, K = {
|
|
35
35
|
filled: "rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",
|
|
36
36
|
outlined: "rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",
|
|
37
37
|
standard: "px-0 py-2.5 bg-transparent border-0 border-b-2"
|
|
38
|
-
},
|
|
38
|
+
}, U = {
|
|
39
39
|
filled: "absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
40
40
|
outlined: "absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
|
|
41
41
|
standard: "absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"
|
|
42
|
-
},
|
|
43
|
-
if (
|
|
42
|
+
}, q = (O, T, E) => {
|
|
43
|
+
if (E)
|
|
44
44
|
return "border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
|
|
45
|
-
if (
|
|
45
|
+
if (T)
|
|
46
46
|
return "border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";
|
|
47
47
|
switch (O) {
|
|
48
48
|
case "error":
|
|
@@ -54,57 +54,57 @@ const re = Q((e, n) => {
|
|
|
54
54
|
default:
|
|
55
55
|
return "border-gray-300 focus:ring-blue-500";
|
|
56
56
|
}
|
|
57
|
-
},
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
!N && r && /* @__PURE__ */
|
|
57
|
+
}, J = L[o] || L.md, Q = M[d] || M.flat, V = q(S, f, b), ee = l === "start" || l === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", te = i && (l === "start" || l === "left") ? "ps-10" : i ? "pe-10" : "", R = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!c;
|
|
58
|
+
return /* @__PURE__ */ x("div", { className: `w-full relative ${N ? "z-0" : ""}`, children: [
|
|
59
|
+
!N && r && /* @__PURE__ */ g(
|
|
60
60
|
"label",
|
|
61
61
|
{
|
|
62
|
-
htmlFor:
|
|
63
|
-
className: `block mb-1 font-light text-sm ${
|
|
62
|
+
htmlFor: R,
|
|
63
|
+
className: `block mb-1 font-light text-sm ${f ? "text-green-700 dark:text-green-500" : b ? "text-red-700 dark:text-red-500" : "text-gray-700"}`,
|
|
64
64
|
children: r
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
67
|
+
/* @__PURE__ */ x("div", { className: "relative w-full", children: [
|
|
68
|
+
i && /* @__PURE__ */ g(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
|
-
className: `absolute inset-y-0 flex items-center ${
|
|
72
|
-
children: /* @__PURE__ */
|
|
71
|
+
className: `absolute inset-y-0 flex items-center ${ee}`,
|
|
72
|
+
children: /* @__PURE__ */ g("span", { className: "text-gray-500", children: i })
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ g(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
78
|
...C,
|
|
79
|
-
id:
|
|
79
|
+
id: R,
|
|
80
80
|
ref: n,
|
|
81
81
|
placeholder: N ? " " : C.placeholder,
|
|
82
|
-
onChange:
|
|
82
|
+
onChange: P,
|
|
83
83
|
className: `border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
84
|
-
${N &&
|
|
85
|
-
${
|
|
84
|
+
${N && c ? K[c] : J}
|
|
85
|
+
${te} ${Q} ${V} ${a}`
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
N && r &&
|
|
88
|
+
N && r && c && /* @__PURE__ */ g(
|
|
89
89
|
"label",
|
|
90
90
|
{
|
|
91
|
-
htmlFor:
|
|
92
|
-
className: `ms-1 ${
|
|
91
|
+
htmlFor: R,
|
|
92
|
+
className: `ms-1 ${U[c]} ${a}`,
|
|
93
93
|
children: r
|
|
94
94
|
}
|
|
95
95
|
)
|
|
96
96
|
] }),
|
|
97
|
-
|
|
97
|
+
m && /* @__PURE__ */ g(
|
|
98
98
|
"p",
|
|
99
99
|
{
|
|
100
|
-
className: `mt-1 text-xs ${
|
|
101
|
-
children:
|
|
100
|
+
className: `mt-1 text-xs ${v === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
101
|
+
children: m
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] });
|
|
105
105
|
});
|
|
106
|
-
|
|
107
|
-
const
|
|
106
|
+
ne.displayName = "Input";
|
|
107
|
+
const oe = {
|
|
108
108
|
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
109
109
|
secondary: "bg-gray-600 text-white hover:bg-gray-700",
|
|
110
110
|
success: "bg-green-600 text-white hover:bg-green-700",
|
|
@@ -122,39 +122,39 @@ const ne = {
|
|
|
122
122
|
"outline-info": "border border-cyan-600 text-cyan-600 hover:bg-cyan-50",
|
|
123
123
|
"outline-dark": "border border-gray-900 text-gray-900 hover:bg-gray-100",
|
|
124
124
|
"outline-light": "border border-gray-100 text-gray-500 hover:bg-gray-200"
|
|
125
|
-
},
|
|
125
|
+
}, se = {
|
|
126
126
|
xs: "px-3 py-2 text-xs",
|
|
127
127
|
sm: "px-3 py-2 text-sm",
|
|
128
128
|
md: "px-5 py-2.5 text-sm",
|
|
129
129
|
lg: "px-5 py-3 text-base",
|
|
130
130
|
xl: "px-6 py-3.5 text-base"
|
|
131
|
-
},
|
|
131
|
+
}, ae = {
|
|
132
132
|
flat: "shadow-none",
|
|
133
133
|
rounded: "rounded-md",
|
|
134
134
|
pill: "rounded-full",
|
|
135
135
|
circle: "rounded-full w-10 h-10 p-0 flex items-center justify-center"
|
|
136
|
-
},
|
|
136
|
+
}, Le = ({
|
|
137
137
|
children: e,
|
|
138
138
|
variant: n = "primary",
|
|
139
139
|
size: r = "md",
|
|
140
140
|
type: t = "button",
|
|
141
|
-
shape:
|
|
142
|
-
className:
|
|
143
|
-
isLoading:
|
|
144
|
-
disabled:
|
|
145
|
-
...
|
|
141
|
+
shape: o = "rounded",
|
|
142
|
+
className: d = "",
|
|
143
|
+
isLoading: u = !1,
|
|
144
|
+
disabled: s = !1,
|
|
145
|
+
...a
|
|
146
146
|
}) => {
|
|
147
|
-
const
|
|
147
|
+
const i = s || u, l = [
|
|
148
148
|
"inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
oe[n],
|
|
150
|
+
se[r],
|
|
151
|
+
ae[o],
|
|
152
|
+
o === "flat" ? "shadow-none" : "shadow-sm",
|
|
153
|
+
i ? "opacity-50 cursor-not-allowed pointer-events-none" : "",
|
|
154
|
+
d
|
|
155
155
|
].filter(Boolean).join(" ");
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
return /* @__PURE__ */ x("button", { type: t, className: l, disabled: i, ...a, children: [
|
|
157
|
+
u && /* @__PURE__ */ x(
|
|
158
158
|
"svg",
|
|
159
159
|
{
|
|
160
160
|
"aria-hidden": "true",
|
|
@@ -164,14 +164,14 @@ const ne = {
|
|
|
164
164
|
fill: "none",
|
|
165
165
|
xmlns: "http://www.w3.org/2000/svg",
|
|
166
166
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ g(
|
|
168
168
|
"path",
|
|
169
169
|
{
|
|
170
170
|
d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
|
|
171
171
|
fill: "currentColor"
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ g(
|
|
175
175
|
"path",
|
|
176
176
|
{
|
|
177
177
|
d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
|
|
@@ -183,12 +183,12 @@ const ne = {
|
|
|
183
183
|
),
|
|
184
184
|
e
|
|
185
185
|
] });
|
|
186
|
-
},
|
|
186
|
+
}, Me = ({
|
|
187
187
|
label: e,
|
|
188
188
|
children: n,
|
|
189
189
|
position: r = "right"
|
|
190
190
|
}) => {
|
|
191
|
-
const [t,
|
|
191
|
+
const [t, o] = w(!1), [d, u] = w(!1), s = $(null), a = $(null), i = I(() => {
|
|
192
192
|
switch (r) {
|
|
193
193
|
case "left":
|
|
194
194
|
return "left-0";
|
|
@@ -198,58 +198,58 @@ const ne = {
|
|
|
198
198
|
default:
|
|
199
199
|
return "right-0";
|
|
200
200
|
}
|
|
201
|
-
}, [r]), l =
|
|
202
|
-
const b =
|
|
203
|
-
|
|
204
|
-
}, []),
|
|
205
|
-
if (!
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
}, [r]), l = h((f) => {
|
|
202
|
+
const b = f.target;
|
|
203
|
+
s.current && !s.current.contains(b) && a.current && !a.current.contains(b) && o(!1);
|
|
204
|
+
}, []), c = h(() => {
|
|
205
|
+
if (!a.current || !s.current) return;
|
|
206
|
+
const f = a.current.getBoundingClientRect(), b = s.current.getBoundingClientRect(), m = window.innerHeight - f.bottom, v = f.top;
|
|
207
|
+
u(
|
|
208
|
+
m < b.height && v > b.height
|
|
209
209
|
);
|
|
210
210
|
}, []);
|
|
211
|
-
|
|
211
|
+
k(() => {
|
|
212
212
|
if (t)
|
|
213
|
-
return
|
|
214
|
-
window.removeEventListener("resize",
|
|
213
|
+
return c(), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), () => {
|
|
214
|
+
window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0);
|
|
215
215
|
};
|
|
216
|
-
}, [t,
|
|
217
|
-
const
|
|
218
|
-
return /* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
t && /* @__PURE__ */
|
|
216
|
+
}, [t, c]), k(() => (document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l)), [l]);
|
|
217
|
+
const p = h(() => o((f) => !f), []);
|
|
218
|
+
return /* @__PURE__ */ x("div", { className: "relative flex items-center", children: [
|
|
219
|
+
/* @__PURE__ */ g("button", { ref: a, onClick: p, children: e }),
|
|
220
|
+
t && /* @__PURE__ */ g(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
223
|
-
ref:
|
|
223
|
+
ref: s,
|
|
224
224
|
className: `absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
225
|
-
${
|
|
226
|
-
${
|
|
225
|
+
${d ? "bottom-full mb-2" : "top-full mt-2"}
|
|
226
|
+
${i}`,
|
|
227
227
|
children: n
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
230
|
] });
|
|
231
|
-
},
|
|
231
|
+
}, Ee = ({
|
|
232
232
|
children: e,
|
|
233
233
|
content: n,
|
|
234
234
|
position: r = "top",
|
|
235
235
|
className: t = "",
|
|
236
|
-
tooltipClass:
|
|
237
|
-
tooltipStyle:
|
|
236
|
+
tooltipClass: o = "",
|
|
237
|
+
tooltipStyle: d = {}
|
|
238
238
|
}) => {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
243
|
-
const
|
|
239
|
+
const u = $(null), s = $(null);
|
|
240
|
+
k(() => {
|
|
241
|
+
const i = u.current, l = s.current;
|
|
242
|
+
if (!i || !l) return;
|
|
243
|
+
const c = () => {
|
|
244
244
|
l.style.opacity = "1", l.style.visibility = "visible";
|
|
245
|
-
},
|
|
245
|
+
}, p = () => {
|
|
246
246
|
l.style.opacity = "0", l.style.visibility = "hidden";
|
|
247
247
|
};
|
|
248
|
-
return
|
|
249
|
-
|
|
248
|
+
return i.addEventListener("mouseenter", c), i.addEventListener("mouseleave", p), () => {
|
|
249
|
+
i.removeEventListener("mouseenter", c), i.removeEventListener("mouseleave", p);
|
|
250
250
|
};
|
|
251
251
|
}, []);
|
|
252
|
-
const
|
|
252
|
+
const a = (i) => {
|
|
253
253
|
const l = {
|
|
254
254
|
position: "absolute",
|
|
255
255
|
opacity: 0,
|
|
@@ -267,7 +267,7 @@ const ne = {
|
|
|
267
267
|
zIndex: 9999,
|
|
268
268
|
width: "max-content"
|
|
269
269
|
};
|
|
270
|
-
switch (
|
|
270
|
+
switch (i) {
|
|
271
271
|
case "top":
|
|
272
272
|
return {
|
|
273
273
|
...l,
|
|
@@ -304,103 +304,181 @@ const ne = {
|
|
|
304
304
|
return l;
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
|
-
return /* @__PURE__ */
|
|
307
|
+
return /* @__PURE__ */ x("div", { ref: u, className: `relative inline-block ${t}`, children: [
|
|
308
308
|
e,
|
|
309
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ g(
|
|
310
310
|
"div",
|
|
311
311
|
{
|
|
312
|
-
ref:
|
|
312
|
+
ref: s,
|
|
313
313
|
role: "tooltip",
|
|
314
|
-
className:
|
|
314
|
+
className: o,
|
|
315
315
|
style: {
|
|
316
|
-
...
|
|
317
|
-
...
|
|
316
|
+
...a(r),
|
|
317
|
+
...d
|
|
318
318
|
},
|
|
319
319
|
children: n
|
|
320
320
|
}
|
|
321
321
|
)
|
|
322
322
|
] });
|
|
323
|
-
},
|
|
324
|
-
|
|
323
|
+
}, le = {
|
|
324
|
+
primary: "bg-blue-500 text-white",
|
|
325
|
+
secondary: "bg-gray-500 text-white",
|
|
326
|
+
success: "bg-green-500 text-white",
|
|
327
|
+
danger: "bg-red-500 text-white",
|
|
328
|
+
warning: "bg-yellow-400 text-black",
|
|
329
|
+
info: "bg-cyan-500 text-white",
|
|
330
|
+
dark: "bg-black text-white",
|
|
331
|
+
light: "bg-gray-100 text-gray-800",
|
|
332
|
+
link: "bg-transparent text-blue-500 underline",
|
|
333
|
+
"outline-primary": "border border-blue-500 text-blue-500 bg-transparent",
|
|
334
|
+
"outline-secondary": "border border-gray-500 text-gray-500 bg-transparent",
|
|
335
|
+
"outline-success": "border border-green-500 text-green-500 bg-transparent",
|
|
336
|
+
"outline-danger": "border border-red-500 text-red-500 bg-transparent",
|
|
337
|
+
"outline-warning": "border border-yellow-400 text-yellow-500 bg-transparent",
|
|
338
|
+
"outline-info": "border border-cyan-500 text-cyan-500 bg-transparent",
|
|
339
|
+
"outline-dark": "border border-black text-black bg-transparent",
|
|
340
|
+
"outline-light": "border border-gray-100 text-gray-800 bg-transparent"
|
|
341
|
+
}, ie = {
|
|
342
|
+
xs: "text-xs px-2 py-0.5",
|
|
343
|
+
sm: "text-sm px-2.5 py-0.5",
|
|
344
|
+
md: "text-base px-3 py-1",
|
|
345
|
+
lg: "text-lg px-3.5 py-1.5",
|
|
346
|
+
xl: "text-xl px-4 py-2"
|
|
347
|
+
}, ce = {
|
|
348
|
+
flat: "rounded-none",
|
|
349
|
+
rounded: "rounded-sm",
|
|
350
|
+
pill: "rounded-full",
|
|
351
|
+
circle: "rounded-full p-2 w-8 h-8 justify-center"
|
|
352
|
+
}, $e = ({
|
|
353
|
+
label: e,
|
|
354
|
+
variant: n = "primary",
|
|
355
|
+
size: r = "sm",
|
|
356
|
+
shape: t = "rounded",
|
|
357
|
+
icon: o,
|
|
358
|
+
dismissible: d,
|
|
359
|
+
onDismiss: u,
|
|
360
|
+
className: s = "",
|
|
361
|
+
...a
|
|
362
|
+
}) => {
|
|
363
|
+
const i = !e && !!o, l = `inline-flex items-center font-medium ${le[n] || ""} ${ie[r] || ""} ${ce[t] || ""} ${i ? "justify-center p-2 w-8 h-8" : ""} ` + s;
|
|
364
|
+
return /* @__PURE__ */ x("span", { className: l.trim(), ...a, children: [
|
|
365
|
+
o && /* @__PURE__ */ g("span", { className: e ? "mr-1" : "", children: o }),
|
|
366
|
+
e,
|
|
367
|
+
d && /* @__PURE__ */ g(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: u,
|
|
372
|
+
className: "ml-2 text-xs font-bold leading-none focus:outline-none",
|
|
373
|
+
children: "Ã"
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] });
|
|
377
|
+
}, de = B(null), ue = () => {
|
|
378
|
+
const e = F(de);
|
|
325
379
|
return e || (console.warn(
|
|
326
380
|
"â ī¸ useModal() called outside of ModalProvider. Falling back to standalone modal usage."
|
|
327
381
|
), null);
|
|
328
382
|
};
|
|
329
|
-
function
|
|
383
|
+
function ze({
|
|
330
384
|
id: e,
|
|
331
385
|
title: n,
|
|
332
386
|
children: r,
|
|
333
387
|
standalone: t = !1,
|
|
334
|
-
showFloatingClose:
|
|
335
|
-
containerClasses:
|
|
336
|
-
onClose:
|
|
388
|
+
showFloatingClose: o = !1,
|
|
389
|
+
containerClasses: d = "",
|
|
390
|
+
onClose: u
|
|
337
391
|
}) {
|
|
338
|
-
const
|
|
339
|
-
|
|
392
|
+
const s = ue(), a = s && typeof s.openModal == "function", i = !t && a, [l, c] = w(!1), p = i ? s.isOpen(e) : l, f = i ? s.getModalData(e) : null, b = () => {
|
|
393
|
+
i ? s.closeModal(e) : c(!1), u == null || u();
|
|
340
394
|
};
|
|
341
|
-
return
|
|
395
|
+
return k(() => (p ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
342
396
|
document.body.style.overflow = "";
|
|
343
|
-
}), [
|
|
397
|
+
}), [p]), p ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ x(
|
|
344
398
|
"div",
|
|
345
399
|
{
|
|
346
|
-
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${
|
|
400
|
+
className: `bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${d}`,
|
|
347
401
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
n && /* @__PURE__ */
|
|
350
|
-
|
|
402
|
+
/* @__PURE__ */ x("div", { className: "flex justify-between items-center relative", children: [
|
|
403
|
+
n && /* @__PURE__ */ g("h2", { className: "text-lg font-semibold", children: n }),
|
|
404
|
+
o && /* @__PURE__ */ g(
|
|
351
405
|
"button",
|
|
352
406
|
{
|
|
353
|
-
onClick:
|
|
407
|
+
onClick: b,
|
|
354
408
|
className: "text-gray-500 hover:text-gray-700 absolute top-2 right-3",
|
|
355
409
|
"aria-label": "Close modal",
|
|
356
410
|
children: "â"
|
|
357
411
|
}
|
|
358
412
|
)
|
|
359
413
|
] }),
|
|
360
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ g("div", { className: "mt-3 text-sm text-gray-700", children: typeof r == "function" ? r({ modalData: f }) : r })
|
|
361
415
|
]
|
|
362
416
|
}
|
|
363
417
|
) }) : null;
|
|
364
418
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
419
|
+
const G = B(null), ge = () => F(G), H = B(null), pe = () => F(H);
|
|
420
|
+
function De({
|
|
421
|
+
children: e
|
|
422
|
+
}) {
|
|
423
|
+
const [n, r] = w({}), [t, o] = w({}), d = h((c, p) => {
|
|
424
|
+
r((f) => ({ ...f, [c]: !0 })), p && o((f) => ({ ...f, [c]: p }));
|
|
425
|
+
}, []), u = h((c) => {
|
|
426
|
+
r((p) => ({ ...p, [c]: !1 })), o((p) => {
|
|
427
|
+
const f = { ...p };
|
|
428
|
+
return delete f[c], f;
|
|
429
|
+
});
|
|
430
|
+
}, []), s = h((c) => !!n[c], [n]), a = h(
|
|
431
|
+
(c) => t[c],
|
|
432
|
+
[t]
|
|
433
|
+
), i = I(
|
|
434
|
+
() => ({ openModal: d, closeModal: u }),
|
|
435
|
+
[d, u]
|
|
436
|
+
), l = I(
|
|
437
|
+
() => ({ isOpen: s, getModalData: a }),
|
|
438
|
+
[s, a]
|
|
439
|
+
);
|
|
440
|
+
return /* @__PURE__ */ g(G.Provider, { value: i, children: /* @__PURE__ */ g(H.Provider, { value: l, children: e }) });
|
|
441
|
+
}
|
|
442
|
+
function Re(e) {
|
|
443
|
+
const { openModal: n, closeModal: r } = ge(), { isOpen: t, getModalData: o } = pe();
|
|
444
|
+
return {
|
|
445
|
+
open: (d) => n(e, d),
|
|
446
|
+
close: () => r(e),
|
|
447
|
+
isOpen: t(e),
|
|
448
|
+
data: o(e)
|
|
449
|
+
};
|
|
372
450
|
}
|
|
373
|
-
let _ = null,
|
|
374
|
-
function
|
|
451
|
+
let _ = null, A = {};
|
|
452
|
+
function fe(e) {
|
|
375
453
|
_ = e;
|
|
376
454
|
}
|
|
377
|
-
function
|
|
378
|
-
|
|
455
|
+
function Te(e) {
|
|
456
|
+
A = { ...A, ...e };
|
|
379
457
|
}
|
|
380
|
-
function
|
|
381
|
-
return
|
|
458
|
+
function be() {
|
|
459
|
+
return A;
|
|
382
460
|
}
|
|
383
|
-
function
|
|
461
|
+
function Ie(e, n, r = 3e3, t) {
|
|
384
462
|
_ ? _(e, n, r, t) : console.warn("Toast system is not mounted");
|
|
385
463
|
}
|
|
386
|
-
var
|
|
464
|
+
var X = {
|
|
387
465
|
color: void 0,
|
|
388
466
|
size: void 0,
|
|
389
467
|
className: void 0,
|
|
390
468
|
style: void 0,
|
|
391
469
|
attr: void 0
|
|
392
|
-
},
|
|
393
|
-
function
|
|
470
|
+
}, Z = y.createContext && /* @__PURE__ */ y.createContext(X), xe = ["attr", "size", "title"];
|
|
471
|
+
function me(e, n) {
|
|
394
472
|
if (e == null) return {};
|
|
395
|
-
var r =
|
|
473
|
+
var r = he(e, n), t, o;
|
|
396
474
|
if (Object.getOwnPropertySymbols) {
|
|
397
|
-
var
|
|
398
|
-
for (
|
|
399
|
-
t =
|
|
475
|
+
var d = Object.getOwnPropertySymbols(e);
|
|
476
|
+
for (o = 0; o < d.length; o++)
|
|
477
|
+
t = d[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
|
|
400
478
|
}
|
|
401
479
|
return r;
|
|
402
480
|
}
|
|
403
|
-
function
|
|
481
|
+
function he(e, n) {
|
|
404
482
|
if (e == null) return {};
|
|
405
483
|
var r = {};
|
|
406
484
|
for (var t in e)
|
|
@@ -410,45 +488,45 @@ function ue(e, n) {
|
|
|
410
488
|
}
|
|
411
489
|
return r;
|
|
412
490
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
491
|
+
function z() {
|
|
492
|
+
return z = Object.assign ? Object.assign.bind() : function(e) {
|
|
415
493
|
for (var n = 1; n < arguments.length; n++) {
|
|
416
494
|
var r = arguments[n];
|
|
417
495
|
for (var t in r)
|
|
418
496
|
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
|
|
419
497
|
}
|
|
420
498
|
return e;
|
|
421
|
-
},
|
|
499
|
+
}, z.apply(this, arguments);
|
|
422
500
|
}
|
|
423
|
-
function
|
|
501
|
+
function W(e, n) {
|
|
424
502
|
var r = Object.keys(e);
|
|
425
503
|
if (Object.getOwnPropertySymbols) {
|
|
426
504
|
var t = Object.getOwnPropertySymbols(e);
|
|
427
|
-
n && (t = t.filter(function(
|
|
428
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
505
|
+
n && (t = t.filter(function(o) {
|
|
506
|
+
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
429
507
|
})), r.push.apply(r, t);
|
|
430
508
|
}
|
|
431
509
|
return r;
|
|
432
510
|
}
|
|
433
|
-
function
|
|
511
|
+
function D(e) {
|
|
434
512
|
for (var n = 1; n < arguments.length; n++) {
|
|
435
513
|
var r = arguments[n] != null ? arguments[n] : {};
|
|
436
|
-
n % 2 ?
|
|
437
|
-
|
|
438
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
514
|
+
n % 2 ? W(Object(r), !0).forEach(function(t) {
|
|
515
|
+
ye(e, t, r[t]);
|
|
516
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : W(Object(r)).forEach(function(t) {
|
|
439
517
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
440
518
|
});
|
|
441
519
|
}
|
|
442
520
|
return e;
|
|
443
521
|
}
|
|
444
|
-
function
|
|
445
|
-
return n =
|
|
522
|
+
function ye(e, n, r) {
|
|
523
|
+
return n = we(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
|
|
446
524
|
}
|
|
447
|
-
function
|
|
448
|
-
var n =
|
|
525
|
+
function we(e) {
|
|
526
|
+
var n = ve(e, "string");
|
|
449
527
|
return typeof n == "symbol" ? n : n + "";
|
|
450
528
|
}
|
|
451
|
-
function
|
|
529
|
+
function ve(e, n) {
|
|
452
530
|
if (typeof e != "object" || !e) return e;
|
|
453
531
|
var r = e[Symbol.toPrimitive];
|
|
454
532
|
if (r !== void 0) {
|
|
@@ -458,77 +536,77 @@ function pe(e, n) {
|
|
|
458
536
|
}
|
|
459
537
|
return (n === "string" ? String : Number)(e);
|
|
460
538
|
}
|
|
461
|
-
function
|
|
462
|
-
return e && e.map((n, r) => /* @__PURE__ */
|
|
539
|
+
function Y(e) {
|
|
540
|
+
return e && e.map((n, r) => /* @__PURE__ */ y.createElement(n.tag, D({
|
|
463
541
|
key: r
|
|
464
|
-
}, n.attr),
|
|
542
|
+
}, n.attr), Y(n.child)));
|
|
465
543
|
}
|
|
466
|
-
function
|
|
467
|
-
return (n) => /* @__PURE__ */
|
|
468
|
-
attr:
|
|
469
|
-
}, n),
|
|
544
|
+
function Ce(e) {
|
|
545
|
+
return (n) => /* @__PURE__ */ y.createElement(Ne, z({
|
|
546
|
+
attr: D({}, e.attr)
|
|
547
|
+
}, n), Y(e.child));
|
|
470
548
|
}
|
|
471
|
-
function
|
|
549
|
+
function Ne(e) {
|
|
472
550
|
var n = (r) => {
|
|
473
551
|
var {
|
|
474
552
|
attr: t,
|
|
475
|
-
size:
|
|
476
|
-
title:
|
|
477
|
-
} = e,
|
|
478
|
-
return r.className && (
|
|
553
|
+
size: o,
|
|
554
|
+
title: d
|
|
555
|
+
} = e, u = me(e, xe), s = o || r.size || "1em", a;
|
|
556
|
+
return r.className && (a = r.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */ y.createElement("svg", z({
|
|
479
557
|
stroke: "currentColor",
|
|
480
558
|
fill: "currentColor",
|
|
481
559
|
strokeWidth: "0"
|
|
482
|
-
}, r.attr, t,
|
|
483
|
-
className:
|
|
484
|
-
style:
|
|
560
|
+
}, r.attr, t, u, {
|
|
561
|
+
className: a,
|
|
562
|
+
style: D(D({
|
|
485
563
|
color: e.color || r.color
|
|
486
564
|
}, r.style), e.style),
|
|
487
|
-
height:
|
|
488
|
-
width:
|
|
565
|
+
height: s,
|
|
566
|
+
width: s,
|
|
489
567
|
xmlns: "http://www.w3.org/2000/svg"
|
|
490
|
-
}),
|
|
568
|
+
}), d && /* @__PURE__ */ y.createElement("title", null, d), e.children);
|
|
491
569
|
};
|
|
492
|
-
return
|
|
570
|
+
return Z !== void 0 ? /* @__PURE__ */ y.createElement(Z.Consumer, null, (r) => n(r)) : n(X);
|
|
493
571
|
}
|
|
494
|
-
function
|
|
495
|
-
return
|
|
572
|
+
function Oe(e) {
|
|
573
|
+
return Ce({ attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
|
|
496
574
|
}
|
|
497
|
-
const
|
|
575
|
+
const ke = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
498
576
|
const n = Math.random() * 16 | 0;
|
|
499
577
|
return (e === "x" ? n : n & 3 | 8).toString(16);
|
|
500
|
-
}),
|
|
578
|
+
}), _e = () => {
|
|
501
579
|
const [e, n] = w([]);
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
n((
|
|
506
|
-
n((
|
|
507
|
-
},
|
|
580
|
+
k(() => {
|
|
581
|
+
fe((t, o, d, u) => {
|
|
582
|
+
const s = ke();
|
|
583
|
+
n((a) => [...a, { id: s, type: t, message: o, config: u }]), setTimeout(() => {
|
|
584
|
+
n((a) => a.filter((i) => i.id !== s));
|
|
585
|
+
}, d);
|
|
508
586
|
});
|
|
509
587
|
}, []);
|
|
510
|
-
const r =
|
|
511
|
-
return /* @__PURE__ */
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
return /* @__PURE__ */
|
|
588
|
+
const r = be();
|
|
589
|
+
return /* @__PURE__ */ g("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
|
|
590
|
+
var a, i, l, c, p, f, b, m, v, C, S, j, P;
|
|
591
|
+
const o = ((a = t.config) == null ? void 0 : a.icon) || ((i = r.icons) == null ? void 0 : i[t.type]) || Se(t.type), d = ((l = t.config) == null ? void 0 : l.bgColor) || ((p = (c = r.colors) == null ? void 0 : c[t.type]) == null ? void 0 : p.bg) || "bg-white dark:bg-gray-800", u = ((f = t.config) == null ? void 0 : f.textColor) || ((m = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : m.text) || "text-gray-700 dark:text-gray-300", s = ((v = t.config) == null ? void 0 : v.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
|
|
592
|
+
return /* @__PURE__ */ x(
|
|
515
593
|
"div",
|
|
516
594
|
{
|
|
517
|
-
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${
|
|
595
|
+
className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${d} ${u}`,
|
|
518
596
|
children: [
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */
|
|
522
|
-
((
|
|
523
|
-
!((
|
|
597
|
+
/* @__PURE__ */ g("div", { className: s, children: o }),
|
|
598
|
+
/* @__PURE__ */ x("div", { className: "flex-1 me-3", children: [
|
|
599
|
+
((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ g("div", { className: "font-semibold text-black", children: t.config.title }),
|
|
600
|
+
((S = t.config) == null ? void 0 : S.description) && /* @__PURE__ */ g("div", { className: "text-sm text-gray-500", children: t.config.description }),
|
|
601
|
+
!((j = t.config) != null && j.title) && !((P = t.config) != null && P.description) && /* @__PURE__ */ g("div", { className: "text-sm", children: t.message })
|
|
524
602
|
] }),
|
|
525
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ g(
|
|
526
604
|
"button",
|
|
527
605
|
{
|
|
528
|
-
onClick: () => n((
|
|
606
|
+
onClick: () => n((L) => L.filter((M) => M.id !== t.id)),
|
|
529
607
|
className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
|
|
530
608
|
"aria-label": "Close",
|
|
531
|
-
children: /* @__PURE__ */
|
|
609
|
+
children: /* @__PURE__ */ g(Oe, { size: 18 })
|
|
532
610
|
}
|
|
533
611
|
)
|
|
534
612
|
]
|
|
@@ -537,7 +615,7 @@ const he = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, functio
|
|
|
537
615
|
);
|
|
538
616
|
}) });
|
|
539
617
|
};
|
|
540
|
-
function
|
|
618
|
+
function Se(e) {
|
|
541
619
|
switch (e) {
|
|
542
620
|
case "success":
|
|
543
621
|
return "â
";
|
|
@@ -550,15 +628,17 @@ function ye(e) {
|
|
|
550
628
|
}
|
|
551
629
|
}
|
|
552
630
|
export {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
631
|
+
$e as Badge,
|
|
632
|
+
Le as Button,
|
|
633
|
+
Me as Dropdown,
|
|
634
|
+
ne as Input,
|
|
635
|
+
ze as Modal,
|
|
636
|
+
De as ModalProvider,
|
|
637
|
+
_e as Toast,
|
|
638
|
+
Ee as Tooltip,
|
|
639
|
+
Te as setToastDefaults,
|
|
640
|
+
Ie as showToast,
|
|
641
|
+
ge as useModalActions,
|
|
642
|
+
Re as useModalInstance,
|
|
643
|
+
pe as useModalState
|
|
564
644
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
${
|
|
3
|
-
${
|
|
1
|
+
(function(x,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],o):(x=typeof globalThis<"u"?globalThis:x||self,o(x.TailwindUiKit={},x.jsxRuntime,x.React))})(this,function(x,o,s){"use strict";"use client";const D=s.forwardRef((e,n)=>{const{label:r,id:t,inputSize:l="md",shape:f="rounded",validate:g,onValidatedChange:a,className:i="",icon:d,iconPosition:c="left",floatingLabelStyle:u,onChange:p,isValid:b,isInvalid:h,feedback:m,feedbackType:y="invalid",...w}=e,[O,k]=s.useState("default"),M=C=>{const z=C.target.value,E=(g==null?void 0:g(z))??"default";k(E),a==null||a(C,E),p==null||p(C)},j={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},P={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},ve={filled:"rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",outlined:"rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",standard:"px-0 py-2.5 bg-transparent border-0 border-b-2"},Ce={filled:"absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",outlined:"absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",standard:"absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"},Ne=(C,z,E)=>{if(E)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(z)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(C){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},Se=j[l]||j.md,Oe=P[f]||P.flat,ke=Ne(O,b,h),Me=c==="start"||c==="left"?"left-0 ps-3.5":"right-0 pe-3.5",je=d&&(c==="start"||c==="left")?"ps-10":d?"pe-10":"",$=t??`input-${(r==null?void 0:r.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,v=!!u;return o.jsxs("div",{className:`w-full relative ${v?"z-0":""}`,children:[!v&&r&&o.jsx("label",{htmlFor:$,className:`block mb-1 font-light text-sm ${b?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:r}),o.jsxs("div",{className:"relative w-full",children:[d&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${Me}`,children:o.jsx("span",{className:"text-gray-500",children:d})}),o.jsx("input",{...w,id:$,ref:n,placeholder:v?" ":w.placeholder,onChange:M,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
|
|
2
|
+
${v&&u?ve[u]:Se}
|
|
3
|
+
${je} ${Oe} ${ke} ${i}`}),v&&r&&u&&o.jsx("label",{htmlFor:$,className:`ms-1 ${Ce[u]} ${i}`,children:r})]}),m&&o.jsx("p",{className:`mt-1 text-xs ${y==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:m})]})});D.displayName="Input";const H={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",success:"bg-green-600 text-white hover:bg-green-700",danger:"bg-red-600 text-white hover:bg-red-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-cyan-600 text-white hover:bg-cyan-700",dark:"bg-gray-900 text-white hover:bg-black",light:"bg-gray-100 text-black hover:bg-gray-200",link:"bg-transparent text-blue-600 hover:underline [&&]:p-0 [&&]:shadow-none","outline-primary":"border border-blue-600 text-blue-600 hover:bg-blue-50","outline-secondary":"border border-gray-600 text-gray-600 hover:bg-gray-50","outline-success":"border border-green-600 text-green-600 hover:bg-green-50","outline-danger":"border border-red-600 text-red-600 hover:bg-red-50","outline-warning":"border border-yellow-500 text-yellow-600 hover:bg-yellow-50","outline-info":"border border-cyan-600 text-cyan-600 hover:bg-cyan-50","outline-dark":"border border-gray-900 text-gray-900 hover:bg-gray-100","outline-light":"border border-gray-100 text-gray-500 hover:bg-gray-200"},q={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},K={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},U=({children:e,variant:n="primary",size:r="md",type:t="button",shape:l="rounded",className:f="",isLoading:g=!1,disabled:a=!1,...i})=>{const d=a||g,c=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",H[n],q[r],K[l],l==="flat"?"shadow-none":"shadow-sm",d?"opacity-50 cursor-not-allowed pointer-events-none":"",f].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:c,disabled:d,...i,children:[g&&o.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),e]})},X=({label:e,children:n,position:r="right"})=>{const[t,l]=s.useState(!1),[f,g]=s.useState(!1),a=s.useRef(null),i=s.useRef(null),d=s.useMemo(()=>{switch(r){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[r]),c=s.useCallback(b=>{const h=b.target;a.current&&!a.current.contains(h)&&i.current&&!i.current.contains(h)&&l(!1)},[]),u=s.useCallback(()=>{if(!i.current||!a.current)return;const b=i.current.getBoundingClientRect(),h=a.current.getBoundingClientRect(),m=window.innerHeight-b.bottom,y=b.top;g(m<h.height&&y>h.height)},[]);s.useEffect(()=>{if(t)return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[t,u]),s.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c]);const p=s.useCallback(()=>l(b=>!b),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:i,onClick:p,children:e}),t&&o.jsx("div",{ref:a,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
|
|
4
4
|
${f?"bottom-full mb-2":"top-full mt-2"}
|
|
5
|
-
${u}`,children:n})]})},U=({children:e,content:n,position:r="top",className:t="",tooltipClass:c="",tooltipStyle:f={}})=>{const d=s.useRef(null),l=s.useRef(null);s.useEffect(()=>{const u=d.current,i=l.current;if(!u||!i)return;const g=()=>{i.style.opacity="1",i.style.visibility="visible"},b=()=>{i.style.opacity="0",i.style.visibility="hidden"};return u.addEventListener("mouseenter",g),u.addEventListener("mouseleave",b),()=>{u.removeEventListener("mouseenter",g),u.removeEventListener("mouseleave",b)}},[]);const a=u=>{const i={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(u){case"top":return{...i,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...i,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...i,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...i,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return i}};return o.jsxs("div",{ref:d,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:l,role:"tooltip",className:c,style:{...a(r),...f},children:n})]})},T=s.createContext(null),_=()=>{const e=s.useContext(T);return e||(console.warn("â ī¸ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function X({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:c=!1,containerClasses:f="",onClose:d}){const l=_(),a=l&&typeof l.openModal=="function",u=!t&&a,[i,g]=s.useState(!1),b=u?l.isOpen(e):i,x=()=>{u?l.closeModal(e):g(!1),d&&d()};return s.useEffect(()=>(b?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[b]),b?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),c&&o.jsx("button",{onClick:()=>x(),className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"â"})]}),o.jsx("div",{className:"text-sm text-gray-700",children:r})]})}):null}function Y({children:e}){const[n,r]=s.useState({}),t=s.useCallback(d=>{r(l=>({...l,[d]:!0}))},[]),c=s.useCallback(d=>{r(l=>({...l,[d]:!1}))},[]),f=s.useCallback(d=>!!n[d],[n]);return o.jsx(T.Provider,{value:{openModal:t,closeModal:c,isOpen:f},children:e})}let M=null,z={};function J(e){M=e}function Q(e){z={...z,...e}}function V(){return z}function R(e,n,r=3e3,t){M?M(e,n,r,t):console.warn("Toast system is not mounted")}var B={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},A=s.createContext&&s.createContext(B),ee=["attr","size","title"];function te(e,n){if(e==null)return{};var r=re(e,n),t,c;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(c=0;c<f.length;c++)t=f[c],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function re(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},N.apply(this,arguments)}function F(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),r.push.apply(r,t)}return r}function O(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F(Object(r),!0).forEach(function(t){ne(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ne(e,n,r){return n=oe(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function oe(e){var n=se(e,"string");return typeof n=="symbol"?n:n+""}function se(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Z(e){return e&&e.map((n,r)=>s.createElement(n.tag,O({key:r},n.attr),Z(n.child)))}function le(e){return n=>s.createElement(ae,N({attr:O({},e.attr)},n),Z(e.child))}function ae(e){var n=r=>{var{attr:t,size:c,title:f}=e,d=te(e,ee),l=c||r.size||"1em",a;return r.className&&(a=r.className),e.className&&(a=(a?a+" ":"")+e.className),s.createElement("svg",N({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,d,{className:a,style:O(O({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),f&&s.createElement("title",null,f),e.children)};return A!==void 0?s.createElement(A.Consumer,null,r=>n(r)):n(B)}function ie(e){return le({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const ce=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),de=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{J((t,c,f,d)=>{const l=ce();n(a=>[...a,{id:l,type:t,message:c,config:d}]),setTimeout(()=>{n(a=>a.filter(u=>u.id!==l))},f)})},[]);const r=V();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var a,u,i,g,b,x,h,m,y,v,S,j,k;const c=((a=t.config)==null?void 0:a.icon)||((u=r.icons)==null?void 0:u[t.type])||ue(t.type),f=((i=t.config)==null?void 0:i.bgColor)||((b=(g=r.colors)==null?void 0:g[t.type])==null?void 0:b.bg)||"bg-white dark:bg-gray-800",d=((x=t.config)==null?void 0:x.textColor)||((m=(h=r.colors)==null?void 0:h[t.type])==null?void 0:m.text)||"text-gray-700 dark:text-gray-300",l=((y=t.config)==null?void 0:y.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${d}`,children:[o.jsx("div",{className:l,children:c}),o.jsxs("div",{className:"flex-1 me-3",children:[((v=t.config)==null?void 0:v.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((S=t.config)==null?void 0:S.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((j=t.config)!=null&&j.title)&&!((k=t.config)!=null&&k.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(E=>E.filter(P=>P.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(ie,{size:18})})]},t.id)})})};function ue(e){switch(e){case"success":return"â
";case"error":return"â";case"warning":return"â ī¸";case"info":return"âšī¸"}}p.Button=q,p.Dropdown=K,p.Input=D,p.Modal=X,p.ModalContext=T,p.ModalProvider=Y,p.Toast=de,p.Tooltip=U,p.setToastDefaults=Q,p.showToast=R,p.useModal=_,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
${d}`,children:n})]})},Y=({children:e,content:n,position:r="top",className:t="",tooltipClass:l="",tooltipStyle:f={}})=>{const g=s.useRef(null),a=s.useRef(null);s.useEffect(()=>{const d=g.current,c=a.current;if(!d||!c)return;const u=()=>{c.style.opacity="1",c.style.visibility="visible"},p=()=>{c.style.opacity="0",c.style.visibility="hidden"};return d.addEventListener("mouseenter",u),d.addEventListener("mouseleave",p),()=>{d.removeEventListener("mouseenter",u),d.removeEventListener("mouseleave",p)}},[]);const i=d=>{const c={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(d){case"top":return{...c,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...c,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...c,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...c,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return c}};return o.jsxs("div",{ref:g,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:a,role:"tooltip",className:l,style:{...i(r),...f},children:n})]})},J={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},Q={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},V={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},R=({label:e,variant:n="primary",size:r="sm",shape:t="rounded",icon:l,dismissible:f,onDismiss:g,className:a="",...i})=>{const d=!e&&!!l,c=`inline-flex items-center font-medium ${J[n]||""} ${Q[r]||""} ${V[t]||""} ${d?"justify-center p-2 w-8 h-8":""} `+a;return o.jsxs("span",{className:c.trim(),...i,children:[l&&o.jsx("span",{className:e?"mr-1":"",children:l}),e,f&&o.jsx("button",{type:"button",onClick:g,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"Ã"})]})},ee=s.createContext(null),te=()=>{const e=s.useContext(ee);return e||(console.warn("â ī¸ useModal() called outside of ModalProvider. Falling back to standalone modal usage."),null)};function re({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:l=!1,containerClasses:f="",onClose:g}){const a=te(),i=a&&typeof a.openModal=="function",d=!t&&i,[c,u]=s.useState(!1),p=d?a.isOpen(e):c,b=d?a.getModalData(e):null,h=()=>{d?a.closeModal(e):u(!1),g==null||g()};return s.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[p]),p?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-3 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),l&&o.jsx("button",{onClick:h,className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"â"})]}),o.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof r=="function"?r({modalData:b}):r})]})}):null}const I=s.createContext(null),B=()=>s.useContext(I),_=s.createContext(null),A=()=>s.useContext(_);function ne({children:e}){const[n,r]=s.useState({}),[t,l]=s.useState({}),f=s.useCallback((u,p)=>{r(b=>({...b,[u]:!0})),p&&l(b=>({...b,[u]:p}))},[]),g=s.useCallback(u=>{r(p=>({...p,[u]:!1})),l(p=>{const b={...p};return delete b[u],b})},[]),a=s.useCallback(u=>!!n[u],[n]),i=s.useCallback(u=>t[u],[t]),d=s.useMemo(()=>({openModal:f,closeModal:g}),[f,g]),c=s.useMemo(()=>({isOpen:a,getModalData:i}),[a,i]);return o.jsx(I.Provider,{value:d,children:o.jsx(_.Provider,{value:c,children:e})})}function oe(e){const{openModal:n,closeModal:r}=B(),{isOpen:t,getModalData:l}=A();return{open:f=>n(e,f),close:()=>r(e),isOpen:t(e),data:l(e)}}let L=null,T={};function se(e){L=e}function le(e){T={...T,...e}}function ae(){return T}function ie(e,n,r=3e3,t){L?L(e,n,r,t):console.warn("Toast system is not mounted")}var F={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Z=s.createContext&&s.createContext(F),ce=["attr","size","title"];function de(e,n){if(e==null)return{};var r=ue(e,n),t,l;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(l=0;l<f.length;l++)t=f[l],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function ue(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function N(){return N=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},N.apply(this,arguments)}function W(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,t)}return r}function S(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?W(Object(r),!0).forEach(function(t){fe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fe(e,n,r){return n=ge(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ge(e){var n=pe(e,"string");return typeof n=="symbol"?n:n+""}function pe(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function G(e){return e&&e.map((n,r)=>s.createElement(n.tag,S({key:r},n.attr),G(n.child)))}function be(e){return n=>s.createElement(xe,N({attr:S({},e.attr)},n),G(e.child))}function xe(e){var n=r=>{var{attr:t,size:l,title:f}=e,g=de(e,ce),a=l||r.size||"1em",i;return r.className&&(i=r.className),e.className&&(i=(i?i+" ":"")+e.className),s.createElement("svg",N({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,g,{className:i,style:S(S({color:e.color||r.color},r.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),f&&s.createElement("title",null,f),e.children)};return Z!==void 0?s.createElement(Z.Consumer,null,r=>n(r)):n(F)}function he(e){return be({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const me=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),ye=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{se((t,l,f,g)=>{const a=me();n(i=>[...i,{id:a,type:t,message:l,config:g}]),setTimeout(()=>{n(i=>i.filter(d=>d.id!==a))},f)})},[]);const r=ae();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var i,d,c,u,p,b,h,m,y,w,O,k,M;const l=((i=t.config)==null?void 0:i.icon)||((d=r.icons)==null?void 0:d[t.type])||we(t.type),f=((c=t.config)==null?void 0:c.bgColor)||((p=(u=r.colors)==null?void 0:u[t.type])==null?void 0:p.bg)||"bg-white dark:bg-gray-800",g=((b=t.config)==null?void 0:b.textColor)||((m=(h=r.colors)==null?void 0:h[t.type])==null?void 0:m.text)||"text-gray-700 dark:text-gray-300",a=((y=t.config)==null?void 0:y.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${g}`,children:[o.jsx("div",{className:a,children:l}),o.jsxs("div",{className:"flex-1 me-3",children:[((w=t.config)==null?void 0:w.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((O=t.config)==null?void 0:O.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((k=t.config)!=null&&k.title)&&!((M=t.config)!=null&&M.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(j=>j.filter(P=>P.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(he,{size:18})})]},t.id)})})};function we(e){switch(e){case"success":return"â
";case"error":return"â";case"warning":return"â ī¸";case"info":return"âšī¸"}}x.Badge=R,x.Button=U,x.Dropdown=X,x.Input=D,x.Modal=re,x.ModalProvider=ne,x.Toast=ye,x.Tooltip=Y,x.setToastDefaults=le,x.showToast=ie,x.useModalActions=B,x.useModalInstance=oe,x.useModalState=A,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Variant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light" | "link" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-danger" | "outline-warning" | "outline-info" | "outline-dark" | "outline-light";
|
|
2
|
+
export type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
export type Shape = "flat" | "rounded" | "pill" | "circle";
|
|
4
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
label?: string;
|
|
6
|
+
variant?: Variant;
|
|
7
|
+
size?: Size;
|
|
8
|
+
shape?: Shape;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
dismissible?: boolean;
|
|
11
|
+
onDismiss?: () => void;
|
|
12
|
+
}
|