@cling-se/widget 0.14.4 → 0.14.5

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 (134) hide show
  1. package/.eslintrc.cjs +4 -4
  2. package/README.md +40 -40
  3. package/dist/AddClientCallout-BMc-v9rJ.js +46 -0
  4. package/dist/AnswerModal-Cu0Ke5pl.js +3874 -0
  5. package/dist/AttachmentItem-Co8pVvtv.js +78 -0
  6. package/dist/BaseDatePicker-P5iq-XAp.js +3183 -0
  7. package/dist/BaseUpload-BDWnWTxr.js +1977 -0
  8. package/dist/BlockMedia-B_UiePCr.js +76 -0
  9. package/dist/CCallout-Bbp9ya9n.js +59 -0
  10. package/dist/CCurrencyDropdown-Cw39vJWw.js +246 -0
  11. package/dist/CDropdownItem-BjYnhZJr.js +538 -0
  12. package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +1 -0
  13. package/dist/CFormField-CeJ58aN2.js +241 -0
  14. package/dist/CPhoneFormat-BZnmeEeW.js +62 -0
  15. package/dist/CPriceInput-B07d19qq.js +112 -0
  16. package/dist/CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js +1 -0
  17. package/dist/ClientAutocomplete-9iM1pR9l.js +78 -0
  18. package/dist/ClientModal-fw8f6UvL.js +625 -0
  19. package/dist/ColorPicker-uu6vKe8o.js +2879 -0
  20. package/dist/CompanyModal-5t4yhKL4.js +141 -0
  21. package/dist/ContentWrapper-DwcOQ21l.js +183 -0
  22. package/dist/CoverBlockSettings-cCCXzAZ0.js +275 -0
  23. package/dist/DocAnswer-9lbgqHRX.js +36 -0
  24. package/dist/DocDetails-CoLL_tHs.js +246 -0
  25. package/dist/DocForm-DUjcuHJe.js +7273 -0
  26. package/dist/DocFormSend-LawcXcM2.js +143 -0
  27. package/dist/DocLinks-pJT9HpjR.js +38 -0
  28. package/dist/DocModalBase-xUoskL63.js +28 -0
  29. package/dist/DocPrint-ClEJBiAg.js +240 -0
  30. package/dist/DocReceipt-x_YsXPnG.js +210 -0
  31. package/dist/DocSendReminder-Dbz8CkAz.js +137 -0
  32. package/dist/DocTextEditor-AqBE7jZj.js +17181 -0
  33. package/dist/DocTimeline-hq2asPzr.js +481 -0
  34. package/dist/DocumentClient-TmtHqfiw.js +136 -0
  35. package/dist/DocumentLayout-CRAp8mfk.js +4909 -0
  36. package/dist/DocumentLogotype-emSjQ21f.js +87 -0
  37. package/dist/DocumentVoided-BOjiWBK6.js +25 -0
  38. package/dist/EmbedInput-B3LFGEee.js +113 -0
  39. package/dist/EmbedSettings-BYPJTGQf.js +72 -0
  40. package/dist/ErrorCallout-CwgYHBkg.js +28 -0
  41. package/dist/FilePreviewModal-81sSrDGg.js +81 -0
  42. package/dist/Flag-DGFvUTQZ.js +114 -0
  43. package/dist/HeaderSettings-BGpkzcbj.js +392 -0
  44. package/dist/ImageSelectModal-Cimviyuy.js +84 -0
  45. package/dist/ImageUploadWrapper-qJDHCf8T.js +1604 -0
  46. package/dist/Index-18w_qMQH.js +25 -0
  47. package/dist/Index-9_R8_myc.js +77 -0
  48. package/dist/Index-BKoXW7GK.js +84 -0
  49. package/dist/Index-BL3-tRGt.js +642 -0
  50. package/dist/Index-BNfAA-ZJ.js +154 -0
  51. package/dist/Index-BOxSvAug.js +144 -0
  52. package/dist/Index-BQgW1jlH.js +45 -0
  53. package/dist/Index-BXAqgXVi.js +150 -0
  54. package/dist/Index-BgK_WC0d.js +140 -0
  55. package/dist/Index-BkUzlQaQ.js +107 -0
  56. package/dist/Index-BpyYa9LR.js +171 -0
  57. package/dist/Index-ByzGXUoc.js +292 -0
  58. package/dist/Index-C1lsSfnX.js +52 -0
  59. package/dist/Index-C9sq_RDg.js +223 -0
  60. package/dist/Index-CDEh3GAi.js +26 -0
  61. package/dist/Index-CEG-Hiv6.js +69 -0
  62. package/dist/Index-CMUg61_b.js +33 -0
  63. package/dist/Index-CObGPoQv.js +62 -0
  64. package/dist/Index-CPNUsaOS.js +57 -0
  65. package/dist/Index-CegW1Rim.js +98 -0
  66. package/dist/Index-CoSt-Bws.js +31 -0
  67. package/dist/Index-CpDgldnz.js +70 -0
  68. package/dist/Index-CqImx-rG.js +55 -0
  69. package/dist/Index-CrOD4_xj.js +58 -0
  70. package/dist/Index-DBCNVVm5.js +24 -0
  71. package/dist/Index-DGG1S8uJ.js +559 -0
  72. package/dist/Index-DRWS2z82.js +2402 -0
  73. package/dist/Index-DXRgZZNj.js +61 -0
  74. package/dist/Index-DY5gAUnE.js +754 -0
  75. package/dist/Index-Dr7mVlBb.js +49 -0
  76. package/dist/Index-Dx944wv-.js +21 -0
  77. package/dist/Index-Eq3JlTKK.js +46 -0
  78. package/dist/Index-Sr3emNkE.js +25 -0
  79. package/dist/Index-VshOfaom.js +32 -0
  80. package/dist/InputToggleRow-CQsaayf-.js +57 -0
  81. package/dist/ManualPopover-CFXm5cQy.js +58 -0
  82. package/dist/MediaWrapper-Cn0Yr4ce.js +23 -0
  83. package/dist/NotBindingText-CNiszGqn.js +32 -0
  84. package/dist/PackageGroup-BVys9ouj.js +699 -0
  85. package/dist/PdfTerms-Bbns-jMY.js +36 -0
  86. package/dist/PdfViewer-B1zzZU4Y.js +374 -0
  87. package/dist/PlainHtml-CARRbTxi.js +20 -0
  88. package/dist/PriceHeader-CqeC9Lhb.js +339 -0
  89. package/dist/SearchApi-bB9FLxUq.js +161 -0
  90. package/dist/Setup-p3Du_uf8.js +50 -0
  91. package/dist/SmartList-P5ZfTWBb.js +83 -0
  92. package/dist/TermsSettings-CQ8TGwBV.js +102 -0
  93. package/dist/ThemeColorRow-DMWVlFRU.js +67 -0
  94. package/dist/ToggleBinding-BPaYWgqP.js +38 -0
  95. package/dist/UploadModal-9O4HTVZm.js +95 -0
  96. package/dist/VideoPlayerInput-5KybfY7N.js +93 -0
  97. package/dist/VideoPlayerSettings-xSW8tcTZ.js +61 -0
  98. package/dist/VideoSelectModal-BbaNAxGH.js +100 -0
  99. package/dist/anime.es-BrPTThYb.js +858 -0
  100. package/dist/answerDocumentMixin-S-Bmv15G.js +51 -0
  101. package/dist/color-TdtKxwVa.js +19 -0
  102. package/dist/debounce-B_0g8OVh.js +84 -0
  103. package/dist/dom-CJxkno7i.js +91 -0
  104. package/dist/favicon.ico +0 -0
  105. package/dist/focusDrawerMixin-DhsqWZUo.js +22 -0
  106. package/dist/formComponentsInstall-UG7a9vjZ.js +2499 -0
  107. package/dist/formDrawerState-BMQrWaBt.js +20 -0
  108. package/dist/formValidationMixin-DUu0omWT.js +49 -0
  109. package/dist/i18nMessages-Chz_lxGG.js +17 -0
  110. package/dist/index-B3R_uKML.js +347 -0
  111. package/dist/index-B4aiQXsr.js +166 -0
  112. package/dist/index-C50JSDKO.js +3916 -0
  113. package/dist/index-CJ9AvuZH.js +102 -0
  114. package/dist/index-Czyda2Ej.js +492 -0
  115. package/dist/index-myOYAnwV.js +81 -0
  116. package/dist/index.es.js +35 -0
  117. package/dist/index.umd.js +3148 -0
  118. package/dist/main-B9t0ybqW.js +56739 -0
  119. package/dist/mapFormMixin-ETYhBLl2.js +72 -0
  120. package/dist/omit-DtTfKAed.js +31 -0
  121. package/dist/publicSenderState-DD1lN9CR.js +21 -0
  122. package/dist/splitpanes-BHUVsCZF.js +382 -0
  123. package/dist/style.css +4 -0
  124. package/dist/throttle-qziKkJJX.js +18 -0
  125. package/dist/tinycolor-CMC8Xp7x.js +633 -0
  126. package/dist/tippy.esm-DjbYjfS2.js +1799 -0
  127. package/dist/utils-C5Rg0fQC.js +108 -0
  128. package/dist/vuedraggable.umd-CE3WmaEQ.js +3161 -0
  129. package/dist/vuex.esm-DKGl8mcw.js +467 -0
  130. package/package.json +1 -1
  131. package/tsconfig.json +26 -26
  132. package/tsconfig.node.json +10 -10
  133. package/tsconfig.paths.json +17 -17
  134. package/vite.config.ts +61 -61
