@orangelogic/design-system 3.8.0 → 3.9.0

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.
@@ -7,7 +7,7 @@ import { C as Et } from "./button.w0zH5Ivx.js";
7
7
  import { C as Dn, o as Mn, O as Fn } from "./dialog.ICoCAj6Z.js";
8
8
  import { C as oi } from "./icon-button.BWJ1Vqn5.js";
9
9
  import Pt from "../components/tooltip.js";
10
- import { i as Wr, r as Ln, f as Jt, m as zn, a as _n, t as jr, g as On, b as An, c as Pn } from "./toast.C5Ir5yKA.js";
10
+ import { i as Wr, r as Ln, f as Jt, m as zn, a as _n, t as jr, g as On, b as An, c as Pn } from "./toast.CCWVobz5.js";
11
11
  import { c as Ie } from "./custom-element.L4WJXn1j.js";
12
12
  import { L as tt } from "./i18n.BA19xtyU.js";
13
13
  import { b as In, S as Hn, c as Vo, p as Nn, w as V, E as Vn } from "./watch.DJF5K-8U.js";
@@ -47,8 +47,7 @@ import "./browser.BHOCIF_A.js";
47
47
  import "./form.C8LMdQB4.js";
48
48
  import "./purify.es.BIuh5IAZ.js";
49
49
  import { D as Yr, a as la, t as ha, b as Zr } from "./date-picker.BGHn6qg8.js";
50
- import { D as Ti } from "./content-builder.BX4pHujE.js";
51
- import "./transformation.DNl_AZs1.js";
50
+ import { D as Ti } from "./transformation.D27sTUdZ.js";
52
51
  import { s as P, h as $o, b as Ui, c as lo } from "./string.Demn8Xmk.js";
53
52
  import { a as ca } from "./_commonjsHelpers.DQNKXVTB.js";
54
53
  import { d as da } from "./debounce.Bv1rtE8D.js";
@@ -23,9 +23,8 @@ import { L as LocalizeController } from "./i18n.BA19xtyU.js";
23
23
  import "./purify.es.BIuh5IAZ.js";
24
24
  import { w as watch } from "./watch.DJF5K-8U.js";
25
25
  import "./date-picker.BGHn6qg8.js";
26
- import { f as fetchCortexApi } from "./content-builder.BX4pHujE.js";
26
+ import { g as fetchCortexApi } from "./transformation.D27sTUdZ.js";
27
27
  import "./unsafe-html.Dff7-rCx.js";
28
- import "./transformation.DNl_AZs1.js";
29
28
  import { r as reactExports, a as React, j as jsxRuntimeExports, w, R as ReactDOM } from "./jsx-runtime.CTpPVMxj.js";
30
29
  import { a as getDefaultExportFromCjs, c as commonjsGlobal } from "./_commonjsHelpers.DQNKXVTB.js";
31
30
  import { r as require$$0 } from "./___vite-browser-external_commonjs-proxy.C2tf3HsQ.js";
@@ -2,7 +2,7 @@ import { C as Z } from "./typography.IqHbnd3C.js";
2
2
  import { n as y, C as ee } from "./lib-cortex-element.CVMmyPMC.js";
3
3
  import { c as ae } from "./component.styles.CRO4Odto.js";
4
4
  import { C as Ee, s as ve, F as Q, a as Ce } from "./folder-select.CP0NPc0S.js";
5
- import { a as U, S as n1, E as ge } from "./content-builder.BX4pHujE.js";
5
+ import { f as U, S as n1, E as ge } from "./transformation.D27sTUdZ.js";
6
6
  import { c as ie } from "./custom-element.L4WJXn1j.js";
7
7
  import { L as W } from "./i18n.BA19xtyU.js";
8
8
  import { w as O } from "./watch.DJF5K-8U.js";
@@ -13,7 +13,7 @@ import { b as Ke } from "./_baseIteratee.sC2wLi2m.js";
13
13
  import { a as c1 } from "./toString.B1zKIiZc.js";
14
14
  import { b as d1 } from "./cloneDeep.tKGbEwzn.js";
15
15
  import { c as s1 } from "./_baseClone.ipmFlCAx.js";
