beez-ui 0.4.0 → 0.5.0
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/CHANGELOG.md +31 -19
- package/README.md +49 -11
- package/dist/adapters/unpic-image.js +92 -14
- package/dist/components/alert-dialog.js +444 -26
- package/dist/components/alert.js +153 -18
- package/dist/components/animated-theme-toggler.js +215 -76
- package/dist/components/avatar.js +247 -15
- package/dist/components/badge.js +18 -16
- package/dist/components/button.js +85 -28
- package/dist/components/calendar.js +327 -68
- package/dist/components/card.js +39 -9
- package/dist/components/carousel.js +454 -84
- package/dist/components/checkbox.js +50 -3
- package/dist/components/data-table.js +827 -583
- package/dist/components/dialog.js +363 -22
- package/dist/components/dropdown-menu.js +543 -32
- package/dist/components/filter-query-bar.js +809 -468
- package/dist/components/filter-query-grammar.js +781 -736
- package/dist/components/form.js +305 -43
- package/dist/components/highlighter.js +142 -87
- package/dist/components/hover-card.js +97 -7
- package/dist/components/input-group.js +261 -41
- package/dist/components/input.js +8 -2
- package/dist/components/label.js +38 -3
- package/dist/components/link.js +45 -7
- package/dist/components/pagination.js +332 -16
- package/dist/components/popover.js +222 -16
- package/dist/components/radio-group.js +85 -5
- package/dist/components/select.js +451 -22
- package/dist/components/separator.js +43 -3
- package/dist/components/sheet.js +345 -22
- package/dist/components/sidebar.js +1385 -193
- package/dist/components/skeleton.js +6 -2
- package/dist/components/svgs/whatsappIcon.js +11 -1
- package/dist/components/switch.js +55 -3
- package/dist/components/table.js +288 -18
- package/dist/components/tabs.js +161 -18
- package/dist/components/textarea.js +7 -2
- package/dist/components/themed-toaster.js +63 -20
- package/dist/components/tooltip.js +128 -9
- package/dist/components/typing-animation.js +335 -150
- package/dist/constants/sidebar.js +1 -4
- package/dist/hooks/use-mobile.js +8 -8
- package/dist/hooks/use-sidebar-persistence.js +27 -27
- package/dist/lib/image-dimensions.js +2 -2
- package/dist/lib/year-month-filter.js +38 -40
- package/dist/next.js +69 -17
- package/dist/providers/beez-ui-provider.js +48 -7
- package/dist/providers/native-provider.js +40 -6
- package/dist/tanstack.js +35 -23
- package/package.json +7 -1
package/dist/components/form.js
CHANGED
|
@@ -1,59 +1,321 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Slot } from "radix-ui";
|
|
5
|
-
import { Controller, FormProvider, useFormContext, useFormState
|
|
5
|
+
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
7
|
import { Label } from "./label.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
const Form = FormProvider;
|
|
9
10
|
const FormFieldContext = React.createContext({});
|
|
10
|
-
const FormField = (
|
|
11
|
-
|
|
11
|
+
const FormField = (t0) => {
|
|
12
|
+
const $ = _c(9);
|
|
13
|
+
let props;
|
|
14
|
+
if ($[0] !== t0) {
|
|
15
|
+
({...props} = t0);
|
|
16
|
+
$[0] = t0;
|
|
17
|
+
$[1] = props;
|
|
18
|
+
} else {
|
|
19
|
+
props = $[1];
|
|
20
|
+
}
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[2] !== props.name) {
|
|
23
|
+
t1 = { name: props.name };
|
|
24
|
+
$[2] = props.name;
|
|
25
|
+
$[3] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t1 = $[3];
|
|
28
|
+
}
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[4] !== props) {
|
|
31
|
+
t2 = /* @__PURE__ */ _jsx(Controller, { ...props });
|
|
32
|
+
$[4] = props;
|
|
33
|
+
$[5] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t2 = $[5];
|
|
36
|
+
}
|
|
37
|
+
let t3;
|
|
38
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
39
|
+
t3 = /* @__PURE__ */ _jsx(FormFieldContext.Provider, {
|
|
40
|
+
value: t1,
|
|
41
|
+
children: t2
|
|
42
|
+
});
|
|
43
|
+
$[6] = t1;
|
|
44
|
+
$[7] = t2;
|
|
45
|
+
$[8] = t3;
|
|
46
|
+
} else {
|
|
47
|
+
t3 = $[8];
|
|
48
|
+
}
|
|
49
|
+
return t3;
|
|
12
50
|
};
|
|
13
51
|
const useFormField = () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
const $ = _c(13);
|
|
53
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
54
|
+
const itemContext = React.useContext(FormItemContext);
|
|
55
|
+
const { getFieldState } = useFormContext();
|
|
56
|
+
let t0;
|
|
57
|
+
if ($[0] !== fieldContext.name) {
|
|
58
|
+
t0 = { name: fieldContext.name };
|
|
59
|
+
$[0] = fieldContext.name;
|
|
60
|
+
$[1] = t0;
|
|
61
|
+
} else {
|
|
62
|
+
t0 = $[1];
|
|
63
|
+
}
|
|
64
|
+
const formState = useFormState(t0);
|
|
65
|
+
let t1;
|
|
66
|
+
if ($[2] !== fieldContext.name || $[3] !== formState || $[4] !== getFieldState) {
|
|
67
|
+
t1 = getFieldState(fieldContext.name, formState);
|
|
68
|
+
$[2] = fieldContext.name;
|
|
69
|
+
$[3] = formState;
|
|
70
|
+
$[4] = getFieldState;
|
|
71
|
+
$[5] = t1;
|
|
72
|
+
} else {
|
|
73
|
+
t1 = $[5];
|
|
74
|
+
}
|
|
75
|
+
const fieldState = t1;
|
|
76
|
+
if (!fieldContext) {
|
|
77
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
78
|
+
}
|
|
79
|
+
const { id } = itemContext;
|
|
80
|
+
const t2 = `${id}-form-item`;
|
|
81
|
+
const t3 = `${id}-form-item-description`;
|
|
82
|
+
const t4 = `${id}-form-item-message`;
|
|
83
|
+
let t5;
|
|
84
|
+
if ($[6] !== fieldContext.name || $[7] !== fieldState || $[8] !== id || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
85
|
+
t5 = {
|
|
86
|
+
id,
|
|
87
|
+
name: fieldContext.name,
|
|
88
|
+
formItemId: t2,
|
|
89
|
+
formDescriptionId: t3,
|
|
90
|
+
formMessageId: t4,
|
|
91
|
+
...fieldState
|
|
92
|
+
};
|
|
93
|
+
$[6] = fieldContext.name;
|
|
94
|
+
$[7] = fieldState;
|
|
95
|
+
$[8] = id;
|
|
96
|
+
$[9] = t2;
|
|
97
|
+
$[10] = t3;
|
|
98
|
+
$[11] = t4;
|
|
99
|
+
$[12] = t5;
|
|
100
|
+
} else {
|
|
101
|
+
t5 = $[12];
|
|
102
|
+
}
|
|
103
|
+
return t5;
|
|
31
104
|
};
|
|
32
105
|
const FormItemContext = React.createContext({});
|
|
33
|
-
function FormItem(
|
|
34
|
-
|
|
35
|
-
|
|
106
|
+
function FormItem(t0) {
|
|
107
|
+
const $ = _c(13);
|
|
108
|
+
let className;
|
|
109
|
+
let props;
|
|
110
|
+
if ($[0] !== t0) {
|
|
111
|
+
({className, ...props} = t0);
|
|
112
|
+
$[0] = t0;
|
|
113
|
+
$[1] = className;
|
|
114
|
+
$[2] = props;
|
|
115
|
+
} else {
|
|
116
|
+
className = $[1];
|
|
117
|
+
props = $[2];
|
|
118
|
+
}
|
|
119
|
+
const id = React.useId();
|
|
120
|
+
let t1;
|
|
121
|
+
if ($[3] !== id) {
|
|
122
|
+
t1 = { id };
|
|
123
|
+
$[3] = id;
|
|
124
|
+
$[4] = t1;
|
|
125
|
+
} else {
|
|
126
|
+
t1 = $[4];
|
|
127
|
+
}
|
|
128
|
+
let t2;
|
|
129
|
+
if ($[5] !== className) {
|
|
130
|
+
t2 = cn("grid gap-2", className);
|
|
131
|
+
$[5] = className;
|
|
132
|
+
$[6] = t2;
|
|
133
|
+
} else {
|
|
134
|
+
t2 = $[6];
|
|
135
|
+
}
|
|
136
|
+
let t3;
|
|
137
|
+
if ($[7] !== props || $[8] !== t2) {
|
|
138
|
+
t3 = /* @__PURE__ */ _jsx("div", {
|
|
139
|
+
"data-slot": "form-item",
|
|
140
|
+
className: t2,
|
|
141
|
+
...props
|
|
142
|
+
});
|
|
143
|
+
$[7] = props;
|
|
144
|
+
$[8] = t2;
|
|
145
|
+
$[9] = t3;
|
|
146
|
+
} else {
|
|
147
|
+
t3 = $[9];
|
|
148
|
+
}
|
|
149
|
+
let t4;
|
|
150
|
+
if ($[10] !== t1 || $[11] !== t3) {
|
|
151
|
+
t4 = /* @__PURE__ */ _jsx(FormItemContext.Provider, {
|
|
152
|
+
value: t1,
|
|
153
|
+
children: t3
|
|
154
|
+
});
|
|
155
|
+
$[10] = t1;
|
|
156
|
+
$[11] = t3;
|
|
157
|
+
$[12] = t4;
|
|
158
|
+
} else {
|
|
159
|
+
t4 = $[12];
|
|
160
|
+
}
|
|
161
|
+
return t4;
|
|
36
162
|
}
|
|
37
|
-
function FormLabel(
|
|
38
|
-
|
|
39
|
-
|
|
163
|
+
function FormLabel(t0) {
|
|
164
|
+
const $ = _c(10);
|
|
165
|
+
let className;
|
|
166
|
+
let props;
|
|
167
|
+
if ($[0] !== t0) {
|
|
168
|
+
({className, ...props} = t0);
|
|
169
|
+
$[0] = t0;
|
|
170
|
+
$[1] = className;
|
|
171
|
+
$[2] = props;
|
|
172
|
+
} else {
|
|
173
|
+
className = $[1];
|
|
174
|
+
props = $[2];
|
|
175
|
+
}
|
|
176
|
+
const { error, formItemId } = useFormField();
|
|
177
|
+
const t1 = !!error;
|
|
178
|
+
let t2;
|
|
179
|
+
if ($[3] !== className) {
|
|
180
|
+
t2 = cn("data-[error=true]:text-destructive", className);
|
|
181
|
+
$[3] = className;
|
|
182
|
+
$[4] = t2;
|
|
183
|
+
} else {
|
|
184
|
+
t2 = $[4];
|
|
185
|
+
}
|
|
186
|
+
let t3;
|
|
187
|
+
if ($[5] !== formItemId || $[6] !== props || $[7] !== t1 || $[8] !== t2) {
|
|
188
|
+
t3 = /* @__PURE__ */ _jsx(Label, {
|
|
189
|
+
"data-slot": "form-label",
|
|
190
|
+
"data-error": t1,
|
|
191
|
+
className: t2,
|
|
192
|
+
htmlFor: formItemId,
|
|
193
|
+
...props
|
|
194
|
+
});
|
|
195
|
+
$[5] = formItemId;
|
|
196
|
+
$[6] = props;
|
|
197
|
+
$[7] = t1;
|
|
198
|
+
$[8] = t2;
|
|
199
|
+
$[9] = t3;
|
|
200
|
+
} else {
|
|
201
|
+
t3 = $[9];
|
|
202
|
+
}
|
|
203
|
+
return t3;
|
|
40
204
|
}
|
|
41
|
-
function FormControl(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
205
|
+
function FormControl(t0) {
|
|
206
|
+
const $ = _c(7);
|
|
207
|
+
let props;
|
|
208
|
+
if ($[0] !== t0) {
|
|
209
|
+
({...props} = t0);
|
|
210
|
+
$[0] = t0;
|
|
211
|
+
$[1] = props;
|
|
212
|
+
} else {
|
|
213
|
+
props = $[1];
|
|
214
|
+
}
|
|
215
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
216
|
+
const t1 = !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`;
|
|
217
|
+
const t2 = !!error;
|
|
218
|
+
let t3;
|
|
219
|
+
if ($[2] !== formItemId || $[3] !== props || $[4] !== t1 || $[5] !== t2) {
|
|
220
|
+
t3 = /* @__PURE__ */ _jsx(Slot.Root, {
|
|
221
|
+
"data-slot": "form-control",
|
|
222
|
+
id: formItemId,
|
|
223
|
+
"aria-describedby": t1,
|
|
224
|
+
"aria-invalid": t2,
|
|
225
|
+
...props
|
|
226
|
+
});
|
|
227
|
+
$[2] = formItemId;
|
|
228
|
+
$[3] = props;
|
|
229
|
+
$[4] = t1;
|
|
230
|
+
$[5] = t2;
|
|
231
|
+
$[6] = t3;
|
|
232
|
+
} else {
|
|
233
|
+
t3 = $[6];
|
|
234
|
+
}
|
|
235
|
+
return t3;
|
|
46
236
|
}
|
|
47
|
-
function FormDescription(
|
|
48
|
-
|
|
49
|
-
|
|
237
|
+
function FormDescription(t0) {
|
|
238
|
+
const $ = _c(9);
|
|
239
|
+
let className;
|
|
240
|
+
let props;
|
|
241
|
+
if ($[0] !== t0) {
|
|
242
|
+
({className, ...props} = t0);
|
|
243
|
+
$[0] = t0;
|
|
244
|
+
$[1] = className;
|
|
245
|
+
$[2] = props;
|
|
246
|
+
} else {
|
|
247
|
+
className = $[1];
|
|
248
|
+
props = $[2];
|
|
249
|
+
}
|
|
250
|
+
const { formDescriptionId } = useFormField();
|
|
251
|
+
let t1;
|
|
252
|
+
if ($[3] !== className) {
|
|
253
|
+
t1 = cn("text-sm text-muted-foreground", className);
|
|
254
|
+
$[3] = className;
|
|
255
|
+
$[4] = t1;
|
|
256
|
+
} else {
|
|
257
|
+
t1 = $[4];
|
|
258
|
+
}
|
|
259
|
+
let t2;
|
|
260
|
+
if ($[5] !== formDescriptionId || $[6] !== props || $[7] !== t1) {
|
|
261
|
+
t2 = /* @__PURE__ */ _jsx("p", {
|
|
262
|
+
"data-slot": "form-description",
|
|
263
|
+
id: formDescriptionId,
|
|
264
|
+
className: t1,
|
|
265
|
+
...props
|
|
266
|
+
});
|
|
267
|
+
$[5] = formDescriptionId;
|
|
268
|
+
$[6] = props;
|
|
269
|
+
$[7] = t1;
|
|
270
|
+
$[8] = t2;
|
|
271
|
+
} else {
|
|
272
|
+
t2 = $[8];
|
|
273
|
+
}
|
|
274
|
+
return t2;
|
|
50
275
|
}
|
|
51
|
-
function FormMessage(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
276
|
+
function FormMessage(t0) {
|
|
277
|
+
const $ = _c(10);
|
|
278
|
+
let className;
|
|
279
|
+
let props;
|
|
280
|
+
if ($[0] !== t0) {
|
|
281
|
+
({className, ...props} = t0);
|
|
282
|
+
$[0] = t0;
|
|
283
|
+
$[1] = className;
|
|
284
|
+
$[2] = props;
|
|
285
|
+
} else {
|
|
286
|
+
className = $[1];
|
|
287
|
+
props = $[2];
|
|
288
|
+
}
|
|
289
|
+
const { error, formMessageId } = useFormField();
|
|
290
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
291
|
+
if (!body) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
let t1;
|
|
295
|
+
if ($[3] !== className) {
|
|
296
|
+
t1 = cn("text-sm text-destructive", className);
|
|
297
|
+
$[3] = className;
|
|
298
|
+
$[4] = t1;
|
|
299
|
+
} else {
|
|
300
|
+
t1 = $[4];
|
|
301
|
+
}
|
|
302
|
+
let t2;
|
|
303
|
+
if ($[5] !== body || $[6] !== formMessageId || $[7] !== props || $[8] !== t1) {
|
|
304
|
+
t2 = /* @__PURE__ */ _jsx("p", {
|
|
305
|
+
"data-slot": "form-message",
|
|
306
|
+
id: formMessageId,
|
|
307
|
+
className: t1,
|
|
308
|
+
...props,
|
|
309
|
+
children: body
|
|
310
|
+
});
|
|
311
|
+
$[5] = body;
|
|
312
|
+
$[6] = formMessageId;
|
|
313
|
+
$[7] = props;
|
|
314
|
+
$[8] = t1;
|
|
315
|
+
$[9] = t2;
|
|
316
|
+
} else {
|
|
317
|
+
t2 = $[9];
|
|
318
|
+
}
|
|
319
|
+
return t2;
|
|
58
320
|
}
|
|
59
|
-
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField
|
|
321
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -1,91 +1,146 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { annotate } from "rough-notation";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export function Highlighter(t0) {
|
|
7
|
+
const $ = _c(17);
|
|
8
|
+
const { children, action: t1, color: t2, strokeWidth: t3, animationDuration: t4, iterations: t5, padding: t6, multiline: t7, isView: t8 } = t0;
|
|
9
|
+
const action = t1 === undefined ? "highlight" : t1;
|
|
10
|
+
const color = t2 === undefined ? "#ffd1dc" : t2;
|
|
11
|
+
const strokeWidth = t3 === undefined ? 1.5 : t3;
|
|
12
|
+
const animationDuration = t4 === undefined ? 600 : t4;
|
|
13
|
+
const iterations = t5 === undefined ? 2 : t5;
|
|
14
|
+
const padding = t6 === undefined ? 2 : t6;
|
|
15
|
+
const multiline = t7 === undefined ? true : t7;
|
|
16
|
+
const isView = t8 === undefined ? false : t8;
|
|
17
|
+
const elementRef = useRef(null);
|
|
18
|
+
const annotationRef = useRef(null);
|
|
19
|
+
let t9;
|
|
20
|
+
if ($[0] !== isView) {
|
|
21
|
+
t9 = () => !isView || typeof IntersectionObserver === "undefined";
|
|
22
|
+
$[0] = isView;
|
|
23
|
+
$[1] = t9;
|
|
24
|
+
} else {
|
|
25
|
+
t9 = $[1];
|
|
26
|
+
}
|
|
27
|
+
const [isInView, setIsInView] = useState(t9);
|
|
28
|
+
let t10;
|
|
29
|
+
let t11;
|
|
30
|
+
if ($[2] !== isView) {
|
|
31
|
+
t10 = () => {
|
|
32
|
+
if (!isView) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const element = elementRef.current;
|
|
36
|
+
if (!element || typeof IntersectionObserver === "undefined") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const observer = new IntersectionObserver((t12) => {
|
|
40
|
+
const [entry] = t12;
|
|
41
|
+
if (entry.isIntersecting) {
|
|
42
|
+
setIsInView(true);
|
|
43
|
+
observer.disconnect();
|
|
44
|
+
}
|
|
45
|
+
}, { rootMargin: "-10%" });
|
|
46
|
+
observer.observe(element);
|
|
47
|
+
return () => {
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
t11 = [isView];
|
|
52
|
+
$[2] = isView;
|
|
53
|
+
$[3] = t10;
|
|
54
|
+
$[4] = t11;
|
|
55
|
+
} else {
|
|
56
|
+
t10 = $[3];
|
|
57
|
+
t11 = $[4];
|
|
58
|
+
}
|
|
59
|
+
useEffect(t10, t11);
|
|
60
|
+
const shouldShow = !isView || isInView;
|
|
61
|
+
let t12;
|
|
62
|
+
let t13;
|
|
63
|
+
if ($[5] !== action || $[6] !== animationDuration || $[7] !== color || $[8] !== iterations || $[9] !== multiline || $[10] !== padding || $[11] !== shouldShow || $[12] !== strokeWidth) {
|
|
64
|
+
t12 = () => {
|
|
65
|
+
const element_0 = elementRef.current;
|
|
66
|
+
let resizeObserver = null;
|
|
67
|
+
let redrawFrameId = null;
|
|
68
|
+
if (shouldShow && element_0) {
|
|
69
|
+
const annotationConfig = {
|
|
70
|
+
type: action,
|
|
71
|
+
color,
|
|
72
|
+
strokeWidth,
|
|
73
|
+
animationDuration,
|
|
74
|
+
iterations,
|
|
75
|
+
padding,
|
|
76
|
+
multiline
|
|
77
|
+
};
|
|
78
|
+
const annotation = annotate(element_0, annotationConfig);
|
|
79
|
+
annotationRef.current = annotation;
|
|
80
|
+
annotation.show();
|
|
81
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
82
|
+
resizeObserver = new ResizeObserver(() => {
|
|
83
|
+
if (redrawFrameId != null) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
redrawFrameId = window.requestAnimationFrame(() => {
|
|
87
|
+
redrawFrameId = null;
|
|
88
|
+
annotation.hide();
|
|
89
|
+
annotation.show();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
resizeObserver.observe(element_0);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return () => {
|
|
96
|
+
if (redrawFrameId != null) {
|
|
97
|
+
window.cancelAnimationFrame(redrawFrameId);
|
|
98
|
+
}
|
|
99
|
+
if (annotationRef.current) {
|
|
100
|
+
annotationRef.current.remove();
|
|
101
|
+
annotationRef.current = null;
|
|
102
|
+
}
|
|
103
|
+
if (resizeObserver) {
|
|
104
|
+
resizeObserver.disconnect();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
t13 = [
|
|
109
|
+
shouldShow,
|
|
110
|
+
action,
|
|
111
|
+
color,
|
|
112
|
+
strokeWidth,
|
|
113
|
+
animationDuration,
|
|
114
|
+
iterations,
|
|
115
|
+
padding,
|
|
116
|
+
multiline
|
|
117
|
+
];
|
|
118
|
+
$[5] = action;
|
|
119
|
+
$[6] = animationDuration;
|
|
120
|
+
$[7] = color;
|
|
121
|
+
$[8] = iterations;
|
|
122
|
+
$[9] = multiline;
|
|
123
|
+
$[10] = padding;
|
|
124
|
+
$[11] = shouldShow;
|
|
125
|
+
$[12] = strokeWidth;
|
|
126
|
+
$[13] = t12;
|
|
127
|
+
$[14] = t13;
|
|
128
|
+
} else {
|
|
129
|
+
t12 = $[13];
|
|
130
|
+
t13 = $[14];
|
|
131
|
+
}
|
|
132
|
+
useEffect(t12, t13);
|
|
133
|
+
let t14;
|
|
134
|
+
if ($[15] !== children) {
|
|
135
|
+
t14 = /* @__PURE__ */ _jsx("span", {
|
|
136
|
+
ref: elementRef,
|
|
137
|
+
className: "relative inline-block bg-transparent",
|
|
138
|
+
children
|
|
139
|
+
});
|
|
140
|
+
$[15] = children;
|
|
141
|
+
$[16] = t14;
|
|
142
|
+
} else {
|
|
143
|
+
t14 = $[16];
|
|
144
|
+
}
|
|
145
|
+
return t14;
|
|
91
146
|
}
|