abrplus-ui-kit 1.0.7 → 1.0.8

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.
Files changed (55) hide show
  1. package/dist/antOverrides.cjs.js +1 -127
  2. package/dist/antOverrides.es.js +70 -98
  3. package/dist/atoms.cjs.js +1 -391
  4. package/dist/atoms.es.js +252 -306
  5. package/dist/colors-BDQwGpaB.cjs +5 -0
  6. package/dist/{colors-CztsZ6e_.js → colors-BW-NR0oP.js} +30 -34
  7. package/dist/deepMerge-2zqLIrFM.cjs +1 -0
  8. package/dist/deepMerge-Dm_AZi0Z.js +14 -0
  9. package/dist/index-B1HRk2-g.cjs +1 -0
  10. package/dist/index-BCH1vT85.js +8 -0
  11. package/dist/index-BJmt8SSx.cjs +1 -0
  12. package/dist/index-BPqX2Hsu.js +75 -0
  13. package/dist/{index-B02Mlfa4.js → index-BRLLsEKX.js} +19905 -19821
  14. package/dist/index-BeP9-mrf.js +200 -0
  15. package/dist/index-Bpx-uyOR.cjs +1 -0
  16. package/dist/index-CpGdrWps.js +19 -0
  17. package/dist/index-CwKyw6uN.cjs +1 -0
  18. package/dist/index-CzPs2mPX.js +478 -0
  19. package/dist/index-QraJKad8.cjs +1 -0
  20. package/dist/index-R9oQ5kp6.js +1569 -0
  21. package/dist/index-bNh4-ggT.cjs +1 -0
  22. package/dist/index-lDQ4dr86.cjs +1 -0
  23. package/dist/index.cjs.js +1 -109
  24. package/dist/index.css +1 -1519
  25. package/dist/index.es.js +5 -5
  26. package/dist/index2.css +1 -3
  27. package/dist/molecules.cjs.js +8 -7826
  28. package/dist/molecules.es.js +4270 -6306
  29. package/dist/organisms.cjs.js +1 -940
  30. package/dist/organisms.es.js +651 -758
  31. package/dist/provider.cjs.js +1 -48
  32. package/dist/provider.es.js +29 -34
  33. package/dist/sortable.esm-BSCvBWLi.js +2943 -0
  34. package/dist/sortable.esm-CA8VbUF-.cjs +5 -0
  35. package/dist/theme.css +1 -102
  36. package/dist/types/components/atoms/icon/constants/iconNames.d.ts +1 -1
  37. package/package.json +4 -4
  38. package/dist/colors-TPZkyKI4.cjs +0 -2212
  39. package/dist/deepMerge-CG1he8ZD.js +0 -20
  40. package/dist/deepMerge-Cn27K7-s.cjs +0 -19
  41. package/dist/index-B1Z0XlNV.cjs +0 -542
  42. package/dist/index-CCvWoynu.cjs +0 -12
  43. package/dist/index-CVNEow23.js +0 -543
  44. package/dist/index-Cbtrrxcv.js +0 -90
  45. package/dist/index-CiSH4Pqy.js +0 -266
  46. package/dist/index-Crz4ws0L.js +0 -1630
  47. package/dist/index-D-q_-bu0.cjs +0 -1629
  48. package/dist/index-DLUd_0LP.js +0 -13
  49. package/dist/index-DM-zAoQS.cjs +0 -89
  50. package/dist/index-DPvG_H_Y.cjs +0 -27
  51. package/dist/index-DdzyIn4u.js +0 -28
  52. package/dist/index-DsPAgC23.cjs +0 -37937
  53. package/dist/index-PyheoujP.cjs +0 -265
  54. package/dist/sortable.esm-BPjdpL-J.cjs +0 -3872
  55. package/dist/sortable.esm-C7oRJuPU.js +0 -3873
