@cling-se/widget 1.0.0-beta.1 → 1.0.0-beta.2

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 (241) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.internal.md +82 -0
  3. package/README.md +14 -40
  4. package/README.public.md +14 -0
  5. package/dist/AddClientCallout-e8d19R3f.js +101 -0
  6. package/dist/AnswerModal-BGvB8IVV.js +3291 -0
  7. package/dist/AttachmentItem-CkHbAm4l.js +171 -0
  8. package/dist/BaseUpload-BiJBcWRu.js +2472 -0
  9. package/dist/BlockMedia-CW5wgipC.js +103 -0
  10. package/dist/CCallout-Cy2eeIYd.js +104 -0
  11. package/dist/{CCurrencyDropdown-qH-3m2eP.js → CCurrencyDropdown-DE_3CTjm.js} +91 -49
  12. package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
  13. package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
  14. package/dist/{CPhoneFormat-CfQayFxw.js → CPhoneFormat-BS2nP9kc.js} +13 -21
  15. package/dist/CPhoneInput-Bf6329PO.js +207 -0
  16. package/dist/CPriceInput-d1yjuMQr.js +140 -0
  17. package/dist/CSelect-DgnT07Hk.js +98 -0
  18. package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
  19. package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
  20. package/dist/ClientModal-BzWQtWSZ.js +1181 -0
  21. package/dist/ColorPicker-BvoFN8nu.js +1408 -0
  22. package/dist/CompanyModal-Bp4V_az9.js +250 -0
  23. package/dist/ContentWrapper-CuH6xKmo.js +265 -0
  24. package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
  25. package/dist/DocAnswer-BcNA_KEg.js +33 -0
  26. package/dist/DocDetails-CStEwWnU.js +448 -0
  27. package/dist/DocForm-BOoILf5E.js +6748 -0
  28. package/dist/DocFormSend-CQIf-HJY.js +171 -0
  29. package/dist/DocLinks-BRX5QzNe.js +36 -0
  30. package/dist/DocModalBase-D72yWj-x.js +29 -0
  31. package/dist/DocPrint-BI1LXUPE.js +399 -0
  32. package/dist/DocReceipt-DaZ4V76p.js +341 -0
  33. package/dist/DocSendReminder-DKGZlo7s.js +181 -0
  34. package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
  35. package/dist/DocTimeline-DCwofzuk.js +537 -0
  36. package/dist/DocumentClient-vJdxCB53.js +90 -0
  37. package/dist/DocumentLayout-CKSi42ev.js +1368 -0
  38. package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
  39. package/dist/DocumentVoided-CRX2WxWO.js +33 -0
  40. package/dist/EmbedInput-B-oeC4Wy.js +157 -0
  41. package/dist/EmbedSettings-B9Yka2yB.js +103 -0
  42. package/dist/ErrorCallout-B_ygH33E.js +34 -0
  43. package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
  44. package/dist/Flag-BwTgCNHO.js +41 -0
  45. package/dist/HeaderSettings-DvC7nlyY.js +720 -0
  46. package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
  47. package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
  48. package/dist/Index-0_3ULrWX.js +126 -0
  49. package/dist/Index-4NPe0sfX.js +629 -0
  50. package/dist/Index-B1uA0FF6.js +4 -0
  51. package/dist/Index-BBkCYm2q.js +201 -0
  52. package/dist/{Index-DIOiMm9f.js → Index-BBwvo7S9.js} +10 -18
  53. package/dist/Index-BEMlsYwJ.js +68 -0
  54. package/dist/Index-BRBhJ6kz.js +21 -0
  55. package/dist/{Index--qPMWUMT.js → Index-BTFmHjUt.js} +48 -61
  56. package/dist/Index-BcUNnxLC.js +1098 -0
  57. package/dist/Index-Bo6ExBUL.js +93 -0
  58. package/dist/Index-BvMPCgdH.js +102 -0
  59. package/dist/Index-Bx5TOI9k.js +74 -0
  60. package/dist/Index-C7GZS8EI.js +16 -0
  61. package/dist/Index-CNWhm07R.js +25 -0
  62. package/dist/{Index-DcQbh-z2.js → Index-CQpznMKV.js} +9 -17
  63. package/dist/Index-CRzsnIij.js +159 -0
  64. package/dist/Index-CeSG1C41.js +140 -0
  65. package/dist/Index-CjfjdZj5.js +52 -0
  66. package/dist/Index-CskKmZpd.js +363 -0
  67. package/dist/Index-D5qwbCo1.js +28 -0
  68. package/dist/Index-D8Ae1Txt.js +228 -0
  69. package/dist/Index-DE8aenDB.js +3452 -0
  70. package/dist/Index-DI5EB5Rt.js +39 -0
  71. package/dist/Index-DaV57YPP.js +163 -0
  72. package/dist/Index-DbwkmoyM.js +38 -0
  73. package/dist/Index-Df9skok6.js +70 -0
  74. package/dist/{Index-Bu0MGrj6.js → Index-DfLLA0ij.js} +313 -206
  75. package/dist/Index-Dw1CO5F9.js +76 -0
  76. package/dist/Index-PZXyOoVb.js +87 -0
  77. package/dist/{Index-D4XgxmbD.js → Index-ZUnH-BHj.js} +10 -18
  78. package/dist/Index-cjKGSiDi.js +136 -0
  79. package/dist/Index-m-goRuKD.js +49 -0
  80. package/dist/Index-rGeWbLcB.js +47 -0
  81. package/dist/Index-vrljNp6G.js +28 -0
  82. package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
  83. package/dist/InputToggleRow-v6qAWPg6.js +99 -0
  84. package/dist/ManualPopover-BONBJIUA.js +57 -0
  85. package/dist/MediaWrapper-CXb2UGd9.js +18 -0
  86. package/dist/{NotBindingText-CNV2Wmdx.js → NotBindingText-BqESO13N.js} +13 -17
  87. package/dist/PackageGroup-AIysVmyh.js +1058 -0
  88. package/dist/PdfTerms-BlhHdTu3.js +34 -0
  89. package/dist/PdfViewer-DwZ1rwlN.js +392 -0
  90. package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
  91. package/dist/PriceHeader-C4XhnoA3.js +488 -0
  92. package/dist/SearchApi-B7lXgUY6.js +137 -0
  93. package/dist/SendForm-BcD0xSvB.js +7031 -0
  94. package/dist/Setup-C2qaYDei.js +47 -0
  95. package/dist/{SmartList-Qgu0rMrI.js → SmartList-DqG7Q5t7.js} +16 -24
  96. package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
  97. package/dist/{TermsSettings-CE3h_xkm.js → TermsSettings-BOCONyM4.js} +169 -49
  98. package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
  99. package/dist/ToggleBinding-7oq_oXPt.js +44 -0
  100. package/dist/UploadModal-C_X2NjVY.js +134 -0
  101. package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
  102. package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
  103. package/dist/VideoSelectModal-CW0OweCw.js +217 -0
  104. package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
  105. package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
  106. package/dist/{debounce-C1AuSpOZ.js → debounce-DNl99Gyo.js} +7 -7
  107. package/dist/dom-CkTGWrfu.js +69 -0
  108. package/dist/{focusDrawerMixin-Be6BAK8-.js → focusDrawerMixin-BwcErMDY.js} +1 -1
  109. package/dist/{formDrawerState-DRbg5rVI.js → formDrawerState-DaurePnd.js} +2 -2
  110. package/dist/helpers-CPW--XIz.js +44 -0
  111. package/dist/index-BjiGCJPI.js +149 -0
  112. package/dist/index-CFNv6OvX.js +188 -0
  113. package/dist/index-Cx71On5Z.js +508 -0
  114. package/dist/index-DKMxIBz_.js +270 -0
  115. package/dist/index-DKf5SGLD.js +125 -0
  116. package/dist/index-E32WgUp9.js +3525 -0
  117. package/dist/index-kp-GC5I0.js +513 -0
  118. package/dist/index.es.js +2 -5
  119. package/dist/index.umd.js +306 -1505
  120. package/dist/{main-WKzC-Dnu.js → main-Cb-nyil1.js} +33252 -33755
  121. package/dist/mapFormMixin-D3BihYWW.js +1544 -0
  122. package/dist/omit--YYr41Xp.js +31 -0
  123. package/dist/{publicSenderState-BujjYsZZ.js → publicSenderState-CdRW_Wwp.js} +4 -4
  124. package/dist/regions-BdZt9Srn.js +1250 -0
  125. package/dist/splitpanes-D-ThFkeR.js +342 -0
  126. package/dist/style.css +1 -4
  127. package/dist/template-BvaNnq-g.js +1493 -0
  128. package/dist/{throttle-CWPJmFid.js → throttle-D-bUGaVh.js} +2 -2
  129. package/dist/tippy.esm-BmKNqohP.js +1994 -0
  130. package/dist/useTermsModal-Dhf6_eYb.js +87 -0
  131. package/dist/{utils-CA_Zy6u1.js → utils-CBPcYdLv.js} +8 -11
  132. package/dist/validation-DOcUOoMe.js +40 -0
  133. package/package.json +25 -31
  134. package/.eslintrc.cjs +0 -4
  135. package/dist/AddClientCallout-BWnvyBcK.js +0 -46
  136. package/dist/AnswerModal-CLGRdSnK.js +0 -3874
  137. package/dist/AttachmentItem-BPS0-wyc.js +0 -78
  138. package/dist/BaseDatePicker-BbmV_GdD.js +0 -3183
  139. package/dist/BaseUpload-9gPgI7r6.js +0 -1977
  140. package/dist/BlockMedia-DkPFWiYL.js +0 -76
  141. package/dist/CCallout-T26jwUby.js +0 -59
  142. package/dist/CDropdownItem-BE8BAMD1.js +0 -636
  143. package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +0 -1
  144. package/dist/CFormField-DECEfoVq.js +0 -241
  145. package/dist/CPriceInput-C4SOB-P5.js +0 -112
  146. package/dist/CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js +0 -1
  147. package/dist/ClientAutocomplete-DSebA1Mx.js +0 -78
  148. package/dist/ClientModal-BXFYvYCF.js +0 -625
  149. package/dist/ColorPicker-CZ_bJabP.js +0 -2879
  150. package/dist/CompanyModal-CDr3t28n.js +0 -141
  151. package/dist/ContentWrapper-BwmMoe4W.js +0 -183
  152. package/dist/CoverBlockSettings-_F11-DGc.js +0 -275
  153. package/dist/DocAnswer-BR59xzkT.js +0 -36
  154. package/dist/DocDetails-D1qbCbps.js +0 -259
  155. package/dist/DocForm-DBc2a7z5.js +0 -7272
  156. package/dist/DocFormSend-Casix-yG.js +0 -144
  157. package/dist/DocLinks-DGTaewyX.js +0 -38
  158. package/dist/DocModalBase-BbS_qvSv.js +0 -28
  159. package/dist/DocPrint-0PqX3mbJ.js +0 -240
  160. package/dist/DocReceipt-CU3VD5pt.js +0 -210
  161. package/dist/DocSendReminder-CuycBspr.js +0 -137
  162. package/dist/DocTextEditor-CntS2Bd-.js +0 -17180
  163. package/dist/DocTimeline-DJuv3yBe.js +0 -481
  164. package/dist/DocumentClient-C25XXzz6.js +0 -136
  165. package/dist/DocumentLayout-B7afHRMr.js +0 -4909
  166. package/dist/DocumentLogotype-sqI51wvM.js +0 -87
  167. package/dist/DocumentVoided-TahdTSMn.js +0 -25
  168. package/dist/EmbedInput-BY-wHSfc.js +0 -113
  169. package/dist/EmbedSettings-8pfjk4NP.js +0 -72
  170. package/dist/ErrorCallout-Dsr8PNsU.js +0 -28
  171. package/dist/FilePreviewModal-CcEinEFg.js +0 -81
  172. package/dist/Flag-PJKrghi9.js +0 -114
  173. package/dist/HeaderSettings-BqczIOsG.js +0 -392
  174. package/dist/ImageSelectModal-Cd-HhKnH.js +0 -84
  175. package/dist/ImageUploadWrapper-Dv43rGdb.js +0 -1604
  176. package/dist/Index-6b5VBKE-.js +0 -107
  177. package/dist/Index-B4pRJnbw.js +0 -84
  178. package/dist/Index-B69f8qgZ.js +0 -62
  179. package/dist/Index-B79YN9RO.js +0 -25
  180. package/dist/Index-BBrlPoe8.js +0 -58
  181. package/dist/Index-BXfWJCuq.js +0 -52
  182. package/dist/Index-Bd76vb37.js +0 -55
  183. package/dist/Index-BmbtQO5F.js +0 -150
  184. package/dist/Index-ByV_kJaH.js +0 -77
  185. package/dist/Index-CDV5rhWS.js +0 -49
  186. package/dist/Index-CIx4OOK-.js +0 -144
  187. package/dist/Index-CL1OWLt6.js +0 -223
  188. package/dist/Index-Caow0eZu.js +0 -31
  189. package/dist/Index-Cd3-3PEK.js +0 -2402
  190. package/dist/Index-CdpZBEKU.js +0 -98
  191. package/dist/Index-CmU3Sys-.js +0 -754
  192. package/dist/Index-CtRtgnpm.js +0 -32
  193. package/dist/Index-Cukkr33D.js +0 -140
  194. package/dist/Index-Cuqw0ios.js +0 -57
  195. package/dist/Index-Czm_WdqC.js +0 -25
  196. package/dist/Index-DNdYXHgr.js +0 -33
  197. package/dist/Index-DcuBxutp.js +0 -642
  198. package/dist/Index-DpWNWiyY.js +0 -291
  199. package/dist/Index-DzS1rZdF.js +0 -24
  200. package/dist/Index-N6s5pZxv.js +0 -26
  201. package/dist/Index-g_DNu4mt.js +0 -69
  202. package/dist/Index-mJ8F41GY.js +0 -154
  203. package/dist/Index-q7W9KA8m.js +0 -21
  204. package/dist/Index-rtzblZp4.js +0 -70
  205. package/dist/InputToggleRow-CZjxsDOQ.js +0 -57
  206. package/dist/ManualPopover-CZrWiT-P.js +0 -58
  207. package/dist/MediaWrapper-D37qK4KR.js +0 -23
  208. package/dist/PackageGroup-Heo_s8ct.js +0 -699
  209. package/dist/PdfTerms-AB9tXAtU.js +0 -36
  210. package/dist/PdfViewer-CIVkvOBr.js +0 -373
  211. package/dist/PlainHtml-CPmIebjY.js +0 -20
  212. package/dist/PriceHeader-DhDAruwX.js +0 -339
  213. package/dist/SearchApi-BMgdaI4s.js +0 -161
  214. package/dist/Setup-VIaIV9uT.js +0 -50
  215. package/dist/ThemeColorRow-DYJNgk6S.js +0 -67
  216. package/dist/ToggleBinding-CuwCeYpO.js +0 -38
  217. package/dist/UploadModal-BITcxG-J.js +0 -95
  218. package/dist/VideoPlayerInput-8szEX_8L.js +0 -93
  219. package/dist/VideoPlayerSettings-BIPytm6w.js +0 -61
  220. package/dist/VideoSelectModal-B-Pe34nb.js +0 -100
  221. package/dist/answerDocumentMixin-W7vE1Gp4.js +0 -51
  222. package/dist/formComponentsInstall-Bm3VMOh6.js +0 -2507
  223. package/dist/formValidationMixin-COkY8COk.js +0 -49
  224. package/dist/index-BFvjENMH.js +0 -81
  225. package/dist/index-BV2nGWay.js +0 -492
  226. package/dist/index-BgJ05dYc.js +0 -165
  227. package/dist/index-CMPAXxzs.js +0 -347
  228. package/dist/index-DNDjI5uI.js +0 -3916
  229. package/dist/index-aoff9oUi.js +0 -102
  230. package/dist/mapFormMixin-QbevCwJK.js +0 -72
  231. package/dist/omit-CTp9CXoU.js +0 -31
  232. package/dist/splitpanes-BHUVsCZF.js +0 -382
  233. package/dist/tinycolor-kTl0yxzz.js +0 -633
  234. package/dist/tippy.esm-sS5koDSU.js +0 -1799
  235. package/dist/vuedraggable.umd-BA3ZDRAp.js +0 -3161
  236. package/dist/vuex.esm-DKGl8mcw.js +0 -467
  237. package/public/favicon.ico +0 -0
  238. package/tsconfig.json +0 -26
  239. package/tsconfig.node.json +0 -10
  240. package/tsconfig.paths.json +0 -17
  241. package/vite.config.ts +0 -60
