@automattic/charts 1.4.3 → 1.5.1
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 +15 -0
- package/SECURITY.md +0 -1
- package/dist/index.cjs +544 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +38 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +839 -490
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/charts/area-chart/area-chart.tsx +39 -21
- package/src/charts/area-chart/test/area-chart.test.tsx +83 -3
- package/src/charts/area-chart/types.ts +15 -0
- package/src/charts/line-chart/line-chart.tsx +102 -84
- package/src/charts/line-chart/test/line-chart.test.tsx +41 -0
- package/src/charts/line-chart/types.ts +6 -0
- package/src/charts/private/test/x-zoom.test.tsx +142 -0
- package/src/charts/private/x-zoom.module.scss +45 -0
- package/src/charts/private/x-zoom.tsx +209 -0
- package/src/types.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2112,20 +2112,94 @@ function useRender(params) {
|
|
|
2112
2112
|
return useRenderElement(_nullishCoalesce(params.defaultTagName, () => ( "div")), params, params);
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
|
-
// ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2115
|
+
// ../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/text/text.mjs
|
|
2116
|
+
|
|
2117
|
+
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
2118
|
+
function getRuntime() {
|
|
2119
|
+
const globalScope = globalThis;
|
|
2120
|
+
if (globalScope.__wpStyleRuntime) {
|
|
2121
|
+
return globalScope.__wpStyleRuntime;
|
|
2122
|
+
}
|
|
2123
|
+
globalScope.__wpStyleRuntime = {
|
|
2124
|
+
documents: /* @__PURE__ */ new Map(),
|
|
2125
|
+
styles: /* @__PURE__ */ new Map(),
|
|
2126
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
2127
|
+
};
|
|
2128
|
+
if (typeof document !== "undefined") {
|
|
2129
|
+
registerDocument(document);
|
|
2130
|
+
}
|
|
2131
|
+
return globalScope.__wpStyleRuntime;
|
|
2132
|
+
}
|
|
2133
|
+
function documentContainsStyleHash(targetDocument, hash2) {
|
|
2134
|
+
if (!targetDocument.head) {
|
|
2135
|
+
return false;
|
|
2136
|
+
}
|
|
2137
|
+
for (const style of targetDocument.head.querySelectorAll(
|
|
2138
|
+
`style[${STYLE_HASH_ATTRIBUTE}]`
|
|
2139
|
+
)) {
|
|
2140
|
+
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash2) {
|
|
2141
|
+
return true;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
return false;
|
|
2145
|
+
}
|
|
2146
|
+
function injectStyle(targetDocument, hash2, css3) {
|
|
2147
|
+
if (!targetDocument.head) {
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
const runtime = getRuntime();
|
|
2151
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
2152
|
+
if (!injectedStyles) {
|
|
2153
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
2154
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
2155
|
+
}
|
|
2156
|
+
if (injectedStyles.has(hash2)) {
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
if (documentContainsStyleHash(targetDocument, hash2)) {
|
|
2160
|
+
injectedStyles.add(hash2);
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
const style = targetDocument.createElement("style");
|
|
2164
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash2);
|
|
2165
|
+
style.appendChild(targetDocument.createTextNode(css3));
|
|
2166
|
+
targetDocument.head.appendChild(style);
|
|
2167
|
+
injectedStyles.add(hash2);
|
|
2168
|
+
}
|
|
2169
|
+
function registerDocument(targetDocument) {
|
|
2170
|
+
const runtime = getRuntime();
|
|
2171
|
+
runtime.documents.set(
|
|
2172
|
+
targetDocument,
|
|
2173
|
+
(_nullishCoalesce(runtime.documents.get(targetDocument), () => ( 0))) + 1
|
|
2174
|
+
);
|
|
2175
|
+
for (const [hash2, css3] of runtime.styles) {
|
|
2176
|
+
injectStyle(targetDocument, hash2, css3);
|
|
2177
|
+
}
|
|
2178
|
+
return () => {
|
|
2179
|
+
const count = runtime.documents.get(targetDocument);
|
|
2180
|
+
if (count === void 0) {
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
if (count <= 1) {
|
|
2184
|
+
runtime.documents.delete(targetDocument);
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
function registerStyle(hash2, css3) {
|
|
2191
|
+
const runtime = getRuntime();
|
|
2192
|
+
runtime.styles.set(hash2, css3);
|
|
2193
|
+
for (const targetDocument of runtime.documents.keys()) {
|
|
2194
|
+
injectStyle(targetDocument, hash2, css3);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
2198
|
+
registerStyle("0c8601dd83", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-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)}}');
|
|
2122
2199
|
}
|
|
2123
2200
|
var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
|
|
2124
|
-
if (typeof
|
|
2125
|
-
|
|
2126
|
-
style.setAttribute("data-wp-hash", "1fb29d3a3c");
|
|
2127
|
-
style.appendChild(document.createTextNode("._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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-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 #0000);transition:var(--_gcd-a-transition,none)}"));
|
|
2128
|
-
document.head.appendChild(style);
|
|
2201
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
2202
|
+
registerStyle("1fb29d3a3c", "._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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-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 #0000);transition:var(--_gcd-a-transition,none)}");
|
|
2129
2203
|
}
|
|
2130
2204
|
var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
|
|
2131
2205
|
var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md", render, className, ...props }, ref) {
|
|
@@ -2136,8 +2210,8 @@ var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md",
|
|
|
2136
2210
|
props: mergeProps(props, {
|
|
2137
2211
|
className: _clsx2.default.call(void 0,
|
|
2138
2212
|
style_default.text,
|
|
2139
|
-
|
|
2140
|
-
|
|
2213
|
+
global_css_defense_default.heading,
|
|
2214
|
+
global_css_defense_default.p,
|
|
2141
2215
|
style_default[variant],
|
|
2142
2216
|
className
|
|
2143
2217
|
)
|
|
@@ -2146,12 +2220,89 @@ var Text = _react.forwardRef.call(void 0, function Text2({ variant = "body-md",
|
|
|
2146
2220
|
return element;
|
|
2147
2221
|
});
|
|
2148
2222
|
|
|
2149
|
-
// ../../../node_modules/.pnpm/@wordpress+ui@0.
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2223
|
+
// ../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/stack/stack.mjs
|
|
2224
|
+
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
|
|
2225
|
+
function getRuntime2() {
|
|
2226
|
+
const globalScope = globalThis;
|
|
2227
|
+
if (globalScope.__wpStyleRuntime) {
|
|
2228
|
+
return globalScope.__wpStyleRuntime;
|
|
2229
|
+
}
|
|
2230
|
+
globalScope.__wpStyleRuntime = {
|
|
2231
|
+
documents: /* @__PURE__ */ new Map(),
|
|
2232
|
+
styles: /* @__PURE__ */ new Map(),
|
|
2233
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
2234
|
+
};
|
|
2235
|
+
if (typeof document !== "undefined") {
|
|
2236
|
+
registerDocument2(document);
|
|
2237
|
+
}
|
|
2238
|
+
return globalScope.__wpStyleRuntime;
|
|
2239
|
+
}
|
|
2240
|
+
function documentContainsStyleHash2(targetDocument, hash2) {
|
|
2241
|
+
if (!targetDocument.head) {
|
|
2242
|
+
return false;
|
|
2243
|
+
}
|
|
2244
|
+
for (const style of targetDocument.head.querySelectorAll(
|
|
2245
|
+
`style[${STYLE_HASH_ATTRIBUTE2}]`
|
|
2246
|
+
)) {
|
|
2247
|
+
if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash2) {
|
|
2248
|
+
return true;
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
return false;
|
|
2252
|
+
}
|
|
2253
|
+
function injectStyle2(targetDocument, hash2, css3) {
|
|
2254
|
+
if (!targetDocument.head) {
|
|
2255
|
+
return;
|
|
2256
|
+
}
|
|
2257
|
+
const runtime = getRuntime2();
|
|
2258
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
2259
|
+
if (!injectedStyles) {
|
|
2260
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
2261
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
2262
|
+
}
|
|
2263
|
+
if (injectedStyles.has(hash2)) {
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2266
|
+
if (documentContainsStyleHash2(targetDocument, hash2)) {
|
|
2267
|
+
injectedStyles.add(hash2);
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
const style = targetDocument.createElement("style");
|
|
2271
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash2);
|
|
2272
|
+
style.appendChild(targetDocument.createTextNode(css3));
|
|
2273
|
+
targetDocument.head.appendChild(style);
|
|
2274
|
+
injectedStyles.add(hash2);
|
|
2275
|
+
}
|
|
2276
|
+
function registerDocument2(targetDocument) {
|
|
2277
|
+
const runtime = getRuntime2();
|
|
2278
|
+
runtime.documents.set(
|
|
2279
|
+
targetDocument,
|
|
2280
|
+
(_nullishCoalesce(runtime.documents.get(targetDocument), () => ( 0))) + 1
|
|
2281
|
+
);
|
|
2282
|
+
for (const [hash2, css3] of runtime.styles) {
|
|
2283
|
+
injectStyle2(targetDocument, hash2, css3);
|
|
2284
|
+
}
|
|
2285
|
+
return () => {
|
|
2286
|
+
const count = runtime.documents.get(targetDocument);
|
|
2287
|
+
if (count === void 0) {
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2290
|
+
if (count <= 1) {
|
|
2291
|
+
runtime.documents.delete(targetDocument);
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
2294
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
function registerStyle2(hash2, css3) {
|
|
2298
|
+
const runtime = getRuntime2();
|
|
2299
|
+
runtime.styles.set(hash2, css3);
|
|
2300
|
+
for (const targetDocument of runtime.documents.keys()) {
|
|
2301
|
+
injectStyle2(targetDocument, hash2, css3);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
2305
|
+
registerStyle2("b51ff41489", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}");
|
|
2155
2306
|
}
|
|
2156
2307
|
var style_default2 = { "stack": "_19ce0419607e1896__stack" };
|
|
2157
2308
|
var gapTokens = {
|
|
@@ -3079,6 +3230,155 @@ function withResponsive(WrappedComponent) {
|
|
|
3079
3230
|
};
|
|
3080
3231
|
}
|
|
3081
3232
|
|
|
3233
|
+
// src/charts/private/x-zoom.tsx
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
|
|
3237
|
+
|
|
3238
|
+
// src/charts/private/x-zoom.module.scss
|
|
3239
|
+
var x_zoom_module_default = {
|
|
3240
|
+
"x-zoom__selection": "a8ccharts-KeNSrO",
|
|
3241
|
+
"x-zoom__reset": "a8ccharts-gg6Kte",
|
|
3242
|
+
"x-zoom__reset-icon": "a8ccharts-bQEoeo"
|
|
3243
|
+
};
|
|
3244
|
+
|
|
3245
|
+
// src/charts/private/x-zoom.tsx
|
|
3246
|
+
|
|
3247
|
+
var MIN_DRAG_PIXELS = 6;
|
|
3248
|
+
function useXZoom({
|
|
3249
|
+
enabled,
|
|
3250
|
+
chartRef,
|
|
3251
|
+
userHandlers
|
|
3252
|
+
}) {
|
|
3253
|
+
const [domain, setDomain] = _react.useState.call(void 0, null);
|
|
3254
|
+
const [drag, setDrag] = _react.useState.call(void 0, null);
|
|
3255
|
+
const reset = _react.useCallback.call(void 0, () => setDomain(null), []);
|
|
3256
|
+
const onPointerDown = _react.useCallback.call(void 0, (params) => {
|
|
3257
|
+
_optionalChain([userHandlers, 'optionalAccess', _140 => _140.onPointerDown, 'optionalCall', _141 => _141(params)]);
|
|
3258
|
+
if (!enabled || !params.svgPoint) return;
|
|
3259
|
+
setDrag({
|
|
3260
|
+
a: params.svgPoint.x,
|
|
3261
|
+
b: params.svgPoint.x
|
|
3262
|
+
});
|
|
3263
|
+
}, [enabled, userHandlers]);
|
|
3264
|
+
const onPointerMove = _react.useCallback.call(void 0, (params) => {
|
|
3265
|
+
_optionalChain([userHandlers, 'optionalAccess', _142 => _142.onPointerMove, 'optionalCall', _143 => _143(params)]);
|
|
3266
|
+
if (!enabled || !params.svgPoint) return;
|
|
3267
|
+
setDrag((current) => current ? {
|
|
3268
|
+
a: current.a,
|
|
3269
|
+
b: params.svgPoint.x
|
|
3270
|
+
} : current);
|
|
3271
|
+
}, [enabled, userHandlers]);
|
|
3272
|
+
const onPointerUp = _react.useCallback.call(void 0, (params) => {
|
|
3273
|
+
_optionalChain([userHandlers, 'optionalAccess', _144 => _144.onPointerUp, 'optionalCall', _145 => _145(params)]);
|
|
3274
|
+
if (!enabled) return;
|
|
3275
|
+
const finalDrag = drag;
|
|
3276
|
+
setDrag(null);
|
|
3277
|
+
if (!finalDrag) return;
|
|
3278
|
+
const lo = Math.min(finalDrag.a, finalDrag.b);
|
|
3279
|
+
const hi = Math.max(finalDrag.a, finalDrag.b);
|
|
3280
|
+
if (hi - lo < MIN_DRAG_PIXELS) return;
|
|
3281
|
+
const xScale = _optionalChain([chartRef, 'access', _146 => _146.current, 'optionalAccess', _147 => _147.getScales, 'call', _148 => _148(), 'optionalAccess', _149 => _149.xScale]);
|
|
3282
|
+
if (!xScale || typeof xScale.invert !== "function") return;
|
|
3283
|
+
setDomain([xScale.invert(lo), xScale.invert(hi)]);
|
|
3284
|
+
}, [enabled, drag, chartRef, userHandlers]);
|
|
3285
|
+
return _react.useMemo.call(void 0, () => ({
|
|
3286
|
+
domain,
|
|
3287
|
+
drag,
|
|
3288
|
+
reset,
|
|
3289
|
+
handlers: {
|
|
3290
|
+
onPointerDown,
|
|
3291
|
+
onPointerMove,
|
|
3292
|
+
onPointerUp
|
|
3293
|
+
}
|
|
3294
|
+
}), [domain, drag, reset, onPointerDown, onPointerMove, onPointerUp]);
|
|
3295
|
+
}
|
|
3296
|
+
function ZoomSelectionRect({
|
|
3297
|
+
drag
|
|
3298
|
+
}) {
|
|
3299
|
+
const {
|
|
3300
|
+
margin,
|
|
3301
|
+
innerHeight
|
|
3302
|
+
} = _react.useContext.call(void 0, _xychart.DataContext);
|
|
3303
|
+
if (!drag || drag.a === drag.b) return null;
|
|
3304
|
+
const x = Math.min(drag.a, drag.b);
|
|
3305
|
+
const w = Math.abs(drag.b - drag.a);
|
|
3306
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", {
|
|
3307
|
+
className: x_zoom_module_default["x-zoom__selection"],
|
|
3308
|
+
x,
|
|
3309
|
+
y: _nullishCoalesce(_optionalChain([margin, 'optionalAccess', _150 => _150.top]), () => ( 0)),
|
|
3310
|
+
width: w,
|
|
3311
|
+
height: _nullishCoalesce(innerHeight, () => ( 0))
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
function ZoomClip({
|
|
3315
|
+
active,
|
|
3316
|
+
chartId,
|
|
3317
|
+
children
|
|
3318
|
+
}) {
|
|
3319
|
+
const {
|
|
3320
|
+
margin,
|
|
3321
|
+
innerWidth,
|
|
3322
|
+
innerHeight
|
|
3323
|
+
} = _react.useContext.call(void 0, _xychart.DataContext);
|
|
3324
|
+
const id = `chart-zoom-clip-${String(_nullishCoalesce(chartId, () => ( ""))).replace(/[^A-Za-z0-9_-]/g, "")}`;
|
|
3325
|
+
const clip = active && (_nullishCoalesce(innerWidth, () => ( 0))) > 0 && (_nullishCoalesce(innerHeight, () => ( 0))) > 0;
|
|
3326
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
|
|
3327
|
+
children: [clip && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "defs", {
|
|
3328
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "clipPath", {
|
|
3329
|
+
id,
|
|
3330
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", {
|
|
3331
|
+
x: _nullishCoalesce(_optionalChain([margin, 'optionalAccess', _151 => _151.left]), () => ( 0)),
|
|
3332
|
+
y: _nullishCoalesce(_optionalChain([margin, 'optionalAccess', _152 => _152.top]), () => ( 0)),
|
|
3333
|
+
width: innerWidth,
|
|
3334
|
+
height: innerHeight
|
|
3335
|
+
})
|
|
3336
|
+
})
|
|
3337
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "g", {
|
|
3338
|
+
clipPath: clip ? `url(#${id})` : void 0,
|
|
3339
|
+
children
|
|
3340
|
+
})]
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
function ZoomResetButton({
|
|
3344
|
+
onClick
|
|
3345
|
+
}) {
|
|
3346
|
+
const label = _i18n.__.call(void 0, "Reset zoom", "jetpack-charts");
|
|
3347
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", {
|
|
3348
|
+
type: "button",
|
|
3349
|
+
className: x_zoom_module_default["x-zoom__reset"],
|
|
3350
|
+
onClick,
|
|
3351
|
+
"aria-label": label,
|
|
3352
|
+
title: label,
|
|
3353
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", {
|
|
3354
|
+
className: x_zoom_module_default["x-zoom__reset-icon"],
|
|
3355
|
+
viewBox: "0 0 24 24",
|
|
3356
|
+
fill: "none",
|
|
3357
|
+
stroke: "currentColor",
|
|
3358
|
+
strokeWidth: "2",
|
|
3359
|
+
strokeLinecap: "round",
|
|
3360
|
+
strokeLinejoin: "round",
|
|
3361
|
+
"aria-hidden": "true",
|
|
3362
|
+
focusable: "false",
|
|
3363
|
+
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", {
|
|
3364
|
+
cx: "10",
|
|
3365
|
+
cy: "10",
|
|
3366
|
+
r: "6"
|
|
3367
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "line", {
|
|
3368
|
+
x1: "15",
|
|
3369
|
+
y1: "15",
|
|
3370
|
+
x2: "20",
|
|
3371
|
+
y2: "20"
|
|
3372
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "line", {
|
|
3373
|
+
x1: "7",
|
|
3374
|
+
y1: "10",
|
|
3375
|
+
x2: "13",
|
|
3376
|
+
y2: "10"
|
|
3377
|
+
})]
|
|
3378
|
+
})
|
|
3379
|
+
});
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3082
3382
|
// src/charts/line-chart/line-chart.module.scss
|
|
3083
3383
|
var line_chart_module_default = {
|
|
3084
3384
|
"line-chart": "a8ccharts-v-oO8E",
|
|
@@ -3209,7 +3509,7 @@ var LineChartAnnotationsOverlay = ({
|
|
|
3209
3509
|
return `${xDomain.join(",")}-${yDomain.join(",")}-${xRange.join(",")}-${yRange.join(",")}`;
|
|
3210
3510
|
}, []);
|
|
3211
3511
|
const getScalesData = _react.useCallback.call(void 0, () => {
|
|
3212
|
-
if (_optionalChain([chartRef, 'optionalAccess',
|
|
3512
|
+
if (_optionalChain([chartRef, 'optionalAccess', _153 => _153.current])) {
|
|
3213
3513
|
const scaleData = chartRef.current.getScales();
|
|
3214
3514
|
if (scaleData) {
|
|
3215
3515
|
const scaleInfo = {
|
|
@@ -3386,7 +3686,7 @@ var LineChartAnnotation = ({
|
|
|
3386
3686
|
const [height, setHeight] = _react.useState.call(void 0, null);
|
|
3387
3687
|
const styles = _deepmerge2.default.call(void 0, _nullishCoalesce(providerTheme.annotationStyles, () => ( {})), _nullishCoalesce(datumStyles, () => ( {})));
|
|
3388
3688
|
_react.useEffect.call(void 0, () => {
|
|
3389
|
-
if (_optionalChain([labelRef, 'access',
|
|
3689
|
+
if (_optionalChain([labelRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.getBBox])) {
|
|
3390
3690
|
const bbox = labelRef.current.getBBox();
|
|
3391
3691
|
setHeight(bbox.height);
|
|
3392
3692
|
}
|
|
@@ -3419,7 +3719,7 @@ var LineChartAnnotation = ({
|
|
|
3419
3719
|
y: y2,
|
|
3420
3720
|
yMin: yMin2,
|
|
3421
3721
|
yMax: yMax2,
|
|
3422
|
-
maxWidth: _optionalChain([styles, 'optionalAccess',
|
|
3722
|
+
maxWidth: _optionalChain([styles, 'optionalAccess', _156 => _156.label, 'optionalAccess', _157 => _157.maxWidth]),
|
|
3423
3723
|
height
|
|
3424
3724
|
});
|
|
3425
3725
|
return {
|
|
@@ -3431,7 +3731,7 @@ var LineChartAnnotation = ({
|
|
|
3431
3731
|
xMax: xMax2,
|
|
3432
3732
|
...position2
|
|
3433
3733
|
};
|
|
3434
|
-
}, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess',
|
|
3734
|
+
}, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess', _158 => _158.label, 'optionalAccess', _159 => _159.maxWidth]), height, renderLabel]);
|
|
3435
3735
|
if (!positionData) return null;
|
|
3436
3736
|
const {
|
|
3437
3737
|
x,
|
|
@@ -3446,13 +3746,13 @@ var LineChartAnnotation = ({
|
|
|
3446
3746
|
isFlippedVertically
|
|
3447
3747
|
} = positionData;
|
|
3448
3748
|
const getLabelY = () => {
|
|
3449
|
-
const labelY = _optionalChain([styles, 'optionalAccess',
|
|
3749
|
+
const labelY = _optionalChain([styles, 'optionalAccess', _160 => _160.label, 'optionalAccess', _161 => _161.y]);
|
|
3450
3750
|
if (labelY === "start") return yMax;
|
|
3451
3751
|
if (labelY === "end") return yMin;
|
|
3452
3752
|
return labelY;
|
|
3453
3753
|
};
|
|
3454
3754
|
const getLabelX = () => {
|
|
3455
|
-
const labelX = _optionalChain([styles, 'optionalAccess',
|
|
3755
|
+
const labelX = _optionalChain([styles, 'optionalAccess', _162 => _162.label, 'optionalAccess', _163 => _163.x]);
|
|
3456
3756
|
if (labelX === "start") return xMin;
|
|
3457
3757
|
if (labelX === "end") return xMax;
|
|
3458
3758
|
return labelX;
|
|
@@ -3477,21 +3777,21 @@ var LineChartAnnotation = ({
|
|
|
3477
3777
|
dx,
|
|
3478
3778
|
dy,
|
|
3479
3779
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Connector, {
|
|
3480
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3780
|
+
..._optionalChain([styles, 'optionalAccess', _164 => _164.connector])
|
|
3481
3781
|
}), subjectType === "circle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.CircleSubject, {
|
|
3482
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3782
|
+
..._optionalChain([styles, 'optionalAccess', _165 => _165.circleSubject])
|
|
3483
3783
|
}), subjectType === "line-vertical" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
|
|
3484
3784
|
min: yMax,
|
|
3485
3785
|
max: yMin,
|
|
3486
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3786
|
+
..._optionalChain([styles, 'optionalAccess', _166 => _166.lineSubject]),
|
|
3487
3787
|
orientation: "vertical"
|
|
3488
3788
|
}), subjectType === "line-horizontal" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
|
|
3489
3789
|
min: xMin,
|
|
3490
3790
|
max: xMax,
|
|
3491
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3791
|
+
..._optionalChain([styles, 'optionalAccess', _167 => _167.lineSubject]),
|
|
3492
3792
|
orientation: "horizontal"
|
|
3493
3793
|
}), renderLabel ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.HtmlLabel, {
|
|
3494
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3794
|
+
..._optionalChain([styles, 'optionalAccess', _168 => _168.label]),
|
|
3495
3795
|
...labelPosition,
|
|
3496
3796
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
3497
3797
|
style: getSafariHTMLLabelPosition(),
|
|
@@ -3510,7 +3810,7 @@ var LineChartAnnotation = ({
|
|
|
3510
3810
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Label, {
|
|
3511
3811
|
title,
|
|
3512
3812
|
subtitle,
|
|
3513
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3813
|
+
..._optionalChain([styles, 'optionalAccess', _169 => _169.label]),
|
|
3514
3814
|
...labelPosition,
|
|
3515
3815
|
horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),
|
|
3516
3816
|
verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, _nullishCoalesce(height, () => ( ANNOTATION_INIT_HEIGHT)))
|
|
@@ -3547,7 +3847,7 @@ var LineChartGlyph = ({
|
|
|
3547
3847
|
const x = xScale(accessors.xAccessor(point));
|
|
3548
3848
|
const y = yScale(accessors.yAccessor(point));
|
|
3549
3849
|
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
3550
|
-
const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess',
|
|
3850
|
+
const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess', _170 => _170.radius])), () => ( 4)));
|
|
3551
3851
|
return renderGlyph({
|
|
3552
3852
|
key: `${position2}-glyph-${data.label}`,
|
|
3553
3853
|
index,
|
|
@@ -3578,9 +3878,9 @@ var renderDefaultTooltip = (params) => {
|
|
|
3578
3878
|
const {
|
|
3579
3879
|
tooltipData
|
|
3580
3880
|
} = params;
|
|
3581
|
-
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess',
|
|
3881
|
+
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _171 => _171.nearestDatum, 'optionalAccess', _172 => _172.datum]);
|
|
3582
3882
|
if (!nearestDatum) return null;
|
|
3583
|
-
const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess',
|
|
3883
|
+
const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess', _173 => _173.datumByKey]) || {}).map(([key, {
|
|
3584
3884
|
datum
|
|
3585
3885
|
}]) => ({
|
|
3586
3886
|
key,
|
|
@@ -3590,7 +3890,7 @@ var renderDefaultTooltip = (params) => {
|
|
|
3590
3890
|
className: line_chart_module_default["line-chart__tooltip"],
|
|
3591
3891
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
3592
3892
|
className: line_chart_module_default["line-chart__tooltip-date"],
|
|
3593
|
-
children: _optionalChain([nearestDatum, 'access',
|
|
3893
|
+
children: _optionalChain([nearestDatum, 'access', _174 => _174.date, 'optionalAccess', _175 => _175.toLocaleDateString, 'call', _176 => _176()])
|
|
3594
3894
|
}), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
|
|
3595
3895
|
direction: "row",
|
|
3596
3896
|
align: "center",
|
|
@@ -3607,7 +3907,7 @@ var renderDefaultTooltip = (params) => {
|
|
|
3607
3907
|
});
|
|
3608
3908
|
};
|
|
3609
3909
|
var validateData = (data) => {
|
|
3610
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
3910
|
+
if (!_optionalChain([data, 'optionalAccess', _177 => _177.length])) return "No data available";
|
|
3611
3911
|
const hasInvalidData = data.some((series) => series.data.some((point) => isNaN(point.value) || point.value === null || point.value === void 0 || "date" in point && point.date && isNaN(point.date.getTime())));
|
|
3612
3912
|
if (hasInvalidData) return "Invalid data";
|
|
3613
3913
|
return null;
|
|
@@ -3621,7 +3921,7 @@ var LineChartScalesRef = ({
|
|
|
3621
3921
|
const context = _react.useContext.call(void 0, _xychart.DataContext);
|
|
3622
3922
|
_react.useImperativeHandle.call(void 0, chartRef, () => ({
|
|
3623
3923
|
getScales: () => {
|
|
3624
|
-
if (!_optionalChain([context, 'optionalAccess',
|
|
3924
|
+
if (!_optionalChain([context, 'optionalAccess', _178 => _178.xScale]) || !_optionalChain([context, 'optionalAccess', _179 => _179.yScale])) {
|
|
3625
3925
|
return null;
|
|
3626
3926
|
}
|
|
3627
3927
|
return {
|
|
@@ -3663,6 +3963,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3663
3963
|
onPointerUp = void 0,
|
|
3664
3964
|
onPointerMove = void 0,
|
|
3665
3965
|
onPointerOut = void 0,
|
|
3966
|
+
zoomable = false,
|
|
3666
3967
|
children,
|
|
3667
3968
|
gridVisibility,
|
|
3668
3969
|
gap = "md"
|
|
@@ -3677,6 +3978,15 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3677
3978
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
3678
3979
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
3679
3980
|
const internalChartRef = _react.useRef.call(void 0, null);
|
|
3981
|
+
const zoom = useXZoom({
|
|
3982
|
+
enabled: zoomable,
|
|
3983
|
+
chartRef: internalChartRef,
|
|
3984
|
+
userHandlers: {
|
|
3985
|
+
onPointerDown,
|
|
3986
|
+
onPointerMove,
|
|
3987
|
+
onPointerUp
|
|
3988
|
+
}
|
|
3989
|
+
});
|
|
3680
3990
|
const {
|
|
3681
3991
|
legendChildren,
|
|
3682
3992
|
nonLegendChildren
|
|
@@ -3687,8 +3997,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3687
3997
|
setMeasuredChartHeight(chartHeight);
|
|
3688
3998
|
}, [height]);
|
|
3689
3999
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
3690
|
-
getScales: () => _optionalChain([internalChartRef, 'access',
|
|
3691
|
-
getChartDimensions: () => _optionalChain([internalChartRef, 'access',
|
|
4000
|
+
getScales: () => _optionalChain([internalChartRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.getScales, 'call', _182 => _182()]) || null,
|
|
4001
|
+
getChartDimensions: () => _optionalChain([internalChartRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.getChartDimensions, 'call', _185 => _185()]) || {
|
|
3692
4002
|
width: 0,
|
|
3693
4003
|
height: 0,
|
|
3694
4004
|
margin: {}
|
|
@@ -3729,10 +4039,10 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3729
4039
|
isNavigating,
|
|
3730
4040
|
setIsNavigating,
|
|
3731
4041
|
chartRef,
|
|
3732
|
-
totalPoints: _optionalChain([dataSorted, 'access',
|
|
4042
|
+
totalPoints: _optionalChain([dataSorted, 'access', _186 => _186[0], 'optionalAccess', _187 => _187.data, 'access', _188 => _188.length]) || 0
|
|
3733
4043
|
});
|
|
3734
4044
|
const chartOptions = _react.useMemo.call(void 0, () => {
|
|
3735
|
-
const formatter = _optionalChain([options, 'optionalAccess',
|
|
4045
|
+
const formatter = _optionalChain([options, 'optionalAccess', _189 => _189.axis, 'optionalAccess', _190 => _190.x, 'optionalAccess', _191 => _191.tickFormat]) || getFormatter(dataSorted);
|
|
3736
4046
|
return {
|
|
3737
4047
|
axis: {
|
|
3738
4048
|
x: {
|
|
@@ -3740,28 +4050,31 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3740
4050
|
numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
|
|
3741
4051
|
tickFormat: formatter,
|
|
3742
4052
|
display: true,
|
|
3743
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4053
|
+
..._optionalChain([options, 'optionalAccess', _192 => _192.axis, 'optionalAccess', _193 => _193.x])
|
|
3744
4054
|
},
|
|
3745
4055
|
y: {
|
|
3746
4056
|
orientation: "left",
|
|
3747
4057
|
numTicks: 4,
|
|
3748
4058
|
tickFormat: _numberformatters.formatNumberCompact,
|
|
3749
4059
|
display: true,
|
|
3750
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4060
|
+
..._optionalChain([options, 'optionalAccess', _194 => _194.axis, 'optionalAccess', _195 => _195.y])
|
|
3751
4061
|
}
|
|
3752
4062
|
},
|
|
3753
4063
|
xScale: {
|
|
3754
4064
|
type: "time",
|
|
3755
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4065
|
+
..._optionalChain([options, 'optionalAccess', _196 => _196.xScale]),
|
|
4066
|
+
...zoom.domain ? {
|
|
4067
|
+
domain: zoom.domain
|
|
4068
|
+
} : {}
|
|
3756
4069
|
},
|
|
3757
4070
|
yScale: {
|
|
3758
4071
|
type: "linear",
|
|
3759
4072
|
nice: true,
|
|
3760
4073
|
zero: false,
|
|
3761
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4074
|
+
..._optionalChain([options, 'optionalAccess', _197 => _197.yScale])
|
|
3762
4075
|
}
|
|
3763
4076
|
};
|
|
3764
|
-
}, [options, dataSorted, width]);
|
|
4077
|
+
}, [options, dataSorted, width, zoom.domain]);
|
|
3765
4078
|
const tooltipRenderGlyph = _react.useMemo.call(void 0, () => {
|
|
3766
4079
|
return (props) => {
|
|
3767
4080
|
const seriesIndex = dataSorted.findIndex((series) => series.label === props.key || series.data.includes(props.datum));
|
|
@@ -3785,9 +4098,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3785
4098
|
const isDataValid = !error;
|
|
3786
4099
|
const legendOptions = _react.useMemo.call(void 0, () => ({
|
|
3787
4100
|
withGlyph: withLegendGlyph,
|
|
3788
|
-
glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess',
|
|
4101
|
+
glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _198 => _198.radius])), () => ( 4))),
|
|
3789
4102
|
renderGlyph
|
|
3790
|
-
}), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess',
|
|
4103
|
+
}), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _199 => _199.radius]), renderGlyph]);
|
|
3791
4104
|
const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);
|
|
3792
4105
|
const chartMetadata = _react.useMemo.call(void 0, () => ({
|
|
3793
4106
|
withGradientFill,
|
|
@@ -3806,8 +4119,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3806
4119
|
});
|
|
3807
4120
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
3808
4121
|
const accessors = {
|
|
3809
|
-
xAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
3810
|
-
yAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4122
|
+
xAccessor: (d) => _optionalChain([d, 'optionalAccess', _200 => _200.date]),
|
|
4123
|
+
yAccessor: (d) => _optionalChain([d, 'optionalAccess', _201 => _201.value])
|
|
3811
4124
|
};
|
|
3812
4125
|
if (error) {
|
|
3813
4126
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
@@ -3860,9 +4173,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3860
4173
|
onKeyDown: onChartKeyDown,
|
|
3861
4174
|
onFocus: onChartFocus,
|
|
3862
4175
|
onBlur: onChartBlur,
|
|
3863
|
-
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.
|
|
4176
|
+
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
3864
4177
|
ref: chartRef,
|
|
3865
|
-
|
|
4178
|
+
style: {
|
|
4179
|
+
position: "relative"
|
|
4180
|
+
},
|
|
4181
|
+
children: [zoomable && zoom.domain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomResetButton, {
|
|
4182
|
+
onClick: zoom.reset
|
|
4183
|
+
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _xychart.XYChart, {
|
|
3866
4184
|
theme,
|
|
3867
4185
|
width,
|
|
3868
4186
|
height: chartHeight,
|
|
@@ -3872,9 +4190,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3872
4190
|
},
|
|
3873
4191
|
xScale: chartOptions.xScale,
|
|
3874
4192
|
yScale: chartOptions.yScale,
|
|
3875
|
-
onPointerDown,
|
|
3876
|
-
onPointerUp,
|
|
3877
|
-
onPointerMove,
|
|
4193
|
+
onPointerDown: zoom.handlers.onPointerDown,
|
|
4194
|
+
onPointerUp: zoom.handlers.onPointerUp,
|
|
4195
|
+
onPointerMove: zoom.handlers.onPointerMove,
|
|
3878
4196
|
onPointerOut,
|
|
3879
4197
|
pointerEventsDataKey: "nearest",
|
|
3880
4198
|
children: [gridVisibility !== "none" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Grid, {
|
|
@@ -3890,65 +4208,69 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3890
4208
|
width,
|
|
3891
4209
|
height: chartHeight,
|
|
3892
4210
|
children: _i18n.__.call(void 0, "All series are hidden. Click legend items to show data.", "jetpack-charts")
|
|
3893
|
-
}) : null,
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
}
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
} = getElementStyles({
|
|
3906
|
-
data: seriesData,
|
|
3907
|
-
index
|
|
3908
|
-
});
|
|
3909
|
-
const lineProps = {
|
|
3910
|
-
stroke: color,
|
|
3911
|
-
...lineStyles
|
|
3912
|
-
};
|
|
3913
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", {
|
|
3914
|
-
children: [withGradientFill && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _gradient.LinearGradient, {
|
|
3915
|
-
id: `area-gradient-${chartId}-${index + 1}`,
|
|
3916
|
-
from: color,
|
|
3917
|
-
fromOpacity: 0.4,
|
|
3918
|
-
toOpacity: 0.1,
|
|
3919
|
-
to: providerTheme.backgroundColor,
|
|
3920
|
-
..._optionalChain([seriesData, 'access', _189 => _189.options, 'optionalAccess', _190 => _190.gradient]),
|
|
3921
|
-
children: _optionalChain([seriesData, 'access', _191 => _191.options, 'optionalAccess', _192 => _192.gradient, 'optionalAccess', _193 => _193.stops, 'optionalAccess', _194 => _194.map, 'call', _195 => _195((stop, stopIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", {
|
|
3922
|
-
offset: stop.offset,
|
|
3923
|
-
stopColor: stop.color || color,
|
|
3924
|
-
stopOpacity: _nullishCoalesce(stop.opacity, () => ( 1))
|
|
3925
|
-
}, `${stop.offset}-${stop.color || color}`))])
|
|
3926
|
-
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AreaSeries, {
|
|
3927
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess', _196 => _196.label]),
|
|
3928
|
-
data: seriesData.data,
|
|
3929
|
-
...accessors,
|
|
3930
|
-
fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : "transparent",
|
|
3931
|
-
renderLine: true,
|
|
3932
|
-
curve: getCurveType(curveType, smoothing),
|
|
3933
|
-
lineProps
|
|
3934
|
-
}, _optionalChain([seriesData, 'optionalAccess', _197 => _197.label])), withStartGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
|
|
3935
|
-
index,
|
|
3936
|
-
data: seriesData,
|
|
4211
|
+
}) : null, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomClip, {
|
|
4212
|
+
active: zoomable && !!zoom.domain,
|
|
4213
|
+
chartId,
|
|
4214
|
+
children: seriesWithVisibility.map(({
|
|
4215
|
+
series: seriesData,
|
|
4216
|
+
index,
|
|
4217
|
+
isVisible
|
|
4218
|
+
}) => {
|
|
4219
|
+
if (!isVisible) {
|
|
4220
|
+
return null;
|
|
4221
|
+
}
|
|
4222
|
+
const {
|
|
3937
4223
|
color,
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
position: "start"
|
|
3942
|
-
}), withEndGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
|
|
3943
|
-
index,
|
|
4224
|
+
lineStyles,
|
|
4225
|
+
glyph
|
|
4226
|
+
} = getElementStyles({
|
|
3944
4227
|
data: seriesData,
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
}
|
|
3951
|
-
|
|
4228
|
+
index
|
|
4229
|
+
});
|
|
4230
|
+
const lineProps = {
|
|
4231
|
+
stroke: color,
|
|
4232
|
+
...lineStyles
|
|
4233
|
+
};
|
|
4234
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", {
|
|
4235
|
+
children: [withGradientFill && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _gradient.LinearGradient, {
|
|
4236
|
+
id: `area-gradient-${chartId}-${index + 1}`,
|
|
4237
|
+
from: color,
|
|
4238
|
+
fromOpacity: 0.4,
|
|
4239
|
+
toOpacity: 0.1,
|
|
4240
|
+
to: providerTheme.backgroundColor,
|
|
4241
|
+
..._optionalChain([seriesData, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.gradient]),
|
|
4242
|
+
children: _optionalChain([seriesData, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.gradient, 'optionalAccess', _206 => _206.stops, 'optionalAccess', _207 => _207.map, 'call', _208 => _208((stop, stopIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", {
|
|
4243
|
+
offset: stop.offset,
|
|
4244
|
+
stopColor: stop.color || color,
|
|
4245
|
+
stopOpacity: _nullishCoalesce(stop.opacity, () => ( 1))
|
|
4246
|
+
}, `${stop.offset}-${stop.color || color}`))])
|
|
4247
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AreaSeries, {
|
|
4248
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _209 => _209.label]),
|
|
4249
|
+
data: seriesData.data,
|
|
4250
|
+
...accessors,
|
|
4251
|
+
fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : "transparent",
|
|
4252
|
+
renderLine: true,
|
|
4253
|
+
curve: getCurveType(curveType, smoothing),
|
|
4254
|
+
lineProps
|
|
4255
|
+
}, _optionalChain([seriesData, 'optionalAccess', _210 => _210.label])), withStartGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
|
|
4256
|
+
index,
|
|
4257
|
+
data: seriesData,
|
|
4258
|
+
color,
|
|
4259
|
+
renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
|
|
4260
|
+
accessors,
|
|
4261
|
+
glyphStyle,
|
|
4262
|
+
position: "start"
|
|
4263
|
+
}), withEndGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
|
|
4264
|
+
index,
|
|
4265
|
+
data: seriesData,
|
|
4266
|
+
color,
|
|
4267
|
+
renderGlyph: _nullishCoalesce(glyph, () => ( renderGlyph)),
|
|
4268
|
+
accessors,
|
|
4269
|
+
glyphStyle,
|
|
4270
|
+
position: "end"
|
|
4271
|
+
})]
|
|
4272
|
+
}, _optionalChain([seriesData, 'optionalAccess', _211 => _211.label]) || index);
|
|
4273
|
+
})
|
|
3952
4274
|
}), withTooltips && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccessibleTooltip, {
|
|
3953
4275
|
detectBounds: true,
|
|
3954
4276
|
snapTooltipToDatumX: true,
|
|
@@ -3957,8 +4279,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3957
4279
|
renderTooltip,
|
|
3958
4280
|
renderGlyph: tooltipRenderGlyph,
|
|
3959
4281
|
glyphStyle,
|
|
3960
|
-
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
3961
|
-
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4282
|
+
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _212 => _212.showVertical]),
|
|
4283
|
+
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _213 => _213.showHorizontal]),
|
|
3962
4284
|
selectedIndex,
|
|
3963
4285
|
tooltipRef,
|
|
3964
4286
|
keyboardFocusedClassName: line_chart_module_default["line-chart__tooltip--keyboard-focused"],
|
|
@@ -3968,8 +4290,10 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3968
4290
|
width,
|
|
3969
4291
|
height,
|
|
3970
4292
|
margin
|
|
4293
|
+
}), zoomable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomSelectionRect, {
|
|
4294
|
+
drag: zoom.drag
|
|
3971
4295
|
})]
|
|
3972
|
-
})
|
|
4296
|
+
})]
|
|
3973
4297
|
})
|
|
3974
4298
|
});
|
|
3975
4299
|
}
|
|
@@ -4013,8 +4337,8 @@ var area_chart_module_default = {
|
|
|
4013
4337
|
// src/charts/area-chart/private/validate-data.ts
|
|
4014
4338
|
|
|
4015
4339
|
var validateData2 = (data) => {
|
|
4016
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
4017
|
-
const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access',
|
|
4340
|
+
if (!_optionalChain([data, 'optionalAccess', _214 => _214.length])) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
|
|
4341
|
+
const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access', _215 => _215.data, 'optionalAccess', _216 => _216.length]));
|
|
4018
4342
|
if (hasEmptySeries) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
|
|
4019
4343
|
const hasInvalidData = data.some(
|
|
4020
4344
|
(series) => series.data.some(
|
|
@@ -4038,7 +4362,7 @@ var AreaChartScalesRef = ({
|
|
|
4038
4362
|
const context = _react.useContext.call(void 0, _xychart.DataContext);
|
|
4039
4363
|
_react.useImperativeHandle.call(void 0, chartRef, () => ({
|
|
4040
4364
|
getScales: () => {
|
|
4041
|
-
if (!_optionalChain([context, 'optionalAccess',
|
|
4365
|
+
if (!_optionalChain([context, 'optionalAccess', _217 => _217.xScale]) || !_optionalChain([context, 'optionalAccess', _218 => _218.yScale])) return null;
|
|
4042
4366
|
return {
|
|
4043
4367
|
xScale: context.xScale,
|
|
4044
4368
|
yScale: context.yScale
|
|
@@ -4061,10 +4385,10 @@ var HoverGlyphs = ({
|
|
|
4061
4385
|
}) => {
|
|
4062
4386
|
const dataContext = _react.useContext.call(void 0, _xychart.DataContext);
|
|
4063
4387
|
const tooltipContext = _react.useContext.call(void 0, _xychart.TooltipContext);
|
|
4064
|
-
const xScale = _optionalChain([dataContext, 'optionalAccess',
|
|
4065
|
-
const yScale = _optionalChain([dataContext, 'optionalAccess',
|
|
4066
|
-
const tooltipOpen = _optionalChain([tooltipContext, 'optionalAccess',
|
|
4067
|
-
const nearestDatum = _optionalChain([tooltipContext, 'optionalAccess',
|
|
4388
|
+
const xScale = _optionalChain([dataContext, 'optionalAccess', _219 => _219.xScale]);
|
|
4389
|
+
const yScale = _optionalChain([dataContext, 'optionalAccess', _220 => _220.yScale]);
|
|
4390
|
+
const tooltipOpen = _optionalChain([tooltipContext, 'optionalAccess', _221 => _221.tooltipOpen]);
|
|
4391
|
+
const nearestDatum = _optionalChain([tooltipContext, 'optionalAccess', _222 => _222.tooltipData, 'optionalAccess', _223 => _223.nearestDatum, 'optionalAccess', _224 => _224.datum]);
|
|
4068
4392
|
if (!tooltipOpen || !xScale || !yScale || !nearestDatum || !nearestDatum.date || stacked && stackOffset !== "none") {
|
|
4069
4393
|
return null;
|
|
4070
4394
|
}
|
|
@@ -4077,8 +4401,8 @@ var HoverGlyphs = ({
|
|
|
4077
4401
|
series,
|
|
4078
4402
|
index
|
|
4079
4403
|
} of visibleSeries) {
|
|
4080
|
-
const datum = series.data.find((d) => _optionalChain([d, 'access',
|
|
4081
|
-
const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess',
|
|
4404
|
+
const datum = series.data.find((d) => _optionalChain([d, 'access', _225 => _225.date, 'optionalAccess', _226 => _226.getTime, 'call', _227 => _227()]) === hoveredTime);
|
|
4405
|
+
const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess', _228 => _228.value]), () => ( 0));
|
|
4082
4406
|
if (stacked) {
|
|
4083
4407
|
cumulative += value;
|
|
4084
4408
|
}
|
|
@@ -4137,6 +4461,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4137
4461
|
onPointerUp,
|
|
4138
4462
|
onPointerMove,
|
|
4139
4463
|
onPointerOut,
|
|
4464
|
+
zoomable = false,
|
|
4465
|
+
rescaleYOnLegendToggle = true,
|
|
4140
4466
|
children,
|
|
4141
4467
|
gridVisibility,
|
|
4142
4468
|
gap = "md"
|
|
@@ -4151,6 +4477,15 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4151
4477
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
4152
4478
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
4153
4479
|
const internalChartRef = _react.useRef.call(void 0, null);
|
|
4480
|
+
const zoom = useXZoom({
|
|
4481
|
+
enabled: zoomable,
|
|
4482
|
+
chartRef: internalChartRef,
|
|
4483
|
+
userHandlers: {
|
|
4484
|
+
onPointerDown,
|
|
4485
|
+
onPointerMove,
|
|
4486
|
+
onPointerUp
|
|
4487
|
+
}
|
|
4488
|
+
});
|
|
4154
4489
|
const {
|
|
4155
4490
|
legendChildren,
|
|
4156
4491
|
nonLegendChildren
|
|
@@ -4161,8 +4496,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4161
4496
|
setMeasuredChartHeight(chartHeight);
|
|
4162
4497
|
}, [height]);
|
|
4163
4498
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
4164
|
-
getScales: () => _optionalChain([internalChartRef, 'access',
|
|
4165
|
-
getChartDimensions: () => _optionalChain([internalChartRef, 'access',
|
|
4499
|
+
getScales: () => _optionalChain([internalChartRef, 'access', _229 => _229.current, 'optionalAccess', _230 => _230.getScales, 'call', _231 => _231()]) || null,
|
|
4500
|
+
getChartDimensions: () => _optionalChain([internalChartRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.getChartDimensions, 'call', _234 => _234()]) || {
|
|
4166
4501
|
width: 0,
|
|
4167
4502
|
height: 0,
|
|
4168
4503
|
margin: {}
|
|
@@ -4201,10 +4536,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4201
4536
|
isNavigating,
|
|
4202
4537
|
setIsNavigating,
|
|
4203
4538
|
chartRef,
|
|
4204
|
-
totalPoints: _optionalChain([dataSorted, 'access',
|
|
4539
|
+
totalPoints: _optionalChain([dataSorted, 'access', _235 => _235[0], 'optionalAccess', _236 => _236.data, 'access', _237 => _237.length]) || 0
|
|
4205
4540
|
});
|
|
4206
4541
|
const fixedYDomain = _react.useMemo.call(void 0, () => {
|
|
4207
|
-
if (!legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
|
|
4542
|
+
if (rescaleYOnLegendToggle || !legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
|
|
4208
4543
|
return void 0;
|
|
4209
4544
|
}
|
|
4210
4545
|
if (stacked) {
|
|
@@ -4215,7 +4550,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4215
4550
|
let posSum = 0;
|
|
4216
4551
|
let negSum = 0;
|
|
4217
4552
|
for (const series of dataSorted) {
|
|
4218
|
-
const v = Number(_optionalChain([series, 'access',
|
|
4553
|
+
const v = Number(_optionalChain([series, 'access', _238 => _238.data, 'access', _239 => _239[i], 'optionalAccess', _240 => _240.value]));
|
|
4219
4554
|
if (Number.isNaN(v)) continue;
|
|
4220
4555
|
if (v >= 0) posSum += v;
|
|
4221
4556
|
else negSum += v;
|
|
@@ -4229,7 +4564,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4229
4564
|
let min = Infinity;
|
|
4230
4565
|
for (const series of dataSorted) {
|
|
4231
4566
|
for (const point of series.data) {
|
|
4232
|
-
const v = Number(_optionalChain([point, 'optionalAccess',
|
|
4567
|
+
const v = Number(_optionalChain([point, 'optionalAccess', _241 => _241.value]));
|
|
4233
4568
|
if (!Number.isNaN(v)) {
|
|
4234
4569
|
if (v > max) max = v;
|
|
4235
4570
|
if (v < min) min = v;
|
|
@@ -4238,9 +4573,9 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4238
4573
|
}
|
|
4239
4574
|
if (max === -Infinity) return void 0;
|
|
4240
4575
|
return [Math.min(0, min), max];
|
|
4241
|
-
}, [dataSorted, stacked, stackOffset, legendInteractive]);
|
|
4576
|
+
}, [dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle]);
|
|
4242
4577
|
const chartOptions = _react.useMemo.call(void 0, () => {
|
|
4243
|
-
const formatter = _optionalChain([options, 'optionalAccess',
|
|
4578
|
+
const formatter = _optionalChain([options, 'optionalAccess', _242 => _242.axis, 'optionalAccess', _243 => _243.x, 'optionalAccess', _244 => _244.tickFormat]) || getFormatter(dataSorted);
|
|
4244
4579
|
return {
|
|
4245
4580
|
axis: {
|
|
4246
4581
|
x: {
|
|
@@ -4248,19 +4583,22 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4248
4583
|
numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
|
|
4249
4584
|
tickFormat: formatter,
|
|
4250
4585
|
display: true,
|
|
4251
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4586
|
+
..._optionalChain([options, 'optionalAccess', _245 => _245.axis, 'optionalAccess', _246 => _246.x])
|
|
4252
4587
|
},
|
|
4253
4588
|
y: {
|
|
4254
4589
|
orientation: "left",
|
|
4255
4590
|
numTicks: 4,
|
|
4256
4591
|
tickFormat: _numberformatters.formatNumberCompact,
|
|
4257
4592
|
display: true,
|
|
4258
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4593
|
+
..._optionalChain([options, 'optionalAccess', _247 => _247.axis, 'optionalAccess', _248 => _248.y])
|
|
4259
4594
|
}
|
|
4260
4595
|
},
|
|
4261
4596
|
xScale: {
|
|
4262
4597
|
type: "time",
|
|
4263
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4598
|
+
..._optionalChain([options, 'optionalAccess', _249 => _249.xScale]),
|
|
4599
|
+
...zoom.domain ? {
|
|
4600
|
+
domain: zoom.domain
|
|
4601
|
+
} : {}
|
|
4264
4602
|
},
|
|
4265
4603
|
yScale: {
|
|
4266
4604
|
type: "linear",
|
|
@@ -4270,10 +4608,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4270
4608
|
...fixedYDomain ? {
|
|
4271
4609
|
domain: fixedYDomain
|
|
4272
4610
|
} : {},
|
|
4273
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4611
|
+
..._optionalChain([options, 'optionalAccess', _250 => _250.yScale])
|
|
4274
4612
|
}
|
|
4275
4613
|
};
|
|
4276
|
-
}, [options, dataSorted, width, stacked, fixedYDomain]);
|
|
4614
|
+
}, [options, dataSorted, width, stacked, fixedYDomain, zoom.domain]);
|
|
4277
4615
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);
|
|
4278
4616
|
const error = validateData2(dataSorted);
|
|
4279
4617
|
const isDataValid = !error;
|
|
@@ -4298,21 +4636,21 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4298
4636
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
4299
4637
|
const animationEnabled = !!animation && !prefersReducedMotion;
|
|
4300
4638
|
const accessors = {
|
|
4301
|
-
xAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4302
|
-
yAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4639
|
+
xAccessor: (d) => _optionalChain([d, 'optionalAccess', _251 => _251.date]),
|
|
4640
|
+
yAccessor: (d) => _optionalChain([d, 'optionalAccess', _252 => _252.value])
|
|
4303
4641
|
};
|
|
4304
4642
|
const zeroYAccessor = _react.useCallback.call(void 0, () => 0, []);
|
|
4305
4643
|
const visibleLabels = _react.useMemo.call(void 0, () => new Set(seriesWithVisibility.filter((s) => s.isVisible).map((s) => s.series.label)), [seriesWithVisibility]);
|
|
4306
4644
|
const filteredRenderTooltip = _react.useCallback.call(void 0, (params) => {
|
|
4307
4645
|
if (!legendInteractive) return renderTooltip(params);
|
|
4308
|
-
const datumByKey = _optionalChain([params, 'optionalAccess',
|
|
4646
|
+
const datumByKey = _optionalChain([params, 'optionalAccess', _253 => _253.tooltipData, 'optionalAccess', _254 => _254.datumByKey]);
|
|
4309
4647
|
if (!datumByKey) return renderTooltip(params);
|
|
4310
4648
|
const filtered = Object.fromEntries(Object.entries(datumByKey).filter(([key]) => visibleLabels.has(key)));
|
|
4311
4649
|
if (Object.keys(filtered).length === 0) return null;
|
|
4312
|
-
const nearestDatum = _optionalChain([params, 'optionalAccess',
|
|
4650
|
+
const nearestDatum = _optionalChain([params, 'optionalAccess', _255 => _255.tooltipData, 'optionalAccess', _256 => _256.nearestDatum]);
|
|
4313
4651
|
const nextNearest = nearestDatum && visibleLabels.has(nearestDatum.key) ? nearestDatum : {
|
|
4314
4652
|
...Object.values(filtered)[0],
|
|
4315
|
-
distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess',
|
|
4653
|
+
distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess', _257 => _257.distance]), () => ( 0))
|
|
4316
4654
|
};
|
|
4317
4655
|
return renderTooltip({
|
|
4318
4656
|
...params,
|
|
@@ -4361,7 +4699,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4361
4699
|
index
|
|
4362
4700
|
});
|
|
4363
4701
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaSeries, {
|
|
4364
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess',
|
|
4702
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _258 => _258.label]),
|
|
4365
4703
|
data: seriesData.data,
|
|
4366
4704
|
xAccessor: accessors.xAccessor,
|
|
4367
4705
|
yAccessor: isVisible || !legendInteractive ? accessors.yAccessor : zeroYAccessor,
|
|
@@ -4375,7 +4713,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4375
4713
|
stroke: color,
|
|
4376
4714
|
...lineStyles
|
|
4377
4715
|
}
|
|
4378
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
4716
|
+
}, _optionalChain([seriesData, 'optionalAccess', _259 => _259.label]) || index);
|
|
4379
4717
|
};
|
|
4380
4718
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SingleChartContext.Provider, {
|
|
4381
4719
|
value: {
|
|
@@ -4409,9 +4747,14 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4409
4747
|
onKeyDown: onChartKeyDown,
|
|
4410
4748
|
onFocus: onChartFocus,
|
|
4411
4749
|
onBlur: onChartBlur,
|
|
4412
|
-
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.
|
|
4750
|
+
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4413
4751
|
ref: chartRef,
|
|
4414
|
-
|
|
4752
|
+
style: {
|
|
4753
|
+
position: "relative"
|
|
4754
|
+
},
|
|
4755
|
+
children: [zoomable && zoom.domain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomResetButton, {
|
|
4756
|
+
onClick: zoom.reset
|
|
4757
|
+
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _xychart.XYChart, {
|
|
4415
4758
|
theme,
|
|
4416
4759
|
width,
|
|
4417
4760
|
height: chartHeight,
|
|
@@ -4421,9 +4764,9 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4421
4764
|
},
|
|
4422
4765
|
xScale: chartOptions.xScale,
|
|
4423
4766
|
yScale: chartOptions.yScale,
|
|
4424
|
-
onPointerDown,
|
|
4425
|
-
onPointerUp,
|
|
4426
|
-
onPointerMove,
|
|
4767
|
+
onPointerDown: zoom.handlers.onPointerDown,
|
|
4768
|
+
onPointerUp: zoom.handlers.onPointerUp,
|
|
4769
|
+
onPointerMove: zoom.handlers.onPointerMove,
|
|
4427
4770
|
onPointerOut,
|
|
4428
4771
|
pointerEventsDataKey: "nearest",
|
|
4429
4772
|
children: [gridVisibility !== "none" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Grid, {
|
|
@@ -4439,19 +4782,23 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4439
4782
|
width,
|
|
4440
4783
|
height: chartHeight,
|
|
4441
4784
|
children: _i18n.__.call(void 0, "All series are hidden. Click legend items to show data.", "jetpack-charts")
|
|
4442
|
-
}) : null,
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4785
|
+
}) : null, /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ZoomClip, {
|
|
4786
|
+
active: zoomable,
|
|
4787
|
+
chartId,
|
|
4788
|
+
children: [!allSeriesHidden && stacked && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaStack, {
|
|
4789
|
+
curve,
|
|
4790
|
+
offset: stackOffset,
|
|
4791
|
+
renderLine: resolvedWithStroke,
|
|
4792
|
+
children: seriesWithVisibility.map(renderSeries)
|
|
4793
|
+
}), !allSeriesHidden && !stacked && seriesWithVisibility.map(renderSeries)]
|
|
4794
|
+
}), withTooltips && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
|
|
4448
4795
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccessibleTooltip, {
|
|
4449
4796
|
detectBounds: true,
|
|
4450
4797
|
snapTooltipToDatumX: true,
|
|
4451
4798
|
snapTooltipToDatumY: !stacked,
|
|
4452
4799
|
renderTooltip: filteredRenderTooltip,
|
|
4453
|
-
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4454
|
-
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4800
|
+
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _260 => _260.showVertical]),
|
|
4801
|
+
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _261 => _261.showHorizontal]),
|
|
4455
4802
|
selectedIndex,
|
|
4456
4803
|
tooltipRef,
|
|
4457
4804
|
keyboardFocusedClassName: area_chart_module_default["area-chart__tooltip--keyboard-focused"],
|
|
@@ -4468,8 +4815,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4468
4815
|
width,
|
|
4469
4816
|
height: height || chartHeight,
|
|
4470
4817
|
margin
|
|
4818
|
+
}), zoomable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomSelectionRect, {
|
|
4819
|
+
drag: zoom.drag
|
|
4471
4820
|
})]
|
|
4472
|
-
})
|
|
4821
|
+
})]
|
|
4473
4822
|
})
|
|
4474
4823
|
});
|
|
4475
4824
|
}
|
|
@@ -4642,12 +4991,12 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4642
4991
|
nice: true,
|
|
4643
4992
|
zero: false
|
|
4644
4993
|
};
|
|
4645
|
-
const labelFormatter = _optionalChain([data, 'optionalAccess',
|
|
4994
|
+
const labelFormatter = _optionalChain([data, 'optionalAccess', _262 => _262[0], 'optionalAccess', _263 => _263.data, 'optionalAccess', _264 => _264[0], 'optionalAccess', _265 => _265.label]) ? (label) => label : formatDateTick2;
|
|
4646
4995
|
const valueFormatter = _numberformatters.formatNumberCompact;
|
|
4647
|
-
const labelAccessor = (d) => _optionalChain([d, 'optionalAccess',
|
|
4996
|
+
const labelAccessor = (d) => _optionalChain([d, 'optionalAccess', _266 => _266.label]) || _optionalChain([d, 'optionalAccess', _267 => _267.date]);
|
|
4648
4997
|
const valueAccessor = (d) => {
|
|
4649
4998
|
const enhancedPoint = d;
|
|
4650
|
-
return _optionalChain([enhancedPoint, 'optionalAccess',
|
|
4999
|
+
return _optionalChain([enhancedPoint, 'optionalAccess', _268 => _268.visualValue]) !== void 0 ? enhancedPoint.visualValue : _optionalChain([d, 'optionalAccess', _269 => _269.value]);
|
|
4651
5000
|
};
|
|
4652
5001
|
return {
|
|
4653
5002
|
vertical: {
|
|
@@ -4686,9 +5035,9 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4686
5035
|
} = defaultOptions[orientationKey];
|
|
4687
5036
|
const xScale = { ...baseXScale, ...options.xScale || {} };
|
|
4688
5037
|
const yScale = { ...baseYScale, ...options.yScale || {} };
|
|
4689
|
-
const providedToolTipLabelFormatter = horizontal ? _optionalChain([options, 'access',
|
|
4690
|
-
const { labelOverflow: xLabelOverflow, ...xAxisOptions } = _optionalChain([options, 'access',
|
|
4691
|
-
const { labelOverflow: yLabelOverflow, ...yAxisOptions } = _optionalChain([options, 'access',
|
|
5038
|
+
const providedToolTipLabelFormatter = horizontal ? _optionalChain([options, 'access', _270 => _270.axis, 'optionalAccess', _271 => _271.y, 'optionalAccess', _272 => _272.tickFormat]) : _optionalChain([options, 'access', _273 => _273.axis, 'optionalAccess', _274 => _274.x, 'optionalAccess', _275 => _275.tickFormat]);
|
|
5039
|
+
const { labelOverflow: xLabelOverflow, ...xAxisOptions } = _optionalChain([options, 'access', _276 => _276.axis, 'optionalAccess', _277 => _277.x]) || {};
|
|
5040
|
+
const { labelOverflow: yLabelOverflow, ...yAxisOptions } = _optionalChain([options, 'access', _278 => _278.axis, 'optionalAccess', _279 => _279.y]) || {};
|
|
4692
5041
|
return {
|
|
4693
5042
|
gridVisibility,
|
|
4694
5043
|
xScale,
|
|
@@ -4726,7 +5075,7 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4726
5075
|
// src/charts/bar-chart/bar-chart.tsx
|
|
4727
5076
|
|
|
4728
5077
|
var validateData3 = (data) => {
|
|
4729
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
5078
|
+
if (!_optionalChain([data, 'optionalAccess', _280 => _280.length])) return "No data available";
|
|
4730
5079
|
const hasInvalidData = data.some((series) => series.data.some((point) => isNaN(point.value) || point.value === null || point.value === void 0 || !point.label && (!("date" in point && point.date) || isNaN(point.date.getTime()))));
|
|
4731
5080
|
if (hasInvalidData) return "Invalid data";
|
|
4732
5081
|
return null;
|
|
@@ -4776,7 +5125,7 @@ var BarChartInternal = ({
|
|
|
4776
5125
|
}, [height]);
|
|
4777
5126
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
4778
5127
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
4779
|
-
const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access',
|
|
5128
|
+
const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access', _281 => _281.data, 'optionalAccess', _282 => _282.length]) || 0)) * data.length;
|
|
4780
5129
|
const {
|
|
4781
5130
|
tooltipRef,
|
|
4782
5131
|
onChartFocus,
|
|
@@ -4820,13 +5169,13 @@ var BarChartInternal = ({
|
|
|
4820
5169
|
const renderDefaultTooltip2 = _react.useCallback.call(void 0, ({
|
|
4821
5170
|
tooltipData
|
|
4822
5171
|
}) => {
|
|
4823
|
-
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess',
|
|
5172
|
+
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _283 => _283.nearestDatum, 'optionalAccess', _284 => _284.datum]);
|
|
4824
5173
|
if (!nearestDatum) return null;
|
|
4825
5174
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4826
5175
|
className: bar_chart_module_default["bar-chart__tooltip"],
|
|
4827
5176
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
4828
5177
|
className: bar_chart_module_default["bar-chart__tooltip-header"],
|
|
4829
|
-
children: _optionalChain([tooltipData, 'optionalAccess',
|
|
5178
|
+
children: _optionalChain([tooltipData, 'optionalAccess', _285 => _285.nearestDatum, 'optionalAccess', _286 => _286.key])
|
|
4830
5179
|
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4831
5180
|
className: bar_chart_module_default["bar-chart__tooltip-row"],
|
|
4832
5181
|
children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
|
|
@@ -5025,12 +5374,12 @@ var BarChartInternal = ({
|
|
|
5025
5374
|
return null;
|
|
5026
5375
|
}
|
|
5027
5376
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.BarSeries, {
|
|
5028
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess',
|
|
5377
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _287 => _287.label]),
|
|
5029
5378
|
data: seriesData.data,
|
|
5030
5379
|
yAccessor: chartOptions.accessors.yAccessor,
|
|
5031
5380
|
xAccessor: chartOptions.accessors.xAccessor,
|
|
5032
5381
|
colorAccessor: getBarBackground(index)
|
|
5033
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
5382
|
+
}, _optionalChain([seriesData, 'optionalAccess', _288 => _288.label]));
|
|
5034
5383
|
})
|
|
5035
5384
|
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Axis, {
|
|
5036
5385
|
...chartOptions.axis.x
|
|
@@ -5084,7 +5433,7 @@ var BarChartResponsive = attachSubComponents(withResponsive(BarChartWithProvider
|
|
|
5084
5433
|
|
|
5085
5434
|
var getScaleBandwidth2 = (scale) => {
|
|
5086
5435
|
const s = scale;
|
|
5087
|
-
return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
5436
|
+
return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess', _289 => _289.bandwidth, 'call', _290 => _290()]), () => ( 0)) : 0;
|
|
5088
5437
|
};
|
|
5089
5438
|
var DefaultLabelComponent = ({
|
|
5090
5439
|
textProps,
|
|
@@ -5145,7 +5494,7 @@ var AxisRenderer = ({
|
|
|
5145
5494
|
delete textProps.dx;
|
|
5146
5495
|
const sum = data.reduce((acc, {
|
|
5147
5496
|
data: seriesData
|
|
5148
|
-
}) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access',
|
|
5497
|
+
}) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access', _291 => _291[index], 'optionalAccess', _292 => _292.value]), () => ( 0))), 0);
|
|
5149
5498
|
const y = from2.y + yOffset;
|
|
5150
5499
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _group.Group, {
|
|
5151
5500
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelComponent, {
|
|
@@ -5313,7 +5662,7 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5313
5662
|
(stepId) => {
|
|
5314
5663
|
if (clickedStep === stepId) {
|
|
5315
5664
|
setClickedStep(null);
|
|
5316
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5665
|
+
_optionalChain([hideTooltip, 'optionalCall', _293 => _293()]);
|
|
5317
5666
|
} else {
|
|
5318
5667
|
setClickedStep(stepId);
|
|
5319
5668
|
}
|
|
@@ -5326,21 +5675,21 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5326
5675
|
event.preventDefault();
|
|
5327
5676
|
if (clickedStep === stepId) {
|
|
5328
5677
|
setClickedStep(null);
|
|
5329
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5678
|
+
_optionalChain([hideTooltip, 'optionalCall', _294 => _294()]);
|
|
5330
5679
|
} else {
|
|
5331
5680
|
setClickedStep(stepId);
|
|
5332
5681
|
}
|
|
5333
5682
|
} else if (event.key === "Escape") {
|
|
5334
5683
|
event.preventDefault();
|
|
5335
5684
|
setClickedStep(null);
|
|
5336
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5685
|
+
_optionalChain([hideTooltip, 'optionalCall', _295 => _295()]);
|
|
5337
5686
|
}
|
|
5338
5687
|
},
|
|
5339
5688
|
[clickedStep, hideTooltip]
|
|
5340
5689
|
);
|
|
5341
5690
|
const clearSelection = _react.useCallback.call(void 0, () => {
|
|
5342
5691
|
setClickedStep(null);
|
|
5343
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5692
|
+
_optionalChain([hideTooltip, 'optionalCall', _296 => _296()]);
|
|
5344
5693
|
}, [hideTooltip]);
|
|
5345
5694
|
const getStepState = _react.useCallback.call(void 0,
|
|
5346
5695
|
(stepId) => ({
|
|
@@ -5502,7 +5851,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5502
5851
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
5503
5852
|
};
|
|
5504
5853
|
}, [clearSelectionAndRef]);
|
|
5505
|
-
const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess',
|
|
5854
|
+
const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess', _297 => _297.height]))), () => ( "100%"));
|
|
5506
5855
|
const {
|
|
5507
5856
|
primaryColor,
|
|
5508
5857
|
backgroundColor,
|
|
@@ -5517,7 +5866,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5517
5866
|
}) : {
|
|
5518
5867
|
color: primaryColor || "#000000"
|
|
5519
5868
|
};
|
|
5520
|
-
const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess',
|
|
5869
|
+
const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess', _298 => _298.startsWith, 'call', _299 => _299("+")]);
|
|
5521
5870
|
const changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;
|
|
5522
5871
|
const barBackgroundColor = backgroundColor || hexToRgba(barColor, 0.08) || "rgba(0, 0, 0, 0.08)";
|
|
5523
5872
|
const renderDefaultMainMetric = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
|
|
@@ -5548,8 +5897,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
5548
5897
|
const chartMetadata = _react.useMemo.call(void 0, () => ({
|
|
5549
5898
|
mainRate,
|
|
5550
5899
|
changeIndicator,
|
|
5551
|
-
stepsCount: _optionalChain([steps, 'optionalAccess',
|
|
5552
|
-
}), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess',
|
|
5900
|
+
stepsCount: _optionalChain([steps, 'optionalAccess', _300 => _300.length]) || 0
|
|
5901
|
+
}), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess', _301 => _301.length])]);
|
|
5553
5902
|
useChartRegistration({
|
|
5554
5903
|
chartId,
|
|
5555
5904
|
legendItems: [],
|
|
@@ -5635,8 +5984,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
5635
5984
|
direction: "column",
|
|
5636
5985
|
justify: "flex-end",
|
|
5637
5986
|
className: conversion_funnel_chart_module_default["bar-container"],
|
|
5638
|
-
onClick: _optionalChain([stepHandlers, 'access',
|
|
5639
|
-
onKeyDown: _optionalChain([stepHandlers, 'access',
|
|
5987
|
+
onClick: _optionalChain([stepHandlers, 'access', _302 => _302.get, 'call', _303 => _303(step.id), 'optionalAccess', _304 => _304.onClick]),
|
|
5988
|
+
onKeyDown: _optionalChain([stepHandlers, 'access', _305 => _305.get, 'call', _306 => _306(step.id), 'optionalAccess', _307 => _307.onKeyDown]),
|
|
5640
5989
|
role: "button",
|
|
5641
5990
|
tabIndex: isBlurred ? -1 : 0,
|
|
5642
5991
|
"aria-label": step.label,
|
|
@@ -7186,10 +7535,10 @@ var jsx = function jsx2(type, props) {
|
|
|
7186
7535
|
}
|
|
7187
7536
|
return React7.createElement.apply(null, createElementArgArray);
|
|
7188
7537
|
};
|
|
7189
|
-
(function(
|
|
7538
|
+
(function(_jsx33) {
|
|
7190
7539
|
var JSX;
|
|
7191
7540
|
/* @__PURE__ */ (function(_JSX) {
|
|
7192
|
-
})(JSX || (JSX =
|
|
7541
|
+
})(JSX || (JSX = _jsx33.JSX || (_jsx33.JSX = {})));
|
|
7193
7542
|
})(jsx || (jsx = {}));
|
|
7194
7543
|
function css() {
|
|
7195
7544
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -7649,7 +7998,7 @@ function contextConnect(Component2, namespace) {
|
|
|
7649
7998
|
});
|
|
7650
7999
|
}
|
|
7651
8000
|
function _contextConnect(Component2, namespace, options) {
|
|
7652
|
-
const WrappedComponent = _optionalChain([options, 'optionalAccess',
|
|
8001
|
+
const WrappedComponent = _optionalChain([options, 'optionalAccess', _308 => _308.forwardsRef]) ? _react.forwardRef.call(void 0, Component2) : Component2;
|
|
7653
8002
|
if (typeof namespace === "undefined") {
|
|
7654
8003
|
globalThis.SCRIPT_DEBUG === true ? warning("contextConnect: Please provide a namespace") : void 0;
|
|
7655
8004
|
}
|
|
@@ -7685,7 +8034,7 @@ function useContextSystem(props, namespace) {
|
|
|
7685
8034
|
if (typeof namespace === "undefined") {
|
|
7686
8035
|
globalThis.SCRIPT_DEBUG === true ? warning("useContextSystem: Please provide a namespace") : void 0;
|
|
7687
8036
|
}
|
|
7688
|
-
const contextProps = _optionalChain([contextSystemProps, 'optionalAccess',
|
|
8037
|
+
const contextProps = _optionalChain([contextSystemProps, 'optionalAccess', _309 => _309[namespace]]) || {};
|
|
7689
8038
|
const finalComponentProps = {
|
|
7690
8039
|
...getConnectedNamespace(),
|
|
7691
8040
|
...getNamespace(namespace)
|
|
@@ -8066,7 +8415,7 @@ function useLeaderboardLegendItems({
|
|
|
8066
8415
|
overrideColor: primaryColor || leaderboardChartSettings.primaryColor
|
|
8067
8416
|
});
|
|
8068
8417
|
items.push({
|
|
8069
|
-
label: _optionalChain([legendLabels, 'optionalAccess',
|
|
8418
|
+
label: _optionalChain([legendLabels, 'optionalAccess', _310 => _310.primary]) || _i18n.__.call(void 0, "Current period", "jetpack-charts"),
|
|
8070
8419
|
color: resolvedPrimaryColor
|
|
8071
8420
|
});
|
|
8072
8421
|
if (withComparison && !withOverlayLabel) {
|
|
@@ -8075,7 +8424,7 @@ function useLeaderboardLegendItems({
|
|
|
8075
8424
|
overrideColor: secondaryColor || leaderboardChartSettings.secondaryColor
|
|
8076
8425
|
});
|
|
8077
8426
|
items.push({
|
|
8078
|
-
label: _optionalChain([legendLabels, 'optionalAccess',
|
|
8427
|
+
label: _optionalChain([legendLabels, 'optionalAccess', _311 => _311.comparison]) || _i18n.__.call(void 0, "Previous period", "jetpack-charts"),
|
|
8079
8428
|
color: resolvedSecondaryColor
|
|
8080
8429
|
});
|
|
8081
8430
|
}
|
|
@@ -8734,11 +9083,11 @@ var PieChartInternal = ({
|
|
|
8734
9083
|
groupProps.onMouseLeave = onMouseLeave;
|
|
8735
9084
|
}
|
|
8736
9085
|
const svgLabelSmall = providerTheme.svgLabelSmall;
|
|
8737
|
-
const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess',
|
|
9086
|
+
const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess', _312 => _312.fontSize])), () => ( 12));
|
|
8738
9087
|
const estimatedTextWidth = _chunk7OZEQ5HEcjs.getStringWidth.call(void 0, arc.data.label, {
|
|
8739
9088
|
fontSize,
|
|
8740
|
-
fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess',
|
|
8741
|
-
fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess',
|
|
9089
|
+
fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess', _313 => _313.fontFamily]),
|
|
9090
|
+
fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess', _314 => _314.fontWeight])
|
|
8742
9091
|
});
|
|
8743
9092
|
const labelPadding = 6;
|
|
8744
9093
|
const backgroundWidth = estimatedTextWidth + labelPadding * 2;
|
|
@@ -9188,7 +9537,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9188
9537
|
animation
|
|
9189
9538
|
}, ref) => {
|
|
9190
9539
|
const theme = useGlobalChartsTheme();
|
|
9191
|
-
const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access',
|
|
9540
|
+
const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access', _315 => _315.sparkline, 'optionalAccess', _316 => _316.strokeWidth]), () => ( 1.5));
|
|
9192
9541
|
const strokeWidth = _nullishCoalesce(strokeWidthProp, () => ( themeStrokeWidth));
|
|
9193
9542
|
const seriesData = _react.useMemo.call(void 0, () => {
|
|
9194
9543
|
if (!data || data.length === 0) {
|
|
@@ -9197,7 +9546,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9197
9546
|
return transformToSeriesData(data, color, strokeWidth);
|
|
9198
9547
|
}, [data, color, strokeWidth]);
|
|
9199
9548
|
const finalMargin = _react.useMemo.call(void 0, () => {
|
|
9200
|
-
const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access',
|
|
9549
|
+
const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access', _317 => _317.sparkline, 'optionalAccess', _318 => _318.margin]), () => ( {
|
|
9201
9550
|
top: 2,
|
|
9202
9551
|
right: 2,
|
|
9203
9552
|
bottom: 2,
|
|
@@ -9208,7 +9557,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9208
9557
|
...themeMargin,
|
|
9209
9558
|
...margin
|
|
9210
9559
|
};
|
|
9211
|
-
}, [marginProp, _optionalChain([theme, 'access',
|
|
9560
|
+
}, [marginProp, _optionalChain([theme, 'access', _319 => _319.sparkline, 'optionalAccess', _320 => _320.margin])]);
|
|
9212
9561
|
const seriesWithGradient = _react.useMemo.call(void 0, () => {
|
|
9213
9562
|
if (!gradient || seriesData.length === 0) {
|
|
9214
9563
|
return seriesData;
|