@@ -0,0 +1,20 @@
1
+ import { V as s } from "./main-B9t0ybqW.js";
2
+ const e = s.observable({
3
+ isFixed: !1,
4
+ // Worded according to CSS property (show as fixed drawer)
5
+ showLeft: !1,
6
+ savedLeftState: !1,
7
+ openSection: null
8
+ });
9
+ e.setLeft = (t) => {
10
+ e.showLeft = !!t, e.savedLeftState = e.showLeft;
11
+ };
12
+ e.toggleLeft = () => {
13
+ e.showLeft = !e.showLeft, e.savedLeftState = e.showLeft;
14
+ };
15
+ e.useSavedLeftState = () => {
16
+ e.showLeft = e.savedLeftState;
17
+ };
18
+ export {
19
+ e as s
20
+ };
@@ -0,0 +1,49 @@
1
+ import { h as n } from "./main-B9t0ybqW.js";
2
+ import { s as l } from "./dom-CJxkno7i.js";
3
+ const s = (r) => {
4
+ var i;
5
+ const t = [];
6
+ return (i = r.$options) != null && i.validations && t.push(r), r.$children && r.$children.forEach((o) => t.push(...s(o))), t;
7
+ }, m = {
8
+ provide() {
9
+ return {
10
+ formValidation: {
11
+ isFormValid: this.isFormValid,
12
+ scrollToInvalidInput: this.scrollToInvalidInput
13
+ }
14
+ };
15
+ },
16
+ data() {
17
+ return {
18
+ _formItems: []
19
+ };
20
+ },
21
+ created() {
22
+ this._formItems = s(this);
23
+ },
24
+ methods: {
25
+ _getInvalidInputs() {
26
+ return this._formItems.filter((r) => {
27
+ var t;
28
+ return (t = r.$v) == null ? void 0 : t.$invalid;
29
+ });
30
+ },
31
+ isFormValid() {
32
+ return this._formItems.every((r) => {
33
+ var t, i;
34
+ return (t = r.$v) == null || t.$touch(), !((i = r.$v) != null && i.$invalid);
35
+ });
36
+ },
37
+ scrollToInvalidInput({ offset: r = 0 } = {}) {
38
+ try {
39
+ const [t] = this._getInvalidInputs();
40
+ t != null && t.$el && l(t.$el, { offset: r });
41
+ } catch (t) {
42
+ n(t);
43
+ }
44
+ }
45
+ }
46
+ };
47
+ export {
48
+ m as f
49
+ };
@@ -0,0 +1,17 @@
1
+ const e = {
2
+ en: {
3
+ name: {
4
+ placeholder: "Document name"
5
+ },
6
+ estimatedTime: "Estimated time"
7
+ },
8
+ sv: {
9
+ name: {
10
+ placeholder: "Namn på dokumentet"
11
+ },
12
+ estimatedTime: "Tidsåtgång"
13
+ }
14
+ };
15
+ export {
16
+ e as i
17
+ };
@@ -0,0 +1,347 @@
1
+ import { w as m } from "./CDropdownItem-BjYnhZJr.js";
2
+ import { n as o, E as f, S as v, g as i, h as l } from "./main-B9t0ybqW.js";
3
+ import { m as h, a as d, b as _ } from "./vuex.esm-DKGl8mcw.js";
4
+ import { B as p } from "./DocTextEditor-AqBE7jZj.js";
5
+ import { v as r } from "./index-Czyda2Ej.js";
6
+ import { S as g } from "./SmartList-P5ZfTWBb.js";
7
+ const x = {
8
+ mixins: [m],
9
+ props: {
10
+ placement: {
11
+ type: String,
12
+ default: "top-start"
13
+ }
14
+ },
15
+ data() {
16
+ return {
17
+ isOpen: !1
18
+ };
19
+ },
20
+ methods: {
21
+ onOpen() {
22
+ this.$emit("open"), this.isOpen = !0;
23
+ },
24
+ onClose() {
25
+ this.$emit("close"), this.isOpen = !1;
26
+ }
27
+ }
28
+ };
29
+ var C = function() {
30
+ var e = this, t = e._self._c;
31
+ return e.mq === "sm" ? t("div", [t("div", { on: { click: e.onOpen } }, [e._t("default")], 2), e.isOpen ? t("portal", { attrs: { to: "modal" } }, [t("div", { staticClass: "modal-overlay", on: { click: function(a) {
32
+ return a.target !== a.currentTarget ? null : e.onClose.apply(null, arguments);
33
+ } } }, [t("div", { staticClass: "modal-container" }, [e._t("popover", null, { close: e.onClose })], 2)])]) : e._e()], 1) : t("v-popover", e._b({ attrs: { open: e.isOpen, placement: e.placement, "popover-class": "reset" }, on: { close: function(a) {
34
+ return e.onClose();
35
+ }, "update:open": function(a) {
36
+ a ? e.onOpen() : e.onClose();
37
+ } } }, "v-popover", e.$props, !1), [e._t("default"), t("div", { staticClass: "popover-container", attrs: { slot: "popover" }, slot: "popover" }, [e.isOpen ? t("portal", { attrs: { to: "modal" } }, [t("div", { staticClass: "overlay" })]) : e._e(), e._t("popover", null, { close: e.onClose })], 2)], 2);
38
+ }, T = [], $ = /* @__PURE__ */ o(
39
+ x,
40
+ C,
41
+ T,
42
+ !1,
43
+ null,
44
+ "da5fd556"
45
+ );
46
+ const S = $.exports, { mapFields: y } = f({
47
+ getterType: "forms/getField",
48
+ mutationType: "forms/updateField"
49
+ }), b = {
50
+ i18nOptions: {
51
+ namespaces: "TextTemplatesForm",
52
+ messages: {
53
+ en: {
54
+ textLabel: "Snippet",
55
+ name: {
56
+ label: "Template Name",
57
+ placeholder: "Name"
58
+ },
59
+ placeholderType: {
60
+ default: "Write here..."
61
+ },
62
+ validations: {
63
+ name: {
64
+ required: "Name is required",
65
+ maxLength: "Maximum length is 256 characters"
66
+ },
67
+ textContent: {
68
+ required: "Add some content"
69
+ }
70
+ }
71
+ },
72
+ sv: {
73
+ textLabel: "Mallens innehåll",
74
+ name: {
75
+ label: "Namn på mallen",
76
+ placeholder: "Mallens namn"
77
+ },
78
+ placeholderType: {
79
+ default: "Skriv här..."
80
+ },
81
+ validations: {
82
+ name: {
83
+ required: "Ge mallen ett namn",
84
+ maxLength: "Får max vara 256 tecken långt"
85
+ },
86
+ textContent: {
87
+ required: "Skriv vad mallen ska innehålla"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ name: "TextTemplatesForm",
94
+ components: {
95
+ BaseTextEditor: p,
96
+ Spinner: v
97
+ },
98
+ props: {
99
+ id: {
100
+ type: [String, Number],
101
+ default: null
102
+ },
103
+ predefinedTextContent: {
104
+ type: String,
105
+ default: null
106
+ },
107
+ onAfterSubmit: {
108
+ type: Function,
109
+ default: null
110
+ },
111
+ showFixedCloseButton: {
112
+ type: Boolean,
113
+ default: !1
114
+ }
115
+ },
116
+ validations: {
117
+ name: {
118
+ required: r.required,
119
+ maxLength: r.maxLength(255)
120
+ },
121
+ textContent: {
122
+ required: r.required
123
+ }
124
+ },
125
+ computed: {
126
+ ...h({
127
+ isPosting: "templateMessages/isPosting",
128
+ isFetching: "templateMessages/isFetching",
129
+ checkFormChanged: "forms/hasChanged"
130
+ }),
131
+ ...y({
132
+ templateMessage: "templateMessage",
133
+ name: "templateMessage.name",
134
+ textContent: "templateMessage.message"
135
+ }),
136
+ messages() {
137
+ return {
138
+ name: {
139
+ required: this.$t("validations.name.required"),
140
+ maxLength: this.$t("validations.name.maxLength")
141
+ },
142
+ textContent: {
143
+ required: this.$t("validations.textContent.required")
144
+ }
145
+ };
146
+ },
147
+ hasChanged() {
148
+ return this.checkFormChanged("templateMessage");
149
+ }
150
+ },
151
+ watch: {
152
+ id() {
153
+ this.load();
154
+ }
155
+ },
156
+ mounted() {
157
+ this.load(), this.predefinedTextContent && (this.textContent = this.predefinedTextContent);
158
+ },
159
+ methods: {
160
+ ...d({
161
+ loadTemplate: i.LOAD_TEMPLATE_MESSAGE,
162
+ deleteTemplate: i.DELETE_TEMPLATE_MESSAGE,
163
+ formNewTemplate: i.FORM_NEW_TEMPLATE_MESSAGE,
164
+ formEditTemplate: i.FORM_EDIT_TEMPLATE_MESSAGE,
165
+ formSubmitTemplate: i.FORM_SUBMIT_TEMPLATE_MESSAGE
166
+ }),
167
+ canLeave() {
168
+ return !this.hasChanged;
169
+ },
170
+ async load() {
171
+ try {
172
+ this.id ? (await this.loadTemplate({
173
+ id: this.id
174
+ }), await this.formEditTemplate({
175
+ id: this.id
176
+ })) : await this.formNewTemplate();
177
+ } catch (s) {
178
+ l(s);
179
+ }
180
+ },
181
+ validateBeforeSubmit() {
182
+ return this.$v.$touch(), this.$v.$invalid ? !1 : this.submit();
183
+ },
184
+ async submit() {
185
+ if (this.hasChanged)
186
+ try {
187
+ await this.formSubmitTemplate(), typeof this.onAfterSubmit == "function" && this.onAfterSubmit();
188
+ } catch (s) {
189
+ l(s);
190
+ }
191
+ },
192
+ async remove() {
193
+ try {
194
+ await this.deleteTemplate({ id: this.id }), typeof this.onAfterSubmit == "function" && this.onAfterSubmit();
195
+ } catch (s) {
196
+ l(s);
197
+ }
198
+ }
199
+ }
200
+ };
201
+ var M = function() {
202
+ var e = this, t = e._self._c;
203
+ return t("div", { staticStyle: { position: "relative" } }, [e.showFixedCloseButton ? t("CButton", { staticClass: "fixed-close-button", attrs: { circle: "", icon: "x" }, on: { click: function(a) {
204
+ return e.$emit("close");
205
+ } } }) : e._e(), e.isFetching ? t("div", { staticClass: "flex w-full items-center justify-center", staticStyle: { padding: "calc(3 * var(--rem)) 0" } }, [t("Spinner")], 1) : e.templateMessage !== void 0 ? t("form", [t("CField", { attrs: { validator: e.$v.name, messages: e.messages.name, label: e.$t("name.label") } }, [t("CInput", { attrs: { placeholder: e.$t("name.placeholder") }, on: { blur: function(a) {
206
+ return e.$v.name.$touch();
207
+ } }, model: { value: e.name, callback: function(a) {
208
+ e.name = a;
209
+ }, expression: "name" } })], 1), t("CField", { attrs: { validator: e.$v.textContent, messages: e.messages.textContent, label: e.$t("textLabel") } }, [t("BaseTextEditor", { attrs: { placeholder: e.$t("placeholderType.default"), "class-list": "large" }, on: { blur: function(a) {
210
+ return e.$v.textContent.$touch();
211
+ } }, model: { value: e.textContent, callback: function(a) {
212
+ e.textContent = a;
213
+ }, expression: "textContent" } })], 1), t("CButton", { staticStyle: { "margin-top": "calc(1 * var(--rem))" }, attrs: { loading: e.isPosting, disabled: !e.hasChanged, type: "secondary", icon: "save", wide: "" }, on: { click: function(a) {
214
+ return e.validateBeforeSubmit();
215
+ } } }, [e._v(" " + e._s(e.$t("_common:save")) + " ")]), e.id ? t("CButton", { staticStyle: { "margin-top": "calc(1 * var(--rem))" }, attrs: { loading: e.isPosting, type: "secondary", pattern: "tertiary", wide: "" }, on: { click: function(a) {
216
+ return e.remove();
217
+ } } }, [e._v(" " + e._s(e.$t("_common:remove")) + " ")]) : e._e()], 1) : e._e()], 1);
218
+ }, E = [], w = /* @__PURE__ */ o(
219
+ b,
220
+ M,
221
+ E,
222
+ !1,
223
+ null,
224
+ "e14860e7"
225
+ );
226
+ const F = w.exports, k = {
227
+ name: "TextTemplatesModal",
228
+ components: {
229
+ SmartList: g,
230
+ BaseTextEditor: p
231
+ },
232
+ mixins: [m],
233
+ data() {
234
+ return {
235
+ selectedIndex: 0,
236
+ query: ""
237
+ };
238
+ },
239
+ computed: {
240
+ ..._("templateMessages", {
241
+ templateMessages: (s) => s.data
242
+ }),
243
+ templates() {
244
+ return Object.values(this.templateMessages);
245
+ }
246
+ },
247
+ methods: {
248
+ onSelect(s) {
249
+ this.$emit("select", s), this.close();
250
+ },
251
+ close() {
252
+ this.$emit("close");
253
+ },
254
+ openCreateModal() {
255
+ this.close(), this.$modal.show(
256
+ F,
257
+ {
258
+ predefinedTextContent: "",
259
+ showFixedCloseButton: !0,
260
+ onAfterSubmit: () => this.$modal.hide("saveTemplateModal")
261
+ },
262
+ {
263
+ name: "saveTemplateModal",
264
+ delay: 100,
265
+ adaptive: !0,
266
+ height: "auto",
267
+ width: "90%",
268
+ maxWidth: 500,
269
+ scrollable: !0,
270
+ classes: "overflow-visible default"
271
+ }
272
+ );
273
+ }
274
+ }
275
+ };
276
+ var q = function() {
277
+ var e = this, t = e._self._c;
278
+ return t("SmartList", { attrs: { items: e.templates, "sort-key": "position", query: e.query }, scopedSlots: e._u([{ key: "default", fn: function({ items: a }) {
279
+ return [t("div", { ref: "modal-container", staticClass: "font-inter t-modal" }, [t("div", { staticClass: "t-nav" }, [t("CInput", { ref: "searchInput", staticClass: "search-input focus:text-gray-500", attrs: { placeholder: e.$t("search"), icon: "search" }, on: { input: function(n) {
280
+ e.selectedIndex = 0;
281
+ } }, model: { value: e.query, callback: function(n) {
282
+ e.query = n;
283
+ }, expression: "query" } })], 1), t("div", { staticClass: "t-main" }, [t("div", { staticClass: "t-list" }, e._l(a, function(n, c) {
284
+ return t("div", { key: n.id, staticClass: "t-list-item truncate-text", class: { selected: c === e.selectedIndex }, on: { "&mouseover": function(u) {
285
+ e.selectedIndex = c;
286
+ }, click: function(u) {
287
+ return e.onSelect(a[e.selectedIndex].message || "");
288
+ } } }, [e._v(" " + e._s(n.name) + " ")]);
289
+ }), 0), e.mq !== "sm" ? t("div", { staticClass: "t-text quill-format" }, [a[e.selectedIndex] ? t("BaseTextEditor", { attrs: { value: a[e.selectedIndex].message || "", editable: !1, extensions: "all", "class-list": "document-form", unstyled: "" } }) : t("div", [e._v(" " + e._s(e.$t("noResults")) + " ")])], 1) : e._e()]), t("div", { staticClass: "t-footer flex w-full items-center justify-between" }, [t("div", { staticStyle: { display: "inline-flex", "align-items": "center" } }), t("div", [t("CButton", { staticClass: "t-footer-button", attrs: { to: { name: "settingsTemplates" }, target: "_blank", size: "small" } }, [e._v(" " + e._s(e.$t("handle")) + " "), t("CIcon", { staticStyle: { "margin-left": "0.5em" }, attrs: { type: "new-window", size: "16" } })], 1), t("CButton", { staticClass: "t-footer-button", attrs: { size: "small" }, on: { click: e.openCreateModal } }, [e._v(" " + e._s(e.$t("create", { thing: e.$t("template") })) + " ")])], 1)])])];
290
+ } }]) });
291
+ }, A = [], L = /* @__PURE__ */ o(
292
+ k,
293
+ q,
294
+ A,
295
+ !1,
296
+ null,
297
+ "9d6f8cd8"
298
+ );
299
+ const B = L.exports, O = {
300
+ name: "TextTemplates",
301
+ components: {
302
+ ContextModal: S,
303
+ TextTemplatesModal: B
304
+ },
305
+ inject: {
306
+ viewSettings: {
307
+ default: () => ({ isPublicForm: !1 })
308
+ }
309
+ },
310
+ props: {
311
+ placement: {
312
+ type: String,
313
+ default: "left"
314
+ }
315
+ },
316
+ created() {
317
+ this.viewSettings.isPublicForm || this.loadTemplateMessages();
318
+ },
319
+ methods: {
320
+ ...d({
321
+ loadTemplateMessages: i.LOAD_TEMPLATE_MESSAGES
322
+ })
323
+ }
324
+ };
325
+ var I = function() {
326
+ var e = this, t = e._self._c;
327
+ return e.viewSettings.isPublicForm ? e._e() : t("div", { staticClass: "t-list" }, [t("ContextModal", { attrs: { "break-point": 1e3, placement: e.placement }, on: { open: function(a) {
328
+ return e.$emit("open");
329
+ }, close: function(a) {
330
+ return e.$emit("close");
331
+ } }, scopedSlots: e._u([{ key: "popover", fn: function({ close: a }) {
332
+ return [t("TextTemplatesModal", { on: { close: a, select: function(n) {
333
+ return e.$emit("select", n);
334
+ } } })];
335
+ } }], null, !1, 1240188552) }, [t("div", { staticClass: "t-option main" }, [e._t("default")], 2)])], 1);
336
+ }, P = [], G = /* @__PURE__ */ o(
337
+ O,
338
+ I,
339
+ P,
340
+ !1,
341
+ null,
342
+ null
343
+ );
344
+ const H = G.exports;
345
+ export {
346
+ H as default
347
+ };
@@ -0,0 +1,166 @@
1
+ import { s as n, F as o } from "./Flag-DGFvUTQZ.js";
2
+ import { w as c } from "./CDropdownItem-BjYnhZJr.js";
3
+ import { n as a } from "./main-B9t0ybqW.js";
4
+ import { i as d } from "./dom-CJxkno7i.js";
5
+ import { d as u } from "./debounce-B_0g8OVh.js";
6
+ import { t as m } from "./throttle-qziKkJJX.js";
7
+ const f = {
8
+ name: "BackgroundsModalList",
9
+ i18nOptions: {
10
+ namespaces: "backgroundsModalList",
11
+ messages: {
12
+ en: {
13
+ searchPlaceholder: "Search",
14
+ noMoreResults: "No more results"
15
+ },
16
+ sv: {
17
+ searchPlaceholder: "Sök efter en bild på engelska",
18
+ noMoreResults: "Inga fler resultat"
19
+ }
20
+ }
21
+ },
22
+ components: {
23
+ simplebar: n,
24
+ Flag: o
25
+ },
26
+ mixins: [c],
27
+ props: {
28
+ /**
29
+ * @param {Object} options Input arguments
30
+ * @param {String} options.query Search/Query string
31
+ * @param {Number} options.page Current page number
32
+ *
33
+ * @returns {Object} containing:
34
+ * items {Array}
35
+ - item {Object}
36
+ - item.image {String} Url of image resource (REQUIRED)
37
+ - item.video {String} Url of video resource (OPTIONAL)
38
+ - item.lowQualityVideo {String} preview url of video file (OPTIONAL)
39
+ * total {Number} Number of results
40
+ */
41
+ fetch: {
42
+ type: Function,
43
+ required: !0
44
+ },
45
+ defaultQuery: {
46
+ type: String,
47
+ required: !0
48
+ },
49
+ creditText: {
50
+ type: String,
51
+ default: ""
52
+ }
53
+ },
54
+ data() {
55
+ return {
56
+ hoverIndex: null,
57
+ query: null,
58
+ items: [],
59
+ page: 1,
60
+ isLoading: !1,
61
+ allowMoreResults: !0,
62
+ searchTimeout: null,
63
+ selectedIndex: null,
64
+ selectedUrl: null,
65
+ noOfResults: null
66
+ };
67
+ },
68
+ watch: {
69
+ query() {
70
+ this.page = 0, this.items = [], this.allowMoreResults = !0, this.isLoading = !1, this.debouncedHandleFetch();
71
+ }
72
+ },
73
+ created() {
74
+ this.handleFetch(), this.debouncedHandleFetch = u(this.handleFetch, 1e3);
75
+ },
76
+ mounted() {
77
+ this.$refs.scrollbar.scrollElement.addEventListener(
78
+ "scroll",
79
+ this.scrollHandler,
80
+ { passive: !0 }
81
+ );
82
+ },
83
+ beforeDestroy() {
84
+ this.$refs.scrollbar.scrollElement.removeEventListener(
85
+ "scroll",
86
+ this.scrollHandler,
87
+ { passive: !0 }
88
+ );
89
+ },
90
+ methods: {
91
+ async handleFetch() {
92
+ if (!this.allowMoreResults || this.isLoading)
93
+ return;
94
+ this.isLoading = !0;
95
+ const i = this.query ? this.query : this.defaultQuery, { items: e, total: t } = await this.fetch({ query: i, page: this.page++ });
96
+ this.isLoading = !1, this.noOfResults = this.query ? t : null, this.items == null ? (this.selectedIndex = null, this.items = e) : this.items = [...this.items, ...e], this.allowMoreResults = t >= this.page * 12;
97
+ },
98
+ scrollHandler: m(async function() {
99
+ const e = this.$refs.item[this.$refs.item.length - 9 || 0];
100
+ e && d(e) && this.handleFetch();
101
+ }, 50),
102
+ selectItem(i, e) {
103
+ this.selectedIndex = e, this.$emit("select", i);
104
+ },
105
+ onSave() {
106
+ this.$emit("save");
107
+ },
108
+ playVideo(i) {
109
+ this.$refs.video[i] && this.$refs.video[i].play();
110
+ },
111
+ pauseVideo(i) {
112
+ const e = this.$refs.video[i];
113
+ e && (e.readyState === 4 ? e.pause() : e.addEventListener("playing", () => e.pause(), { once: !0 }));
114
+ }
115
+ }
116
+ };
117
+ var h = function() {
118
+ var e = this, t = e._self._c;
119
+ return t("div", { staticStyle: { "min-height": "0", display: "flex", "flex-direction": "column", height: "100%" } }, [t("div", { staticClass: "relative flex w-full shrink-0 py-1" }, [t("CInput", { staticClass: "flex-grow", staticStyle: { "border-bottom": "1px solid hsl(0, 0%, 92%)" }, attrs: { placeholder: e.$t("searchPlaceholder"), reset: !0, icon: "search", size: "medium" }, model: { value: e.query, callback: function(s) {
120
+ e.query = s;
121
+ }, expression: "query" } })], 1), t("div", { staticStyle: { overflow: "hidden", flex: "1", height: "100%" } }, [t("simplebar", { ref: "scrollbar", staticStyle: { width: "100%", height: "100%", padding: "3px 4px" } }, [t("div", { staticStyle: { display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(210px, 1fr))", gap: "2px" } }, [!e.items.length && e.isLoading ? e._l(12, function(s) {
122
+ return t("div", { key: s, ref: "item", refInFor: !0, staticClass: "photo" });
123
+ }) : e._e(), e._l(e.items, function(s, l) {
124
+ return t("div", { key: l, ref: "item", refInFor: !0, staticClass: "photo", style: { backgroundImage: `url(${s.minImage})` }, on: { click: function(r) {
125
+ return e.selectItem(s, l);
126
+ } } }, [s.minVideo || s.video ? t("div", { staticClass: "video-bg__media", on: { "&mouseenter": function(r) {
127
+ return e.playVideo(l, s.minVideo || s.video);
128
+ }, "&mouseleave": function(r) {
129
+ return e.pauseVideo(l);
130
+ } } }, [t("video", { ref: "video", refInFor: !0, attrs: { src: s.minVideo || s.video, loop: "", muted: "", playsInline: "", preload: "none" }, domProps: { muted: !0 } })]) : e._e(), e.selectedIndex === l ? t("div", { staticClass: "select-wrapper" }) : e._e(), t("div", { staticClass: "photo__credit" }, [e._v(e._s(s.userName))])]);
131
+ })], 2), t("div", { staticClass: "flex w-full items-center justify-center", staticStyle: { padding: "2em 1em" } }, [e.isLoading ? t("CIcon", { staticClass: "rotateSpin", attrs: { type: "loader" } }) : e.allowMoreResults ? e._e() : t("div", { staticClass: "flex w-full flex-col items-center justify-center text-gray-400" }, [t("div", [e._v(" " + e._s(e.$t("noMoreResults")) + " ")]), e.$i18n.lang !== "en" ? t("div", { staticClass: "flex flex-col items-center text-center", staticStyle: { "padding-top": "3.2rem" } }, [t("Flag", { staticClass: "mb-1 h-8 w-8", attrs: { region: "GB" } }), e._v(" Glöm inte att sökordet måste vara på engelska ")], 1) : e._e()])], 1)])], 1), t("div", { staticClass: "flex w-full items-center justify-end", staticStyle: { padding: "4px 4px 4px 8px", "flex-shrink": "0" } }, [t("div", { staticClass: "flex-grow text-gray-400" }, [e.mq !== "sm" ? [e.query && e.noOfResults && e.noOfResults > 0 ? t("div", [e._v(" " + e._s(e.$tc("_common:result", { count: e.noOfResults })) + " ")]) : e._e(), t("div", [e._v(" " + e._s(e.creditText) + " ")])] : e._e()], 2), e._t("footer", function() {
132
+ return [t("CButton", { staticStyle: { "margin-left": "0.5em" }, attrs: { type: "secondary" }, on: { click: e.onSave } }, [e._v(" " + e._s(e.$t("_common:save")) + " ")])];
133
+ })], 2)]);
134
+ }, p = [], v = /* @__PURE__ */ a(
135
+ f,
136
+ h,
137
+ p,
138
+ !1,
139
+ null,
140
+ "70d28101"
141
+ );
142
+ const g = v.exports, _ = {
143
+ name: "BackgroundsModal"
144
+ };
145
+ var y = function() {
146
+ var e = this, t = e._self._c;
147
+ return t("div", { staticClass: "font-primary fixed inset-0 z-[1000] flex items-center justify-center overflow-auto bg-black bg-opacity-10 max-sm:block max-sm:min-h-full max-sm:w-full max-sm:overflow-auto", on: { click: function(s) {
148
+ return s.target !== s.currentTarget ? null : e.$emit("close");
149
+ } } }, [t("div", { staticClass: "relative flex h-[90%] max-h-[700px] w-[90%] max-w-3xl flex-col rounded-lg bg-white max-sm:h-full max-sm:max-h-full max-sm:w-full max-sm:rounded-none", on: { click: function(s) {
150
+ s.stopPropagation();
151
+ } } }, [t("CButton", { staticClass: "absolute right-3 top-3 z-10", attrs: { pattern: "tertiary", type: "none", size: "small", circle: "", icon: "x" }, on: { click: function(s) {
152
+ return e.$emit("close");
153
+ } } }), e._t("header"), e._t("default")], 2)]);
154
+ }, x = [], w = /* @__PURE__ */ a(
155
+ _,
156
+ y,
157
+ x,
158
+ !1,
159
+ null,
160
+ "4a6a378b"
161
+ );
162
+ const b = w.exports, R = g, L = b;
163
+ export {
164
+ L as B,
165
+ R as a
166
+ };