@levo-so/react 0.0.2-alpha → 0.1.1
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/dist/Checbox-sq-atGlJ.js +28 -0
- package/dist/CheckboxWidget-ComdVcZ_.js +118 -0
- package/dist/CollectionFormBuilder-jwwjyIpv.js +738 -0
- package/dist/CurrencyWidget-DVqD_lsY.js +60 -0
- package/dist/DateTimeWidget-CvgzwY1U.js +80 -0
- package/dist/DefaultFormVariant-CbRB9O_e.js +80 -0
- package/dist/DropdownWidget-C2YaM9Cf.js +115 -0
- package/dist/EmailWidget-BBthwF68.js +41 -0
- package/dist/GeocoderWidget-Dht_2vi6.js +309 -0
- package/dist/Input-2CvZ90f8.js +54 -0
- package/dist/LevoProvider-DNbYyEaf.js +21 -0
- package/dist/MultiGeocoderWidget-paCFW0QZ.js +49 -0
- package/dist/PhoneWidget-CP2T2JDx.js +47 -0
- package/dist/RadioWidget-BuFPz7kK.js +109 -0
- package/dist/RichTextWidget-DGFNZ1jl.js +310 -0
- package/dist/Sonner-t6JVKA0a.js +39 -0
- package/dist/Spinner-CuUosd-S.js +297 -0
- package/dist/StepsFormVariant-5_c3f2Vk.js +137 -0
- package/dist/SwitchWidget-t8iwhxk9.js +53 -0
- package/dist/TextWidget-D0UBxTxe.js +33 -0
- package/dist/TextareaWidget-CG6J_plD.js +30 -0
- package/dist/ToggleCheckboxWidget-dl8ks4VX.js +44 -0
- package/dist/Tooltip-CI4i4mYr.js +144 -0
- package/dist/URLWidget-CHeUEUXl.js +14 -0
- package/dist/UploadWidget-CzYGViqE.js +503 -0
- package/dist/audience/{block.d.ts → components/block.d.ts} +1 -1
- package/dist/audience/components/block.d.ts.map +1 -0
- package/dist/audience/{component.d.ts → components/component.d.ts} +1 -1
- package/dist/audience/components/component.d.ts.map +1 -0
- package/dist/audience/{page.d.ts → components/page.d.ts} +1 -1
- package/dist/audience/components/page.d.ts.map +1 -0
- package/dist/audience/components/useScrollDepth.d.ts.map +1 -0
- package/dist/audience/index.d.ts +3 -3
- package/dist/audience/index.d.ts.map +1 -1
- package/dist/audience/index.js +4 -2303
- package/dist/byteToSize-BFKZSBu1.js +8 -0
- package/dist/cn-C9QoOYNG.js +6 -0
- package/dist/collection/components/CollectionFormBuilder.d.ts +12 -0
- package/dist/collection/components/CollectionFormBuilder.d.ts.map +1 -0
- package/dist/collection/components/FieldRenderer.d.ts +9 -0
- package/dist/collection/components/FieldRenderer.d.ts.map +1 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts +5 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -0
- package/dist/collection/components/core/Checkbox/Checbox.d.ts +5 -0
- package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -0
- package/dist/collection/components/core/Input/Input.d.ts +11 -0
- package/dist/collection/components/core/Input/Input.d.ts.map +1 -0
- package/dist/collection/components/core/Switch/Switch.d.ts +5 -0
- package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts +5 -0
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderCommonField.d.ts +5 -0
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts +4 -0
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/ErrorMessage.d.ts +6 -0
- package/dist/collection/components/widgets/ErrorMessage.d.ts.map +1 -0
- package/dist/collection/components/widgets/FieldWrapper.d.ts +14 -0
- package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -0
- package/dist/collection/components/widgets/FormHelperText.d.ts +6 -0
- package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -0
- package/dist/collection/components/widgets/FormLabel.d.ts +8 -0
- package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -0
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +8 -0
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts +7 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts +9 -0
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +8 -0
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts +9 -0
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +8 -0
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts +8 -0
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts +8 -0
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts +8 -0
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts +11 -0
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts +12 -0
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts +8 -0
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts +9 -0
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts +8 -0
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts +8 -0
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts +10 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts +13 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts +11 -0
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts +19 -0
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts +5 -0
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts.map +1 -0
- package/dist/collection/index.d.ts +5 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +19 -0
- package/dist/collection/lib/FormBuilder.d.ts +8 -0
- package/dist/collection/lib/FormBuilder.d.ts.map +1 -0
- package/dist/collection/lib/SaveDraftValues.d.ts +7 -0
- package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -0
- package/dist/collection/lib/hooks/useLevoForm.d.ts +18 -0
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -0
- package/dist/collection/lib/provider/LevoFormProvider.d.ts +9 -0
- package/dist/collection/lib/provider/LevoFormProvider.d.ts.map +1 -0
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts +3 -0
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -0
- package/dist/collection/lib/variants/StepsFormVariant.d.ts +4 -0
- package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -0
- package/dist/collection/types/context.d.ts +34 -0
- package/dist/collection/types/context.d.ts.map +1 -0
- package/dist/collection/types/errors.d.ts +7 -0
- package/dist/collection/types/errors.d.ts.map +1 -0
- package/dist/collection/types/formVariant.d.ts +18 -0
- package/dist/collection/types/formVariant.d.ts.map +1 -0
- package/dist/collection/types/forms.d.ts +31 -0
- package/dist/collection/types/forms.d.ts.map +1 -0
- package/dist/collection/types/index.d.ts +4 -0
- package/dist/collection/types/index.d.ts.map +1 -0
- package/dist/collection/types/renderer.d.ts +6 -0
- package/dist/collection/types/renderer.d.ts.map +1 -0
- package/dist/collection/utils/formHelpers.d.ts +47 -0
- package/dist/collection/utils/formHelpers.d.ts.map +1 -0
- package/dist/collection/utils/getFieldValidations.d.ts +6 -0
- package/dist/collection/utils/getFieldValidations.d.ts.map +1 -0
- package/dist/collection/utils/index.d.ts +4 -0
- package/dist/collection/utils/index.d.ts.map +1 -0
- package/dist/collection/utils/schema.d.ts +3 -0
- package/dist/collection/utils/schema.d.ts.map +1 -0
- package/dist/collection/utils/setFormErrors.d.ts +4 -0
- package/dist/collection/utils/setFormErrors.d.ts.map +1 -0
- package/dist/collection/utils/storage.d.ts +11 -0
- package/dist/collection/utils/storage.d.ts.map +1 -0
- package/dist/components/Dialog.d.ts +21 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/DialogWrapper.d.ts +11 -0
- package/dist/components/DialogWrapper.d.ts.map +1 -0
- package/dist/components/Sonner.d.ts +7 -0
- package/dist/components/Sonner.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +5 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Tabs.d.ts +8 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/button/Button.d.ts +12 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/buttonVariants.d.ts +6 -0
- package/dist/components/button/buttonVariants.d.ts.map +1 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/constants/fileUploadPresets.d.ts +34 -0
- package/dist/constants/fileUploadPresets.d.ts.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/errorHandler-BJcFS2qV.js +26 -0
- package/dist/fileUploadPresets-2raQmHT0.js +74 -0
- package/dist/index-wTf_TtOG.js +131 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +84 -0
- package/dist/isEmptyObject-C5s4GzLE.js +8 -0
- package/dist/jsx-runtime-B6kdoens.js +634 -0
- package/dist/membership/components/OAuth/Button.d.ts +8 -0
- package/dist/membership/components/OAuth/Button.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Container.d.ts +24 -0
- package/dist/membership/components/OAuth/Container.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Core.d.ts +17 -0
- package/dist/membership/components/OAuth/Core.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Popup.d.ts +15 -0
- package/dist/membership/components/OAuth/Popup.d.ts.map +1 -0
- package/dist/membership/components/index.d.ts +8 -0
- package/dist/membership/components/index.d.ts.map +1 -0
- package/dist/membership/index.d.ts +2 -0
- package/dist/membership/index.d.ts.map +1 -0
- package/dist/membership/index.js +4 -0
- package/dist/page-CxaKoH22.js +205 -0
- package/dist/providers/LevoProvider.d.ts +25 -0
- package/dist/providers/LevoProvider.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/useLevoForm-BcN8f66y.js +166 -0
- package/dist/utils/byteToSize.d.ts +3 -0
- package/dist/utils/byteToSize.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +4 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/errorHandler.d.ts +2 -0
- package/dist/utils/errorHandler.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +14 -0
- package/dist/utils/isDateObject.d.ts +2 -0
- package/dist/utils/isDateObject.d.ts.map +1 -0
- package/dist/utils/isEmptyObject.d.ts +5 -0
- package/dist/utils/isEmptyObject.d.ts.map +1 -0
- package/dist/utils/isNullOrUndefined.d.ts +2 -0
- package/dist/utils/isNullOrUndefined.d.ts.map +1 -0
- package/dist/utils/isObject.d.ts +3 -0
- package/dist/utils/isObject.d.ts.map +1 -0
- package/package.json +88 -5
- package/dist/audience/block.d.ts.map +0 -1
- package/dist/audience/component.d.ts.map +0 -1
- package/dist/audience/page.d.ts.map +0 -1
- package/dist/audience/useScrollDepth.d.ts.map +0 -1
- /package/dist/audience/{useScrollDepth.d.ts → components/useScrollDepth.d.ts} +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
+
import * as s from "@radix-ui/react-dialog";
|
|
4
|
+
import { X as N } from "lucide-react";
|
|
5
|
+
import * as n from "react";
|
|
6
|
+
import { c as l } from "./cn-C9QoOYNG.js";
|
|
7
|
+
import * as d from "@radix-ui/react-tooltip";
|
|
8
|
+
const j = s.Root, C = s.Trigger, y = s.Portal, m = n.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ a.jsx(
|
|
9
|
+
s.Overlay,
|
|
10
|
+
{
|
|
11
|
+
ref: o,
|
|
12
|
+
className: l(
|
|
13
|
+
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
14
|
+
t
|
|
15
|
+
),
|
|
16
|
+
...e
|
|
17
|
+
}
|
|
18
|
+
));
|
|
19
|
+
m.displayName = s.Overlay.displayName;
|
|
20
|
+
const c = n.forwardRef(({ className: t, children: e, hideCloseButton: o, ...i }, r) => /* @__PURE__ */ a.jsxs(y, { children: [
|
|
21
|
+
/* @__PURE__ */ a.jsx(m, {}),
|
|
22
|
+
/* @__PURE__ */ a.jsxs(
|
|
23
|
+
s.Content,
|
|
24
|
+
{
|
|
25
|
+
ref: r,
|
|
26
|
+
className: l(
|
|
27
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
|
|
28
|
+
t
|
|
29
|
+
),
|
|
30
|
+
...i,
|
|
31
|
+
children: [
|
|
32
|
+
e,
|
|
33
|
+
!o && /* @__PURE__ */ a.jsxs(s.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
34
|
+
/* @__PURE__ */ a.jsx(N, { className: "h-4 w-4" }),
|
|
35
|
+
/* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Close" })
|
|
36
|
+
] })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] }));
|
|
41
|
+
c.displayName = s.Content.displayName;
|
|
42
|
+
const p = ({
|
|
43
|
+
className: t,
|
|
44
|
+
...e
|
|
45
|
+
}) => /* @__PURE__ */ a.jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: l(
|
|
49
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
50
|
+
t
|
|
51
|
+
),
|
|
52
|
+
...e
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
p.displayName = "DialogHeader";
|
|
56
|
+
const h = ({
|
|
57
|
+
className: t,
|
|
58
|
+
...e
|
|
59
|
+
}) => /* @__PURE__ */ a.jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: l(
|
|
63
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
64
|
+
t
|
|
65
|
+
),
|
|
66
|
+
...e
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
h.displayName = "DialogFooter";
|
|
70
|
+
const f = n.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ a.jsx(
|
|
71
|
+
s.Title,
|
|
72
|
+
{
|
|
73
|
+
ref: o,
|
|
74
|
+
className: l(
|
|
75
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
76
|
+
t
|
|
77
|
+
),
|
|
78
|
+
...e
|
|
79
|
+
}
|
|
80
|
+
));
|
|
81
|
+
f.displayName = s.Title.displayName;
|
|
82
|
+
const g = n.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ a.jsx(
|
|
83
|
+
s.Description,
|
|
84
|
+
{
|
|
85
|
+
ref: o,
|
|
86
|
+
className: l("text-sm text-muted-foreground", t),
|
|
87
|
+
...e
|
|
88
|
+
}
|
|
89
|
+
));
|
|
90
|
+
g.displayName = s.Description.displayName;
|
|
91
|
+
const R = ({
|
|
92
|
+
isOpen: t,
|
|
93
|
+
onClose: e,
|
|
94
|
+
children: o,
|
|
95
|
+
title: i,
|
|
96
|
+
contentClassName: r,
|
|
97
|
+
modal: u = !0
|
|
98
|
+
}) => /* @__PURE__ */ a.jsx(j, { open: t, onOpenChange: e, modal: u, children: /* @__PURE__ */ a.jsxs(c, { className: r, children: [
|
|
99
|
+
i && /* @__PURE__ */ a.jsxs(p, { className: "flex-1 font-medium", children: [
|
|
100
|
+
/* @__PURE__ */ a.jsx(f, { children: i }),
|
|
101
|
+
/* @__PURE__ */ a.jsx(g, {})
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ a.jsx("div", { className: "w-full", children: o })
|
|
104
|
+
] }) }), P = d.Provider, D = d.Root, b = d.Trigger, z = d.Portal, x = n.forwardRef(({ className: t, sideOffset: e = 4, ...o }, i) => /* @__PURE__ */ a.jsx(
|
|
105
|
+
d.Content,
|
|
106
|
+
{
|
|
107
|
+
ref: i,
|
|
108
|
+
sideOffset: e,
|
|
109
|
+
className: l(
|
|
110
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
111
|
+
t
|
|
112
|
+
),
|
|
113
|
+
...o
|
|
114
|
+
}
|
|
115
|
+
));
|
|
116
|
+
x.displayName = d.Content.displayName;
|
|
117
|
+
const k = ({
|
|
118
|
+
children: t,
|
|
119
|
+
label: e,
|
|
120
|
+
labelClassName: o,
|
|
121
|
+
contentClassName: i,
|
|
122
|
+
asChild: r = !0
|
|
123
|
+
}) => /* @__PURE__ */ a.jsxs(D, { children: [
|
|
124
|
+
e && /* @__PURE__ */ a.jsx(x, { className: o, children: /* @__PURE__ */ a.jsx("p", { className: i, children: e }) }),
|
|
125
|
+
/* @__PURE__ */ a.jsx(b, { asChild: r, children: t })
|
|
126
|
+
] });
|
|
127
|
+
export {
|
|
128
|
+
j as D,
|
|
129
|
+
k as S,
|
|
130
|
+
D as T,
|
|
131
|
+
y as a,
|
|
132
|
+
m as b,
|
|
133
|
+
C as c,
|
|
134
|
+
c as d,
|
|
135
|
+
p as e,
|
|
136
|
+
h as f,
|
|
137
|
+
f as g,
|
|
138
|
+
g as h,
|
|
139
|
+
R as i,
|
|
140
|
+
b as j,
|
|
141
|
+
x as k,
|
|
142
|
+
P as l,
|
|
143
|
+
z as m
|
|
144
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { H as s } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
3
|
+
import r from "./TextWidget-D0UBxTxe.js";
|
|
4
|
+
const a = (t) => /* @__PURE__ */ e.jsx(
|
|
5
|
+
r,
|
|
6
|
+
{
|
|
7
|
+
leftIcon: /* @__PURE__ */ e.jsx("div", { className: "w-full h-full flex items-center justify-center bg-muted", children: /* @__PURE__ */ e.jsx(s, { size: "20px", className: "text-muted-foreground" }) }),
|
|
8
|
+
...t
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
a as URLWidget,
|
|
13
|
+
a as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
+
import { createSrcSet as f, MediaKindList as k } from "@levo-so/core";
|
|
4
|
+
import { useMemo as Q, useState as S, useRef as aa, useEffect as D } from "react";
|
|
5
|
+
import { useController as ra } from "react-hook-form";
|
|
6
|
+
import { G as R, B as I, S as W, T as ta, a as sa, c as q, d as G } from "./Spinner-CuUosd-S.js";
|
|
7
|
+
import { X as ea, Upload as M } from "lucide-react";
|
|
8
|
+
import { h as oa, j as ca, k as na } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
9
|
+
import { I as X } from "./Input-2CvZ90f8.js";
|
|
10
|
+
import { l as la, S as K, i as da } from "./Tooltip-CI4i4mYr.js";
|
|
11
|
+
import { useDropzone as xa } from "react-dropzone";
|
|
12
|
+
import { m as ia, g as F } from "./fileUploadPresets-2raQmHT0.js";
|
|
13
|
+
import { e as O } from "./Sonner-t6JVKA0a.js";
|
|
14
|
+
import { c as P } from "./cn-C9QoOYNG.js";
|
|
15
|
+
import { u as V } from "./LevoProvider-DNbYyEaf.js";
|
|
16
|
+
import { e as J } from "./errorHandler-BJcFS2qV.js";
|
|
17
|
+
import { useDebouncedCallback as pa } from "use-debounce";
|
|
18
|
+
import { C as ma } from "./Checbox-sq-atGlJ.js";
|
|
19
|
+
import { b as ha } from "./byteToSize-BFKZSBu1.js";
|
|
20
|
+
function $(e) {
|
|
21
|
+
return R({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" }, child: [] }] })(e);
|
|
22
|
+
}
|
|
23
|
+
function ua(e) {
|
|
24
|
+
return R({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z" }, child: [] }] })(e);
|
|
25
|
+
}
|
|
26
|
+
function ga(e) {
|
|
27
|
+
return R({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z" }, child: [] }] })(e);
|
|
28
|
+
}
|
|
29
|
+
const ja = ({ onChange: e, value: o, kind: j, isMultiple: d = !1 }) => {
|
|
30
|
+
const { media: c } = V(), n = Array.isArray(o) ? o : [], _ = Q(() => {
|
|
31
|
+
let t = {};
|
|
32
|
+
return j.forEach((m) => {
|
|
33
|
+
t = {
|
|
34
|
+
...t,
|
|
35
|
+
...ia[m]
|
|
36
|
+
};
|
|
37
|
+
}), t;
|
|
38
|
+
}, [j]), g = (t) => {
|
|
39
|
+
e == null || e(t);
|
|
40
|
+
}, y = async (t) => {
|
|
41
|
+
if ((t == null ? void 0 : t.length) === 0) {
|
|
42
|
+
O("No file selected. Please select one file.");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const m = new FormData();
|
|
46
|
+
t == null || t.forEach((p) => {
|
|
47
|
+
m.append("media", p);
|
|
48
|
+
}), await (c == null ? void 0 : c.mediaBulkUpload(m).then((p) => {
|
|
49
|
+
var h, E;
|
|
50
|
+
const w = (E = (h = p == null ? void 0 : p.content) == null ? void 0 : h.data) == null ? void 0 : E.map(
|
|
51
|
+
(a) => {
|
|
52
|
+
var l;
|
|
53
|
+
return {
|
|
54
|
+
id: a == null ? void 0 : a.id,
|
|
55
|
+
kind: a == null ? void 0 : a.kind,
|
|
56
|
+
location: a == null ? void 0 : a.location,
|
|
57
|
+
mimetype: (l = a == null ? void 0 : a.metadata) == null ? void 0 : l.mimetype,
|
|
58
|
+
srcset: a == null ? void 0 : a.srcset
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
g([...n, ...w]);
|
|
63
|
+
}).catch(J));
|
|
64
|
+
}, { getRootProps: z, getInputProps: i, isDragActive: v } = xa({
|
|
65
|
+
onDrop: y,
|
|
66
|
+
accept: _,
|
|
67
|
+
multiple: d,
|
|
68
|
+
maxSize: 25 * 1024 * 1024,
|
|
69
|
+
onDropRejected: (t) => {
|
|
70
|
+
t.forEach((m) => {
|
|
71
|
+
m.errors.forEach((p) => {
|
|
72
|
+
p.code === "file-too-large" && O(`${m.file.name} is bigger than 25MB`);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ r.jsx(la, { children: /* @__PURE__ */ r.jsx("div", { className: "w-full min-h-[150px]", children: (n == null ? void 0 : n.length) > 0 ? /* @__PURE__ */ r.jsxs("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fit,_minmax(150px,_1fr))]", children: [
|
|
78
|
+
n == null ? void 0 : n.map((t) => {
|
|
79
|
+
var m, p;
|
|
80
|
+
return /* @__PURE__ */ r.jsxs(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: "group relative w-full overflow-hidden h-auto max-[350px] rounded-md border border-gray-300",
|
|
84
|
+
style: {
|
|
85
|
+
background: "linear-gradient(to top, black -50%, transparent 45%)"
|
|
86
|
+
},
|
|
87
|
+
children: [
|
|
88
|
+
(t == null ? void 0 : t.kind) !== "image" ? /* @__PURE__ */ r.jsx("div", { className: "flex items-center h-[100px]", children: /* @__PURE__ */ r.jsx(
|
|
89
|
+
$,
|
|
90
|
+
{
|
|
91
|
+
size: "60px",
|
|
92
|
+
className: "text-gray-400 p-2"
|
|
93
|
+
}
|
|
94
|
+
) }) : /* @__PURE__ */ r.jsx(
|
|
95
|
+
"img",
|
|
96
|
+
{
|
|
97
|
+
className: "w-full h-full object-contain",
|
|
98
|
+
src: t == null ? void 0 : t.location
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ r.jsx(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
className: P(
|
|
105
|
+
"absolute left-0 right-0 bottom-0 h-16 bg-[linear-gradient(to-t,_rgba(0,_0,_10,_0.35),_transparent)]",
|
|
106
|
+
"group-hover:bg-[linear-gradient(to-t,_rgba(0,0,10,0.5),_transparent)] group-hover:h-[70%]"
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ r.jsx("p", { className: "absolute left-4 bottom-2 text-base text-white", children: (p = t == null ? void 0 : t.location) == null ? void 0 : p.split("/")[((m = t == null ? void 0 : t.location) == null ? void 0 : m.split("/").length) - 1] }),
|
|
111
|
+
/* @__PURE__ */ r.jsx(
|
|
112
|
+
I,
|
|
113
|
+
{
|
|
114
|
+
className: "absolute right-4 top-4 z-10",
|
|
115
|
+
size: "icon",
|
|
116
|
+
variant: "secondary",
|
|
117
|
+
onClick: () => {
|
|
118
|
+
g(
|
|
119
|
+
n == null ? void 0 : n.filter((w) => (w == null ? void 0 : w.id) !== (t == null ? void 0 : t.id))
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */ r.jsx(ea, { className: "text-primary" })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
t == null ? void 0 : t.id
|
|
128
|
+
);
|
|
129
|
+
}),
|
|
130
|
+
d && /* @__PURE__ */ r.jsxs(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: "flex items-center justify-center flex-col w-full rounded-md border-dashed border-[2px] border-gray-400 h-[14rem] p-4 gap-2",
|
|
134
|
+
...z(),
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ r.jsx("p", { className: "text-xl text-center my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
|
|
137
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ r.jsx(K, { label: "Upload a file", children: /* @__PURE__ */ r.jsxs(I, { size: "icon", className: "text-md", children: [
|
|
138
|
+
/* @__PURE__ */ r.jsx("input", { ...i() }),
|
|
139
|
+
/* @__PURE__ */ r.jsx(M, { size: 20 })
|
|
140
|
+
] }) }) })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] }) : /* @__PURE__ */ r.jsxs(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: "flex items-center justify-center flex-col w-full rounded-md border-dashed border-[2px] border-gray-400 h-[14rem] p-4 gap-2",
|
|
148
|
+
...z(),
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ r.jsx("p", { className: "text-xl my-2", children: v ? "Drop your files here..." : "Drag & Drop here to upload!" }),
|
|
151
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ r.jsx(K, { label: "Upload a file", children: /* @__PURE__ */ r.jsxs(I, { size: "icon", className: "text-md", children: [
|
|
152
|
+
/* @__PURE__ */ r.jsx("input", { ...i() }),
|
|
153
|
+
/* @__PURE__ */ r.jsx(M, { size: 20 })
|
|
154
|
+
] }) }) })
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
) }) });
|
|
158
|
+
}, ya = ({
|
|
159
|
+
selectedFiles: e = [],
|
|
160
|
+
onChange: o,
|
|
161
|
+
isMultiple: j = !1,
|
|
162
|
+
kind: d
|
|
163
|
+
}) => {
|
|
164
|
+
const { media: c } = V(), [n, _] = S(1), [g, y] = S([]), [z, i] = S(!1), v = aa(null), [t, m] = S({
|
|
165
|
+
searchText: "",
|
|
166
|
+
currentPage: 1
|
|
167
|
+
}), p = pa(() => {
|
|
168
|
+
i(!0), c == null || c.getAllMedia({
|
|
169
|
+
page: t.currentPage,
|
|
170
|
+
limit: 24,
|
|
171
|
+
sort: {
|
|
172
|
+
created_at: "desc"
|
|
173
|
+
},
|
|
174
|
+
search: t.searchText || void 0
|
|
175
|
+
}).then((a) => {
|
|
176
|
+
var l, A;
|
|
177
|
+
_((A = (l = a == null ? void 0 : a.content) == null ? void 0 : l.meta) == null ? void 0 : A.pages), y((L) => {
|
|
178
|
+
var b;
|
|
179
|
+
return [...L, ...((b = a == null ? void 0 : a.content) == null ? void 0 : b.data) || []];
|
|
180
|
+
});
|
|
181
|
+
}).catch((a) => {
|
|
182
|
+
console.error(a);
|
|
183
|
+
}).finally(() => {
|
|
184
|
+
i(!1);
|
|
185
|
+
});
|
|
186
|
+
}, 500);
|
|
187
|
+
D(() => {
|
|
188
|
+
p();
|
|
189
|
+
}, [t]), D(() => {
|
|
190
|
+
const a = v.current;
|
|
191
|
+
if (a)
|
|
192
|
+
return a.addEventListener("scroll", w), () => a.removeEventListener("scroll", w);
|
|
193
|
+
}, [v, t.currentPage, n]);
|
|
194
|
+
const w = () => {
|
|
195
|
+
const a = v.current;
|
|
196
|
+
a && a.scrollTop + a.clientHeight + 1 >= a.scrollHeight && h();
|
|
197
|
+
}, h = () => {
|
|
198
|
+
t.currentPage < n && m((a) => ({
|
|
199
|
+
searchText: a.searchText,
|
|
200
|
+
currentPage: a.currentPage + 1
|
|
201
|
+
}));
|
|
202
|
+
}, E = (a) => {
|
|
203
|
+
if (!(d != null && d.includes(a == null ? void 0 : a.kind))) {
|
|
204
|
+
O(`Only ${d == null ? void 0 : d.join(", ")}s are allowed.`);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
j ? (e == null ? void 0 : e.findIndex((l) => (l == null ? void 0 : l.id) === (a == null ? void 0 : a.id))) >= 0 ? o == null || o(e == null ? void 0 : e.filter((l) => (l == null ? void 0 : l.id) !== (a == null ? void 0 : a.id))) : o == null || o([...e || [], a]) : o == null || o([a]);
|
|
208
|
+
};
|
|
209
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "bg-white p-0 rounded-md w-full relative", children: [
|
|
210
|
+
/* @__PURE__ */ r.jsx("div", { className: "py-2 bg-white sticky top-0 z-50 w-full", children: /* @__PURE__ */ r.jsx(
|
|
211
|
+
X,
|
|
212
|
+
{
|
|
213
|
+
name: "searchText",
|
|
214
|
+
type: "text",
|
|
215
|
+
placeholder: "Search...",
|
|
216
|
+
value: t.searchText,
|
|
217
|
+
onChange: (a) => {
|
|
218
|
+
i(!0), m({ currentPage: 1, searchText: a.target.value }), y([]);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
) }),
|
|
222
|
+
z && !g.length ? /* @__PURE__ */ r.jsx("div", { className: "w-full h-full min-h-[30rem] flex items-center justify-center", children: /* @__PURE__ */ r.jsx(W, {}) }) : /* @__PURE__ */ r.jsxs(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
ref: v,
|
|
226
|
+
className: "w-full h-[30rem] overflow-y-auto overflow-x-hidden grid lg:grid-cols-4 gap-6 p-2",
|
|
227
|
+
children: [
|
|
228
|
+
g == null ? void 0 : g.map((a, l) => {
|
|
229
|
+
const A = d == null ? void 0 : d.includes(a == null ? void 0 : a.kind), L = (e == null ? void 0 : e.findIndex((b) => (b == null ? void 0 : b.id) === (a == null ? void 0 : a.id))) >= 0;
|
|
230
|
+
return /* @__PURE__ */ r.jsxs(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: P(
|
|
234
|
+
"relative w-full",
|
|
235
|
+
A ? "opacity-100" : "opacity-50"
|
|
236
|
+
),
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ r.jsxs(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
className: P(
|
|
242
|
+
"cursor-pointer w-full group rounded-md overflow-hidden h-[130px] border-2 flex items-center justify-center",
|
|
243
|
+
L ? "border-primary" : "border-gray-100"
|
|
244
|
+
),
|
|
245
|
+
onClick: () => {
|
|
246
|
+
var b;
|
|
247
|
+
return E({
|
|
248
|
+
id: a == null ? void 0 : a.id,
|
|
249
|
+
location: a == null ? void 0 : a.location,
|
|
250
|
+
mimetype: (b = a == null ? void 0 : a.metadata) == null ? void 0 : b.mimetype,
|
|
251
|
+
kind: a == null ? void 0 : a.kind,
|
|
252
|
+
srcset: a == null ? void 0 : a.srcset
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ r.jsx(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: P(
|
|
260
|
+
"rounded-md opacity-0 absolute left-0 right-0 top-0 w-full h-[42px] bg-[linear-gradient(0deg,_transparent_0%,_#000000_200%)]",
|
|
261
|
+
A ? "group-hover:opacity-100" : ""
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
A && /* @__PURE__ */ r.jsx(
|
|
266
|
+
ma,
|
|
267
|
+
{
|
|
268
|
+
name: "isFileIncluded",
|
|
269
|
+
className: "absolute top-[10px] left-[10px]",
|
|
270
|
+
checked: L
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
(a == null ? void 0 : a.kind) !== "image" ? /* @__PURE__ */ r.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ r.jsx(
|
|
274
|
+
"img",
|
|
275
|
+
{
|
|
276
|
+
className: "w-full h-full object-contain",
|
|
277
|
+
srcSet: f(a == null ? void 0 : a.srcset),
|
|
278
|
+
src: a == null ? void 0 : a.location
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ r.jsxs("div", { className: "my-[10px]", children: [
|
|
285
|
+
/* @__PURE__ */ r.jsx("p", { className: "text-sm whitespace-nowrap overflow-hidden text-ellipsis", children: a == null ? void 0 : a.filename }),
|
|
286
|
+
/* @__PURE__ */ r.jsx("p", { className: "text-xs text-gray-500", children: ha(a == null ? void 0 : a.metadata.size) })
|
|
287
|
+
] })
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
`media-layout-file-${l}`
|
|
291
|
+
);
|
|
292
|
+
}),
|
|
293
|
+
z && /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ r.jsx(W, {}) })
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
] });
|
|
298
|
+
}, ba = ({
|
|
299
|
+
isOpen: e,
|
|
300
|
+
onClose: o,
|
|
301
|
+
onChange: j,
|
|
302
|
+
value: d,
|
|
303
|
+
kind: c,
|
|
304
|
+
isMultiple: n = !1,
|
|
305
|
+
isExternal: _
|
|
306
|
+
}) => {
|
|
307
|
+
const [g, y] = S([]), z = () => {
|
|
308
|
+
o();
|
|
309
|
+
};
|
|
310
|
+
return D(() => {
|
|
311
|
+
y(d.filter((i) => !!i.location));
|
|
312
|
+
}, [d]), /* @__PURE__ */ r.jsxs(
|
|
313
|
+
da,
|
|
314
|
+
{
|
|
315
|
+
title: (c == null ? void 0 : c.length) > 1 ? "Upload file" : `Upload ${c == null ? void 0 : c[0]}`,
|
|
316
|
+
isOpen: e,
|
|
317
|
+
onClose: () => z(),
|
|
318
|
+
contentClassName: "max-w-[60%]",
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ r.jsxs(ta, { defaultValue: "upload", children: [
|
|
321
|
+
/* @__PURE__ */ r.jsxs(sa, { children: [
|
|
322
|
+
/* @__PURE__ */ r.jsx(q, { value: "upload", children: "Local File" }),
|
|
323
|
+
!_ && /* @__PURE__ */ r.jsx(q, { value: "import", children: "Import from Gallery" })
|
|
324
|
+
] }),
|
|
325
|
+
/* @__PURE__ */ r.jsx(G, { value: "upload", children: /* @__PURE__ */ r.jsx("div", { className: "mt-[20px] max-h-[70vh] overflow-y-auto", children: /* @__PURE__ */ r.jsx(
|
|
326
|
+
ja,
|
|
327
|
+
{
|
|
328
|
+
kind: c,
|
|
329
|
+
value: g,
|
|
330
|
+
onChange: (i) => y(i),
|
|
331
|
+
isMultiple: n
|
|
332
|
+
}
|
|
333
|
+
) }) }),
|
|
334
|
+
/* @__PURE__ */ r.jsx(G, { value: "import", children: /* @__PURE__ */ r.jsx(
|
|
335
|
+
ya,
|
|
336
|
+
{
|
|
337
|
+
onChange: (i) => {
|
|
338
|
+
y == null || y(i);
|
|
339
|
+
},
|
|
340
|
+
selectedFiles: g,
|
|
341
|
+
isMultiple: n,
|
|
342
|
+
kind: c
|
|
343
|
+
}
|
|
344
|
+
) })
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex justify-end mt-[20px]", children: /* @__PURE__ */ r.jsx(
|
|
347
|
+
I,
|
|
348
|
+
{
|
|
349
|
+
variant: "default",
|
|
350
|
+
onClick: () => {
|
|
351
|
+
g && (j == null || j(g)), z();
|
|
352
|
+
},
|
|
353
|
+
children: "Save"
|
|
354
|
+
}
|
|
355
|
+
) })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
}, Va = ({
|
|
360
|
+
field: e,
|
|
361
|
+
kind: o = k,
|
|
362
|
+
isMultiple: j,
|
|
363
|
+
isExternal: d = !1
|
|
364
|
+
}) => {
|
|
365
|
+
var H;
|
|
366
|
+
const { media: c } = V(), { key: n = "", label: _ = "", helper_text: g = "", readonly: y = !1 } = e, {
|
|
367
|
+
field: { onBlur: z, onChange: i, value: v, disabled: t, ref: m },
|
|
368
|
+
fieldState: p
|
|
369
|
+
} = ra({
|
|
370
|
+
name: n,
|
|
371
|
+
rules: oa(e)
|
|
372
|
+
}), w = Q(() => {
|
|
373
|
+
const s = [];
|
|
374
|
+
return o.forEach((T) => {
|
|
375
|
+
s.push(...F[T]);
|
|
376
|
+
}), s;
|
|
377
|
+
}, [o]), h = v ? Array.isArray(v) ? v : [v] : [], [E, a] = S(!1), l = () => a(!0), A = () => a(!1), [L, b] = S(!1), U = (s) => {
|
|
378
|
+
i && (j === !0 ? i(s) : j === !1 && i(s == null ? void 0 : s[0]));
|
|
379
|
+
}, Y = async (s) => {
|
|
380
|
+
const T = new FormData();
|
|
381
|
+
let x = [...s];
|
|
382
|
+
j || (x = s == null ? void 0 : s.slice(0, 1)), (x == null ? void 0 : x.length) > 0 && (x == null || x.forEach((u) => {
|
|
383
|
+
var C;
|
|
384
|
+
const N = u.name.split("."), B = (C = N[N.length - 1]) == null ? void 0 : C.toLowerCase();
|
|
385
|
+
o == null || o.forEach((Z) => {
|
|
386
|
+
w.push(...F[Z]);
|
|
387
|
+
}), B && w.includes(B) && T.append("media", u);
|
|
388
|
+
})), b(!0), await (c == null ? void 0 : c.mediaBulkUpload(T).then((u) => {
|
|
389
|
+
var N, B;
|
|
390
|
+
b(!1), (N = u == null ? void 0 : u.content) != null && N.data && U((B = u == null ? void 0 : u.content) == null ? void 0 : B.data);
|
|
391
|
+
}).catch((u) => {
|
|
392
|
+
J(u);
|
|
393
|
+
}).finally(() => {
|
|
394
|
+
b(!1);
|
|
395
|
+
}));
|
|
396
|
+
};
|
|
397
|
+
return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ r.jsx(
|
|
399
|
+
ba,
|
|
400
|
+
{
|
|
401
|
+
isOpen: E,
|
|
402
|
+
onClose: A,
|
|
403
|
+
onChange: (s) => {
|
|
404
|
+
U(s);
|
|
405
|
+
},
|
|
406
|
+
value: h,
|
|
407
|
+
kind: [...o],
|
|
408
|
+
isMultiple: j,
|
|
409
|
+
isExternal: d
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
/* @__PURE__ */ r.jsxs(
|
|
413
|
+
ca,
|
|
414
|
+
{
|
|
415
|
+
error: (H = p == null ? void 0 : p.error) == null ? void 0 : H.message,
|
|
416
|
+
helperText: g,
|
|
417
|
+
readOnly: y,
|
|
418
|
+
children: [
|
|
419
|
+
_ && /* @__PURE__ */ r.jsx(na, { htmlFor: n, isRequired: e == null ? void 0 : e.required, children: _ }),
|
|
420
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex gap-2", ref: m, children: [
|
|
421
|
+
/* @__PURE__ */ r.jsx(
|
|
422
|
+
I,
|
|
423
|
+
{
|
|
424
|
+
size: "icon-small",
|
|
425
|
+
variant: "outline",
|
|
426
|
+
disabled: t,
|
|
427
|
+
onClick: l,
|
|
428
|
+
children: /* @__PURE__ */ r.jsx(M, { size: 15 })
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative flex", children: [
|
|
432
|
+
/* @__PURE__ */ r.jsx(
|
|
433
|
+
X,
|
|
434
|
+
{
|
|
435
|
+
name: "pasteUrl",
|
|
436
|
+
onBlur: () => z(),
|
|
437
|
+
onPaste: (s) => {
|
|
438
|
+
const T = s.clipboardData.items, x = [];
|
|
439
|
+
for (let u = 0; u < T.length; u++) {
|
|
440
|
+
const N = T[u];
|
|
441
|
+
if ((N == null ? void 0 : N.kind) === "file") {
|
|
442
|
+
const B = N == null ? void 0 : N.getAsFile();
|
|
443
|
+
B && x.push(B);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
(x == null ? void 0 : x.length) > 0 && Y(x);
|
|
447
|
+
},
|
|
448
|
+
disabled: t,
|
|
449
|
+
readOnly: y
|
|
450
|
+
}
|
|
451
|
+
),
|
|
452
|
+
L && /* @__PURE__ */ r.jsxs(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
role: "status",
|
|
456
|
+
className: "absolute right-3 top-[50%] translate-y-[-50%]",
|
|
457
|
+
children: [
|
|
458
|
+
/* @__PURE__ */ r.jsx(ua, {}),
|
|
459
|
+
/* @__PURE__ */ r.jsx("span", { className: "sr-only", children: "Loading..." })
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
] })
|
|
464
|
+
] }),
|
|
465
|
+
(h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ r.jsx("div", { className: "mt-3 w-full", children: /* @__PURE__ */ r.jsx("div", { className: "w-full grid gap-4 grid-cols-[repeat(auto-fill,_minmax(100px,_1fr))]", children: h == null ? void 0 : h.map((s, T) => s != null && s.location ? /* @__PURE__ */ r.jsxs(
|
|
466
|
+
"div",
|
|
467
|
+
{
|
|
468
|
+
className: "relative border overflow-hidden group w-full rounded-xl h-[120px] flex items-center justify-center",
|
|
469
|
+
children: [
|
|
470
|
+
(s == null ? void 0 : s.kind) !== "image" ? /* @__PURE__ */ r.jsx($, { size: "60px", className: "text-gray-400" }) : /* @__PURE__ */ r.jsx(
|
|
471
|
+
"img",
|
|
472
|
+
{
|
|
473
|
+
className: "w-full h-full object-contain",
|
|
474
|
+
src: s == null ? void 0 : s.location,
|
|
475
|
+
alt: s == null ? void 0 : s.id
|
|
476
|
+
}
|
|
477
|
+
),
|
|
478
|
+
/* @__PURE__ */ r.jsx(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
className: "absolute top-1 right-1 bg-white p-1 rounded-full focus:outline-none",
|
|
482
|
+
onClick: () => {
|
|
483
|
+
U(
|
|
484
|
+
h == null ? void 0 : h.filter((x) => (x == null ? void 0 : x.id) !== (s == null ? void 0 : s.id))
|
|
485
|
+
);
|
|
486
|
+
},
|
|
487
|
+
type: "button",
|
|
488
|
+
children: /* @__PURE__ */ r.jsx(ga, { className: "text-sm" })
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
`${s == null ? void 0 : s.location}-${T}`
|
|
494
|
+
) : null) }) })
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
] });
|
|
499
|
+
};
|
|
500
|
+
export {
|
|
501
|
+
Va as UploadWidget,
|
|
502
|
+
Va as default
|
|
503
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/audience/components/block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CAkBA,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/audience/components/component.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC;CACtC,CAUA,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|