@usethrottle/builder-react 0.5.2 → 0.5.3
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.
- package/dist/{chunk-ULAFEYQV.js → chunk-HE6MD2RZ.js} +1661 -109
- package/dist/{chunk-WGBNEYOF.cjs → chunk-J2IHOBDX.cjs} +1678 -126
- package/dist/index.cjs +1714 -200
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1669 -155
- package/dist/next.cjs +62 -32
- package/dist/next.d.cts +7 -1
- package/dist/next.d.ts +7 -1
- package/dist/next.js +38 -8
- package/dist/server.cjs +26 -24
- package/dist/server.d.cts +101 -83
- package/dist/server.d.ts +101 -83
- package/dist/server.js +3 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -565,12 +565,12 @@ var Boundary = class extends BoundaryBase {
|
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
567
|
function PartBoundary({
|
|
568
|
-
label,
|
|
568
|
+
label: label2,
|
|
569
569
|
resetKey,
|
|
570
570
|
children
|
|
571
571
|
}) {
|
|
572
572
|
const builder = useBuilder();
|
|
573
|
-
return /* @__PURE__ */ jsx6(Boundary, { label, resetKeys: [builder?.site, resetKey], onError: builder?.onError, children });
|
|
573
|
+
return /* @__PURE__ */ jsx6(Boundary, { label: label2, resetKeys: [builder?.site, resetKey], onError: builder?.onError, children });
|
|
574
574
|
}
|
|
575
575
|
function contextData(context) {
|
|
576
576
|
if (typeof context !== "object" || context === null) return {};
|
|
@@ -622,9 +622,9 @@ function compileTemplate(snapshot, registry) {
|
|
|
622
622
|
return result;
|
|
623
623
|
}
|
|
624
624
|
function compile(snapshot, registry) {
|
|
625
|
-
const
|
|
625
|
+
const label2 = `${snapshot.type}@${String(snapshot.v)}`;
|
|
626
626
|
const refuse = (why) => {
|
|
627
|
-
warnOnce(`template:${
|
|
627
|
+
warnOnce(`template:${label2}`, `${label2} was refused (${why}); rendering nothing for it`);
|
|
628
628
|
return null;
|
|
629
629
|
};
|
|
630
630
|
if (snapshot.kind !== "template") return refuse("not a template widget");
|
|
@@ -796,10 +796,10 @@ function check(raw, registry) {
|
|
|
796
796
|
}
|
|
797
797
|
function verify(raw, registry) {
|
|
798
798
|
const snapshot = raw;
|
|
799
|
-
const
|
|
799
|
+
const label2 = `${String(snapshot.type)}@${String(snapshot.v)}`;
|
|
800
800
|
if (snapshot.disabled === true) return { status: "disabled" };
|
|
801
801
|
const refuse = (why) => {
|
|
802
|
-
warnOnce(`code:${
|
|
802
|
+
warnOnce(`code:${label2}`, `Code widget ${label2} was refused (${why}); rendering nothing for it`);
|
|
803
803
|
return { status: "invalid" };
|
|
804
804
|
};
|
|
805
805
|
if (snapshot.kind !== "code") return refuse("not a code widget");
|
|
@@ -850,7 +850,7 @@ function CodeWidget(props) {
|
|
|
850
850
|
const src = runs(props, result.snapshot.jsHash);
|
|
851
851
|
if (src !== null) markCodeEmitted();
|
|
852
852
|
const env = newEnv({ settings: props.props, data: props.data, locale: props.locale, mediaOrigin: props.mediaOrigin, budget: new RenderBudget() });
|
|
853
|
-
const
|
|
853
|
+
const label2 = `${node.type}@${String(node.v)}`;
|
|
854
854
|
return /* @__PURE__ */ jsxs2(
|
|
855
855
|
NodeWrapper,
|
|
856
856
|
{
|
|
@@ -865,27 +865,27 @@ function CodeWidget(props) {
|
|
|
865
865
|
entrance,
|
|
866
866
|
attributes: src === null ? { "data-b-code-inert": "" } : { "data-b-code": result.snapshot.jsHash },
|
|
867
867
|
children: [
|
|
868
|
-
/* @__PURE__ */ jsx8(PartBoundary, { label, children: /* @__PURE__ */ jsxs2(Suspense2, { fallback: null, children: [
|
|
868
|
+
/* @__PURE__ */ jsx8(PartBoundary, { label: label2, children: /* @__PURE__ */ jsxs2(Suspense2, { fallback: null, children: [
|
|
869
869
|
template.css === "" ? null : /* @__PURE__ */ jsx8(CustomCss, { css: template.css }),
|
|
870
870
|
renderTemplate(template.ast, env)
|
|
871
871
|
] }) }),
|
|
872
872
|
src === null && (edit !== void 0 || props.code?.preview === true) ? /* @__PURE__ */ jsx8("div", { "data-b-code-badge": "", style: BADGE, children: "Runs on your store" }) : null,
|
|
873
|
-
src === null ? null : /* @__PURE__ */ jsx8(CodeInput, { props: props.props, data: props.data, label }),
|
|
873
|
+
src === null ? null : /* @__PURE__ */ jsx8(CodeInput, { props: props.props, data: props.data, label: label2 }),
|
|
874
874
|
src === null ? null : /* @__PURE__ */ jsx8("script", { async: true, src })
|
|
875
875
|
]
|
|
876
876
|
}
|
|
877
877
|
);
|
|
878
878
|
}
|
|
879
|
-
function CodeInput({ props, data, label }) {
|
|
879
|
+
function CodeInput({ props, data, label: label2 }) {
|
|
880
880
|
let json = "";
|
|
881
881
|
try {
|
|
882
882
|
json = jsonForScript({ props, data });
|
|
883
883
|
if (json.length > MAX_INPUT_CHARS) {
|
|
884
|
-
warnOnce(`code-input:${
|
|
884
|
+
warnOnce(`code-input:${label2}`, `The data of ${label2} is too large for its code input; it gets its props only`);
|
|
885
885
|
json = jsonForScript({ props, data: {} });
|
|
886
886
|
}
|
|
887
887
|
} catch {
|
|
888
|
-
warnOnce(`code-input:${
|
|
888
|
+
warnOnce(`code-input:${label2}`, `The input of ${label2} cannot be written as JSON; it gets none`);
|
|
889
889
|
json = jsonForScript({ props: {}, data: {} });
|
|
890
890
|
}
|
|
891
891
|
return /* @__PURE__ */ jsx8("script", { type: "application/json", "data-b-code-input": "", children: json });
|
|
@@ -999,16 +999,22 @@ function widgetDecls(node, device, registry) {
|
|
|
999
999
|
var ALIGN_ITEMS = { top: "flex-start", center: "center", bottom: "flex-end", stretch: "stretch" };
|
|
1000
1000
|
var BG_POSITION = /* @__PURE__ */ new Set(["center", "top", "bottom", "left", "right", "top left", "top right", "bottom left", "bottom right"]);
|
|
1001
1001
|
var BG_SIZE = /* @__PURE__ */ new Set(["cover", "contain", "auto"]);
|
|
1002
|
-
function backgroundDecls(out, bg, assets, mediaOrigin) {
|
|
1002
|
+
function backgroundDecls(out, bg, assets, mediaOrigin, device) {
|
|
1003
1003
|
if (bg === void 0) return;
|
|
1004
1004
|
put(out, "--tb-bg", bg.color === void 0 ? null : colour(bg.color));
|
|
1005
1005
|
put(out, "--tb-overlay", bg.overlay === void 0 ? null : colour(bg.overlay));
|
|
1006
1006
|
if (bg.position !== void 0 && BG_POSITION.has(bg.position)) put(out, "--tb-bgpos", bg.position);
|
|
1007
1007
|
if (bg.size !== void 0 && BG_SIZE.has(bg.size)) put(out, "--tb-bgsize", bg.size);
|
|
1008
|
-
const asset = bg
|
|
1009
|
-
if (asset !== void 0
|
|
1010
|
-
|
|
1011
|
-
|
|
1008
|
+
const asset = backgroundAsset(bg, device, assets, mediaOrigin);
|
|
1009
|
+
if (asset !== void 0) out.set("--tb-bgimg", `url("${asset.url}")`);
|
|
1010
|
+
}
|
|
1011
|
+
function backgroundAsset(bg, device, assets, mediaOrigin) {
|
|
1012
|
+
if (bg === void 0 || assets === void 0) return void 0;
|
|
1013
|
+
const usable = (id) => {
|
|
1014
|
+
const found = id === void 0 || !Object.hasOwn(assets, id) ? void 0 : assets[id];
|
|
1015
|
+
return found !== void 0 && safeUrl2(found.url, "src", { mediaOrigin }) !== null && URL_QUOTE_SAFE.test(found.url) ? found : void 0;
|
|
1016
|
+
};
|
|
1017
|
+
return (device === "phone" ? usable(bg.mobileImage) : void 0) ?? usable(bg.image);
|
|
1012
1018
|
}
|
|
1013
1019
|
function sectionDecls(section, device, assets, mediaOrigin) {
|
|
1014
1020
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -1021,7 +1027,7 @@ function sectionDecls(section, device, assets, mediaOrigin) {
|
|
|
1021
1027
|
put(out, "--tb-padx", p.paddingX === void 0 ? null : spacing(p.paddingX));
|
|
1022
1028
|
if (typeof p.minHeight === "number" && p.minHeight > 0 && p.minHeight <= 2e3) put(out, "--tb-minh", px(p.minHeight));
|
|
1023
1029
|
if (typeof p.verticalAlign === "string" && Object.hasOwn(ALIGN_ITEMS, p.verticalAlign)) put(out, "--tb-valign", ALIGN_ITEMS[p.verticalAlign]);
|
|
1024
|
-
backgroundDecls(out, p.background, assets, mediaOrigin);
|
|
1030
|
+
backgroundDecls(out, p.background, assets, mediaOrigin, device);
|
|
1025
1031
|
const widths = resolveColumnWidths(section, device);
|
|
1026
1032
|
const rows = wrapColumnRows(widths);
|
|
1027
1033
|
const stacked = rows.every((row) => row.length === 1);
|
|
@@ -1046,7 +1052,7 @@ function columnDecls(section, index, device, assets, mediaOrigin, widths) {
|
|
|
1046
1052
|
if (p.hidden === true) put(out, "--tb-hide", "none");
|
|
1047
1053
|
if (typeof p.verticalAlign === "string" && Object.hasOwn(ALIGN_ITEMS, p.verticalAlign)) put(out, "--tb-self", ALIGN_ITEMS[p.verticalAlign]);
|
|
1048
1054
|
put(out, "--tb-pad", p.padding === void 0 ? null : spacing(p.padding));
|
|
1049
|
-
backgroundDecls(out, p.background, assets, mediaOrigin);
|
|
1055
|
+
backgroundDecls(out, p.background, assets, mediaOrigin, device);
|
|
1050
1056
|
return out;
|
|
1051
1057
|
}
|
|
1052
1058
|
function collect(doc, registry, assets, mediaOrigin) {
|
|
@@ -1365,7 +1371,7 @@ function startRuntime() {
|
|
|
1365
1371
|
document.addEventListener("keydown", onKey);
|
|
1366
1372
|
window.addEventListener("hashchange", onHash);
|
|
1367
1373
|
let beat = 0;
|
|
1368
|
-
const
|
|
1374
|
+
const clock2 = window.setInterval(() => {
|
|
1369
1375
|
const minute = ++beat % 60 === 0;
|
|
1370
1376
|
all("[data-b-cd]:not([data-b-ended])").forEach((el) => tick(el, minute));
|
|
1371
1377
|
}, 1e3);
|
|
@@ -1383,7 +1389,7 @@ function startRuntime() {
|
|
|
1383
1389
|
document.removeEventListener("click", onClick);
|
|
1384
1390
|
document.removeEventListener("keydown", onKey);
|
|
1385
1391
|
window.removeEventListener("hashchange", onHash);
|
|
1386
|
-
window.clearInterval(
|
|
1392
|
+
window.clearInterval(clock2);
|
|
1387
1393
|
watcher.disconnect();
|
|
1388
1394
|
autoplay.forEach((id) => window.clearInterval(id));
|
|
1389
1395
|
autoplay.clear();
|
|
@@ -1535,11 +1541,11 @@ function DrawerRuntime() {
|
|
|
1535
1541
|
return null;
|
|
1536
1542
|
}
|
|
1537
1543
|
function Collapse(props) {
|
|
1538
|
-
const { sectionId, id, px: px2, label, children } = props;
|
|
1544
|
+
const { sectionId, id, px: px2, label: label2, children } = props;
|
|
1539
1545
|
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1540
1546
|
/* @__PURE__ */ jsx12("style", { href: `tb-fr-${sectionId}`, precedence: "throttle", children: collapseCss(sectionId, px2) }),
|
|
1541
1547
|
/* @__PURE__ */ jsxs5("div", { className: "tb-fr", "data-tb-collapse": "", children: [
|
|
1542
|
-
/* @__PURE__ */ jsx12("button", { type: "button", className: "tb-fr-open", "data-tb-drawer-open": "", "aria-expanded": "false", "aria-controls": id, children:
|
|
1548
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: "tb-fr-open", "data-tb-drawer-open": "", "aria-expanded": "false", "aria-controls": id, children: label2 }),
|
|
1543
1549
|
/* @__PURE__ */ jsxs5("div", { id, className: "tb-fr-body", children: [
|
|
1544
1550
|
/* @__PURE__ */ jsx12("button", { type: "button", className: "tb-fr-close", "data-tb-drawer-close": "", "aria-label": "Close", children: /* @__PURE__ */ jsx12("span", { "aria-hidden": "true", children: "\xD7" }) }),
|
|
1545
1551
|
children
|
|
@@ -2032,7 +2038,34 @@ function renderSection(section, ctx, registry, nested = false) {
|
|
|
2032
2038
|
variant.devices.join("-")
|
|
2033
2039
|
);
|
|
2034
2040
|
});
|
|
2035
|
-
|
|
2041
|
+
const preloads = backgroundPreloads(section, ctx);
|
|
2042
|
+
return gated(section, ctx, marker === null && preloads.length === 0 ? copies : [...marker === null ? [] : [marker], ...preloads, ...copies]);
|
|
2043
|
+
}
|
|
2044
|
+
function backgroundPreloads(section, ctx) {
|
|
2045
|
+
if (ctx.edit !== void 0) return [];
|
|
2046
|
+
const on = (device) => resolveResponsive3(section.props, section.responsive, device);
|
|
2047
|
+
const desktopBg = on("desktop").background;
|
|
2048
|
+
const phoneBg = on("phone").background;
|
|
2049
|
+
if (desktopBg?.priority !== true && phoneBg?.priority !== true) return [];
|
|
2050
|
+
const main = backgroundAsset(desktopBg, "desktop", ctx.assets, ctx.mediaOrigin) ?? null;
|
|
2051
|
+
const mobile = backgroundAsset(phoneBg, "phone", ctx.assets, ctx.mediaOrigin) ?? null;
|
|
2052
|
+
const link = (key, asset, media) => /* @__PURE__ */ jsx16(
|
|
2053
|
+
"link",
|
|
2054
|
+
{
|
|
2055
|
+
rel: "preload",
|
|
2056
|
+
as: "image",
|
|
2057
|
+
href: asset.url,
|
|
2058
|
+
fetchPriority: "high",
|
|
2059
|
+
...media === void 0 ? {} : { media }
|
|
2060
|
+
},
|
|
2061
|
+
key
|
|
2062
|
+
);
|
|
2063
|
+
if (main === null && mobile === null) return [];
|
|
2064
|
+
if (main !== null && mobile !== null && main.url === mobile.url) return [link(`bgp-${section.id}`, main, void 0)];
|
|
2065
|
+
return [
|
|
2066
|
+
...main === null ? [] : [link(`bgp-${section.id}`, main, "(min-width:768px)")],
|
|
2067
|
+
...mobile === null ? [] : [link(`bgpm-${section.id}`, mobile, "(max-width:767px)")]
|
|
2068
|
+
];
|
|
2036
2069
|
}
|
|
2037
2070
|
function needsRuntime(doc) {
|
|
2038
2071
|
let found = false;
|
|
@@ -2097,16 +2130,19 @@ function isFrozenAsset(value) {
|
|
|
2097
2130
|
const v = value;
|
|
2098
2131
|
return typeof v.url === "string" && typeof v.width === "number" && typeof v.height === "number" && Array.isArray(v.variants);
|
|
2099
2132
|
}
|
|
2133
|
+
function assetSrcSet(asset, mediaOrigin) {
|
|
2134
|
+
return asset.variants.flatMap((variant) => {
|
|
2135
|
+
const url = safeUrl4(variant.url, "src", { mediaOrigin });
|
|
2136
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
2137
|
+
}).join(", ");
|
|
2138
|
+
}
|
|
2100
2139
|
function AssetImage(props) {
|
|
2101
|
-
const { asset, alt, sizes, className, loading = "lazy", style, mediaOrigin } = props;
|
|
2140
|
+
const { asset, alt, sizes, className, loading = "lazy", fetchPriority, reserveSpace = true, style, mediaOrigin } = props;
|
|
2102
2141
|
const href = (url) => safeUrl4(url, "src", { mediaOrigin });
|
|
2103
2142
|
if (!isFrozenAsset(asset)) return null;
|
|
2104
2143
|
const src = href(asset.url);
|
|
2105
2144
|
if (src === null) return null;
|
|
2106
|
-
const srcSet = asset
|
|
2107
|
-
const url = href(variant.url);
|
|
2108
|
-
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
2109
|
-
}).join(", ");
|
|
2145
|
+
const srcSet = assetSrcSet(asset, mediaOrigin);
|
|
2110
2146
|
return /* @__PURE__ */ jsx17(
|
|
2111
2147
|
"img",
|
|
2112
2148
|
{
|
|
@@ -2116,15 +2152,16 @@ function AssetImage(props) {
|
|
|
2116
2152
|
height: asset.height,
|
|
2117
2153
|
alt,
|
|
2118
2154
|
loading,
|
|
2155
|
+
...fetchPriority === void 0 ? {} : { fetchPriority },
|
|
2119
2156
|
decoding: "async",
|
|
2120
2157
|
...className === void 0 ? {} : { className },
|
|
2121
|
-
style: { aspectRatio: `${String(asset.width)} / ${String(asset.height)}
|
|
2158
|
+
style: { ...reserveSpace ? { aspectRatio: `${String(asset.width)} / ${String(asset.height)}` } : {}, ...style }
|
|
2122
2159
|
}
|
|
2123
2160
|
);
|
|
2124
2161
|
}
|
|
2125
2162
|
|
|
2126
2163
|
// src/provider.tsx
|
|
2127
|
-
import { Suspense as Suspense5, useCallback, useContext as useContext3, useMemo as useMemo2, useRef as
|
|
2164
|
+
import { Suspense as Suspense5, useCallback, useContext as useContext3, useMemo as useMemo2, useRef as useRef8 } from "react";
|
|
2128
2165
|
import { createBuilderClient } from "@usethrottle/builder";
|
|
2129
2166
|
import { AppearanceContext, SiteDesignProvider, SlotOutletProvider, ThrottleUIProvider, useAppearanceProviderValue } from "@usethrottle/ui";
|
|
2130
2167
|
|
|
@@ -2259,7 +2296,7 @@ function Redirect({ to }) {
|
|
|
2259
2296
|
import { createRegistry } from "@usethrottle/builder-schema";
|
|
2260
2297
|
|
|
2261
2298
|
// src/basics/index.ts
|
|
2262
|
-
import { BASIC_WIDGET_DEFINITIONS as
|
|
2299
|
+
import { BASIC_WIDGET_DEFINITIONS as BASIC_WIDGET_DEFINITIONS5 } from "@usethrottle/builder-schema";
|
|
2263
2300
|
|
|
2264
2301
|
// src/basics/announcement.tsx
|
|
2265
2302
|
import { useEffect as useEffect7, useState as useState3 } from "react";
|
|
@@ -2432,13 +2469,29 @@ function Announcement({ props, mediaOrigin, editMode }) {
|
|
|
2432
2469
|
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2433
2470
|
var STYLES = ["primary", "secondary", "outline", "link"];
|
|
2434
2471
|
var SIZES = ["s", "m", "l"];
|
|
2472
|
+
var REL = {
|
|
2473
|
+
nofollow: ["nofollow"],
|
|
2474
|
+
sponsored: ["sponsored"],
|
|
2475
|
+
ugc: ["ugc"],
|
|
2476
|
+
"nofollow-sponsored": ["nofollow", "sponsored"],
|
|
2477
|
+
"nofollow-ugc": ["nofollow", "ugc"],
|
|
2478
|
+
"sponsored-ugc": ["sponsored", "ugc"],
|
|
2479
|
+
"nofollow-sponsored-ugc": ["nofollow", "sponsored", "ugc"]
|
|
2480
|
+
};
|
|
2435
2481
|
function Button({ props, mediaOrigin, inlineEdit }) {
|
|
2436
2482
|
const href = hrefOf(props.link, mediaOrigin);
|
|
2437
2483
|
const className = `tb-b-button tb-b-button--${oneOf(props.style, STYLES, "primary")} tb-b-button--${oneOf(props.size, SIZES, "m")}`;
|
|
2438
|
-
const
|
|
2484
|
+
const label2 = inlineEdit?.("label") ?? str(props.label) ?? "";
|
|
2485
|
+
const tokens = [];
|
|
2486
|
+
if (href !== null) {
|
|
2487
|
+
const rel = typeof props.rel === "string" && Object.hasOwn(REL, props.rel) ? REL[props.rel] : void 0;
|
|
2488
|
+
if (rel !== void 0) tokens.push(...rel);
|
|
2489
|
+
if (props.newTab === true) tokens.push("noopener");
|
|
2490
|
+
}
|
|
2491
|
+
const linkAttrs = href === null ? {} : { href, ...props.newTab === true ? { target: "_blank" } : {}, ...tokens.length === 0 ? {} : { rel: tokens.join(" ") } };
|
|
2439
2492
|
return /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
2440
2493
|
/* @__PURE__ */ jsx21(BasicStyles, {}),
|
|
2441
|
-
/* @__PURE__ */ jsx21("div", { className: "tb-b-button-wrap", children: /* @__PURE__ */ jsx21("a", { className, ...
|
|
2494
|
+
/* @__PURE__ */ jsx21("div", { className: "tb-b-button-wrap", children: /* @__PURE__ */ jsx21("a", { className, ...linkAttrs, children: label2 }) })
|
|
2442
2495
|
] });
|
|
2443
2496
|
}
|
|
2444
2497
|
|
|
@@ -2625,16 +2678,42 @@ var RULES2 = [
|
|
|
2625
2678
|
{ key: "radius", property: "--bx-radius", values: { none: "0", s: "4px", m: "8px", l: "16px", full: "9999px" } },
|
|
2626
2679
|
{ key: "fit", property: "--bx-fit", values: { cover: "cover", contain: "contain" } }
|
|
2627
2680
|
];
|
|
2681
|
+
var NODE_ID = /^[a-z0-9]{8,24}(-[a-z0-9]{8,24})?$/;
|
|
2682
|
+
var RATIOS = { "1:1": "1 / 1", "4:3": "4 / 3", "3:4": "3 / 4", "16:9": "16 / 9" };
|
|
2628
2683
|
function Image({ node, props, mediaOrigin, editMode }) {
|
|
2629
2684
|
const href = hrefOf(props.link, mediaOrigin);
|
|
2630
2685
|
const decorative = props.decorative === true;
|
|
2631
2686
|
const alt = decorative ? "" : typeof props.alt === "string" ? props.alt : "";
|
|
2632
2687
|
const asset = isFrozenAsset(props.image) ? props.image : void 0;
|
|
2633
|
-
const
|
|
2688
|
+
const priority = props.priority === true;
|
|
2689
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS, props.ratio) ? RATIOS[props.ratio] : void 0;
|
|
2690
|
+
const sizes = "(max-width: 767px) 100vw, 50vw";
|
|
2691
|
+
const mobile = isFrozenAsset(props.mobileImage) ? props.mobileImage : void 0;
|
|
2692
|
+
const mobileSrc = mobile === void 0 ? null : safeUrl8(mobile.url, "src", { mediaOrigin });
|
|
2693
|
+
const directed = mobile !== void 0 && mobileSrc !== null && asset !== void 0;
|
|
2694
|
+
const perBreakpoint = directed && ratio === void 0;
|
|
2695
|
+
const raw = /* @__PURE__ */ jsx27(
|
|
2696
|
+
AssetImage,
|
|
2697
|
+
{
|
|
2698
|
+
asset,
|
|
2699
|
+
mediaOrigin,
|
|
2700
|
+
alt,
|
|
2701
|
+
className: "tb-b-img",
|
|
2702
|
+
sizes,
|
|
2703
|
+
reserveSpace: !perBreakpoint,
|
|
2704
|
+
...priority ? { loading: "eager", fetchPriority: "high" } : {},
|
|
2705
|
+
...ratio === void 0 ? {} : { style: { aspectRatio: ratio } }
|
|
2706
|
+
}
|
|
2707
|
+
);
|
|
2708
|
+
const reserve = perBreakpoint && asset !== void 0 && mobile !== void 0 && NODE_ID.test(node.id) && [asset.width, asset.height, mobile.width, mobile.height].every((n) => Number.isInteger(n) && n > 0) ? `[data-b-id="${node.id}"] .tb-b-img{aspect-ratio:${String(asset.width)} / ${String(asset.height)}}@media (max-width:767px){[data-b-id="${node.id}"] .tb-b-img{aspect-ratio:${String(mobile.width)} / ${String(mobile.height)}}}` : "";
|
|
2709
|
+
const image = directed ? /* @__PURE__ */ jsxs17("picture", { children: [
|
|
2710
|
+
/* @__PURE__ */ jsx27("source", { media: "(max-width:767px)", srcSet: assetSrcSet(mobile, mediaOrigin) || mobileSrc, sizes: "100vw", width: mobile.width, height: mobile.height }),
|
|
2711
|
+
raw
|
|
2712
|
+
] }) : raw;
|
|
2634
2713
|
const shown2 = asset !== void 0 && safeUrl8(asset.url, "src", { mediaOrigin }) !== null;
|
|
2635
2714
|
return /* @__PURE__ */ jsxs17(Fragment13, { children: [
|
|
2636
2715
|
/* @__PURE__ */ jsx27(BasicStyles, {}),
|
|
2637
|
-
/* @__PURE__ */ jsx27(WidgetStyle, { css: enumCss(node, RULES2) }),
|
|
2716
|
+
/* @__PURE__ */ jsx27(WidgetStyle, { css: enumCss(node, RULES2) + reserve }),
|
|
2638
2717
|
shown2 ? /* @__PURE__ */ jsx27("div", { className: "tb-b-image", children: /* @__PURE__ */ jsx27("div", { className: "tb-b-image-box", children: href === null ? image : /* @__PURE__ */ jsx27("a", { href, children: image }) }) }) : /* @__PURE__ */ jsx27(Placeholder, { editMode, children: asset === void 0 ? "Choose an image" : "Image unavailable" })
|
|
2639
2718
|
] });
|
|
2640
2719
|
}
|
|
@@ -2697,7 +2776,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2697
2776
|
const menus = design?.menus;
|
|
2698
2777
|
const items = menus !== void 0 && Object.hasOwn(menus, name) ? menus[name] : void 0;
|
|
2699
2778
|
const strings = design?.strings;
|
|
2700
|
-
const
|
|
2779
|
+
const label2 = (strings !== void 0 && Object.hasOwn(strings, "nav.menu") ? str(strings["nav.menu"]) : void 0) ?? SITE_STRING_DEFAULTS4["nav.menu"];
|
|
2701
2780
|
if (items === void 0 || items.length === 0) {
|
|
2702
2781
|
return /* @__PURE__ */ jsxs19(Fragment15, { children: [
|
|
2703
2782
|
/* @__PURE__ */ jsx29(BasicStyles, {}),
|
|
@@ -2717,7 +2796,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2717
2796
|
"nav",
|
|
2718
2797
|
{
|
|
2719
2798
|
className: `tb-b-menu tb-b-menu--${layout}${layout === "vertical" ? "" : " tb-b-menu--h"}`,
|
|
2720
|
-
"aria-label":
|
|
2799
|
+
"aria-label": label2,
|
|
2721
2800
|
"data-open": drawer ? String(open) : void 0,
|
|
2722
2801
|
onKeyDown: drawer ? onKeyDown : void 0,
|
|
2723
2802
|
children: [
|
|
@@ -2730,7 +2809,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2730
2809
|
"aria-expanded": open,
|
|
2731
2810
|
"aria-controls": listId,
|
|
2732
2811
|
onClick: () => setOpen2((value) => !value),
|
|
2733
|
-
children: /* @__PURE__ */ jsx29(Icon2, { name: open ? "close" : "menu", size: 24, label })
|
|
2812
|
+
children: /* @__PURE__ */ jsx29(Icon2, { name: open ? "close" : "menu", size: 24, label: label2 })
|
|
2734
2813
|
}
|
|
2735
2814
|
),
|
|
2736
2815
|
/* @__PURE__ */ jsx29(List, { items, mediaOrigin, id: listId, ...drawer ? { onNavigate: () => setOpen2(false) } : {} })
|
|
@@ -2964,11 +3043,58 @@ function Text({ props, mediaOrigin, editMode, inlineEdit }) {
|
|
|
2964
3043
|
|
|
2965
3044
|
// src/basics/video.tsx
|
|
2966
3045
|
import { useState as useState5 } from "react";
|
|
3046
|
+
import { safeUrl as safeUrl12 } from "@usethrottle/builder-schema";
|
|
2967
3047
|
import { Icon as Icon3 } from "@usethrottle/ui";
|
|
3048
|
+
|
|
3049
|
+
// src/server/jsonld.ts
|
|
3050
|
+
var CONTEXT = "https://schema.org";
|
|
3051
|
+
var isHttp = (value) => typeof value === "string" && /^https?:\/\/[^\s]+$/iu.test(value);
|
|
3052
|
+
function breadcrumbJsonLd(items) {
|
|
3053
|
+
return {
|
|
3054
|
+
"@context": CONTEXT,
|
|
3055
|
+
"@type": "BreadcrumbList",
|
|
3056
|
+
itemListElement: items.map((item, index) => ({
|
|
3057
|
+
"@type": "ListItem",
|
|
3058
|
+
position: index + 1,
|
|
3059
|
+
name: item.name,
|
|
3060
|
+
item: item.url
|
|
3061
|
+
}))
|
|
3062
|
+
};
|
|
3063
|
+
}
|
|
3064
|
+
function faqJsonLd(items) {
|
|
3065
|
+
return {
|
|
3066
|
+
"@context": CONTEXT,
|
|
3067
|
+
"@type": "FAQPage",
|
|
3068
|
+
mainEntity: items.map((item) => ({
|
|
3069
|
+
"@type": "Question",
|
|
3070
|
+
name: item.question,
|
|
3071
|
+
acceptedAnswer: { "@type": "Answer", text: item.answer }
|
|
3072
|
+
}))
|
|
3073
|
+
};
|
|
3074
|
+
}
|
|
3075
|
+
function videoJsonLd(input) {
|
|
3076
|
+
return {
|
|
3077
|
+
"@context": CONTEXT,
|
|
3078
|
+
"@type": "VideoObject",
|
|
3079
|
+
name: input.name,
|
|
3080
|
+
...input.description === void 0 || input.description === "" ? {} : { description: input.description },
|
|
3081
|
+
thumbnailUrl: [input.thumbnailUrl],
|
|
3082
|
+
uploadDate: input.uploadDate,
|
|
3083
|
+
...isHttp(input.embedUrl) ? { embedUrl: input.embedUrl } : {},
|
|
3084
|
+
...isHttp(input.contentUrl) ? { contentUrl: input.contentUrl } : {}
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
function jsonLdString(value) {
|
|
3088
|
+
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
// src/basics/video.tsx
|
|
2968
3092
|
import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2969
3093
|
var RULES3 = [
|
|
2970
3094
|
{ key: "ratio", property: "--bx-ratio", values: { "16:9": "16 / 9", "4:3": "4 / 3", "1:1": "1 / 1", "9:16": "9 / 16" } }
|
|
2971
3095
|
];
|
|
3096
|
+
var POSTER_STYLE = { position: "absolute", inset: 0, inlineSize: "100%", blockSize: "100%", objectFit: "cover" };
|
|
3097
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2}))?$/;
|
|
2972
3098
|
var YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
|
|
2973
3099
|
var VIMEO_ID = /^\d{5,12}$/;
|
|
2974
3100
|
var YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
|
|
@@ -3004,22 +3130,62 @@ function parseVideoUrl(input) {
|
|
|
3004
3130
|
function embedSrc(video, muted) {
|
|
3005
3131
|
return video.provider === "youtube" ? `https://www.youtube-nocookie.com/embed/${video.id}?autoplay=1&rel=0&playsinline=1${muted ? "&mute=1" : ""}` : `https://player.vimeo.com/video/${video.id}?autoplay=1&dnt=1${muted ? "&muted=1" : ""}`;
|
|
3006
3132
|
}
|
|
3007
|
-
function Video({ node, props, editMode }) {
|
|
3133
|
+
function Video({ node, props, mediaOrigin, editMode }) {
|
|
3008
3134
|
const [loaded, setLoaded] = useState5(false);
|
|
3009
3135
|
const video = parseVideoUrl(str(props.url) ?? "");
|
|
3136
|
+
const title = str(props.title);
|
|
3137
|
+
const poster = isFrozenAsset(props.poster) ? props.poster : void 0;
|
|
3138
|
+
const posterSrc = poster === void 0 ? null : safeUrl12(poster.url, "src", { mediaOrigin });
|
|
3139
|
+
const priority = props.priority === true;
|
|
3140
|
+
const uploadDate = str(props.uploadDate);
|
|
3141
|
+
const jsonLd = video !== null && title !== void 0 && posterSrc !== null && uploadDate !== void 0 && ISO_DATE.test(uploadDate) && !Number.isNaN(Date.parse(uploadDate)) ? jsonLdString(
|
|
3142
|
+
videoJsonLd({
|
|
3143
|
+
name: title,
|
|
3144
|
+
thumbnailUrl: posterSrc,
|
|
3145
|
+
uploadDate,
|
|
3146
|
+
description: str(props.description),
|
|
3147
|
+
embedUrl: embedSrc(video, false).split("?")[0]
|
|
3148
|
+
})
|
|
3149
|
+
) : null;
|
|
3010
3150
|
return /* @__PURE__ */ jsxs23(Fragment19, { children: [
|
|
3011
3151
|
/* @__PURE__ */ jsx33(BasicStyles, {}),
|
|
3012
3152
|
/* @__PURE__ */ jsx33(WidgetStyle, { css: enumCss(node, RULES3) }),
|
|
3013
|
-
video === null ? /* @__PURE__ */ jsx33(Placeholder, { editMode, children: "Paste a YouTube or Vimeo link" }) : /* @__PURE__ */
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3153
|
+
video === null ? /* @__PURE__ */ jsx33(Placeholder, { editMode, children: "Paste a YouTube or Vimeo link" }) : /* @__PURE__ */ jsxs23("div", { className: "tb-b-video", "data-provider": video.provider, children: [
|
|
3154
|
+
loaded && !editMode ? /* @__PURE__ */ jsx33(
|
|
3155
|
+
"iframe",
|
|
3156
|
+
{
|
|
3157
|
+
src: embedSrc(video, props.autoplayMuted === true),
|
|
3158
|
+
title: title ?? "Video",
|
|
3159
|
+
allow: "autoplay; encrypted-media; picture-in-picture; fullscreen",
|
|
3160
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
3161
|
+
sandbox: "allow-scripts allow-same-origin allow-presentation allow-popups"
|
|
3162
|
+
}
|
|
3163
|
+
) : /* @__PURE__ */ jsxs23(Fragment19, { children: [
|
|
3164
|
+
posterSrc !== null && /* @__PURE__ */ jsx33(
|
|
3165
|
+
AssetImage,
|
|
3166
|
+
{
|
|
3167
|
+
asset: poster,
|
|
3168
|
+
mediaOrigin,
|
|
3169
|
+
alt: "",
|
|
3170
|
+
className: "tb-b-video-poster",
|
|
3171
|
+
style: POSTER_STYLE,
|
|
3172
|
+
sizes: "(max-width: 767px) 100vw, 50vw",
|
|
3173
|
+
...priority ? { loading: "eager", fetchPriority: "high" } : {}
|
|
3174
|
+
}
|
|
3175
|
+
),
|
|
3176
|
+
/* @__PURE__ */ jsx33(
|
|
3177
|
+
"button",
|
|
3178
|
+
{
|
|
3179
|
+
type: "button",
|
|
3180
|
+
className: "tb-b-play",
|
|
3181
|
+
"aria-label": title === void 0 ? "Play video" : `Play video: ${title}`,
|
|
3182
|
+
onClick: () => setLoaded(true),
|
|
3183
|
+
children: /* @__PURE__ */ jsx33("span", { children: /* @__PURE__ */ jsx33(Icon3, { name: "play", size: 28 }) })
|
|
3184
|
+
}
|
|
3185
|
+
)
|
|
3186
|
+
] }),
|
|
3187
|
+
jsonLd !== null && /* @__PURE__ */ jsx33("script", { type: "application/ld+json", children: jsonLd })
|
|
3188
|
+
] })
|
|
3023
3189
|
] });
|
|
3024
3190
|
}
|
|
3025
3191
|
|
|
@@ -3029,7 +3195,7 @@ import { Icon as Icon5, useSiteDesign as useSiteDesign6 } from "@usethrottle/ui"
|
|
|
3029
3195
|
import { BASIC_WIDGET_DEFINITIONS as BASIC_WIDGET_DEFINITIONS2, SITE_STRING_DEFAULTS as SITE_STRING_DEFAULTS6 } from "@usethrottle/builder-schema";
|
|
3030
3196
|
|
|
3031
3197
|
// src/theme.ts
|
|
3032
|
-
import { SITE_FONTS, eligibleMessages, safeUrl as
|
|
3198
|
+
import { SITE_FONTS, eligibleMessages, safeUrl as safeUrl13, sanitizeSiteCss } from "@usethrottle/builder-schema";
|
|
3033
3199
|
import { PRESET_NAMES, PRESET_TOKENS } from "@usethrottle/ui/presets";
|
|
3034
3200
|
var isRecord5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3035
3201
|
var str2 = (v) => typeof v === "string" && v !== "" ? v : void 0;
|
|
@@ -3134,7 +3300,7 @@ function customCssDeliveryOf(settings, answerTheme, mediaOrigin = "") {
|
|
|
3134
3300
|
const theme = isRecord5(settings.theme) ? settings.theme : {};
|
|
3135
3301
|
const raw = typeof theme.customCss === "string" ? theme.customCss : "";
|
|
3136
3302
|
const candidate = isRecord5(answerTheme) ? answerTheme.customCssHref : void 0;
|
|
3137
|
-
const href = typeof candidate === "string" && /^https:\/\/[^\s/\\]+\/[^\s\\]*$/iu.test(candidate) &&
|
|
3303
|
+
const href = typeof candidate === "string" && /^https:\/\/[^\s/\\]+\/[^\s\\]*$/iu.test(candidate) && safeUrl13(candidate, "href", { mediaOrigin: "" }) !== null && new URL(candidate).pathname.includes("/v1/css/") ? candidate : void 0;
|
|
3138
3304
|
const inline2 = customCssOf(settings, mediaOrigin);
|
|
3139
3305
|
const small = new TextEncoder().encode(inline2).length <= CUSTOM_CSS_INLINE_MAX_BYTES;
|
|
3140
3306
|
if (href !== void 0 && raw.trim() === "") return { inline: "", href };
|
|
@@ -3150,14 +3316,14 @@ function makeResolveLink(settings, packs) {
|
|
|
3150
3316
|
return (target2) => {
|
|
3151
3317
|
for (const pack of packs) {
|
|
3152
3318
|
const href = pack.linkTargets?.resolve(target2) ?? null;
|
|
3153
|
-
if (href !== null) return
|
|
3319
|
+
if (href !== null) return safeUrl13(href, "href", { mediaOrigin: "" });
|
|
3154
3320
|
}
|
|
3155
|
-
if (target2.kind === "url") return
|
|
3156
|
-
if (typeof target2.href === "string") return
|
|
3321
|
+
if (target2.kind === "url") return safeUrl13(target2.href, "href", { mediaOrigin: "" });
|
|
3322
|
+
if (typeof target2.href === "string") return safeUrl13(target2.href, "href", { mediaOrigin: "" });
|
|
3157
3323
|
if (target2.kind === "page") {
|
|
3158
3324
|
const slug2 = str2(target2.slug) ?? str2(target2.handle);
|
|
3159
3325
|
if (slug2 !== void 0 && /^[A-Za-z0-9._~-]{1,200}$/.test(slug2)) {
|
|
3160
|
-
return
|
|
3326
|
+
return safeUrl13(pageRoute.replace("{handle}", slug2), "href", { mediaOrigin: "" });
|
|
3161
3327
|
}
|
|
3162
3328
|
}
|
|
3163
3329
|
return null;
|
|
@@ -3169,13 +3335,13 @@ function menuItems(items, resolve, depth = 0) {
|
|
|
3169
3335
|
const out = [];
|
|
3170
3336
|
for (const item of items) {
|
|
3171
3337
|
if (!isRecord5(item) || !isRecord5(item.target) || typeof item.target.kind !== "string") continue;
|
|
3172
|
-
const
|
|
3338
|
+
const label2 = str2(item.label);
|
|
3173
3339
|
const href = resolve(item.target);
|
|
3174
|
-
if (
|
|
3340
|
+
if (label2 === void 0 || href === null) continue;
|
|
3175
3341
|
const kind = MENU_KINDS.has(item.target.kind) ? item.target.kind : void 0;
|
|
3176
3342
|
const children = menuItems(item.children, resolve, depth + 1);
|
|
3177
3343
|
out.push({
|
|
3178
|
-
label,
|
|
3344
|
+
label: label2,
|
|
3179
3345
|
href,
|
|
3180
3346
|
...kind === void 0 ? {} : { kind },
|
|
3181
3347
|
...children.length === 0 ? {} : { children }
|
|
@@ -3223,7 +3389,7 @@ function serverMessages(messages, now, page) {
|
|
|
3223
3389
|
}
|
|
3224
3390
|
var assetUrl = (v, mediaOrigin) => {
|
|
3225
3391
|
const raw = typeof v === "string" ? v : isRecord5(v) ? v.url : void 0;
|
|
3226
|
-
return typeof raw === "string" ?
|
|
3392
|
+
return typeof raw === "string" ? safeUrl13(raw, "src", { mediaOrigin }) ?? void 0 : void 0;
|
|
3227
3393
|
};
|
|
3228
3394
|
function partClassesOf(settings) {
|
|
3229
3395
|
const theme = isRecord5(settings.theme) ? settings.theme : {};
|
|
@@ -3281,7 +3447,7 @@ function siteDesignOf(settings, resolve, pageOutlet, mediaOrigin, locale, now =
|
|
|
3281
3447
|
// src/basics/v2/menu-v2.tsx
|
|
3282
3448
|
import { useEffect as useEffect8, useId as useId2 } from "react";
|
|
3283
3449
|
import { Icon as Icon4, useSiteDesign as useSiteDesign5 } from "@usethrottle/ui";
|
|
3284
|
-
import { MB_BASIC_WIDGET_DEFINITIONS, SITE_STRING_DEFAULTS as SITE_STRING_DEFAULTS5, expandMenu, safeUrl as
|
|
3450
|
+
import { MB_BASIC_WIDGET_DEFINITIONS, SITE_STRING_DEFAULTS as SITE_STRING_DEFAULTS5, expandMenu, safeUrl as safeUrl14, sectionNodeSchema as sectionNodeSchema2 } from "@usethrottle/builder-schema";
|
|
3285
3451
|
|
|
3286
3452
|
// src/interactions/menu-runtime.ts
|
|
3287
3453
|
var holds3 = 0;
|
|
@@ -3349,8 +3515,8 @@ function setDrawer(nav, open) {
|
|
|
3349
3515
|
if (open) {
|
|
3350
3516
|
list2.setAttribute("role", "dialog");
|
|
3351
3517
|
list2.setAttribute("aria-modal", "true");
|
|
3352
|
-
const
|
|
3353
|
-
if (
|
|
3518
|
+
const label2 = nav.getAttribute("aria-label");
|
|
3519
|
+
if (label2 !== null) list2.setAttribute("aria-label", label2);
|
|
3354
3520
|
focusablesOf(list2)[0]?.focus();
|
|
3355
3521
|
} else {
|
|
3356
3522
|
list2.removeAttribute("role");
|
|
@@ -3470,16 +3636,16 @@ function makeLink(builder, own, mediaOrigin) {
|
|
|
3470
3636
|
const targets = builder?.linkTargets;
|
|
3471
3637
|
const fallback = own ?? builder?.resolveLink;
|
|
3472
3638
|
return (target2) => {
|
|
3473
|
-
if (target2.kind === "url") return
|
|
3639
|
+
if (target2.kind === "url") return safeUrl14(target2.href, "href", { mediaOrigin });
|
|
3474
3640
|
if (targets !== void 0 && typeof target2.id === "string") {
|
|
3475
3641
|
const key = `${String(target2.kind)}:${target2.id}`;
|
|
3476
3642
|
if (Object.hasOwn(targets, key)) {
|
|
3477
3643
|
const known = targets[key];
|
|
3478
|
-
return typeof known === "string" ?
|
|
3644
|
+
return typeof known === "string" ? safeUrl14(known, "href", { mediaOrigin }) : null;
|
|
3479
3645
|
}
|
|
3480
3646
|
}
|
|
3481
3647
|
const raw = fallback?.(target2) ?? null;
|
|
3482
|
-
return raw === null ? null :
|
|
3648
|
+
return raw === null ? null : safeUrl14(raw, "href", { mediaOrigin });
|
|
3483
3649
|
};
|
|
3484
3650
|
}
|
|
3485
3651
|
function megaOf(value, locale) {
|
|
@@ -3499,12 +3665,12 @@ function build(raw, level, b) {
|
|
|
3499
3665
|
raw.forEach((entry, index) => {
|
|
3500
3666
|
if (!isRecord4(entry) || !isRecord4(entry.target)) return;
|
|
3501
3667
|
const target2 = entry.target;
|
|
3502
|
-
const
|
|
3503
|
-
if (
|
|
3668
|
+
const label2 = localized(entry.label, b.r.locale);
|
|
3669
|
+
if (label2 === void 0) return;
|
|
3504
3670
|
out.push({
|
|
3505
3671
|
key: typeof entry.id === "string" ? entry.id : String(index),
|
|
3506
|
-
label,
|
|
3507
|
-
href: target2.kind === "category" && typeof entry.url === "string" ?
|
|
3672
|
+
label: label2,
|
|
3673
|
+
href: target2.kind === "category" && typeof entry.url === "string" ? safeUrl14(entry.url, "href", { mediaOrigin: b.r.mediaOrigin }) : b.r.link(target2),
|
|
3508
3674
|
newTab: entry.newTab === true,
|
|
3509
3675
|
classes: Array.isArray(entry.cssClass) ? entry.cssClass.filter((c) => typeof c === "string" && CLASS_RE.test(c)) : [],
|
|
3510
3676
|
description: localized(entry.description, b.r.locale),
|
|
@@ -3521,7 +3687,7 @@ function fromDesign(items, level, r) {
|
|
|
3521
3687
|
return items.map((item, index) => ({
|
|
3522
3688
|
key: String(index),
|
|
3523
3689
|
label: item.label,
|
|
3524
|
-
href:
|
|
3690
|
+
href: safeUrl14(item.href, "href", { mediaOrigin: r.mediaOrigin }),
|
|
3525
3691
|
newTab: false,
|
|
3526
3692
|
classes: [],
|
|
3527
3693
|
description: void 0,
|
|
@@ -3537,7 +3703,7 @@ var Extras = ({ item, describe }) => /* @__PURE__ */ jsxs24(Fragment20, { childr
|
|
|
3537
3703
|
item.badge === void 0 ? null : /* @__PURE__ */ jsx34("span", { className: "tb-mm-badge", children: item.badge }),
|
|
3538
3704
|
describe && item.description !== void 0 ? /* @__PURE__ */ jsx34("span", { className: "tb-mm-desc", children: item.description }) : null
|
|
3539
3705
|
] });
|
|
3540
|
-
function FeaturedPanel({ featured, label, ctx }) {
|
|
3706
|
+
function FeaturedPanel({ featured, label: label2, ctx }) {
|
|
3541
3707
|
const { builder, props } = ctx;
|
|
3542
3708
|
const site = builder?.site;
|
|
3543
3709
|
if (builder === null || site === void 0 || site.status !== "ok") return null;
|
|
@@ -3571,7 +3737,7 @@ function FeaturedPanel({ featured, label, ctx }) {
|
|
|
3571
3737
|
}
|
|
3572
3738
|
if (!isFrozenAsset(asset)) return null;
|
|
3573
3739
|
const href = featured.link === null ? null : makeLink(builder, props.resolveLink, props.mediaOrigin)(featured.link);
|
|
3574
|
-
const image = /* @__PURE__ */ jsx34(AssetImage, { asset, mediaOrigin: props.mediaOrigin, alt: href === null ? featured.caption : featured.caption ||
|
|
3740
|
+
const image = /* @__PURE__ */ jsx34(AssetImage, { asset, mediaOrigin: props.mediaOrigin, alt: href === null ? featured.caption : featured.caption || label2 });
|
|
3575
3741
|
return /* @__PURE__ */ jsxs24("figure", { className: "tb-mm-feat", children: [
|
|
3576
3742
|
href === null ? image : /* @__PURE__ */ jsx34("a", { href, children: image }),
|
|
3577
3743
|
featured.caption === "" ? null : /* @__PURE__ */ jsx34("figcaption", { children: featured.caption })
|
|
@@ -3626,11 +3792,11 @@ var part = (key, extra) => ({
|
|
|
3626
3792
|
className: [`tsf-${key}`, extra].filter(Boolean).join(" "),
|
|
3627
3793
|
"data-throttle-part": key
|
|
3628
3794
|
});
|
|
3629
|
-
function StorefrontNav({ items, label, listId, ctx, className, menu }) {
|
|
3795
|
+
function StorefrontNav({ items, label: label2, listId, ctx, className, menu }) {
|
|
3630
3796
|
const categories = items.some((item) => item.handle !== void 0);
|
|
3631
3797
|
const handle = (item, parent) => item.handle === void 0 ? {} : { "data-category-handle": item.handle, ...categories ? { "data-category-parent": parent } : {} };
|
|
3632
3798
|
const link = (item) => item.href === null ? /* @__PURE__ */ jsx34("span", { ...part("category-nav-link", "tb-mm-text"), children: item.label }) : /* @__PURE__ */ jsx34("a", { ...part("category-nav-link"), href: item.href, ...item.newTab ? { target: "_blank", rel: "noopener noreferrer" } : {}, children: item.label });
|
|
3633
|
-
return /* @__PURE__ */ jsx34("nav", { ...part("category-nav", className), "aria-label":
|
|
3799
|
+
return /* @__PURE__ */ jsx34("nav", { ...part("category-nav", className), "aria-label": label2, ...categories ? {} : { "data-menu": menu }, children: /* @__PURE__ */ jsx34("ul", { ...part("category-nav-list"), children: items.map((item) => {
|
|
3634
3800
|
const sub = item.children.length > 0;
|
|
3635
3801
|
const panelId = `${listId}-${item.key.replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
3636
3802
|
return /* @__PURE__ */ jsxs24("li", { ...part("category-nav-item", item.classes.join(" ")), "data-nav-top": "", ...sub ? { "data-tb-i": "" } : {}, ...handle(item, ""), children: [
|
|
@@ -3651,11 +3817,11 @@ function StorefrontNav({ items, label, listId, ctx, className, menu }) {
|
|
|
3651
3817
|
] }, item.key);
|
|
3652
3818
|
}) }) });
|
|
3653
3819
|
}
|
|
3654
|
-
function Nav({ items, label, listId, ctx, className, menu }) {
|
|
3655
|
-
if (ctx.variant === "storefront") return /* @__PURE__ */ jsx34(StorefrontNav, { items, label, listId, ctx, menu, ...className === void 0 ? {} : { className } });
|
|
3820
|
+
function Nav({ items, label: label2, listId, ctx, className, menu }) {
|
|
3821
|
+
if (ctx.variant === "storefront") return /* @__PURE__ */ jsx34(StorefrontNav, { items, label: label2, listId, ctx, menu, ...className === void 0 ? {} : { className } });
|
|
3656
3822
|
const full = { ...ctx, listId };
|
|
3657
|
-
return /* @__PURE__ */ jsxs24("nav", { className: `tb-mm tb-mm--${ctx.mode}${className === void 0 ? "" : ` ${className}`}`, "aria-label":
|
|
3658
|
-
ctx.mode === "drawer" && /* @__PURE__ */ jsx34("button", { type: "button", className: "tb-mm-drawer", "data-tb-drawer": "", "aria-expanded": "false", "aria-controls": listId, children: /* @__PURE__ */ jsx34(Icon4, { name: "menu", size: 24, label }) }),
|
|
3823
|
+
return /* @__PURE__ */ jsxs24("nav", { className: `tb-mm tb-mm--${ctx.mode}${className === void 0 ? "" : ` ${className}`}`, "aria-label": label2, children: [
|
|
3824
|
+
ctx.mode === "drawer" && /* @__PURE__ */ jsx34("button", { type: "button", className: "tb-mm-drawer", "data-tb-drawer": "", "aria-expanded": "false", "aria-controls": listId, children: /* @__PURE__ */ jsx34(Icon4, { name: "menu", size: 24, label: label2 }) }),
|
|
3659
3825
|
/* @__PURE__ */ jsx34(List2, { items, top: { id: listId }, ctx: full })
|
|
3660
3826
|
] });
|
|
3661
3827
|
}
|
|
@@ -3686,7 +3852,7 @@ function MenuV2(props) {
|
|
|
3686
3852
|
}
|
|
3687
3853
|
return fallback;
|
|
3688
3854
|
};
|
|
3689
|
-
const
|
|
3855
|
+
const label2 = word("nav.menu", SITE_STRING_DEFAULTS5["nav.menu"]);
|
|
3690
3856
|
if (items.length === 0 && mobile.length === 0) {
|
|
3691
3857
|
return /* @__PURE__ */ jsxs24(Fragment20, { children: [
|
|
3692
3858
|
/* @__PURE__ */ jsx34(BasicStyles, {}),
|
|
@@ -3694,7 +3860,7 @@ function MenuV2(props) {
|
|
|
3694
3860
|
] });
|
|
3695
3861
|
}
|
|
3696
3862
|
const ctx = { builder, props, mode, variant: oneOf(settings.variant, ["default", "storefront"], "default"), submenu: word("nav.submenu", frameSubmenu(word("frame.nav.submenu", ""))) };
|
|
3697
|
-
const nameOf = (menu) => menu === "header" ?
|
|
3863
|
+
const nameOf = (menu) => menu === "header" ? label2 : `${label2} (${menu})`;
|
|
3698
3864
|
return /* @__PURE__ */ jsxs24(Fragment20, { children: [
|
|
3699
3865
|
/* @__PURE__ */ jsx34(BasicStyles, {}),
|
|
3700
3866
|
/* @__PURE__ */ jsx34("style", { href: "tb-menu-v2", precedence: "throttle", children: MENU_V2_CSS }),
|
|
@@ -3996,36 +4162,7 @@ var announcementV2Widgets = [{ ...definition2, Component: AnnouncementV2 }];
|
|
|
3996
4162
|
|
|
3997
4163
|
// src/basics/v2/breadcrumbs.tsx
|
|
3998
4164
|
import { useSiteDesign as useSiteDesign7 } from "@usethrottle/ui";
|
|
3999
|
-
import { safeUrl as
|
|
4000
|
-
|
|
4001
|
-
// src/server/jsonld.ts
|
|
4002
|
-
var CONTEXT = "https://schema.org";
|
|
4003
|
-
function breadcrumbJsonLd(items) {
|
|
4004
|
-
return {
|
|
4005
|
-
"@context": CONTEXT,
|
|
4006
|
-
"@type": "BreadcrumbList",
|
|
4007
|
-
itemListElement: items.map((item, index) => ({
|
|
4008
|
-
"@type": "ListItem",
|
|
4009
|
-
position: index + 1,
|
|
4010
|
-
name: item.name,
|
|
4011
|
-
item: item.url
|
|
4012
|
-
}))
|
|
4013
|
-
};
|
|
4014
|
-
}
|
|
4015
|
-
function faqJsonLd(items) {
|
|
4016
|
-
return {
|
|
4017
|
-
"@context": CONTEXT,
|
|
4018
|
-
"@type": "FAQPage",
|
|
4019
|
-
mainEntity: items.map((item) => ({
|
|
4020
|
-
"@type": "Question",
|
|
4021
|
-
name: item.question,
|
|
4022
|
-
acceptedAnswer: { "@type": "Answer", text: item.answer }
|
|
4023
|
-
}))
|
|
4024
|
-
};
|
|
4025
|
-
}
|
|
4026
|
-
function jsonLdString(value) {
|
|
4027
|
-
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
4028
|
-
}
|
|
4165
|
+
import { safeUrl as safeUrl15 } from "@usethrottle/builder-schema";
|
|
4029
4166
|
|
|
4030
4167
|
// src/basics/v2/definitions.ts
|
|
4031
4168
|
import { MB_BASIC_WIDGET_DEFINITIONS as MB_BASIC_WIDGET_DEFINITIONS2 } from "@usethrottle/builder-schema";
|
|
@@ -4053,7 +4190,7 @@ function Breadcrumbs({ props, data, mediaOrigin, resolveLink, editMode }) {
|
|
|
4053
4190
|
/* @__PURE__ */ jsx36(Placeholder, { editMode, children: "The trail appears on a product page" })
|
|
4054
4191
|
] });
|
|
4055
4192
|
}
|
|
4056
|
-
const href = (target2) =>
|
|
4193
|
+
const href = (target2) => safeUrl15(resolveLink?.(target2), "href", { mediaOrigin });
|
|
4057
4194
|
const trail = [{ name: str(design?.brand?.storeName?.trim()) ?? "Home", href: "/" }];
|
|
4058
4195
|
for (const step2 of Array.isArray(product.breadcrumbs) ? product.breadcrumbs : []) {
|
|
4059
4196
|
if (!isRecord4(step2) || str(step2.name) === void 0) continue;
|
|
@@ -4087,7 +4224,7 @@ import { sanitizeRichContent } from "@usethrottle/builder-schema";
|
|
|
4087
4224
|
|
|
4088
4225
|
// src/basics/v2/markup.tsx
|
|
4089
4226
|
import { createElement as createElement4, useEffect as useEffect10, useState as useState7 } from "react";
|
|
4090
|
-
import { RICH_CONTENT_ALLOWED_TAGS, SVG_ALLOWED_TAGS, SVG_MAX_BYTES, safeUrl as
|
|
4227
|
+
import { RICH_CONTENT_ALLOWED_TAGS, SVG_ALLOWED_TAGS, SVG_MAX_BYTES, safeUrl as safeUrl16, sanitizeSvg } from "@usethrottle/builder-schema";
|
|
4091
4228
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
4092
4229
|
var RICH = new Set(RICH_CONTENT_ALLOWED_TAGS);
|
|
4093
4230
|
var SVG = new Set(SVG_ALLOWED_TAGS);
|
|
@@ -4228,7 +4365,7 @@ function checkUrls(tag, props, mediaOrigin) {
|
|
|
4228
4365
|
for (const key of ["href", "xlinkHref", "src"]) {
|
|
4229
4366
|
if (!Object.hasOwn(props, key)) continue;
|
|
4230
4367
|
const value = props[key];
|
|
4231
|
-
const safe = SVG.has(tag) ? typeof value === "string" && FRAGMENT.test(value) ? value : null :
|
|
4368
|
+
const safe = SVG.has(tag) ? typeof value === "string" && FRAGMENT.test(value) ? value : null : safeUrl16(value, key === "src" ? "src" : "href", { mediaOrigin });
|
|
4232
4369
|
if (safe !== null) {
|
|
4233
4370
|
props[key] = safe;
|
|
4234
4371
|
continue;
|
|
@@ -4256,7 +4393,7 @@ function svgElement(svg) {
|
|
|
4256
4393
|
return renderMarkup([withFill])[0] ?? null;
|
|
4257
4394
|
}
|
|
4258
4395
|
async function readSvg(response, mediaOrigin) {
|
|
4259
|
-
if (!response.ok ||
|
|
4396
|
+
if (!response.ok || safeUrl16(response.url, "src", { mediaOrigin }) === null) return null;
|
|
4260
4397
|
if (!/^image\/svg\+xml(?:\s*;|$)/iu.test(response.headers.get("content-type") ?? "")) return null;
|
|
4261
4398
|
const reader = response.body?.getReader();
|
|
4262
4399
|
if (reader === void 0) {
|
|
@@ -4277,8 +4414,8 @@ async function readSvg(response, mediaOrigin) {
|
|
|
4277
4414
|
text += decoder.decode(value, { stream: true });
|
|
4278
4415
|
}
|
|
4279
4416
|
}
|
|
4280
|
-
function SvgFromAsset({ asset, mediaOrigin, label }) {
|
|
4281
|
-
const src = isFrozenAsset(asset) ?
|
|
4417
|
+
function SvgFromAsset({ asset, mediaOrigin, label: label2 }) {
|
|
4418
|
+
const src = isFrozenAsset(asset) ? safeUrl16(asset.url, "src", { mediaOrigin }) : null;
|
|
4282
4419
|
const [source, setSource] = useState7(null);
|
|
4283
4420
|
useEffect10(() => {
|
|
4284
4421
|
if (src === null) return;
|
|
@@ -4291,7 +4428,7 @@ function SvgFromAsset({ asset, mediaOrigin, label }) {
|
|
|
4291
4428
|
if (src === null) return null;
|
|
4292
4429
|
const inline2 = source === null ? null : svgElement(source);
|
|
4293
4430
|
if (inline2 !== null) return inline2;
|
|
4294
|
-
return /* @__PURE__ */ jsx37(AssetImage, { asset, mediaOrigin, alt:
|
|
4431
|
+
return /* @__PURE__ */ jsx37(AssetImage, { asset, mediaOrigin, alt: label2 ?? "", loading: "eager" });
|
|
4295
4432
|
}
|
|
4296
4433
|
|
|
4297
4434
|
// src/basics/v2/faq.tsx
|
|
@@ -4427,9 +4564,9 @@ function headings(nodes, nodeId) {
|
|
|
4427
4564
|
for (const node of list2) {
|
|
4428
4565
|
if (typeof node === "string") continue;
|
|
4429
4566
|
if (node.tag === "h2" || node.tag === "h3") {
|
|
4430
|
-
const
|
|
4567
|
+
const label2 = textOf2(node.children).replace(/\s+/gu, " ").trim();
|
|
4431
4568
|
const n = found.size + 1;
|
|
4432
|
-
found.set(node, { id: `${nodeId}-${String(n)}${slug(
|
|
4569
|
+
found.set(node, { id: `${nodeId}-${String(n)}${slug(label2) === "" ? "" : `-${slug(label2)}`}`, level: node.tag === "h2" ? 2 : 3, label: label2 });
|
|
4433
4570
|
}
|
|
4434
4571
|
visit(node.children);
|
|
4435
4572
|
}
|
|
@@ -4471,7 +4608,7 @@ var richContentWidgets = [{ ...mbDefinition("basic.rich-content"), Component: Ri
|
|
|
4471
4608
|
import { Fragment as Fragment28, jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4472
4609
|
function Svg({ props, mediaOrigin, editMode }) {
|
|
4473
4610
|
const pasted = str(props.svg);
|
|
4474
|
-
const
|
|
4611
|
+
const label2 = str(props.label);
|
|
4475
4612
|
const inline2 = pasted === void 0 ? null : svgElement(pasted);
|
|
4476
4613
|
const asset = pasted === void 0 && props.asset !== null && props.asset !== void 0 ? props.asset : null;
|
|
4477
4614
|
if (inline2 === null && asset === null) {
|
|
@@ -4481,14 +4618,1375 @@ function Svg({ props, mediaOrigin, editMode }) {
|
|
|
4481
4618
|
] });
|
|
4482
4619
|
}
|
|
4483
4620
|
const decorative = props.decorative !== false;
|
|
4484
|
-
const access = decorative ? { "aria-hidden": true } :
|
|
4621
|
+
const access = decorative ? { "aria-hidden": true } : label2 === void 0 ? {} : { role: "img", "aria-label": label2 };
|
|
4485
4622
|
return /* @__PURE__ */ jsxs31(Fragment28, { children: [
|
|
4486
4623
|
/* @__PURE__ */ jsx42(BasicV2Styles, {}),
|
|
4487
|
-
/* @__PURE__ */ jsx42("div", { className: "tb-b-svg", ...access, children: inline2 ?? /* @__PURE__ */ jsx42(SvgFromAsset, { asset, mediaOrigin, ...
|
|
4624
|
+
/* @__PURE__ */ jsx42("div", { className: "tb-b-svg", ...access, children: inline2 ?? /* @__PURE__ */ jsx42(SvgFromAsset, { asset, mediaOrigin, ...label2 === void 0 || decorative ? {} : { label: label2 } }) })
|
|
4488
4625
|
] });
|
|
4489
4626
|
}
|
|
4490
4627
|
var svgWidgets = [{ ...mbDefinition("basic.svg"), Component: Svg }];
|
|
4491
4628
|
|
|
4629
|
+
// src/basics/r23/feature-grid.tsx
|
|
4630
|
+
import { createElement as createElement5 } from "react";
|
|
4631
|
+
import { ICON_NAMES as ICON_NAMES2, Icon as Icon7 } from "@usethrottle/ui";
|
|
4632
|
+
import { sanitizeRichContent as sanitizeRichContent3 } from "@usethrottle/builder-schema";
|
|
4633
|
+
|
|
4634
|
+
// src/basics/r23/shared.tsx
|
|
4635
|
+
import { BASIC_WIDGET_DEFINITIONS as BASIC_WIDGET_DEFINITIONS3, safeUrl as safeUrl17 } from "@usethrottle/builder-schema";
|
|
4636
|
+
import { Fragment as Fragment29, jsx as jsx43, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4637
|
+
function r23Definition(type) {
|
|
4638
|
+
const found = BASIC_WIDGET_DEFINITIONS3.filter((d) => d.type === type).sort((a, b) => b.v - a.v)[0];
|
|
4639
|
+
if (found === void 0) throw new Error(`No R2.3 definition of ${type}`);
|
|
4640
|
+
return found;
|
|
4641
|
+
}
|
|
4642
|
+
var rowsOf = (value) => Array.isArray(value) ? value.flatMap((row) => isRecord4(row) ? [row] : []) : [];
|
|
4643
|
+
var fill = (template, vars) => template.replace(/\{([a-z]+)\}/gu, (whole, name) => Object.hasOwn(vars, name) ? vars[name] : whole);
|
|
4644
|
+
var textOf3 = (value) => typeof value === "string" ? value : "";
|
|
4645
|
+
function usableAsset(value, mediaOrigin) {
|
|
4646
|
+
return isFrozenAsset(value) && safeUrl17(value.url, "src", { mediaOrigin }) !== null ? value : null;
|
|
4647
|
+
}
|
|
4648
|
+
var srcSetOf = (asset, mediaOrigin) => asset.variants.flatMap((variant) => {
|
|
4649
|
+
const url = safeUrl17(variant.url, "src", { mediaOrigin });
|
|
4650
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
4651
|
+
}).join(", ");
|
|
4652
|
+
function PictureImage({
|
|
4653
|
+
asset,
|
|
4654
|
+
mobile,
|
|
4655
|
+
mediaOrigin,
|
|
4656
|
+
alt,
|
|
4657
|
+
sizes,
|
|
4658
|
+
priority = false,
|
|
4659
|
+
className
|
|
4660
|
+
}) {
|
|
4661
|
+
const src = safeUrl17(asset.url, "src", { mediaOrigin });
|
|
4662
|
+
if (src === null) return null;
|
|
4663
|
+
const srcSet = srcSetOf(asset, mediaOrigin);
|
|
4664
|
+
const img = /* @__PURE__ */ jsx43(
|
|
4665
|
+
"img",
|
|
4666
|
+
{
|
|
4667
|
+
src,
|
|
4668
|
+
...srcSet === "" ? {} : { srcSet, sizes },
|
|
4669
|
+
width: asset.width,
|
|
4670
|
+
height: asset.height,
|
|
4671
|
+
alt,
|
|
4672
|
+
loading: priority ? "eager" : "lazy",
|
|
4673
|
+
...priority ? { fetchPriority: "high" } : {},
|
|
4674
|
+
decoding: "async",
|
|
4675
|
+
...className === void 0 ? {} : { className }
|
|
4676
|
+
}
|
|
4677
|
+
);
|
|
4678
|
+
if (mobile === null || mobile === void 0) return img;
|
|
4679
|
+
const mobileSrc = safeUrl17(mobile.url, "src", { mediaOrigin });
|
|
4680
|
+
if (mobileSrc === null) return img;
|
|
4681
|
+
const mobileSet = srcSetOf(mobile, mediaOrigin);
|
|
4682
|
+
return /* @__PURE__ */ jsxs32("picture", { children: [
|
|
4683
|
+
/* @__PURE__ */ jsx43(
|
|
4684
|
+
"source",
|
|
4685
|
+
{
|
|
4686
|
+
media: "(max-width: 767px)",
|
|
4687
|
+
srcSet: mobileSet === "" ? mobileSrc : mobileSet,
|
|
4688
|
+
...mobileSet === "" ? {} : { sizes: "100vw" },
|
|
4689
|
+
width: mobile.width,
|
|
4690
|
+
height: mobile.height
|
|
4691
|
+
}
|
|
4692
|
+
),
|
|
4693
|
+
img
|
|
4694
|
+
] });
|
|
4695
|
+
}
|
|
4696
|
+
var R23_CSS = `@layer throttle{
|
|
4697
|
+
.tb-b-sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
4698
|
+
.tb-b-iwt{display:flex;flex-direction:var(--bx-dir,row);gap:var(--tb-space-l);align-items:stretch}
|
|
4699
|
+
.tb-b-iwt-media{flex:var(--bx-mediaFr,1) 1 0;min-inline-size:0}
|
|
4700
|
+
.tb-b-iwt-media img{display:block;inline-size:100%;block-size:auto;aspect-ratio:var(--bx-ratio,auto);object-fit:cover;border-radius:var(--throttle-radius,8px)}
|
|
4701
|
+
.tb-b-iwt-content{flex:var(--bx-textFr,1) 1 0;min-inline-size:0;align-self:var(--bx-self,center);box-sizing:border-box;padding:var(--tb-space-m);background:var(--b-cardBackground,transparent);border-radius:var(--throttle-radius,8px);margin-inline-start:calc(var(--bx-overlap,0rem)*var(--bx-sa,0));margin-inline-end:calc(var(--bx-overlap,0rem)*var(--bx-ea,0));position:relative}
|
|
4702
|
+
.tb-b-iwt-kicker{margin:0 0 var(--tb-space-xs);font-size:var(--tb-text-s);letter-spacing:.08em;text-transform:uppercase;color:var(--tb-color-muted-foreground,inherit)}
|
|
4703
|
+
.tb-b-iwt-title{margin:0 0 var(--tb-space-s);font-family:var(--throttle-font-family-heading,inherit);line-height:1.2;overflow-wrap:anywhere}
|
|
4704
|
+
.tb-b-iwt-text{line-height:1.6;overflow-wrap:anywhere}
|
|
4705
|
+
.tb-b-iwt-text>:first-child{margin-block-start:0}
|
|
4706
|
+
.tb-b-iwt-content .tb-b-button{margin-block-start:var(--tb-space-s);min-block-size:44px;box-sizing:border-box}
|
|
4707
|
+
.tb-b-iwt-content a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
4708
|
+
@media (max-width:767px){.tb-b-iwt{flex-direction:var(--bx-pdir,column);gap:var(--tb-space-m)}.tb-b-iwt-media,.tb-b-iwt-content{flex:0 0 auto;align-self:stretch}.tb-b-iwt-content{margin-inline:0}}
|
|
4709
|
+
.tb-b-fg{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--tb-space-m);margin:0;padding:0;list-style:none;text-align:var(--b-align,left)}
|
|
4710
|
+
@media (max-width:1024px){.tb-b-fg{grid-template-columns:repeat(var(--b-columnsTablet,2),minmax(0,1fr))}}
|
|
4711
|
+
@media (max-width:767px){.tb-b-fg{grid-template-columns:repeat(var(--b-columnsMobile,1),minmax(0,1fr))}}
|
|
4712
|
+
.tb-b-fg-item{display:flex;flex-direction:column;gap:var(--tb-space-s);box-sizing:border-box;min-inline-size:0;align-items:var(--b-align-items,stretch)}
|
|
4713
|
+
.tb-b-fg--left .tb-b-fg-item{flex-direction:row;align-items:flex-start}
|
|
4714
|
+
.tb-b-fg--card .tb-b-fg-item,.tb-b-fg--bordered .tb-b-fg-item{padding:var(--tb-space-m);border-radius:var(--throttle-radius,8px)}
|
|
4715
|
+
.tb-b-fg--card .tb-b-fg-item{background:var(--tb-color-surface,var(--tb-color-muted,#f4f4f4))}
|
|
4716
|
+
.tb-b-fg--bordered .tb-b-fg-item{border:1px solid var(--tb-color-border,currentColor)}
|
|
4717
|
+
.tb-b-fg-media{flex:0 0 auto;display:inline-flex;color:var(--b-iconColor,var(--tb-color-primary,currentColor))}
|
|
4718
|
+
.tb-b-fg-media svg,.tb-b-fg-media img{inline-size:calc(var(--b-iconSize,40)*1px);block-size:calc(var(--b-iconSize,40)*1px);object-fit:cover}
|
|
4719
|
+
.tb-b-fg-title{margin:0;font-family:var(--throttle-font-family-heading,inherit);font-size:var(--tb-text-l);line-height:1.25}
|
|
4720
|
+
.tb-b-fg-title a{color:inherit;display:inline-block;min-block-size:44px;line-height:44px}
|
|
4721
|
+
.tb-b-fg-title a:focus-visible,.tb-b-badge a:focus-visible,.tb-b-logos a:focus-visible,.tb-b-social a:focus-visible,.tb-b-tm-btn:focus-visible,.tb-b-logos-pause:focus-visible,.tb-b-tm-list:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
4722
|
+
.tb-b-fg-text>:first-child{margin-block-start:0}
|
|
4723
|
+
.tb-b-fg-text>:last-child{margin-block-end:0}
|
|
4724
|
+
.tb-b-fg-body{min-inline-size:0;display:flex;flex-direction:column;gap:var(--tb-space-xs)}
|
|
4725
|
+
.tb-b-tm{color:var(--b-color,inherit);font-size:var(--b-size,var(--tb-text-m));text-align:var(--b-align,left);position:relative}
|
|
4726
|
+
.tb-b-tm-list{margin:0;padding:0;list-style:none}
|
|
4727
|
+
.tb-b-tm--grid .tb-b-tm-list{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--tb-space-m)}
|
|
4728
|
+
.tb-b-tm--masonry .tb-b-tm-list{column-count:var(--b-columnsDesktop,3);column-gap:var(--tb-space-m)}
|
|
4729
|
+
.tb-b-tm--masonry .tb-b-tm-list>li{break-inside:avoid;margin-block-end:var(--tb-space-m)}
|
|
4730
|
+
.tb-b-tm--carousel .tb-b-tm-list{display:flex;gap:var(--tb-space-m);overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:thin;overscroll-behavior-x:contain}
|
|
4731
|
+
.tb-b-tm--carousel .tb-b-tm-slide{flex:0 0 calc((100% - (var(--b-columnsDesktop,3) - 1)*var(--tb-space-m))/var(--b-columnsDesktop,3));scroll-snap-align:start;min-inline-size:0}
|
|
4732
|
+
@media (max-width:1024px){.tb-b-tm--grid .tb-b-tm-list{grid-template-columns:repeat(min(var(--b-columnsDesktop,3),2),minmax(0,1fr))}.tb-b-tm--masonry .tb-b-tm-list{column-count:min(var(--b-columnsDesktop,3),2)}.tb-b-tm--carousel .tb-b-tm-slide{flex-basis:calc((100% - var(--tb-space-m))/min(var(--b-columnsDesktop,3),2))}}
|
|
4733
|
+
@media (max-width:767px){.tb-b-tm--grid .tb-b-tm-list{grid-template-columns:repeat(var(--b-columnsMobile,1),minmax(0,1fr))}.tb-b-tm--masonry .tb-b-tm-list{column-count:var(--b-columnsMobile,1)}.tb-b-tm--carousel .tb-b-tm-slide{flex-basis:calc((100% - (var(--b-columnsMobile,1) - 1)*var(--tb-space-m))/var(--b-columnsMobile,1))}}
|
|
4734
|
+
.tb-b-tm-card{margin:0;box-sizing:border-box;block-size:100%;display:flex;flex-direction:column;gap:var(--tb-space-s)}
|
|
4735
|
+
.tb-b-tm--card .tb-b-tm-card,.tb-b-tm--bordered .tb-b-tm-card{padding:var(--tb-space-m);border-radius:var(--throttle-radius,8px)}
|
|
4736
|
+
.tb-b-tm--card .tb-b-tm-card{background:var(--tb-color-surface,var(--tb-color-muted,#f4f4f4))}
|
|
4737
|
+
.tb-b-tm--bordered .tb-b-tm-card{border:1px solid var(--tb-color-border,currentColor)}
|
|
4738
|
+
.tb-b-tm-card blockquote{margin:0;line-height:1.5;overflow-wrap:anywhere}
|
|
4739
|
+
.tb-b-tm-card figcaption{display:flex;align-items:center;gap:var(--tb-space-s);font-size:var(--tb-text-s)}
|
|
4740
|
+
.tb-b-tm-photo{inline-size:44px;block-size:44px;border-radius:50%;object-fit:cover;flex:0 0 auto}
|
|
4741
|
+
.tb-b-tm-by{display:flex;flex-direction:column}
|
|
4742
|
+
.tb-b-tm-name{font-weight:600}
|
|
4743
|
+
.tb-b-tm-role,.tb-b-tm-source{color:var(--tb-color-muted-foreground,inherit)}
|
|
4744
|
+
.tb-b-tm-rating{margin:0;display:flex;gap:2px}
|
|
4745
|
+
.tb-b-star{position:relative;display:inline-block;color:var(--tb-color-border-control,#bbb);line-height:1}
|
|
4746
|
+
.tb-b-star--full{color:var(--tb-color-accent,#f5a623)}
|
|
4747
|
+
.tb-b-star--half::before{content:"\\2605";position:absolute;inset-block-start:0;inset-inline-start:0;inline-size:50%;overflow:hidden;color:var(--tb-color-accent,#f5a623)}
|
|
4748
|
+
.tb-b-tm-ctrl{display:flex;justify-content:center;gap:var(--tb-space-s);margin-block-start:var(--tb-space-s);min-block-size:44px}
|
|
4749
|
+
.tb-b-tm-ctrl--wait{visibility:hidden}
|
|
4750
|
+
@media (prefers-reduced-motion:reduce){.tb-b-tm-pause{display:none}}
|
|
4751
|
+
.tb-b-tm-btn{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,transparent);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 var(--tb-space-m)}
|
|
4752
|
+
.tb-b-tm-btn[hidden]{display:none}
|
|
4753
|
+
@media (prefers-reduced-motion:reduce){.tb-b-tm-list{scroll-behavior:auto}}
|
|
4754
|
+
.tb-b-logos{text-align:var(--b-align,center)}
|
|
4755
|
+
.tb-b-logos-title{margin:0 0 var(--tb-space-s);font-size:var(--tb-text-s);letter-spacing:.08em;text-transform:uppercase;color:var(--tb-color-muted-foreground,inherit)}
|
|
4756
|
+
.tb-b-logos-list{margin:0;padding:0;list-style:none}
|
|
4757
|
+
.tb-b-logos--row .tb-b-logos-list>li,.tb-b-logos--grid .tb-b-logos-list>li{display:inline-flex;align-items:center;justify-content:center;margin:calc(var(--b-gap,var(--tb-space-m))/2)}
|
|
4758
|
+
.tb-b-logos--grid .tb-b-logos-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));gap:var(--b-gap,var(--tb-space-m));justify-items:center;align-items:center}
|
|
4759
|
+
.tb-b-logos--grid .tb-b-logos-list>li{margin:0}
|
|
4760
|
+
@media (max-width:767px){.tb-b-logos--grid .tb-b-logos-list{grid-template-columns:repeat(var(--b-columnsMobile,2),minmax(0,1fr))}}
|
|
4761
|
+
.tb-b-logos img{display:block;inline-size:auto;max-inline-size:100%;block-size:calc(var(--b-logoHeight,40)*1px);object-fit:contain;filter:grayscale(var(--b-grayscale,0));opacity:calc(1 - var(--b-grayscale,0)*.25)}
|
|
4762
|
+
.tb-b-logos a{display:inline-flex;align-items:center;min-block-size:44px}
|
|
4763
|
+
.tb-b-logos-warn{padding:var(--tb-space-xs);border:1px dashed currentColor;font-size:var(--tb-text-s)}
|
|
4764
|
+
.tb-b-logos--marquee .tb-b-logos-track{display:flex;overflow-x:auto;scrollbar-width:none}
|
|
4765
|
+
.tb-b-logos--marquee .tb-b-logos-track::-webkit-scrollbar{display:none}
|
|
4766
|
+
.tb-b-logos--marquee .tb-b-logos-list{display:flex;flex:0 0 auto;flex-wrap:nowrap;align-items:center;gap:var(--b-gap,var(--tb-space-m));padding-inline-end:var(--b-gap,var(--tb-space-m))}
|
|
4767
|
+
.tb-b-logos--marquee .tb-b-logos-list>li{flex:0 0 auto;margin:0}
|
|
4768
|
+
.tb-b-logos--marquee.is-live .tb-b-logos-track{inline-size:max-content;animation:tb-b-marquee var(--bx-speed,40s) linear infinite}
|
|
4769
|
+
.tb-b-logos--marquee.is-live{overflow:hidden}
|
|
4770
|
+
:dir(rtl) .tb-b-logos--marquee.is-live .tb-b-logos-track{animation-name:tb-b-marquee-rtl}
|
|
4771
|
+
.tb-b-logos--marquee.is-live.is-paused .tb-b-logos-track,.tb-b-logos--marquee.is-live:hover .tb-b-logos-track,.tb-b-logos--marquee.is-live:focus-within .tb-b-logos-track{animation-play-state:paused}
|
|
4772
|
+
@keyframes tb-b-marquee{to{transform:translateX(-50%)}}
|
|
4773
|
+
@keyframes tb-b-marquee-rtl{to{transform:translateX(50%)}}
|
|
4774
|
+
@media (prefers-reduced-motion:reduce){.tb-b-logos--marquee.is-live .tb-b-logos-track{animation:none}.tb-b-logos-pause{display:none}}
|
|
4775
|
+
.tb-b-logos-pause{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,transparent);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;margin-block-start:var(--tb-space-xs);padding:0 var(--tb-space-m)}
|
|
4776
|
+
.tb-b-social{margin:0;padding:0;list-style:none;color:var(--b-color,inherit);text-align:var(--b-align,left)}
|
|
4777
|
+
.tb-b-social>li{display:inline-block;vertical-align:top;margin:calc(var(--tb-space-xs)/2)}
|
|
4778
|
+
.tb-b-social a{display:inline-flex;align-items:center;justify-content:center;gap:var(--tb-space-xs);min-inline-size:44px;min-block-size:44px;box-sizing:border-box;padding-inline:var(--tb-space-xs);color:inherit;text-decoration:none}
|
|
4779
|
+
.tb-b-social--icon-label a,.tb-b-social--label a{padding-inline:var(--tb-space-s)}
|
|
4780
|
+
.tb-b-social svg{inline-size:calc(var(--b-iconSize,24)*1px);block-size:calc(var(--b-iconSize,24)*1px);flex:0 0 auto}
|
|
4781
|
+
.tb-b-social--circle a,.tb-b-social--square a{border:1px solid currentColor}
|
|
4782
|
+
.tb-b-social--circle.tb-b-social--icon a{border-radius:50%}
|
|
4783
|
+
.tb-b-social--circle.tb-b-social--icon-label a,.tb-b-social--circle.tb-b-social--label a{border-radius:999px}
|
|
4784
|
+
.tb-b-social--square a{border-radius:var(--throttle-radius,8px)}
|
|
4785
|
+
.tb-b-trust{color:var(--b-color,inherit);font-size:var(--b-size,var(--tb-text-m));text-align:var(--b-align,center)}
|
|
4786
|
+
.tb-b-badges,.tb-b-pay{display:flex;flex-wrap:wrap;gap:var(--tb-space-m);margin:0;padding:0;list-style:none;justify-content:center}
|
|
4787
|
+
.tb-b-trust--grid .tb-b-badges{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))}
|
|
4788
|
+
.tb-b-badge{display:flex;align-items:flex-start;gap:var(--tb-space-s);text-align:start}
|
|
4789
|
+
.tb-b-badge-icon{flex:0 0 auto;display:inline-flex;color:var(--b-iconColor,var(--tb-color-primary,currentColor))}
|
|
4790
|
+
.tb-b-badge-icon svg,.tb-b-badge-icon img{inline-size:calc(var(--b-iconSize,32)*1px);block-size:calc(var(--b-iconSize,32)*1px)}
|
|
4791
|
+
.tb-b-badge-body{display:flex;flex-direction:column}
|
|
4792
|
+
.tb-b-badge-title{font-weight:600}
|
|
4793
|
+
.tb-b-badge a{color:inherit;display:inline-flex;align-items:center;min-block-size:44px}
|
|
4794
|
+
.tb-b-badge-text{font-size:var(--tb-text-s);color:var(--tb-color-muted-foreground,inherit)}
|
|
4795
|
+
.tb-b-pay{margin-block-start:var(--tb-space-m);gap:var(--tb-space-xs)}
|
|
4796
|
+
.tb-b-pay svg{display:block;inline-size:calc(var(--b-iconSize,32)*1.5px);block-size:auto}
|
|
4797
|
+
}`;
|
|
4798
|
+
function R23Styles() {
|
|
4799
|
+
return /* @__PURE__ */ jsxs32(Fragment29, { children: [
|
|
4800
|
+
/* @__PURE__ */ jsx43(BasicStyles, {}),
|
|
4801
|
+
/* @__PURE__ */ jsx43("style", { href: "tb-basics-r23", precedence: "throttle", children: R23_CSS })
|
|
4802
|
+
] });
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
// src/basics/r23/feature-grid.tsx
|
|
4806
|
+
import { Fragment as Fragment30, jsx as jsx44, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4807
|
+
var LEVELS2 = ["h2", "h3", "h4"];
|
|
4808
|
+
var CARDS = ["plain", "card", "bordered"];
|
|
4809
|
+
var isIconName2 = (name) => typeof name === "string" && ICON_NAMES2.includes(name);
|
|
4810
|
+
function FeatureGrid({ props, mediaOrigin, editMode }) {
|
|
4811
|
+
const rows = rowsOf(props.items).filter((row) => str(row.title) !== void 0 || str(row.text) !== void 0);
|
|
4812
|
+
if (rows.length === 0) {
|
|
4813
|
+
return /* @__PURE__ */ jsxs33(Fragment30, { children: [
|
|
4814
|
+
/* @__PURE__ */ jsx44(R23Styles, {}),
|
|
4815
|
+
/* @__PURE__ */ jsx44(Placeholder, { editMode, children: "Add features in the settings" })
|
|
4816
|
+
] });
|
|
4817
|
+
}
|
|
4818
|
+
const level = oneOf(props.titleLevel, LEVELS2, "h3");
|
|
4819
|
+
const card = oneOf(props.cardStyle, CARDS, "plain");
|
|
4820
|
+
const left = props.mediaPosition === "left";
|
|
4821
|
+
return /* @__PURE__ */ jsxs33(Fragment30, { children: [
|
|
4822
|
+
/* @__PURE__ */ jsx44(R23Styles, {}),
|
|
4823
|
+
/* @__PURE__ */ jsx44("ul", { className: `tb-b-fg tb-b-fg--${card}${left ? " tb-b-fg--left" : ""}`, children: rows.map((row, index) => {
|
|
4824
|
+
const image = usableAsset(row.image, mediaOrigin);
|
|
4825
|
+
const svg = image === null && usableAsset(row.svgAsset, mediaOrigin) !== null ? row.svgAsset : null;
|
|
4826
|
+
const icon = image === null && svg === null && isIconName2(row.icon) ? row.icon : null;
|
|
4827
|
+
const title = str(row.title);
|
|
4828
|
+
const href = hrefOf(row.link, mediaOrigin);
|
|
4829
|
+
const html = str(row.text);
|
|
4830
|
+
const body = html === void 0 ? null : renderMarkup(parseMarkup(sanitizeRichContent3(html, mediaOrigin).html, "rich"), { mediaOrigin });
|
|
4831
|
+
return /* @__PURE__ */ jsxs33("li", { className: "tb-b-fg-item", children: [
|
|
4832
|
+
(image !== null || svg !== null || icon !== null) && /* @__PURE__ */ jsx44("span", { className: "tb-b-fg-media", "aria-hidden": "true", children: image !== null ? /* @__PURE__ */ jsx44(AssetImage, { asset: image, mediaOrigin, alt: "", sizes: "96px" }) : svg !== null ? /* @__PURE__ */ jsx44(SvgFromAsset, { asset: svg, mediaOrigin }) : /* @__PURE__ */ jsx44(Icon7, { name: icon }) }),
|
|
4833
|
+
/* @__PURE__ */ jsxs33("div", { className: "tb-b-fg-body", children: [
|
|
4834
|
+
title !== void 0 && createElement5(level, { className: "tb-b-fg-title" }, href === null ? title : /* @__PURE__ */ jsx44("a", { href, children: title })),
|
|
4835
|
+
body !== null && /* @__PURE__ */ jsx44("div", { className: "tb-b-fg-text", children: body })
|
|
4836
|
+
] })
|
|
4837
|
+
] }, `${String(index)}:${textOf3(row.title)}`);
|
|
4838
|
+
}) })
|
|
4839
|
+
] });
|
|
4840
|
+
}
|
|
4841
|
+
var featureGridWidgets = [{ ...r23Definition("basic.feature-grid"), Component: FeatureGrid }];
|
|
4842
|
+
|
|
4843
|
+
// src/basics/r23/image-with-text.tsx
|
|
4844
|
+
import { createElement as createElement6 } from "react";
|
|
4845
|
+
import { sanitizeRichContent as sanitizeRichContent4 } from "@usethrottle/builder-schema";
|
|
4846
|
+
import { Fragment as Fragment31, jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4847
|
+
var TYPE = "basic.image-with-text";
|
|
4848
|
+
var LEVELS3 = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4849
|
+
var BUTTON_STYLES = ["primary", "secondary", "outline", "link"];
|
|
4850
|
+
var RULES4 = [
|
|
4851
|
+
{ key: "imageRatio", property: "--bx-ratio", values: { adapt: "auto", "1:1": "1 / 1", "4:3": "4 / 3", "3:4": "3 / 4", "16:9": "16 / 9" } },
|
|
4852
|
+
{ key: "imagePosition", property: "--bx-dir", values: { left: "row", right: "row-reverse" } },
|
|
4853
|
+
{ key: "imagePosition", property: "--bx-sa", values: { left: "-1", right: "0" } },
|
|
4854
|
+
{ key: "imagePosition", property: "--bx-ea", values: { left: "0", right: "-1" } },
|
|
4855
|
+
{ key: "stackOnPhone", property: "--bx-pdir", values: { "image-first": "column", "text-first": "column-reverse" } },
|
|
4856
|
+
{ key: "contentPosition", property: "--bx-self", values: { top: "flex-start", center: "center", bottom: "flex-end" } },
|
|
4857
|
+
{ key: "overlap", property: "--bx-overlap", values: { none: "0rem", small: "2rem", large: "4rem" } },
|
|
4858
|
+
{ key: "imageWidth", property: "--bx-mediaFr", values: { "33": "1", "50": "1", "66": "2" } },
|
|
4859
|
+
{ key: "imageWidth", property: "--bx-textFr", values: { "33": "2", "50": "1", "66": "1" } }
|
|
4860
|
+
];
|
|
4861
|
+
function ImageWithText({ node, props, mediaOrigin, editMode, inlineEdit }) {
|
|
4862
|
+
const image = usableAsset(props.image, mediaOrigin);
|
|
4863
|
+
const mobile = usableAsset(props.mobileImage, mediaOrigin);
|
|
4864
|
+
const title = inlineEdit?.("title") ?? str(props.title);
|
|
4865
|
+
const kicker = str(props.kicker);
|
|
4866
|
+
const html = str(props.text);
|
|
4867
|
+
const label2 = str(props.buttonLabel);
|
|
4868
|
+
const href = hrefOf(props.buttonLink, mediaOrigin);
|
|
4869
|
+
const body = html === void 0 ? null : renderMarkup(parseMarkup(sanitizeRichContent4(html, mediaOrigin).html, "rich"), { mediaOrigin });
|
|
4870
|
+
if (image === null && title === void 0 && kicker === void 0 && html === void 0 && label2 === void 0) {
|
|
4871
|
+
return /* @__PURE__ */ jsxs34(Fragment31, { children: [
|
|
4872
|
+
/* @__PURE__ */ jsx45(R23Styles, {}),
|
|
4873
|
+
/* @__PURE__ */ jsx45(Placeholder, { editMode, children: "Choose an image and write some text" })
|
|
4874
|
+
] });
|
|
4875
|
+
}
|
|
4876
|
+
const alt = props.decorative === true ? "" : str(props.alt) ?? "";
|
|
4877
|
+
const level = oneOf(props.titleLevel, LEVELS3, "h2");
|
|
4878
|
+
const style = oneOf(props.buttonStyle, BUTTON_STYLES, "primary");
|
|
4879
|
+
return /* @__PURE__ */ jsxs34(Fragment31, { children: [
|
|
4880
|
+
/* @__PURE__ */ jsx45(R23Styles, {}),
|
|
4881
|
+
/* @__PURE__ */ jsx45(WidgetStyle, { css: enumCss(node, RULES4) }),
|
|
4882
|
+
/* @__PURE__ */ jsxs34("div", { className: "tb-b-iwt", children: [
|
|
4883
|
+
/* @__PURE__ */ jsxs34("div", { className: "tb-b-iwt-media", children: [
|
|
4884
|
+
image !== null && /* @__PURE__ */ jsx45(PictureImage, { asset: image, mobile, mediaOrigin, alt, sizes: `(max-width: 767px) 100vw, ${oneOf(props.imageWidth, ["33", "50", "66"], "50")}vw`, priority: props.priority === true }),
|
|
4885
|
+
editMode && image !== null && alt === "" && props.decorative !== true && /* @__PURE__ */ jsx45("p", { className: "tb-b-empty", children: "Add alt text or mark the image decorative" })
|
|
4886
|
+
] }),
|
|
4887
|
+
/* @__PURE__ */ jsxs34("div", { className: "tb-b-iwt-content", children: [
|
|
4888
|
+
kicker !== void 0 && /* @__PURE__ */ jsx45("p", { className: "tb-b-iwt-kicker", children: kicker }),
|
|
4889
|
+
title !== void 0 && createElement6(level, { className: "tb-b-iwt-title" }, title),
|
|
4890
|
+
body !== null && /* @__PURE__ */ jsx45("div", { className: "tb-b-iwt-text", children: body }),
|
|
4891
|
+
label2 !== void 0 && href !== null && /* @__PURE__ */ jsx45("a", { className: `tb-b-button tb-b-button--${style} tb-b-button--m`, href, children: label2 })
|
|
4892
|
+
] })
|
|
4893
|
+
] })
|
|
4894
|
+
] });
|
|
4895
|
+
}
|
|
4896
|
+
var imageWithTextWidgets = [{ ...r23Definition(TYPE), Component: ImageWithText }];
|
|
4897
|
+
|
|
4898
|
+
// src/basics/r23/logo-strip.tsx
|
|
4899
|
+
import { useEffect as useEffect11, useId as useId4, useState as useState9 } from "react";
|
|
4900
|
+
import { Fragment as Fragment32, jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4901
|
+
var LAYOUTS2 = ["row", "grid", "marquee"];
|
|
4902
|
+
var RULES5 = [{ key: "speed", property: "--bx-speed", values: { slow: "60s", medium: "40s", fast: "20s" } }];
|
|
4903
|
+
function LogoStrip({ node, props, mediaOrigin, editMode }) {
|
|
4904
|
+
const titleId = useId4();
|
|
4905
|
+
const [reduced2, setReduced] = useState9(null);
|
|
4906
|
+
const [paused, setPaused] = useState9(false);
|
|
4907
|
+
const layout = oneOf(props.layout, LAYOUTS2, "row");
|
|
4908
|
+
const live = reduced2 === false;
|
|
4909
|
+
useEffect11(() => {
|
|
4910
|
+
setReduced(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true);
|
|
4911
|
+
}, []);
|
|
4912
|
+
const pauseLabel = str(props.pauseLabel) ?? "Pause logo scrolling";
|
|
4913
|
+
const playLabel = str(props.playLabel) ?? "Play logo scrolling";
|
|
4914
|
+
const logos = [];
|
|
4915
|
+
const warnings = [];
|
|
4916
|
+
rowsOf(props.items).forEach((row, index) => {
|
|
4917
|
+
const image = usableAsset(row.image, mediaOrigin);
|
|
4918
|
+
if (image === null) return;
|
|
4919
|
+
const decorative = row.decorative === true;
|
|
4920
|
+
const alt = decorative ? "" : str(row.alt) ?? "";
|
|
4921
|
+
if (!decorative && alt === "") {
|
|
4922
|
+
warnings.push(index);
|
|
4923
|
+
return;
|
|
4924
|
+
}
|
|
4925
|
+
logos.push({ key: String(index), image, alt, href: decorative ? null : hrefOf(row.link, mediaOrigin) });
|
|
4926
|
+
});
|
|
4927
|
+
if (logos.length === 0 && !(editMode && warnings.length > 0)) {
|
|
4928
|
+
return /* @__PURE__ */ jsxs35(Fragment32, { children: [
|
|
4929
|
+
/* @__PURE__ */ jsx46(R23Styles, {}),
|
|
4930
|
+
/* @__PURE__ */ jsx46(Placeholder, { editMode, children: "Add logos in the settings" })
|
|
4931
|
+
] });
|
|
4932
|
+
}
|
|
4933
|
+
const title = str(props.title);
|
|
4934
|
+
const marquee = layout === "marquee" && live && logos.length > 0;
|
|
4935
|
+
const renderLogos = (copy) => logos.map((logo) => {
|
|
4936
|
+
const img = /* @__PURE__ */ jsx46(AssetImage, { asset: logo.image, mediaOrigin, alt: copy ? "" : logo.alt, sizes: "160px" });
|
|
4937
|
+
const external = logo.href !== null && logo.href.startsWith("https://");
|
|
4938
|
+
return /* @__PURE__ */ jsx46("li", { children: logo.href === null ? img : /* @__PURE__ */ jsx46(
|
|
4939
|
+
"a",
|
|
4940
|
+
{
|
|
4941
|
+
href: logo.href,
|
|
4942
|
+
...external ? { rel: "nofollow noopener" } : {},
|
|
4943
|
+
...copy ? { tabIndex: -1 } : {},
|
|
4944
|
+
children: img
|
|
4945
|
+
}
|
|
4946
|
+
) }, logo.key);
|
|
4947
|
+
});
|
|
4948
|
+
const list2 = /* @__PURE__ */ jsxs35("ul", { className: "tb-b-logos-list", ...title === void 0 ? {} : { "aria-labelledby": titleId }, children: [
|
|
4949
|
+
renderLogos(false),
|
|
4950
|
+
editMode && warnings.map((index) => /* @__PURE__ */ jsx46("li", { className: "tb-b-logos-warn", children: "Add alt text or mark it decorative" }, `w${String(index)}`))
|
|
4951
|
+
] });
|
|
4952
|
+
return /* @__PURE__ */ jsxs35(Fragment32, { children: [
|
|
4953
|
+
/* @__PURE__ */ jsx46(R23Styles, {}),
|
|
4954
|
+
/* @__PURE__ */ jsx46(WidgetStyle, { css: enumCss(node, RULES5) }),
|
|
4955
|
+
/* @__PURE__ */ jsxs35("div", { className: `tb-b-logos tb-b-logos--${layout}${marquee ? " is-live" : ""}${marquee && paused ? " is-paused" : ""}`, children: [
|
|
4956
|
+
title !== void 0 && /* @__PURE__ */ jsx46("p", { className: "tb-b-logos-title", id: titleId, children: title }),
|
|
4957
|
+
layout === "marquee" ? /* @__PURE__ */ jsxs35("div", { className: "tb-b-logos-track", children: [
|
|
4958
|
+
list2,
|
|
4959
|
+
marquee && /* @__PURE__ */ jsx46("ul", { className: "tb-b-logos-list", "aria-hidden": "true", children: renderLogos(true) })
|
|
4960
|
+
] }) : list2,
|
|
4961
|
+
layout === "marquee" && logos.length > 0 && reduced2 !== true && /* @__PURE__ */ jsx46("button", { type: "button", className: "tb-b-logos-pause", disabled: !live, "aria-label": paused ? playLabel : pauseLabel, onClick: () => setPaused(!paused), children: /* @__PURE__ */ jsx46("span", { "aria-hidden": "true", children: paused ? "\u25B6" : "\u23F8" }) })
|
|
4962
|
+
] })
|
|
4963
|
+
] });
|
|
4964
|
+
}
|
|
4965
|
+
var logoStripWidgets = [{ ...r23Definition("basic.logo-strip"), Component: LogoStrip }];
|
|
4966
|
+
|
|
4967
|
+
// src/basics/r23/social-links.tsx
|
|
4968
|
+
import { useSiteDesign as useSiteDesign8 } from "@usethrottle/ui";
|
|
4969
|
+
import { safeUrl as safeUrl18 } from "@usethrottle/builder-schema";
|
|
4970
|
+
|
|
4971
|
+
// src/basics/r23/icons.tsx
|
|
4972
|
+
import { jsx as jsx47, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4973
|
+
var Svg2 = ({ children }) => /* @__PURE__ */ jsx47("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children });
|
|
4974
|
+
var PLATFORM_NAMES = {
|
|
4975
|
+
instagram: "Instagram",
|
|
4976
|
+
facebook: "Facebook",
|
|
4977
|
+
x: "X",
|
|
4978
|
+
tiktok: "TikTok",
|
|
4979
|
+
youtube: "YouTube",
|
|
4980
|
+
pinterest: "Pinterest",
|
|
4981
|
+
linkedin: "LinkedIn",
|
|
4982
|
+
threads: "Threads",
|
|
4983
|
+
whatsapp: "WhatsApp",
|
|
4984
|
+
email: "Email",
|
|
4985
|
+
custom: "Website"
|
|
4986
|
+
};
|
|
4987
|
+
var SOCIAL = {
|
|
4988
|
+
instagram: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
4989
|
+
/* @__PURE__ */ jsx47("rect", { x: "3", y: "3", width: "18", height: "18", rx: "5" }),
|
|
4990
|
+
/* @__PURE__ */ jsx47("circle", { cx: "12", cy: "12", r: "4" }),
|
|
4991
|
+
/* @__PURE__ */ jsx47("circle", { cx: "17.5", cy: "6.5", r: ".6", fill: "currentColor" })
|
|
4992
|
+
] }),
|
|
4993
|
+
facebook: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M15 3h-2.5A3.5 3.5 0 0 0 9 6.5V9H6v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h2z", fill: "currentColor", stroke: "none" }) }),
|
|
4994
|
+
x: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M4 4l16 16M20 4L4 20" }) }),
|
|
4995
|
+
tiktok: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M14 3v11.5a3.5 3.5 0 1 1-3.5-3.5M14 3c.5 3 2.5 4.5 5 4.5" }) }),
|
|
4996
|
+
youtube: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
4997
|
+
/* @__PURE__ */ jsx47("rect", { x: "2", y: "5", width: "20", height: "14", rx: "4" }),
|
|
4998
|
+
/* @__PURE__ */ jsx47("path", { d: "M10 9l6 3-6 3z", fill: "currentColor" })
|
|
4999
|
+
] }),
|
|
5000
|
+
pinterest: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5001
|
+
/* @__PURE__ */ jsx47("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5002
|
+
/* @__PURE__ */ jsx47("path", { d: "M10.5 20l1.8-7.5M9.5 10.5a2.8 2.8 0 1 1 4.5 2.3" })
|
|
5003
|
+
] }),
|
|
5004
|
+
linkedin: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5005
|
+
/* @__PURE__ */ jsx47("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
|
|
5006
|
+
/* @__PURE__ */ jsx47("path", { d: "M8 10v6M8 7.5v.01M12 16v-6M12 12.5a2.5 2.5 0 0 1 5 0V16" })
|
|
5007
|
+
] }),
|
|
5008
|
+
threads: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M16.5 8.5C15.8 6.8 14.2 6 12.3 6 9.5 6 7.5 8.2 7.5 12s2 6 5 6c2.6 0 4.2-1.5 4.2-3.5 0-2.3-2.3-3-4.5-3-1.8 0-2.7.9-2.7 1.8" }) }),
|
|
5009
|
+
whatsapp: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5010
|
+
/* @__PURE__ */ jsx47("path", { d: "M3 21l1.6-4.7A9 9 0 1 1 8 19.5z" }),
|
|
5011
|
+
/* @__PURE__ */ jsx47("path", { d: "M9 9c0 3 3 6 6 6l1-1.5-2-1-1 .8c-1-.4-2-1.4-2.4-2.4l.8-1-1-2z", fill: "currentColor" })
|
|
5012
|
+
] }),
|
|
5013
|
+
email: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5014
|
+
/* @__PURE__ */ jsx47("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
5015
|
+
/* @__PURE__ */ jsx47("path", { d: "M3 7l9 6 9-6" })
|
|
5016
|
+
] }),
|
|
5017
|
+
custom: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5018
|
+
/* @__PURE__ */ jsx47("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5019
|
+
/* @__PURE__ */ jsx47("path", { d: "M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18" })
|
|
5020
|
+
] })
|
|
5021
|
+
};
|
|
5022
|
+
var SocialIcon = ({ platform }) => Object.hasOwn(SOCIAL, platform) ? SOCIAL[platform]() : null;
|
|
5023
|
+
var BADGE2 = {
|
|
5024
|
+
"secure-checkout": () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5025
|
+
/* @__PURE__ */ jsx47("rect", { x: "5", y: "11", width: "14", height: "9", rx: "2" }),
|
|
5026
|
+
/* @__PURE__ */ jsx47("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
|
|
5027
|
+
] }),
|
|
5028
|
+
"free-shipping": () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5029
|
+
/* @__PURE__ */ jsx47("path", { d: "M2 6h12v10H2zM14 9h4l3 3v4h-7" }),
|
|
5030
|
+
/* @__PURE__ */ jsx47("circle", { cx: "6", cy: "18", r: "2" }),
|
|
5031
|
+
/* @__PURE__ */ jsx47("circle", { cx: "17", cy: "18", r: "2" })
|
|
5032
|
+
] }),
|
|
5033
|
+
returns: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M4 12a8 8 0 1 0 3-6.2M4 4v4h4" }) }),
|
|
5034
|
+
warranty: () => /* @__PURE__ */ jsxs36(Svg2, { children: [
|
|
5035
|
+
/* @__PURE__ */ jsx47("path", { d: "M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z" }),
|
|
5036
|
+
/* @__PURE__ */ jsx47("path", { d: "M8.5 12l2.5 2.5 4.5-5" })
|
|
5037
|
+
] }),
|
|
5038
|
+
support: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M4 14v-2a8 8 0 0 1 16 0v2M4 14h3v5H5a1 1 0 0 1-1-1zM20 14h-3v5h2a1 1 0 0 0 1-1z" }) }),
|
|
5039
|
+
eco: () => /* @__PURE__ */ jsx47(Svg2, { children: /* @__PURE__ */ jsx47("path", { d: "M5 19c0-8 5-14 15-14 0 10-6 15-14 15M5 19c2-5 5-8 9-10" }) })
|
|
5040
|
+
};
|
|
5041
|
+
var BadgeIcon = ({ name }) => Object.hasOwn(BADGE2, name) ? BADGE2[name]() : null;
|
|
5042
|
+
var Card = ({ title, fill: fill2 = "#fff", children }) => /* @__PURE__ */ jsxs36("svg", { viewBox: "0 0 40 26", role: "img", children: [
|
|
5043
|
+
/* @__PURE__ */ jsx47("title", { children: title }),
|
|
5044
|
+
/* @__PURE__ */ jsx47("rect", { x: ".5", y: ".5", width: "39", height: "25", rx: "4", fill: fill2, stroke: "#c8c8c8" }),
|
|
5045
|
+
children
|
|
5046
|
+
] });
|
|
5047
|
+
var label = (text, fill2, size = 9, extra = {}) => /* @__PURE__ */ jsx47("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: size, fontWeight: "700", fill: fill2, ...extra, children: text });
|
|
5048
|
+
var PAYMENT = {
|
|
5049
|
+
visa: () => /* @__PURE__ */ jsx47(Card, { title: "Visa", children: label("VISA", "#1a1f71", 10, { fontStyle: "italic" }) }),
|
|
5050
|
+
mastercard: () => /* @__PURE__ */ jsxs36(Card, { title: "Mastercard", children: [
|
|
5051
|
+
/* @__PURE__ */ jsx47("circle", { cx: "15", cy: "13", r: "7", fill: "#eb001b" }),
|
|
5052
|
+
/* @__PURE__ */ jsx47("circle", { cx: "25", cy: "13", r: "7", fill: "#f79e1b", fillOpacity: ".85" })
|
|
5053
|
+
] }),
|
|
5054
|
+
amex: () => /* @__PURE__ */ jsx47(Card, { title: "American Express", fill: "#2e77bb", children: label("AMEX", "#fff", 9) }),
|
|
5055
|
+
discover: () => /* @__PURE__ */ jsxs36(Card, { title: "Discover", children: [
|
|
5056
|
+
label("DISCOVER", "#222", 5.5),
|
|
5057
|
+
/* @__PURE__ */ jsx47("circle", { cx: "30", cy: "20", r: "3", fill: "#f58220" })
|
|
5058
|
+
] }),
|
|
5059
|
+
paypal: () => /* @__PURE__ */ jsx47(Card, { title: "PayPal", children: /* @__PURE__ */ jsxs36("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: "8", fontWeight: "700", fill: "#003087", children: [
|
|
5060
|
+
"Pay",
|
|
5061
|
+
/* @__PURE__ */ jsx47("tspan", { fill: "#009cde", children: "Pal" })
|
|
5062
|
+
] }) }),
|
|
5063
|
+
"apple-pay": () => /* @__PURE__ */ jsx47(Card, { title: "Apple Pay", children: label("Apple Pay", "#000", 6.5) }),
|
|
5064
|
+
"google-pay": () => /* @__PURE__ */ jsx47(Card, { title: "Google Pay", children: /* @__PURE__ */ jsxs36("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: "7.5", fontWeight: "700", fill: "#5f6368", children: [
|
|
5065
|
+
/* @__PURE__ */ jsx47("tspan", { fill: "#4285f4", children: "G" }),
|
|
5066
|
+
" Pay"
|
|
5067
|
+
] }) }),
|
|
5068
|
+
klarna: () => /* @__PURE__ */ jsx47(Card, { title: "Klarna", fill: "#ffb3c7", children: label("Klarna", "#17120f", 8) }),
|
|
5069
|
+
maestro: () => /* @__PURE__ */ jsxs36(Card, { title: "Maestro", children: [
|
|
5070
|
+
/* @__PURE__ */ jsx47("circle", { cx: "15", cy: "13", r: "7", fill: "#eb001b" }),
|
|
5071
|
+
/* @__PURE__ */ jsx47("circle", { cx: "25", cy: "13", r: "7", fill: "#0099df", fillOpacity: ".85" })
|
|
5072
|
+
] }),
|
|
5073
|
+
diners: () => /* @__PURE__ */ jsxs36(Card, { title: "Diners Club", children: [
|
|
5074
|
+
/* @__PURE__ */ jsx47("circle", { cx: "20", cy: "13", r: "8", fill: "none", stroke: "#0079be", strokeWidth: "2" }),
|
|
5075
|
+
/* @__PURE__ */ jsx47("path", { d: "M20 5v16", stroke: "#0079be", strokeWidth: "2" })
|
|
5076
|
+
] })
|
|
5077
|
+
};
|
|
5078
|
+
var PaymentMark = ({ method }) => Object.hasOwn(PAYMENT, method) ? PAYMENT[method]() : null;
|
|
5079
|
+
|
|
5080
|
+
// src/basics/r23/social-links.tsx
|
|
5081
|
+
import { Fragment as Fragment33, jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
5082
|
+
var STYLES2 = ["icon", "icon-label", "label"];
|
|
5083
|
+
var SHAPES = ["none", "circle", "square"];
|
|
5084
|
+
var EMAIL = /^[^\s@<>"'\\]+@[^\s@<>"'\\]+\.[^\s@<>"'\\]+$/u;
|
|
5085
|
+
var PHONE = /^\+?\d{6,15}$/u;
|
|
5086
|
+
function socialHref(platform, value, mediaOrigin) {
|
|
5087
|
+
const url = value.trim();
|
|
5088
|
+
if (platform === "email") {
|
|
5089
|
+
const address = url.replace(/^mailto:/iu, "");
|
|
5090
|
+
return EMAIL.test(address) ? `mailto:${address}` : null;
|
|
5091
|
+
}
|
|
5092
|
+
if (platform === "whatsapp" && !url.startsWith("https://")) {
|
|
5093
|
+
const digits = url.replace(/[\s().-]/gu, "");
|
|
5094
|
+
return PHONE.test(digits) ? `https://wa.me/${digits.replace("+", "")}` : null;
|
|
5095
|
+
}
|
|
5096
|
+
const safe = safeUrl18(url, "href", { mediaOrigin });
|
|
5097
|
+
if (safe === null) return null;
|
|
5098
|
+
return safe.startsWith("https://") || platform === "custom" && safe.startsWith("/") ? safe : null;
|
|
5099
|
+
}
|
|
5100
|
+
function SocialLinks({ props, mediaOrigin, editMode }) {
|
|
5101
|
+
const design = useSiteDesign8();
|
|
5102
|
+
const store = str(design?.brand?.storeName?.trim());
|
|
5103
|
+
const template = str(props.nameTemplate) ?? "{store} on {platform}";
|
|
5104
|
+
const style = oneOf(props.style, STYLES2, "icon");
|
|
5105
|
+
const shape = oneOf(props.shape, SHAPES, "none");
|
|
5106
|
+
const newTab = props.newTab !== false;
|
|
5107
|
+
const links = rowsOf(props.links).flatMap((row, index) => {
|
|
5108
|
+
const platform = typeof row.platform === "string" && Object.hasOwn(PLATFORM_NAMES, row.platform) ? row.platform : null;
|
|
5109
|
+
const href = platform === null ? null : socialHref(platform, textOf3(row.url), mediaOrigin);
|
|
5110
|
+
return platform === null || href === null ? [] : [{ index, platform, href, label: str(row.label) }];
|
|
5111
|
+
});
|
|
5112
|
+
if (links.length === 0) {
|
|
5113
|
+
return /* @__PURE__ */ jsxs37(Fragment33, { children: [
|
|
5114
|
+
/* @__PURE__ */ jsx48(R23Styles, {}),
|
|
5115
|
+
/* @__PURE__ */ jsx48(Placeholder, { editMode, children: "Add your social profiles in the settings" })
|
|
5116
|
+
] });
|
|
5117
|
+
}
|
|
5118
|
+
return /* @__PURE__ */ jsxs37(Fragment33, { children: [
|
|
5119
|
+
/* @__PURE__ */ jsx48(R23Styles, {}),
|
|
5120
|
+
/* @__PURE__ */ jsx48("ul", { className: `tb-b-social tb-b-social--${style} tb-b-social--${shape}`, children: links.map(({ index, platform, href, label: label2 }) => {
|
|
5121
|
+
const platformName = PLATFORM_NAMES[platform];
|
|
5122
|
+
const name = label2 ?? (store === void 0 || platform === "custom" ? platformName : fill(template, { store, platform: platformName }));
|
|
5123
|
+
const visible = style === "icon" ? void 0 : label2 ?? platformName;
|
|
5124
|
+
const web = href.startsWith("http") || href.startsWith("/");
|
|
5125
|
+
return /* @__PURE__ */ jsx48("li", { children: /* @__PURE__ */ jsxs37(
|
|
5126
|
+
"a",
|
|
5127
|
+
{
|
|
5128
|
+
href,
|
|
5129
|
+
...visible === name ? {} : { "aria-label": name },
|
|
5130
|
+
...web ? { rel: "me noopener" } : {},
|
|
5131
|
+
...web && newTab && href.startsWith("http") ? { target: "_blank" } : {},
|
|
5132
|
+
children: [
|
|
5133
|
+
style !== "label" && /* @__PURE__ */ jsx48(SocialIcon, { platform }),
|
|
5134
|
+
visible !== void 0 && /* @__PURE__ */ jsx48("span", { className: "tb-b-social-label", children: visible })
|
|
5135
|
+
]
|
|
5136
|
+
}
|
|
5137
|
+
) }, `${String(index)}:${platform}`);
|
|
5138
|
+
}) })
|
|
5139
|
+
] });
|
|
5140
|
+
}
|
|
5141
|
+
var socialLinksWidgets = [{ ...r23Definition("basic.social-links"), Component: SocialLinks }];
|
|
5142
|
+
|
|
5143
|
+
// src/basics/r23/testimonials.tsx
|
|
5144
|
+
import { useEffect as useEffect12, useRef as useRef5, useState as useState10 } from "react";
|
|
5145
|
+
import { Fragment as Fragment34, jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
5146
|
+
var LAYOUTS3 = ["grid", "carousel", "masonry"];
|
|
5147
|
+
var CARDS2 = ["plain", "card", "bordered"];
|
|
5148
|
+
var reducedMotion = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5149
|
+
function Rating({ value, template }) {
|
|
5150
|
+
const rounded = Math.round(Math.min(5, Math.max(0, value)) * 2) / 2;
|
|
5151
|
+
return /* @__PURE__ */ jsxs38("p", { className: "tb-b-tm-rating", children: [
|
|
5152
|
+
/* @__PURE__ */ jsx49("span", { className: "tb-b-sr", children: fill(template, { rating: String(rounded) }) }),
|
|
5153
|
+
/* @__PURE__ */ jsx49("span", { "aria-hidden": "true", children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx49("span", { className: `tb-b-star tb-b-star--${rounded >= n ? "full" : rounded >= n - 0.5 ? "half" : "empty"}`, children: "\u2605" }, n)) })
|
|
5154
|
+
] });
|
|
5155
|
+
}
|
|
5156
|
+
function Testimonials({ props, mediaOrigin, editMode }) {
|
|
5157
|
+
const track = useRef5(null);
|
|
5158
|
+
const [live, setLive] = useState10(false);
|
|
5159
|
+
const [motion, setMotion] = useState10(false);
|
|
5160
|
+
const [hover, setHover] = useState10(false);
|
|
5161
|
+
const [focus, setFocus] = useState10(false);
|
|
5162
|
+
const [paused, setPaused] = useState10(false);
|
|
5163
|
+
const layout = oneOf(props.layout, LAYOUTS3, "grid");
|
|
5164
|
+
const rows = rowsOf(props.items).filter((row) => str(row.quote) !== void 0);
|
|
5165
|
+
const carousel = layout === "carousel" && rows.length > 1;
|
|
5166
|
+
const interval = typeof props.intervalMs === "number" ? props.intervalMs : 6e3;
|
|
5167
|
+
const autoplay2 = carousel && props.autoplay === true && live && motion;
|
|
5168
|
+
useEffect12(() => {
|
|
5169
|
+
setLive(true);
|
|
5170
|
+
setMotion(!reducedMotion());
|
|
5171
|
+
}, []);
|
|
5172
|
+
const step2 = (dir, wrap = false) => {
|
|
5173
|
+
const el = track.current;
|
|
5174
|
+
if (el === null) return;
|
|
5175
|
+
const slide = el.firstElementChild instanceof HTMLElement ? el.firstElementChild.offsetWidth : 0;
|
|
5176
|
+
const width = slide > 0 ? slide : el.clientWidth;
|
|
5177
|
+
if (wrap && dir > 0 && el.scrollWidth > el.clientWidth && Math.abs(el.scrollLeft) + el.clientWidth >= el.scrollWidth - 2) {
|
|
5178
|
+
el.scrollTo?.({ left: 0, behavior: "auto" });
|
|
5179
|
+
return;
|
|
5180
|
+
}
|
|
5181
|
+
const rtl = getComputedStyle(el).direction === "rtl";
|
|
5182
|
+
el.scrollBy?.({ left: dir * width * (rtl ? -1 : 1), behavior: reducedMotion() ? "auto" : "smooth" });
|
|
5183
|
+
};
|
|
5184
|
+
useEffect12(() => {
|
|
5185
|
+
if (!autoplay2 || paused || hover || focus) return;
|
|
5186
|
+
const id = window.setInterval(() => step2(1, true), Math.max(3e3, interval));
|
|
5187
|
+
return () => window.clearInterval(id);
|
|
5188
|
+
}, [autoplay2, paused, hover, focus, interval]);
|
|
5189
|
+
if (rows.length === 0) {
|
|
5190
|
+
return /* @__PURE__ */ jsxs38(Fragment34, { children: [
|
|
5191
|
+
/* @__PURE__ */ jsx49(R23Styles, {}),
|
|
5192
|
+
/* @__PURE__ */ jsx49(Placeholder, { editMode, children: "Add testimonials in the settings" })
|
|
5193
|
+
] });
|
|
5194
|
+
}
|
|
5195
|
+
const showRating = props.showRating !== false;
|
|
5196
|
+
const showImage = props.showImage !== false;
|
|
5197
|
+
const label2 = str(props.carouselLabel) ?? "Customer reviews";
|
|
5198
|
+
const prevLabel = str(props.prevLabel) ?? "Previous review";
|
|
5199
|
+
const nextLabel = str(props.nextLabel) ?? "Next review";
|
|
5200
|
+
const pauseLabel = str(props.pauseLabel) ?? "Pause autoplay";
|
|
5201
|
+
const playLabel = str(props.playLabel) ?? "Start autoplay";
|
|
5202
|
+
const ratingLabel = str(props.ratingLabel) ?? "{rating} out of 5";
|
|
5203
|
+
const slideLabel = str(props.slideLabel) ?? "{n} of {total}";
|
|
5204
|
+
const cards = rows.map((row, index) => {
|
|
5205
|
+
const name = str(row.name);
|
|
5206
|
+
const role = str(row.role);
|
|
5207
|
+
const source = str(row.source);
|
|
5208
|
+
const photo = showImage ? usableAsset(row.image, mediaOrigin) : null;
|
|
5209
|
+
const rating = showRating && typeof row.rating === "number" && row.rating > 0 ? row.rating : null;
|
|
5210
|
+
const card2 = /* @__PURE__ */ jsxs38("figure", { className: "tb-b-tm-card", children: [
|
|
5211
|
+
rating !== null && /* @__PURE__ */ jsx49(Rating, { value: rating, template: ratingLabel }),
|
|
5212
|
+
/* @__PURE__ */ jsx49("blockquote", { children: str(row.quote) }),
|
|
5213
|
+
(name !== void 0 || role !== void 0 || source !== void 0 || photo !== null) && /* @__PURE__ */ jsxs38("figcaption", { children: [
|
|
5214
|
+
photo !== null && /* @__PURE__ */ jsx49(AssetImage, { asset: photo, mediaOrigin, alt: "", className: "tb-b-tm-photo", sizes: "44px" }),
|
|
5215
|
+
/* @__PURE__ */ jsxs38("span", { className: "tb-b-tm-by", children: [
|
|
5216
|
+
name !== void 0 && /* @__PURE__ */ jsx49("span", { className: "tb-b-tm-name", children: name }),
|
|
5217
|
+
role !== void 0 && /* @__PURE__ */ jsx49("span", { className: "tb-b-tm-role", children: role }),
|
|
5218
|
+
source !== void 0 && /* @__PURE__ */ jsx49("span", { className: "tb-b-tm-source", children: source })
|
|
5219
|
+
] })
|
|
5220
|
+
] })
|
|
5221
|
+
] });
|
|
5222
|
+
return carousel ? /* @__PURE__ */ jsx49(
|
|
5223
|
+
"div",
|
|
5224
|
+
{
|
|
5225
|
+
className: "tb-b-tm-slide",
|
|
5226
|
+
role: "group",
|
|
5227
|
+
"aria-roledescription": "slide",
|
|
5228
|
+
"aria-label": fill(slideLabel, { n: String(index + 1), total: String(rows.length) }),
|
|
5229
|
+
children: card2
|
|
5230
|
+
},
|
|
5231
|
+
index
|
|
5232
|
+
) : /* @__PURE__ */ jsx49("li", { children: card2 }, index);
|
|
5233
|
+
});
|
|
5234
|
+
const card = oneOf(props.cardStyle, CARDS2, "card");
|
|
5235
|
+
const className = `tb-b-tm tb-b-tm--${carousel ? "carousel" : layout === "carousel" ? "grid" : layout} tb-b-tm--${card}`;
|
|
5236
|
+
if (!carousel) {
|
|
5237
|
+
return /* @__PURE__ */ jsxs38(Fragment34, { children: [
|
|
5238
|
+
/* @__PURE__ */ jsx49(R23Styles, {}),
|
|
5239
|
+
/* @__PURE__ */ jsx49("div", { className, children: /* @__PURE__ */ jsx49("ul", { className: "tb-b-tm-list", children: cards }) })
|
|
5240
|
+
] });
|
|
5241
|
+
}
|
|
5242
|
+
return /* @__PURE__ */ jsxs38(Fragment34, { children: [
|
|
5243
|
+
/* @__PURE__ */ jsx49(R23Styles, {}),
|
|
5244
|
+
/* @__PURE__ */ jsxs38(
|
|
5245
|
+
"div",
|
|
5246
|
+
{
|
|
5247
|
+
className,
|
|
5248
|
+
role: "region",
|
|
5249
|
+
"aria-roledescription": "carousel",
|
|
5250
|
+
"aria-label": label2,
|
|
5251
|
+
"data-interval": String(Math.min(15e3, Math.max(3e3, interval))),
|
|
5252
|
+
onMouseEnter: () => setHover(true),
|
|
5253
|
+
onMouseLeave: () => setHover(false),
|
|
5254
|
+
onFocus: () => setFocus(true),
|
|
5255
|
+
onBlur: () => setFocus(false),
|
|
5256
|
+
children: [
|
|
5257
|
+
/* @__PURE__ */ jsx49("div", { className: "tb-b-tm-list", ref: track, role: "group", tabIndex: 0, children: cards }),
|
|
5258
|
+
/* @__PURE__ */ jsxs38("div", { className: `tb-b-tm-ctrl${live ? "" : " tb-b-tm-ctrl--wait"}`, children: [
|
|
5259
|
+
/* @__PURE__ */ jsx49("button", { type: "button", className: "tb-b-tm-btn", "aria-label": prevLabel, onClick: () => step2(-1), children: /* @__PURE__ */ jsx49("span", { "aria-hidden": "true", children: "\u2039" }) }),
|
|
5260
|
+
props.autoplay === true && !(live && !motion) && /* @__PURE__ */ jsx49("button", { type: "button", className: "tb-b-tm-btn tb-b-tm-pause", "aria-label": paused ? playLabel : pauseLabel, onClick: () => setPaused(!paused), children: /* @__PURE__ */ jsx49("span", { "aria-hidden": "true", children: paused ? "\u25B6" : "\u23F8" }) }),
|
|
5261
|
+
/* @__PURE__ */ jsx49("button", { type: "button", className: "tb-b-tm-btn", "aria-label": nextLabel, onClick: () => step2(1), children: /* @__PURE__ */ jsx49("span", { "aria-hidden": "true", children: "\u203A" }) })
|
|
5262
|
+
] })
|
|
5263
|
+
]
|
|
5264
|
+
}
|
|
5265
|
+
)
|
|
5266
|
+
] });
|
|
5267
|
+
}
|
|
5268
|
+
var testimonialsWidgets = [{ ...r23Definition("basic.testimonials"), Component: Testimonials }];
|
|
5269
|
+
|
|
5270
|
+
// src/basics/r23/trust-badges.tsx
|
|
5271
|
+
import { Fragment as Fragment35, jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
5272
|
+
var LAYOUTS4 = ["row", "grid"];
|
|
5273
|
+
function TrustBadges({ props, mediaOrigin, editMode }) {
|
|
5274
|
+
const badges = rowsOf(props.items).filter((row) => str(row.title) !== void 0 || str(row.text) !== void 0);
|
|
5275
|
+
const methods = rowsOf(props.paymentIcons).flatMap((row) => typeof row.method === "string" ? [row.method] : []);
|
|
5276
|
+
if (badges.length === 0 && methods.length === 0) {
|
|
5277
|
+
return /* @__PURE__ */ jsxs39(Fragment35, { children: [
|
|
5278
|
+
/* @__PURE__ */ jsx50(R23Styles, {}),
|
|
5279
|
+
/* @__PURE__ */ jsx50(Placeholder, { editMode, children: "Add badges or payment methods in the settings" })
|
|
5280
|
+
] });
|
|
5281
|
+
}
|
|
5282
|
+
return /* @__PURE__ */ jsxs39(Fragment35, { children: [
|
|
5283
|
+
/* @__PURE__ */ jsx50(R23Styles, {}),
|
|
5284
|
+
/* @__PURE__ */ jsxs39("div", { className: `tb-b-trust tb-b-trust--${oneOf(props.layout, LAYOUTS4, "row")}`, children: [
|
|
5285
|
+
badges.length > 0 && /* @__PURE__ */ jsx50("ul", { className: "tb-b-badges", children: badges.map((row, index) => {
|
|
5286
|
+
const svg = usableAsset(row.svgAsset, mediaOrigin) === null ? null : row.svgAsset;
|
|
5287
|
+
const title = str(row.title);
|
|
5288
|
+
const href = hrefOf(row.link, mediaOrigin);
|
|
5289
|
+
const text = str(row.text);
|
|
5290
|
+
return /* @__PURE__ */ jsxs39("li", { className: "tb-b-badge", children: [
|
|
5291
|
+
/* @__PURE__ */ jsx50("span", { className: "tb-b-badge-icon", "aria-hidden": "true", children: svg !== null ? /* @__PURE__ */ jsx50(SvgFromAsset, { asset: svg, mediaOrigin }) : /* @__PURE__ */ jsx50(BadgeIcon, { name: textOf3(row.icon) }) }),
|
|
5292
|
+
/* @__PURE__ */ jsxs39("span", { className: "tb-b-badge-body", children: [
|
|
5293
|
+
title !== void 0 && /* @__PURE__ */ jsx50("span", { className: "tb-b-badge-title", children: href === null ? title : /* @__PURE__ */ jsx50("a", { href, children: title }) }),
|
|
5294
|
+
text !== void 0 && /* @__PURE__ */ jsx50("span", { className: "tb-b-badge-text", children: text })
|
|
5295
|
+
] })
|
|
5296
|
+
] }, `${String(index)}:${textOf3(row.title)}`);
|
|
5297
|
+
}) }),
|
|
5298
|
+
methods.length > 0 && /* @__PURE__ */ jsx50("ul", { className: "tb-b-pay", role: "list", "aria-label": str(props.paymentTitle) ?? "Payment methods we accept", children: methods.map((method, index) => /* @__PURE__ */ jsx50("li", { children: /* @__PURE__ */ jsx50(PaymentMark, { method }) }, `${String(index)}:${method}`)) })
|
|
5299
|
+
] })
|
|
5300
|
+
] });
|
|
5301
|
+
}
|
|
5302
|
+
var trustBadgesWidgets = [{ ...r23Definition("basic.trust-badges"), Component: TrustBadges }];
|
|
5303
|
+
|
|
5304
|
+
// src/basics/r23/index.ts
|
|
5305
|
+
var r23ContentWidgets = [
|
|
5306
|
+
...imageWithTextWidgets,
|
|
5307
|
+
...featureGridWidgets,
|
|
5308
|
+
...testimonialsWidgets,
|
|
5309
|
+
...logoStripWidgets,
|
|
5310
|
+
...socialLinksWidgets,
|
|
5311
|
+
...trustBadgesWidgets
|
|
5312
|
+
];
|
|
5313
|
+
|
|
5314
|
+
// src/basics/r23/before-after.tsx
|
|
5315
|
+
import { useRef as useRef6, useState as useState11 } from "react";
|
|
5316
|
+
|
|
5317
|
+
// src/basics/r23/media-shared.tsx
|
|
5318
|
+
import { BASIC_WIDGET_DEFINITIONS as BASIC_WIDGET_DEFINITIONS4, safeUrl as safeUrl19 } from "@usethrottle/builder-schema";
|
|
5319
|
+
import { Fragment as Fragment36, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5320
|
+
function r23MediaDefinition(type) {
|
|
5321
|
+
const found = BASIC_WIDGET_DEFINITIONS4.filter((d) => d.type === type).sort((a, b) => b.v - a.v)[0];
|
|
5322
|
+
if (found === void 0) throw new Error(`No R2.3 definition of ${type}`);
|
|
5323
|
+
return found;
|
|
5324
|
+
}
|
|
5325
|
+
var mediaRows = (value) => Array.isArray(value) ? value.flatMap((row) => isRecord4(row) ? [row] : []) : [];
|
|
5326
|
+
var mediaText = (value) => typeof value === "string" ? value : "";
|
|
5327
|
+
function mediaAsset(value, mediaOrigin) {
|
|
5328
|
+
return isFrozenAsset(value) && safeUrl19(value.url, "src", { mediaOrigin }) !== null ? value : null;
|
|
5329
|
+
}
|
|
5330
|
+
function MediaImage({
|
|
5331
|
+
asset,
|
|
5332
|
+
mediaOrigin,
|
|
5333
|
+
alt,
|
|
5334
|
+
sizes,
|
|
5335
|
+
priority = false,
|
|
5336
|
+
style
|
|
5337
|
+
}) {
|
|
5338
|
+
const src = safeUrl19(asset.url, "src", { mediaOrigin });
|
|
5339
|
+
if (src === null) return null;
|
|
5340
|
+
const srcSet = asset.variants.flatMap((variant) => {
|
|
5341
|
+
const url = safeUrl19(variant.url, "src", { mediaOrigin });
|
|
5342
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
5343
|
+
}).join(", ");
|
|
5344
|
+
return /* @__PURE__ */ jsx51(
|
|
5345
|
+
"img",
|
|
5346
|
+
{
|
|
5347
|
+
src,
|
|
5348
|
+
...srcSet === "" ? {} : { srcSet, sizes },
|
|
5349
|
+
width: asset.width,
|
|
5350
|
+
height: asset.height,
|
|
5351
|
+
alt,
|
|
5352
|
+
loading: priority ? "eager" : "lazy",
|
|
5353
|
+
...priority ? { fetchPriority: "high" } : {},
|
|
5354
|
+
decoding: "async",
|
|
5355
|
+
style: { aspectRatio: `${String(asset.width)} / ${String(asset.height)}`, ...style }
|
|
5356
|
+
}
|
|
5357
|
+
);
|
|
5358
|
+
}
|
|
5359
|
+
var R23_MEDIA_CSS = `@layer throttle{
|
|
5360
|
+
.tb-b-msr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
5361
|
+
.tb-b-gal{--g:calc(var(--b-gap,12)*1px)}
|
|
5362
|
+
.tb-b-gal-list{margin:0;padding:0;list-style:none}
|
|
5363
|
+
.tb-b-gal--grid .tb-b-gal-list{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--g)}
|
|
5364
|
+
.tb-b-gal--masonry .tb-b-gal-list{column-count:var(--b-columnsDesktop,3);column-gap:var(--g)}
|
|
5365
|
+
.tb-b-gal--masonry .tb-b-gal-list>li{break-inside:avoid;margin-block-end:var(--g)}
|
|
5366
|
+
.tb-b-gal-scroll{overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:thin}
|
|
5367
|
+
.tb-b-gal--carousel .tb-b-gal-list{display:flex;gap:var(--g)}
|
|
5368
|
+
.tb-b-gal--carousel .tb-b-gal-list>li{flex:0 0 calc((100% - (var(--b-columnsDesktop,3) - 1)*var(--g))/var(--b-columnsDesktop,3));scroll-snap-align:start;min-inline-size:0}
|
|
5369
|
+
@media (max-width:1024px){.tb-b-gal--grid .tb-b-gal-list{grid-template-columns:repeat(min(var(--b-columnsDesktop,3),3),minmax(0,1fr))}.tb-b-gal--masonry .tb-b-gal-list{column-count:min(var(--b-columnsDesktop,3),3)}.tb-b-gal--carousel .tb-b-gal-list>li{flex-basis:calc((100% - (min(var(--b-columnsDesktop,3),3) - 1)*var(--g))/min(var(--b-columnsDesktop,3),3))}}
|
|
5370
|
+
@media (max-width:767px){.tb-b-gal--grid .tb-b-gal-list{grid-template-columns:repeat(var(--b-columnsMobile,2),minmax(0,1fr))}.tb-b-gal--masonry .tb-b-gal-list{column-count:var(--b-columnsMobile,2)}.tb-b-gal--carousel .tb-b-gal-list>li{flex-basis:calc((100% - (var(--b-columnsMobile,2) - 1)*var(--g))/var(--b-columnsMobile,2))}}
|
|
5371
|
+
.tb-b-gal-item{margin:0;position:relative;min-inline-size:0}
|
|
5372
|
+
.tb-b-gal-item img{display:block;inline-size:100%;block-size:auto;object-fit:cover}
|
|
5373
|
+
.tb-b-gal-link{display:block;min-block-size:44px}
|
|
5374
|
+
.tb-b-gal-link:focus-visible,.tb-b-gal-scroll:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5375
|
+
.tb-b-gal-item figcaption{padding-block-start:4px;font-size:.875em;overflow-wrap:anywhere}
|
|
5376
|
+
.tb-b-gal--caps-overlay .tb-b-gal-item figcaption{position:absolute;inset-inline:0;inset-block-end:0;padding:6px 10px;background:rgba(0,0,0,.65);color:#fff;pointer-events:none}
|
|
5377
|
+
.tb-b-gal-ctrl{display:flex;justify-content:center;gap:8px;margin-block-start:8px}
|
|
5378
|
+
.tb-b-gal-btn,.tb-b-gal-dialog button{appearance:none;cursor:pointer;font:inherit;color:inherit;background:transparent;border:1px solid currentColor;border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 16px}
|
|
5379
|
+
.tb-b-gal-btn[hidden]{display:none}
|
|
5380
|
+
.tb-b-gal-btn:focus-visible,.tb-b-gal-dialog button:focus-visible{outline:3px solid #fff;outline-offset:2px}
|
|
5381
|
+
.tb-b-gal-ctrl .tb-b-gal-btn:focus-visible{outline-color:var(--tb-color-primary,currentColor)}
|
|
5382
|
+
.tb-b-gal-dialog{position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;box-sizing:border-box;padding:16px;background:rgba(0,0,0,.92);color:#fff}
|
|
5383
|
+
.tb-b-gal-stage{display:flex;align-items:center;justify-content:center;gap:12px;inline-size:100%;min-block-size:0}
|
|
5384
|
+
.tb-b-gal-stage figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:8px;min-inline-size:0}
|
|
5385
|
+
.tb-b-gal-stage img{display:block;inline-size:auto;max-inline-size:100%;block-size:auto;max-block-size:72vh;object-fit:contain}
|
|
5386
|
+
.tb-b-gal-stage figcaption{text-align:center;overflow-wrap:anywhere}
|
|
5387
|
+
.tb-b-gal-status{font-size:.875em}
|
|
5388
|
+
.tb-b-gal-x{position:absolute;inset-block-start:12px;inset-inline-end:12px}
|
|
5389
|
+
.tb-b-ba{inline-size:100%}
|
|
5390
|
+
.tb-b-ba-stage{position:relative;overflow:hidden;inline-size:100%;border-radius:var(--throttle-radius,8px);touch-action:pan-y;user-select:none}
|
|
5391
|
+
.tb-b-ba--vertical .tb-b-ba-stage{touch-action:pan-x}
|
|
5392
|
+
.tb-b-ba-pane{margin:0;position:absolute;inset:0}
|
|
5393
|
+
.tb-b-ba-pane img{display:block;inline-size:100%;block-size:100%;object-fit:cover}
|
|
5394
|
+
.tb-b-ba-after{clip-path:inset(0 0 0 var(--pos,50%))}
|
|
5395
|
+
:dir(rtl) .tb-b-ba-after{clip-path:inset(0 var(--pos,50%) 0 0)}
|
|
5396
|
+
.tb-b-ba--vertical .tb-b-ba-after,:dir(rtl) .tb-b-ba--vertical .tb-b-ba-after{clip-path:inset(var(--pos,50%) 0 0 0)}
|
|
5397
|
+
.tb-b-ba-pane figcaption{position:absolute;inset-block-start:8px;padding:4px 10px;border-radius:4px;background:rgba(0,0,0,.7);color:#fff;font-size:.875em}
|
|
5398
|
+
.tb-b-ba-before figcaption{inset-inline-start:8px}
|
|
5399
|
+
.tb-b-ba-after figcaption{inset-inline-end:8px}
|
|
5400
|
+
.tb-b-ba--vertical .tb-b-ba-after figcaption{inset-block-start:auto;inset-block-end:8px;inset-inline-end:auto;inset-inline-start:8px}
|
|
5401
|
+
.tb-b-ba-range{position:absolute;inset:0;inline-size:100%;block-size:100%;margin:0;opacity:0;pointer-events:none}
|
|
5402
|
+
.tb-b-ba-handle{position:absolute;inset-block:0;inset-inline-start:var(--pos,50%);inline-size:4px;margin-inline-start:-2px;background:var(--b-handleColor,#fff);box-shadow:0 0 0 1px rgba(0,0,0,.35);pointer-events:none}
|
|
5403
|
+
.tb-b-ba-handle::after{content:"";position:absolute;inset-block-start:50%;inset-inline-start:50%;inline-size:44px;block-size:44px;margin:-22px 0 0 -22px;border-radius:50%;background:var(--b-handleColor,#fff);box-shadow:0 0 0 1px rgba(0,0,0,.35),0 2px 6px rgba(0,0,0,.35)}
|
|
5404
|
+
:dir(rtl) .tb-b-ba-handle::after{margin-inline:0;margin:-22px -22px 0 0}
|
|
5405
|
+
.tb-b-ba--vertical .tb-b-ba-handle{inset-block:auto;inset-inline:0;inset-block-start:var(--pos,50%);inline-size:auto;block-size:4px;margin:-2px 0 0}
|
|
5406
|
+
.tb-b-ba-range:focus-visible+.tb-b-ba-handle::after{outline:3px solid var(--tb-color-primary,#2563eb);outline-offset:2px}
|
|
5407
|
+
@media (scripting:none){.tb-b-ba-stage{aspect-ratio:auto!important;display:grid;grid-template-columns:1fr 1fr;gap:8px;overflow:visible}.tb-b-ba--vertical .tb-b-ba-stage{grid-template-columns:1fr}.tb-b-ba-pane{position:relative;inset:auto;aspect-ratio:var(--ba-ratio,auto);clip-path:none!important}.tb-b-ba-range,.tb-b-ba-handle{display:none}}
|
|
5408
|
+
.tb-b-ct{color:var(--b-color,inherit)}
|
|
5409
|
+
.tb-b-ct-scroll{overflow-x:auto}
|
|
5410
|
+
.tb-b-ct-scroll:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5411
|
+
.tb-b-ct--sticky-head .tb-b-ct-scroll{max-block-size:70vh;overflow:auto}
|
|
5412
|
+
.tb-b-ct-table{border-collapse:separate;border-spacing:0;inline-size:100%;min-inline-size:36rem}
|
|
5413
|
+
.tb-b-ct-table caption{caption-side:top;text-align:start;font-weight:600;padding-block-end:8px}
|
|
5414
|
+
.tb-b-ct-table th,.tb-b-ct-table td{padding:12px 16px;border-block-end:1px solid var(--tb-color-border,currentColor);text-align:center;vertical-align:middle;background:var(--tb-color-background,#fff)}
|
|
5415
|
+
.tb-b-ct-table tbody th{text-align:start;font-weight:600}
|
|
5416
|
+
.tb-b-ct-table thead th{font-weight:600}
|
|
5417
|
+
.tb-b-ct-table .tb-b-ct-title{display:block}
|
|
5418
|
+
.tb-b-ct-table thead .tb-b-button{display:inline-flex;align-items:center;justify-content:center;min-block-size:44px;box-sizing:border-box;margin-block-start:8px}
|
|
5419
|
+
.tb-b-ct-table thead a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5420
|
+
.tb-b-ct--sticky-head .tb-b-ct-table thead th{position:sticky;inset-block-start:0;z-index:2}
|
|
5421
|
+
.tb-b-ct--sticky-col .tb-b-ct-table tbody th,.tb-b-ct--sticky-col .tb-b-ct-table thead th:first-child{position:sticky;inset-inline-start:0;z-index:1}
|
|
5422
|
+
.tb-b-ct--sticky-col.tb-b-ct--sticky-head .tb-b-ct-table thead th:first-child{z-index:3}
|
|
5423
|
+
.tb-b-ct-table .is-hl{background:color-mix(in srgb,var(--b-highlightColor,var(--tb-color-primary,#2563eb)) 12%,var(--tb-color-background,#fff))}
|
|
5424
|
+
.tb-b-ct-mark{font-weight:700}
|
|
5425
|
+
.tb-b-ct-stack{display:none}
|
|
5426
|
+
.tb-b-ct-stack-card{padding:16px;border:1px solid var(--tb-color-border,currentColor);border-radius:var(--throttle-radius,8px)}
|
|
5427
|
+
.tb-b-ct-stack-card.is-hl{background:color-mix(in srgb,var(--b-highlightColor,var(--tb-color-primary,#2563eb)) 12%,var(--tb-color-background,#fff))}
|
|
5428
|
+
.tb-b-ct-stack-title{margin:0 0 8px;font-weight:700}
|
|
5429
|
+
.tb-b-ct-stack dl{margin:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px}
|
|
5430
|
+
.tb-b-ct-stack dt{font-weight:600}
|
|
5431
|
+
.tb-b-ct-stack dd{margin:0;text-align:end}
|
|
5432
|
+
.tb-b-ct-stack .tb-b-button{display:inline-flex;align-items:center;min-block-size:44px;box-sizing:border-box;margin-block-start:8px}
|
|
5433
|
+
@media (max-width:767px){.tb-b-ct--stacked .tb-b-ct-scroll{display:none}.tb-b-ct--stacked .tb-b-ct-stack{display:grid;gap:16px}}
|
|
5434
|
+
.tb-b-map{display:grid;gap:16px}
|
|
5435
|
+
.tb-b-map--list-beside{grid-template-columns:minmax(0,2fr) minmax(0,1fr);align-items:start}
|
|
5436
|
+
@media (max-width:767px){.tb-b-map--list-beside{grid-template-columns:minmax(0,1fr)}}
|
|
5437
|
+
.tb-b-map-frame{position:relative;block-size:calc(var(--b-height,400)*1px);border-radius:var(--throttle-radius,8px);overflow:hidden;background:var(--tb-color-muted,#eef0f2)}
|
|
5438
|
+
.tb-b-map-frame iframe{display:block;inline-size:100%;block-size:100%;border:0}
|
|
5439
|
+
.tb-b-map-facade{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;text-align:center;background:repeating-linear-gradient(45deg,transparent 0 14px,rgba(0,0,0,.04) 14px 28px)}
|
|
5440
|
+
.tb-b-map-pin{inline-size:28px;block-size:28px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--tb-color-primary,#2563eb)}
|
|
5441
|
+
.tb-b-map-note{margin:0;max-inline-size:32rem;font-size:.875em}
|
|
5442
|
+
.tb-b-map-load,.tb-b-map-show{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,#fff);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 16px}
|
|
5443
|
+
.tb-b-map-load:focus-visible,.tb-b-map-show:focus-visible,.tb-b-map-card a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5444
|
+
.tb-b-map-show[hidden]{display:none}
|
|
5445
|
+
.tb-b-map-list{margin:0;padding:0;list-style:none;display:grid;gap:12px}
|
|
5446
|
+
.tb-b-map--list-hidden .tb-b-map-list{position:absolute;inline-size:1px;block-size:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
5447
|
+
.tb-b-map-card{display:flex;flex-direction:column;gap:4px;padding:12px;border:1px solid var(--tb-color-border,currentColor);border-radius:var(--throttle-radius,8px);overflow-wrap:anywhere}
|
|
5448
|
+
.tb-b-map-card p{margin:0}
|
|
5449
|
+
.tb-b-map-name{font-weight:600}
|
|
5450
|
+
.tb-b-map-card a{display:inline-flex;align-items:center;min-block-size:44px;color:inherit}
|
|
5451
|
+
}`;
|
|
5452
|
+
function R23MediaStyles() {
|
|
5453
|
+
return /* @__PURE__ */ jsxs40(Fragment36, { children: [
|
|
5454
|
+
/* @__PURE__ */ jsx51(BasicStyles, {}),
|
|
5455
|
+
/* @__PURE__ */ jsx51("style", { href: "tb-basics-r23-media", precedence: "throttle", children: R23_MEDIA_CSS })
|
|
5456
|
+
] });
|
|
5457
|
+
}
|
|
5458
|
+
|
|
5459
|
+
// src/basics/r23/before-after.tsx
|
|
5460
|
+
import { Fragment as Fragment37, jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5461
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
5462
|
+
var RATIOS2 = { "1:1": "1 / 1", "4:3": "4 / 3", "3:2": "3 / 2", "16:9": "16 / 9" };
|
|
5463
|
+
var clamp = (n) => Math.min(100, Math.max(0, Math.round(n)));
|
|
5464
|
+
function BeforeAfter({ props, mediaOrigin, editMode }) {
|
|
5465
|
+
const startValue = typeof props.start === "number" && Number.isFinite(props.start) ? clamp(props.start) : 50;
|
|
5466
|
+
const [pos, setPos] = useState11(startValue);
|
|
5467
|
+
const stage = useRef6(null);
|
|
5468
|
+
const dragging = useRef6(false);
|
|
5469
|
+
const before = mediaAsset(props.before, mediaOrigin);
|
|
5470
|
+
const after = mediaAsset(props.after, mediaOrigin);
|
|
5471
|
+
if (before === null || after === null) {
|
|
5472
|
+
return /* @__PURE__ */ jsxs41(Fragment37, { children: [
|
|
5473
|
+
/* @__PURE__ */ jsx52(R23MediaStyles, {}),
|
|
5474
|
+
/* @__PURE__ */ jsx52(Placeholder, { editMode, children: "Choose a before and an after image" })
|
|
5475
|
+
] });
|
|
5476
|
+
}
|
|
5477
|
+
const orientation = oneOf(props.orientation, ORIENTATIONS, "horizontal");
|
|
5478
|
+
const vertical = orientation === "vertical";
|
|
5479
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS2, props.ratio) ? RATIOS2[props.ratio] : `${String(before.width)} / ${String(before.height)}`;
|
|
5480
|
+
const beforeLabel = str(props.beforeLabel) ?? "Before";
|
|
5481
|
+
const afterLabel = str(props.afterLabel) ?? "After";
|
|
5482
|
+
const name = str(props.handleLabel) ?? "Comparison slider";
|
|
5483
|
+
const isRtl = () => stage.current !== null && getComputedStyle(stage.current).direction === "rtl";
|
|
5484
|
+
const onKeyDown = (event) => {
|
|
5485
|
+
const flip = !vertical && isRtl();
|
|
5486
|
+
const keys = { ArrowRight: flip ? -1 : 1, ArrowUp: vertical ? -1 : 1, ArrowLeft: flip ? 1 : -1, ArrowDown: vertical ? 1 : -1, PageUp: 10, PageDown: -10 };
|
|
5487
|
+
if (event.key === "Home") setPos(0);
|
|
5488
|
+
else if (event.key === "End") setPos(100);
|
|
5489
|
+
else if (Object.hasOwn(keys, event.key)) setPos((current) => clamp(current + (keys[event.key] ?? 0)));
|
|
5490
|
+
else return;
|
|
5491
|
+
event.preventDefault();
|
|
5492
|
+
};
|
|
5493
|
+
const fromPointer = (event) => {
|
|
5494
|
+
const rect = stage.current?.getBoundingClientRect();
|
|
5495
|
+
if (rect === void 0) return;
|
|
5496
|
+
const size = vertical ? rect.height : rect.width;
|
|
5497
|
+
if (size <= 0) return;
|
|
5498
|
+
const offset = vertical ? event.clientY - rect.top : isRtl() ? rect.right - event.clientX : event.clientX - rect.left;
|
|
5499
|
+
setPos(clamp(offset / size * 100));
|
|
5500
|
+
};
|
|
5501
|
+
const style = { aspectRatio: ratio, "--ba-ratio": ratio, "--pos": `${String(pos)}%` };
|
|
5502
|
+
return /* @__PURE__ */ jsxs41(Fragment37, { children: [
|
|
5503
|
+
/* @__PURE__ */ jsx52(R23MediaStyles, {}),
|
|
5504
|
+
/* @__PURE__ */ jsx52("div", { className: `tb-b-ba tb-b-ba--${orientation}`, children: /* @__PURE__ */ jsxs41(
|
|
5505
|
+
"div",
|
|
5506
|
+
{
|
|
5507
|
+
ref: stage,
|
|
5508
|
+
className: "tb-b-ba-stage",
|
|
5509
|
+
style,
|
|
5510
|
+
onPointerDown: (event) => {
|
|
5511
|
+
if (event.button > 0) return;
|
|
5512
|
+
dragging.current = true;
|
|
5513
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
5514
|
+
fromPointer(event);
|
|
5515
|
+
},
|
|
5516
|
+
onPointerMove: (event) => {
|
|
5517
|
+
if (dragging.current) fromPointer(event);
|
|
5518
|
+
},
|
|
5519
|
+
onPointerUp: () => {
|
|
5520
|
+
dragging.current = false;
|
|
5521
|
+
},
|
|
5522
|
+
onPointerCancel: () => {
|
|
5523
|
+
dragging.current = false;
|
|
5524
|
+
},
|
|
5525
|
+
children: [
|
|
5526
|
+
/* @__PURE__ */ jsxs41("figure", { className: "tb-b-ba-pane tb-b-ba-before", children: [
|
|
5527
|
+
/* @__PURE__ */ jsx52(MediaImage, { asset: before, mediaOrigin, alt: str(props.beforeAlt) ?? "", sizes: "100vw", priority: props.priority === true, style: { aspectRatio: "auto" } }),
|
|
5528
|
+
/* @__PURE__ */ jsx52("figcaption", { children: beforeLabel })
|
|
5529
|
+
] }),
|
|
5530
|
+
/* @__PURE__ */ jsxs41("figure", { className: "tb-b-ba-pane tb-b-ba-after", children: [
|
|
5531
|
+
/* @__PURE__ */ jsx52(MediaImage, { asset: after, mediaOrigin, alt: str(props.afterAlt) ?? "", sizes: "100vw", priority: props.priority === true, style: { aspectRatio: "auto" } }),
|
|
5532
|
+
/* @__PURE__ */ jsx52("figcaption", { children: afterLabel })
|
|
5533
|
+
] }),
|
|
5534
|
+
/* @__PURE__ */ jsx52(
|
|
5535
|
+
"input",
|
|
5536
|
+
{
|
|
5537
|
+
type: "range",
|
|
5538
|
+
className: "tb-b-ba-range",
|
|
5539
|
+
min: 0,
|
|
5540
|
+
max: 100,
|
|
5541
|
+
step: 1,
|
|
5542
|
+
value: pos,
|
|
5543
|
+
"aria-label": name,
|
|
5544
|
+
"aria-orientation": orientation,
|
|
5545
|
+
"aria-valuetext": `${String(pos)} % ${beforeLabel}, ${String(100 - pos)} % ${afterLabel}`,
|
|
5546
|
+
onKeyDown,
|
|
5547
|
+
onChange: (event) => setPos(clamp(Number(event.target.value)))
|
|
5548
|
+
}
|
|
5549
|
+
),
|
|
5550
|
+
/* @__PURE__ */ jsx52("span", { className: "tb-b-ba-handle", "aria-hidden": "true" })
|
|
5551
|
+
]
|
|
5552
|
+
}
|
|
5553
|
+
) })
|
|
5554
|
+
] });
|
|
5555
|
+
}
|
|
5556
|
+
var beforeAfterWidgets = [{ ...r23MediaDefinition("basic.before-after"), Component: BeforeAfter }];
|
|
5557
|
+
|
|
5558
|
+
// src/basics/r23/comparison-table.tsx
|
|
5559
|
+
import { useId as useId5 } from "react";
|
|
5560
|
+
import { Fragment as Fragment38, jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5561
|
+
var MODES2 = ["scroll", "stacked"];
|
|
5562
|
+
var VALUE_KEYS = ["value1", "value2", "value3", "value4", "value5"];
|
|
5563
|
+
function ComparisonTable({ props, mediaOrigin, editMode }) {
|
|
5564
|
+
const stackId = useId5();
|
|
5565
|
+
const columns = mediaRows(props.columns).slice(0, 5).flatMap((row, index) => {
|
|
5566
|
+
const title = str(row.title);
|
|
5567
|
+
return title === void 0 ? [] : [{ index, title, highlight: row.highlight === true, href: hrefOf(row.link, mediaOrigin), buttonLabel: str(row.buttonLabel) }];
|
|
5568
|
+
});
|
|
5569
|
+
const rows = mediaRows(props.rows).flatMap((row) => {
|
|
5570
|
+
const label2 = str(row.label);
|
|
5571
|
+
return label2 === void 0 ? [] : [{ label: label2, row }];
|
|
5572
|
+
});
|
|
5573
|
+
if (columns.length === 0 || rows.length === 0) {
|
|
5574
|
+
return /* @__PURE__ */ jsxs42(Fragment38, { children: [
|
|
5575
|
+
/* @__PURE__ */ jsx53(R23MediaStyles, {}),
|
|
5576
|
+
/* @__PURE__ */ jsx53(Placeholder, { editMode, children: "Add columns and rows in the settings" })
|
|
5577
|
+
] });
|
|
5578
|
+
}
|
|
5579
|
+
const included = str(props.includedText) ?? "Included";
|
|
5580
|
+
const notIncluded = str(props.notIncludedText) ?? "Not included";
|
|
5581
|
+
const notApplicable = str(props.notApplicableText) ?? "Not applicable";
|
|
5582
|
+
const mode = oneOf(props.mobileMode, MODES2, "scroll");
|
|
5583
|
+
const caption = str(props.caption);
|
|
5584
|
+
const cell = (raw) => {
|
|
5585
|
+
const value = mediaText(raw).trim();
|
|
5586
|
+
switch (value.toLowerCase()) {
|
|
5587
|
+
case "check":
|
|
5588
|
+
case "\u2713":
|
|
5589
|
+
case "\u2714":
|
|
5590
|
+
return /* @__PURE__ */ jsxs42(Fragment38, { children: [
|
|
5591
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-ct-mark tb-b-ct-mark--check", "aria-hidden": "true", children: "\u2713" }),
|
|
5592
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-msr", children: included })
|
|
5593
|
+
] });
|
|
5594
|
+
case "cross":
|
|
5595
|
+
case "\u2715":
|
|
5596
|
+
case "\u2717":
|
|
5597
|
+
case "\u2716":
|
|
5598
|
+
return /* @__PURE__ */ jsxs42(Fragment38, { children: [
|
|
5599
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-ct-mark tb-b-ct-mark--cross", "aria-hidden": "true", children: "\u2715" }),
|
|
5600
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-msr", children: notIncluded })
|
|
5601
|
+
] });
|
|
5602
|
+
case "dash":
|
|
5603
|
+
case "\u2013":
|
|
5604
|
+
case "\u2014":
|
|
5605
|
+
return /* @__PURE__ */ jsxs42(Fragment38, { children: [
|
|
5606
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-ct-mark tb-b-ct-mark--dash", "aria-hidden": "true", children: "\u2013" }),
|
|
5607
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-msr", children: notApplicable })
|
|
5608
|
+
] });
|
|
5609
|
+
default:
|
|
5610
|
+
return value;
|
|
5611
|
+
}
|
|
5612
|
+
};
|
|
5613
|
+
const button = (col) => col.href !== null && col.buttonLabel !== void 0 ? /* @__PURE__ */ jsx53("a", { className: "tb-b-button tb-b-button--primary", href: col.href, "aria-label": `${col.buttonLabel}: ${col.title}`, children: col.buttonLabel }) : null;
|
|
5614
|
+
const className = [
|
|
5615
|
+
"tb-b-ct",
|
|
5616
|
+
props.stickyHeader === true ? "tb-b-ct--sticky-head" : "",
|
|
5617
|
+
props.stickyFirstColumn === true ? "tb-b-ct--sticky-col" : "",
|
|
5618
|
+
mode === "stacked" ? "tb-b-ct--stacked" : ""
|
|
5619
|
+
].filter((c) => c !== "").join(" ");
|
|
5620
|
+
return /* @__PURE__ */ jsxs42(Fragment38, { children: [
|
|
5621
|
+
/* @__PURE__ */ jsx53(R23MediaStyles, {}),
|
|
5622
|
+
/* @__PURE__ */ jsxs42("div", { className, children: [
|
|
5623
|
+
/* @__PURE__ */ jsx53("div", { className: "tb-b-ct-scroll", role: "region", tabIndex: 0, "aria-label": str(props.scrollLabel) ?? "Comparison table, scrollable", children: /* @__PURE__ */ jsxs42("table", { className: "tb-b-ct-table", children: [
|
|
5624
|
+
caption !== void 0 && /* @__PURE__ */ jsx53("caption", { children: caption }),
|
|
5625
|
+
/* @__PURE__ */ jsx53("thead", { children: /* @__PURE__ */ jsxs42("tr", { children: [
|
|
5626
|
+
/* @__PURE__ */ jsx53("th", { scope: "col", children: /* @__PURE__ */ jsx53("span", { className: "tb-b-msr", children: str(props.featureLabel) ?? "Feature" }) }),
|
|
5627
|
+
columns.map((col) => /* @__PURE__ */ jsxs42("th", { scope: "col", className: col.highlight ? "is-hl" : void 0, children: [
|
|
5628
|
+
/* @__PURE__ */ jsx53("span", { className: "tb-b-ct-title", children: col.title }),
|
|
5629
|
+
button(col)
|
|
5630
|
+
] }, col.index))
|
|
5631
|
+
] }) }),
|
|
5632
|
+
/* @__PURE__ */ jsx53("tbody", { children: rows.map(({ label: label2, row }, r) => /* @__PURE__ */ jsxs42("tr", { children: [
|
|
5633
|
+
/* @__PURE__ */ jsx53("th", { scope: "row", children: label2 }),
|
|
5634
|
+
columns.map((col) => /* @__PURE__ */ jsx53("td", { className: col.highlight ? "is-hl" : void 0, children: cell(row[VALUE_KEYS[col.index] ?? "value1"]) }, col.index))
|
|
5635
|
+
] }, r)) })
|
|
5636
|
+
] }) }),
|
|
5637
|
+
mode === "stacked" && /* @__PURE__ */ jsx53("div", { className: "tb-b-ct-stack", children: columns.map((col) => /* @__PURE__ */ jsxs42("div", { role: "group", "aria-labelledby": `${stackId}-${String(col.index)}`, className: `tb-b-ct-stack-card${col.highlight ? " is-hl" : ""}`, children: [
|
|
5638
|
+
/* @__PURE__ */ jsx53("p", { id: `${stackId}-${String(col.index)}`, className: "tb-b-ct-stack-title", children: col.title }),
|
|
5639
|
+
/* @__PURE__ */ jsx53("dl", { children: rows.flatMap(({ label: label2, row }, r) => [
|
|
5640
|
+
/* @__PURE__ */ jsx53("dt", { children: label2 }, `t${String(r)}`),
|
|
5641
|
+
/* @__PURE__ */ jsx53("dd", { children: cell(row[VALUE_KEYS[col.index] ?? "value1"]) }, `d${String(r)}`)
|
|
5642
|
+
]) }),
|
|
5643
|
+
button(col)
|
|
5644
|
+
] }, col.index)) })
|
|
5645
|
+
] })
|
|
5646
|
+
] });
|
|
5647
|
+
}
|
|
5648
|
+
var comparisonTableWidgets = [{ ...r23MediaDefinition("basic.comparison-table"), Component: ComparisonTable }];
|
|
5649
|
+
|
|
5650
|
+
// src/basics/r23/gallery.tsx
|
|
5651
|
+
import { useEffect as useEffect13, useRef as useRef7, useState as useState12 } from "react";
|
|
5652
|
+
import { createPortal } from "react-dom";
|
|
5653
|
+
import { safeUrl as safeUrl20 } from "@usethrottle/builder-schema";
|
|
5654
|
+
import { Fragment as Fragment39, jsx as jsx54, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5655
|
+
var LAYOUTS5 = ["grid", "masonry", "carousel"];
|
|
5656
|
+
var CAPTIONS = ["below", "overlay", "hidden"];
|
|
5657
|
+
var RATIOS3 = { "1:1": "1 / 1", "4:5": "4 / 5" };
|
|
5658
|
+
var reducedMotion2 = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5659
|
+
var statusOf = (template, n, total) => template.replaceAll("{n}", String(n)).replaceAll("{total}", String(total));
|
|
5660
|
+
function Lightbox({
|
|
5661
|
+
shots,
|
|
5662
|
+
index,
|
|
5663
|
+
setIndex,
|
|
5664
|
+
onClose,
|
|
5665
|
+
returnTo,
|
|
5666
|
+
label: label2,
|
|
5667
|
+
statusText,
|
|
5668
|
+
texts,
|
|
5669
|
+
mediaOrigin
|
|
5670
|
+
}) {
|
|
5671
|
+
const dialog = useRef7(null);
|
|
5672
|
+
const closeButton = useRef7(null);
|
|
5673
|
+
useEffect13(() => {
|
|
5674
|
+
closeButton.current?.focus();
|
|
5675
|
+
const previous = document.body.style.overflow;
|
|
5676
|
+
document.body.style.overflow = "hidden";
|
|
5677
|
+
return () => {
|
|
5678
|
+
document.body.style.overflow = previous;
|
|
5679
|
+
returnTo?.focus();
|
|
5680
|
+
};
|
|
5681
|
+
}, [returnTo]);
|
|
5682
|
+
const total = shots.length;
|
|
5683
|
+
const go = (dir) => setIndex((index + dir + total) % total);
|
|
5684
|
+
const onKeyDown = (event) => {
|
|
5685
|
+
if (event.key === "Escape") {
|
|
5686
|
+
event.stopPropagation();
|
|
5687
|
+
onClose();
|
|
5688
|
+
} else if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
5689
|
+
if (total < 2) return;
|
|
5690
|
+
event.stopPropagation();
|
|
5691
|
+
const rtl = dialog.current !== null && getComputedStyle(dialog.current).direction === "rtl";
|
|
5692
|
+
go(event.key === "ArrowRight" !== rtl ? 1 : -1);
|
|
5693
|
+
} else if (event.key === "Tab") {
|
|
5694
|
+
event.stopPropagation();
|
|
5695
|
+
if (dialog.current !== null) trapTab(event, focusablesOf(dialog.current));
|
|
5696
|
+
}
|
|
5697
|
+
};
|
|
5698
|
+
const latestKeyDown = useRef7(onKeyDown);
|
|
5699
|
+
latestKeyDown.current = onKeyDown;
|
|
5700
|
+
useEffect13(() => {
|
|
5701
|
+
const listener = (event) => latestKeyDown.current(event);
|
|
5702
|
+
document.addEventListener("keydown", listener, true);
|
|
5703
|
+
return () => document.removeEventListener("keydown", listener, true);
|
|
5704
|
+
}, []);
|
|
5705
|
+
const shot = shots[index];
|
|
5706
|
+
if (shot === void 0) return null;
|
|
5707
|
+
return createPortal(
|
|
5708
|
+
/* @__PURE__ */ jsxs43(
|
|
5709
|
+
"div",
|
|
5710
|
+
{
|
|
5711
|
+
ref: dialog,
|
|
5712
|
+
className: "tb-b-gal-dialog",
|
|
5713
|
+
role: "dialog",
|
|
5714
|
+
"aria-modal": "true",
|
|
5715
|
+
"aria-label": label2,
|
|
5716
|
+
tabIndex: -1,
|
|
5717
|
+
onClick: (event) => {
|
|
5718
|
+
if (event.target === event.currentTarget) onClose();
|
|
5719
|
+
},
|
|
5720
|
+
children: [
|
|
5721
|
+
/* @__PURE__ */ jsx54("button", { ref: closeButton, type: "button", className: "tb-b-gal-x", onClick: onClose, children: texts.close }),
|
|
5722
|
+
/* @__PURE__ */ jsxs43("div", { className: "tb-b-gal-stage", children: [
|
|
5723
|
+
total > 1 && /* @__PURE__ */ jsx54("button", { type: "button", "aria-label": texts.prev, onClick: () => go(-1), children: "\u2039" }),
|
|
5724
|
+
/* @__PURE__ */ jsxs43("figure", { children: [
|
|
5725
|
+
/* @__PURE__ */ jsx54(AssetImage, { asset: shot.asset, mediaOrigin, alt: shot.alt, sizes: "100vw", loading: "eager" }),
|
|
5726
|
+
shot.caption !== void 0 && /* @__PURE__ */ jsx54("figcaption", { children: shot.caption })
|
|
5727
|
+
] }),
|
|
5728
|
+
total > 1 && /* @__PURE__ */ jsx54("button", { type: "button", "aria-label": texts.next, onClick: () => go(1), children: "\u203A" })
|
|
5729
|
+
] }),
|
|
5730
|
+
/* @__PURE__ */ jsx54("p", { className: "tb-b-gal-status", role: "status", "aria-live": "polite", children: statusOf(statusText, index + 1, total) })
|
|
5731
|
+
]
|
|
5732
|
+
}
|
|
5733
|
+
),
|
|
5734
|
+
document.body
|
|
5735
|
+
);
|
|
5736
|
+
}
|
|
5737
|
+
function Gallery({ props, mediaOrigin, editMode, interactive }) {
|
|
5738
|
+
const [open, setOpen2] = useState12(null);
|
|
5739
|
+
const returnTo = useRef7(null);
|
|
5740
|
+
const track = useRef7(null);
|
|
5741
|
+
const shots = [];
|
|
5742
|
+
for (const row of mediaRows(props.images)) {
|
|
5743
|
+
const asset = mediaAsset(row.image, mediaOrigin);
|
|
5744
|
+
const full = asset === null ? null : safeUrl20(asset.url, "src", { mediaOrigin });
|
|
5745
|
+
if (asset === null || full === null) continue;
|
|
5746
|
+
shots.push({ asset, full, alt: str(row.alt) ?? "", caption: str(row.caption), href: hrefOf(row.link, mediaOrigin) });
|
|
5747
|
+
}
|
|
5748
|
+
if (shots.length === 0) {
|
|
5749
|
+
return /* @__PURE__ */ jsxs43(Fragment39, { children: [
|
|
5750
|
+
/* @__PURE__ */ jsx54(R23MediaStyles, {}),
|
|
5751
|
+
/* @__PURE__ */ jsx54(Placeholder, { editMode, children: "Add images in the settings" })
|
|
5752
|
+
] });
|
|
5753
|
+
}
|
|
5754
|
+
const layout = oneOf(props.layout, LAYOUTS5, "grid");
|
|
5755
|
+
const captions = oneOf(props.captions, CAPTIONS, "below");
|
|
5756
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS3, props.ratio) ? RATIOS3[props.ratio] : void 0;
|
|
5757
|
+
const lightbox = props.lightbox !== false;
|
|
5758
|
+
const label2 = str(props.label) ?? "Gallery";
|
|
5759
|
+
const statusText = str(props.statusText) ?? "Image {n} of {total}";
|
|
5760
|
+
const texts = { close: str(props.closeLabel) ?? "Close", prev: str(props.prevLabel) ?? "Previous image", next: str(props.nextLabel) ?? "Next image" };
|
|
5761
|
+
const priority = props.priority === true;
|
|
5762
|
+
const columns = (value, fallback) => typeof value === "number" && value >= 1 ? value : fallback;
|
|
5763
|
+
const sizes = `(max-width: 767px) ${String(Math.round(100 / columns(props.columnsMobile, 2)))}vw, ${String(Math.round(100 / columns(props.columnsDesktop, 3)))}vw`;
|
|
5764
|
+
const step2 = (dir) => {
|
|
5765
|
+
const el = track.current;
|
|
5766
|
+
if (el === null) return;
|
|
5767
|
+
const rtl = getComputedStyle(el).direction === "rtl";
|
|
5768
|
+
el.scrollBy?.({ left: dir * el.clientWidth * (rtl ? -1 : 1), behavior: reducedMotion2() ? "auto" : "smooth" });
|
|
5769
|
+
};
|
|
5770
|
+
const items = shots.map((shot, index) => {
|
|
5771
|
+
const img = /* @__PURE__ */ jsx54(
|
|
5772
|
+
MediaImage,
|
|
5773
|
+
{
|
|
5774
|
+
asset: shot.asset,
|
|
5775
|
+
mediaOrigin,
|
|
5776
|
+
alt: shot.alt,
|
|
5777
|
+
sizes,
|
|
5778
|
+
priority: priority && index === 0,
|
|
5779
|
+
...ratio === void 0 ? {} : { style: { aspectRatio: ratio } }
|
|
5780
|
+
}
|
|
5781
|
+
);
|
|
5782
|
+
const href = lightbox ? shot.full : shot.href;
|
|
5783
|
+
const name = shot.alt === "" ? shot.caption ?? statusOf(statusText, index + 1, shots.length) : void 0;
|
|
5784
|
+
return /* @__PURE__ */ jsx54("li", { children: /* @__PURE__ */ jsxs43("figure", { className: "tb-b-gal-item", children: [
|
|
5785
|
+
href === null ? img : /* @__PURE__ */ jsx54(
|
|
5786
|
+
"a",
|
|
5787
|
+
{
|
|
5788
|
+
className: "tb-b-gal-link",
|
|
5789
|
+
href,
|
|
5790
|
+
...name === void 0 ? {} : { "aria-label": name },
|
|
5791
|
+
...lightbox ? { "aria-haspopup": "dialog" } : {},
|
|
5792
|
+
onClick: lightbox && interactive !== false && !editMode ? (event) => {
|
|
5793
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
5794
|
+
event.preventDefault();
|
|
5795
|
+
returnTo.current = event.currentTarget;
|
|
5796
|
+
setOpen2(index);
|
|
5797
|
+
} : void 0,
|
|
5798
|
+
children: img
|
|
5799
|
+
}
|
|
5800
|
+
),
|
|
5801
|
+
captions !== "hidden" && shot.caption !== void 0 && /* @__PURE__ */ jsx54("figcaption", { children: shot.caption })
|
|
5802
|
+
] }) }, index);
|
|
5803
|
+
});
|
|
5804
|
+
const carousel = layout === "carousel" && shots.length > 1;
|
|
5805
|
+
const className = `tb-b-gal tb-b-gal--${carousel ? "carousel" : layout === "carousel" ? "grid" : layout} tb-b-gal--caps-${captions}`;
|
|
5806
|
+
return /* @__PURE__ */ jsxs43(Fragment39, { children: [
|
|
5807
|
+
/* @__PURE__ */ jsx54(R23MediaStyles, {}),
|
|
5808
|
+
/* @__PURE__ */ jsxs43("div", { className, children: [
|
|
5809
|
+
carousel ? /* @__PURE__ */ jsxs43(Fragment39, { children: [
|
|
5810
|
+
/* @__PURE__ */ jsx54("div", { className: "tb-b-gal-scroll", ref: track, role: "group", tabIndex: 0, "aria-label": label2, children: /* @__PURE__ */ jsx54("ul", { className: "tb-b-gal-list", children: items }) }),
|
|
5811
|
+
/* @__PURE__ */ jsxs43("div", { className: "tb-b-gal-ctrl", children: [
|
|
5812
|
+
/* @__PURE__ */ jsx54("button", { type: "button", className: "tb-b-gal-btn", "aria-label": texts.prev, onClick: () => step2(-1), children: "\u2039" }),
|
|
5813
|
+
/* @__PURE__ */ jsx54("button", { type: "button", className: "tb-b-gal-btn", "aria-label": texts.next, onClick: () => step2(1), children: "\u203A" })
|
|
5814
|
+
] })
|
|
5815
|
+
] }) : /* @__PURE__ */ jsx54("ul", { className: "tb-b-gal-list", "aria-label": label2, children: items }),
|
|
5816
|
+
open !== null && /* @__PURE__ */ jsx54(
|
|
5817
|
+
Lightbox,
|
|
5818
|
+
{
|
|
5819
|
+
shots,
|
|
5820
|
+
index: open,
|
|
5821
|
+
setIndex: setOpen2,
|
|
5822
|
+
onClose: () => setOpen2(null),
|
|
5823
|
+
returnTo: returnTo.current,
|
|
5824
|
+
label: label2,
|
|
5825
|
+
statusText,
|
|
5826
|
+
texts,
|
|
5827
|
+
mediaOrigin
|
|
5828
|
+
}
|
|
5829
|
+
)
|
|
5830
|
+
] })
|
|
5831
|
+
] });
|
|
5832
|
+
}
|
|
5833
|
+
var galleryWidgets = [{ ...r23MediaDefinition("basic.gallery"), Component: Gallery }];
|
|
5834
|
+
|
|
5835
|
+
// src/basics/r23/map.tsx
|
|
5836
|
+
import { useState as useState13 } from "react";
|
|
5837
|
+
import { Fragment as Fragment40, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5838
|
+
var PROVIDERS = ["openstreetmap", "google"];
|
|
5839
|
+
var LIST = ["below", "beside", "hidden"];
|
|
5840
|
+
var TYPES = ["LocalBusiness", "Store"];
|
|
5841
|
+
var DAYS = { mon: "Mo", tue: "Tu", wed: "We", thu: "Th", fri: "Fr", sat: "Sa", sun: "Su" };
|
|
5842
|
+
var DAY = "[A-Za-z]{3,9}";
|
|
5843
|
+
var DAY_PART = `${DAY}(?:\\s*[-\u2013]\\s*${DAY})?`;
|
|
5844
|
+
var HOURS_RE = new RegExp(`^\\s*(${DAY_PART}(?:\\s*,\\s*${DAY_PART})*)\\s+(\\d{1,2})(?::(\\d{2}))?\\s*(?:-|\u2013|to)\\s*(\\d{1,2})(?::(\\d{2}))?\\s*$`, "iu");
|
|
5845
|
+
var dayCode = (word) => {
|
|
5846
|
+
const key = word.trim().slice(0, 3).toLowerCase();
|
|
5847
|
+
return /^[a-z]{3,9}$/iu.test(word.trim()) && Object.hasOwn(DAYS, key) ? DAYS[key] : void 0;
|
|
5848
|
+
};
|
|
5849
|
+
var clock = (hour, minute) => {
|
|
5850
|
+
const h = Number(hour);
|
|
5851
|
+
const m = minute === void 0 ? 0 : Number(minute);
|
|
5852
|
+
return h > 24 || m > 59 || h === 24 && m > 0 ? null : `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
5853
|
+
};
|
|
5854
|
+
function parseOpeningHours(input) {
|
|
5855
|
+
const out = [];
|
|
5856
|
+
for (const segment of input.split(/[;\n]+/u)) {
|
|
5857
|
+
const match = HOURS_RE.exec(segment);
|
|
5858
|
+
if (match === null) continue;
|
|
5859
|
+
const days = [];
|
|
5860
|
+
for (const part2 of (match[1] ?? "").split(",")) {
|
|
5861
|
+
const ends = part2.split(/[-–]/u).map(dayCode);
|
|
5862
|
+
if (ends.length === 0 || ends.some((end) => end === void 0)) {
|
|
5863
|
+
days.length = 0;
|
|
5864
|
+
break;
|
|
5865
|
+
}
|
|
5866
|
+
days.push(ends.join("-"));
|
|
5867
|
+
}
|
|
5868
|
+
const open = clock(match[2] ?? "", match[3]);
|
|
5869
|
+
const close = clock(match[4] ?? "", match[5]);
|
|
5870
|
+
if (days.length > 0 && open !== null && close !== null) out.push(`${days.join(",")} ${open}-${close}`);
|
|
5871
|
+
}
|
|
5872
|
+
return out;
|
|
5873
|
+
}
|
|
5874
|
+
var coord = (value, limit) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) <= limit ? value : null;
|
|
5875
|
+
var round = (n) => String(Math.round(n * 1e6) / 1e6);
|
|
5876
|
+
function embedSrc2(provider, lat, lng, zoom) {
|
|
5877
|
+
if (provider === "google") {
|
|
5878
|
+
return `https://www.google.com/maps?${new URLSearchParams({ q: `${round(lat)},${round(lng)}`, z: String(zoom), output: "embed" }).toString()}`;
|
|
5879
|
+
}
|
|
5880
|
+
const lon = 360 / 2 ** zoom * 1.5;
|
|
5881
|
+
const la = lon * 0.6;
|
|
5882
|
+
const bbox = [Math.max(-180, lng - lon), Math.max(-85, lat - la), Math.min(180, lng + lon), Math.min(85, lat + la)].map(round).join(",");
|
|
5883
|
+
return `https://www.openstreetmap.org/export/embed.html?${new URLSearchParams({ bbox, layer: "mapnik", marker: `${round(lat)},${round(lng)}` }).toString()}`;
|
|
5884
|
+
}
|
|
5885
|
+
var directionsHref = (place) => {
|
|
5886
|
+
const destination = place.lat !== null && place.lng !== null ? `${round(place.lat)},${round(place.lng)}` : place.address;
|
|
5887
|
+
return destination === void 0 ? null : `https://www.google.com/maps/dir/?${new URLSearchParams({ api: "1", destination }).toString()}`;
|
|
5888
|
+
};
|
|
5889
|
+
var telHref = (phone) => {
|
|
5890
|
+
const digits = phone.replace(/[^\d]/gu, "");
|
|
5891
|
+
return digits.length >= 5 && digits.length <= 15 ? `tel:${phone.trim().startsWith("+") ? "+" : ""}${digits}` : null;
|
|
5892
|
+
};
|
|
5893
|
+
function MapWidget({ node, props, mediaOrigin, editMode }) {
|
|
5894
|
+
const consentRequired = props.consentRequired !== false;
|
|
5895
|
+
const [loaded, setLoaded] = useState13(!consentRequired);
|
|
5896
|
+
const places = mediaRows(props.locations).slice(0, 20).map((row, index) => ({
|
|
5897
|
+
index,
|
|
5898
|
+
name: str(row.name),
|
|
5899
|
+
address: str(row.address),
|
|
5900
|
+
lat: coord(row.lat, 90),
|
|
5901
|
+
lng: coord(row.lng, 180),
|
|
5902
|
+
hours: str(row.hours),
|
|
5903
|
+
phone: str(row.phone),
|
|
5904
|
+
href: hrefOf(row.link, mediaOrigin)
|
|
5905
|
+
})).filter((place) => place.name !== void 0 || place.address !== void 0);
|
|
5906
|
+
const mappable = places.filter((place) => place.lat !== null && place.lng !== null);
|
|
5907
|
+
const [selected, setSelected] = useState13(mappable[0]?.index ?? 0);
|
|
5908
|
+
if (places.length === 0) {
|
|
5909
|
+
return /* @__PURE__ */ jsxs44(Fragment40, { children: [
|
|
5910
|
+
/* @__PURE__ */ jsx55(R23MediaStyles, {}),
|
|
5911
|
+
/* @__PURE__ */ jsx55(Placeholder, { editMode, children: "Add locations in the settings" })
|
|
5912
|
+
] });
|
|
5913
|
+
}
|
|
5914
|
+
const provider = oneOf(props.provider, PROVIDERS, "openstreetmap");
|
|
5915
|
+
const zoom = typeof props.zoom === "number" && props.zoom >= 3 && props.zoom <= 18 ? Math.round(props.zoom) : 14;
|
|
5916
|
+
const listMode = oneOf(props.showList, LIST, "below");
|
|
5917
|
+
const current = mappable.find((place) => place.index === selected) ?? mappable[0];
|
|
5918
|
+
const showFrame = loaded && !editMode && current !== void 0 && current.lat !== null && current.lng !== null;
|
|
5919
|
+
const directions = str(props.directionsLabel) ?? "Get directions";
|
|
5920
|
+
const showLabel = str(props.showLabel) ?? "Show on map";
|
|
5921
|
+
const schemaType = oneOf(props.schemaType, TYPES, "LocalBusiness");
|
|
5922
|
+
const lds = props.jsonLd !== true ? [] : places.flatMap((place) => {
|
|
5923
|
+
if (place.name === void 0 || place.address === void 0) return [];
|
|
5924
|
+
const hours = place.hours === void 0 ? [] : parseOpeningHours(place.hours);
|
|
5925
|
+
return [
|
|
5926
|
+
{
|
|
5927
|
+
"@context": "https://schema.org",
|
|
5928
|
+
"@type": schemaType,
|
|
5929
|
+
// A fragment of the page's own address: stable per position in the list.
|
|
5930
|
+
"@id": `#store-${node.id}-${String(place.index)}`,
|
|
5931
|
+
name: place.name,
|
|
5932
|
+
address: { "@type": "PostalAddress", streetAddress: place.address },
|
|
5933
|
+
...place.lat !== null && place.lng !== null ? { geo: { "@type": "GeoCoordinates", latitude: place.lat, longitude: place.lng } } : {},
|
|
5934
|
+
...hours.length === 0 ? {} : { openingHours: hours },
|
|
5935
|
+
...place.phone === void 0 ? {} : { telephone: place.phone },
|
|
5936
|
+
...place.href !== null && place.href.startsWith("https://") ? { url: place.href } : {}
|
|
5937
|
+
}
|
|
5938
|
+
];
|
|
5939
|
+
});
|
|
5940
|
+
return /* @__PURE__ */ jsxs44(Fragment40, { children: [
|
|
5941
|
+
/* @__PURE__ */ jsx55(R23MediaStyles, {}),
|
|
5942
|
+
/* @__PURE__ */ jsxs44("div", { className: `tb-b-map tb-b-map--list-${listMode}`, children: [
|
|
5943
|
+
mappable.length > 0 && /* @__PURE__ */ jsx55("div", { className: "tb-b-map-frame", children: showFrame && current.lat !== null && current.lng !== null ? /* @__PURE__ */ jsx55(
|
|
5944
|
+
"iframe",
|
|
5945
|
+
{
|
|
5946
|
+
src: embedSrc2(provider, current.lat, current.lng, zoom),
|
|
5947
|
+
title: str(props.mapTitle) ?? "Map",
|
|
5948
|
+
loading: "lazy",
|
|
5949
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
5950
|
+
sandbox: "allow-scripts allow-same-origin allow-popups"
|
|
5951
|
+
},
|
|
5952
|
+
`${String(current.index)}-${provider}`
|
|
5953
|
+
) : /* @__PURE__ */ jsxs44("div", { className: "tb-b-map-facade", children: [
|
|
5954
|
+
/* @__PURE__ */ jsx55("span", { className: "tb-b-map-pin", "aria-hidden": "true" }),
|
|
5955
|
+
str(props.privacyNote) !== void 0 && /* @__PURE__ */ jsx55("p", { className: "tb-b-map-note", children: str(props.privacyNote) }),
|
|
5956
|
+
/* @__PURE__ */ jsx55("button", { type: "button", className: "tb-b-map-load", onClick: () => setLoaded(true), children: str(props.loadLabel) ?? "Load interactive map" })
|
|
5957
|
+
] }) }),
|
|
5958
|
+
/* @__PURE__ */ jsx55("ul", { className: "tb-b-map-list", children: places.map((place) => {
|
|
5959
|
+
const plain = listMode === "hidden";
|
|
5960
|
+
const dir = plain ? null : directionsHref(place);
|
|
5961
|
+
const tel = place.phone === void 0 || plain ? null : telHref(place.phone);
|
|
5962
|
+
return /* @__PURE__ */ jsxs44("li", { className: "tb-b-map-card", children: [
|
|
5963
|
+
place.name !== void 0 && /* @__PURE__ */ jsx55("p", { className: "tb-b-map-name", children: place.href === null || plain ? place.name : /* @__PURE__ */ jsx55("a", { href: place.href, children: place.name }) }),
|
|
5964
|
+
place.address !== void 0 && /* @__PURE__ */ jsx55("p", { className: "tb-b-map-address", children: place.address }),
|
|
5965
|
+
place.hours !== void 0 && /* @__PURE__ */ jsx55("p", { className: "tb-b-map-hours", children: place.hours }),
|
|
5966
|
+
place.phone !== void 0 && /* @__PURE__ */ jsx55("p", { className: "tb-b-map-phone", children: tel === null ? place.phone : /* @__PURE__ */ jsx55("a", { href: tel, children: place.phone }) }),
|
|
5967
|
+
dir !== null && /* @__PURE__ */ jsx55("a", { className: "tb-b-map-dir", href: dir, target: "_blank", rel: "noopener", "aria-label": place.name === void 0 ? directions : `${directions}: ${place.name}`, children: directions }),
|
|
5968
|
+
!plain && mappable.length > 1 && place.lat !== null && place.lng !== null && /* @__PURE__ */ jsx55(
|
|
5969
|
+
"button",
|
|
5970
|
+
{
|
|
5971
|
+
type: "button",
|
|
5972
|
+
className: "tb-b-map-show",
|
|
5973
|
+
"aria-pressed": current?.index === place.index,
|
|
5974
|
+
"aria-label": place.name === void 0 ? showLabel : `${showLabel}: ${place.name}`,
|
|
5975
|
+
onClick: () => setSelected(place.index),
|
|
5976
|
+
children: showLabel
|
|
5977
|
+
}
|
|
5978
|
+
)
|
|
5979
|
+
] }, place.index);
|
|
5980
|
+
}) }),
|
|
5981
|
+
lds.map((ld, i) => /* @__PURE__ */ jsx55("script", { type: "application/ld+json", children: jsonLdString(ld) }, i))
|
|
5982
|
+
] })
|
|
5983
|
+
] });
|
|
5984
|
+
}
|
|
5985
|
+
var mapWidgets = [{ ...r23MediaDefinition("basic.map"), Component: MapWidget }];
|
|
5986
|
+
|
|
5987
|
+
// src/basics/r23/media-index.ts
|
|
5988
|
+
var r23MediaWidgets = [...galleryWidgets, ...beforeAfterWidgets, ...comparisonTableWidgets, ...mapWidgets];
|
|
5989
|
+
|
|
4492
5990
|
// src/basics/index.ts
|
|
4493
5991
|
var BASIC_COMPONENTS = {
|
|
4494
5992
|
"basic.heading": Heading,
|
|
@@ -4504,7 +6002,7 @@ var BASIC_COMPONENTS = {
|
|
|
4504
6002
|
"basic.copyright": Copyright,
|
|
4505
6003
|
"basic.countdown": Countdown
|
|
4506
6004
|
};
|
|
4507
|
-
var v1Widgets =
|
|
6005
|
+
var v1Widgets = BASIC_WIDGET_DEFINITIONS5.flatMap(
|
|
4508
6006
|
(definition3) => definition3.v === 1 && Object.hasOwn(BASIC_COMPONENTS, definition3.type) ? [{ ...definition3, Component: BASIC_COMPONENTS[definition3.type] }] : []
|
|
4509
6007
|
);
|
|
4510
6008
|
var widgets = mergeV2Widgets(v1Widgets, [
|
|
@@ -4516,17 +6014,19 @@ var widgets = mergeV2Widgets(v1Widgets, [
|
|
|
4516
6014
|
...quoteWidgets,
|
|
4517
6015
|
...menuV2Widgets,
|
|
4518
6016
|
...announcementV2Widgets,
|
|
4519
|
-
...headingV2Widgets
|
|
6017
|
+
...headingV2Widgets,
|
|
6018
|
+
...r23ContentWidgets,
|
|
6019
|
+
...r23MediaWidgets
|
|
4520
6020
|
]);
|
|
4521
6021
|
var basicPack = { id: "basic", version: "0.0.0", widgets, dataSources: [] };
|
|
4522
6022
|
|
|
4523
6023
|
// src/custom/factory.ts
|
|
4524
|
-
import { createElement as
|
|
6024
|
+
import { createElement as createElement7 } from "react";
|
|
4525
6025
|
|
|
4526
6026
|
// src/custom/composite-widget.tsx
|
|
4527
6027
|
import { Suspense as Suspense3 } from "react";
|
|
4528
6028
|
import { pageDocumentSchema, validateSettingValue as validateSettingValue3 } from "@usethrottle/builder-schema";
|
|
4529
|
-
import { jsx as
|
|
6029
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
4530
6030
|
var SETTING_KEY_RE = /^[a-z][A-Za-z0-9]{0,39}$/;
|
|
4531
6031
|
var NODE_ID_RE = /^[a-z0-9]{8,24}$/;
|
|
4532
6032
|
var WRAP = { section: "zzcompsec001", column: "zzcompcol001", inner: "zzcompinr001" };
|
|
@@ -4559,9 +6059,9 @@ function compileComposite(snapshot) {
|
|
|
4559
6059
|
return result;
|
|
4560
6060
|
}
|
|
4561
6061
|
function compile2(snapshot) {
|
|
4562
|
-
const
|
|
6062
|
+
const label2 = `${snapshot.type}@${String(snapshot.v)}`;
|
|
4563
6063
|
const refuse = (why) => {
|
|
4564
|
-
warnOnce(`composite:${
|
|
6064
|
+
warnOnce(`composite:${label2}`, `${label2} was refused (${why}); rendering nothing for it`);
|
|
4565
6065
|
return null;
|
|
4566
6066
|
};
|
|
4567
6067
|
if (snapshot.kind !== "composite") return refuse("not a composite widget");
|
|
@@ -4716,7 +6216,7 @@ function CompositeBody(props) {
|
|
|
4716
6216
|
warnOnce(`composite-weight:${snapshot.type}@${String(snapshot.v)}`, `${snapshot.type} would render too many nodes; rendering nothing for it`);
|
|
4717
6217
|
return null;
|
|
4718
6218
|
}
|
|
4719
|
-
return /* @__PURE__ */
|
|
6219
|
+
return /* @__PURE__ */ jsx56(
|
|
4720
6220
|
BuilderRenderer,
|
|
4721
6221
|
{
|
|
4722
6222
|
document: built.document,
|
|
@@ -4732,23 +6232,23 @@ function CompositeBody(props) {
|
|
|
4732
6232
|
);
|
|
4733
6233
|
}
|
|
4734
6234
|
function CompositeWidget(props) {
|
|
4735
|
-
return /* @__PURE__ */
|
|
6235
|
+
return /* @__PURE__ */ jsx56(PartBoundary, { label: `${props.snapshot.type}@${String(props.snapshot.v)}`, children: /* @__PURE__ */ jsx56(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx56(CompositeBody, { ...props }) }) });
|
|
4736
6236
|
}
|
|
4737
6237
|
|
|
4738
6238
|
// src/custom/factory.ts
|
|
4739
6239
|
var isDisabled = (snapshot) => snapshot.status === "disabled";
|
|
4740
|
-
var Disabled = ({ editMode }) => editMode ?
|
|
6240
|
+
var Disabled = ({ editMode }) => editMode ? createElement7("div", { className: "tb-missing" }, "This custom widget is disabled") : null;
|
|
4741
6241
|
var customWidgetFactory = (snapshot, registry) => {
|
|
4742
6242
|
if (isDisabled(snapshot)) return Disabled;
|
|
4743
6243
|
if (snapshot.kind === "template") {
|
|
4744
6244
|
const template = compileTemplate(snapshot, registry);
|
|
4745
6245
|
if (template === null) return null;
|
|
4746
|
-
const Component2 = (props) =>
|
|
6246
|
+
const Component2 = (props) => createElement7(TemplateWidget, { ...props, snapshot, registry });
|
|
4747
6247
|
componentWeights.set(Component2, template.weight);
|
|
4748
6248
|
return Component2;
|
|
4749
6249
|
}
|
|
4750
6250
|
if (compileComposite(snapshot) === null) return null;
|
|
4751
|
-
return (props) =>
|
|
6251
|
+
return (props) => createElement7(CompositeWidget, { ...props, snapshot, registry });
|
|
4752
6252
|
};
|
|
4753
6253
|
|
|
4754
6254
|
// src/registry.ts
|
|
@@ -4805,7 +6305,7 @@ function createRendererRegistry(packs, options = {}) {
|
|
|
4805
6305
|
|
|
4806
6306
|
// src/slot.tsx
|
|
4807
6307
|
import { Suspense as Suspense4 } from "react";
|
|
4808
|
-
import { jsx as
|
|
6308
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4809
6309
|
function contextKey(context) {
|
|
4810
6310
|
if (typeof context !== "object" || context === null) return "";
|
|
4811
6311
|
return Object.values(context).map((value) => {
|
|
@@ -4821,12 +6321,12 @@ function BuilderSlot({ name, context }) {
|
|
|
4821
6321
|
if (part2 === void 0 || part2.document.sections.length === 0) return null;
|
|
4822
6322
|
return (
|
|
4823
6323
|
// Suspense inside the boundary: see parts.tsx.
|
|
4824
|
-
/* @__PURE__ */
|
|
6324
|
+
/* @__PURE__ */ jsx57(PartBoundary, { label: `Builder slot ${name}`, resetKey: contextKey(context), children: /* @__PURE__ */ jsx57("div", { "data-throttle-part": "builder-slot", "data-b-slot": name, children: /* @__PURE__ */ jsx57(Suspense4, { fallback: null, children: /* @__PURE__ */ jsx57(PartView, { part: part2, context }) }) }) })
|
|
4825
6325
|
);
|
|
4826
6326
|
}
|
|
4827
6327
|
|
|
4828
6328
|
// src/provider.tsx
|
|
4829
|
-
import { jsx as
|
|
6329
|
+
import { jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4830
6330
|
var EMPTY = {};
|
|
4831
6331
|
function loadedAtOf(site) {
|
|
4832
6332
|
if (site.status !== "ok" || site.loadedAt === void 0) return void 0;
|
|
@@ -4838,7 +6338,7 @@ function useParentFont() {
|
|
|
4838
6338
|
}
|
|
4839
6339
|
function BuilderProvider({ builderKey, client, packs, site, onError, interactive = true, pathname, catalogRoutes, routeTable, templateName, ownPagePaths, mode = "live", viewer, page, linkTargets, children }) {
|
|
4840
6340
|
const packsKey = packs.map((pack) => `${pack.id}@${pack.version}`).join("|");
|
|
4841
|
-
const registryRef =
|
|
6341
|
+
const registryRef = useRef8(null);
|
|
4842
6342
|
if (registryRef.current?.key !== packsKey) {
|
|
4843
6343
|
registryRef.current = { key: packsKey, registry: createRendererRegistry(packs) };
|
|
4844
6344
|
}
|
|
@@ -4850,13 +6350,13 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4850
6350
|
const mediaOrigin = site.status === "ok" ? site.mediaOrigin : "";
|
|
4851
6351
|
const settings = site.status === "ok" ? site.settings : EMPTY;
|
|
4852
6352
|
const resolveLink = useMemo2(() => makeResolveLink(settings, packs), [settings, packs]);
|
|
4853
|
-
const outlets =
|
|
4854
|
-
const renderers =
|
|
6353
|
+
const outlets = useRef8(/* @__PURE__ */ new Map());
|
|
6354
|
+
const renderers = useRef8(/* @__PURE__ */ new Map());
|
|
4855
6355
|
const pageOutlet = useCallback((handle) => {
|
|
4856
6356
|
let outlet = outlets.current.get(handle);
|
|
4857
6357
|
if (outlet === void 0) {
|
|
4858
6358
|
outlet = function PageOutlet() {
|
|
4859
|
-
return /* @__PURE__ */
|
|
6359
|
+
return /* @__PURE__ */ jsx58(PartBoundary, { label: `Builder page ${handle}`, children: /* @__PURE__ */ jsx58(Suspense5, { fallback: null, children: /* @__PURE__ */ jsx58(BuilderPage, { slug: handle }) }) });
|
|
4860
6360
|
};
|
|
4861
6361
|
outlets.current.set(handle, outlet);
|
|
4862
6362
|
}
|
|
@@ -4869,7 +6369,7 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4869
6369
|
let renderer = renderers.current.get(name);
|
|
4870
6370
|
if (renderer === void 0) {
|
|
4871
6371
|
renderer = function SlotRenderer({ context }) {
|
|
4872
|
-
return /* @__PURE__ */
|
|
6372
|
+
return /* @__PURE__ */ jsx58(BuilderSlot, { name, context });
|
|
4873
6373
|
};
|
|
4874
6374
|
renderers.current.set(name, renderer);
|
|
4875
6375
|
}
|
|
@@ -4919,17 +6419,17 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4919
6419
|
if (own === void 0) return void 0;
|
|
4920
6420
|
return parentFont === void 0 ? merged : { ...merged, variables: { ...merged.variables, fontFamily: parentFont } };
|
|
4921
6421
|
}, [own, merged, parentFont]);
|
|
4922
|
-
return /* @__PURE__ */
|
|
4923
|
-
site.status === "ok" ? /* @__PURE__ */
|
|
4924
|
-
customCss === "" ? null : /* @__PURE__ */
|
|
4925
|
-
customCssHref === void 0 ? null : /* @__PURE__ */
|
|
4926
|
-
/* @__PURE__ */
|
|
6422
|
+
return /* @__PURE__ */ jsx58(BuilderContext.Provider, { value, children: /* @__PURE__ */ jsx58(ThrottleUIProvider, { ...appearance === void 0 ? {} : { appearance }, children: /* @__PURE__ */ jsx58(SiteDesignProvider, { value: design, children: /* @__PURE__ */ jsxs45(SlotOutletProvider, { resolve: resolveSlot, children: [
|
|
6423
|
+
site.status === "ok" ? /* @__PURE__ */ jsx58("style", { children: themeCss(site.settings, { hostFont: parentFont !== void 0 }) }) : null,
|
|
6424
|
+
customCss === "" ? null : /* @__PURE__ */ jsx58("style", { children: customCssSheet(customCss) }),
|
|
6425
|
+
customCssHref === void 0 ? null : /* @__PURE__ */ jsx58("link", { rel: "stylesheet", href: customCssHref }),
|
|
6426
|
+
/* @__PURE__ */ jsx58(ViewerContext.Provider, { value: viewer, children: leaving ? /* @__PURE__ */ jsx58("div", { "data-b-leaving": "", hidden: true }) : children })
|
|
4927
6427
|
] }) }) }) });
|
|
4928
6428
|
}
|
|
4929
6429
|
|
|
4930
6430
|
// src/parts.tsx
|
|
4931
6431
|
import { Suspense as Suspense6 } from "react";
|
|
4932
|
-
import { jsx as
|
|
6432
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
4933
6433
|
function Part({ name, tag }) {
|
|
4934
6434
|
const builder = useBuilder();
|
|
4935
6435
|
if (builder === null || builder.site.status !== "ok") return null;
|
|
@@ -4939,21 +6439,35 @@ function Part({ name, tag }) {
|
|
|
4939
6439
|
return (
|
|
4940
6440
|
// Error boundaries do not catch on the server: the Suspense inside turns a throw
|
|
4941
6441
|
// during SSR into "render nothing here" and the client retries under the boundary.
|
|
4942
|
-
/* @__PURE__ */
|
|
6442
|
+
/* @__PURE__ */ jsx59(PartBoundary, { label: `Builder ${name}`, children: /* @__PURE__ */ jsx59(Tag, { "data-throttle-part": `builder-${name}`, children: /* @__PURE__ */ jsx59(Suspense6, { fallback: null, children: /* @__PURE__ */ jsx59(PartView, { part: part2 }) }) }) })
|
|
4943
6443
|
);
|
|
4944
6444
|
}
|
|
4945
|
-
var BuilderHeader = () => /* @__PURE__ */
|
|
4946
|
-
var BuilderFooter = () => /* @__PURE__ */
|
|
6445
|
+
var BuilderHeader = () => /* @__PURE__ */ jsx59(Part, { name: "header", tag: "header" });
|
|
6446
|
+
var BuilderFooter = () => /* @__PURE__ */ jsx59(Part, { name: "footer", tag: "footer" });
|
|
4947
6447
|
|
|
4948
6448
|
// src/template-view.tsx
|
|
4949
6449
|
import { Suspense as Suspense7, useMemo as useMemo3 } from "react";
|
|
4950
|
-
import { jsx as
|
|
6450
|
+
import { jsx as jsx60, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
6451
|
+
var FRAMELESS_CSS = '[data-throttle-part="builder-header"],[data-throttle-part="builder-footer"]{display:none}';
|
|
4951
6452
|
function BuilderTemplateView({
|
|
4952
6453
|
name,
|
|
4953
6454
|
part: part2,
|
|
4954
|
-
context
|
|
6455
|
+
context,
|
|
6456
|
+
frame
|
|
4955
6457
|
}) {
|
|
4956
|
-
|
|
6458
|
+
const frameless = frame === "none";
|
|
6459
|
+
return /* @__PURE__ */ jsxs46(PartBoundary, { label: `Builder template ${name}`, children: [
|
|
6460
|
+
frameless ? /* @__PURE__ */ jsx60("style", { children: FRAMELESS_CSS }) : null,
|
|
6461
|
+
/* @__PURE__ */ jsx60(
|
|
6462
|
+
"div",
|
|
6463
|
+
{
|
|
6464
|
+
"data-throttle-part": "builder-template",
|
|
6465
|
+
"data-b-template": name,
|
|
6466
|
+
...frameless ? { "data-b-frame": "none" } : {},
|
|
6467
|
+
children: /* @__PURE__ */ jsx60(Suspense7, { fallback: null, children: /* @__PURE__ */ jsx60(PartView, { part: part2, context }) })
|
|
6468
|
+
}
|
|
6469
|
+
)
|
|
6470
|
+
] });
|
|
4957
6471
|
}
|
|
4958
6472
|
function BuilderRouteScope({
|
|
4959
6473
|
templateName,
|
|
@@ -4973,7 +6487,7 @@ function BuilderRouteScope({
|
|
|
4973
6487
|
return { ...builder, codeRoutes, templateName };
|
|
4974
6488
|
}, [builder, templateName, tableKey, allowPath]);
|
|
4975
6489
|
if (allowPath !== void 0) allowCodePath(allowPath);
|
|
4976
|
-
return /* @__PURE__ */
|
|
6490
|
+
return /* @__PURE__ */ jsx60(BuilderContext.Provider, { value, children });
|
|
4977
6491
|
}
|
|
4978
6492
|
|
|
4979
6493
|
// src/index.ts
|