16
- import { I as je, C as Ve, a as o1, b as He, S as z, D as h1, c as l1, A as _e, g as g1, i as C1, F as y1, d as x1, t as b1, e as k1, f as p1, h as u1, j as f1, k as A1, l as B1, m as D1, n as F1, o as E1, p as v1, q as $1, r as w1, O as S1 } from "./types.CRoGmgCO.js";
16
+ import { I as je, C as Ve, a as o1, b as He, S as z, D as h1, c as l1, A as _e, g as g1, i as C1, F as y1, d as x1, t as b1, e as k1, f as p1, h as u1, j as f1, k as A1, l as B1, m as D1, n as F1, o as E1, p as v1, q as $1, r as w1, O as S1 } from "./types.Bin5fi-e.js";
17
17
  import { C as ce } from "./button.w0zH5Ivx.js";
18
18
  import I1 from "../components/button-group.js";
19
19
  import _1 from "../components/card.js";
@@ -59,11 +59,11 @@ import { n as $ } from "./when.Dr1es41R.js";
59
59
  import { a as l0 } from "./_baseXor.DixEm6JQ.js";
60
60
  import { a as g0, i as qe, b as C0 } from "./isArrayLikeObject.D7afXo-f.js";
61
61
  import { i as y0 } from "./isEmpty.DtTJTUcf.js";
62
- import { a as Ae, F as x0, b as b0, c as Le, d as Oe, i as k0, e as Ge, u as Be } from "./asset-link-format.B-tXtkr4.js";
62
+ import { a as Ae, F as x0, b as b0, c as Le, d as Oe, i as k0, e as Ge, u as Be } from "./asset-link-format.BLKOUD2l.js";
63
63
  import p0 from "../components/color-picker.js";
64
64
  import { C as Ie } from "./icon-button.BWJ1Vqn5.js";
65
65
  import u0 from "../components/spinner.js";
66
- import { a as f0, d as A0 } from "./color-swatch-group.D1evXBSR.js";
66
+ import { a as f0, d as A0 } from "./color-swatch-group.Bvq6xkM-.js";
67
67
  import { c as ne, C as me, p as B0, a as D0, b as F0, g as ye } from "./color.LzSGBy7o.js";
68
68
  import { o as e1 } from "./map.D8heArFD.js";
69
69
  import { v as a1 } from "./v4.CKZ6klMF.js";
@@ -1,4 +1,4 @@
1
- import { D as f } from "./content-builder.BX4pHujE.js";
1
+ import { D as f } from "./transformation.D27sTUdZ.js";
2
2
  function h(n, e) {
3
3
  return n.filter((r, t) => t !== e);
4
4
  }
