@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,392 @@
1
+ import { m as x } from "./mapFormMixin-ETYhBLl2.js";
2
+ import { T as w } from "./ThemeColorRow-DMWVlFRU.js";
3
+ import C from "./VideoPlayerInput-5KybfY7N.js";
4
+ import _ from "./ImageUploadWrapper-qJDHCf8T.js";
5
+ import { B as k, a as b } from "./index-B4aiQXsr.js";
6
+ import { c as v, n as y, o as d, H as S } from "./main-B9t0ybqW.js";
7
+ import { t as A } from "./tinycolor-CMC8Xp7x.js";
8
+ const g = v.unsplash.id, L = v.pexels.id, z = {
9
+ name: "MediaSelectModal",
10
+ i18nOptions: {
11
+ namespaces: "mediaSelectModal",
12
+ messages: {
13
+ en: {
14
+ title: "Choose background",
15
+ creditVideos: "Videos from {{thing}}",
16
+ tabLink: "Use link",
17
+ minWidth: "Recommended minimum image width is 1200 pixels or greater."
18
+ },
19
+ sv: {
20
+ title: "Välj bakgrundsbild",
21
+ creditVideos: "Videor från {{thing}}",
22
+ tabLink: "Egen länk",
23
+ minWidth: "Rekommenderad minimum bredd på bilden är 1200 pixlar eller större."
24
+ }
25
+ }
26
+ },
27
+ components: {
28
+ BackgroundModal: k,
29
+ BackgroundList: b,
30
+ VideoPlayerInput: C,
31
+ ImageUploadWrapper: _
32
+ },
33
+ props: {
34
+ currentType: {
35
+ type: String,
36
+ default: ""
37
+ }
38
+ },
39
+ data() {
40
+ return {
41
+ tabs: [
42
+ {
43
+ value: "unsplash",
44
+ label: "Unsplash",
45
+ icon: '<svg style="margin-right: calc(0.5 * var(--rem));" width="20" height="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z"/></svg>'
46
+ },
47
+ {
48
+ value: "customImage",
49
+ label: this.$t("_common:upload"),
50
+ icon: '<svg style="margin-right: calc(0.5 * var(--rem));" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M20.4 14.5L16 10 4 20"/></svg>'
51
+ },
52
+ {
53
+ value: "pexels",
54
+ label: "Pexels",
55
+ icon: '<svg style="margin-right: calc(0.5 * var(--rem));" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 32 32"><path d="M2 0h28a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2z" fill="#05A081"></path><path d="M13 21h3.863v-3.752h1.167a3.124 3.124 0 1 0 0-6.248H13v10zm5.863 2H11V9h7.03a5.124 5.124 0 0 1 .833 10.18V23z" fill="#fff"></path></svg>'
56
+ },
57
+ {
58
+ value: "customVideo",
59
+ label: this.$t("tabLink"),
60
+ icon: '<svg style="margin-right: calc(0.5 * var(--rem));" width="28" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" xml:space="preserve" viewBox="0 0 71.412 50"><g transform="scale(.58824)"><path d="M118.9 13.3c-1.4-5.2-5.5-9.3-10.7-10.7C98.7 0 60.7 0 60.7 0s-38 0-47.5 2.5C8.1 3.9 3.9 8.1 2.5 13.3 0 22.8 0 42.5 0 42.5s0 19.8 2.5 29.2C3.9 76.9 8 81 13.2 82.4 22.8 85 60.7 85 60.7 85s38 0 47.5-2.5c5.2-1.4 9.3-5.5 10.7-10.7 2.5-9.5 2.5-29.2 2.5-29.2s.1-19.8-2.5-29.3z" fill="red" fill-opacity="1"/><path fill="#fff" d="M80.2 42.5L48.6 24.3v36.4z"/></g></svg>'
61
+ }
62
+ ],
63
+ activeTab: "unsplash",
64
+ selectedImage: null,
65
+ preferredColor: null,
66
+ customImage: null,
67
+ selectedVideo: null,
68
+ customVideo: null
69
+ };
70
+ },
71
+ computed: {
72
+ isImage() {
73
+ return ["unsplash", "customImage"].includes(this.activeTab);
74
+ }
75
+ },
76
+ created() {
77
+ this.currentType === "video" && (this.activeTab = "pexels");
78
+ },
79
+ methods: {
80
+ async fetchImage({ query: i, page: t }) {
81
+ const { data: e } = await d.get(
82
+ "https://api.unsplash.com/search/photos",
83
+ {
84
+ params: {
85
+ page: t,
86
+ per_page: 12,
87
+ client_id: g,
88
+ query: i
89
+ }
90
+ }
91
+ );
92
+ return {
93
+ items: (e.results || []).map((o) => ({
94
+ ...o,
95
+ image: o.urls.regular,
96
+ minImage: o.urls.thumb
97
+ })),
98
+ total: e.total
99
+ };
100
+ },
101
+ async fetchVideo({ query: i, page: t }) {
102
+ const { data: e } = await d.get("https://api.pexels.com/videos/search", {
103
+ headers: {
104
+ Authorization: L
105
+ },
106
+ params: {
107
+ page: t,
108
+ per_page: 12,
109
+ query: i
110
+ }
111
+ }), o = (s, a) => s.height < a.height || s.width < a.width ? -1 : 1, r = (s) => (s.find(({ height: a }) => a > 1e3 && a < 1200) || {}).link;
112
+ return {
113
+ items: (e.videos || []).map(
114
+ ({ id: s, image: a, video_files: u = [], user: m }) => {
115
+ const { sd: h, hd: p } = (u || []).sort(o).reduce(
116
+ (n, l) => (n[l.quality] && l.link && n[l.quality].push(l.link), n),
117
+ { sd: [], hd: [] }
118
+ ), [f] = h;
119
+ let c = r(u);
120
+ return c || ([c] = p.length ? p : h.slice(-1)), {
121
+ id: `${s}`,
122
+ image: a,
123
+ minImage: a,
124
+ video: c,
125
+ minVideo: f,
126
+ userName: m.name,
127
+ userLink: m.link
128
+ };
129
+ }
130
+ ),
131
+ total: e.total_results
132
+ };
133
+ },
134
+ selectImage({ image: i, links: t, color: e }) {
135
+ this.selectedImage = S(i, { w: 1800 }), e && (this.preferredColor = e);
136
+ const o = new Image();
137
+ o.src = this.selectedImage, d.get(t.download_location, {
138
+ params: {
139
+ client_id: g
140
+ }
141
+ });
142
+ },
143
+ setCustomBackground({ response: i }) {
144
+ this.customImage = i.url;
145
+ },
146
+ selectVideo({ id: i, image: t, video: e }) {
147
+ this.selectedVideo = {
148
+ id: i,
149
+ url: e,
150
+ thumbnail: t,
151
+ provider: "pexels"
152
+ };
153
+ },
154
+ onSave() {
155
+ let i;
156
+ this.isImage ? i = {
157
+ type: "image",
158
+ value: this.activeTab === "unsplash" ? this.selectedImage : this.customImage
159
+ } : i = {
160
+ type: "video",
161
+ value: this.activeTab === "pexels" ? this.selectedVideo : this.customVideo
162
+ }, this.preferredColor && (i.preferredColor = this.preferredColor), this.$emit("input", i), this.$parent && this.$parent.$emit("input", i), this.$emit("close");
163
+ }
164
+ }
165
+ };
166
+ var I = function() {
167
+ var t = this, e = t._self._c;
168
+ return e("BackgroundModal", t._g({}, t.$listeners), [e("div", { staticClass: "flex w-full items-center justify-center", staticStyle: { padding: "calc(0.25 * var(--rem)) calc(1 * var(--rem))", "border-bottom": "1px solid hsl(0, 0%, 88%)" }, attrs: { slot: "header" }, slot: "header" }, t._l(t.tabs, function(o, r) {
169
+ return e("CButton", { key: r, staticStyle: { "font-size": "15px", "font-weight": "700", opacity: "0.5", "box-shadow": "none" }, style: t.activeTab === o.value && { opacity: 1 }, on: { click: function(s) {
170
+ t.activeTab = o.value;
171
+ } } }, [e("span", { staticClass: "inline-flex items-center justify-center" }, [e("div", { domProps: { innerHTML: t._s(o.icon) } }), e("span", { staticClass: "max-md:!hidden" }, [t._v(t._s(o.label))])])]);
172
+ }), 1), ["unsplash", "pexels"].includes(t.activeTab) ? e("BackgroundList", { key: t.activeTab, attrs: { fetch: t.isImage ? t.fetchImage : t.fetchVideo, "credit-text": t.$t("creditVideos", { thing: t.activeTab.capitalize() }), "default-query": "nature" }, on: { select: function(o) {
173
+ t.isImage ? t.selectImage(o) : t.selectVideo(o);
174
+ } } }, [e("CButton", { staticStyle: { "margin-left": "0.5em" }, attrs: { slot: "footer", disabled: t.isImage ? !t.selectedImage : !t.selectedVideo, type: "secondary" }, on: { click: t.onSave }, slot: "footer" }, [t._v(" " + t._s(t.$t("_common:save")) + " ")])], 1) : t.activeTab === "customVideo" ? e("div", { staticClass: "flex w-full flex-col items-center justify-center" }, [e("div", { staticStyle: { "max-width": "500px", width: "100%", margin: "0 auto", "padding-top": "calc(3 * var(--rem))" } }, [e("div", { staticStyle: { position: "relative", width: "100%", "padding-top": "56.25%", "background-color": "hsl(var(--gray-color-100) / 1)", "border-radius": "0.5em", "margin-bottom": "calc(1.5 * var(--rem))" } }, [t.customVideo ? e("iframe", { staticClass: "custom-video-preview", attrs: { src: t.customVideo.url } }) : t._e()]), e("VideoPlayerInput", { attrs: { filled: !0, "video-options": { background: !0 } }, model: { value: t.customVideo, callback: function(o) {
175
+ t.customVideo = o;
176
+ }, expression: "customVideo" } }, [e("CButton", { attrs: { disabled: !t.customVideo, type: "secondary" }, on: { click: t.onSave } }, [t._v(" " + t._s(t.$t("_common:save")) + " ")])], 1)], 1)]) : e("div", { staticClass: "flex flex-col items-center justify-center" }, [e("div", { staticStyle: { "max-width": "500px", width: "100%", margin: "0 auto", "padding-top": "calc(3 * var(--rem))" } }, [e("ImageUploadWrapper", { ref: "uploadWrapper", attrs: { "on-image-upload": t.setCustomBackground }, scopedSlots: t._u([{ key: "default", fn: function({ progress: o }) {
177
+ return [e("div", { staticClass: "relative mb-6 w-full" }, [t.customImage ? e("img", { staticClass: "h-full w-full object-cover object-scale-down object-top", staticStyle: { "max-height": "500px" }, attrs: { src: t.customImage, alt: t.customImage } }) : e("div", { staticClass: "flex aspect-video flex-col items-center justify-center rounded-md bg-gray-100" }, [e("CButton", { style: t.customImage && { opacity: 0.5 }, attrs: { loading: !!o && o < 100, "icon-left": "upload", type: "none" } }, [t._v(" " + t._s(t.$t("_common:upload")) + " ")]), e("div", { staticClass: "text-center text-gray-600", staticStyle: { "padding-top": "calc(1 * var(--rem))", "font-size": "14px", "max-width": "40ch" } }, [t._v(" " + t._s(t.$t("minWidth")) + " ")])], 1)])];
178
+ } }]) }), e("div", { staticClass: "flex items-center justify-center" }, [e("CButton", { attrs: { disabled: !t.customImage, type: "secondary" }, on: { click: t.onSave } }, [t._v(" " + t._s(t.$t("_common:save")) + " ")])], 1)], 1)])], 1);
179
+ }, V = [], M = /* @__PURE__ */ y(
180
+ z,
181
+ I,
182
+ V,
183
+ !1,
184
+ null,
185
+ "459dc015"
186
+ );
187
+ const T = M.exports, $ = {
188
+ name: "HeaderSettings",
189
+ components: {
190
+ ThemeColorRow: w
191
+ },
192
+ mixins: [
193
+ x(
194
+ [
195
+ "layout",
196
+ "items",
197
+ "media",
198
+ "showPriceSummary",
199
+ "backgroundColor",
200
+ "textAlign",
201
+ "textColor"
202
+ ],
203
+ { useEmit: !1 }
204
+ )
205
+ ],
206
+ data() {
207
+ return {
208
+ type: "image",
209
+ layoutOptions2: [
210
+ {
211
+ value: "left",
212
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="6" width="8" height="14" rx="1" fill="currentColor"></rect>'
213
+ },
214
+ {
215
+ value: "right",
216
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="13" y="6" width="8" height="14" rx="1" fill="currentColor"></rect>'
217
+ },
218
+ {
219
+ value: "top",
220
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="6" width="18" height="7" rx="1" fill="currentColor"></rect>'
221
+ },
222
+ {
223
+ value: "bottom",
224
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="14" width="18" height="5" rx="1" fill="currentColor"></rect>'
225
+ },
226
+ {
227
+ value: "center",
228
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="8" y="12" width="8" height="2" rx="0" fill="currentColor"></rect>'
229
+ },
230
+ {
231
+ value: "price",
232
+ icon: '<rect x="4" y="6" width="16" height="7"></rect><rect x="4" y="16" width="16" height="3" style="fill: currentColor;"></rect>'
233
+ }
234
+ ],
235
+ alignOptions: [
236
+ {
237
+ value: "left",
238
+ icon: '<path d="M 6 9 A 2.0002 2.0002 0 1 0 6 13 L 34 13 A 2.0002 2.0002 0 1 0 34 9 L 6 9 z M 6 22 A 2.0002 2.0002 0 1 0 6 26 L 42 26 A 2.0002 2.0002 0 1 0 42 22 L 6 22 z M 7 35 A 2.0002 2.0002 0 1 0 7 39 L 27 39 A 2.0002 2.0002 0 1 0 27 35 L 7 35 z" />'
239
+ },
240
+ {
241
+ value: "center",
242
+ icon: '<path d="M 10 9 A 2.0002 2.0002 0 1 0 10 13 L 38 13 A 2.0002 2.0002 0 1 0 38 9 L 10 9 z M 6 22 A 2.0002 2.0002 0 1 0 6 26 L 42 26 A 2.0002 2.0002 0 1 0 42 22 L 6 22 z M 14 35 A 2.0002 2.0002 0 1 0 14 39 L 34 39 A 2.0002 2.0002 0 1 0 34 35 L 14 35 z" />'
243
+ },
244
+ {
245
+ value: "right",
246
+ icon: '<path d="M 14 9 A 2.0002 2.0002 0 1 0 14 13 L 42 13 A 2.0002 2.0002 0 1 0 42 9 L 14 9 z M 6 22 A 2.0002 2.0002 0 1 0 6 26 L 42 26 A 2.0002 2.0002 0 1 0 42 22 L 6 22 z M 22 35 A 2.0002 2.0002 0 1 0 22 39 L 42 39 A 2.0002 2.0002 0 1 0 42 35 L 22 35 z" />'
247
+ }
248
+ ]
249
+ };
250
+ },
251
+ computed: {
252
+ layoutOptions() {
253
+ var t;
254
+ const { type: i } = ((t = this.items) == null ? void 0 : t[0]) || {};
255
+ return [
256
+ {
257
+ // left
258
+ isActive: this.layout === "vertical" && i === "media",
259
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="6" width="8" height="14" rx="1" fill="currentColor"></rect>',
260
+ onClick: () => this.setLayout({ layout: "vertical", type: "media" })
261
+ },
262
+ {
263
+ // right
264
+ isActive: this.layout === "vertical" && i === "content",
265
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="13" y="6" width="8" height="14" rx="1" fill="currentColor"></rect>',
266
+ onClick: () => this.setLayout({ layout: "vertical", type: "content" })
267
+ },
268
+ {
269
+ // top
270
+ isActive: this.layout === "horizontal" && i === "media",
271
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="6" width="18" height="7" rx="1" fill="currentColor"></rect>',
272
+ onClick: () => this.setLayout({ layout: "horizontal", type: "media" })
273
+ },
274
+ {
275
+ // bottom
276
+ isActive: this.layout === "horizontal" && i === "content",
277
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="3" y="14" width="18" height="5" rx="1" fill="currentColor"></rect>',
278
+ onClick: () => this.setLayout({ layout: "horizontal", type: "content" })
279
+ },
280
+ {
281
+ // center
282
+ isActive: this.layout === "center",
283
+ icon: '<rect x="3" y="6" width="18" height="14" rx="1"></rect><rect x="8" y="12" width="8" height="2" rx="0" fill="currentColor"></rect>',
284
+ onClick: () => this.setLayout({ layout: "center", type: "media" })
285
+ },
286
+ {
287
+ // price
288
+ isActive: this.layout === "price",
289
+ icon: '<rect x="4" y="6" width="16" height="7"></rect><rect x="4" y="16" width="16" height="3" style="fill: currentColor;"></rect>',
290
+ onClick: () => this.setLayout({ layout: "price" })
291
+ }
292
+ ];
293
+ },
294
+ overlayColor: {
295
+ get() {
296
+ var i;
297
+ return ((i = this.media) == null ? void 0 : i.overlayColor) || "";
298
+ },
299
+ set(i) {
300
+ this.media = { ...this.media, overlay: !0, overlayColor: i };
301
+ }
302
+ },
303
+ background() {
304
+ let i = "";
305
+ const { type: t, resourceUrl: e, video: o = {} } = this.media || {};
306
+ return t === "image" && e ? i = e : t === "video" && o.thumbnail && (i = o.thumbnail), i;
307
+ },
308
+ theme() {
309
+ var i;
310
+ return ((i = this._document) == null ? void 0 : i.theme) || {};
311
+ },
312
+ showPriceToggle: {
313
+ get() {
314
+ return !!(typeof this.showPriceSummary == "boolean" ? this.showPriceSummary : this.theme.showPriceSummary);
315
+ },
316
+ set(i) {
317
+ this.showPriceSummary = i;
318
+ }
319
+ }
320
+ },
321
+ watch: {
322
+ layout(i) {
323
+ this._document.isDirty(this._value.textAlign) || (this.textAlign = i === "center" ? i : "left");
324
+ },
325
+ backgroundColor(i) {
326
+ this._document.isDirty(this._value.textColor) || (this.textColor = A.readability(i, "#fff") < 1.8 ? "#111111" : "#FFFFFF");
327
+ }
328
+ },
329
+ methods: {
330
+ // Used for setting the correct array item order for specific layouts
331
+ // will place the given item type first in items
332
+ setLayout({ layout: i, type: t = "" }) {
333
+ const e = (o) => (r) => r.type === o ? -1 : 1;
334
+ t && (this.items = [...this.items].sort(e(t))), this.layout = i;
335
+ },
336
+ openBgModal() {
337
+ const { type: i = "image" } = this.media || {};
338
+ this.$modal.show(
339
+ T,
340
+ {
341
+ currentType: i
342
+ },
343
+ {},
344
+ {
345
+ input: ({ type: t, value: e, preferredColor: o }) => {
346
+ const r = t === "image" ? "resourceUrl" : "video";
347
+ this.media = {
348
+ ...this.media,
349
+ type: t,
350
+ [r]: e
351
+ }, o && !this._document.isDirty(this._value.backgroundColor) && (this.backgroundColor = o);
352
+ }
353
+ }
354
+ );
355
+ }
356
+ }
357
+ };
358
+ var B = function() {
359
+ var t = this, e = t._self._c;
360
+ return e("div", { staticClass: "d-root" }, [e("div", { staticClass: "d-option" }, [e("div", { staticClass: "d-option-title", staticStyle: { "padding-bottom": "calc(0.5 * var(--rem))" } }, [t._v(" Layouts ")]), e("div", { staticClass: "grid grid-cols-3 gap-2 p-1" }, t._l(t.layoutOptions, function({ isActive: o, onClick: r, icon: s }, a) {
361
+ return e("CButton", { key: a, staticStyle: { padding: "6px 10px", "border-radius": "3px", height: "initial" }, attrs: { type: o ? "secondary" : "none", pattern: o ? "primary" : "secondary", size: "normal" }, on: { click: r } }, [e("svg", { attrs: { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" }, domProps: { innerHTML: t._s(s) } })]);
362
+ }), 1)]), e("div", { staticClass: "d-option" }, [e("div", { staticClass: "d-option-title", staticStyle: { "padding-bottom": "calc(0.5 * var(--rem))" } }, [t._v(" " + t._s(t.$t("_common:background").capitalize()) + " ")]), e("div", { staticClass: "d-option-button-image", style: {
363
+ backgroundImage: `url(${t.background || t.theme.background})`
364
+ }, on: { click: t.openBgModal } })]), e("div", { staticClass: "d-option", staticStyle: { "padding-bottom": "0.5em" } }, [e("ThemeColorRow", { staticClass: "d-option-title", attrs: { value: t.overlayColor || t.theme.backgroundFilter || "", placement: "auto" }, on: { change: function(o) {
365
+ t.overlayColor = o;
366
+ } } }, [t._v(" " + t._s(t.$t("components:account.documentForm.settings.backgroundFilter")) + " ")])], 1), t.layout === "price" ? e("div", { staticClass: "d-option" }, [e("div", { staticClass: "d-option-title" }, [e("div", { staticStyle: { flex: "1 1 auto" } }, [t._v(" " + t._s(t.$t("components:account.documentForm.settings.priceSummaryBackground")) + " ")]), e("CSwitch", { staticStyle: { "margin-right": "0" }, attrs: { size: "small", type: "secondary" }, model: { value: t.showPriceToggle, callback: function(o) {
367
+ t.showPriceToggle = o;
368
+ }, expression: "showPriceToggle" } })], 1), t.showPriceToggle ? e("div", { staticClass: "d-option-row", staticStyle: { "padding-top": "1em" } }, [e("ThemeColorRow", { staticClass: "d-option-title", attrs: { value: t.backgroundColor || t.theme.priceSummaryBackground || "", "picker-options": { disableAlpha: !0 }, placement: "auto" }, on: { change: function(o) {
369
+ t.backgroundColor = o;
370
+ } } }, [t._v(" " + t._s(t.$t("_common:backgroundColor").capitalize()) + " ")])], 1) : t._e()]) : [t.layout !== "center" ? e("div", { staticClass: "d-option" }, [e("ThemeColorRow", { staticClass: "d-option-title", attrs: { value: t.backgroundColor || t.theme.priceSummaryBackground || "", "picker-options": { disableAlpha: !0 }, placement: "auto" }, on: { change: function(o) {
371
+ t.backgroundColor = o, t._document.setDirty(t._value.backgroundColor);
372
+ } } }, [t._v(" " + t._s(t.$t("_common:backgroundColor").capitalize()) + " ")])], 1) : t._e(), e("div", { staticClass: "d-option" }, [e("ThemeColorRow", { staticClass: "d-option-title", staticStyle: { "margin-top": "calc(0.5 * var(--rem))" }, attrs: { value: t.textColor || "", "picker-options": { disableAlpha: !0 }, placement: "auto" }, on: { change: function(o) {
373
+ t.textColor = o, t._document.setDirty(t._value.textColor);
374
+ } } }, [t._v(" " + t._s(t.$t("_common:textColor").capitalize()) + " ")])], 1), e("div", { staticClass: "d-option flex w-full" }, [e("div", { staticClass: "d-option-title", staticStyle: { "margin-top": "calc(0.5 * var(--rem))" } }, [t._v(" " + t._s(t.$t("_common:textAlign").capitalize()) + " ")]), e("CField", { staticStyle: { "margin-left": "auto" } }, t._l(t.alignOptions, function({ value: o, icon: r }, s) {
375
+ return e("CRadioButton", { key: s, class: !t.textAlign && "text-gray-400", attrs: { "native-value": o, type: t.textAlign ? "secondary" : "none", size: "small" }, on: { input: function(a) {
376
+ return t._document.setDirty(t._value.textAlign);
377
+ } }, model: { value: t.textAlign, callback: function(a) {
378
+ t.textAlign = a;
379
+ }, expression: "textAlign" } }, [e("svg", { staticStyle: { margin: "0" }, attrs: { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 48 48", fill: "currentColor", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }, domProps: { innerHTML: t._s(r) } })]);
380
+ }), 1)], 1)]], 2);
381
+ }, P = [], F = /* @__PURE__ */ y(
382
+ $,
383
+ B,
384
+ P,
385
+ !1,
386
+ null,
387
+ "adcf8352"
388
+ );
389
+ const q = F.exports;
390
+ export {
391
+ q as default
392
+ };
@@ -0,0 +1,84 @@
1
+ import r from "./ImageUploadWrapper-qJDHCf8T.js";
2
+ import { B as l, a as i } from "./index-B4aiQXsr.js";
3
+ import { c, n as m, o as n, H as d } from "./main-B9t0ybqW.js";
4
+ const o = c.unsplash.id, p = {
5
+ name: "ImageSelectModal",
6
+ i18nOptions: {
7
+ namespaces: "imageSelectModal",
8
+ messages: {
9
+ en: {
10
+ creditImages: "Images from {{thing}}"
11
+ },
12
+ sv: {
13
+ creditImages: "Bilder från {{thing}}"
14
+ }
15
+ }
16
+ },
17
+ components: {
18
+ BackgroundModal: l,
19
+ BackgroundList: i,
20
+ ImageUploadWrapper: r
21
+ },
22
+ data() {
23
+ return {
24
+ selectedUrl: null
25
+ };
26
+ },
27
+ methods: {
28
+ async fetch({ query: a, page: e }) {
29
+ const { data: t } = await n.get(
30
+ "https://api.unsplash.com/search/photos",
31
+ {
32
+ params: {
33
+ page: e,
34
+ per_page: 12,
35
+ client_id: o,
36
+ query: a
37
+ }
38
+ }
39
+ );
40
+ return {
41
+ items: (t.results || []).map((s) => ({
42
+ ...s,
43
+ image: s.urls.regular,
44
+ minImage: s.urls.thumb
45
+ })),
46
+ total: t.total
47
+ };
48
+ },
49
+ selectImage(a) {
50
+ this.selectedUrl = d(a.image, { w: 1800 });
51
+ const e = new Image();
52
+ e.src = this.selectedUrl, n.get(a.links.download_location, {
53
+ params: {
54
+ client_id: o
55
+ }
56
+ });
57
+ },
58
+ setCustomBackground({ response: a }) {
59
+ this.selectedUrl = a.url, this.onSave();
60
+ },
61
+ onSave() {
62
+ this.$emit("change"), this.$emit("input", this.selectedUrl), this.$parent && (this.$parent.$emit("change"), this.$parent.$emit("input", this.selectedUrl)), this.$emit("close");
63
+ }
64
+ }
65
+ };
66
+ var u = function() {
67
+ var e = this, t = e._self._c;
68
+ return t("BackgroundModal", e._g({}, e.$listeners), [t("BackgroundList", { attrs: { fetch: e.fetch, "credit-text": e.$t("creditImages", { thing: "Unsplash" }), "default-query": "architecture" }, on: { select: e.selectImage } }, [t("template", { slot: "footer" }, [t("ImageUploadWrapper", { ref: "uploadWrapper", attrs: { "on-image-upload": e.setCustomBackground }, on: { upload: function(s) {
69
+ e.isUploadingImage = !0;
70
+ } }, scopedSlots: e._u([{ key: "default", fn: function({ progress: s }) {
71
+ return [t("CButton", { attrs: { loading: !!s, "icon-left": "upload", type: "none" } }, [e._v(" " + e._s(e.$t("_common:upload")) + " ")])];
72
+ } }]) }), t("CButton", { staticStyle: { "margin-left": "0.5em" }, attrs: { type: "secondary" }, on: { click: e.onSave } }, [e._v(" " + e._s(e.$t("_common:save")) + " ")])], 1)], 2)], 1);
73
+ }, g = [], h = /* @__PURE__ */ m(
74
+ p,
75
+ u,
76
+ g,
77
+ !1,
78
+ null,
79
+ "d3705339"
80
+ );
81
+ const v = h.exports;
82
+ export {
83
+ v as default
84
+ };