kitzo 2.3.5 → 2.3.7
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 +39 -258
- package/dist/fns.d.ts +3 -0
- package/dist/fns.js +4 -0
- package/dist/functions/copy/copy.js +23 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +14 -0
- package/dist/react/components/toast/Toaster.js +71 -0
- package/dist/react/components/toast/helpers/addToastStyles.js +259 -0
- package/dist/react/components/toast/helpers/createToast.js +45 -0
- package/dist/react/components/toast/helpers/listenar.js +14 -0
- package/dist/react/components/toast/helpers/manageToasts/addToasts.js +12 -0
- package/dist/react/components/toast/helpers/manageToasts/dismissToasts.js +17 -0
- package/dist/react/components/toast/helpers/manageToasts/manageToasts.js +9 -0
- package/dist/react/components/toast/helpers/manageToasts/timers.js +39 -0
- package/dist/react/components/toast/helpers/manageToasts/updateToasts.js +10 -0
- package/dist/react/components/toast/helpers/triggerToasts.js +99 -0
- package/dist/react/components/toast/partials/Svgs.js +98 -0
- package/dist/react/components/toast/partials/Toast.js +54 -0
- package/dist/react/components/toast/partials/ToastContainer.js +59 -0
- package/dist/react/components/tooltip/Tooltip.js +67 -0
- package/dist/react/components/tooltip/helpers/addTooltipStyles.js +230 -0
- package/dist/react/components/tooltip/helpers/getAnimationProperties.js +12 -0
- package/dist/react/components/tooltip/helpers/getPositionClass.js +27 -0
- package/dist/react/components/tooltip/partials/TooltipWrapper.js +29 -0
- package/dist/react/hooks/useCopy.js +38 -0
- package/dist/react/hooks/useDebounce.js +16 -0
- package/dist/react/hooks/useWindowSize.js +26 -0
- package/package.json +73 -77
- package/dist/functions/index.js +0 -36
- package/dist/functions/index.js.map +0 -1
- package/dist/functions/types.d.ts +0 -2
- package/dist/react/index.js +0 -1094
- package/dist/react/index.js.map +0 -1
- package/dist/react/types/hooks.d.ts +0 -34
- package/dist/react/types/toast.d.ts +0 -60
- package/dist/react/types/tooltip.d.ts +0 -55
- package/dist/react/types.d.ts +0 -3
package/README.md
CHANGED
|
@@ -1,258 +1,39 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// ---------------------
|
|
41
|
-
|
|
42
|
-
toast('Toast message', {
|
|
43
|
-
id: 'normat_toast',
|
|
44
|
-
duration: 2000,
|
|
45
|
-
showIcon: true,
|
|
46
|
-
position: 'top-center',
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
toast.success('Toast message', {
|
|
50
|
-
id: 'success_toast',
|
|
51
|
-
duration: 2000,
|
|
52
|
-
showIcon: true,
|
|
53
|
-
position: 'top-center',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
toast.error('Toast message', {
|
|
57
|
-
id: 'error_toast',
|
|
58
|
-
duration: 2000,
|
|
59
|
-
showIcon: true,
|
|
60
|
-
position: 'top-center',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// content can be: (dismiss) => (
|
|
64
|
-
// <div>
|
|
65
|
-
// <span>any thing</span>
|
|
66
|
-
// <button onClick={dismiss} >❌</button>
|
|
67
|
-
// </div>
|
|
68
|
-
//)
|
|
69
|
-
|
|
70
|
-
// ---------------------
|
|
71
|
-
// Promise-based toast
|
|
72
|
-
// ---------------------
|
|
73
|
-
|
|
74
|
-
toast.promise(
|
|
75
|
-
promise(), // function that returns a promise
|
|
76
|
-
{
|
|
77
|
-
loading: 'Saving...',
|
|
78
|
-
success: (res) => `Saved: ${res}`, // or just 'Saved'
|
|
79
|
-
error: (err) => `Error occurred: ${err}`, // or just 'Error occurred'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'promise_toast',
|
|
83
|
-
duration: 2000,
|
|
84
|
-
showIcon: true,
|
|
85
|
-
position: 'top-center',
|
|
86
|
-
},
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// ---------------------
|
|
90
|
-
// Custom toast
|
|
91
|
-
// ---------------------
|
|
92
|
-
|
|
93
|
-
// JSX element
|
|
94
|
-
toast.custom(<MyCustomComponent />, {
|
|
95
|
-
id: 'custom_toast',
|
|
96
|
-
duration: 2000,
|
|
97
|
-
position: 'top-center',
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Function that receives a dismiss handler
|
|
101
|
-
toast.custom(
|
|
102
|
-
(dismiss) => (
|
|
103
|
-
<div>
|
|
104
|
-
<span>Custom toast message</span>
|
|
105
|
-
<button onClick={dismiss}>Close</button>
|
|
106
|
-
</div>
|
|
107
|
-
),
|
|
108
|
-
{
|
|
109
|
-
id: 'custom_toast',
|
|
110
|
-
duration: Infinity, // or 3000
|
|
111
|
-
position: 'top-center',
|
|
112
|
-
},
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// Simple string
|
|
116
|
-
toast.custom('Simple string toast', {
|
|
117
|
-
id: 'custom_toast',
|
|
118
|
-
duration: 2000,
|
|
119
|
-
position: 'top-center',
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// ---------------------
|
|
123
|
-
// Update / Dismiss
|
|
124
|
-
// ---------------------
|
|
125
|
-
// ❗ Update is only supported on custom toasts
|
|
126
|
-
|
|
127
|
-
toast.update('my-toast', 'Updated content!', {
|
|
128
|
-
duration: 3000,
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Dismiss by id (optional)
|
|
132
|
-
toast.dismiss('my-toast');
|
|
133
|
-
// Or dismiss all toasts
|
|
134
|
-
toast.dismiss();
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
> Each toast can have its own position. default position is `top-center`.
|
|
138
|
-
|
|
139
|
-
##### React Tooltip API usage:
|
|
140
|
-
|
|
141
|
-
```jsx
|
|
142
|
-
import { Tooltip } from 'kitzo';
|
|
143
|
-
|
|
144
|
-
function App() {
|
|
145
|
-
return (
|
|
146
|
-
<div>
|
|
147
|
-
<h1>Tooltip api</h1>
|
|
148
|
-
|
|
149
|
-
<div>
|
|
150
|
-
<Tooltip
|
|
151
|
-
content="Tooltip"
|
|
152
|
-
tooltipOptions={{
|
|
153
|
-
offset: 10,
|
|
154
|
-
smartHover: true,
|
|
155
|
-
}}
|
|
156
|
-
animate={{
|
|
157
|
-
duration: 120,
|
|
158
|
-
startDelay: 400,
|
|
159
|
-
endDelay: 50,
|
|
160
|
-
}}
|
|
161
|
-
style={{
|
|
162
|
-
'--arrow-size': 6,
|
|
163
|
-
'--arrow-color': 'red',
|
|
164
|
-
}}
|
|
165
|
-
>
|
|
166
|
-
<button>Hover me</button>
|
|
167
|
-
</Tooltip>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
> You can provide your own custom jsx element as `content`. e.g. `content={<div>Custom tooltip</div>}`
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
### Hooks
|
|
179
|
-
|
|
180
|
-
- useDebounce
|
|
181
|
-
- useWindowSize
|
|
182
|
-
|
|
183
|
-
#### useDebounce usage:
|
|
184
|
-
|
|
185
|
-
```jsx
|
|
186
|
-
import { useDebounce } from 'kitzo';
|
|
187
|
-
|
|
188
|
-
function App() {
|
|
189
|
-
const [value, setValue] = useState('');
|
|
190
|
-
const debouncedValue = useDebounce(value, 500);
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<div>
|
|
194
|
-
<input
|
|
195
|
-
value={value}
|
|
196
|
-
onChange={(e) => setValue(e.target.value)}
|
|
197
|
-
/>
|
|
198
|
-
<p>Debounced value: {debouncedValue}</p>
|
|
199
|
-
</div>
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### useWindowSize usage:
|
|
205
|
-
|
|
206
|
-
```jsx
|
|
207
|
-
import { useWindowSize } from 'kitzo';
|
|
208
|
-
|
|
209
|
-
function App() {
|
|
210
|
-
const { screenWidth, screenHeight } = useWindowSize({ delay: 100 });
|
|
211
|
-
|
|
212
|
-
return (
|
|
213
|
-
<div>
|
|
214
|
-
<p>Window width: {width}</p>
|
|
215
|
-
<p>Window height: {height}</p>
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
### Functions
|
|
224
|
-
|
|
225
|
-
- copy _(Copy text to clipboard)_
|
|
226
|
-
|
|
227
|
-
#### copy usage:
|
|
228
|
-
|
|
229
|
-
```jsx
|
|
230
|
-
import { copy } from 'kitzo/fns';
|
|
231
|
-
import { ToastContainer, toast } from 'kitzo';
|
|
232
|
-
|
|
233
|
-
// copy(text: string): Promise<void>;
|
|
234
|
-
|
|
235
|
-
function App() {
|
|
236
|
-
async function copyText(text) {
|
|
237
|
-
try {
|
|
238
|
-
await copy(text);
|
|
239
|
-
toast.success('Copied to clipboard');
|
|
240
|
-
} catch (err) {
|
|
241
|
-
console.error(err);
|
|
242
|
-
toast.error('Failed to copy to clipboard');
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return (
|
|
247
|
-
<div>
|
|
248
|
-
<button onClick={() => copyText('hello world')}>Copy text</button>
|
|
249
|
-
<ToastContainer />
|
|
250
|
-
</div>
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// or just
|
|
255
|
-
copy('hello world');
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
> Use `copy` function to copy text to clipboard.
|
|
1
|
+
# Kitzo
|
|
2
|
+
|
|
3
|
+
**Lightweight React UI components and essential hooks.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### 📦 Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install kitzo
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### 🚀 Core Features
|
|
16
|
+
|
|
17
|
+
#### Components
|
|
18
|
+
|
|
19
|
+
🍞 **Toast** — Accessible, animated notifications.
|
|
20
|
+
💡 **Tooltip** — Smart-positioned contextual labels.
|
|
21
|
+
|
|
22
|
+
#### Hooks
|
|
23
|
+
|
|
24
|
+
⏱️ **useDebounce** — Optimize performance by delaying execution.
|
|
25
|
+
📏 **useWindowSize** — Real-time viewport dimensions.
|
|
26
|
+
📋 **useCopy** — Simple "copy to clipboard" functionality.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### 📖 Documentation
|
|
31
|
+
|
|
32
|
+
For usage guides and live demos, visit documentation:
|
|
33
|
+
[https://kitzo.vercel.app](https://kitzo.vercel.app)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### 📄 License
|
|
38
|
+
|
|
39
|
+
MIT
|
package/dist/fns.d.ts
ADDED
package/dist/fns.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function o(e) {
|
|
2
|
+
const t = document.createElement("textarea");
|
|
3
|
+
t.value = e, document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
4
|
+
}
|
|
5
|
+
async function n(e) {
|
|
6
|
+
if (!navigator.clipboard?.writeText) {
|
|
7
|
+
o(e);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
await navigator.clipboard.writeText(e);
|
|
12
|
+
} catch (t) {
|
|
13
|
+
o(e), console.error(t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function r(e) {
|
|
17
|
+
if (e == null) throw new Error("[kitzo/copy] expected a value to copy, got null or undefined.");
|
|
18
|
+
const t = typeof e == "string" || typeof e == "number" ? String(e) : JSON.stringify(e);
|
|
19
|
+
await n(t);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
r as default
|
|
23
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
declare type AnimationOptions = {
|
|
6
|
+
duration?: number;
|
|
7
|
+
startDuration?: number;
|
|
8
|
+
endDuration?: number;
|
|
9
|
+
delay?: number;
|
|
10
|
+
startDelay?: number;
|
|
11
|
+
endDelay?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare type CopyStatus = 'standby' | 'copying' | 'copied' | 'error';
|
|
15
|
+
|
|
16
|
+
declare type Position = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
17
|
+
|
|
18
|
+
declare type Positions = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
19
|
+
|
|
20
|
+
declare type PromiseToastFn = <T, E = unknown>(promise: Promise<T>, msgs: PromiseToastMsgs<T, E>, options?: PromiseToastOptions) => Promise<T>;
|
|
21
|
+
|
|
22
|
+
declare type PromiseToastMsgs<T, E = unknown> = {
|
|
23
|
+
loading: ReactNode;
|
|
24
|
+
success: ReactNode | ((res: T) => ReactNode | Promise<ReactNode>);
|
|
25
|
+
error: ReactNode | ((err: E) => ReactNode | Promise<ReactNode>);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
declare type PromiseToastOptions = Omit<ToastOptions, 'id' | 'type'>;
|
|
29
|
+
|
|
30
|
+
export declare const toast: ToastFn;
|
|
31
|
+
|
|
32
|
+
declare type ToastContent = ((dismiss: () => void) => ReactNode) | ReactNode;
|
|
33
|
+
|
|
34
|
+
export declare function Toaster(props: ToasterProps): JSX.Element;
|
|
35
|
+
|
|
36
|
+
declare type ToasterProps = {
|
|
37
|
+
position?: Positions;
|
|
38
|
+
richColors?: boolean;
|
|
39
|
+
animateTransformOrigin?: boolean;
|
|
40
|
+
gap?: number | `${number}`;
|
|
41
|
+
edgeOffset?: number | `${number}px` | `${number}rem` | `${number}%`;
|
|
42
|
+
isDark?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare type ToastFn = {
|
|
46
|
+
(content: ToastContent, options?: ToastOptions): void;
|
|
47
|
+
info: (content: ToastContent, options?: ToastOptions) => void;
|
|
48
|
+
success: (content: ToastContent, options?: ToastOptions) => void;
|
|
49
|
+
warning: (content: ToastContent, options?: ToastOptions) => void;
|
|
50
|
+
error: (content: ToastContent, options?: ToastOptions) => void;
|
|
51
|
+
promise: PromiseToastFn;
|
|
52
|
+
loading: (content: ToastContent, options?: ToastOptions) => void;
|
|
53
|
+
custom: (content: ToastContent, options?: ToastOptions) => void;
|
|
54
|
+
dismiss: (id?: string | number) => void;
|
|
55
|
+
update: (id: string | number, content: ToastContent, options?: ToastUpdateOptions) => void;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
declare type ToastOptions = {
|
|
59
|
+
duration?: number;
|
|
60
|
+
showIcon?: boolean;
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
position?: Positions;
|
|
63
|
+
animateTransformOrigin?: boolean;
|
|
64
|
+
id?: string | number;
|
|
65
|
+
type?: ToastType;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
declare type ToastType = 'default' | 'success' | 'warning' | 'error' | 'info' | 'custom' | 'loading';
|
|
69
|
+
|
|
70
|
+
declare type ToastUpdateOptions = Omit<ToastOptions, 'id'>;
|
|
71
|
+
|
|
72
|
+
export declare function Tooltip(props: TooltipProps): ReactNode;
|
|
73
|
+
|
|
74
|
+
declare type TooltipAnimation = boolean | AnimationOptions;
|
|
75
|
+
|
|
76
|
+
declare type TooltipCoreProps = {
|
|
77
|
+
/**
|
|
78
|
+
* content is necessary
|
|
79
|
+
*/
|
|
80
|
+
content: ReactNode;
|
|
81
|
+
position?: Position;
|
|
82
|
+
offset?: number;
|
|
83
|
+
smartHover?: boolean;
|
|
84
|
+
hideOnTouch?: boolean;
|
|
85
|
+
animation?: TooltipAnimation;
|
|
86
|
+
isHidden?: boolean;
|
|
87
|
+
isDark?: boolean;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
declare type TooltipProps = PropsWithChildren<TooltipCoreProps>;
|
|
91
|
+
|
|
92
|
+
export declare function useCopy(options?: UseCopyOptions): UseCopyReturn;
|
|
93
|
+
|
|
94
|
+
declare type UseCopyOptions = {
|
|
95
|
+
resetDelay?: number;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare type UseCopyReturn = {
|
|
99
|
+
copy: (doc: string) => Promise<void>;
|
|
100
|
+
status: CopyStatus;
|
|
101
|
+
error: Error | null;
|
|
102
|
+
isCopying: boolean;
|
|
103
|
+
isCopied: boolean;
|
|
104
|
+
isError: boolean;
|
|
105
|
+
isStandby: boolean;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export declare function useDebounce<T>(value: T, delay?: number): T;
|
|
109
|
+
|
|
110
|
+
export declare function useWindowSize(options?: UseWindowSizeOptions): {
|
|
111
|
+
screenWidth: number;
|
|
112
|
+
screenHeight: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
declare type UseWindowSizeOptions = {
|
|
116
|
+
updateDelay?: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as t } from "./react/hooks/useWindowSize.js";
|
|
2
|
+
import { default as r } from "./react/hooks/useDebounce.js";
|
|
3
|
+
import { default as s } from "./react/hooks/useCopy.js";
|
|
4
|
+
import { default as p } from "./react/components/tooltip/Tooltip.js";
|
|
5
|
+
import { default as l } from "./react/components/toast/Toaster.js";
|
|
6
|
+
import { default as x } from "./react/components/toast/helpers/triggerToasts.js";
|
|
7
|
+
export {
|
|
8
|
+
l as Toaster,
|
|
9
|
+
p as Tooltip,
|
|
10
|
+
x as toast,
|
|
11
|
+
s as useCopy,
|
|
12
|
+
r as useDebounce,
|
|
13
|
+
t as useWindowSize
|
|
14
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as k, useRef as v, useCallback as x, useLayoutEffect as E } from "react";
|
|
3
|
+
import { subscribe as T } from "./helpers/listenar.js";
|
|
4
|
+
import z from "./helpers/manageToasts/manageToasts.js";
|
|
5
|
+
import O from "./partials/ToastContainer.js";
|
|
6
|
+
function A(p) {
|
|
7
|
+
const {
|
|
8
|
+
position: u = "top-center",
|
|
9
|
+
richColors: l = !0,
|
|
10
|
+
animateTransformOrigin: m = !0,
|
|
11
|
+
gap: o = 8,
|
|
12
|
+
edgeOffset: n = 16,
|
|
13
|
+
isDark: d = window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
14
|
+
} = p, [c, h] = b([]);
|
|
15
|
+
k(() => T((e) => z({ toast: e, setToasts: h })), []);
|
|
16
|
+
const s = v(null), r = x(() => {
|
|
17
|
+
if (!s.current) return;
|
|
18
|
+
const t = s.current.querySelectorAll("[data-toast-container]"), e = {
|
|
19
|
+
"top-left": 0,
|
|
20
|
+
"top-center": 0,
|
|
21
|
+
"top-right": 0,
|
|
22
|
+
"bottom-left": 0,
|
|
23
|
+
"bottom-center": 0,
|
|
24
|
+
"bottom-right": 0
|
|
25
|
+
};
|
|
26
|
+
t.forEach((a) => {
|
|
27
|
+
const f = a.getAttribute("data-toast-position") || "top-center", g = parseFloat(a.style.getPropertyValue("--toast-height")) || 0;
|
|
28
|
+
a.style.setProperty("--toast-offset-y", `${e[f]}px`);
|
|
29
|
+
const y = isNaN(+o) ? +o : 8;
|
|
30
|
+
e[f] += g + y;
|
|
31
|
+
});
|
|
32
|
+
}, [o]);
|
|
33
|
+
return E(() => {
|
|
34
|
+
r();
|
|
35
|
+
}, [c, r]), /* @__PURE__ */ i(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: s,
|
|
39
|
+
style: {
|
|
40
|
+
position: "fixed",
|
|
41
|
+
inset: 0,
|
|
42
|
+
zIndex: 2147483647,
|
|
43
|
+
pointerEvents: "none",
|
|
44
|
+
display: "grid",
|
|
45
|
+
padding: n ?? 16
|
|
46
|
+
},
|
|
47
|
+
className: `kitzo-toaster ${l ? "kitzo-toaster-rich-colors" : ""} ${d ? "kitzo-toaster-dark" : ""}`,
|
|
48
|
+
children: /* @__PURE__ */ i(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
style: {
|
|
52
|
+
position: "relative"
|
|
53
|
+
},
|
|
54
|
+
children: c.map((t) => /* @__PURE__ */ i(
|
|
55
|
+
O,
|
|
56
|
+
{
|
|
57
|
+
t,
|
|
58
|
+
animateTransformOrigin: m,
|
|
59
|
+
containerPosition: u,
|
|
60
|
+
updateOffsets: r
|
|
61
|
+
},
|
|
62
|
+
t.id
|
|
63
|
+
))
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
A as default
|
|
71
|
+
};
|