@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.
Files changed (215) hide show
  1. package/dist/Checbox-sq-atGlJ.js +28 -0
  2. package/dist/CheckboxWidget-ComdVcZ_.js +118 -0
  3. package/dist/CollectionFormBuilder-jwwjyIpv.js +738 -0
  4. package/dist/CurrencyWidget-DVqD_lsY.js +60 -0
  5. package/dist/DateTimeWidget-CvgzwY1U.js +80 -0
  6. package/dist/DefaultFormVariant-CbRB9O_e.js +80 -0
  7. package/dist/DropdownWidget-C2YaM9Cf.js +115 -0
  8. package/dist/EmailWidget-BBthwF68.js +41 -0
  9. package/dist/GeocoderWidget-Dht_2vi6.js +309 -0
  10. package/dist/Input-2CvZ90f8.js +54 -0
  11. package/dist/LevoProvider-DNbYyEaf.js +21 -0
  12. package/dist/MultiGeocoderWidget-paCFW0QZ.js +49 -0
  13. package/dist/PhoneWidget-CP2T2JDx.js +47 -0
  14. package/dist/RadioWidget-BuFPz7kK.js +109 -0
  15. package/dist/RichTextWidget-DGFNZ1jl.js +310 -0
  16. package/dist/Sonner-t6JVKA0a.js +39 -0
  17. package/dist/Spinner-CuUosd-S.js +297 -0
  18. package/dist/StepsFormVariant-5_c3f2Vk.js +137 -0
  19. package/dist/SwitchWidget-t8iwhxk9.js +53 -0
  20. package/dist/TextWidget-D0UBxTxe.js +33 -0
  21. package/dist/TextareaWidget-CG6J_plD.js +30 -0
  22. package/dist/ToggleCheckboxWidget-dl8ks4VX.js +44 -0
  23. package/dist/Tooltip-CI4i4mYr.js +144 -0
  24. package/dist/URLWidget-CHeUEUXl.js +14 -0
  25. package/dist/UploadWidget-CzYGViqE.js +503 -0
  26. package/dist/audience/{block.d.ts → components/block.d.ts} +1 -1
  27. package/dist/audience/components/block.d.ts.map +1 -0
  28. package/dist/audience/{component.d.ts → components/component.d.ts} +1 -1
  29. package/dist/audience/components/component.d.ts.map +1 -0
  30. package/dist/audience/{page.d.ts → components/page.d.ts} +1 -1
  31. package/dist/audience/components/page.d.ts.map +1 -0
  32. package/dist/audience/components/useScrollDepth.d.ts.map +1 -0
  33. package/dist/audience/index.d.ts +3 -3
  34. package/dist/audience/index.d.ts.map +1 -1
  35. package/dist/audience/index.js +4 -2303
  36. package/dist/byteToSize-BFKZSBu1.js +8 -0
  37. package/dist/cn-C9QoOYNG.js +6 -0
  38. package/dist/collection/components/CollectionFormBuilder.d.ts +12 -0
  39. package/dist/collection/components/CollectionFormBuilder.d.ts.map +1 -0
  40. package/dist/collection/components/FieldRenderer.d.ts +9 -0
  41. package/dist/collection/components/FieldRenderer.d.ts.map +1 -0
  42. package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts +5 -0
  43. package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -0
  44. package/dist/collection/components/core/Checkbox/Checbox.d.ts +5 -0
  45. package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -0
  46. package/dist/collection/components/core/Input/Input.d.ts +11 -0
  47. package/dist/collection/components/core/Input/Input.d.ts.map +1 -0
  48. package/dist/collection/components/core/Switch/Switch.d.ts +5 -0
  49. package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -0
  50. package/dist/collection/components/renderer/RenderArrayWidget.d.ts +5 -0
  51. package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +1 -0
  52. package/dist/collection/components/renderer/RenderCommonField.d.ts +5 -0
  53. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -0
  54. package/dist/collection/components/renderer/RenderRecordWidget.d.ts +4 -0
  55. package/dist/collection/components/renderer/RenderRecordWidget.d.ts.map +1 -0
  56. package/dist/collection/components/widgets/ErrorMessage.d.ts +6 -0
  57. package/dist/collection/components/widgets/ErrorMessage.d.ts.map +1 -0
  58. package/dist/collection/components/widgets/FieldWrapper.d.ts +14 -0
  59. package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -0
  60. package/dist/collection/components/widgets/FormHelperText.d.ts +6 -0
  61. package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -0
  62. package/dist/collection/components/widgets/FormLabel.d.ts +8 -0
  63. package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -0
  64. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +8 -0
  65. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -0
  66. package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts +7 -0
  67. package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +1 -0
  68. package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts +9 -0
  69. package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -0
  70. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +8 -0
  71. package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -0
  72. package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts +9 -0
  73. package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -0
  74. package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +8 -0
  75. package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts.map +1 -0
  76. package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts +8 -0
  77. package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -0
  78. package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts +8 -0
  79. package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -0
  80. package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts +8 -0
  81. package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -0
  82. package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts +11 -0
  83. package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -0
  84. package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts +12 -0
  85. package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -0
  86. package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts +8 -0
  87. package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts.map +1 -0
  88. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts +9 -0
  89. package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -0
  90. package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts +8 -0
  91. package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -0
  92. package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts +8 -0
  93. package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts.map +1 -0
  94. package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts +10 -0
  95. package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -0
  96. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts +13 -0
  97. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -0
  98. package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts +11 -0
  99. package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -0
  100. package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts +19 -0
  101. package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -0
  102. package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts +5 -0
  103. package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts.map +1 -0
  104. package/dist/collection/index.d.ts +5 -0
  105. package/dist/collection/index.d.ts.map +1 -0
  106. package/dist/collection/index.js +19 -0
  107. package/dist/collection/lib/FormBuilder.d.ts +8 -0
  108. package/dist/collection/lib/FormBuilder.d.ts.map +1 -0
  109. package/dist/collection/lib/SaveDraftValues.d.ts +7 -0
  110. package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -0
  111. package/dist/collection/lib/hooks/useLevoForm.d.ts +18 -0
  112. package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -0
  113. package/dist/collection/lib/provider/LevoFormProvider.d.ts +9 -0
  114. package/dist/collection/lib/provider/LevoFormProvider.d.ts.map +1 -0
  115. package/dist/collection/lib/variants/DefaultFormVariant.d.ts +3 -0
  116. package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -0
  117. package/dist/collection/lib/variants/StepsFormVariant.d.ts +4 -0
  118. package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -0
  119. package/dist/collection/types/context.d.ts +34 -0
  120. package/dist/collection/types/context.d.ts.map +1 -0
  121. package/dist/collection/types/errors.d.ts +7 -0
  122. package/dist/collection/types/errors.d.ts.map +1 -0
  123. package/dist/collection/types/formVariant.d.ts +18 -0
  124. package/dist/collection/types/formVariant.d.ts.map +1 -0
  125. package/dist/collection/types/forms.d.ts +31 -0
  126. package/dist/collection/types/forms.d.ts.map +1 -0
  127. package/dist/collection/types/index.d.ts +4 -0
  128. package/dist/collection/types/index.d.ts.map +1 -0
  129. package/dist/collection/types/renderer.d.ts +6 -0
  130. package/dist/collection/types/renderer.d.ts.map +1 -0
  131. package/dist/collection/utils/formHelpers.d.ts +47 -0
  132. package/dist/collection/utils/formHelpers.d.ts.map +1 -0
  133. package/dist/collection/utils/getFieldValidations.d.ts +6 -0
  134. package/dist/collection/utils/getFieldValidations.d.ts.map +1 -0
  135. package/dist/collection/utils/index.d.ts +4 -0
  136. package/dist/collection/utils/index.d.ts.map +1 -0
  137. package/dist/collection/utils/schema.d.ts +3 -0
  138. package/dist/collection/utils/schema.d.ts.map +1 -0
  139. package/dist/collection/utils/setFormErrors.d.ts +4 -0
  140. package/dist/collection/utils/setFormErrors.d.ts.map +1 -0
  141. package/dist/collection/utils/storage.d.ts +11 -0
  142. package/dist/collection/utils/storage.d.ts.map +1 -0
  143. package/dist/components/Dialog.d.ts +21 -0
  144. package/dist/components/Dialog.d.ts.map +1 -0
  145. package/dist/components/DialogWrapper.d.ts +11 -0
  146. package/dist/components/DialogWrapper.d.ts.map +1 -0
  147. package/dist/components/Sonner.d.ts +7 -0
  148. package/dist/components/Sonner.d.ts.map +1 -0
  149. package/dist/components/Spinner.d.ts +5 -0
  150. package/dist/components/Spinner.d.ts.map +1 -0
  151. package/dist/components/Tabs.d.ts +8 -0
  152. package/dist/components/Tabs.d.ts.map +1 -0
  153. package/dist/components/Tooltip.d.ts +16 -0
  154. package/dist/components/Tooltip.d.ts.map +1 -0
  155. package/dist/components/button/Button.d.ts +12 -0
  156. package/dist/components/button/Button.d.ts.map +1 -0
  157. package/dist/components/button/buttonVariants.d.ts +6 -0
  158. package/dist/components/button/buttonVariants.d.ts.map +1 -0
  159. package/dist/components/button/index.d.ts +3 -0
  160. package/dist/components/button/index.d.ts.map +1 -0
  161. package/dist/components/index.d.ts +8 -0
  162. package/dist/components/index.d.ts.map +1 -0
  163. package/dist/components/index.js +33 -0
  164. package/dist/constants/fileUploadPresets.d.ts +34 -0
  165. package/dist/constants/fileUploadPresets.d.ts.map +1 -0
  166. package/dist/constants/index.d.ts +2 -0
  167. package/dist/constants/index.d.ts.map +1 -0
  168. package/dist/errorHandler-BJcFS2qV.js +26 -0
  169. package/dist/fileUploadPresets-2raQmHT0.js +74 -0
  170. package/dist/index-wTf_TtOG.js +131 -0
  171. package/dist/index.d.ts +8 -0
  172. package/dist/index.js +84 -0
  173. package/dist/isEmptyObject-C5s4GzLE.js +8 -0
  174. package/dist/jsx-runtime-B6kdoens.js +634 -0
  175. package/dist/membership/components/OAuth/Button.d.ts +8 -0
  176. package/dist/membership/components/OAuth/Button.d.ts.map +1 -0
  177. package/dist/membership/components/OAuth/Container.d.ts +24 -0
  178. package/dist/membership/components/OAuth/Container.d.ts.map +1 -0
  179. package/dist/membership/components/OAuth/Core.d.ts +17 -0
  180. package/dist/membership/components/OAuth/Core.d.ts.map +1 -0
  181. package/dist/membership/components/OAuth/Popup.d.ts +15 -0
  182. package/dist/membership/components/OAuth/Popup.d.ts.map +1 -0
  183. package/dist/membership/components/index.d.ts +8 -0
  184. package/dist/membership/components/index.d.ts.map +1 -0
  185. package/dist/membership/index.d.ts +2 -0
  186. package/dist/membership/index.d.ts.map +1 -0
  187. package/dist/membership/index.js +4 -0
  188. package/dist/page-CxaKoH22.js +205 -0
  189. package/dist/providers/LevoProvider.d.ts +25 -0
  190. package/dist/providers/LevoProvider.d.ts.map +1 -0
  191. package/dist/style.css +1 -0
  192. package/dist/useLevoForm-BcN8f66y.js +166 -0
  193. package/dist/utils/byteToSize.d.ts +3 -0
  194. package/dist/utils/byteToSize.d.ts.map +1 -0
  195. package/dist/utils/cn.d.ts +4 -0
  196. package/dist/utils/cn.d.ts.map +1 -0
  197. package/dist/utils/errorHandler.d.ts +2 -0
  198. package/dist/utils/errorHandler.d.ts.map +1 -0
  199. package/dist/utils/index.d.ts +8 -0
  200. package/dist/utils/index.d.ts.map +1 -0
  201. package/dist/utils/index.js +14 -0
  202. package/dist/utils/isDateObject.d.ts +2 -0
  203. package/dist/utils/isDateObject.d.ts.map +1 -0
  204. package/dist/utils/isEmptyObject.d.ts +5 -0
  205. package/dist/utils/isEmptyObject.d.ts.map +1 -0
  206. package/dist/utils/isNullOrUndefined.d.ts +2 -0
  207. package/dist/utils/isNullOrUndefined.d.ts.map +1 -0
  208. package/dist/utils/isObject.d.ts +3 -0
  209. package/dist/utils/isObject.d.ts.map +1 -0
  210. package/package.json +88 -5
  211. package/dist/audience/block.d.ts.map +0 -1
  212. package/dist/audience/component.d.ts.map +0 -1
  213. package/dist/audience/page.d.ts.map +0 -1
  214. package/dist/audience/useScrollDepth.d.ts.map +0 -1
  215. /package/dist/audience/{useScrollDepth.d.ts → components/useScrollDepth.d.ts} +0 -0