@@ -1,543 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { F as Flex, T as Text, I as Icon, a as Tooltip$1, R as Render, L as Loading } from "./index-B02Mlfa4.js";
3
- import { c as colors, A as AbrplusUIKit } from "./colors-CztsZ6e_.js";
4
- import { twMerge } from "tailwind-merge";
5
- function uncapitalize(value) {
6
- return value.slice(0, 1).toLowerCase() + value.slice(1);
7
- }
8
- function batch(components) {
9
- const assignees = Object.assign({}, { ...components });
10
- return new Proxy(assignees, {
11
- get(target, property) {
12
- const safeTarget = Object.freeze({
13
- ...target,
14
- [Symbol.toPrimitive]() {
15
- return "Error: Attempted to render object as a JSX";
16
- }
17
- });
18
- if (property in safeTarget) {
19
- return safeTarget[property];
20
- }
21
- const origProperty = uncapitalize(property);
22
- if (origProperty in safeTarget) {
23
- return safeTarget[origProperty];
24
- }
25
- return null;
26
- }
27
- });
28
- }
29
- const TooltipTitle = ({ title, iconName }) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
30
- /* @__PURE__ */ jsx(Text, { size: 14, color: colors.white_ff, children: title }),
31
- iconName && /* @__PURE__ */ jsx(Icon, { name: iconName })
32
- ] });
33
- const Tooltip = ({ children, title, iconName, ...rest }) => {
34
- return /* @__PURE__ */ jsx(
35
- Tooltip$1,
36
- {
37
- title: typeof title === "string" ? /* @__PURE__ */ jsx(TooltipTitle, { title, iconName }) : title,
38
- ...rest,
39
- children
40
- }
41
- );
42
- };
43
- const fontSizePicker = {
44
- block: "text-[16px]",
45
- medium: "text-[16px]",
46
- small: "text-[12px]"
47
- };
48
- const paddingPicker = (hasIcon) => ({
49
- start: {
50
- block: `pe-4 ${hasIcon ? "ps-3" : "ps-4"} `,
51
- medium: `pe-4 ${hasIcon ? "ps-3" : "ps-4"} `,
52
- small: `pe-3 ps-[8px]`
53
- },
54
- end: {
55
- block: `ps-4 pe-3`,
56
- medium: `ps-4 pe-3`,
57
- small: `ps-4 pe-3`
58
- }
59
- });
60
- const buttonDefaultClasses = "flex relative select-none w-fit appearance-none flex-row items-center justify-center gap-2 whitespace-nowrap rounded text-center outline-none";
61
- const ActionButton = ({
62
- style,
63
- height,
64
- mode,
65
- children,
66
- iconName,
67
- disabled,
68
- className,
69
- iconPosition = "start",
70
- isLoading,
71
- lang = "fa",
72
- ...rest
73
- }) => {
74
- const appName = AbrplusUIKit.config().getAppName();
75
- const getColor = () => {
76
- if ((disabled || isLoading) && appName) {
77
- if (appName === "home" || appName === "sandbox" || appName === "bi" || appName === "storybook")
78
- return colors["sales"]["action_light_2"];
79
- return colors[appName]["action_light_2"];
80
- }
81
- return colors.white_ff;
82
- };
83
- const getColorClass = () => {
84
- if (!appName) return;
85
- const data = {
86
- bi: twMerge("bg-sales-action hover:bg-sales-action-light-1 active:bg-sales-action-dark-1"),
87
- call: twMerge("bg-call-action hover:bg-call-action-light-1 active:bg-call-action-dark-1"),
88
- club: twMerge("bg-club-action hover:bg-club-action-light-1 active:bg-club-action-dark-1"),
89
- marketing: twMerge(
90
- "bg-marketing-action hover:bg-marketing-action-light-1 active:bg-marketing-action-dark-1"
91
- ),
92
- sales: twMerge("bg-sales-action hover:bg-sales-action-light-1 active:bg-sales-action-dark-1"),
93
- team: twMerge("bg-team-action hover:bg-team-action-light-1 active:bg-team-action-dark-1"),
94
- rayan: twMerge("bg-rayan-action hover:bg-rayan-action-light-1 active:bg-rayan-action-dark-1")
95
- };
96
- return data?.[appName] || data["sales"];
97
- };
98
- return /* @__PURE__ */ jsxs(
99
- "button",
100
- {
101
- lang,
102
- style: {
103
- height: height || 34,
104
- ...style
105
- },
106
- className: twMerge(
107
- "bg-repo disabled:bg-light-6 ",
108
- getColorClass(),
109
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
110
- fontSizePicker[mode || "block"],
111
- buttonDefaultClasses,
112
- mode === "block" && "w-full",
113
- (disabled || isLoading) && "cursor-not-allowed border-light-6",
114
- className
115
- ),
116
- disabled: disabled || isLoading,
117
- ...rest,
118
- children: [
119
- /* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
120
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
121
- /* @__PURE__ */ jsx(
122
- Text,
123
- {
124
- lang,
125
- weight: "medium",
126
- className: fontSizePicker[mode || "block"],
127
- color: getColor(),
128
- children
129
- }
130
- ),
131
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
132
- ]
133
- }
134
- );
135
- };
136
- const IconButton = ({
137
- style,
138
- height = 34,
139
- iconName,
140
- disabled,
141
- className,
142
- iconPosition = "start",
143
- iconProps,
144
- color,
145
- ...rest
146
- }) => {
147
- return /* @__PURE__ */ jsx(
148
- "button",
149
- {
150
- style: {
151
- height,
152
- ...style
153
- },
154
- className: twMerge(
155
- buttonDefaultClasses,
156
- "h-[34px] w-[34px] p-4",
157
- "bg-light-1 border-primary-light-3 border",
158
- "hover:bg-white-ff hover:border-primary-light-2",
159
- "active:bg-light-6 active:border-primary-light-2",
160
- "disabled:text-primary-light-2 disabled:bg-light-6 disabled:border-light-6",
161
- disabled && "border-light-6 cursor-not-allowed",
162
- className
163
- ),
164
- disabled,
165
- ...rest,
166
- children: iconProps?.renderIcon ? iconProps.renderIcon : /* @__PURE__ */ jsx(
167
- Icon,
168
- {
169
- name: iconName,
170
- color: disabled ? colors.primary_light_3 : color ?? colors.primary,
171
- ...iconProps
172
- }
173
- )
174
- }
175
- );
176
- };
177
- const NegativeButton = ({
178
- style,
179
- height,
180
- mode,
181
- children,
182
- iconName,
183
- disabled,
184
- className,
185
- iconPosition = "start",
186
- isLoading,
187
- lang = "fa",
188
- variant = "outline",
189
- // Default variant
190
- ...rest
191
- }) => {
192
- const getColor = () => {
193
- if (disabled || isLoading) {
194
- return colors.primary_light_2;
195
- } else if (variant === "contain") {
196
- return colors.white_ff;
197
- }
198
- return colors.negative;
199
- };
200
- const outlineClasses = "hover:bg-negative-light-1 active:bg-negative-dark-1 [&_p]:hover:!text-white-ff [&_*]:hover:fill-white-ff disabled:bg-light-6 bg-transparent border-negative hover:border-negative-light-1 active:border-negative-dark-1 disabled:light-6 border-[2px] border-solid";
201
- const containClasses = "bg-negative hover:bg-negative-light-1 active:bg-negative-dark-1 disabled:bg-light-6 border-transparent";
202
- const buttonVariantClasses = variant === "contain" ? containClasses : outlineClasses;
203
- return /* @__PURE__ */ jsxs(
204
- "button",
205
- {
206
- lang,
207
- style: {
208
- height: height || 34,
209
- ...style
210
- },
211
- className: twMerge(
212
- buttonDefaultClasses,
213
- buttonVariantClasses,
214
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
215
- fontSizePicker[mode || "block"],
216
- (disabled || isLoading) && "cursor-not-allowed",
217
- className
218
- ),
219
- disabled: disabled || isLoading,
220
- ...rest,
221
- children: [
222
- /* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
223
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(
224
- Icon,
225
- {
226
- name: iconName,
227
- className: twMerge(fontSizePicker[mode || "block"]),
228
- color: getColor()
229
- }
230
- ) }),
231
- /* @__PURE__ */ jsx(Text, { weight: "medium", size: 16, color: getColor(), lang, children }),
232
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
233
- ]
234
- }
235
- );
236
- };
237
- const PrimaryButton = ({
238
- style,
239
- height = 34,
240
- mode,
241
- children,
242
- iconName,
243
- disabled,
244
- className,
245
- iconPosition = "start",
246
- isLoading,
247
- lang = "fa",
248
- textSize,
249
- ...rest
250
- }) => {
251
- const getColor = () => {
252
- if (disabled || isLoading) {
253
- return colors.primary_light_2;
254
- }
255
- return colors.white_ff;
256
- };
257
- return /* @__PURE__ */ jsxs(
258
- "button",
259
- {
260
- lang,
261
- style: { height, ...style },
262
- className: twMerge(
263
- "bg-primary hover:bg-primary-light-1 active:bg-primary-dark-1 disabled:bg-light-6",
264
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
265
- fontSizePicker[mode || "block"],
266
- buttonDefaultClasses,
267
- mode === "block" && "w-full",
268
- (disabled || isLoading) && "cursor-not-allowed border-light-6",
269
- className
270
- ),
271
- disabled: disabled || isLoading,
272
- ...rest,
273
- children: [
274
- /* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
275
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
276
- /* @__PURE__ */ jsx(
277
- Text,
278
- {
279
- lang,
280
- weight: "medium",
281
- className: twMerge(
282
- "text-white-ff",
283
- (disabled || isLoading) && "text-primary-light-2",
284
- fontSizePicker[mode || "block"]
285
- ),
286
- size: textSize,
287
- children
288
- }
289
- ),
290
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
291
- ]
292
- }
293
- );
294
- };
295
- const SecondaryButton = ({
296
- style,
297
- height = 34,
298
- mode,
299
- children,
300
- iconName,
301
- disabled,
302
- className,
303
- iconPosition = "start",
304
- isLoading,
305
- lang = "fa",
306
- ...rest
307
- }) => {
308
- const getColor = () => {
309
- if (disabled || isLoading) {
310
- return colors.primary_light_2;
311
- }
312
- return colors.primary;
313
- };
314
- return /* @__PURE__ */ jsxs(
315
- "button",
316
- {
317
- lang,
318
- style: { height, ...style },
319
- className: twMerge(
320
- "bg-transparent hover:bg-primary-light-1 active:bg-primary-dark-1 disabled:bg-light-6 [&_p]:text-primary [&_p]:hover:text-white-ff [&_svg]:hover:!fill-white-ff",
321
- "border-[2px] border-solid border-primary hover:border-primary-light-1 active:border-primary-dark-1 disabled:bg-light-6",
322
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
323
- fontSizePicker[mode || "block"],
324
- buttonDefaultClasses,
325
- (disabled || isLoading) && "cursor-not-allowed",
326
- className
327
- ),
328
- disabled: disabled || isLoading,
329
- ...rest,
330
- children: [
331
- /* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
332
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
333
- /* @__PURE__ */ jsx(Text, { lang, weight: "medium", className: fontSizePicker[mode || "block"], children }),
334
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
335
- ]
336
- }
337
- );
338
- };
339
- const SecondaryQuietButton = ({
340
- style,
341
- height,
342
- mode,
343
- children,
344
- iconName,
345
- disabled,
346
- className,
347
- iconPosition = "start",
348
- isLoading,
349
- lang = "fa",
350
- ...rest
351
- }) => {
352
- const getColor = () => {
353
- if (disabled || isLoading) {
354
- return colors.primary_light_2;
355
- }
356
- return colors.primary;
357
- };
358
- return /* @__PURE__ */ jsxs(
359
- "button",
360
- {
361
- lang,
362
- style: {
363
- height: height || 34,
364
- ...style
365
- },
366
- className: twMerge(
367
- "hover:bg-light-6 active:bg-light-7 disabled:light-6 bg-transparent",
368
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
369
- fontSizePicker[mode || "block"],
370
- buttonDefaultClasses,
371
- (disabled || isLoading) && "cursor-not-allowed ",
372
- className
373
- ),
374
- disabled: disabled || isLoading,
375
- ...rest,
376
- children: [
377
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
378
- /* @__PURE__ */ jsx(
379
- Text,
380
- {
381
- lang,
382
- weight: "medium",
383
- className: fontSizePicker[mode || "block"],
384
- color: getColor(),
385
- children
386
- }
387
- ),
388
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
389
- ]
390
- }
391
- );
392
- };
393
- const TertiaryButton = ({
394
- style,
395
- height,
396
- mode,
397
- children,
398
- iconName,
399
- disabled,
400
- className,
401
- iconPosition = "start",
402
- isLoading,
403
- lang = "fa",
404
- ...rest
405
- }) => {
406
- const getColor = () => {
407
- if (disabled || isLoading) {
408
- return colors.primary_light_2;
409
- }
410
- return colors.primary_dark_1;
411
- };
412
- return /* @__PURE__ */ jsxs(
413
- "button",
414
- {
415
- lang,
416
- style: {
417
- height: height || 34,
418
- ...style
419
- },
420
- className: twMerge(
421
- "bg-light-1 hover:bg-white-ff active:light-6 disabled:light-6",
422
- "border-primary-light-3 hover:border-primary-light-2 active:bg-primary-light-2 disabled:light-6 border-[1px] border-solid",
423
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
424
- fontSizePicker[mode || "block"],
425
- buttonDefaultClasses,
426
- (disabled || isLoading) && "cursor-not-allowed",
427
- className
428
- ),
429
- disabled: disabled || isLoading,
430
- ...rest,
431
- children: [
432
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
433
- /* @__PURE__ */ jsx(
434
- Text,
435
- {
436
- lang,
437
- weight: "medium",
438
- className: fontSizePicker[mode || "block"],
439
- color: getColor(),
440
- children
441
- }
442
- ),
443
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
444
- ]
445
- }
446
- );
447
- };
448
- const TextButton = ({
449
- style,
450
- height = 34,
451
- mode,
452
- children,
453
- iconName,
454
- disabled,
455
- className,
456
- iconPosition = "start",
457
- isLoading,
458
- lang = "fa",
459
- underline,
460
- textProps,
461
- startIconSize,
462
- endIconSize,
463
- ...rest
464
- }) => {
465
- const getColor = () => {
466
- if (disabled || isLoading) {
467
- return colors.primary_light_2;
468
- }
469
- return colors.black;
470
- };
471
- return /* @__PURE__ */ jsxs(
472
- "button",
473
- {
474
- lang,
475
- style: { height, ...style },
476
- className: twMerge(
477
- "disabled:bg-light-6 border-none hover:bg-none focus:bg-none",
478
- paddingPicker(!!iconName)[iconPosition][mode || "block"],
479
- fontSizePicker[mode || "block"],
480
- buttonDefaultClasses,
481
- mode === "block" && "w-full",
482
- (disabled || isLoading) && "border-light-6 cursor-not-allowed",
483
- className
484
- ),
485
- disabled: disabled || isLoading,
486
- ...rest,
487
- children: [
488
- /* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
489
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(
490
- Icon,
491
- {
492
- size: startIconSize,
493
- name: iconName,
494
- className: fontSizePicker[mode || "block"],
495
- color: getColor()
496
- }
497
- ) }),
498
- /* @__PURE__ */ jsx(
499
- Text,
500
- {
501
- lang,
502
- weight: "medium",
503
- className: twMerge(
504
- (disabled || isLoading) && "text-primary-light-2",
505
- fontSizePicker[mode || "block"],
506
- underline && "underline"
507
- ),
508
- ...textProps,
509
- children
510
- }
511
- ),
512
- /* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(
513
- Icon,
514
- {
515
- size: endIconSize,
516
- name: iconName,
517
- className: fontSizePicker[mode || "block"],
518
- color: getColor()
519
- }
520
- ) })
521
- ]
522
- }
523
- );
524
- };
525
- const Button = batch({
526
- Primary: PrimaryButton,
527
- Secondary: SecondaryButton,
528
- Tertiary: TertiaryButton,
529
- SecondaryQuiet: SecondaryQuietButton,
530
- Icon: IconButton,
531
- Negative: NegativeButton,
532
- Action: ActionButton,
533
- Text: TextButton
534
- });
535
- export {
536
- Button as B,
537
- IconButton as I,
538
- Tooltip as T,
539
- buttonDefaultClasses as a,
540
- batch as b,
541
- fontSizePicker as f,
542
- paddingPicker as p
543
- };
@@ -1,90 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { ConfigProvider, Dropdown as Dropdown$1, Image as Image$1 } from "antd";
3
- import { twMerge } from "tailwind-merge";
4
- import { useState, useEffect } from "react";
5
- import { F as Flex, L as Loading } from "./index-B02Mlfa4.js";
6
- const SwitchThemeConfig = {
7
- components: {
8
- Dropdown: {}
9
- }
10
- };
11
- const Dropdown = ({ className, ...props }) => {
12
- return /* @__PURE__ */ jsx(ConfigProvider, { theme: SwitchThemeConfig, children: /* @__PURE__ */ jsx(Dropdown$1, { ...props, className: twMerge("bg-light-7", className) }) });
13
- };
14
- const Image = ({
15
- preview = false,
16
- width,
17
- height,
18
- fallback,
19
- onError,
20
- wrapperClassName,
21
- ...rest
22
- }) => {
23
- const [showFallBack, setShowFallBack] = useState(false);
24
- return /* @__PURE__ */ jsx(
25
- Flex,
26
- {
27
- style: { width, height },
28
- align: "center",
29
- justify: "center",
30
- className: wrapperClassName,
31
- children: showFallBack && fallback ? fallback : /* @__PURE__ */ jsx(
32
- Image$1,
33
- {
34
- preview,
35
- onError: (e) => {
36
- setShowFallBack(true);
37
- onError?.(e);
38
- },
39
- ...{ width, height },
40
- ...rest
41
- }
42
- )
43
- }
44
- );
45
- };
46
- const getScrollableNode = (scrollableNodeId) => {
47
- return document.getElementById(scrollableNodeId);
48
- };
49
- const debounce = (func, delay) => {
50
- let timeoutId;
51
- return function() {
52
- clearTimeout(timeoutId);
53
- timeoutId = setTimeout(func, delay);
54
- };
55
- };
56
- const InfiniteLoader = ({
57
- children,
58
- indicatorColor,
59
- indicatorSize,
60
- className,
61
- hasMore,
62
- scrollableNodeId,
63
- onNextPage
64
- }) => {
65
- useEffect(() => {
66
- const scrollableNode = getScrollableNode(scrollableNodeId);
67
- if (scrollableNode) {
68
- const onScroll = () => {
69
- if (hasMore) {
70
- const { scrollHeight, scrollTop, clientHeight } = scrollableNode;
71
- const isBottom = Math.ceil(scrollTop) + clientHeight === scrollHeight;
72
- isBottom && onNextPage();
73
- }
74
- };
75
- onScroll();
76
- const debouncedOnScroll = debounce(onScroll, 1500);
77
- scrollableNode.addEventListener("scroll", debouncedOnScroll);
78
- return () => scrollableNode.removeEventListener("scroll", debouncedOnScroll);
79
- }
80
- }, [hasMore, scrollableNodeId]);
81
- return /* @__PURE__ */ jsxs("div", { className: twMerge(className, "w-full"), onClick: (e) => e.stopPropagation(), children: [
82
- children,
83
- hasMore && /* @__PURE__ */ jsx(Flex, { className: "min-h-12", align: "center", justify: "center", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, color: indicatorColor, size: indicatorSize }) })
84
- ] });
85
- };
86
- export {
87
- Dropdown as D,
88
- InfiniteLoader as I,
89
- Image as a
90
- };