@@ -0,0 +1,98 @@
1
+ import { _ as u, ak as r, al as m, o as i, d, s as n, E as c, am as p, Z as o, v as h, f, S as V, n as y } from "./main-Cb-nyil1.js";
2
+ const S = {
3
+ name: "CSelect",
4
+ mixins: [r, m],
5
+ inheritAttrs: !1,
6
+ props: {
7
+ modelValue: {
8
+ type: [String, Number, Boolean, Object, Array, Function],
9
+ default: null
10
+ },
11
+ placeholder: {
12
+ type: String,
13
+ default: ""
14
+ },
15
+ multiple: Boolean,
16
+ selectClass: {
17
+ type: [String, Object, Array],
18
+ default: ""
19
+ },
20
+ nativeSize: {
21
+ type: [String, Number],
22
+ default: null
23
+ }
24
+ },
25
+ emits: ["blur", "focus", "update:modelValue"],
26
+ data() {
27
+ return {
28
+ selected: this.modelValue,
29
+ _elementRef: "select"
30
+ };
31
+ },
32
+ computed: {
33
+ computedValue: {
34
+ get() {
35
+ return this.selected;
36
+ },
37
+ set(e) {
38
+ this.selected = e, this.$emit("update:modelValue", e), !this.isValid && this.checkHtml5Validity();
39
+ }
40
+ },
41
+ spanClasses() {
42
+ return [
43
+ this.size,
44
+ this.statusType,
45
+ {
46
+ "is-fullwidth": this.expanded,
47
+ "is-loading": this.loading,
48
+ "is-multiple": this.multiple,
49
+ "is-rounded": this.rounded,
50
+ "is-empty": this.selected === null
51
+ }
52
+ ];
53
+ }
54
+ },
55
+ watch: {
56
+ /**
57
+ * When v-model is changed:
58
+ * 1. Set the selected option.
59
+ * 2. If it's invalid, validate again.
60
+ */
61
+ modelValue(e) {
62
+ this.selected = e, !this.isValid && this.checkHtml5Validity();
63
+ }
64
+ }
65
+ }, g = ["multiple", "size"], C = {
66
+ key: 0,
67
+ value: null,
68
+ disabled: "",
69
+ hidden: ""
70
+ };
71
+ function b(e, t, l, k, v, a) {
72
+ return i(), d("div", o({
73
+ class: [{ "is-expanded": e.expanded, "has-icons-left": e.icon }, "control"]
74
+ }, e.rootAttrs), [
75
+ n("span", {
76
+ class: y([a.spanClasses, "select"])
77
+ }, [
78
+ c(n("select", o(e.fallthroughAttrs, {
79
+ ref: "select",
80
+ "onUpdate:modelValue": t[0] || (t[0] = (s) => a.computedValue = s),
81
+ multiple: l.multiple,
82
+ size: l.nativeSize,
83
+ class: l.selectClass,
84
+ onBlur: t[1] || (t[1] = (s) => e.$emit("blur", s) && e.checkHtml5Validity()),
85
+ onFocus: t[2] || (t[2] = (s) => e.$emit("focus", s))
86
+ }), [
87
+ l.placeholder && a.computedValue == null ? (i(), d("option", C, h(l.placeholder), 1)) : f("", !0),
88
+ V(e.$slots, "default", {}, void 0, !0)
89
+ ], 16, g), [
90
+ [p, a.computedValue]
91
+ ])
92
+ ], 2)
93
+ ], 16);
94
+ }
95
+ const B = /* @__PURE__ */ u(S, [["render", b], ["__scopeId", "data-v-097f661c"]]);
96
+ export {
97
+ B as C
98
+ };
@@ -0,0 +1,51 @@
1
+ import { h as b, t as g, i as l, u as C, j as e, o as s, d as n, F as x, k as S, n as i, l as d, f as w } from "./main-Cb-nyil1.js";
2
+ const $ = /* @__PURE__ */ b({
3
+ __name: "CSkeleton",
4
+ props: {
5
+ active: { type: Boolean, default: !0 },
6
+ animated: { type: Boolean, default: !1 },
7
+ width: { default: "" },
8
+ height: { default: "" },
9
+ circle: { type: Boolean, default: !1 },
10
+ rounded: { type: Boolean, default: !0 },
11
+ count: { default: 1 },
12
+ hidden: { type: Boolean, default: !1 },
13
+ color: { default: "" }
14
+ },
15
+ setup(r) {
16
+ const c = r, {
17
+ active: v,
18
+ animated: m,
19
+ width: t,
20
+ height: a,
21
+ circle: f,
22
+ rounded: p,
23
+ count: h,
24
+ hidden: y,
25
+ color: o
26
+ } = g(c), k = l(() => ({
27
+ height: a.value === void 0 ? null : isNaN(Number(a.value)) ? a.value : `${a.value}px`,
28
+ width: t.value === void 0 ? null : isNaN(Number(t.value)) ? t.value : `${t.value}px`,
29
+ borderRadius: f.value ? "50%" : null,
30
+ background: o.value ? o.value : null
31
+ })), u = C(), B = l(() => u.style), N = l(() => u.class);
32
+ return (z, F) => e(v) ? (s(), n("div", {
33
+ key: 0,
34
+ class: i([
35
+ "c-skeleton",
36
+ { "is-animated": e(m), "is-invisible": e(y) },
37
+ N.value
38
+ ]),
39
+ style: d(B.value)
40
+ }, [
41
+ (s(!0), n(x, null, S(e(h), (_) => (s(), n("div", {
42
+ key: _,
43
+ class: i(["c-skeleton-item", { "is-rounded": e(p) }]),
44
+ style: d(k.value)
45
+ }, null, 6))), 128))
46
+ ], 6)) : w("", !0);
47
+ }
48
+ });
49
+ export {
50
+ $ as _
51
+ };
@@ -0,0 +1,532 @@
1
+ import { S as O } from "./SearchApi-B7lXgUY6.js";
2
+ import { _ as B, X as E, ak as F, al as H, b as g, o as d, d as c, e as V, Z as S, af as m, ao as v, w as p, E as $, G as T, s as w, l as C, S as y, f, F as x, k as _, n as A, aj as L, v as h, aF as D, c as b, B as R } from "./main-Cb-nyil1.js";
3
+ import { c as P, r as z, g as N } from "./helpers-CPW--XIz.js";
4
+ const q = {
5
+ name: "CAutocomplete",
6
+ components: {
7
+ CInput: E
8
+ },
9
+ mixins: [F, H],
10
+ props: {
11
+ modelValue: {
12
+ type: [Number, String],
13
+ default: null
14
+ },
15
+ data: {
16
+ type: Array,
17
+ default: () => []
18
+ },
19
+ field: {
20
+ type: String,
21
+ default: "value"
22
+ },
23
+ keepFirst: Boolean,
24
+ clearOnSelect: Boolean,
25
+ openOnFocus: Boolean,
26
+ customFormatter: {
27
+ type: Function,
28
+ default: () => {
29
+ }
30
+ },
31
+ checkInfiniteScroll: Boolean,
32
+ keepOpen: Boolean,
33
+ clearable: Boolean,
34
+ maxHeight: {
35
+ type: [String, Number],
36
+ default: null
37
+ },
38
+ dropdownPosition: {
39
+ type: String,
40
+ default: "auto"
41
+ },
42
+ iconRight: {
43
+ type: String,
44
+ default: null
45
+ },
46
+ iconRightClickable: Boolean,
47
+ appendToBody: Boolean
48
+ },
49
+ emits: [
50
+ "active",
51
+ "blur",
52
+ "focus",
53
+ "icon-click",
54
+ "icon-right-click",
55
+ "infinite-scroll",
56
+ "select",
57
+ "select-footer",
58
+ "select-header",
59
+ "typing",
60
+ "update:modelValue"
61
+ ],
62
+ data() {
63
+ return {
64
+ selected: null,
65
+ hovered: null,
66
+ isActive: !1,
67
+ newValue: this.modelValue,
68
+ newAutocomplete: this.autocomplete || "off",
69
+ isListInViewportVertically: !0,
70
+ hasFocus: !1,
71
+ style: {},
72
+ _isAutocomplete: !0,
73
+ _elementRef: "input",
74
+ _bodyEl: void 0,
75
+ // Used to append to body
76
+ timeOutID: null
77
+ };
78
+ },
79
+ computed: {
80
+ /**
81
+ * White-listed items to not close when clicked.
82
+ * Add input, dropdown and all children.
83
+ */
84
+ whiteList() {
85
+ const e = [];
86
+ if (e.push(this.$refs.input.$el.querySelector("input")), e.push(this.$refs.dropdown), this.$refs.dropdown != null) {
87
+ const t = this.$refs.dropdown.querySelectorAll("*");
88
+ for (const i of t)
89
+ e.push(i);
90
+ }
91
+ if (this.$parent.$data._isTaginput) {
92
+ e.push(this.$parent.$el);
93
+ const t = this.$parent.$el.querySelectorAll("*");
94
+ for (const i of t)
95
+ e.push(i);
96
+ }
97
+ return e;
98
+ },
99
+ /**
100
+ * Check if exists default slot
101
+ */
102
+ hasDefaultSlot() {
103
+ return !!this.$slots.default;
104
+ },
105
+ /**
106
+ * Check if exists "empty" slot
107
+ */
108
+ hasEmptySlot() {
109
+ return !!this.$slots.empty;
110
+ },
111
+ /**
112
+ * Check if exists "header" slot
113
+ */
114
+ hasHeaderSlot() {
115
+ return !!this.$slots.header;
116
+ },
117
+ /**
118
+ * Check if exists "footer" slot
119
+ */
120
+ hasFooterSlot() {
121
+ return !!this.$slots.footer;
122
+ },
123
+ /**
124
+ * Apply dropdownPosition property
125
+ */
126
+ isOpenedTop() {
127
+ return this.dropdownPosition === "top" || this.dropdownPosition === "auto" && !this.isListInViewportVertically;
128
+ },
129
+ newIconRight() {
130
+ return this.clearable && this.newValue ? "close-circle" : this.iconRight;
131
+ },
132
+ newIconRightClickable() {
133
+ return this.clearable ? !0 : this.iconRightClickable;
134
+ },
135
+ contentStyle() {
136
+ return {
137
+ maxHeight: this.maxHeight === void 0 ? null : isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`
138
+ };
139
+ },
140
+ isDropdownOpen() {
141
+ return this.isActive && (this.data.length > 0 || this.hasEmptySlot || this.hasHeaderSlot || this.hasFooterSlot);
142
+ }
143
+ },
144
+ watch: {
145
+ /**
146
+ * When dropdown is toggled, check the visibility to know when
147
+ * to open upwards.
148
+ */
149
+ isActive(e) {
150
+ this.dropdownPosition === "auto" && (e ? this.calcDropdownInViewportVertical() : this.timeOutID = setTimeout(() => {
151
+ this.calcDropdownInViewportVertical();
152
+ }, 100)), this.$nextTick(() => {
153
+ this.$emit("active", e);
154
+ }), e && this.$nextTick(() => this.setHovered(null));
155
+ },
156
+ /**
157
+ * When updating input's value
158
+ * 1. Emit changes
159
+ * 2. If value isn't the same as selected, set null
160
+ * 3. Close dropdown if value is clear or else open it
161
+ */
162
+ newValue(e) {
163
+ this.$emit("update:modelValue", e);
164
+ const t = this.getValue(this.selected);
165
+ t && t !== e && this.setSelected(null, !1), this.hasFocus && (!this.openOnFocus || e) && (this.isActive = !!e);
166
+ },
167
+ /**
168
+ * When v-model is changed:
169
+ * 1. Update internal value.
170
+ * 2. If it's invalid, validate again.
171
+ */
172
+ modelValue(e) {
173
+ this.newValue = e;
174
+ },
175
+ /**
176
+ * Select first option if "keep-first
177
+ */
178
+ data(e) {
179
+ this.keepFirst && this.selectFirstOption(e);
180
+ }
181
+ },
182
+ created() {
183
+ typeof window < "u" && (document.addEventListener("click", this.clickedOutside), this.dropdownPosition === "auto" && window.addEventListener("resize", this.calcDropdownInViewportVertical));
184
+ },
185
+ mounted() {
186
+ if (this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content")) {
187
+ const e = this.$refs.dropdown.querySelector(".dropdown-content");
188
+ e.addEventListener(
189
+ "scroll",
190
+ () => this.checkIfReachedTheEndOfScroll(e)
191
+ );
192
+ }
193
+ this.appendToBody && (this.$data._bodyEl = P(this.$refs.dropdown), this.updateAppendToBody());
194
+ },
195
+ beforeUnmount() {
196
+ typeof window < "u" && (document.removeEventListener("click", this.clickedOutside), this.dropdownPosition === "auto" && window.removeEventListener(
197
+ "resize",
198
+ this.calcDropdownInViewportVertical
199
+ )), this.checkInfiniteScroll && this.$refs.dropdown && this.$refs.dropdown.querySelector(".dropdown-content") && this.$refs.dropdown.querySelector(".dropdown-content").removeEventListener("scroll", this.checkIfReachedTheEndOfScroll), this.appendToBody && z(this.$data._bodyEl), clearTimeout(this.timeOutID);
200
+ },
201
+ methods: {
202
+ /**
203
+ * Set which option is currently hovered.
204
+ */
205
+ setHovered(e) {
206
+ e !== void 0 && (this.hovered = e);
207
+ },
208
+ /**
209
+ * Set which option is currently selected, update v-model,
210
+ * update input value and close dropdown.
211
+ */
212
+ setSelected(e, t = !0) {
213
+ e !== void 0 && (this.selected = e, this.$emit("select", this.selected), this.selected !== null && (this.newValue = this.clearOnSelect ? "" : this.getValue(this.selected), this.setHovered(this.clearOnSelect ? null : this.hovered)), t && this.$nextTick(() => {
214
+ this.isActive = !1;
215
+ }), this.checkValidity());
216
+ },
217
+ /**
218
+ * Select first option
219
+ */
220
+ selectFirstOption(e) {
221
+ this.$nextTick(() => {
222
+ e.length ? (this.openOnFocus || this.newValue !== "" && this.hovered !== e[0]) && this.setHovered(e[0]) : this.setHovered(null);
223
+ });
224
+ },
225
+ /**
226
+ * Enter key listener.
227
+ * Select the hovered option.
228
+ */
229
+ enterPressed(e) {
230
+ this.isDropdownOpen && (e.preventDefault(), this.hovered !== null && this.setSelected(this.hovered, !this.keepOpen));
231
+ },
232
+ /**
233
+ * Tab key listener.
234
+ * Select hovered option if it exists, close dropdown, then allow
235
+ * native handling to move to next tabbable element.
236
+ */
237
+ tabPressed() {
238
+ if (this.hovered === null) {
239
+ this.isActive = !1;
240
+ return;
241
+ }
242
+ this.setSelected(this.hovered, !this.keepOpen);
243
+ },
244
+ /**
245
+ * Close dropdown if clicked outside.
246
+ */
247
+ clickedOutside(e) {
248
+ var i;
249
+ const t = ((i = e.path) == null ? void 0 : i[0]) || e.target;
250
+ this.whiteList.indexOf(t) < 0 && (this.isActive = !1);
251
+ },
252
+ /**
253
+ * Return display text for the input.
254
+ * If object, get value from path, or else just the value.
255
+ */
256
+ getValue(e) {
257
+ if (e !== null)
258
+ return typeof this.customFormatter < "u" ? this.customFormatter(e) : typeof e == "object" ? N(e, this.field) : e;
259
+ },
260
+ /**
261
+ * Check if the scroll list inside the dropdown
262
+ * reached it's end.
263
+ */
264
+ checkIfReachedTheEndOfScroll(e) {
265
+ e.clientHeight !== e.scrollHeight && e.scrollTop + e.clientHeight >= e.scrollHeight && this.$emit("infinite-scroll");
266
+ },
267
+ /**
268
+ * Calculate if the dropdown is vertically visible when activated,
269
+ * otherwise it is openened upwards.
270
+ */
271
+ calcDropdownInViewportVertical() {
272
+ this.$nextTick(() => {
273
+ if (this.$refs.dropdown == null) return;
274
+ const e = this.$refs.dropdown.getBoundingClientRect();
275
+ this.isListInViewportVertically = e.top >= 0 && e.bottom <= (window.innerHeight || document.documentElement.clientHeight), this.appendToBody && this.updateAppendToBody();
276
+ });
277
+ },
278
+ /**
279
+ * Arrows keys listener.
280
+ * If dropdown is active, set hovered option, or else just open.
281
+ */
282
+ keyArrows(e) {
283
+ const t = e === "down" ? 1 : -1;
284
+ if (this.isActive) {
285
+ let i = this.data.indexOf(this.hovered) + t;
286
+ i = i > this.data.length - 1 ? this.data.length : i, i = i < 0 ? 0 : i, this.setHovered(this.data[i]);
287
+ const l = this.$refs.dropdown.querySelector(".dropdown-content"), s = l.querySelectorAll(
288
+ "a.dropdown-item:not(.is-disabled)"
289
+ )[i];
290
+ if (!s) return;
291
+ const o = l.scrollTop, a = l.scrollTop + l.clientHeight - s.clientHeight;
292
+ s.offsetTop < o ? l.scrollTop = s.offsetTop : s.offsetTop >= a && (l.scrollTop = s.offsetTop - l.clientHeight + s.clientHeight);
293
+ } else
294
+ this.isActive = !0;
295
+ },
296
+ /**
297
+ * Focus listener.
298
+ * If value is the same as selected, select all text.
299
+ */
300
+ focused(e) {
301
+ this.getValue(this.selected) === this.newValue && this.$el.querySelector("input").select(), this.openOnFocus && (this.isActive = !0, this.keepFirst && this.selectFirstOption(this.data)), this.hasFocus = !0, this.$emit("focus", e);
302
+ },
303
+ /**
304
+ * Blur listener.
305
+ */
306
+ onBlur(e) {
307
+ this.hasFocus = !1, this.$emit("blur", e);
308
+ },
309
+ onInput() {
310
+ const e = this.getValue(this.selected);
311
+ e && e === this.newValue || (this.$emit("typing", this.newValue), this.checkValidity());
312
+ },
313
+ rightIconClick(e) {
314
+ this.clearable ? this.newValue = "" : this.$emit("icon-right-click", e);
315
+ },
316
+ checkValidity() {
317
+ this.useHtml5Validation && this.$nextTick(() => {
318
+ this.checkHtml5Validity();
319
+ });
320
+ },
321
+ updateAppendToBody() {
322
+ var i, l;
323
+ const e = this.$refs.dropdown, t = (l = (i = this.$parent) == null ? void 0 : i.$data) != null && l._isTaginput ? this.$parent.$el : this.$refs.input.$el;
324
+ if (e && t) {
325
+ const s = this.$data._bodyEl;
326
+ s.classList.forEach((u) => s.classList.remove(u)), s.classList.add("autocomplete"), s.classList.add("control"), this.expandend && s.classList.add("is-expandend");
327
+ const o = t.getBoundingClientRect();
328
+ let a = o.top + window.scrollY;
329
+ const n = o.left + window.scrollX;
330
+ this.isOpenedTop ? a -= e.clientHeight : a += t.clientHeight, this.style = {
331
+ position: "absolute",
332
+ top: `${a}px`,
333
+ left: `${n}px`,
334
+ width: `${t.clientWidth}px`,
335
+ maxWidth: `${t.clientWidth}px`,
336
+ zIndex: "99"
337
+ };
338
+ }
339
+ }
340
+ }
341
+ }, M = {
342
+ key: 0,
343
+ class: "dropdown-item"
344
+ }, K = ["onClick"], Q = { key: 1 }, U = {
345
+ key: 1,
346
+ class: "dropdown-item is-disabled"
347
+ }, W = {
348
+ key: 2,
349
+ class: "dropdown-item"
350
+ };
351
+ function j(e, t, i, l, s, o) {
352
+ const a = g("CInput");
353
+ return d(), c("div", S({
354
+ class: ["autocomplete control", { "is-expanded": e.expanded }]
355
+ }, e.rootAttrs), [
356
+ V(a, S({
357
+ modelValue: s.newValue,
358
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => s.newValue = n),
359
+ ref: "input",
360
+ size: e.size,
361
+ loading: e.loading,
362
+ rounded: e.rounded,
363
+ icon: e.icon,
364
+ "icon-right": o.newIconRight,
365
+ "icon-right-clickable": o.newIconRightClickable,
366
+ "icon-pack": e.iconPack,
367
+ maxlength: e.maxlength,
368
+ autocomplete: s.newAutocomplete,
369
+ "use-html5-validation": !1,
370
+ type: "text"
371
+ }, e.fallthroughAttrs, {
372
+ "onUpdate:modelValue": o.onInput,
373
+ onFocus: o.focused,
374
+ onBlur: o.onBlur,
375
+ onKeyup: t[1] || (t[1] = m(v((n) => s.isActive = !1, ["prevent"]), ["esc"])),
376
+ onKeydown: [
377
+ m(o.tabPressed, ["tab"]),
378
+ m(o.enterPressed, ["enter"]),
379
+ t[2] || (t[2] = m(v((n) => o.keyArrows("up"), ["prevent"]), ["up"])),
380
+ t[3] || (t[3] = m(v((n) => o.keyArrows("down"), ["prevent"]), ["down"]))
381
+ ],
382
+ onIconRightClick: o.rightIconClick,
383
+ onIconClick: t[4] || (t[4] = (n) => e.$emit("icon-click", n))
384
+ }), null, 16, ["modelValue", "size", "loading", "rounded", "icon", "icon-right", "icon-right-clickable", "icon-pack", "maxlength", "autocomplete", "onUpdate:modelValue", "onFocus", "onBlur", "onKeydown", "onIconRightClick"]),
385
+ V(L, { name: "fade" }, {
386
+ default: p(() => [
387
+ $(w("div", {
388
+ ref: "dropdown",
389
+ class: A([{ "is-opened-top": o.isOpenedTop && !i.appendToBody }, "dropdown-menu"]),
390
+ style: C(s.style)
391
+ }, [
392
+ $(w("div", {
393
+ style: C(o.contentStyle),
394
+ class: "dropdown-content"
395
+ }, [
396
+ o.hasHeaderSlot ? (d(), c("div", M, [
397
+ y(e.$slots, "header")
398
+ ])) : f("", !0),
399
+ (d(!0), c(x, null, _(i.data, (n, u) => (d(), c("a", {
400
+ key: u,
401
+ class: A([{ "is-hovered": n === s.hovered }, "dropdown-item"]),
402
+ onClick: (k) => o.setSelected(n, void 0, k)
403
+ }, [
404
+ o.hasDefaultSlot ? y(e.$slots, "default", {
405
+ key: 0,
406
+ option: n,
407
+ index: u
408
+ }) : (d(), c("span", Q, h(o.getValue(n, !0)), 1))
409
+ ], 10, K))), 128)),
410
+ i.data.length === 0 && o.hasEmptySlot ? (d(), c("div", U, [
411
+ y(e.$slots, "empty")
412
+ ])) : f("", !0),
413
+ o.hasFooterSlot ? (d(), c("div", W, [
414
+ y(e.$slots, "footer")
415
+ ])) : f("", !0)
416
+ ], 4), [
417
+ [T, s.isActive]
418
+ ])
419
+ ], 6), [
420
+ [T, o.isDropdownOpen]
421
+ ])
422
+ ]),
423
+ _: 3
424
+ })
425
+ ], 16);
426
+ }
427
+ const X = /* @__PURE__ */ B(q, [["render", j]]), G = {
428
+ i18nOptions: {
429
+ namespaces: "components",
430
+ keyPrefix: "account.documentForm.clients"
431
+ },
432
+ name: "ClientAutocomplete",
433
+ components: {
434
+ SearchApi: O,
435
+ CAutocomplete: X
436
+ },
437
+ props: {
438
+ searchEnabled: {
439
+ type: Boolean,
440
+ default: !0
441
+ },
442
+ showLoading: {
443
+ type: Boolean,
444
+ default: !1
445
+ },
446
+ showEmpty: {
447
+ type: Boolean,
448
+ default: !1
449
+ },
450
+ filled: {
451
+ type: Boolean,
452
+ default: !1
453
+ }
454
+ },
455
+ emits: ["input", "setClient", "add"],
456
+ data() {
457
+ return {
458
+ convertToNewClient: D,
459
+ results: [],
460
+ // results when searching for existing endCustomer
461
+ searchQuery: ""
462
+ // query used to search for endCustomers
463
+ };
464
+ },
465
+ methods: {
466
+ search(e, t) {
467
+ this.$emit("input", t), this.searchEnabled && (this.searchQuery = t, e({
468
+ q: t,
469
+ cb: ({ endCustomer: i }) => {
470
+ this.results = i;
471
+ }
472
+ }));
473
+ }
474
+ }
475
+ }, Y = { style: { "line-height": "1.5" } }, Z = { style: { "font-weight": "500" } }, J = {
476
+ class: "text-gray-600",
477
+ style: { "font-size": "14px" }
478
+ }, ee = { key: 0 }, te = { key: 0 };
479
+ function ie(e, t, i, l, s, o) {
480
+ const a = g("CButton"), n = g("CAutocomplete"), u = g("SearchApi");
481
+ return d(), b(u, { "custom-search": { endCustomer: !0 } }, {
482
+ default: p(({ fetch: k, isLoading: I }) => [
483
+ V(n, S({
484
+ placeholder: e.$t("search.placeholder"),
485
+ ...e.$attrs,
486
+ ...e.$props
487
+ }, {
488
+ data: s.results,
489
+ loading: i.showLoading && I,
490
+ filled: i.filled,
491
+ expanded: "",
492
+ "keep-first": "",
493
+ onTyping: (r) => o.search(k, r),
494
+ onSelect: t[1] || (t[1] = (r) => e.$emit("setClient", s.convertToNewClient(r)))
495
+ }), {
496
+ default: p(({ option: r }) => [
497
+ w("div", Y, [
498
+ w("div", Z, h(r.name || r.email), 1),
499
+ w("div", J, h(r.reference ? `${r.reference} · ` : "") + " " + h(r.workStreet || r.street || " "), 1)
500
+ ])
501
+ ]),
502
+ footer: p(() => [
503
+ i.searchEnabled && i.showEmpty ? (d(), c("div", ee, [
504
+ s.searchQuery && !s.results.length ? (d(), b(a, {
505
+ key: 0,
506
+ type: "secondary",
507
+ pattern: "tertiary",
508
+ size: "small",
509
+ style: { "font-weight": "600" },
510
+ onClick: t[0] || (t[0] = (r) => e.$emit("add"))
511
+ }, {
512
+ default: p(() => [
513
+ R(h(e.$t("_common:add")), 1)
514
+ ]),
515
+ _: 1
516
+ })) : f("", !0)
517
+ ])) : f("", !0)
518
+ ]),
519
+ empty: p(() => [
520
+ i.searchEnabled && i.showEmpty ? (d(), c("div", te, h(e.$t("search.empty")) + " " + h(s.searchQuery), 1)) : f("", !0)
521
+ ]),
522
+ _: 2
523
+ }, 1040, ["data", "loading", "filled", "onTyping"])
524
+ ]),
525
+ _: 1
526
+ });
527
+ }
528
+ const le = /* @__PURE__ */ B(G, [["render", ie]]);
529
+ export {
530
+ le as C,
531
+ X as a
532
+ };