@@ -0,0 +1,392 @@
1
+ import { c as b } from "./capitalize.CIBKBL10.js";
2
+ import { C as A, T as g, U as M } from "./asset-link-format.ClaYu_v8.js";
3
+ import { P as C } from "./position-picker.DjnhxIKF.js";
4
+ const p = window.location.origin.includes("localhost:") ? "https://local.orangelogic.com" : window.location.origin;
5
+ function at(t, i, e, l = p) {
6
+ const s = new URL(l + "/" + t);
7
+ return Array.isArray(e) ? e.forEach((a) => {
8
+ a[1] && s.searchParams.append(a[0], a[1]);
9
+ }) : e && Object.keys(e).forEach((a) => {
10
+ e[a] && s.searchParams.append(a, e[a]);
11
+ }), fetch(s, i);
12
+ }
13
+ const ot = "space-default";
14
+ var L = /* @__PURE__ */ ((t) => (t.Desktop = "desktop", t.Mobile = "mobile", t.Tablet = "tablet", t))(L || {});
15
+ const w = {
16
+ canvasWidth: "",
17
+ height: "",
18
+ id: "desktop",
19
+ maxWidth: "",
20
+ name: b(
21
+ "desktop"
22
+ /* Desktop */
23
+ )
24
+ }, F = {
25
+ canvasWidth: "770px",
26
+ height: "",
27
+ id: "tablet",
28
+ maxWidth: "1280px",
29
+ name: b(
30
+ "tablet"
31
+ /* Tablet */
32
+ )
33
+ }, W = {
34
+ canvasWidth: "320px",
35
+ height: "",
36
+ id: "mobile",
37
+ maxWidth: "480px",
38
+ name: b(
39
+ "mobile"
40
+ /* Mobile */
41
+ )
42
+ }, rt = [w, F, W];
43
+ var B = /* @__PURE__ */ ((t) => (t.All = "ALL", t.CanDelete = "CanDelete", t.CanDownload = "CanDownload", t.CanFind = "CanFind", t.CanManageRights = "CanManageRights", t.CanMove = "CanMove", t.CanRead = "CanRead", t.CanReadAll = "CanReadAll", t.CanReadAndWrite = "CanReadAndWrite", t.CanReadLarge = "CanReadLarge", t.CanReadMedium = "CanReadMedium", t.CanReadOriginal = "CanReadOriginal", t.CanShare = "CanShare", t.CanUpload = "CanUpload", t.CanWrite = "CanWrite", t.None = "NONE", t))(B || {}), U = /* @__PURE__ */ ((t) => (t.All = "all", t.Audio = "audio", t.Image = "image", t.Other = "other", t.Video = "video", t))(U || {}), D = /* @__PURE__ */ ((t) => (t.Content = "content", t.Template = "template", t))(D || {}), G = /* @__PURE__ */ ((t) => (t.Administrator = "Administrator", t.Designer = "Designer", t.Editor = "Editor", t))(G || {}), I = /* @__PURE__ */ ((t) => (t.Accordion = "BlockAccordion", t.Analytics = "BlockAnalytics", t.Audio = "BlockAudio", t.Button = "BlockButton", t.Carousel = "BlockCarousel", t.ColorSwatches = "BlockColorSwatches", t.Column = "BlockCell", t.ColumnGroup = "BlockColumns", t.DamView = "BlockDamView", t.Divider = "BlockDivider", t.DocumentViewer = "BlockDocumentViewer", t.FontKit = "BlockFontKit", t.Gallery = "BlockGallery", t.Header = "BlockHeader", t.Image = "BlockImage", t.RichText = "BlockRichText", t.SearchBox = "BlockSearchBox", t.TabGroup = "BlockTabs", t.Text = "BlockText", t.Timeline = "BlockTimeline", t.Video = "BlockVideo", t))(I || {});
44
+ const st = Object.values(I).filter(
45
+ (t) => t !== "BlockCell"
46
+ /* Column */
47
+ );
48
+ var K = /* @__PURE__ */ ((t) => (t.Carousel = "carousel", t.Gallery = "gallery", t))(K || {}), V = /* @__PURE__ */ ((t) => (t.Templates = "TEMPLATES", t.TranslatableAttributes = "TRANSLATABLE_ATTRIBUTES", t.TranslatableTexts = "TRANSLATABLE_TEXTS", t))(V || {});
49
+ const m = "/AssetLink/", X = {
50
+ [C.BottomCenter]: A.South,
51
+ [C.BottomLeft]: A.Southwest,
52
+ [C.BottomRight]: A.Southeast,
53
+ [C.CenterCenter]: A.Center,
54
+ [C.CenterLeft]: A.West,
55
+ [C.CenterRight]: A.East,
56
+ [C.TopCenter]: A.North,
57
+ [C.TopLeft]: A.Northwest,
58
+ [C.TopRight]: A.Northeast
59
+ }, v = "/t/", j = [400, 800, 1200, 1600, 2400], z = 0.15;
60
+ function H({
61
+ asset: t,
62
+ baseUrl: i,
63
+ extension: e,
64
+ options: l,
65
+ parameters: s,
66
+ transformations: a,
67
+ useSession: h = ""
68
+ }) {
69
+ if (i == null)
70
+ return "";
71
+ let r = i;
72
+ const f = a?.findLast(
73
+ (d) => d.key === g.Quality
74
+ );
75
+ if (f && (a = [
76
+ ...a?.filter(
77
+ (d) => d.key !== g.Quality
78
+ ) || [],
79
+ f
80
+ ]), a) {
81
+ const d = [];
82
+ for (let n = 0; n < a.length; n++) {
83
+ const u = a[n];
84
+ if (u.key === g.Rotate) {
85
+ let o = u.value.rotation ?? 0;
86
+ for (; a[n + 1]?.key === g.Rotate; )
87
+ n++, o += a[n].value.rotation ?? 0;
88
+ o !== 0 && d.push({ key: g.Rotate, value: { rotation: o } });
89
+ } else
90
+ d.push(u);
91
+ }
92
+ a = d;
93
+ }
94
+ a && a.length > 0 && (r += "/t/"), a?.forEach(({ key: d, value: n }) => {
95
+ if (d === g.Resize) {
96
+ if (n.unit === M.AspectRatio && n.ratioWidth && n.ratioHeight) {
97
+ r += `re_ar_${n.ratioWidth}:${n.ratioHeight}/`;
98
+ return;
99
+ }
100
+ const u = [
101
+ ...[
102
+ {
103
+ key: "re_w_",
104
+ value: Math.round(n.width ?? 0)
105
+ },
106
+ {
107
+ key: "re_h_",
108
+ value: Math.round(n.height ?? 0)
109
+ }
110
+ ].filter((o) => o.value !== void 0).map((o) => ({
111
+ key: o.key,
112
+ value: Math.round(Number(o.value))
113
+ })),
114
+ {
115
+ key: "re_rm_",
116
+ value: "stretch"
117
+ }
118
+ ];
119
+ u.forEach(({ key: o, value: _ }, $) => {
120
+ r += `${o}${_}${$ < u.length - 1 ? "," : ""}`;
121
+ }), r += "/";
122
+ }
123
+ if (d === g.Crop) {
124
+ const u = n.unit === M.AspectRatio && !!n.ratioWidth && !!n.ratioHeight, o = !n.disabledSize && !u, _ = o && (n.x !== void 0 || n.y !== void 0), $ = [
125
+ ...[
126
+ {
127
+ key: "c_",
128
+ value: n.mode
129
+ },
130
+ ...u ? [
131
+ {
132
+ key: "ar_",
133
+ value: `${n.ratioWidth}:${n.ratioHeight}`
134
+ }
135
+ ] : [],
136
+ ...o ? [
137
+ {
138
+ key: "c_w_",
139
+ value: Math.round(n.width ?? 0)
140
+ },
141
+ {
142
+ key: "c_h_",
143
+ value: Math.round(n.height ?? 0)
144
+ },
145
+ {
146
+ key: "c_x_",
147
+ value: Math.round(n.x ?? 0) === 0 && l?.omitZeroXY ? void 0 : Math.round(n.x ?? 0)
148
+ },
149
+ {
150
+ key: "c_y_",
151
+ value: Math.round(n.y ?? 0) === 0 && l?.omitZeroXY ? void 0 : Math.round(n.y ?? 0)
152
+ }
153
+ ] : [],
154
+ ...!_ && n.focusMode && n.focusMode !== "manual" ? [
155
+ {
156
+ key: n.isFocusModeAuto ? "acm_" : "c_g_",
157
+ value: n.focusMode
158
+ }
159
+ ] : [],
160
+ ...!_ && n.focusMode === "manual" && n.position ? [
161
+ {
162
+ key: "c_g_",
163
+ value: X[n.position]
164
+ }
165
+ ] : []
166
+ ].filter((R) => R.value !== void 0 && R.value !== null).map((R) => ({
167
+ key: R.key,
168
+ value: R.value
169
+ })),
170
+ ...u ? [] : [
171
+ {
172
+ key: "c_whu_",
173
+ value: "pixel"
174
+ }
175
+ ]
176
+ ];
177
+ $.forEach(({ key: R, value: k }, S) => {
178
+ const y = ["c_w_", "c_h_", "c_x_", "c_y_"].includes(R);
179
+ r += `${R}${y ? Math.round(Number(k)) : k}${S < $.length - 1 ? "," : ""}`;
180
+ }), r += "/";
181
+ }
182
+ if (d === g.Rotate && ([
183
+ {
184
+ key: "r_a_",
185
+ value: n.rotation
186
+ }
187
+ ].filter((o) => o.value !== void 0).map((o) => ({
188
+ key: o.key,
189
+ value: Math.round(Number(o.value))
190
+ })).forEach(({ key: o, value: _ }) => {
191
+ r += `${o}${_}`;
192
+ }), r += "/"), d === g.Quality) {
193
+ const u = [
194
+ {
195
+ key: "q_level_",
196
+ value: n.quality
197
+ }
198
+ ].filter((o) => o.value !== void 0).map((o) => ({
199
+ key: o.key,
200
+ value: Math.round(Number(o.value))
201
+ }));
202
+ u.forEach(({ key: o, value: _ }, $) => {
203
+ r += `${o}${_}${$ < u.length - 1 ? "," : ""}`;
204
+ }), r += "/";
205
+ }
206
+ if (d === g.Metadata) {
207
+ const u = [
208
+ {
209
+ key: "fl_keep_metadata",
210
+ value: n.keepMetadata
211
+ }
212
+ ].filter((o) => o.value !== void 0).map((o) => ({ key: o.key, value: o.value }));
213
+ u.forEach(({ key: o }, _) => {
214
+ r += `${o}${_ < u.length - 1 ? "," : ""}`;
215
+ }), r += "/";
216
+ }
217
+ }), e && (r += `${t?.identifier ?? crypto.randomUUID()}${e}`);
218
+ const c = [];
219
+ return s && s.length > 0 && s.forEach(({ key: d, value: n }) => {
220
+ c.push(
221
+ `${encodeURIComponent(d.trim())}=${encodeURIComponent(n.trim())}`
222
+ );
223
+ }), i && h && c.push(`UseSession=${encodeURIComponent(h)}`), c.length > 0 && (r += `?${c.join("&")}`), r.endsWith("/") && (r = r.slice(0, -1)), r;
224
+ }
225
+ function ct(t, i) {
226
+ if (!t || !i?.length)
227
+ return t;
228
+ const e = H({ baseUrl: "", transformations: i }).replace(
229
+ /\/t\//g,
230
+ ""
231
+ );
232
+ if (!e)
233
+ return t;
234
+ const l = t.indexOf(m);
235
+ if (l < 0)
236
+ return `${t}/t/${e}`;
237
+ const s = t.slice(0, l + m.length), a = t.slice(l + m.length), h = a.indexOf("/t/");
238
+ if (h >= 0) {
239
+ const f = a.slice(0, h);
240
+ return `${s}${f}/t/${e}`;
241
+ }
242
+ const r = a.indexOf("/");
243
+ if (r >= 0) {
244
+ const f = a.slice(0, r), c = a.slice(r);
245
+ return `${s}${f}/t/${e}${c}`;
246
+ }
247
+ return `${t}/t/${e}`;
248
+ }
249
+ function Y(t) {
250
+ return `re_w_${Math.round(t)}`;
251
+ }
252
+ function q(t, i) {
253
+ if (!t || !Number.isFinite(i) || i <= 0)
254
+ return t;
255
+ const e = t.indexOf(m);
256
+ if (e < 0)
257
+ return t;
258
+ const l = Y(i), s = t.slice(0, e + m.length), a = t.slice(e + m.length), h = a.indexOf(v);
259
+ if (h >= 0) {
260
+ const f = a.slice(0, h), c = a.slice(
261
+ h + v.length
262
+ );
263
+ return `${s}${f}${v}${l}/${c}`;
264
+ }
265
+ const r = a.indexOf("/");
266
+ if (r >= 0) {
267
+ const f = a.slice(0, r), c = a.slice(r);
268
+ return `${s}${f}${v}${l}${c}`;
269
+ }
270
+ return `${s}${a}${v}${l}`;
271
+ }
272
+ function Q(t) {
273
+ const i = t.indexOf(m);
274
+ return i < 0 ? !1 : t.slice(i + m.length).includes(v);
275
+ }
276
+ const x = "TRX", T = "TR1", Z = /* @__PURE__ */ new Set([
277
+ "avif",
278
+ "bmp",
279
+ "gif",
280
+ "ico",
281
+ "jpeg",
282
+ "jpg",
283
+ "png",
284
+ "svg",
285
+ "tif",
286
+ "tiff",
287
+ "webp"
288
+ ]);
289
+ function N(t) {
290
+ if (!t)
291
+ return "";
292
+ const i = t.trim().toLowerCase();
293
+ return i.startsWith(".") ? i.slice(1) : i;
294
+ }
295
+ function O(t) {
296
+ return N(t) === "gif";
297
+ }
298
+ const J = 1e3 * 1024 * 1024, P = {
299
+ b: 1,
300
+ byte: 1,
301
+ bytes: 1,
302
+ gb: 1024 ** 3,
303
+ kb: 1024,
304
+ mb: 1024 ** 2,
305
+ tb: 1024 ** 4
306
+ };
307
+ function tt(t) {
308
+ if (typeof t == "number")
309
+ return Number.isFinite(t) && t >= 0 ? t : void 0;
310
+ if (!t)
311
+ return;
312
+ const i = /^\s*([\d.,]+)\s*([a-z]*)\s*$/i.exec(t);
313
+ if (!i)
314
+ return;
315
+ const e = Number(i[1].replace(/,/g, ""));
316
+ if (!Number.isFinite(e) || e < 0)
317
+ return;
318
+ const l = i[2].toLowerCase();
319
+ if (!l)
320
+ return e;
321
+ const s = P[l];
322
+ return s === void 0 ? void 0 : e * s;
323
+ }
324
+ function lt(t, i) {
325
+ if (t)
326
+ return;
327
+ const e = typeof i == "number" ? i : Number(i ?? "");
328
+ return Number.isFinite(e) && e > 0 ? e : void 0;
329
+ }
330
+ function dt(t, i) {
331
+ if (!Z.has(N(t)))
332
+ return T;
333
+ const e = tt(i);
334
+ return e !== void 0 && e > J ? T : x;
335
+ }
336
+ const E = ".auto";
337
+ function ut(t, i = {}) {
338
+ const e = t ? t.indexOf(m) : -1;
339
+ if (e < 0 || i.format === x && O(i.extension))
340
+ return t;
341
+ const l = t.slice(e + m.length), s = l.slice(l.lastIndexOf("/") + 1);
342
+ return s === "" || s.endsWith(E) ? t : `${t}${E}`;
343
+ }
344
+ function ft(t, i = {}) {
345
+ if (!t.includes(m) || Q(t) || i.format === x && O(i.extension))
346
+ return "";
347
+ const { maxWidth: e, widths: l = j } = i, s = [...l].filter((c) => Number.isFinite(c) && c > 0).sort((c, d) => c - d);
348
+ if (s.length === 0)
349
+ return "";
350
+ let a = s;
351
+ if (e !== void 0 && Number.isFinite(e) && e > 0) {
352
+ const c = s.filter((d) => d <= e);
353
+ a = c.length > 0 ? c : [s[0]];
354
+ }
355
+ const h = e !== void 0 && Number.isFinite(e) && e > 0, f = (h ? a.filter(
356
+ (c) => e > c * (1 + z)
357
+ ) : a).map(
358
+ (c) => `${q(t, c)} ${c}w`
359
+ );
360
+ return h && f.push(`${t} ${e}w`), f.join(", ");
361
+ }
362
+ function ht(t, i = 100) {
363
+ return !Number.isFinite(t) || t <= 0 ? "" : `${Math.ceil(t / i) * i}px`;
364
+ }
365
+ export {
366
+ U as A,
367
+ I as B,
368
+ L as D,
369
+ D as E,
370
+ B as P,
371
+ ot as S,
372
+ G as T,
373
+ ct as a,
374
+ ut as b,
375
+ ft as c,
376
+ lt as d,
377
+ H as e,
378
+ K as f,
379
+ at as g,
380
+ ht as h,
381
+ V as i,
382
+ st as j,
383
+ rt as k,
384
+ j as l,
385
+ q as m,
386
+ Q as n,
387
+ T as o,
388
+ J as p,
389
+ tt as q,
390
+ dt as r,
391
+ E as s
392
+ };