@datawheel/bespoke 0.3.19 → 0.3.21
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/index.js +75 -39
- package/dist/server.js +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2957,16 +2957,17 @@ var init_actions = __esm({
|
|
|
2957
2957
|
}
|
|
2958
2958
|
});
|
|
2959
2959
|
function ResourceProvider(props) {
|
|
2960
|
-
const { pathSegment, profilePrefix } = props;
|
|
2960
|
+
const { pathSegment, profilePrefix, siteProps } = props;
|
|
2961
2961
|
const formatters2 = useFormatterList();
|
|
2962
2962
|
const value = useMemo(() => ({
|
|
2963
2963
|
profilePrefix,
|
|
2964
2964
|
pathSegment,
|
|
2965
|
+
siteProps,
|
|
2965
2966
|
formatterFunctions: locales3.reduce((acc, locale) => ({
|
|
2966
2967
|
...acc,
|
|
2967
2968
|
[locale]: formatters2.data ? funcifyFormattersByLocale(formatters2.data, locale) : {}
|
|
2968
2969
|
}), {})
|
|
2969
|
-
}), [formatters2, pathSegment, profilePrefix]);
|
|
2970
|
+
}), [formatters2, pathSegment, profilePrefix, siteProps]);
|
|
2970
2971
|
return /* @__PURE__ */ jsx(ResourceContext.Provider, { value, children: props.children });
|
|
2971
2972
|
}
|
|
2972
2973
|
function useBespoke() {
|
|
@@ -2987,7 +2988,8 @@ var init_ResourceProvider = __esm({
|
|
|
2987
2988
|
initialContext = {
|
|
2988
2989
|
pathSegment: "path",
|
|
2989
2990
|
formatterFunctions: locales3.reduce((acc, d) => ({ ...acc, [d]: {} }), {}),
|
|
2990
|
-
profilePrefix: "path"
|
|
2991
|
+
profilePrefix: "path",
|
|
2992
|
+
siteProps: {}
|
|
2991
2993
|
};
|
|
2992
2994
|
ResourceContext = createContext(initialContext);
|
|
2993
2995
|
}
|
|
@@ -3782,8 +3784,8 @@ var init_sanitizeBlockContent = __esm({
|
|
|
3782
3784
|
});
|
|
3783
3785
|
function InnerTooltip(props) {
|
|
3784
3786
|
const { content, style = {} } = props;
|
|
3785
|
-
const
|
|
3786
|
-
const element =
|
|
3787
|
+
const print = usePrint();
|
|
3788
|
+
const element = print ? /* @__PURE__ */ jsx("div", { className: "bespoke-inner-tooltip-notification", children: /* @__PURE__ */ jsx(
|
|
3787
3789
|
Notification,
|
|
3788
3790
|
{
|
|
3789
3791
|
icon: /* @__PURE__ */ jsx(IconInfoCircle, { size: "1.1rem" }),
|
|
@@ -4205,7 +4207,7 @@ function TitleView({
|
|
|
4205
4207
|
_iconPadding,
|
|
4206
4208
|
asComparison = false
|
|
4207
4209
|
}) {
|
|
4208
|
-
const
|
|
4210
|
+
const print = usePrint();
|
|
4209
4211
|
const titleHTML = sanitizeBlockContent_default(title) || "<span class='cr-block-placeholder'>Title</span>";
|
|
4210
4212
|
const tooltipHTML = sanitizeBlockContent_default(tooltip);
|
|
4211
4213
|
const intOrder = settings && settings.order ? parseInt(settings.order, 10) : 1;
|
|
@@ -4245,7 +4247,7 @@ function TitleView({
|
|
|
4245
4247
|
spacing: "sm",
|
|
4246
4248
|
children: [
|
|
4247
4249
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4248
|
-
|
|
4250
|
+
print ? titleElement : finalElement,
|
|
4249
4251
|
displayName && /* @__PURE__ */ jsx(Text, { className: "bespoke-comparison-title", children: memberName })
|
|
4250
4252
|
] }),
|
|
4251
4253
|
tooltip && /* @__PURE__ */ jsx(InnerTooltip, { content: tooltipHTML })
|
|
@@ -4362,7 +4364,7 @@ var init_useOnChangeSelector = __esm({
|
|
|
4362
4364
|
});
|
|
4363
4365
|
function Selector(config) {
|
|
4364
4366
|
const { name, options, id, defaultValue, section, component, asComparison, hideLabel } = config;
|
|
4365
|
-
const
|
|
4367
|
+
const print = usePrint();
|
|
4366
4368
|
const selectorIdentifier = getSelectorIdentifier(id);
|
|
4367
4369
|
const router = useRouter();
|
|
4368
4370
|
const callback = useOnChangeSelector(id, section, selectorIdentifier, asComparison);
|
|
@@ -4374,9 +4376,9 @@ function Selector(config) {
|
|
|
4374
4376
|
(d) => ({ value: d.id, label: d.label })
|
|
4375
4377
|
), [optDependency]);
|
|
4376
4378
|
const printValue = useMemo(() => {
|
|
4377
|
-
const optionsString =
|
|
4379
|
+
const optionsString = print ? options.filter((o) => multiValue.includes(o.id)).map((o) => o.label).join(", ") : "";
|
|
4378
4380
|
return optionsString;
|
|
4379
|
-
}, [
|
|
4381
|
+
}, [print]);
|
|
4380
4382
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4381
4383
|
/* @__PURE__ */ jsx(MediaQuery, { query: "print", styles: { display: "none" }, children: /* @__PURE__ */ jsx(Box, { children: {
|
|
4382
4384
|
[SELECTOR_TYPES.SINGLE]: component === SELECTOR_COMPONENTS.SEGMENTED_CONTROL ? /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4419,7 +4421,7 @@ function Selector(config) {
|
|
|
4419
4421
|
}
|
|
4420
4422
|
)
|
|
4421
4423
|
}[config.type] }) }),
|
|
4422
|
-
|
|
4424
|
+
print && /* @__PURE__ */ jsxs(Text, { children: [
|
|
4423
4425
|
name,
|
|
4424
4426
|
": ",
|
|
4425
4427
|
printValue
|
|
@@ -5068,7 +5070,7 @@ __export(Viz_exports, {
|
|
|
5068
5070
|
default: () => Viz
|
|
5069
5071
|
});
|
|
5070
5072
|
function Viz(config) {
|
|
5071
|
-
const
|
|
5073
|
+
const print = usePrint();
|
|
5072
5074
|
const { block, active, locale, variables, configOverride = {} } = config;
|
|
5073
5075
|
const content = getBlockContent(block);
|
|
5074
5076
|
const formatterFunctions = useFormatterFunctionsForLocale(locale);
|
|
@@ -5097,8 +5099,8 @@ function Viz(config) {
|
|
|
5097
5099
|
const Visualization = vizTypes[fallbackType];
|
|
5098
5100
|
const vizPropsConfig = useMemo(() => {
|
|
5099
5101
|
const { _data, ...vizPropsInnerConfig } = vizProps.config;
|
|
5100
|
-
return printOverrides(vizPropsInnerConfig,
|
|
5101
|
-
}, [vizProps,
|
|
5102
|
+
return printOverrides(vizPropsInnerConfig, print);
|
|
5103
|
+
}, [vizProps, print]);
|
|
5102
5104
|
const vizConfig = { locale, variables, ...vizPropsConfig, ...configOverride };
|
|
5103
5105
|
return /* @__PURE__ */ jsx("div", { className: "bespoke-Viz", children: /* @__PURE__ */ jsx(
|
|
5104
5106
|
"div",
|
|
@@ -8029,24 +8031,27 @@ var init_DataTab = __esm({
|
|
|
8029
8031
|
function ImageTab(props) {
|
|
8030
8032
|
const { section } = props;
|
|
8031
8033
|
const blocksIds = section.blocks || [];
|
|
8032
|
-
const
|
|
8034
|
+
const vizAvailable = useAppSelector((state) => blocksIds.map((blockId) => state.records.entities.block[blockId]).filter((block) => block.type === "visualization" && state.variables.status[block.id].allowed));
|
|
8033
8035
|
const [imageContext, setImageContext] = useState(contextOptions.section);
|
|
8034
8036
|
const [imageFormat, setImageFormat] = useState(formatOptions2.png);
|
|
8035
8037
|
const [imageProcessing, setImageProcessing] = useState(false);
|
|
8036
8038
|
const [svgAvailable, setSvgAvailable] = useState(false);
|
|
8037
|
-
const [vizAvailable, setVizAvailable] = useState(vizBlocks);
|
|
8038
8039
|
const [vizPreviews, setVizPreviews] = useState([]);
|
|
8039
8040
|
const [vizSelected, setVizSelected] = useState(vizAvailable.length > 0 ? vizAvailable[0].id : null);
|
|
8040
8041
|
const [transparentBackground, setTransparentBackground] = useState(true);
|
|
8041
8042
|
const [loadingPreviews, setLoadingPreviews] = useState(false);
|
|
8042
8043
|
const optionsTranslations = useBespokeTranslations("options");
|
|
8043
8044
|
const translations = { ...DEFAULT_TRANSLATIONS3, ...optionsTranslations["image_tab"] };
|
|
8045
|
+
const { siteProps } = useBespoke();
|
|
8046
|
+
const includeLogo = siteProps?.logoSrc && typeof siteProps.logoSrc === "string";
|
|
8047
|
+
const sectionHash = section.settings?.name ? `#${section.settings.name}` : `#section-${section.id}`;
|
|
8048
|
+
const theme = useMantineTheme();
|
|
8044
8049
|
const vizSelectedHasSVG = () => {
|
|
8045
8050
|
const vizNode = getVizNode(section.id, vizSelected);
|
|
8046
8051
|
const svgCount = select(vizNode).select("svg").size();
|
|
8047
8052
|
return svgCount === 1;
|
|
8048
8053
|
};
|
|
8049
|
-
const getFileName = () => `${slugify_default(
|
|
8054
|
+
const getFileName = () => `${slugify_default(section?.settings?.name || `section-${section.id}`)}`;
|
|
8050
8055
|
const getSectionNode = (sectionId) => {
|
|
8051
8056
|
const sectionNode = document.getElementById(`section-${sectionId}`);
|
|
8052
8057
|
return select(sectionNode).select(".bespoke-section-content").node();
|
|
@@ -8055,15 +8060,39 @@ function ImageTab(props) {
|
|
|
8055
8060
|
const sectionNode = getSectionNode(sectionId);
|
|
8056
8061
|
return select(sectionNode).select(`#bespoke-visualization-${vizId}.bespoke-block-area`).node();
|
|
8057
8062
|
};
|
|
8058
|
-
const getSelectedNode = () => {
|
|
8063
|
+
const getSelectedNode = () => new Promise((resolve) => {
|
|
8059
8064
|
let node;
|
|
8060
8065
|
if (imageContext === contextOptions.section) {
|
|
8061
8066
|
node = getSectionNode(section.id);
|
|
8062
8067
|
} else if (imageContext === contextOptions.viz) {
|
|
8063
8068
|
node = getVizNode(section.id, vizSelected);
|
|
8064
8069
|
}
|
|
8065
|
-
|
|
8066
|
-
|
|
8070
|
+
const sourceContainer = document.createElement("div");
|
|
8071
|
+
sourceContainer.style.display = "flex";
|
|
8072
|
+
sourceContainer.style.justifyContent = "space-between";
|
|
8073
|
+
sourceContainer.classList.add("bespoke-Viz-source");
|
|
8074
|
+
sourceContainer.style.padding = theme.spacing.xs;
|
|
8075
|
+
sourceContainer.style.width = "100%";
|
|
8076
|
+
const sourceNode = document.createElement("div");
|
|
8077
|
+
sourceNode.innerText = translations["source"].replace("{src}", `${window.location}${sectionHash}`);
|
|
8078
|
+
sourceNode.style.fontSize = theme.fontSizes.xs;
|
|
8079
|
+
sourceContainer.appendChild(sourceNode);
|
|
8080
|
+
if (includeLogo) {
|
|
8081
|
+
const sourceImage = document.createElement("img");
|
|
8082
|
+
sourceImage.src = siteProps.logoSrc;
|
|
8083
|
+
sourceImage.style.height = "30px";
|
|
8084
|
+
sourceImage.onload = () => resolve(node);
|
|
8085
|
+
sourceImage.onerror = () => {
|
|
8086
|
+
sourceImage.remove();
|
|
8087
|
+
resolve(node);
|
|
8088
|
+
};
|
|
8089
|
+
sourceContainer.appendChild(sourceImage);
|
|
8090
|
+
node.appendChild(sourceContainer);
|
|
8091
|
+
} else {
|
|
8092
|
+
node.appendChild(sourceContainer);
|
|
8093
|
+
resolve(node);
|
|
8094
|
+
}
|
|
8095
|
+
});
|
|
8067
8096
|
const getBackground = (elem) => {
|
|
8068
8097
|
if (transparentBackground)
|
|
8069
8098
|
return "transparent";
|
|
@@ -8086,9 +8115,6 @@ function ImageTab(props) {
|
|
|
8086
8115
|
return !config.exclusionClasses.some((classname) => innerNode.classList.contains(classname));
|
|
8087
8116
|
}
|
|
8088
8117
|
return true;
|
|
8089
|
-
},
|
|
8090
|
-
style: {
|
|
8091
|
-
// background: "green",
|
|
8092
8118
|
}
|
|
8093
8119
|
}
|
|
8094
8120
|
).then((dataUrl) => {
|
|
@@ -8096,6 +8122,7 @@ function ImageTab(props) {
|
|
|
8096
8122
|
link.download = `${config.filename}.png`;
|
|
8097
8123
|
link.href = dataUrl;
|
|
8098
8124
|
link.click();
|
|
8125
|
+
cleanDOM();
|
|
8099
8126
|
setImageProcessing(false);
|
|
8100
8127
|
}).catch((err) => {
|
|
8101
8128
|
console.log(err);
|
|
@@ -8108,9 +8135,9 @@ function ImageTab(props) {
|
|
|
8108
8135
|
{ background: config.background }
|
|
8109
8136
|
);
|
|
8110
8137
|
};
|
|
8111
|
-
const onSaveClick = () => {
|
|
8138
|
+
const onSaveClick = async () => {
|
|
8112
8139
|
setImageProcessing(true);
|
|
8113
|
-
const node = getSelectedNode();
|
|
8140
|
+
const node = await getSelectedNode();
|
|
8114
8141
|
const exportConfig = {
|
|
8115
8142
|
background: getBackground(node),
|
|
8116
8143
|
exclusionClasses: ["export-hidden"],
|
|
@@ -8157,7 +8184,7 @@ function ImageTab(props) {
|
|
|
8157
8184
|
}, [vizSelected]);
|
|
8158
8185
|
return /* @__PURE__ */ jsxs(Stack, { className: "cms-section-options-image", children: [
|
|
8159
8186
|
/* @__PURE__ */ jsx(Space, { h: "xs" }),
|
|
8160
|
-
/* @__PURE__ */ jsx(Input.Wrapper, { label: `${translations["choose_area"]}:`, children: /* @__PURE__ */ jsx(
|
|
8187
|
+
vizAvailable.length > 0 ? /* @__PURE__ */ jsx(Input.Wrapper, { label: `${translations["choose_area"]}:`, children: /* @__PURE__ */ jsx(
|
|
8161
8188
|
SegmentedControl,
|
|
8162
8189
|
{
|
|
8163
8190
|
fullWidth: true,
|
|
@@ -8185,7 +8212,7 @@ function ImageTab(props) {
|
|
|
8185
8212
|
}
|
|
8186
8213
|
}
|
|
8187
8214
|
}
|
|
8188
|
-
) }),
|
|
8215
|
+
) }) : /* @__PURE__ */ jsx(Text, { fw: "700", color: "gray.7", children: `${translations["entire_section"]}:` }),
|
|
8189
8216
|
imageContext === contextOptions.viz && vizAvailable.length > 0 && /* @__PURE__ */ jsxs(
|
|
8190
8217
|
Input.Wrapper,
|
|
8191
8218
|
{
|
|
@@ -8239,7 +8266,7 @@ function ImageTab(props) {
|
|
|
8239
8266
|
Checkbox,
|
|
8240
8267
|
{
|
|
8241
8268
|
checked: transparentBackground,
|
|
8242
|
-
label: `${translations["transparent_bg"]}
|
|
8269
|
+
label: `${translations["transparent_bg"]}`,
|
|
8243
8270
|
onChange: () => setTransparentBackground(!transparentBackground),
|
|
8244
8271
|
radius: "xl"
|
|
8245
8272
|
}
|
|
@@ -8256,13 +8283,14 @@ function ImageTab(props) {
|
|
|
8256
8283
|
)
|
|
8257
8284
|
] });
|
|
8258
8285
|
}
|
|
8259
|
-
var contextOptions, formatOptions2, DEFAULT_TRANSLATIONS3;
|
|
8286
|
+
var contextOptions, formatOptions2, cleanDOM, DEFAULT_TRANSLATIONS3;
|
|
8260
8287
|
var init_ImageTab = __esm({
|
|
8261
8288
|
"components/options/tabs/ImageTab.tsx"() {
|
|
8262
8289
|
init_esm_shims();
|
|
8263
8290
|
init_slugify();
|
|
8264
8291
|
init_store2();
|
|
8265
8292
|
init_TranslationsProvider();
|
|
8293
|
+
init_ResourceProvider();
|
|
8266
8294
|
contextOptions = {
|
|
8267
8295
|
viz: "viz",
|
|
8268
8296
|
section: "section"
|
|
@@ -8271,6 +8299,10 @@ var init_ImageTab = __esm({
|
|
|
8271
8299
|
png: "PNG",
|
|
8272
8300
|
svg: "SVG"
|
|
8273
8301
|
};
|
|
8302
|
+
cleanDOM = () => {
|
|
8303
|
+
const sourceNodes = document.getElementsByClassName("bespoke-Viz-source");
|
|
8304
|
+
Array.from(sourceNodes).forEach((node) => node.remove());
|
|
8305
|
+
};
|
|
8274
8306
|
DEFAULT_TRANSLATIONS3 = {
|
|
8275
8307
|
"wrong_node": "Wrong node in export",
|
|
8276
8308
|
"choose_area": "Choose image area",
|
|
@@ -8280,7 +8312,8 @@ var init_ImageTab = __esm({
|
|
|
8280
8312
|
"processing": "Processing image...",
|
|
8281
8313
|
"download": "Download {imageFormat}",
|
|
8282
8314
|
"entire_section": "Entire section",
|
|
8283
|
-
"viz_only": "Visualization only"
|
|
8315
|
+
"viz_only": "Visualization only",
|
|
8316
|
+
"source": "Source: {src}"
|
|
8284
8317
|
};
|
|
8285
8318
|
}
|
|
8286
8319
|
});
|
|
@@ -9144,7 +9177,7 @@ var init_site = __esm({
|
|
|
9144
9177
|
}
|
|
9145
9178
|
});
|
|
9146
9179
|
function ImageCredits({ previews, translations }) {
|
|
9147
|
-
const
|
|
9180
|
+
const print = usePrint();
|
|
9148
9181
|
const credits = useMemo(() => previews.map(
|
|
9149
9182
|
({ image, name }, idx) => (image?.author || image?.url) && /* @__PURE__ */ jsxs(Stack, { spacing: 0, children: [
|
|
9150
9183
|
image.author && /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
|
|
@@ -9169,7 +9202,7 @@ function ImageCredits({ previews, translations }) {
|
|
|
9169
9202
|
idx + 1 < previews.length && /* @__PURE__ */ jsx(Divider, {})
|
|
9170
9203
|
] }, image.id)
|
|
9171
9204
|
), [previews]);
|
|
9172
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
9205
|
+
return /* @__PURE__ */ jsx(Fragment, { children: print ? /* @__PURE__ */ jsx(Fragment, { children: credits }) : /* @__PURE__ */ jsxs(Popover, { position: "right", children: [
|
|
9173
9206
|
/* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "light", radius: "xl", children: /* @__PURE__ */ jsx(IconPhoto, { size: 20 }) }) }),
|
|
9174
9207
|
/* @__PURE__ */ jsx(Popover.Dropdown, { children: credits })
|
|
9175
9208
|
] }) });
|
|
@@ -9181,6 +9214,7 @@ var init_ImageCredits = __esm({
|
|
|
9181
9214
|
}
|
|
9182
9215
|
});
|
|
9183
9216
|
function SectionWrapper({
|
|
9217
|
+
name,
|
|
9184
9218
|
children,
|
|
9185
9219
|
id,
|
|
9186
9220
|
sectionSettings: sectionSettings2,
|
|
@@ -9188,6 +9222,7 @@ function SectionWrapper({
|
|
|
9188
9222
|
previews,
|
|
9189
9223
|
translations
|
|
9190
9224
|
}) {
|
|
9225
|
+
const print = usePrint();
|
|
9191
9226
|
const showCredits = sectionSettings2.memberImageBg && previews.some(({ image }) => image && (image.url || image.author));
|
|
9192
9227
|
return /* @__PURE__ */ jsxs(
|
|
9193
9228
|
PositionWrapper,
|
|
@@ -9203,7 +9238,7 @@ function SectionWrapper({
|
|
|
9203
9238
|
className: `bespoke-Section-${id} bespoke-Section-container `,
|
|
9204
9239
|
settings: sectionSettings2,
|
|
9205
9240
|
styles: sectionStyles?.container,
|
|
9206
|
-
id: `section-${id}`,
|
|
9241
|
+
id: name || `section-${id}`,
|
|
9207
9242
|
pos: "relative",
|
|
9208
9243
|
children: [
|
|
9209
9244
|
!print && /* @__PURE__ */ jsxs(Group, { position: "right", mb: "xs", children: [
|
|
@@ -9235,7 +9270,6 @@ function Section({ section }) {
|
|
|
9235
9270
|
...defaultSectionSettings,
|
|
9236
9271
|
...settings
|
|
9237
9272
|
};
|
|
9238
|
-
usePrint();
|
|
9239
9273
|
const comparison = useComparison();
|
|
9240
9274
|
const state = useAppSelector((state2) => state2);
|
|
9241
9275
|
const status = useAppSelector((state2) => state2.variables.status);
|
|
@@ -9356,6 +9390,7 @@ function Section({ section }) {
|
|
|
9356
9390
|
SectionWrapper,
|
|
9357
9391
|
{
|
|
9358
9392
|
id,
|
|
9393
|
+
name: section?.settings?.name,
|
|
9359
9394
|
previews: comparisonPreviews,
|
|
9360
9395
|
sectionSettings: sectionSettings2,
|
|
9361
9396
|
sectionStyles,
|
|
@@ -9466,7 +9501,7 @@ function Report({ pathSegmentsKey = "bespoke" }) {
|
|
|
9466
9501
|
const { asPath, query } = useRouter();
|
|
9467
9502
|
const sectionList = useSectionList();
|
|
9468
9503
|
const comparison = useComparison();
|
|
9469
|
-
const
|
|
9504
|
+
const print = yn4(query.print) ?? false;
|
|
9470
9505
|
const printBtn = yn4(query.printBtn) ?? false;
|
|
9471
9506
|
const [downloadLoading, setDownloadLoading] = useState(false);
|
|
9472
9507
|
const printReport = () => {
|
|
@@ -9482,12 +9517,12 @@ function Report({ pathSegmentsKey = "bespoke" }) {
|
|
|
9482
9517
|
});
|
|
9483
9518
|
};
|
|
9484
9519
|
useScrollToAnchor();
|
|
9485
|
-
return /* @__PURE__ */ jsxs(PrintContext.Provider, { value:
|
|
9486
|
-
|
|
9520
|
+
return /* @__PURE__ */ jsxs(PrintContext.Provider, { value: print, children: [
|
|
9521
|
+
print && /* @__PURE__ */ jsx(MediaQuery, { query: "print", styles: { display: "block" }, children: /* @__PURE__ */ jsx(Title, { display: "none", children: "This is the report header" }) }),
|
|
9487
9522
|
/* @__PURE__ */ jsxs(Container, { id: "bespoke-report", className: comparison.comparisonLoaded ? "compare" : "", p: 0, pos: "relative", fluid: true, children: [
|
|
9488
9523
|
sectionList.isSuccess && sectionList.data.sort(orderSort).map((section) => /* @__PURE__ */ jsx(Section_default, { section }, section.id)),
|
|
9489
9524
|
/*pdf.active*/
|
|
9490
|
-
printBtn && !
|
|
9525
|
+
printBtn && !print && /* @__PURE__ */ jsx(Affix, { position: { bottom: rem(20), right: rem(20) }, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "filled", radius: "xl", color: "blue", onClick: printReport, children: downloadLoading ? /* @__PURE__ */ jsx(Loader, { size: "1.125rem", color: "white" }) : /* @__PURE__ */ jsx(IconDownload, { size: "1.125rem" }) }) })
|
|
9491
9526
|
] })
|
|
9492
9527
|
] });
|
|
9493
9528
|
}
|
|
@@ -16677,6 +16712,7 @@ function BespokeRenderer({
|
|
|
16677
16712
|
translations,
|
|
16678
16713
|
bespokeStyles,
|
|
16679
16714
|
buildTime,
|
|
16715
|
+
siteProps,
|
|
16680
16716
|
profilePrefix = "/defaultPath",
|
|
16681
16717
|
loader = /* @__PURE__ */ jsx(LoadingOverlay, { visible: true }),
|
|
16682
16718
|
mantineProviderProps = {}
|
|
@@ -16684,7 +16720,7 @@ function BespokeRenderer({
|
|
|
16684
16720
|
const loading = useInitialState(pathSegmentsKey);
|
|
16685
16721
|
if (loading)
|
|
16686
16722
|
return /* @__PURE__ */ jsx(Fragment, { children: loader });
|
|
16687
|
-
return /* @__PURE__ */ jsx(MantineProvider, { ...mantineProviderProps, theme: { other: { bespokeStyles } }, inherit: true, children: /* @__PURE__ */ jsxs(ResourceProvider, { pathSegment: "bespoke", profilePrefix, children: [
|
|
16723
|
+
return /* @__PURE__ */ jsx(MantineProvider, { ...mantineProviderProps, theme: { other: { bespokeStyles } }, inherit: true, children: /* @__PURE__ */ jsxs(ResourceProvider, { pathSegment: "bespoke", profilePrefix, siteProps, children: [
|
|
16688
16724
|
/* @__PURE__ */ jsx(TranslationsProvider, { translations, children: /* @__PURE__ */ jsx(ComparisonProvider, { children: /* @__PURE__ */ jsx(PdfProvider, { children: /* @__PURE__ */ jsx(Report_default, {}) }) }) }),
|
|
16689
16725
|
/* @__PURE__ */ jsx("small", { className: "bespoke-timestamp", children: buildTime })
|
|
16690
16726
|
] }) });
|
package/dist/server.js
CHANGED
|
@@ -5900,7 +5900,8 @@ var { locales: locales8 } = getLocales_default();
|
|
|
5900
5900
|
var initialContext = {
|
|
5901
5901
|
pathSegment: "path",
|
|
5902
5902
|
formatterFunctions: locales8.reduce((acc, d) => ({ ...acc, [d]: {} }), {}),
|
|
5903
|
-
profilePrefix: "path"
|
|
5903
|
+
profilePrefix: "path",
|
|
5904
|
+
siteProps: {}
|
|
5904
5905
|
};
|
|
5905
5906
|
createContext(initialContext);
|
|
5906
5907
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datawheel/bespoke",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Content management system for creating automated data reports",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -130,4 +130,4 @@
|
|
|
130
130
|
"peerDependencies": {
|
|
131
131
|
"next": "^13.4.0"
|
|
132
132
|
}
|
|
133
|
-
}
|
|
133
|
+
}
|