@datawheel/bespoke 0.3.19 → 0.3.20
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 +18 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3782,8 +3782,8 @@ var init_sanitizeBlockContent = __esm({
|
|
|
3782
3782
|
});
|
|
3783
3783
|
function InnerTooltip(props) {
|
|
3784
3784
|
const { content, style = {} } = props;
|
|
3785
|
-
const
|
|
3786
|
-
const element =
|
|
3785
|
+
const print = usePrint();
|
|
3786
|
+
const element = print ? /* @__PURE__ */ jsx("div", { className: "bespoke-inner-tooltip-notification", children: /* @__PURE__ */ jsx(
|
|
3787
3787
|
Notification,
|
|
3788
3788
|
{
|
|
3789
3789
|
icon: /* @__PURE__ */ jsx(IconInfoCircle, { size: "1.1rem" }),
|
|
@@ -4205,7 +4205,7 @@ function TitleView({
|
|
|
4205
4205
|
_iconPadding,
|
|
4206
4206
|
asComparison = false
|
|
4207
4207
|
}) {
|
|
4208
|
-
const
|
|
4208
|
+
const print = usePrint();
|
|
4209
4209
|
const titleHTML = sanitizeBlockContent_default(title) || "<span class='cr-block-placeholder'>Title</span>";
|
|
4210
4210
|
const tooltipHTML = sanitizeBlockContent_default(tooltip);
|
|
4211
4211
|
const intOrder = settings && settings.order ? parseInt(settings.order, 10) : 1;
|
|
@@ -4245,7 +4245,7 @@ function TitleView({
|
|
|
4245
4245
|
spacing: "sm",
|
|
4246
4246
|
children: [
|
|
4247
4247
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4248
|
-
|
|
4248
|
+
print ? titleElement : finalElement,
|
|
4249
4249
|
displayName && /* @__PURE__ */ jsx(Text, { className: "bespoke-comparison-title", children: memberName })
|
|
4250
4250
|
] }),
|
|
4251
4251
|
tooltip && /* @__PURE__ */ jsx(InnerTooltip, { content: tooltipHTML })
|
|
@@ -4362,7 +4362,7 @@ var init_useOnChangeSelector = __esm({
|
|
|
4362
4362
|
});
|
|
4363
4363
|
function Selector(config) {
|
|
4364
4364
|
const { name, options, id, defaultValue, section, component, asComparison, hideLabel } = config;
|
|
4365
|
-
const
|
|
4365
|
+
const print = usePrint();
|
|
4366
4366
|
const selectorIdentifier = getSelectorIdentifier(id);
|
|
4367
4367
|
const router = useRouter();
|
|
4368
4368
|
const callback = useOnChangeSelector(id, section, selectorIdentifier, asComparison);
|
|
@@ -4374,9 +4374,9 @@ function Selector(config) {
|
|
|
4374
4374
|
(d) => ({ value: d.id, label: d.label })
|
|
4375
4375
|
), [optDependency]);
|
|
4376
4376
|
const printValue = useMemo(() => {
|
|
4377
|
-
const optionsString =
|
|
4377
|
+
const optionsString = print ? options.filter((o) => multiValue.includes(o.id)).map((o) => o.label).join(", ") : "";
|
|
4378
4378
|
return optionsString;
|
|
4379
|
-
}, [
|
|
4379
|
+
}, [print]);
|
|
4380
4380
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4381
4381
|
/* @__PURE__ */ jsx(MediaQuery, { query: "print", styles: { display: "none" }, children: /* @__PURE__ */ jsx(Box, { children: {
|
|
4382
4382
|
[SELECTOR_TYPES.SINGLE]: component === SELECTOR_COMPONENTS.SEGMENTED_CONTROL ? /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4419,7 +4419,7 @@ function Selector(config) {
|
|
|
4419
4419
|
}
|
|
4420
4420
|
)
|
|
4421
4421
|
}[config.type] }) }),
|
|
4422
|
-
|
|
4422
|
+
print && /* @__PURE__ */ jsxs(Text, { children: [
|
|
4423
4423
|
name,
|
|
4424
4424
|
": ",
|
|
4425
4425
|
printValue
|
|
@@ -5068,7 +5068,7 @@ __export(Viz_exports, {
|
|
|
5068
5068
|
default: () => Viz
|
|
5069
5069
|
});
|
|
5070
5070
|
function Viz(config) {
|
|
5071
|
-
const
|
|
5071
|
+
const print = usePrint();
|
|
5072
5072
|
const { block, active, locale, variables, configOverride = {} } = config;
|
|
5073
5073
|
const content = getBlockContent(block);
|
|
5074
5074
|
const formatterFunctions = useFormatterFunctionsForLocale(locale);
|
|
@@ -5097,8 +5097,8 @@ function Viz(config) {
|
|
|
5097
5097
|
const Visualization = vizTypes[fallbackType];
|
|
5098
5098
|
const vizPropsConfig = useMemo(() => {
|
|
5099
5099
|
const { _data, ...vizPropsInnerConfig } = vizProps.config;
|
|
5100
|
-
return printOverrides(vizPropsInnerConfig,
|
|
5101
|
-
}, [vizProps,
|
|
5100
|
+
return printOverrides(vizPropsInnerConfig, print);
|
|
5101
|
+
}, [vizProps, print]);
|
|
5102
5102
|
const vizConfig = { locale, variables, ...vizPropsConfig, ...configOverride };
|
|
5103
5103
|
return /* @__PURE__ */ jsx("div", { className: "bespoke-Viz", children: /* @__PURE__ */ jsx(
|
|
5104
5104
|
"div",
|
|
@@ -9144,7 +9144,7 @@ var init_site = __esm({
|
|
|
9144
9144
|
}
|
|
9145
9145
|
});
|
|
9146
9146
|
function ImageCredits({ previews, translations }) {
|
|
9147
|
-
const
|
|
9147
|
+
const print = usePrint();
|
|
9148
9148
|
const credits = useMemo(() => previews.map(
|
|
9149
9149
|
({ image, name }, idx) => (image?.author || image?.url) && /* @__PURE__ */ jsxs(Stack, { spacing: 0, children: [
|
|
9150
9150
|
image.author && /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
|
|
@@ -9169,7 +9169,7 @@ function ImageCredits({ previews, translations }) {
|
|
|
9169
9169
|
idx + 1 < previews.length && /* @__PURE__ */ jsx(Divider, {})
|
|
9170
9170
|
] }, image.id)
|
|
9171
9171
|
), [previews]);
|
|
9172
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
9172
|
+
return /* @__PURE__ */ jsx(Fragment, { children: print ? /* @__PURE__ */ jsx(Fragment, { children: credits }) : /* @__PURE__ */ jsxs(Popover, { position: "right", children: [
|
|
9173
9173
|
/* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "light", radius: "xl", children: /* @__PURE__ */ jsx(IconPhoto, { size: 20 }) }) }),
|
|
9174
9174
|
/* @__PURE__ */ jsx(Popover.Dropdown, { children: credits })
|
|
9175
9175
|
] }) });
|
|
@@ -9188,6 +9188,7 @@ function SectionWrapper({
|
|
|
9188
9188
|
previews,
|
|
9189
9189
|
translations
|
|
9190
9190
|
}) {
|
|
9191
|
+
const print = usePrint();
|
|
9191
9192
|
const showCredits = sectionSettings2.memberImageBg && previews.some(({ image }) => image && (image.url || image.author));
|
|
9192
9193
|
return /* @__PURE__ */ jsxs(
|
|
9193
9194
|
PositionWrapper,
|
|
@@ -9235,7 +9236,6 @@ function Section({ section }) {
|
|
|
9235
9236
|
...defaultSectionSettings,
|
|
9236
9237
|
...settings
|
|
9237
9238
|
};
|
|
9238
|
-
usePrint();
|
|
9239
9239
|
const comparison = useComparison();
|
|
9240
9240
|
const state = useAppSelector((state2) => state2);
|
|
9241
9241
|
const status = useAppSelector((state2) => state2.variables.status);
|
|
@@ -9466,7 +9466,7 @@ function Report({ pathSegmentsKey = "bespoke" }) {
|
|
|
9466
9466
|
const { asPath, query } = useRouter();
|
|
9467
9467
|
const sectionList = useSectionList();
|
|
9468
9468
|
const comparison = useComparison();
|
|
9469
|
-
const
|
|
9469
|
+
const print = yn4(query.print) ?? false;
|
|
9470
9470
|
const printBtn = yn4(query.printBtn) ?? false;
|
|
9471
9471
|
const [downloadLoading, setDownloadLoading] = useState(false);
|
|
9472
9472
|
const printReport = () => {
|
|
@@ -9482,12 +9482,12 @@ function Report({ pathSegmentsKey = "bespoke" }) {
|
|
|
9482
9482
|
});
|
|
9483
9483
|
};
|
|
9484
9484
|
useScrollToAnchor();
|
|
9485
|
-
return /* @__PURE__ */ jsxs(PrintContext.Provider, { value:
|
|
9486
|
-
|
|
9485
|
+
return /* @__PURE__ */ jsxs(PrintContext.Provider, { value: print, children: [
|
|
9486
|
+
print && /* @__PURE__ */ jsx(MediaQuery, { query: "print", styles: { display: "block" }, children: /* @__PURE__ */ jsx(Title, { display: "none", children: "This is the report header" }) }),
|
|
9487
9487
|
/* @__PURE__ */ jsxs(Container, { id: "bespoke-report", className: comparison.comparisonLoaded ? "compare" : "", p: 0, pos: "relative", fluid: true, children: [
|
|
9488
9488
|
sectionList.isSuccess && sectionList.data.sort(orderSort).map((section) => /* @__PURE__ */ jsx(Section_default, { section }, section.id)),
|
|
9489
9489
|
/*pdf.active*/
|
|
9490
|
-
printBtn && !
|
|
9490
|
+
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
9491
|
] })
|
|
9492
9492
|
] });
|
|
9493
9493
|
}
|