@automattic/charts 1.10.3 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/TOKENS.md +83 -0
- package/dist/index.cjs +894 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +58 -62
- package/dist/index.d.cts +75 -13
- package/dist/index.d.ts +75 -13
- package/dist/index.js +894 -139
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/charts/area-chart/area-chart.tsx +28 -8
- package/src/charts/area-chart/test/area-chart.test.tsx +102 -0
- package/src/charts/area-chart/types.ts +20 -6
- package/src/charts/bar-chart/bar-chart.tsx +33 -9
- package/src/charts/bar-chart/test/bar-chart.test.tsx +117 -0
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +7 -7
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +18 -13
- package/src/charts/heatmap-chart/heatmap-chart.tsx +11 -7
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +3 -3
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +13 -7
- package/src/charts/leaderboard-chart/hooks/index.ts +1 -0
- package/src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts +115 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +39 -12
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +67 -14
- package/src/charts/leaderboard-chart/test/leaderboard-chart-fit-rows.test.tsx +365 -0
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +73 -2
- package/src/charts/leaderboard-chart/types.ts +12 -0
- package/src/charts/line-chart/line-chart.module.scss +2 -2
- package/src/charts/line-chart/line-chart.tsx +40 -5
- package/src/charts/line-chart/test/line-chart.test.tsx +190 -1
- package/src/charts/line-chart/types.ts +14 -0
- package/src/charts/private/grid-control/grid-control.module.scss +1 -1
- package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +1 -1
- package/src/charts/private/x-zoom/index.ts +1 -0
- package/src/charts/private/{test → x-zoom/test}/x-zoom.test.tsx +46 -3
- package/src/charts/private/x-zoom/x-zoom.module.scss +43 -0
- package/src/charts/private/{x-zoom.tsx → x-zoom/x-zoom.tsx} +52 -24
- package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +152 -0
- package/src/components/legend/hooks/use-chart-legend-items.ts +118 -16
- package/src/components/legend/private/base-legend.tsx +21 -9
- package/src/components/legend/test/legend-config-types.test.tsx +32 -0
- package/src/components/legend/test/legend.test.tsx +121 -1
- package/src/components/legend/types.ts +6 -0
- package/src/components/tooltip/base-tooltip.module.scss +3 -2
- package/src/components/trend-indicator/trend-indicator.module.scss +6 -5
- package/src/index.ts +1 -0
- package/src/providers/chart-context/themes.ts +33 -19
- package/src/types.ts +18 -2
- package/src/charts/private/x-zoom.module.scss +0 -48
package/dist/index.cjs
CHANGED
|
@@ -725,9 +725,9 @@ const getChartColor = (index, colorCache) => {
|
|
|
725
725
|
* Default theme configuration
|
|
726
726
|
*/
|
|
727
727
|
const defaultTheme = {
|
|
728
|
-
backgroundColor: "var(--wpds-color-background-surface-neutral-strong, #fff)",
|
|
728
|
+
backgroundColor: "var(--a8c-charts-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))",
|
|
729
729
|
labelBackgroundColor: "transparent",
|
|
730
|
-
labelTextColor: "#FFFFFF",
|
|
730
|
+
labelTextColor: "var(--a8c-charts-color-label-on-fill, #FFFFFF)",
|
|
731
731
|
colors: [
|
|
732
732
|
"#98C8DF",
|
|
733
733
|
"#006DAB",
|
|
@@ -736,59 +736,59 @@ const defaultTheme = {
|
|
|
736
736
|
"#FF8C8F"
|
|
737
737
|
],
|
|
738
738
|
gridStyles: {
|
|
739
|
-
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
739
|
+
stroke: "var(--a8c-charts-color-grid, var(--wpds-color-stroke-surface-neutral, #dbdbdb))",
|
|
740
740
|
strokeWidth: 1
|
|
741
741
|
},
|
|
742
742
|
tickLength: 4,
|
|
743
743
|
gridColor: "",
|
|
744
744
|
gridColorDark: "",
|
|
745
745
|
xTickLineStyles: {
|
|
746
|
-
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
746
|
+
stroke: "var(--a8c-charts-color-tick, var(--wpds-color-stroke-surface-neutral, #dbdbdb))",
|
|
747
747
|
strokeWidth: 1
|
|
748
748
|
},
|
|
749
749
|
xAxisLineStyles: {
|
|
750
|
-
stroke: "var(--wpds-color-stroke-surface-neutral, #dbdbdb)",
|
|
750
|
+
stroke: "var(--a8c-charts-color-axis, var(--wpds-color-stroke-surface-neutral, #dbdbdb))",
|
|
751
751
|
strokeWidth: 1
|
|
752
752
|
},
|
|
753
753
|
legend: {
|
|
754
|
-
labelStyles: { color: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
754
|
+
labelStyles: { color: "var(--a8c-charts-color-label, var(--wpds-color-foreground-content-neutral, #1e1e1e))" },
|
|
755
755
|
containerStyles: {},
|
|
756
756
|
shapeStyles: []
|
|
757
757
|
},
|
|
758
758
|
seriesLineStyles: [],
|
|
759
759
|
glyphs: [],
|
|
760
760
|
svgLabelSmall: {
|
|
761
|
-
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
761
|
+
fill: "var(--a8c-charts-color-label, var(--wpds-color-foreground-content-neutral, #1e1e1e))",
|
|
762
762
|
fontFamily: "inherit"
|
|
763
763
|
},
|
|
764
764
|
svgLabelBig: { fontFamily: "inherit" },
|
|
765
765
|
annotationStyles: {
|
|
766
766
|
label: {
|
|
767
|
-
anchorLineStroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
768
|
-
backgroundFill: "var(--wpds-color-background-surface-neutral-strong, #fff)"
|
|
767
|
+
anchorLineStroke: "var(--a8c-charts-color-annotation, var(--wpds-color-foreground-content-neutral, #1e1e1e))",
|
|
768
|
+
backgroundFill: "var(--a8c-charts-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))"
|
|
769
769
|
},
|
|
770
|
-
connector: { stroke: "var(--wpds-color-foreground-content-neutral, #1e1e1e)" },
|
|
770
|
+
connector: { stroke: "var(--a8c-charts-color-annotation, var(--wpds-color-foreground-content-neutral, #1e1e1e))" },
|
|
771
771
|
circleSubject: {
|
|
772
772
|
stroke: "transparent",
|
|
773
|
-
fill: "var(--wpds-color-foreground-content-neutral, #1e1e1e)",
|
|
773
|
+
fill: "var(--a8c-charts-color-annotation, var(--wpds-color-foreground-content-neutral, #1e1e1e))",
|
|
774
774
|
radius: 5
|
|
775
775
|
}
|
|
776
776
|
},
|
|
777
|
-
geoChart: { featureFillColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)" },
|
|
777
|
+
geoChart: { featureFillColor: "var(--a8c-charts-color-surface-secondary, var(--wpds-color-background-surface-neutral-weak, #f4f4f4))" },
|
|
778
778
|
leaderboardChart: {
|
|
779
779
|
rowGap: 12,
|
|
780
780
|
columnGap: 4,
|
|
781
781
|
labelSpacing: "xs",
|
|
782
782
|
deltaColors: [
|
|
783
|
-
"var(--wpds-color-foreground-content-error-weak, #cc1818)",
|
|
784
|
-
"var(--wpds-color-foreground-content-neutral-weak, #707070)",
|
|
785
|
-
"var(--wpds-color-foreground-content-success-weak, #008030)"
|
|
783
|
+
"var(--a8c-charts-color-trend-down, var(--wpds-color-foreground-content-error-weak, #cc1818))",
|
|
784
|
+
"var(--a8c-charts-color-trend-neutral, var(--wpds-color-foreground-content-neutral-weak, #707070))",
|
|
785
|
+
"var(--a8c-charts-color-trend-up, var(--wpds-color-foreground-content-success-weak, #008030))"
|
|
786
786
|
]
|
|
787
787
|
},
|
|
788
788
|
conversionFunnelChart: {
|
|
789
|
-
backgroundColor: "var(--wpds-color-background-surface-neutral-weak, #f4f4f4)",
|
|
790
|
-
positiveChangeColor: "var(--wpds-color-foreground-content-success-weak, #008030)",
|
|
791
|
-
negativeChangeColor: "var(--wpds-color-foreground-content-error-weak, #cc1818)"
|
|
789
|
+
backgroundColor: "var(--a8c-charts-color-surface-secondary, var(--wpds-color-background-surface-neutral-weak, #f4f4f4))",
|
|
790
|
+
positiveChangeColor: "var(--a8c-charts-color-trend-up, var(--wpds-color-foreground-content-success-weak, #008030))",
|
|
791
|
+
negativeChangeColor: "var(--a8c-charts-color-trend-down, var(--wpds-color-foreground-content-error-weak, #cc1818))"
|
|
792
792
|
},
|
|
793
793
|
lineChart: { lineStyles: { comparison: {
|
|
794
794
|
strokeDasharray: "4 4",
|
|
@@ -1816,6 +1816,30 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1816
1816
|
tslib_1.__exportStar(require_dist$1(), exports);
|
|
1817
1817
|
}));
|
|
1818
1818
|
//#endregion
|
|
1819
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/error.mjs
|
|
1820
|
+
let set$1;
|
|
1821
|
+
if (process.env.NODE_ENV !== "production") set$1 = /* @__PURE__ */ new Set();
|
|
1822
|
+
function error(...messages) {
|
|
1823
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1824
|
+
const messageKey = messages.join(" ");
|
|
1825
|
+
if (!set$1.has(messageKey)) {
|
|
1826
|
+
set$1.add(messageKey);
|
|
1827
|
+
console.error(`Base UI: ${messageKey}`);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
//#endregion
|
|
1832
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/safeReact.mjs
|
|
1833
|
+
/**
|
|
1834
|
+
* A clone of the React namespace for reading APIs that may be missing in older
|
|
1835
|
+
* supported React versions. Bundlers can rewrite direct `React.someNewApi`
|
|
1836
|
+
* reads into named imports, which breaks React 17. Reading from this cloned
|
|
1837
|
+
* object keeps those lookups optional.
|
|
1838
|
+
*
|
|
1839
|
+
* @see https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
1840
|
+
*/
|
|
1841
|
+
const SafeReact = { ...react$1 };
|
|
1842
|
+
//#endregion
|
|
1819
1843
|
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useRefWithInit.mjs
|
|
1820
1844
|
const UNINITIALIZED = {};
|
|
1821
1845
|
/**
|
|
@@ -1831,6 +1855,44 @@ function useRefWithInit(init, initArg) {
|
|
|
1831
1855
|
return ref;
|
|
1832
1856
|
}
|
|
1833
1857
|
//#endregion
|
|
1858
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useStableCallback.mjs
|
|
1859
|
+
const useInsertionEffect$1 = SafeReact.useInsertionEffect;
|
|
1860
|
+
const useSafeInsertionEffect = useInsertionEffect$1 && useInsertionEffect$1 !== SafeReact.useLayoutEffect ? useInsertionEffect$1 : (fn) => fn();
|
|
1861
|
+
/**
|
|
1862
|
+
* Stabilizes the function passed so it's always the same between renders.
|
|
1863
|
+
*
|
|
1864
|
+
* The function becomes non-reactive to any values it captures.
|
|
1865
|
+
* It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.
|
|
1866
|
+
*
|
|
1867
|
+
* The function must only be called inside effects and event handlers, never during render (which throws an error).
|
|
1868
|
+
*
|
|
1869
|
+
* This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.
|
|
1870
|
+
*/
|
|
1871
|
+
function useStableCallback(callback) {
|
|
1872
|
+
const stable = useRefWithInit(createStableCallback).current;
|
|
1873
|
+
stable.next = callback;
|
|
1874
|
+
useSafeInsertionEffect(stable.effect);
|
|
1875
|
+
return stable.trampoline;
|
|
1876
|
+
}
|
|
1877
|
+
function createStableCallback() {
|
|
1878
|
+
const stable = {
|
|
1879
|
+
next: void 0,
|
|
1880
|
+
callback: assertNotCalled,
|
|
1881
|
+
trampoline: (...args) => stable.callback?.(...args),
|
|
1882
|
+
effect: () => {
|
|
1883
|
+
stable.callback = stable.next;
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
return stable;
|
|
1887
|
+
}
|
|
1888
|
+
function assertNotCalled() {
|
|
1889
|
+
if (process.env.NODE_ENV !== "production") throw new Error("Base UI: Cannot call an event handler while rendering.");
|
|
1890
|
+
}
|
|
1891
|
+
//#endregion
|
|
1892
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
|
|
1893
|
+
const noop = () => {};
|
|
1894
|
+
const useIsoLayoutEffect = typeof document !== "undefined" ? react$1.useLayoutEffect : noop;
|
|
1895
|
+
//#endregion
|
|
1834
1896
|
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/warn.mjs
|
|
1835
1897
|
let set;
|
|
1836
1898
|
if (process.env.NODE_ENV !== "production") set = /* @__PURE__ */ new Set();
|
|
@@ -2270,6 +2332,190 @@ function renderTag(Tag, props) {
|
|
|
2270
2332
|
return /*#__PURE__*/ react$1.createElement(Tag, props);
|
|
2271
2333
|
}
|
|
2272
2334
|
//#endregion
|
|
2335
|
+
//#region ../../../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2336
|
+
function hasWindow() {
|
|
2337
|
+
return typeof window !== "undefined";
|
|
2338
|
+
}
|
|
2339
|
+
function getWindow(node) {
|
|
2340
|
+
var _node$ownerDocument;
|
|
2341
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2342
|
+
}
|
|
2343
|
+
function isHTMLElement(value) {
|
|
2344
|
+
if (!hasWindow()) return false;
|
|
2345
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2346
|
+
}
|
|
2347
|
+
//#endregion
|
|
2348
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.6.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
|
|
2349
|
+
const CompositeRootContext = /*#__PURE__*/ react$1.createContext(void 0);
|
|
2350
|
+
if (process.env.NODE_ENV !== "production") CompositeRootContext.displayName = "CompositeRootContext";
|
|
2351
|
+
function useCompositeRootContext(optional = false) {
|
|
2352
|
+
const context = react$1.useContext(CompositeRootContext);
|
|
2353
|
+
if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage(16));
|
|
2354
|
+
return context;
|
|
2355
|
+
}
|
|
2356
|
+
//#endregion
|
|
2357
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.6.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
|
|
2358
|
+
function useFocusableWhenDisabled(parameters) {
|
|
2359
|
+
const { focusableWhenDisabled, disabled, composite = false, tabIndex: tabIndexProp = 0, isNativeButton } = parameters;
|
|
2360
|
+
const isFocusableComposite = composite && focusableWhenDisabled !== false;
|
|
2361
|
+
const isNonFocusableComposite = composite && focusableWhenDisabled === false;
|
|
2362
|
+
return { props: react$1.useMemo(() => {
|
|
2363
|
+
const additionalProps = { onKeyDown(event) {
|
|
2364
|
+
if (disabled && focusableWhenDisabled && event.key !== "Tab") event.preventDefault();
|
|
2365
|
+
} };
|
|
2366
|
+
if (!composite) {
|
|
2367
|
+
additionalProps.tabIndex = tabIndexProp;
|
|
2368
|
+
if (!isNativeButton && disabled) additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
|
|
2369
|
+
}
|
|
2370
|
+
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) additionalProps["aria-disabled"] = disabled;
|
|
2371
|
+
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) additionalProps.disabled = disabled;
|
|
2372
|
+
return additionalProps;
|
|
2373
|
+
}, [
|
|
2374
|
+
composite,
|
|
2375
|
+
disabled,
|
|
2376
|
+
focusableWhenDisabled,
|
|
2377
|
+
isFocusableComposite,
|
|
2378
|
+
isNonFocusableComposite,
|
|
2379
|
+
isNativeButton,
|
|
2380
|
+
tabIndexProp
|
|
2381
|
+
]) };
|
|
2382
|
+
}
|
|
2383
|
+
//#endregion
|
|
2384
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.6.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/use-button/useButton.mjs
|
|
2385
|
+
function useButton(parameters = {}) {
|
|
2386
|
+
const { disabled = false, focusableWhenDisabled, tabIndex = 0, native: isNativeButton = true, composite: compositeProp } = parameters;
|
|
2387
|
+
const elementRef = react$1.useRef(null);
|
|
2388
|
+
const compositeRootContext = useCompositeRootContext(true);
|
|
2389
|
+
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
|
|
2390
|
+
const { props: focusableWhenDisabledProps } = useFocusableWhenDisabled({
|
|
2391
|
+
focusableWhenDisabled,
|
|
2392
|
+
disabled,
|
|
2393
|
+
composite: isCompositeItem,
|
|
2394
|
+
tabIndex,
|
|
2395
|
+
isNativeButton
|
|
2396
|
+
});
|
|
2397
|
+
if (process.env.NODE_ENV !== "production") react$1.useEffect(() => {
|
|
2398
|
+
if (!elementRef.current) return;
|
|
2399
|
+
const isButtonTag = isButtonElement(elementRef.current);
|
|
2400
|
+
if (isNativeButton) {
|
|
2401
|
+
if (!isButtonTag) error(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${SafeReact.captureOwnerStack?.() || ""}`);
|
|
2402
|
+
} else if (isButtonTag) error(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${SafeReact.captureOwnerStack?.() || ""}`);
|
|
2403
|
+
}, [isNativeButton]);
|
|
2404
|
+
const updateDisabled = react$1.useCallback(() => {
|
|
2405
|
+
const element = elementRef.current;
|
|
2406
|
+
if (!isButtonElement(element)) return;
|
|
2407
|
+
if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === void 0 && element.disabled) element.disabled = false;
|
|
2408
|
+
}, [
|
|
2409
|
+
disabled,
|
|
2410
|
+
focusableWhenDisabledProps.disabled,
|
|
2411
|
+
isCompositeItem
|
|
2412
|
+
]);
|
|
2413
|
+
useIsoLayoutEffect(updateDisabled, [updateDisabled]);
|
|
2414
|
+
return {
|
|
2415
|
+
getButtonProps: react$1.useCallback((externalProps = {}) => {
|
|
2416
|
+
const { onClick: externalOnClick, onMouseDown: externalOnMouseDown, onKeyUp: externalOnKeyUp, onKeyDown: externalOnKeyDown, onPointerDown: externalOnPointerDown, ...otherExternalProps } = externalProps;
|
|
2417
|
+
return mergeProps({
|
|
2418
|
+
onClick(event) {
|
|
2419
|
+
if (disabled) {
|
|
2420
|
+
event.preventDefault();
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
externalOnClick?.(event);
|
|
2424
|
+
},
|
|
2425
|
+
onMouseDown(event) {
|
|
2426
|
+
if (!disabled) externalOnMouseDown?.(event);
|
|
2427
|
+
},
|
|
2428
|
+
onKeyDown(event) {
|
|
2429
|
+
if (disabled) return;
|
|
2430
|
+
makeEventPreventable(event);
|
|
2431
|
+
externalOnKeyDown?.(event);
|
|
2432
|
+
if (event.baseUIHandlerPrevented) return;
|
|
2433
|
+
const isCurrentTarget = event.target === event.currentTarget;
|
|
2434
|
+
const currentTarget = event.currentTarget;
|
|
2435
|
+
const isButton = isButtonElement(currentTarget);
|
|
2436
|
+
const isLink = !isNativeButton && isValidLinkElement(currentTarget);
|
|
2437
|
+
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
|
|
2438
|
+
const isEnterKey = event.key === "Enter";
|
|
2439
|
+
const isSpaceKey = event.key === " ";
|
|
2440
|
+
const role = currentTarget.getAttribute("role");
|
|
2441
|
+
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
|
|
2442
|
+
if (isCurrentTarget && isCompositeItem && isSpaceKey) {
|
|
2443
|
+
if (event.defaultPrevented && isTextNavigationRole) return;
|
|
2444
|
+
event.preventDefault();
|
|
2445
|
+
if (isLink || isNativeButton && isButton) {
|
|
2446
|
+
currentTarget.click();
|
|
2447
|
+
event.preventBaseUIHandler();
|
|
2448
|
+
} else if (shouldClick) {
|
|
2449
|
+
externalOnClick?.(event);
|
|
2450
|
+
event.preventBaseUIHandler();
|
|
2451
|
+
}
|
|
2452
|
+
return;
|
|
2453
|
+
}
|
|
2454
|
+
if (shouldClick) {
|
|
2455
|
+
if (!isNativeButton && (isSpaceKey || isEnterKey)) event.preventDefault();
|
|
2456
|
+
if (!isNativeButton && isEnterKey) externalOnClick?.(event);
|
|
2457
|
+
}
|
|
2458
|
+
},
|
|
2459
|
+
onKeyUp(event) {
|
|
2460
|
+
if (disabled) return;
|
|
2461
|
+
makeEventPreventable(event);
|
|
2462
|
+
externalOnKeyUp?.(event);
|
|
2463
|
+
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
|
|
2464
|
+
event.preventDefault();
|
|
2465
|
+
return;
|
|
2466
|
+
}
|
|
2467
|
+
if (event.baseUIHandlerPrevented) return;
|
|
2468
|
+
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") externalOnClick?.(event);
|
|
2469
|
+
},
|
|
2470
|
+
onPointerDown(event) {
|
|
2471
|
+
if (disabled) {
|
|
2472
|
+
event.preventDefault();
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2475
|
+
externalOnPointerDown?.(event);
|
|
2476
|
+
}
|
|
2477
|
+
}, isNativeButton ? { type: "button" } : { role: "button" }, focusableWhenDisabledProps, otherExternalProps);
|
|
2478
|
+
}, [
|
|
2479
|
+
disabled,
|
|
2480
|
+
focusableWhenDisabledProps,
|
|
2481
|
+
isCompositeItem,
|
|
2482
|
+
isNativeButton
|
|
2483
|
+
]),
|
|
2484
|
+
buttonRef: useStableCallback((element) => {
|
|
2485
|
+
elementRef.current = element;
|
|
2486
|
+
updateDisabled();
|
|
2487
|
+
})
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
function isButtonElement(elem) {
|
|
2491
|
+
return isHTMLElement(elem) && elem.tagName === "BUTTON";
|
|
2492
|
+
}
|
|
2493
|
+
function isValidLinkElement(elem) {
|
|
2494
|
+
return Boolean(elem?.tagName === "A" && elem?.href);
|
|
2495
|
+
}
|
|
2496
|
+
//#endregion
|
|
2497
|
+
//#region ../../../node_modules/.pnpm/@base-ui+react@1.6.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/button/Button.mjs
|
|
2498
|
+
/**
|
|
2499
|
+
* A button component that can be used to trigger actions.
|
|
2500
|
+
* Renders a `<button>` element.
|
|
2501
|
+
*
|
|
2502
|
+
* Documentation: [Base UI Button](https://base-ui.com/react/components/button)
|
|
2503
|
+
*/
|
|
2504
|
+
const Button$2 = /*#__PURE__*/ react$1.forwardRef(function Button(componentProps, forwardedRef) {
|
|
2505
|
+
const { render, className, disabled = false, focusableWhenDisabled = false, nativeButton = true, style, ...elementProps } = componentProps;
|
|
2506
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
2507
|
+
disabled,
|
|
2508
|
+
focusableWhenDisabled,
|
|
2509
|
+
native: nativeButton
|
|
2510
|
+
});
|
|
2511
|
+
return useRenderElement("button", componentProps, {
|
|
2512
|
+
state: { disabled },
|
|
2513
|
+
ref: [forwardedRef, buttonRef],
|
|
2514
|
+
props: [elementProps, getButtonProps]
|
|
2515
|
+
});
|
|
2516
|
+
});
|
|
2517
|
+
if (process.env.NODE_ENV !== "production") Button$2.displayName = "Button";
|
|
2518
|
+
//#endregion
|
|
2273
2519
|
//#region ../../../node_modules/.pnpm/@base-ui+react@1.6.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/use-render/useRender.mjs
|
|
2274
2520
|
/**
|
|
2275
2521
|
* Renders a Base UI element.
|
|
@@ -2281,8 +2527,8 @@ function useRender(params) {
|
|
|
2281
2527
|
}
|
|
2282
2528
|
//#endregion
|
|
2283
2529
|
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/text/text.mjs
|
|
2284
|
-
var STYLE_HASH_ATTRIBUTE$
|
|
2285
|
-
function getRuntime$
|
|
2530
|
+
var STYLE_HASH_ATTRIBUTE$3 = "data-wp-hash";
|
|
2531
|
+
function getRuntime$3() {
|
|
2286
2532
|
const globalScope = globalThis;
|
|
2287
2533
|
if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
|
|
2288
2534
|
globalScope.__wpStyleRuntime = {
|
|
@@ -2290,37 +2536,37 @@ function getRuntime$1() {
|
|
|
2290
2536
|
styles: /* @__PURE__ */ new Map(),
|
|
2291
2537
|
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
2292
2538
|
};
|
|
2293
|
-
if (typeof document !== "undefined") registerDocument$
|
|
2539
|
+
if (typeof document !== "undefined") registerDocument$3(document);
|
|
2294
2540
|
return globalScope.__wpStyleRuntime;
|
|
2295
2541
|
}
|
|
2296
|
-
function documentContainsStyleHash$
|
|
2542
|
+
function documentContainsStyleHash$3(targetDocument, hash) {
|
|
2297
2543
|
if (!targetDocument.head) return false;
|
|
2298
|
-
for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE$
|
|
2544
|
+
for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE$3}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE$3) === hash) return true;
|
|
2299
2545
|
return false;
|
|
2300
2546
|
}
|
|
2301
|
-
function injectStyle$
|
|
2547
|
+
function injectStyle$3(targetDocument, hash, css) {
|
|
2302
2548
|
if (!targetDocument.head) return;
|
|
2303
|
-
const runtime = getRuntime$
|
|
2549
|
+
const runtime = getRuntime$3();
|
|
2304
2550
|
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
2305
2551
|
if (!injectedStyles) {
|
|
2306
2552
|
injectedStyles = /* @__PURE__ */ new Set();
|
|
2307
2553
|
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
2308
2554
|
}
|
|
2309
2555
|
if (injectedStyles.has(hash)) return;
|
|
2310
|
-
if (documentContainsStyleHash$
|
|
2556
|
+
if (documentContainsStyleHash$3(targetDocument, hash)) {
|
|
2311
2557
|
injectedStyles.add(hash);
|
|
2312
2558
|
return;
|
|
2313
2559
|
}
|
|
2314
2560
|
const style = targetDocument.createElement("style");
|
|
2315
|
-
style.setAttribute(STYLE_HASH_ATTRIBUTE$
|
|
2561
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE$3, hash);
|
|
2316
2562
|
style.appendChild(targetDocument.createTextNode(css));
|
|
2317
2563
|
targetDocument.head.appendChild(style);
|
|
2318
2564
|
injectedStyles.add(hash);
|
|
2319
2565
|
}
|
|
2320
|
-
function registerDocument$
|
|
2321
|
-
const runtime = getRuntime$
|
|
2566
|
+
function registerDocument$3(targetDocument) {
|
|
2567
|
+
const runtime = getRuntime$3();
|
|
2322
2568
|
runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
|
|
2323
|
-
for (const [hash, css] of runtime.styles) injectStyle$
|
|
2569
|
+
for (const [hash, css] of runtime.styles) injectStyle$3(targetDocument, hash, css);
|
|
2324
2570
|
return () => {
|
|
2325
2571
|
const count = runtime.documents.get(targetDocument);
|
|
2326
2572
|
if (count === void 0) return;
|
|
@@ -2331,13 +2577,13 @@ function registerDocument$1(targetDocument) {
|
|
|
2331
2577
|
runtime.documents.set(targetDocument, count - 1);
|
|
2332
2578
|
};
|
|
2333
2579
|
}
|
|
2334
|
-
function registerStyle$
|
|
2335
|
-
const runtime = getRuntime$
|
|
2580
|
+
function registerStyle$3(hash, css) {
|
|
2581
|
+
const runtime = getRuntime$3();
|
|
2336
2582
|
runtime.styles.set(hash, css);
|
|
2337
|
-
for (const targetDocument of runtime.documents.keys()) injectStyle$
|
|
2583
|
+
for (const targetDocument of runtime.documents.keys()) injectStyle$3(targetDocument, hash, css);
|
|
2338
2584
|
}
|
|
2339
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$
|
|
2340
|
-
var style_default$
|
|
2585
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$3("0c5702ddca", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}");
|
|
2586
|
+
var style_default$3 = {
|
|
2341
2587
|
"text": "_83ed8a8da5dd50ea__text",
|
|
2342
2588
|
"heading-2xl": "_14437cfb77831647__heading-2xl",
|
|
2343
2589
|
"heading-xl": "_3c78b7fa9b4072dd__heading-xl",
|
|
@@ -2349,8 +2595,8 @@ var style_default$1 = {
|
|
|
2349
2595
|
"body-md": "_131101940be12424__body-md",
|
|
2350
2596
|
"body-sm": "_0e8d87a42c1f75fa__body-sm"
|
|
2351
2597
|
};
|
|
2352
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$
|
|
2353
|
-
var global_css_defense_default = {
|
|
2598
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$3("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
|
|
2599
|
+
var global_css_defense_default$1 = {
|
|
2354
2600
|
"button": "_6defc79820e382c6__button",
|
|
2355
2601
|
"input": "d2cff2e5dea83bd1__input",
|
|
2356
2602
|
"textarea": "_547d86373d02e108__textarea",
|
|
@@ -2364,10 +2610,317 @@ var Text$2 = (0, react$1.forwardRef)(function Text2({ variant = "body-md", rende
|
|
|
2364
2610
|
render,
|
|
2365
2611
|
defaultTagName: "span",
|
|
2366
2612
|
ref,
|
|
2367
|
-
props: mergeProps(props, { className: (0, clsx.default)(style_default$
|
|
2613
|
+
props: mergeProps(props, { className: (0, clsx.default)(style_default$3.text, global_css_defense_default$1.heading, global_css_defense_default$1.p, style_default$3[variant], className) })
|
|
2368
2614
|
});
|
|
2369
2615
|
});
|
|
2370
2616
|
//#endregion
|
|
2617
|
+
//#region ../../../node_modules/.pnpm/@wordpress+dom-ready@4.51.0/node_modules/@wordpress/dom-ready/build-module/index.mjs
|
|
2618
|
+
function domReady(callback) {
|
|
2619
|
+
if (typeof document === "undefined") return;
|
|
2620
|
+
if (document.readyState === "complete" || document.readyState === "interactive") {
|
|
2621
|
+
callback();
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
document.addEventListener("DOMContentLoaded", callback);
|
|
2625
|
+
}
|
|
2626
|
+
//#endregion
|
|
2627
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/script/add-container.mjs
|
|
2628
|
+
function addContainer(ariaLive = "polite") {
|
|
2629
|
+
const container = document.createElement("div");
|
|
2630
|
+
container.id = `a11y-speak-${ariaLive}`;
|
|
2631
|
+
container.className = "a11y-speak-region";
|
|
2632
|
+
container.setAttribute("style", "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;word-break:normal !important;");
|
|
2633
|
+
container.setAttribute("aria-live", ariaLive);
|
|
2634
|
+
container.setAttribute("aria-relevant", "additions text");
|
|
2635
|
+
container.setAttribute("aria-atomic", "true");
|
|
2636
|
+
const { body } = document;
|
|
2637
|
+
if (body) body.appendChild(container);
|
|
2638
|
+
return container;
|
|
2639
|
+
}
|
|
2640
|
+
//#endregion
|
|
2641
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/script/add-intro-text.mjs
|
|
2642
|
+
function addIntroText() {
|
|
2643
|
+
const introText = document.createElement("p");
|
|
2644
|
+
introText.id = "a11y-speak-intro-text";
|
|
2645
|
+
introText.className = "a11y-speak-intro-text";
|
|
2646
|
+
introText.textContent = (0, _wordpress_i18n.__)("Notifications");
|
|
2647
|
+
introText.setAttribute("style", "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;word-break:normal !important;");
|
|
2648
|
+
introText.setAttribute("hidden", "");
|
|
2649
|
+
const { body } = document;
|
|
2650
|
+
if (body) body.appendChild(introText);
|
|
2651
|
+
return introText;
|
|
2652
|
+
}
|
|
2653
|
+
//#endregion
|
|
2654
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/shared/clear.mjs
|
|
2655
|
+
function clear() {
|
|
2656
|
+
const regions = document.getElementsByClassName("a11y-speak-region");
|
|
2657
|
+
const introText = document.getElementById("a11y-speak-intro-text");
|
|
2658
|
+
for (let i = 0; i < regions.length; i++) regions[i].textContent = "";
|
|
2659
|
+
if (introText) introText.setAttribute("hidden", "hidden");
|
|
2660
|
+
}
|
|
2661
|
+
//#endregion
|
|
2662
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/shared/filter-message.mjs
|
|
2663
|
+
var previousMessage = "";
|
|
2664
|
+
function filterMessage(message) {
|
|
2665
|
+
message = message.replace(/<[^<>]+>/g, " ");
|
|
2666
|
+
if (previousMessage === message) message += "\xA0";
|
|
2667
|
+
previousMessage = message;
|
|
2668
|
+
return message;
|
|
2669
|
+
}
|
|
2670
|
+
//#endregion
|
|
2671
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/shared/index.mjs
|
|
2672
|
+
function speak(message, ariaLive) {
|
|
2673
|
+
clear();
|
|
2674
|
+
message = filterMessage(message);
|
|
2675
|
+
const introText = document.getElementById("a11y-speak-intro-text");
|
|
2676
|
+
const containerAssertive = document.getElementById("a11y-speak-assertive");
|
|
2677
|
+
const containerPolite = document.getElementById("a11y-speak-polite");
|
|
2678
|
+
if (containerAssertive && ariaLive === "assertive") containerAssertive.textContent = message;
|
|
2679
|
+
else if (containerPolite) containerPolite.textContent = message;
|
|
2680
|
+
if (introText) introText.removeAttribute("hidden");
|
|
2681
|
+
}
|
|
2682
|
+
//#endregion
|
|
2683
|
+
//#region ../../../node_modules/.pnpm/@wordpress+a11y@4.51.0/node_modules/@wordpress/a11y/build-module/index.mjs
|
|
2684
|
+
function setup() {
|
|
2685
|
+
const introText = document.getElementById("a11y-speak-intro-text");
|
|
2686
|
+
const containerAssertive = document.getElementById("a11y-speak-assertive");
|
|
2687
|
+
const containerPolite = document.getElementById("a11y-speak-polite");
|
|
2688
|
+
if (introText === null) addIntroText();
|
|
2689
|
+
if (containerAssertive === null) addContainer("assertive");
|
|
2690
|
+
if (containerPolite === null) addContainer("polite");
|
|
2691
|
+
}
|
|
2692
|
+
domReady(setup);
|
|
2693
|
+
//#endregion
|
|
2694
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/button/button.mjs
|
|
2695
|
+
var STYLE_HASH_ATTRIBUTE$2 = "data-wp-hash";
|
|
2696
|
+
function getRuntime$2() {
|
|
2697
|
+
const globalScope = globalThis;
|
|
2698
|
+
if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
|
|
2699
|
+
globalScope.__wpStyleRuntime = {
|
|
2700
|
+
documents: /* @__PURE__ */ new Map(),
|
|
2701
|
+
styles: /* @__PURE__ */ new Map(),
|
|
2702
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
2703
|
+
};
|
|
2704
|
+
if (typeof document !== "undefined") registerDocument$2(document);
|
|
2705
|
+
return globalScope.__wpStyleRuntime;
|
|
2706
|
+
}
|
|
2707
|
+
function documentContainsStyleHash$2(targetDocument, hash) {
|
|
2708
|
+
if (!targetDocument.head) return false;
|
|
2709
|
+
for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE$2}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE$2) === hash) return true;
|
|
2710
|
+
return false;
|
|
2711
|
+
}
|
|
2712
|
+
function injectStyle$2(targetDocument, hash, css) {
|
|
2713
|
+
if (!targetDocument.head) return;
|
|
2714
|
+
const runtime = getRuntime$2();
|
|
2715
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
2716
|
+
if (!injectedStyles) {
|
|
2717
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
2718
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
2719
|
+
}
|
|
2720
|
+
if (injectedStyles.has(hash)) return;
|
|
2721
|
+
if (documentContainsStyleHash$2(targetDocument, hash)) {
|
|
2722
|
+
injectedStyles.add(hash);
|
|
2723
|
+
return;
|
|
2724
|
+
}
|
|
2725
|
+
const style = targetDocument.createElement("style");
|
|
2726
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE$2, hash);
|
|
2727
|
+
style.appendChild(targetDocument.createTextNode(css));
|
|
2728
|
+
targetDocument.head.appendChild(style);
|
|
2729
|
+
injectedStyles.add(hash);
|
|
2730
|
+
}
|
|
2731
|
+
function registerDocument$2(targetDocument) {
|
|
2732
|
+
const runtime = getRuntime$2();
|
|
2733
|
+
runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
|
|
2734
|
+
for (const [hash, css] of runtime.styles) injectStyle$2(targetDocument, hash, css);
|
|
2735
|
+
return () => {
|
|
2736
|
+
const count = runtime.documents.get(targetDocument);
|
|
2737
|
+
if (count === void 0) return;
|
|
2738
|
+
if (count <= 1) {
|
|
2739
|
+
runtime.documents.delete(targetDocument);
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
2743
|
+
};
|
|
2744
|
+
}
|
|
2745
|
+
function registerStyle$2(hash, css) {
|
|
2746
|
+
const runtime = getRuntime$2();
|
|
2747
|
+
runtime.styles.set(hash, css);
|
|
2748
|
+
for (const targetDocument of runtime.documents.keys()) injectStyle$2(targetDocument, hash, css);
|
|
2749
|
+
}
|
|
2750
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$2("4c317b0736", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-medium,499);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:\"\";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}");
|
|
2751
|
+
var style_default$2 = {
|
|
2752
|
+
"button": "_97b0fc33c028be1a__button",
|
|
2753
|
+
"is-unstyled": "abbb272e2ce49bd6__is-unstyled",
|
|
2754
|
+
"is-loading": "_914b42f315c0e580__is-loading",
|
|
2755
|
+
"is-small": "_908205475f9f2a92__is-small",
|
|
2756
|
+
"icon": "_9f6fc6553aeb36fe__icon",
|
|
2757
|
+
"is-brand": "dd460c965226cc77__is-brand",
|
|
2758
|
+
"is-outline": "_62d5a778b7b258ee__is-outline",
|
|
2759
|
+
"is-minimal": "ad0619a3217c6a5b__is-minimal",
|
|
2760
|
+
"is-neutral": "e722a8f96726aa99__is-neutral",
|
|
2761
|
+
"is-solid": "b50b3358c5fb4d0b__is-solid",
|
|
2762
|
+
"is-compact": "cf59cf1b69629838__is-compact",
|
|
2763
|
+
"loading-animation": "_5a1d53da6f830c8d__loading-animation"
|
|
2764
|
+
};
|
|
2765
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
|
|
2766
|
+
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
|
|
2767
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$2("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
|
|
2768
|
+
var focus_default = {
|
|
2769
|
+
"outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus",
|
|
2770
|
+
"outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active",
|
|
2771
|
+
"outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible",
|
|
2772
|
+
"outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within",
|
|
2773
|
+
"outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active",
|
|
2774
|
+
"outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible",
|
|
2775
|
+
"outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible"
|
|
2776
|
+
};
|
|
2777
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$2("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
|
|
2778
|
+
var global_css_defense_default = {
|
|
2779
|
+
"button": "_6defc79820e382c6__button",
|
|
2780
|
+
"input": "d2cff2e5dea83bd1__input",
|
|
2781
|
+
"textarea": "_547d86373d02e108__textarea",
|
|
2782
|
+
"div": "_8c15fd0ed9f28ba4__div",
|
|
2783
|
+
"p": "_43cec3e1eec1066d__p",
|
|
2784
|
+
"heading": "e97669c6d9a38497__heading",
|
|
2785
|
+
"a": "_2c0831b0499dbd6e__a"
|
|
2786
|
+
};
|
|
2787
|
+
var Button$1 = (0, react$1.forwardRef)(function Button2({ tone = "brand", variant = "solid", size = "default", className, focusableWhenDisabled = true, disabled, loading, loadingAnnouncement = (0, _wordpress_i18n.__)("Loading"), children, ...props }, ref) {
|
|
2788
|
+
const mergedClassName = (0, clsx.default)(global_css_defense_default.button, resets_default["box-sizing"], focus_default["outset-ring--focus-except-active"], variant !== "unstyled" && style_default$2.button, style_default$2[`is-${tone}`], style_default$2[`is-${variant}`], style_default$2[`is-${size}`], loading && style_default$2["is-loading"], className);
|
|
2789
|
+
(0, react$1.useEffect)(() => {
|
|
2790
|
+
if (loading && loadingAnnouncement) speak(loadingAnnouncement);
|
|
2791
|
+
}, [loading, loadingAnnouncement]);
|
|
2792
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button$2, {
|
|
2793
|
+
ref,
|
|
2794
|
+
className: mergedClassName,
|
|
2795
|
+
focusableWhenDisabled,
|
|
2796
|
+
disabled: disabled ?? loading,
|
|
2797
|
+
...props,
|
|
2798
|
+
children
|
|
2799
|
+
});
|
|
2800
|
+
});
|
|
2801
|
+
//#endregion
|
|
2802
|
+
//#region ../../../node_modules/.pnpm/@wordpress+primitives@4.51.0_@types+react@18.3.28_react@18.3.1/node_modules/@wordpress/primitives/build-module/svg/index.mjs
|
|
2803
|
+
var SVG = (0, react$1.forwardRef)(
|
|
2804
|
+
/**
|
|
2805
|
+
* @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
|
|
2806
|
+
* Other props will be passed through to svg component.
|
|
2807
|
+
* @param {React.ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
|
|
2808
|
+
*
|
|
2809
|
+
* @return {React.JSX.Element} Stop component
|
|
2810
|
+
*/
|
|
2811
|
+
({ className, isPressed, ...props }, ref) => {
|
|
2812
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
2813
|
+
...props,
|
|
2814
|
+
className: (0, clsx.default)(className, { "is-pressed": isPressed }) || void 0,
|
|
2815
|
+
"aria-hidden": true,
|
|
2816
|
+
focusable: false,
|
|
2817
|
+
ref
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
);
|
|
2821
|
+
SVG.displayName = "SVG";
|
|
2822
|
+
//#endregion
|
|
2823
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/icon/icon.mjs
|
|
2824
|
+
var Icon$2 = (0, react$1.forwardRef)(function Icon2({ icon, size = 24, ...restProps }, ref) {
|
|
2825
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SVG, {
|
|
2826
|
+
ref,
|
|
2827
|
+
...icon.props,
|
|
2828
|
+
...restProps,
|
|
2829
|
+
width: size,
|
|
2830
|
+
height: size
|
|
2831
|
+
});
|
|
2832
|
+
});
|
|
2833
|
+
//#endregion
|
|
2834
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/button/icon.mjs
|
|
2835
|
+
var STYLE_HASH_ATTRIBUTE$1 = "data-wp-hash";
|
|
2836
|
+
function getRuntime$1() {
|
|
2837
|
+
const globalScope = globalThis;
|
|
2838
|
+
if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
|
|
2839
|
+
globalScope.__wpStyleRuntime = {
|
|
2840
|
+
documents: /* @__PURE__ */ new Map(),
|
|
2841
|
+
styles: /* @__PURE__ */ new Map(),
|
|
2842
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
2843
|
+
};
|
|
2844
|
+
if (typeof document !== "undefined") registerDocument$1(document);
|
|
2845
|
+
return globalScope.__wpStyleRuntime;
|
|
2846
|
+
}
|
|
2847
|
+
function documentContainsStyleHash$1(targetDocument, hash) {
|
|
2848
|
+
if (!targetDocument.head) return false;
|
|
2849
|
+
for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE$1}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE$1) === hash) return true;
|
|
2850
|
+
return false;
|
|
2851
|
+
}
|
|
2852
|
+
function injectStyle$1(targetDocument, hash, css) {
|
|
2853
|
+
if (!targetDocument.head) return;
|
|
2854
|
+
const runtime = getRuntime$1();
|
|
2855
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
2856
|
+
if (!injectedStyles) {
|
|
2857
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
2858
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
2859
|
+
}
|
|
2860
|
+
if (injectedStyles.has(hash)) return;
|
|
2861
|
+
if (documentContainsStyleHash$1(targetDocument, hash)) {
|
|
2862
|
+
injectedStyles.add(hash);
|
|
2863
|
+
return;
|
|
2864
|
+
}
|
|
2865
|
+
const style = targetDocument.createElement("style");
|
|
2866
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE$1, hash);
|
|
2867
|
+
style.appendChild(targetDocument.createTextNode(css));
|
|
2868
|
+
targetDocument.head.appendChild(style);
|
|
2869
|
+
injectedStyles.add(hash);
|
|
2870
|
+
}
|
|
2871
|
+
function registerDocument$1(targetDocument) {
|
|
2872
|
+
const runtime = getRuntime$1();
|
|
2873
|
+
runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
|
|
2874
|
+
for (const [hash, css] of runtime.styles) injectStyle$1(targetDocument, hash, css);
|
|
2875
|
+
return () => {
|
|
2876
|
+
const count = runtime.documents.get(targetDocument);
|
|
2877
|
+
if (count === void 0) return;
|
|
2878
|
+
if (count <= 1) {
|
|
2879
|
+
runtime.documents.delete(targetDocument);
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2885
|
+
function registerStyle$1(hash, css) {
|
|
2886
|
+
const runtime = getRuntime$1();
|
|
2887
|
+
runtime.styles.set(hash, css);
|
|
2888
|
+
for (const targetDocument of runtime.documents.keys()) injectStyle$1(targetDocument, hash, css);
|
|
2889
|
+
}
|
|
2890
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle$1("4c317b0736", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-medium,499);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:\"\";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}");
|
|
2891
|
+
var style_default$1 = {
|
|
2892
|
+
"button": "_97b0fc33c028be1a__button",
|
|
2893
|
+
"is-unstyled": "abbb272e2ce49bd6__is-unstyled",
|
|
2894
|
+
"is-loading": "_914b42f315c0e580__is-loading",
|
|
2895
|
+
"is-small": "_908205475f9f2a92__is-small",
|
|
2896
|
+
"icon": "_9f6fc6553aeb36fe__icon",
|
|
2897
|
+
"is-brand": "dd460c965226cc77__is-brand",
|
|
2898
|
+
"is-outline": "_62d5a778b7b258ee__is-outline",
|
|
2899
|
+
"is-minimal": "ad0619a3217c6a5b__is-minimal",
|
|
2900
|
+
"is-neutral": "e722a8f96726aa99__is-neutral",
|
|
2901
|
+
"is-solid": "b50b3358c5fb4d0b__is-solid",
|
|
2902
|
+
"is-compact": "cf59cf1b69629838__is-compact",
|
|
2903
|
+
"loading-animation": "_5a1d53da6f830c8d__loading-animation"
|
|
2904
|
+
};
|
|
2905
|
+
var ButtonIcon = (0, react$1.forwardRef)(function ButtonIcon2({ className, icon, ...props }, ref) {
|
|
2906
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$2, {
|
|
2907
|
+
ref,
|
|
2908
|
+
icon,
|
|
2909
|
+
className: (0, clsx.default)(style_default$1.icon, className),
|
|
2910
|
+
size: 24,
|
|
2911
|
+
...props
|
|
2912
|
+
});
|
|
2913
|
+
});
|
|
2914
|
+
//#endregion
|
|
2915
|
+
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/button/index.mjs
|
|
2916
|
+
ButtonIcon.displayName = "Button.Icon";
|
|
2917
|
+
var Button = Object.assign(Button$1, {
|
|
2918
|
+
/**
|
|
2919
|
+
* An icon component specifically designed to work well when rendered inside
|
|
2920
|
+
* a `Button` component.
|
|
2921
|
+
*/
|
|
2922
|
+
Icon: ButtonIcon });
|
|
2923
|
+
//#endregion
|
|
2371
2924
|
//#region ../../../node_modules/.pnpm/@wordpress+ui@0.17.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/stack/stack.mjs
|
|
2372
2925
|
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
2373
2926
|
function getRuntime() {
|
|
@@ -2532,8 +3085,13 @@ const BaseLegend = (0, react$1.forwardRef)(({ items, className, orientation = "h
|
|
|
2532
3085
|
});
|
|
2533
3086
|
const domain = legendScale.domain();
|
|
2534
3087
|
const getShapeStyle = (0, react$1.useCallback)(({ index }) => items[index]?.shapeStyle, [items]);
|
|
2535
|
-
const handleLegendClick = (0, react$1.useCallback)((
|
|
2536
|
-
if (interactive && chartId && context)
|
|
3088
|
+
const handleLegendClick = (0, react$1.useCallback)((seriesLabels) => {
|
|
3089
|
+
if (interactive && chartId && context) {
|
|
3090
|
+
const representativeVisible = context.isSeriesVisible(chartId, seriesLabels[0]);
|
|
3091
|
+
seriesLabels.forEach((label) => {
|
|
3092
|
+
if (context.isSeriesVisible(chartId, label) === representativeVisible) context.toggleSeriesVisibility(chartId, label);
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
2537
3095
|
}, [
|
|
2538
3096
|
interactive,
|
|
2539
3097
|
chartId,
|
|
@@ -2547,16 +3105,16 @@ const BaseLegend = (0, react$1.forwardRef)(({ items, className, orientation = "h
|
|
|
2547
3105
|
chartId,
|
|
2548
3106
|
context
|
|
2549
3107
|
]);
|
|
2550
|
-
const createClickHandler = (0, react$1.useCallback)((
|
|
3108
|
+
const createClickHandler = (0, react$1.useCallback)((seriesLabels) => {
|
|
2551
3109
|
if (!interactive) return;
|
|
2552
|
-
return () => handleLegendClick(
|
|
3110
|
+
return () => handleLegendClick(seriesLabels);
|
|
2553
3111
|
}, [interactive, handleLegendClick]);
|
|
2554
|
-
const createKeyDownHandler = (0, react$1.useCallback)((
|
|
3112
|
+
const createKeyDownHandler = (0, react$1.useCallback)((seriesLabels) => {
|
|
2555
3113
|
if (!interactive) return;
|
|
2556
3114
|
return (event) => {
|
|
2557
3115
|
if (event.key === "Enter" || event.key === " ") {
|
|
2558
3116
|
event.preventDefault();
|
|
2559
|
-
handleLegendClick(
|
|
3117
|
+
handleLegendClick(seriesLabels);
|
|
2560
3118
|
}
|
|
2561
3119
|
};
|
|
2562
3120
|
}, [interactive, handleLegendClick]);
|
|
@@ -2576,10 +3134,11 @@ const BaseLegend = (0, react$1.forwardRef)(({ items, className, orientation = "h
|
|
|
2576
3134
|
className: (0, clsx.default)(base_legend_module_default.legend, className),
|
|
2577
3135
|
style: theme.legend?.containerStyles,
|
|
2578
3136
|
children: labels.map((label, i) => {
|
|
2579
|
-
const visible = isSeriesVisible(label.text);
|
|
2580
|
-
const handleClick = createClickHandler(label.text);
|
|
2581
|
-
const handleKeyDown = createKeyDownHandler(label.text);
|
|
2582
3137
|
const matchedItem = items[i];
|
|
3138
|
+
const seriesLabels = matchedItem?.seriesLabels?.length ? matchedItem.seriesLabels : [label.text];
|
|
3139
|
+
const visible = isSeriesVisible(seriesLabels[0]);
|
|
3140
|
+
const handleClick = createClickHandler(seriesLabels);
|
|
3141
|
+
const handleKeyDown = createKeyDownHandler(seriesLabels);
|
|
2583
3142
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_visx_legend.LegendItem, {
|
|
2584
3143
|
className: (0, clsx.default)("visx-legend-item", base_legend_module_default["legend-item"], interactive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
|
|
2585
3144
|
margin: itemMargin,
|
|
@@ -2707,31 +3266,88 @@ function applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSi
|
|
|
2707
3266
|
return baseItem;
|
|
2708
3267
|
}
|
|
2709
3268
|
/**
|
|
2710
|
-
*
|
|
3269
|
+
* Buckets series by their `group`, preserving first-appearance order. Series with no group — or a
|
|
3270
|
+
* group value unique to them — end up in a bucket of their own. Whether a multi-series bucket then
|
|
3271
|
+
* collapses to a single legend item is decided by the caller: with `collapseGroups` on, every
|
|
3272
|
+
* multi-member bucket collapses, and the comparison pattern only decides which member represents it.
|
|
3273
|
+
* @param seriesData - The series data to group
|
|
3274
|
+
* @return Ordered groups, each holding its member series with their original indices
|
|
3275
|
+
*/
|
|
3276
|
+
function groupSeriesForLegend(seriesData) {
|
|
3277
|
+
const groups = [];
|
|
3278
|
+
const groupIndexByKey = /* @__PURE__ */ new Map();
|
|
3279
|
+
seriesData.forEach((series, index) => {
|
|
3280
|
+
const member = {
|
|
3281
|
+
series,
|
|
3282
|
+
index
|
|
3283
|
+
};
|
|
3284
|
+
const key = series.group;
|
|
3285
|
+
if (key === void 0) {
|
|
3286
|
+
groups.push([member]);
|
|
3287
|
+
return;
|
|
3288
|
+
}
|
|
3289
|
+
const existing = groupIndexByKey.get(key);
|
|
3290
|
+
if (existing === void 0) {
|
|
3291
|
+
groupIndexByKey.set(key, groups.length);
|
|
3292
|
+
groups.push([member]);
|
|
3293
|
+
} else groups[existing].push(member);
|
|
3294
|
+
});
|
|
3295
|
+
return groups;
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Builds a single legend item from a representative series, tagging it with the series it controls
|
|
3299
|
+
* @param member - The series (with its original index) that provides the label/colour
|
|
3300
|
+
* @param seriesLabels - Every series label this item toggles (grouped) or just its own
|
|
3301
|
+
* @param getElementStyles - Function to get element styles
|
|
3302
|
+
* @param showValues - Whether to show values in legend
|
|
3303
|
+
* @param withGlyph - Whether to include glyph rendering
|
|
3304
|
+
* @param glyphSize - Size of the glyph
|
|
3305
|
+
* @param renderGlyph - Component to render the glyph
|
|
3306
|
+
* @param legendShape - The shape type for legend items (string literal or React component)
|
|
3307
|
+
* @return The processed legend item
|
|
3308
|
+
*/
|
|
3309
|
+
function buildSeriesLegendItem(member, seriesLabels, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
|
|
3310
|
+
const { color, glyph, shapeStyles } = getElementStyles({
|
|
3311
|
+
data: member.series,
|
|
3312
|
+
index: member.index,
|
|
3313
|
+
legendShape
|
|
3314
|
+
});
|
|
3315
|
+
return applyGlyphToLegendItem({
|
|
3316
|
+
label: member.series.label,
|
|
3317
|
+
value: showValues ? member.series.data?.length?.toString() || "0" : "",
|
|
3318
|
+
color,
|
|
3319
|
+
shapeStyle: shapeStyles,
|
|
3320
|
+
seriesLabels
|
|
3321
|
+
}, withGlyph, glyph, renderGlyph, glyphSize);
|
|
3322
|
+
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Processes SeriesData into legend items. Every series keeps its own legend entry unless
|
|
3325
|
+
* `collapseGroups` is set, in which case series sharing a `group` collapse to one item labelled by
|
|
3326
|
+
* the group's primary (its first non-comparison member).
|
|
2711
3327
|
* @param seriesData - The series data to process
|
|
2712
3328
|
* @param getElementStyles - Function to get element styles
|
|
2713
3329
|
* @param showValues - Whether to show values in legend
|
|
2714
3330
|
* @param withGlyph - Whether to include glyph rendering
|
|
2715
3331
|
* @param glyphSize - Size of the glyph
|
|
3332
|
+
* @param collapseGroups - Whether series sharing a group collapse to a single item
|
|
2716
3333
|
* @param renderGlyph - Component to render the glyph
|
|
2717
3334
|
* @param legendShape - The shape type for legend items (string literal or React component)
|
|
2718
3335
|
* @return Array of processed legend items
|
|
2719
3336
|
*/
|
|
2720
|
-
function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
};
|
|
2734
|
-
return seriesData.map(mapper);
|
|
3337
|
+
function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, collapseGroups, renderGlyph, legendShape) {
|
|
3338
|
+
const buildItem = (member, seriesLabels) => buildSeriesLegendItem(member, seriesLabels, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape);
|
|
3339
|
+
if (!collapseGroups) return seriesData.map((series, index) => buildItem({
|
|
3340
|
+
series,
|
|
3341
|
+
index
|
|
3342
|
+
}, [series.label]));
|
|
3343
|
+
return groupSeriesForLegend(seriesData).flatMap((members) => {
|
|
3344
|
+
if (members.length > 1) {
|
|
3345
|
+
const primary = members.find(({ series }) => series.options?.type !== "comparison") ?? members[0];
|
|
3346
|
+
const seriesLabels = [primary.series.label, ...members.filter((member) => member !== primary).map(({ series }) => series.label)];
|
|
3347
|
+
return [buildItem(primary, seriesLabels)];
|
|
3348
|
+
}
|
|
3349
|
+
return members.map((member) => buildItem(member, [member.series.label]));
|
|
3350
|
+
});
|
|
2735
3351
|
}
|
|
2736
3352
|
/**
|
|
2737
3353
|
* Processes point data into legend items
|
|
@@ -2769,11 +3385,11 @@ function processPointData(pointData, getElementStyles, showValues, legendValueDi
|
|
|
2769
3385
|
* @return Array of legend items ready for display
|
|
2770
3386
|
*/
|
|
2771
3387
|
function useChartLegendItems(data, options = {}, legendShape) {
|
|
2772
|
-
const { showValues = false, legendValueDisplay = "percentage", withGlyph = false, glyphSize = 8, renderGlyph } = options;
|
|
3388
|
+
const { showValues = false, legendValueDisplay = "percentage", withGlyph = false, glyphSize = 8, collapseGroups = false, renderGlyph } = options;
|
|
2773
3389
|
const { getElementStyles } = useGlobalChartsContext();
|
|
2774
3390
|
return (0, react$1.useMemo)(() => {
|
|
2775
3391
|
if (!data || !Array.isArray(data) || data.length === 0) return [];
|
|
2776
|
-
if ("data" in data[0]) return processSeriesData(data, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape);
|
|
3392
|
+
if ("data" in data[0]) return processSeriesData(data, getElementStyles, showValues, withGlyph, glyphSize, collapseGroups, renderGlyph, legendShape);
|
|
2777
3393
|
return processPointData(data, getElementStyles, showValues, legendValueDisplay, withGlyph, glyphSize, renderGlyph, legendShape);
|
|
2778
3394
|
}, [
|
|
2779
3395
|
data,
|
|
@@ -2782,6 +3398,7 @@ function useChartLegendItems(data, options = {}, legendShape) {
|
|
|
2782
3398
|
legendValueDisplay,
|
|
2783
3399
|
withGlyph,
|
|
2784
3400
|
glyphSize,
|
|
3401
|
+
collapseGroups,
|
|
2785
3402
|
renderGlyph,
|
|
2786
3403
|
legendShape
|
|
2787
3404
|
]);
|
|
@@ -3288,14 +3905,13 @@ function withResponsive(WrappedComponent) {
|
|
|
3288
3905
|
};
|
|
3289
3906
|
}
|
|
3290
3907
|
//#endregion
|
|
3291
|
-
//#region src/charts/private/x-zoom.module.scss
|
|
3908
|
+
//#region src/charts/private/x-zoom/x-zoom.module.scss
|
|
3292
3909
|
var x_zoom_module_default = {
|
|
3293
|
-
"x-zoom__reset": "a8ccharts-
|
|
3294
|
-
"x-
|
|
3295
|
-
"x-zoom__selection": "a8ccharts-y6bXNq-x-zoom__selection"
|
|
3910
|
+
"x-zoom__reset": "a8ccharts-ur9dWW-x-zoom__reset",
|
|
3911
|
+
"x-zoom__selection": "a8ccharts-ur9dWW-x-zoom__selection"
|
|
3296
3912
|
};
|
|
3297
3913
|
//#endregion
|
|
3298
|
-
//#region src/charts/private/x-zoom.tsx
|
|
3914
|
+
//#region src/charts/private/x-zoom/x-zoom.tsx
|
|
3299
3915
|
const MIN_DRAG_PIXELS = 6;
|
|
3300
3916
|
/**
|
|
3301
3917
|
* Drag-to-zoom state + pointer handlers for an XY chart. Designed to be
|
|
@@ -3424,24 +4040,35 @@ function ZoomClip({ active, chartId, children }) {
|
|
|
3424
4040
|
})] });
|
|
3425
4041
|
}
|
|
3426
4042
|
/**
|
|
3427
|
-
* Visible icon-only reset
|
|
3428
|
-
*
|
|
3429
|
-
* container so the button anchors correctly.
|
|
4043
|
+
* Visible icon-only reset control rendered as an HTML overlay on top of the
|
|
4044
|
+
* chart container, using the WPDS `Button`. The host should wrap its SVG in a
|
|
4045
|
+
* `position: relative` container so the button anchors correctly.
|
|
4046
|
+
*
|
|
4047
|
+
* `IconButton` would be the natural fit, but it renders a Base UI tooltip whose
|
|
4048
|
+
* CommonJS `use-sync-external-store` dependency makes Rolldown emit a dynamic
|
|
4049
|
+
* `require()` into `dist`, which throws on evaluation in WordPress Script
|
|
4050
|
+
* Module consumers. `Button` gives the same treatment without that dependency;
|
|
4051
|
+
* the tooltip is replaced by `aria-label` + `title`.
|
|
3430
4052
|
*
|
|
3431
4053
|
* @param props - Props.
|
|
3432
4054
|
* @param props.onClick - Click handler. Typically the `reset` from `useXZoom`.
|
|
3433
4055
|
* @return JSX element.
|
|
3434
4056
|
*/
|
|
3435
4057
|
function ZoomResetButton({ onClick }) {
|
|
4058
|
+
const stopActivationKeys = (0, react$1.useCallback)((event) => {
|
|
4059
|
+
if (event.key === "Enter" || event.key === " ") event.stopPropagation();
|
|
4060
|
+
}, []);
|
|
3436
4061
|
const label = (0, _wordpress_i18n.__)("Reset zoom", "jetpack-charts");
|
|
3437
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3438
|
-
type: "button",
|
|
4062
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
3439
4063
|
className: x_zoom_module_default["x-zoom__reset"],
|
|
3440
|
-
|
|
4064
|
+
onKeyDown: stopActivationKeys,
|
|
3441
4065
|
"aria-label": label,
|
|
3442
4066
|
title: label,
|
|
3443
|
-
|
|
3444
|
-
|
|
4067
|
+
variant: "outline",
|
|
4068
|
+
tone: "neutral",
|
|
4069
|
+
size: "small",
|
|
4070
|
+
onClick,
|
|
4071
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button.Icon, { icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3445
4072
|
viewBox: "0 0 24 24",
|
|
3446
4073
|
fill: "none",
|
|
3447
4074
|
stroke: "currentColor",
|
|
@@ -3450,26 +4077,29 @@ function ZoomResetButton({ onClick }) {
|
|
|
3450
4077
|
strokeLinejoin: "round",
|
|
3451
4078
|
"aria-hidden": "true",
|
|
3452
4079
|
focusable: "false",
|
|
3453
|
-
children:
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
4080
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
4081
|
+
transform: "translate(2.4 2.4) scale(0.8)",
|
|
4082
|
+
children: [
|
|
4083
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
4084
|
+
cx: "10",
|
|
4085
|
+
cy: "10",
|
|
4086
|
+
r: "6"
|
|
4087
|
+
}),
|
|
4088
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
4089
|
+
x1: "15",
|
|
4090
|
+
y1: "15",
|
|
4091
|
+
x2: "20",
|
|
4092
|
+
y2: "20"
|
|
4093
|
+
}),
|
|
4094
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
4095
|
+
x1: "7",
|
|
4096
|
+
y1: "10",
|
|
4097
|
+
x2: "13",
|
|
4098
|
+
y2: "10"
|
|
4099
|
+
})
|
|
4100
|
+
]
|
|
4101
|
+
})
|
|
4102
|
+
}) })
|
|
3473
4103
|
});
|
|
3474
4104
|
}
|
|
3475
4105
|
//#endregion
|
|
@@ -3958,8 +4588,9 @@ const LineChartScalesRef = ({ chartRef, width, height, margin }) => {
|
|
|
3958
4588
|
]);
|
|
3959
4589
|
return null;
|
|
3960
4590
|
};
|
|
3961
|
-
const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, renderGlyph = defaultRenderGlyph, glyphStyle = {}, withLegendGlyph = false, withGradientFill = false, smoothing = true, curveType, renderTooltip = renderDefaultTooltip, withStartGlyphs = false, withEndGlyphs = false, animation, options = {}, onPointerDown = void 0, onPointerUp = void 0, onPointerMove = void 0, onPointerOut = void 0, zoomable = false, children, gridVisibility, gap = "md" }, ref) => {
|
|
4591
|
+
const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, renderGlyph = defaultRenderGlyph, glyphStyle = {}, withLegendGlyph = false, withGradientFill = false, smoothing = true, curveType, renderTooltip = renderDefaultTooltip, withStartGlyphs = false, withEndGlyphs = false, animation, options = {}, onPointerDown = void 0, onPointerUp = void 0, onPointerMove = void 0, onPointerOut = void 0, zoomable = false, rescaleYOnVisibilityChange = true, children, gridVisibility, gap = "md" }, ref) => {
|
|
3962
4592
|
const legendInteractive = legend.interactive ?? false;
|
|
4593
|
+
const legendCollapseGroups = legend.collapseGroups ?? false;
|
|
3963
4594
|
const legendShape = legend.shape ?? "line";
|
|
3964
4595
|
const legendPosition = legend.position ?? "bottom";
|
|
3965
4596
|
const providerTheme = useGlobalChartsTheme();
|
|
@@ -4014,6 +4645,23 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4014
4645
|
const allSeriesHidden = (0, react$1.useMemo)(() => {
|
|
4015
4646
|
return seriesWithVisibility.every(({ isVisible }) => !isVisible);
|
|
4016
4647
|
}, [seriesWithVisibility]);
|
|
4648
|
+
const stableYDomain = (0, react$1.useMemo)(() => {
|
|
4649
|
+
if (!legendInteractive || rescaleYOnVisibilityChange) return;
|
|
4650
|
+
let min = Infinity;
|
|
4651
|
+
let max = -Infinity;
|
|
4652
|
+
for (const series of dataSorted) for (const point of series.data ?? []) {
|
|
4653
|
+
const value = point?.value;
|
|
4654
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4655
|
+
min = Math.min(min, value);
|
|
4656
|
+
max = Math.max(max, value);
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
return min < max ? [min, max] : void 0;
|
|
4660
|
+
}, [
|
|
4661
|
+
legendInteractive,
|
|
4662
|
+
rescaleYOnVisibilityChange,
|
|
4663
|
+
dataSorted
|
|
4664
|
+
]);
|
|
4017
4665
|
const { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation({
|
|
4018
4666
|
selectedIndex,
|
|
4019
4667
|
setSelectedIndex,
|
|
@@ -4050,6 +4698,7 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4050
4698
|
type: "linear",
|
|
4051
4699
|
nice: true,
|
|
4052
4700
|
zero: false,
|
|
4701
|
+
...stableYDomain ? { domain: stableYDomain } : {},
|
|
4053
4702
|
...options?.yScale
|
|
4054
4703
|
}
|
|
4055
4704
|
};
|
|
@@ -4057,7 +4706,8 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4057
4706
|
options,
|
|
4058
4707
|
dataSorted,
|
|
4059
4708
|
width,
|
|
4060
|
-
zoom.domain
|
|
4709
|
+
zoom.domain,
|
|
4710
|
+
stableYDomain
|
|
4061
4711
|
]);
|
|
4062
4712
|
const tooltipRenderGlyph = (0, react$1.useMemo)(() => {
|
|
4063
4713
|
return (props) => {
|
|
@@ -4086,10 +4736,12 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4086
4736
|
legendItems: useChartLegendItems(dataSorted, (0, react$1.useMemo)(() => ({
|
|
4087
4737
|
withGlyph: withLegendGlyph,
|
|
4088
4738
|
glyphSize: Math.max(0, toNumber(glyphStyle?.radius) ?? 4),
|
|
4739
|
+
collapseGroups: legendCollapseGroups,
|
|
4089
4740
|
renderGlyph
|
|
4090
4741
|
}), [
|
|
4091
4742
|
withLegendGlyph,
|
|
4092
4743
|
glyphStyle?.radius,
|
|
4744
|
+
legendCollapseGroups,
|
|
4093
4745
|
renderGlyph
|
|
4094
4746
|
]), legendShape),
|
|
4095
4747
|
chartType: "line",
|
|
@@ -4179,12 +4831,12 @@ const LineChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4179
4831
|
onPointerOut,
|
|
4180
4832
|
pointerEventsDataKey: "nearest",
|
|
4181
4833
|
children: [
|
|
4182
|
-
gridVisibility !== "none" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
4834
|
+
!allSeriesHidden && gridVisibility !== "none" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
4183
4835
|
columns: false,
|
|
4184
4836
|
numTicks: 4
|
|
4185
4837
|
}),
|
|
4186
|
-
chartOptions.axis.x.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }),
|
|
4187
|
-
chartOptions.axis.y.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y }),
|
|
4838
|
+
!allSeriesHidden && chartOptions.axis.x.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }),
|
|
4839
|
+
!allSeriesHidden && chartOptions.axis.y.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y }),
|
|
4188
4840
|
allSeriesHidden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SvgEmptyState, {
|
|
4189
4841
|
x: width / 2,
|
|
4190
4842
|
y: chartHeight / 2,
|
|
@@ -4392,10 +5044,11 @@ const HoverGlyphs = ({ visibleSeries, stacked, stackOffset, getElementStyles, st
|
|
|
4392
5044
|
};
|
|
4393
5045
|
//#endregion
|
|
4394
5046
|
//#region src/charts/area-chart/area-chart.tsx
|
|
4395
|
-
const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, stacked = true, stackOffset = "none", smoothing = true, curveType, fillOpacity, withStroke, renderTooltip = renderDefaultTooltip, animation, options = {}, onPointerDown, onPointerUp, onPointerMove, onPointerOut, zoomable = false, rescaleYOnLegendToggle
|
|
5047
|
+
const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, stacked = true, stackOffset = "none", smoothing = true, curveType, fillOpacity, withStroke, renderTooltip = renderDefaultTooltip, animation, options = {}, onPointerDown, onPointerUp, onPointerMove, onPointerOut, zoomable = false, rescaleYOnVisibilityChange, rescaleYOnLegendToggle, children, gridVisibility, gap = "md" }, ref) => {
|
|
4396
5048
|
const legendInteractive = legend.interactive ?? false;
|
|
4397
5049
|
const legendShape = legend.shape ?? "rect";
|
|
4398
5050
|
const legendPosition = legend.position ?? "bottom";
|
|
5051
|
+
const rescaleYOnVisibility = rescaleYOnVisibilityChange ?? rescaleYOnLegendToggle ?? true;
|
|
4399
5052
|
const providerTheme = useGlobalChartsTheme();
|
|
4400
5053
|
const theme = useXYChartTheme(data);
|
|
4401
5054
|
const chartId = useChartId(providedChartId);
|
|
@@ -4454,7 +5107,7 @@ const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4454
5107
|
totalPoints: dataSorted[0]?.data.length || 0
|
|
4455
5108
|
});
|
|
4456
5109
|
const fixedYDomain = (0, react$1.useMemo)(() => {
|
|
4457
|
-
if (
|
|
5110
|
+
if (rescaleYOnVisibility || !legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") return;
|
|
4458
5111
|
if (stacked) {
|
|
4459
5112
|
const numPoints = Math.max(...dataSorted.map((s) => s.data.length));
|
|
4460
5113
|
let posMax = 0;
|
|
@@ -4489,7 +5142,7 @@ const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4489
5142
|
stacked,
|
|
4490
5143
|
stackOffset,
|
|
4491
5144
|
legendInteractive,
|
|
4492
|
-
|
|
5145
|
+
rescaleYOnVisibility
|
|
4493
5146
|
]);
|
|
4494
5147
|
const chartOptions = (0, react$1.useMemo)(() => {
|
|
4495
5148
|
const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);
|
|
@@ -4538,8 +5191,9 @@ const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4538
5191
|
chartId,
|
|
4539
5192
|
legendItems: useChartLegendItems(dataSorted, (0, react$1.useMemo)(() => ({
|
|
4540
5193
|
withGlyph: false,
|
|
4541
|
-
glyphSize: 0
|
|
4542
|
-
|
|
5194
|
+
glyphSize: 0,
|
|
5195
|
+
collapseGroups: legend.collapseGroups ?? false
|
|
5196
|
+
}), [legend.collapseGroups]), legendShape),
|
|
4543
5197
|
chartType: "area",
|
|
4544
5198
|
isDataValid,
|
|
4545
5199
|
metadata: (0, react$1.useMemo)(() => ({
|
|
@@ -4676,12 +5330,12 @@ const AreaChartInternal = (0, react$1.forwardRef)(({ data, chartId: providedChar
|
|
|
4676
5330
|
onPointerOut,
|
|
4677
5331
|
pointerEventsDataKey: "nearest",
|
|
4678
5332
|
children: [
|
|
4679
|
-
gridVisibility !== "none" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
5333
|
+
!allSeriesHidden && gridVisibility !== "none" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
4680
5334
|
columns: false,
|
|
4681
5335
|
numTicks: 4
|
|
4682
5336
|
}),
|
|
4683
|
-
chartOptions.axis.x.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }),
|
|
4684
|
-
chartOptions.axis.y.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y }),
|
|
5337
|
+
!allSeriesHidden && chartOptions.axis.x.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }),
|
|
5338
|
+
!allSeriesHidden && chartOptions.axis.y.display && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y }),
|
|
4685
5339
|
allSeriesHidden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SvgEmptyState, {
|
|
4686
5340
|
x: width / 2,
|
|
4687
5341
|
y: chartHeight / 2,
|
|
@@ -5150,6 +5804,7 @@ const renderTooltipRow = (label, value) => /* @__PURE__ */ (0, react_jsx_runtime
|
|
|
5150
5804
|
});
|
|
5151
5805
|
const BarChartInternal = ({ data, chartId: providedChartId, width, height, className, margin, withTooltips = false, showLegend = false, legend = {}, gridVisibility: gridVisibilityProp, renderTooltip, options = {}, orientation = "vertical", withPatterns = false, showZeroValues = false, animation, children, gap = "md" }) => {
|
|
5152
5806
|
const legendInteractive = legend.interactive ?? false;
|
|
5807
|
+
const legendCollapseGroups = legend.collapseGroups ?? false;
|
|
5153
5808
|
const horizontal = orientation === "horizontal";
|
|
5154
5809
|
const chartId = useChartId(providedChartId);
|
|
5155
5810
|
const theme = useXYChartTheme(data);
|
|
@@ -5158,7 +5813,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
|
|
|
5158
5813
|
enabled: showZeroValues,
|
|
5159
5814
|
valueAxisLength: horizontal ? width : height
|
|
5160
5815
|
});
|
|
5161
|
-
const legendItems = useChartLegendItems(dataSorted);
|
|
5816
|
+
const legendItems = useChartLegendItems(dataSorted, (0, react$1.useMemo)(() => ({ collapseGroups: legendCollapseGroups }), [legendCollapseGroups]));
|
|
5162
5817
|
const chartOptions = useBarChartOptions(dataWithVisibleZeros, horizontal, options);
|
|
5163
5818
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme, horizontal);
|
|
5164
5819
|
const chartRef = (0, react$1.useRef)(null);
|
|
@@ -5450,7 +6105,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
|
|
|
5450
6105
|
horizontal,
|
|
5451
6106
|
pointerEventsDataKey: "nearest",
|
|
5452
6107
|
children: [
|
|
5453
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
6108
|
+
!allSeriesHidden && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Grid, {
|
|
5454
6109
|
columns: gridVisibility.includes("y"),
|
|
5455
6110
|
rows: gridVisibility.includes("x"),
|
|
5456
6111
|
numTicks: 4
|
|
@@ -5490,8 +6145,7 @@ const BarChartInternal = ({ data, chartId: providedChartId, width, height, class
|
|
|
5490
6145
|
colorAccessor: getBarBackground(index)
|
|
5491
6146
|
}, seriesData?.label))
|
|
5492
6147
|
}),
|
|
5493
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }),
|
|
5494
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y }),
|
|
6148
|
+
!allSeriesHidden && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.x }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_visx_xychart.Axis, { ...chartOptions.axis.y })] }),
|
|
5495
6149
|
withTooltips && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccessibleTooltip, {
|
|
5496
6150
|
detectBounds: true,
|
|
5497
6151
|
snapTooltipToDatumX: true,
|
|
@@ -6427,9 +7081,9 @@ const HeatmapLegend = ({ steps = 5, lessLabel, moreLabel }) => {
|
|
|
6427
7081
|
"aria-hidden": "true",
|
|
6428
7082
|
className: heatmap_chart_module_default["heatmap-chart__legend-swatch"],
|
|
6429
7083
|
style: {
|
|
6430
|
-
"--heatmap-primary": primaryColorHex,
|
|
6431
|
-
"--heatmap-
|
|
6432
|
-
"--intensity": intensity
|
|
7084
|
+
"--a8c-charts-color-heatmap-primary": primaryColorHex,
|
|
7085
|
+
"--a8c-charts-color-heatmap-background": backgroundColor,
|
|
7086
|
+
"--a8c-charts-heatmap-cell-intensity": intensity
|
|
6433
7087
|
}
|
|
6434
7088
|
}, index);
|
|
6435
7089
|
})
|
|
@@ -6587,17 +7241,17 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
6587
7241
|
children: (0, _wordpress_i18n.__)("No data available", "jetpack-charts")
|
|
6588
7242
|
})
|
|
6589
7243
|
});
|
|
6590
|
-
const columnTrack = compact ? "var(--heatmap-cell-size)" : `minmax(${minCellWidth ?? 0}px, ${maxCellWidth ? `${maxCellWidth}px` : "1fr"})`;
|
|
6591
|
-
const rowTrack = compact ? "var(--heatmap-cell-size)" : `minmax(${minCellHeight ?? 0}px, ${maxCellHeight ? `${maxCellHeight}px` : "1fr"})`;
|
|
7244
|
+
const columnTrack = compact ? "var(--a8c-charts-dimension-heatmap-cell-size)" : `minmax(${minCellWidth ?? 0}px, ${maxCellWidth ? `${maxCellWidth}px` : "1fr"})`;
|
|
7245
|
+
const rowTrack = compact ? "var(--a8c-charts-dimension-heatmap-cell-size)" : `minmax(${minCellHeight ?? 0}px, ${maxCellHeight ? `${maxCellHeight}px` : "1fr"})`;
|
|
6592
7246
|
const gridStyle = {
|
|
6593
|
-
"--heatmap-primary": primaryColorHex,
|
|
6594
|
-
"--heatmap-
|
|
7247
|
+
"--a8c-charts-color-heatmap-primary": primaryColorHex,
|
|
7248
|
+
"--a8c-charts-color-heatmap-background": theme.backgroundColor,
|
|
6595
7249
|
gridTemplateColumns: `auto repeat(${columns}, ${columnTrack})`,
|
|
6596
7250
|
gridTemplateRows: `auto repeat(${rows}, ${rowTrack})`
|
|
6597
7251
|
};
|
|
6598
7252
|
if (compact) {
|
|
6599
|
-
gridStyle["--heatmap-cell-gap"] = `${compactCellGap}px`;
|
|
6600
|
-
gridStyle["--heatmap-cell-size"] = `${compactCellSize}px`;
|
|
7253
|
+
gridStyle["--a8c-charts-dimension-heatmap-cell-gap"] = `${compactCellGap}px`;
|
|
7254
|
+
gridStyle["--a8c-charts-dimension-heatmap-cell-size"] = `${compactCellSize}px`;
|
|
6601
7255
|
}
|
|
6602
7256
|
const activeDescendant = selectedIndex !== void 0 ? `${chartId}-cell-${Math.floor(selectedIndex / rows)}-${selectedIndex % rows}` : void 0;
|
|
6603
7257
|
const heightCapped = !compact && Boolean(maxCellHeight);
|
|
@@ -6674,7 +7328,7 @@ const HeatmapChartInternal = ({ data, chartId: providedChartId, width = 0, heigh
|
|
|
6674
7328
|
[heatmap_chart_module_default["heatmap-chart__cell--strong"]]: present && cellHasLightText(normalized),
|
|
6675
7329
|
[heatmap_chart_module_default["heatmap-chart__cell--selected"]]: selectedIndex === flatIndex
|
|
6676
7330
|
}),
|
|
6677
|
-
style: present ? { "--intensity": normalized } : void 0,
|
|
7331
|
+
style: present ? { "--a8c-charts-heatmap-cell-intensity": normalized } : void 0,
|
|
6678
7332
|
onMouseMove: handleCellMouseMove,
|
|
6679
7333
|
onMouseLeave: handleCellMouseLeave,
|
|
6680
7334
|
children: drawValues && present && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -9007,6 +9661,90 @@ function UnconnectedGrid(props, forwardedRef) {
|
|
|
9007
9661
|
}
|
|
9008
9662
|
var component_default = contextConnect(UnconnectedGrid, "Grid");
|
|
9009
9663
|
//#endregion
|
|
9664
|
+
//#region src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts
|
|
9665
|
+
/**
|
|
9666
|
+
* Fractional layout rounding can put a row's bottom a hair past the container's
|
|
9667
|
+
* without any visible clipping. Allow that much slack before hiding a row.
|
|
9668
|
+
*
|
|
9669
|
+
* Exported so tests and stories assert against the real tolerance rather than
|
|
9670
|
+
* restating it.
|
|
9671
|
+
*/
|
|
9672
|
+
const SUBPIXEL_TOLERANCE = .5;
|
|
9673
|
+
/**
|
|
9674
|
+
* Counts how many leading rows fit inside the content container.
|
|
9675
|
+
*
|
|
9676
|
+
* Rows are read from the DOM rather than derived from constants: row height
|
|
9677
|
+
* depends on the theme's row gap, label wrapping, and whatever a caller renders
|
|
9678
|
+
* as a label, so any restated number would drift.
|
|
9679
|
+
*
|
|
9680
|
+
* Every row is a direct grid child marked with `data-row-index`; interactive rows
|
|
9681
|
+
* use a button wrapper and non-interactive rows use a div wrapper.
|
|
9682
|
+
*
|
|
9683
|
+
* @param enabled - Whether to measure at all. When false every row fits.
|
|
9684
|
+
* @param rowCount - Total number of rows rendered.
|
|
9685
|
+
* @param data - Rendered row data, whose geometry may change without changing the count.
|
|
9686
|
+
* @return Ref for the content container and the number of leading rows that fit.
|
|
9687
|
+
*/
|
|
9688
|
+
function useFittedRowCount(enabled, rowCount, data) {
|
|
9689
|
+
const contentRef = (0, react$1.useRef)(null);
|
|
9690
|
+
const [fittedCount, setFittedCount] = (0, react$1.useState)(rowCount);
|
|
9691
|
+
const [isMeasurable, setIsMeasurable] = (0, react$1.useState)(true);
|
|
9692
|
+
const measure = (0, react$1.useCallback)(() => {
|
|
9693
|
+
const content = contentRef.current;
|
|
9694
|
+
if (!content) return;
|
|
9695
|
+
content.scrollTop = 0;
|
|
9696
|
+
const rows = content.querySelectorAll(":scope > [data-leaderboard-grid] > [data-row-index]");
|
|
9697
|
+
const rowBottoms = [];
|
|
9698
|
+
rows.forEach((row) => {
|
|
9699
|
+
const index = Number(row.getAttribute("data-row-index"));
|
|
9700
|
+
if (!Number.isInteger(index) || index < 0 || index >= rowCount) return;
|
|
9701
|
+
const { bottom } = row.getBoundingClientRect();
|
|
9702
|
+
rowBottoms[index] = Math.max(rowBottoms[index] ?? -Infinity, bottom);
|
|
9703
|
+
});
|
|
9704
|
+
if (rowBottoms.length === 0) {
|
|
9705
|
+
setIsMeasurable(false);
|
|
9706
|
+
setFittedCount(rowCount);
|
|
9707
|
+
return;
|
|
9708
|
+
}
|
|
9709
|
+
setIsMeasurable(true);
|
|
9710
|
+
const contentBottom = content.getBoundingClientRect().bottom + SUBPIXEL_TOLERANCE;
|
|
9711
|
+
let fits = 0;
|
|
9712
|
+
while (fits < rowBottoms.length && rowBottoms[fits] <= contentBottom) fits++;
|
|
9713
|
+
setFittedCount((current) => current === fits ? current : fits);
|
|
9714
|
+
}, [rowCount]);
|
|
9715
|
+
(0, react$1.useLayoutEffect)(() => {
|
|
9716
|
+
if (!enabled) {
|
|
9717
|
+
setFittedCount(rowCount);
|
|
9718
|
+
return;
|
|
9719
|
+
}
|
|
9720
|
+
measure();
|
|
9721
|
+
}, [
|
|
9722
|
+
enabled,
|
|
9723
|
+
rowCount,
|
|
9724
|
+
data,
|
|
9725
|
+
measure
|
|
9726
|
+
]);
|
|
9727
|
+
(0, react$1.useLayoutEffect)(() => {
|
|
9728
|
+
if (!enabled) return;
|
|
9729
|
+
const content = contentRef.current;
|
|
9730
|
+
if (!content) return;
|
|
9731
|
+
const observer = new ResizeObserver(measure);
|
|
9732
|
+
observer.observe(content);
|
|
9733
|
+
const grid = content.querySelector(":scope > [data-leaderboard-grid]");
|
|
9734
|
+
if (grid) observer.observe(grid);
|
|
9735
|
+
return () => observer.disconnect();
|
|
9736
|
+
}, [
|
|
9737
|
+
enabled,
|
|
9738
|
+
rowCount,
|
|
9739
|
+
measure
|
|
9740
|
+
]);
|
|
9741
|
+
return {
|
|
9742
|
+
contentRef,
|
|
9743
|
+
fittedCount: enabled ? fittedCount : rowCount,
|
|
9744
|
+
isMeasurable
|
|
9745
|
+
};
|
|
9746
|
+
}
|
|
9747
|
+
//#endregion
|
|
9010
9748
|
//#region src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts
|
|
9011
9749
|
/**
|
|
9012
9750
|
* Hook to create legend items from leaderboard data
|
|
@@ -9067,11 +9805,13 @@ var leaderboard_chart_module_default = {
|
|
|
9067
9805
|
"deltaPlaceholder": "a8ccharts-GovfoW-deltaPlaceholder",
|
|
9068
9806
|
"deltaValue": "a8ccharts-GovfoW-deltaValue",
|
|
9069
9807
|
"emptyState": "a8ccharts-GovfoW-emptyState",
|
|
9808
|
+
"fitEmptyState": "a8ccharts-GovfoW-fitEmptyState",
|
|
9070
9809
|
"interactiveRow": "a8ccharts-GovfoW-interactiveRow",
|
|
9071
9810
|
"is-overlay": "a8ccharts-GovfoW-is-overlay",
|
|
9072
9811
|
"label": "a8ccharts-GovfoW-label",
|
|
9073
9812
|
"leaderboardChart": "a8ccharts-GovfoW-leaderboardChart",
|
|
9074
9813
|
"leaderboardChart__content": "a8ccharts-GovfoW-leaderboardChart__content",
|
|
9814
|
+
"leaderboardChart__content--fit": "a8ccharts-GovfoW-leaderboardChart__content--fit",
|
|
9075
9815
|
"leaderboardChart--loading": "a8ccharts-GovfoW-leaderboardChart--loading",
|
|
9076
9816
|
"leaderboardChart--responsive": "a8ccharts-GovfoW-leaderboardChart--responsive",
|
|
9077
9817
|
"overlap": "a8ccharts-GovfoW-overlap",
|
|
@@ -9116,8 +9856,9 @@ const defaultDeltaFormatter = (value) => {
|
|
|
9116
9856
|
* @param share - The bar's share of the row width, as a percentage.
|
|
9117
9857
|
* @return A CSS width value.
|
|
9118
9858
|
*/
|
|
9119
|
-
const getBarWidth = (share) => `calc(${share}% - var(--a8c
|
|
9120
|
-
const
|
|
9859
|
+
const getBarWidth = (share) => `calc(${share}% - var(--a8c-charts-dimension-leaderboard-bar-hover-inset, 0px) * ${share} / 100)`;
|
|
9860
|
+
const hasPreviousValue = (entry) => entry.previousValue != null && entry.previousShare != null;
|
|
9861
|
+
const hasDeltaValue = (entry) => hasPreviousValue(entry) && entry.delta != null;
|
|
9121
9862
|
const BarLabel = ({ label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: typeof label === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$2, {
|
|
9122
9863
|
className: leaderboard_chart_module_default.label,
|
|
9123
9864
|
children: label
|
|
@@ -9135,7 +9876,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
|
|
|
9135
9876
|
backgroundColor: primaryColor
|
|
9136
9877
|
}
|
|
9137
9878
|
}),
|
|
9138
|
-
showComparisonBar &&
|
|
9879
|
+
showComparisonBar && hasPreviousValue(entry) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9139
9880
|
className: (0, clsx.default)(leaderboard_chart_module_default.bar, { [leaderboard_chart_module_default["bar--animated"]]: animation }),
|
|
9140
9881
|
style: {
|
|
9141
9882
|
width: getBarWidth(entry.previousShare),
|
|
@@ -9161,6 +9902,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
|
|
|
9161
9902
|
* @param props.valueFormatter - Custom formatter for values
|
|
9162
9903
|
* @param props.deltaFormatter - Custom formatter for delta values
|
|
9163
9904
|
* @param props.loading - Whether the chart is in loading state
|
|
9905
|
+
* @param props.fitRows - Whether to show only the rows that fit the chart's height
|
|
9164
9906
|
* @param props.animation - Whether the chart should animate on load
|
|
9165
9907
|
* @param props.showLegend - Whether to show legend
|
|
9166
9908
|
* @param props.legend - Legend configuration (orientation, position, alignment, shape, shapeStyles, interactive)
|
|
@@ -9171,7 +9913,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
|
|
|
9171
9913
|
* @param props.style - Custom styling for the chart container
|
|
9172
9914
|
* @return JSX element representing the leaderboard chart
|
|
9173
9915
|
*/
|
|
9174
|
-
const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, showLegend = false, legend = {}, legendLabels, gap = "md", className, style, children }) => {
|
|
9916
|
+
const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, fitRows = false, showLegend = false, legend = {}, legendLabels, gap = "md", className, style, children }) => {
|
|
9175
9917
|
const legendInteractive = legend.interactive ?? false;
|
|
9176
9918
|
const legendPosition = legend.position ?? "bottom";
|
|
9177
9919
|
const chartId = useChartId(providedChartId);
|
|
@@ -9240,6 +9982,8 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
9240
9982
|
}), [withComparison, withOverlayLabel])
|
|
9241
9983
|
});
|
|
9242
9984
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
9985
|
+
const { contentRef, fittedCount, isMeasurable } = useFittedRowCount(fitRows && !allSeriesHidden, data?.length ?? 0, data);
|
|
9986
|
+
const shouldFitRows = fitRows && isMeasurable;
|
|
9243
9987
|
if (!data || data.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SingleChartContext.Provider, {
|
|
9244
9988
|
value: { chartId },
|
|
9245
9989
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChartLayout, {
|
|
@@ -9292,20 +10036,27 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
9292
10036
|
height: propHeight || void 0
|
|
9293
10037
|
},
|
|
9294
10038
|
trailingContent: nonLegendChildren,
|
|
9295
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
9296
|
-
|
|
9297
|
-
|
|
10039
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10040
|
+
ref: contentRef,
|
|
10041
|
+
className: (0, clsx.default)(leaderboard_chart_module_default.leaderboardChart__content, { [leaderboard_chart_module_default["leaderboardChart__content--fit"]]: shouldFitRows }),
|
|
10042
|
+
children: [shouldFitRows && fittedCount === 0 && !allSeriesHidden && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10043
|
+
className: (0, clsx.default)(leaderboard_chart_module_default.emptyState, leaderboard_chart_module_default.fitEmptyState),
|
|
10044
|
+
children: (0, _wordpress_i18n.__)("Not enough space to display data", "jetpack-charts")
|
|
10045
|
+
}), allSeriesHidden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9298
10046
|
className: leaderboard_chart_module_default.emptyState,
|
|
9299
10047
|
children: (0, _wordpress_i18n.__)("All series are hidden. Click legend items to show data.", "jetpack-charts")
|
|
9300
10048
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default, {
|
|
9301
10049
|
templateColumns: "minmax(0, 1fr) auto",
|
|
9302
10050
|
rowGap,
|
|
9303
10051
|
columnGap,
|
|
9304
|
-
|
|
10052
|
+
"data-leaderboard-grid": true,
|
|
10053
|
+
children: data.map((entry, rowIndex) => {
|
|
10054
|
+
const rowStyle = shouldFitRows && rowIndex >= fittedCount ? { visibility: "hidden" } : void 0;
|
|
9305
10055
|
const showComparisonColumn = withComparison && isComparisonVisible;
|
|
9306
|
-
const
|
|
9307
|
-
const
|
|
9308
|
-
const
|
|
10056
|
+
const hasPreviousPeriodValue = hasPreviousValue(entry);
|
|
10057
|
+
const hasDelta = hasDeltaValue(entry);
|
|
10058
|
+
const showComparisonValue = showComparisonColumn && hasDelta;
|
|
10059
|
+
const showComparisonPlaceholder = showComparisonColumn && !hasDelta;
|
|
9309
10060
|
const colorIndex = showComparisonValue ? Math.sign(entry.delta) + 1 : 1;
|
|
9310
10061
|
const deltaColor = deltaColors[colorIndex];
|
|
9311
10062
|
const rowCells = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Stack, {
|
|
@@ -9337,16 +10088,18 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
9337
10088
|
style: { color: deltaColor },
|
|
9338
10089
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9339
10090
|
"aria-hidden": "true",
|
|
9340
|
-
children: "
|
|
10091
|
+
children: "—"
|
|
9341
10092
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(component_default$1, {
|
|
9342
10093
|
as: "span",
|
|
9343
|
-
children: (0, _wordpress_i18n.__)("No comparison data", "jetpack-charts")
|
|
10094
|
+
children: hasPreviousPeriodValue ? (0, _wordpress_i18n.__)("Percentage change unavailable", "jetpack-charts") : (0, _wordpress_i18n.__)("No comparison data", "jetpack-charts")
|
|
9344
10095
|
})]
|
|
9345
10096
|
})
|
|
9346
10097
|
]
|
|
9347
10098
|
})] });
|
|
9348
10099
|
if (entry.onClick) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
9349
10100
|
type: "button",
|
|
10101
|
+
"data-row-index": rowIndex,
|
|
10102
|
+
style: rowStyle,
|
|
9350
10103
|
className: (0, clsx.default)(leaderboard_chart_module_default.row, leaderboard_chart_module_default.interactiveRow),
|
|
9351
10104
|
onClick: entry.onClick,
|
|
9352
10105
|
"aria-label": entry.ariaLabel,
|
|
@@ -9357,11 +10110,13 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
9357
10110
|
})]
|
|
9358
10111
|
}, entry.id);
|
|
9359
10112
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10113
|
+
"data-row-index": rowIndex,
|
|
10114
|
+
style: rowStyle,
|
|
9360
10115
|
className: leaderboard_chart_module_default.row,
|
|
9361
10116
|
children: rowCells
|
|
9362
10117
|
}, entry.id);
|
|
9363
10118
|
})
|
|
9364
|
-
})
|
|
10119
|
+
})]
|
|
9365
10120
|
})
|
|
9366
10121
|
})
|
|
9367
10122
|
});
|