@@ -0,0 +1,54 @@
1
+ import { j as e } from "./jsx-runtime-B6kdoens.js";
2
+ import u from "react";
3
+ import { c as r } from "./cn-C9QoOYNG.js";
4
+ const b = u.forwardRef(
5
+ ({
6
+ className: l,
7
+ leftIcon: t,
8
+ rightIcon: o,
9
+ leftIconBoxStyles: i,
10
+ rightIconBoxStyles: d,
11
+ containerStyles: n,
12
+ ...s
13
+ }, a) => /* @__PURE__ */ e.jsxs("div", { className: r("w-full relative", n), children: [
14
+ t ? /* @__PURE__ */ e.jsx(
15
+ "div",
16
+ {
17
+ className: r(
18
+ "absolute left-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-l-md overflow-hidden",
19
+ "border border-transparent",
20
+ i
21
+ ),
22
+ children: t
23
+ }
24
+ ) : null,
25
+ /* @__PURE__ */ e.jsx(
26
+ "input",
27
+ {
28
+ ref: a,
29
+ className: r(
30
+ "h-9 flex w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
31
+ s.readOnly ? "focus-visible:ring-0" : "",
32
+ t ? "pl-11" : "",
33
+ o ? "pr-11" : "",
34
+ l
35
+ ),
36
+ ...s
37
+ }
38
+ ),
39
+ o ? /* @__PURE__ */ e.jsx(
40
+ "div",
41
+ {
42
+ className: r(
43
+ "absolute right-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-r-md overflow-hidden",
44
+ "border border-transparent",
45
+ d
46
+ ),
47
+ children: o
48
+ }
49
+ ) : null
50
+ ] })
51
+ );
52
+ export {
53
+ b as I
54
+ };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { j as r } from "./jsx-runtime-B6kdoens.js";
3
+ import { createContext as s, useContext as n } from "react";
4
+ const o = s(null), v = ({ children: e, ...t }) => /* @__PURE__ */ r.jsx(
5
+ o.Provider,
6
+ {
7
+ value: {
8
+ ...t
9
+ },
10
+ children: e
11
+ }
12
+ ), x = () => {
13
+ const e = n(o);
14
+ if (!e)
15
+ throw new Error("useLevo must be used within LevoProvider");
16
+ return e;
17
+ };
18
+ export {
19
+ v as L,
20
+ x as u
21
+ };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { j as e } from "./jsx-runtime-B6kdoens.js";
3
+ import { useFieldArray as m } from "react-hook-form";
4
+ import { k as n } from "./CollectionFormBuilder-jwwjyIpv.js";
5
+ import { Plus as c } from "lucide-react";
6
+ import { GeocoderWidget as d } from "./GeocoderWidget-Dht_2vi6.js";
7
+ import { B as p } from "./Spinner-CuUosd-S.js";
8
+ const g = ({
9
+ field: l
10
+ }) => {
11
+ const { key: s = "", label: o = "" } = l, { fields: r, ...i } = m({
12
+ name: s
13
+ });
14
+ return /* @__PURE__ */ e.jsxs("div", { className: "w-full relative", children: [
15
+ o && /* @__PURE__ */ e.jsx(n, { htmlFor: s, children: o }),
16
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
17
+ r == null ? void 0 : r.map((a, t) => /* @__PURE__ */ e.jsx(
18
+ d,
19
+ {
20
+ field: {
21
+ ...l,
22
+ key: `${s}.${t}`,
23
+ label: ""
24
+ }
25
+ },
26
+ a.id
27
+ )),
28
+ /* @__PURE__ */ e.jsxs(
29
+ p,
30
+ {
31
+ variant: "ghost",
32
+ size: "xs",
33
+ className: "shrink-0 grow-0 self-start",
34
+ onClick: () => {
35
+ i.append(null);
36
+ },
37
+ children: [
38
+ /* @__PURE__ */ e.jsx(c, { className: "inline-block mr-1", size: "14px" }),
39
+ "Add"
40
+ ]
41
+ }
42
+ )
43
+ ] })
44
+ ] });
45
+ };
46
+ export {
47
+ g as MultiGeocoderWidget,
48
+ g as default
49
+ };
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { j as o } from "./jsx-runtime-B6kdoens.js";
3
+ import { useController as f } from "react-hook-form";
4
+ import { PhoneInput as g } from "react-international-phone";
5
+ import { h as x, j as v, k as j } from "./CollectionFormBuilder-jwwjyIpv.js";
6
+ import { c as l } from "./cn-C9QoOYNG.js";
7
+ const q = ({ field: e }) => {
8
+ const { key: u = "", label: n = "", helper_text: c = "", readonly: t = !1 } = e, s = u, {
9
+ field: { value: d, onBlur: a, onChange: i, ...m },
10
+ fieldState: { error: r }
11
+ } = f({
12
+ name: s,
13
+ rules: x(e)
14
+ }), p = !!(e != null && e.required), h = r == null ? void 0 : r.message;
15
+ return /* @__PURE__ */ o.jsxs(v, { error: h, helperText: c, readOnly: t, children: [
16
+ n && /* @__PURE__ */ o.jsx(j, { htmlFor: s, isRequired: p, children: n }),
17
+ /* @__PURE__ */ o.jsx(
18
+ g,
19
+ {
20
+ defaultCountry: "in",
21
+ value: d,
22
+ className: l(
23
+ "w-full",
24
+ t ? "focus-visible:ring-0 pointer-events-none" : ""
25
+ ),
26
+ inputClassName: l(
27
+ "w-full border border-input bg-transparent text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
28
+ ),
29
+ onChange: (b) => {
30
+ i && i(b);
31
+ },
32
+ onBlur: () => {
33
+ a && a();
34
+ },
35
+ style: {
36
+ "--react-international-phone-height": "2.25rem",
37
+ "--react-international-phone-border-radius": "calc(var(--radius) - 2px)"
38
+ },
39
+ ...m
40
+ }
41
+ )
42
+ ] });
43
+ };
44
+ export {
45
+ q as PhoneWidget,
46
+ q as default
47
+ };
@@ -0,0 +1,109 @@
1
+ "use client";
2
+ import { j as r } from "./jsx-runtime-B6kdoens.js";
3
+ import * as n from "@radix-ui/react-radio-group";
4
+ import * as d from "react";
5
+ import { useController as F } from "react-hook-form";
6
+ import { G as E } from "./Spinner-CuUosd-S.js";
7
+ import { h as G, j as V, k as f } from "./CollectionFormBuilder-jwwjyIpv.js";
8
+ import { I as q } from "./Input-2CvZ90f8.js";
9
+ import { c as N } from "./cn-C9QoOYNG.js";
10
+ function B(s) {
11
+ return E({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128 192 384l-96-96" }, child: [] }] })(s);
12
+ }
13
+ const C = ({ field: s }) => {
14
+ var y;
15
+ const [c, m] = d.useState(""), [u, h] = d.useState(!1), {
16
+ key: v = "",
17
+ label: j = "",
18
+ helper_text: $ = "",
19
+ readonly: g = !1,
20
+ values: t = [],
21
+ options: w = {}
22
+ } = s, { custom_input: I } = w, a = v, {
23
+ field: { value: i, onBlur: b, onChange: o, ...R },
24
+ fieldState: p
25
+ } = F({
26
+ name: a,
27
+ rules: G(s)
28
+ }), O = !!(s != null && s.required), k = (y = p == null ? void 0 : p.error) == null ? void 0 : y.message;
29
+ return d.useEffect(() => {
30
+ u || i && (t == null ? void 0 : t.findIndex((e) => e === i)) === -1 && (h(!0), m(i));
31
+ }, [i]), /* @__PURE__ */ r.jsxs(V, { error: k, helperText: $, readOnly: g, children: [
32
+ j && /* @__PURE__ */ r.jsx(f, { htmlFor: a, isRequired: O, children: j }),
33
+ /* @__PURE__ */ r.jsxs(
34
+ n.Root,
35
+ {
36
+ id: a,
37
+ className: N(
38
+ "w-full flex gap-4 flex-col flex-wrap pt-1",
39
+ g && "pointer-events-none cursor-not-allowed"
40
+ ),
41
+ onValueChange: (e) => {
42
+ o && (e === "Other" ? (h(!0), o(c)) : (h(!1), o(e)));
43
+ },
44
+ onBlur: () => {
45
+ b && b();
46
+ },
47
+ value: u ? "Other" : i,
48
+ ...R,
49
+ children: [
50
+ t == null ? void 0 : t.map((e, l) => /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
51
+ /* @__PURE__ */ r.jsx(x, { id: `${a}-${e}-${l}`, value: e, children: e }),
52
+ /* @__PURE__ */ r.jsx(
53
+ f,
54
+ {
55
+ htmlFor: `${a}-${e}-${l}`,
56
+ className: "font-normal mb-0",
57
+ children: e
58
+ }
59
+ )
60
+ ] }, `${e}-${l}`)),
61
+ !!I && /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
62
+ /* @__PURE__ */ r.jsx(x, { id: `${a}-other`, value: "Other" }),
63
+ /* @__PURE__ */ r.jsx(
64
+ f,
65
+ {
66
+ className: "font-normal leading-none mb-0",
67
+ htmlFor: `${a}-other`,
68
+ children: "Other:"
69
+ }
70
+ ),
71
+ /* @__PURE__ */ r.jsx(
72
+ q,
73
+ {
74
+ className: "max-w-[300px]",
75
+ name: `radio-other-${a}`,
76
+ value: c,
77
+ onChange: (e) => {
78
+ var l;
79
+ o == null || o((l = e == null ? void 0 : e.target) == null ? void 0 : l.value), m(e.target.value);
80
+ },
81
+ disabled: !u,
82
+ placeholder: "Please specify"
83
+ }
84
+ )
85
+ ] })
86
+ ]
87
+ }
88
+ )
89
+ ] });
90
+ };
91
+ C.displayName = n.Root.displayName;
92
+ const x = d.forwardRef(({ className: s, ...c }, m) => /* @__PURE__ */ r.jsx(
93
+ n.Item,
94
+ {
95
+ ref: m,
96
+ className: N(
97
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
98
+ s
99
+ ),
100
+ ...c,
101
+ children: /* @__PURE__ */ r.jsx(n.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ r.jsx(B, { className: "h-3.5 w-3.5 fill-primary" }) })
102
+ }
103
+ ));
104
+ x.displayName = n.Item.displayName;
105
+ export {
106
+ x as RadioGroupItem,
107
+ C as RadioWidget,
108
+ C as default
109
+ };
@@ -0,0 +1,310 @@
1
+ "use client";
2
+ import { j as l } from "./jsx-runtime-B6kdoens.js";
3
+ import B from "@tiptap/extension-bold";
4
+ import d from "@tiptap/extension-bullet-list";
5
+ import w from "@tiptap/extension-document";
6
+ import { HardBreak as y } from "@tiptap/extension-hard-break";
7
+ import z from "@tiptap/extension-history";
8
+ import S from "@tiptap/extension-italic";
9
+ import R from "@tiptap/extension-link";
10
+ import M from "@tiptap/extension-list-item";
11
+ import U from "@tiptap/extension-ordered-list";
12
+ import T from "@tiptap/extension-paragraph";
13
+ import H from "@tiptap/extension-strike";
14
+ import N from "@tiptap/extension-text";
15
+ import O from "@tiptap/extension-text-align";
16
+ import F from "@tiptap/extension-underline";
17
+ import { useEditor as I, EditorContent as E } from "@tiptap/react";
18
+ import { useState as D, useEffect as G } from "react";
19
+ import { useController as q } from "react-hook-form";
20
+ import { G as p, e as J, f as V, g as W, h as Z, i as _, j as P, k as K, l as Q, m as X, n as Y, o as $, p as nn } from "./Spinner-CuUosd-S.js";
21
+ import { h as ln, j as en, k as sn } from "./CollectionFormBuilder-jwwjyIpv.js";
22
+ import { c as j } from "./cn-C9QoOYNG.js";
23
+ function an(n) {
24
+ return p({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, child: [] }] })(n);
25
+ }
26
+ function cn(n) {
27
+ return p({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 0 0-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 0 0-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z" }, child: [] }] })(n);
28
+ }
29
+ function tn(n) {
30
+ return p({ tag: "svg", attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M12.6512 14.0654L11.6047 20H9.57389L10.9247 12.339L3.51465 4.92892L4.92886 3.51471L20.4852 19.0711L19.071 20.4853L12.6512 14.0654ZM11.7727 7.53009L12.0425 5.99999H10.2426L8.24257 3.99999H19.9999V5.99999H14.0733L13.4991 9.25652L11.7727 7.53009Z" }, child: [] }] })(n);
31
+ }
32
+ const e = ({
33
+ isSelected: n,
34
+ className: c,
35
+ children: t,
36
+ ...i
37
+ }) => /* @__PURE__ */ l.jsx(
38
+ "button",
39
+ {
40
+ className: j(
41
+ "text-gray-900 rounded-[4px] hover:bg-gray-200",
42
+ n ? "bg-gray-400" : "bg-transparent",
43
+ c
44
+ ),
45
+ type: "button",
46
+ ...i,
47
+ children: t
48
+ }
49
+ ), a = ({ children: n }) => /* @__PURE__ */ l.jsx("div", { className: "flex p-1 gap-[2px] border-solid border-r-[1px] border-input", children: n }), rn = ({ editor: n }) => {
50
+ if (!n)
51
+ return null;
52
+ function c(i) {
53
+ const u = i.getAttributes("link").href, r = window.prompt("URL", u);
54
+ if (r !== null) {
55
+ if (r === "") {
56
+ i.chain().focus().extendMarkRange("link").unsetLink().run();
57
+ return;
58
+ }
59
+ i.chain().focus().extendMarkRange("link").setLink({ href: r }).run();
60
+ }
61
+ }
62
+ const t = n.getAttributes("link").href;
63
+ return /* @__PURE__ */ l.jsxs("div", { className: "w-full bg-white flex flex-wrap border-solid border-b-[1px] rounded-tl-[14px] rounded-br-[14px] overflow", children: [
64
+ /* @__PURE__ */ l.jsxs(a, { children: [
65
+ /* @__PURE__ */ l.jsx(
66
+ e,
67
+ {
68
+ title: "Bold",
69
+ isSelected: n == null ? void 0 : n.isActive("bold"),
70
+ "aria-label": "bold",
71
+ onClick: () => n == null ? void 0 : n.chain().focus().toggleBold().run(),
72
+ children: /* @__PURE__ */ l.jsx(J, { size: "1.125rem" })
73
+ }
74
+ ),
75
+ /* @__PURE__ */ l.jsx(
76
+ e,
77
+ {
78
+ title: "Italic",
79
+ isSelected: n == null ? void 0 : n.isActive("italic"),
80
+ "aria-label": "italic",
81
+ onClick: () => n == null ? void 0 : n.chain().focus().toggleItalic().run(),
82
+ children: /* @__PURE__ */ l.jsx(V, { size: "1.125rem" })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ l.jsx(
86
+ e,
87
+ {
88
+ title: "Underline",
89
+ isSelected: n == null ? void 0 : n.isActive("underline"),
90
+ "aria-label": "underline",
91
+ onClick: () => n == null ? void 0 : n.commands.toggleUnderline(),
92
+ children: /* @__PURE__ */ l.jsx(W, { size: "1.25rem" })
93
+ }
94
+ ),
95
+ /* @__PURE__ */ l.jsx(
96
+ e,
97
+ {
98
+ title: "Strike",
99
+ isSelected: n == null ? void 0 : n.isActive("strike"),
100
+ "aria-label": "strike",
101
+ onClick: () => n == null ? void 0 : n.chain().focus().toggleStrike().run(),
102
+ children: /* @__PURE__ */ l.jsx(Z, { size: "1.125rem" })
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ l.jsxs(a, { children: [
107
+ /* @__PURE__ */ l.jsx(
108
+ e,
109
+ {
110
+ title: "Bullet list",
111
+ isSelected: n == null ? void 0 : n.isActive("bulletList"),
112
+ "aria-label": "bulletList",
113
+ onClick: () => n == null ? void 0 : n.chain().focus().toggleBulletList().run(),
114
+ children: /* @__PURE__ */ l.jsx(_, { size: "1.25rem" })
115
+ }
116
+ ),
117
+ /* @__PURE__ */ l.jsx(
118
+ e,
119
+ {
120
+ title: "Numbered List",
121
+ isSelected: n == null ? void 0 : n.isActive("orderedList"),
122
+ "aria-label": "numberList",
123
+ onClick: () => n == null ? void 0 : n.chain().focus().toggleOrderedList().run(),
124
+ children: /* @__PURE__ */ l.jsx(P, { size: "1.25rem" })
125
+ }
126
+ )
127
+ ] }),
128
+ /* @__PURE__ */ l.jsxs(a, { children: [
129
+ /* @__PURE__ */ l.jsx(
130
+ e,
131
+ {
132
+ title: "Add Link",
133
+ "aria-label": "link",
134
+ isSelected: n == null ? void 0 : n.isActive("link"),
135
+ onClick: () => c(n),
136
+ children: /* @__PURE__ */ l.jsx(K, { size: "1.25rem" })
137
+ }
138
+ ),
139
+ /* @__PURE__ */ l.jsx(
140
+ e,
141
+ {
142
+ title: "Remove Link",
143
+ "aria-label": "unlink",
144
+ disabled: !t,
145
+ onClick: () => n.chain().focus().extendMarkRange("link").unsetLink().run(),
146
+ children: /* @__PURE__ */ l.jsx(Q, { size: "1.25rem" })
147
+ }
148
+ )
149
+ ] }),
150
+ /* @__PURE__ */ l.jsxs(a, { children: [
151
+ /* @__PURE__ */ l.jsx(
152
+ e,
153
+ {
154
+ title: "Left Align",
155
+ isSelected: n == null ? void 0 : n.isActive({ textAlign: "left" }),
156
+ "aria-label": "leftAlign",
157
+ onClick: () => n == null ? void 0 : n.chain().focus().setTextAlign("left").run(),
158
+ children: /* @__PURE__ */ l.jsx(X, { size: "1.125rem" })
159
+ }
160
+ ),
161
+ /* @__PURE__ */ l.jsx(
162
+ e,
163
+ {
164
+ title: "Center Align",
165
+ isSelected: n == null ? void 0 : n.isActive({ textAlign: "center" }),
166
+ "aria-label": "centerAlign",
167
+ onClick: () => n == null ? void 0 : n.chain().focus().setTextAlign("center").run(),
168
+ children: /* @__PURE__ */ l.jsx(Y, { size: "1.125rem" })
169
+ }
170
+ ),
171
+ /* @__PURE__ */ l.jsx(
172
+ e,
173
+ {
174
+ title: "Right Align",
175
+ isSelected: n == null ? void 0 : n.isActive({ textAlign: "right" }),
176
+ "aria-label": "rightAlign",
177
+ onClick: () => n == null ? void 0 : n.chain().focus().setTextAlign("right").run(),
178
+ children: /* @__PURE__ */ l.jsx($, { size: "1.125rem" })
179
+ }
180
+ ),
181
+ /* @__PURE__ */ l.jsx(
182
+ e,
183
+ {
184
+ title: "Justify Align",
185
+ isSelected: n == null ? void 0 : n.isActive({ textAlign: "justify" }),
186
+ "aria-label": "justifyAlign",
187
+ onClick: () => n == null ? void 0 : n.chain().focus().setTextAlign("justify").run(),
188
+ children: /* @__PURE__ */ l.jsx(nn, { size: "1.125rem" })
189
+ }
190
+ )
191
+ ] }),
192
+ /* @__PURE__ */ l.jsx(a, { children: /* @__PURE__ */ l.jsx(
193
+ e,
194
+ {
195
+ title: "Clear Formatting",
196
+ isSelected: n == null ? void 0 : n.isActive("clear-formatting"),
197
+ "aria-label": "clear-formatting",
198
+ onClick: () => n.chain().focus().clearNodes().unsetAllMarks().run(),
199
+ children: /* @__PURE__ */ l.jsx(tn, { size: "1.125rem" })
200
+ }
201
+ ) }),
202
+ /* @__PURE__ */ l.jsxs(a, { children: [
203
+ /* @__PURE__ */ l.jsx(
204
+ e,
205
+ {
206
+ title: "Undo",
207
+ "aria-label": "undo",
208
+ onClick: () => n.chain().focus().undo().run(),
209
+ disabled: !n.can().chain().focus().undo().run(),
210
+ children: /* @__PURE__ */ l.jsx(cn, { size: "1.125rem" })
211
+ }
212
+ ),
213
+ /* @__PURE__ */ l.jsx(
214
+ e,
215
+ {
216
+ title: "Redo",
217
+ "aria-label": "redo",
218
+ onClick: () => n.chain().focus().redo().run(),
219
+ disabled: !n.can().chain().focus().redo().run(),
220
+ children: /* @__PURE__ */ l.jsx(an, { size: "1.125rem" })
221
+ }
222
+ )
223
+ ] })
224
+ ] });
225
+ }, Rn = ({ field: n }) => {
226
+ var b;
227
+ const [c, t] = D(!1), { key: i = "", label: u = "", helper_text: r = "", readonly: h = !1 } = n, o = i, {
228
+ field: { value: x, onBlur: k, onChange: L, ...m },
229
+ fieldState: g
230
+ } = q({
231
+ name: o,
232
+ rules: ln(n)
233
+ }), A = !!(n != null && n.required), v = (b = g == null ? void 0 : g.error) == null ? void 0 : b.message, s = I({
234
+ extensions: [
235
+ w,
236
+ T,
237
+ N,
238
+ B,
239
+ F,
240
+ S,
241
+ H,
242
+ U,
243
+ d,
244
+ M,
245
+ y,
246
+ R.configure({
247
+ HTMLAttributes: {
248
+ target: "_blank"
249
+ },
250
+ openOnClick: !1
251
+ }),
252
+ O.configure({
253
+ types: ["heading", "paragraph"]
254
+ }),
255
+ z
256
+ ],
257
+ content: x,
258
+ editable: !m.disabled && !h,
259
+ onBlur: () => {
260
+ k();
261
+ },
262
+ onUpdate: ({ editor: f }) => {
263
+ const C = f.getHTML();
264
+ L(C);
265
+ },
266
+ immediatelyRender: !1
267
+ });
268
+ return G(() => {
269
+ s != null && s.commands && !c && (s.commands.setContent(x || ""), t(!0));
270
+ }, [x]), /* @__PURE__ */ l.jsxs(en, { error: v, helperText: r, readOnly: h, children: [
271
+ u && /* @__PURE__ */ l.jsx(sn, { htmlFor: o, isRequired: A, children: u }),
272
+ /* @__PURE__ */ l.jsxs(
273
+ "div",
274
+ {
275
+ className: j(
276
+ "w-full rounded-md border border-input placeholder:text-muted-foreground focus-within:outline-none focus-within:ring-1 focus-within:ring-ring overflow-hidden",
277
+ (m == null ? void 0 : m.disabled) && "cursor-not-allowed opacity-50 pointer-events-none",
278
+ h && "focus-visible:ring-0 pointer-events-none"
279
+ ),
280
+ children: [
281
+ /* @__PURE__ */ l.jsx(rn, { editor: s }),
282
+ /* @__PURE__ */ l.jsx(
283
+ "div",
284
+ {
285
+ className: "overflow-y-auto bg-white flex-1 w-full h-[210px] rounded-b-[inherit]",
286
+ onClick: () => {
287
+ var f;
288
+ return (f = s == null ? void 0 : s.commands) == null ? void 0 : f.focus();
289
+ },
290
+ children: /* @__PURE__ */ l.jsx(
291
+ E,
292
+ {
293
+ id: o,
294
+ className: "prose prose-sm px-4 !w-full [&>div]:outline-none [&>div]:w-full",
295
+ name: o,
296
+ editor: s
297
+ }
298
+ )
299
+ }
300
+ )
301
+ ]
302
+ }
303
+ )
304
+ ] });
305
+ };
306
+ export {
307
+ Rn as RichTextWidget,
308
+ e as ToolbarButton,
309
+ Rn as default
310
+ };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { j as e } from "./jsx-runtime-B6kdoens.js";
3
+ import { Toaster as a, toast as s } from "sonner";
4
+ const n = ({ ...t }) => /* @__PURE__ */ e.jsx(
5
+ a,
6
+ {
7
+ closeButton: !0,
8
+ richColors: !0,
9
+ className: "toaster group",
10
+ toastOptions: {
11
+ classNames: {
12
+ toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
13
+ description: "group-[.toast]:text-muted-foreground",
14
+ actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
15
+ cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
16
+ }
17
+ },
18
+ ...t
19
+ }
20
+ ), p = (t, o = "Error", r = {}) => {
21
+ s.error(o, {
22
+ description: t,
23
+ duration: 4e3,
24
+ position: "bottom-right",
25
+ ...r
26
+ });
27
+ }, g = (t, o = "Success", r = {}) => {
28
+ s.success(o, {
29
+ description: t,
30
+ duration: 4e3,
31
+ position: "bottom-right",
32
+ ...r
33
+ });
34
+ };
35
+ export {
36
+ n as T,
37
+ p as e,
38
+ g as s
39
+ };