@automattic/charts 1.4.3 → 1.5.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 +9 -0
- package/SECURITY.md +0 -1
- package/dist/index.cjs +449 -137
- 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 +747 -435
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/charts/area-chart/area-chart.tsx +24 -10
- package/src/charts/area-chart/test/area-chart.test.tsx +73 -3
- package/src/charts/area-chart/types.ts +15 -0
- package/src/charts/line-chart/line-chart.tsx +16 -5
- 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 +162 -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,126 @@ 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 ZoomResetButton({
|
|
3315
|
+
onClick
|
|
3316
|
+
}) {
|
|
3317
|
+
const label = _i18n.__.call(void 0, "Reset zoom", "jetpack-charts");
|
|
3318
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", {
|
|
3319
|
+
type: "button",
|
|
3320
|
+
className: x_zoom_module_default["x-zoom__reset"],
|
|
3321
|
+
onClick,
|
|
3322
|
+
"aria-label": label,
|
|
3323
|
+
title: label,
|
|
3324
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", {
|
|
3325
|
+
className: x_zoom_module_default["x-zoom__reset-icon"],
|
|
3326
|
+
viewBox: "0 0 24 24",
|
|
3327
|
+
fill: "none",
|
|
3328
|
+
stroke: "currentColor",
|
|
3329
|
+
strokeWidth: "2",
|
|
3330
|
+
strokeLinecap: "round",
|
|
3331
|
+
strokeLinejoin: "round",
|
|
3332
|
+
"aria-hidden": "true",
|
|
3333
|
+
focusable: "false",
|
|
3334
|
+
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", {
|
|
3335
|
+
cx: "10",
|
|
3336
|
+
cy: "10",
|
|
3337
|
+
r: "6"
|
|
3338
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "line", {
|
|
3339
|
+
x1: "15",
|
|
3340
|
+
y1: "15",
|
|
3341
|
+
x2: "20",
|
|
3342
|
+
y2: "20"
|
|
3343
|
+
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "line", {
|
|
3344
|
+
x1: "7",
|
|
3345
|
+
y1: "10",
|
|
3346
|
+
x2: "13",
|
|
3347
|
+
y2: "10"
|
|
3348
|
+
})]
|
|
3349
|
+
})
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3082
3353
|
// src/charts/line-chart/line-chart.module.scss
|
|
3083
3354
|
var line_chart_module_default = {
|
|
3084
3355
|
"line-chart": "a8ccharts-v-oO8E",
|
|
@@ -3209,7 +3480,7 @@ var LineChartAnnotationsOverlay = ({
|
|
|
3209
3480
|
return `${xDomain.join(",")}-${yDomain.join(",")}-${xRange.join(",")}-${yRange.join(",")}`;
|
|
3210
3481
|
}, []);
|
|
3211
3482
|
const getScalesData = _react.useCallback.call(void 0, () => {
|
|
3212
|
-
if (_optionalChain([chartRef, 'optionalAccess',
|
|
3483
|
+
if (_optionalChain([chartRef, 'optionalAccess', _151 => _151.current])) {
|
|
3213
3484
|
const scaleData = chartRef.current.getScales();
|
|
3214
3485
|
if (scaleData) {
|
|
3215
3486
|
const scaleInfo = {
|
|
@@ -3386,7 +3657,7 @@ var LineChartAnnotation = ({
|
|
|
3386
3657
|
const [height, setHeight] = _react.useState.call(void 0, null);
|
|
3387
3658
|
const styles = _deepmerge2.default.call(void 0, _nullishCoalesce(providerTheme.annotationStyles, () => ( {})), _nullishCoalesce(datumStyles, () => ( {})));
|
|
3388
3659
|
_react.useEffect.call(void 0, () => {
|
|
3389
|
-
if (_optionalChain([labelRef, 'access',
|
|
3660
|
+
if (_optionalChain([labelRef, 'access', _152 => _152.current, 'optionalAccess', _153 => _153.getBBox])) {
|
|
3390
3661
|
const bbox = labelRef.current.getBBox();
|
|
3391
3662
|
setHeight(bbox.height);
|
|
3392
3663
|
}
|
|
@@ -3419,7 +3690,7 @@ var LineChartAnnotation = ({
|
|
|
3419
3690
|
y: y2,
|
|
3420
3691
|
yMin: yMin2,
|
|
3421
3692
|
yMax: yMax2,
|
|
3422
|
-
maxWidth: _optionalChain([styles, 'optionalAccess',
|
|
3693
|
+
maxWidth: _optionalChain([styles, 'optionalAccess', _154 => _154.label, 'optionalAccess', _155 => _155.maxWidth]),
|
|
3423
3694
|
height
|
|
3424
3695
|
});
|
|
3425
3696
|
return {
|
|
@@ -3431,7 +3702,7 @@ var LineChartAnnotation = ({
|
|
|
3431
3702
|
xMax: xMax2,
|
|
3432
3703
|
...position2
|
|
3433
3704
|
};
|
|
3434
|
-
}, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess',
|
|
3705
|
+
}, [datum, xScale, yScale, subjectType, _optionalChain([styles, 'optionalAccess', _156 => _156.label, 'optionalAccess', _157 => _157.maxWidth]), height, renderLabel]);
|
|
3435
3706
|
if (!positionData) return null;
|
|
3436
3707
|
const {
|
|
3437
3708
|
x,
|
|
@@ -3446,13 +3717,13 @@ var LineChartAnnotation = ({
|
|
|
3446
3717
|
isFlippedVertically
|
|
3447
3718
|
} = positionData;
|
|
3448
3719
|
const getLabelY = () => {
|
|
3449
|
-
const labelY = _optionalChain([styles, 'optionalAccess',
|
|
3720
|
+
const labelY = _optionalChain([styles, 'optionalAccess', _158 => _158.label, 'optionalAccess', _159 => _159.y]);
|
|
3450
3721
|
if (labelY === "start") return yMax;
|
|
3451
3722
|
if (labelY === "end") return yMin;
|
|
3452
3723
|
return labelY;
|
|
3453
3724
|
};
|
|
3454
3725
|
const getLabelX = () => {
|
|
3455
|
-
const labelX = _optionalChain([styles, 'optionalAccess',
|
|
3726
|
+
const labelX = _optionalChain([styles, 'optionalAccess', _160 => _160.label, 'optionalAccess', _161 => _161.x]);
|
|
3456
3727
|
if (labelX === "start") return xMin;
|
|
3457
3728
|
if (labelX === "end") return xMax;
|
|
3458
3729
|
return labelX;
|
|
@@ -3477,21 +3748,21 @@ var LineChartAnnotation = ({
|
|
|
3477
3748
|
dx,
|
|
3478
3749
|
dy,
|
|
3479
3750
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Connector, {
|
|
3480
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3751
|
+
..._optionalChain([styles, 'optionalAccess', _162 => _162.connector])
|
|
3481
3752
|
}), subjectType === "circle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.CircleSubject, {
|
|
3482
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3753
|
+
..._optionalChain([styles, 'optionalAccess', _163 => _163.circleSubject])
|
|
3483
3754
|
}), subjectType === "line-vertical" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
|
|
3484
3755
|
min: yMax,
|
|
3485
3756
|
max: yMin,
|
|
3486
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3757
|
+
..._optionalChain([styles, 'optionalAccess', _164 => _164.lineSubject]),
|
|
3487
3758
|
orientation: "vertical"
|
|
3488
3759
|
}), subjectType === "line-horizontal" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.LineSubject, {
|
|
3489
3760
|
min: xMin,
|
|
3490
3761
|
max: xMax,
|
|
3491
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3762
|
+
..._optionalChain([styles, 'optionalAccess', _165 => _165.lineSubject]),
|
|
3492
3763
|
orientation: "horizontal"
|
|
3493
3764
|
}), renderLabel ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.HtmlLabel, {
|
|
3494
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3765
|
+
..._optionalChain([styles, 'optionalAccess', _166 => _166.label]),
|
|
3495
3766
|
...labelPosition,
|
|
3496
3767
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
3497
3768
|
style: getSafariHTMLLabelPosition(),
|
|
@@ -3510,7 +3781,7 @@ var LineChartAnnotation = ({
|
|
|
3510
3781
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _annotation.Label, {
|
|
3511
3782
|
title,
|
|
3512
3783
|
subtitle,
|
|
3513
|
-
..._optionalChain([styles, 'optionalAccess',
|
|
3784
|
+
..._optionalChain([styles, 'optionalAccess', _167 => _167.label]),
|
|
3514
3785
|
...labelPosition,
|
|
3515
3786
|
horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),
|
|
3516
3787
|
verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, _nullishCoalesce(height, () => ( ANNOTATION_INIT_HEIGHT)))
|
|
@@ -3547,7 +3818,7 @@ var LineChartGlyph = ({
|
|
|
3547
3818
|
const x = xScale(accessors.xAccessor(point));
|
|
3548
3819
|
const y = yScale(accessors.yAccessor(point));
|
|
3549
3820
|
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
3550
|
-
const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess',
|
|
3821
|
+
const size = Math.max(0, _nullishCoalesce(toNumber(_optionalChain([glyphStyle, 'optionalAccess', _168 => _168.radius])), () => ( 4)));
|
|
3551
3822
|
return renderGlyph({
|
|
3552
3823
|
key: `${position2}-glyph-${data.label}`,
|
|
3553
3824
|
index,
|
|
@@ -3578,9 +3849,9 @@ var renderDefaultTooltip = (params) => {
|
|
|
3578
3849
|
const {
|
|
3579
3850
|
tooltipData
|
|
3580
3851
|
} = params;
|
|
3581
|
-
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess',
|
|
3852
|
+
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _169 => _169.nearestDatum, 'optionalAccess', _170 => _170.datum]);
|
|
3582
3853
|
if (!nearestDatum) return null;
|
|
3583
|
-
const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess',
|
|
3854
|
+
const tooltipPoints = Object.entries(_optionalChain([tooltipData, 'optionalAccess', _171 => _171.datumByKey]) || {}).map(([key, {
|
|
3584
3855
|
datum
|
|
3585
3856
|
}]) => ({
|
|
3586
3857
|
key,
|
|
@@ -3590,7 +3861,7 @@ var renderDefaultTooltip = (params) => {
|
|
|
3590
3861
|
className: line_chart_module_default["line-chart__tooltip"],
|
|
3591
3862
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
3592
3863
|
className: line_chart_module_default["line-chart__tooltip-date"],
|
|
3593
|
-
children: _optionalChain([nearestDatum, 'access',
|
|
3864
|
+
children: _optionalChain([nearestDatum, 'access', _172 => _172.date, 'optionalAccess', _173 => _173.toLocaleDateString, 'call', _174 => _174()])
|
|
3594
3865
|
}), tooltipPoints.map((point) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Stack, {
|
|
3595
3866
|
direction: "row",
|
|
3596
3867
|
align: "center",
|
|
@@ -3607,7 +3878,7 @@ var renderDefaultTooltip = (params) => {
|
|
|
3607
3878
|
});
|
|
3608
3879
|
};
|
|
3609
3880
|
var validateData = (data) => {
|
|
3610
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
3881
|
+
if (!_optionalChain([data, 'optionalAccess', _175 => _175.length])) return "No data available";
|
|
3611
3882
|
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
3883
|
if (hasInvalidData) return "Invalid data";
|
|
3613
3884
|
return null;
|
|
@@ -3621,7 +3892,7 @@ var LineChartScalesRef = ({
|
|
|
3621
3892
|
const context = _react.useContext.call(void 0, _xychart.DataContext);
|
|
3622
3893
|
_react.useImperativeHandle.call(void 0, chartRef, () => ({
|
|
3623
3894
|
getScales: () => {
|
|
3624
|
-
if (!_optionalChain([context, 'optionalAccess',
|
|
3895
|
+
if (!_optionalChain([context, 'optionalAccess', _176 => _176.xScale]) || !_optionalChain([context, 'optionalAccess', _177 => _177.yScale])) {
|
|
3625
3896
|
return null;
|
|
3626
3897
|
}
|
|
3627
3898
|
return {
|
|
@@ -3663,6 +3934,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3663
3934
|
onPointerUp = void 0,
|
|
3664
3935
|
onPointerMove = void 0,
|
|
3665
3936
|
onPointerOut = void 0,
|
|
3937
|
+
zoomable = false,
|
|
3666
3938
|
children,
|
|
3667
3939
|
gridVisibility,
|
|
3668
3940
|
gap = "md"
|
|
@@ -3677,6 +3949,15 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3677
3949
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
3678
3950
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
3679
3951
|
const internalChartRef = _react.useRef.call(void 0, null);
|
|
3952
|
+
const zoom = useXZoom({
|
|
3953
|
+
enabled: zoomable,
|
|
3954
|
+
chartRef: internalChartRef,
|
|
3955
|
+
userHandlers: {
|
|
3956
|
+
onPointerDown,
|
|
3957
|
+
onPointerMove,
|
|
3958
|
+
onPointerUp
|
|
3959
|
+
}
|
|
3960
|
+
});
|
|
3680
3961
|
const {
|
|
3681
3962
|
legendChildren,
|
|
3682
3963
|
nonLegendChildren
|
|
@@ -3687,8 +3968,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3687
3968
|
setMeasuredChartHeight(chartHeight);
|
|
3688
3969
|
}, [height]);
|
|
3689
3970
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
3690
|
-
getScales: () => _optionalChain([internalChartRef, 'access',
|
|
3691
|
-
getChartDimensions: () => _optionalChain([internalChartRef, 'access',
|
|
3971
|
+
getScales: () => _optionalChain([internalChartRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.getScales, 'call', _180 => _180()]) || null,
|
|
3972
|
+
getChartDimensions: () => _optionalChain([internalChartRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.getChartDimensions, 'call', _183 => _183()]) || {
|
|
3692
3973
|
width: 0,
|
|
3693
3974
|
height: 0,
|
|
3694
3975
|
margin: {}
|
|
@@ -3729,10 +4010,10 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3729
4010
|
isNavigating,
|
|
3730
4011
|
setIsNavigating,
|
|
3731
4012
|
chartRef,
|
|
3732
|
-
totalPoints: _optionalChain([dataSorted, 'access',
|
|
4013
|
+
totalPoints: _optionalChain([dataSorted, 'access', _184 => _184[0], 'optionalAccess', _185 => _185.data, 'access', _186 => _186.length]) || 0
|
|
3733
4014
|
});
|
|
3734
4015
|
const chartOptions = _react.useMemo.call(void 0, () => {
|
|
3735
|
-
const formatter = _optionalChain([options, 'optionalAccess',
|
|
4016
|
+
const formatter = _optionalChain([options, 'optionalAccess', _187 => _187.axis, 'optionalAccess', _188 => _188.x, 'optionalAccess', _189 => _189.tickFormat]) || getFormatter(dataSorted);
|
|
3736
4017
|
return {
|
|
3737
4018
|
axis: {
|
|
3738
4019
|
x: {
|
|
@@ -3740,28 +4021,31 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3740
4021
|
numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
|
|
3741
4022
|
tickFormat: formatter,
|
|
3742
4023
|
display: true,
|
|
3743
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4024
|
+
..._optionalChain([options, 'optionalAccess', _190 => _190.axis, 'optionalAccess', _191 => _191.x])
|
|
3744
4025
|
},
|
|
3745
4026
|
y: {
|
|
3746
4027
|
orientation: "left",
|
|
3747
4028
|
numTicks: 4,
|
|
3748
4029
|
tickFormat: _numberformatters.formatNumberCompact,
|
|
3749
4030
|
display: true,
|
|
3750
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4031
|
+
..._optionalChain([options, 'optionalAccess', _192 => _192.axis, 'optionalAccess', _193 => _193.y])
|
|
3751
4032
|
}
|
|
3752
4033
|
},
|
|
3753
4034
|
xScale: {
|
|
3754
4035
|
type: "time",
|
|
3755
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4036
|
+
..._optionalChain([options, 'optionalAccess', _194 => _194.xScale]),
|
|
4037
|
+
...zoom.domain ? {
|
|
4038
|
+
domain: zoom.domain
|
|
4039
|
+
} : {}
|
|
3756
4040
|
},
|
|
3757
4041
|
yScale: {
|
|
3758
4042
|
type: "linear",
|
|
3759
4043
|
nice: true,
|
|
3760
4044
|
zero: false,
|
|
3761
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4045
|
+
..._optionalChain([options, 'optionalAccess', _195 => _195.yScale])
|
|
3762
4046
|
}
|
|
3763
4047
|
};
|
|
3764
|
-
}, [options, dataSorted, width]);
|
|
4048
|
+
}, [options, dataSorted, width, zoom.domain]);
|
|
3765
4049
|
const tooltipRenderGlyph = _react.useMemo.call(void 0, () => {
|
|
3766
4050
|
return (props) => {
|
|
3767
4051
|
const seriesIndex = dataSorted.findIndex((series) => series.label === props.key || series.data.includes(props.datum));
|
|
@@ -3785,9 +4069,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3785
4069
|
const isDataValid = !error;
|
|
3786
4070
|
const legendOptions = _react.useMemo.call(void 0, () => ({
|
|
3787
4071
|
withGlyph: withLegendGlyph,
|
|
3788
|
-
glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess',
|
|
4072
|
+
glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _196 => _196.radius])), () => ( 4))),
|
|
3789
4073
|
renderGlyph
|
|
3790
|
-
}), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess',
|
|
4074
|
+
}), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _197 => _197.radius]), renderGlyph]);
|
|
3791
4075
|
const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);
|
|
3792
4076
|
const chartMetadata = _react.useMemo.call(void 0, () => ({
|
|
3793
4077
|
withGradientFill,
|
|
@@ -3806,8 +4090,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3806
4090
|
});
|
|
3807
4091
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
3808
4092
|
const accessors = {
|
|
3809
|
-
xAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
3810
|
-
yAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4093
|
+
xAccessor: (d) => _optionalChain([d, 'optionalAccess', _198 => _198.date]),
|
|
4094
|
+
yAccessor: (d) => _optionalChain([d, 'optionalAccess', _199 => _199.value])
|
|
3811
4095
|
};
|
|
3812
4096
|
if (error) {
|
|
3813
4097
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
@@ -3860,9 +4144,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3860
4144
|
onKeyDown: onChartKeyDown,
|
|
3861
4145
|
onFocus: onChartFocus,
|
|
3862
4146
|
onBlur: onChartBlur,
|
|
3863
|
-
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.
|
|
4147
|
+
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
3864
4148
|
ref: chartRef,
|
|
3865
|
-
|
|
4149
|
+
style: {
|
|
4150
|
+
position: "relative"
|
|
4151
|
+
},
|
|
4152
|
+
children: [zoomable && zoom.domain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomResetButton, {
|
|
4153
|
+
onClick: zoom.reset
|
|
4154
|
+
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _xychart.XYChart, {
|
|
3866
4155
|
theme,
|
|
3867
4156
|
width,
|
|
3868
4157
|
height: chartHeight,
|
|
@@ -3872,9 +4161,9 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3872
4161
|
},
|
|
3873
4162
|
xScale: chartOptions.xScale,
|
|
3874
4163
|
yScale: chartOptions.yScale,
|
|
3875
|
-
onPointerDown,
|
|
3876
|
-
onPointerUp,
|
|
3877
|
-
onPointerMove,
|
|
4164
|
+
onPointerDown: zoom.handlers.onPointerDown,
|
|
4165
|
+
onPointerUp: zoom.handlers.onPointerUp,
|
|
4166
|
+
onPointerMove: zoom.handlers.onPointerMove,
|
|
3878
4167
|
onPointerOut,
|
|
3879
4168
|
pointerEventsDataKey: "nearest",
|
|
3880
4169
|
children: [gridVisibility !== "none" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Grid, {
|
|
@@ -3917,21 +4206,21 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3917
4206
|
fromOpacity: 0.4,
|
|
3918
4207
|
toOpacity: 0.1,
|
|
3919
4208
|
to: providerTheme.backgroundColor,
|
|
3920
|
-
..._optionalChain([seriesData, 'access',
|
|
3921
|
-
children: _optionalChain([seriesData, 'access',
|
|
4209
|
+
..._optionalChain([seriesData, 'access', _200 => _200.options, 'optionalAccess', _201 => _201.gradient]),
|
|
4210
|
+
children: _optionalChain([seriesData, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.gradient, 'optionalAccess', _204 => _204.stops, 'optionalAccess', _205 => _205.map, 'call', _206 => _206((stop, stopIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", {
|
|
3922
4211
|
offset: stop.offset,
|
|
3923
4212
|
stopColor: stop.color || color,
|
|
3924
4213
|
stopOpacity: _nullishCoalesce(stop.opacity, () => ( 1))
|
|
3925
4214
|
}, `${stop.offset}-${stop.color || color}`))])
|
|
3926
4215
|
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AreaSeries, {
|
|
3927
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess',
|
|
4216
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _207 => _207.label]),
|
|
3928
4217
|
data: seriesData.data,
|
|
3929
4218
|
...accessors,
|
|
3930
4219
|
fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : "transparent",
|
|
3931
4220
|
renderLine: true,
|
|
3932
4221
|
curve: getCurveType(curveType, smoothing),
|
|
3933
4222
|
lineProps
|
|
3934
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
4223
|
+
}, _optionalChain([seriesData, 'optionalAccess', _208 => _208.label])), withStartGlyphs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, line_chart_glyph_default, {
|
|
3935
4224
|
index,
|
|
3936
4225
|
data: seriesData,
|
|
3937
4226
|
color,
|
|
@@ -3948,7 +4237,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3948
4237
|
glyphStyle,
|
|
3949
4238
|
position: "end"
|
|
3950
4239
|
})]
|
|
3951
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
4240
|
+
}, _optionalChain([seriesData, 'optionalAccess', _209 => _209.label]) || index);
|
|
3952
4241
|
}), withTooltips && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AccessibleTooltip, {
|
|
3953
4242
|
detectBounds: true,
|
|
3954
4243
|
snapTooltipToDatumX: true,
|
|
@@ -3957,8 +4246,8 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3957
4246
|
renderTooltip,
|
|
3958
4247
|
renderGlyph: tooltipRenderGlyph,
|
|
3959
4248
|
glyphStyle,
|
|
3960
|
-
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
3961
|
-
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4249
|
+
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _210 => _210.showVertical]),
|
|
4250
|
+
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _211 => _211.showHorizontal]),
|
|
3962
4251
|
selectedIndex,
|
|
3963
4252
|
tooltipRef,
|
|
3964
4253
|
keyboardFocusedClassName: line_chart_module_default["line-chart__tooltip--keyboard-focused"],
|
|
@@ -3968,8 +4257,10 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
3968
4257
|
width,
|
|
3969
4258
|
height,
|
|
3970
4259
|
margin
|
|
4260
|
+
}), zoomable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomSelectionRect, {
|
|
4261
|
+
drag: zoom.drag
|
|
3971
4262
|
})]
|
|
3972
|
-
})
|
|
4263
|
+
})]
|
|
3973
4264
|
})
|
|
3974
4265
|
});
|
|
3975
4266
|
}
|
|
@@ -4013,8 +4304,8 @@ var area_chart_module_default = {
|
|
|
4013
4304
|
// src/charts/area-chart/private/validate-data.ts
|
|
4014
4305
|
|
|
4015
4306
|
var validateData2 = (data) => {
|
|
4016
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
4017
|
-
const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access',
|
|
4307
|
+
if (!_optionalChain([data, 'optionalAccess', _212 => _212.length])) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
|
|
4308
|
+
const hasEmptySeries = data.some((series) => !_optionalChain([series, 'access', _213 => _213.data, 'optionalAccess', _214 => _214.length]));
|
|
4018
4309
|
if (hasEmptySeries) return _i18n.__.call(void 0, "No data available", "jetpack-charts");
|
|
4019
4310
|
const hasInvalidData = data.some(
|
|
4020
4311
|
(series) => series.data.some(
|
|
@@ -4038,7 +4329,7 @@ var AreaChartScalesRef = ({
|
|
|
4038
4329
|
const context = _react.useContext.call(void 0, _xychart.DataContext);
|
|
4039
4330
|
_react.useImperativeHandle.call(void 0, chartRef, () => ({
|
|
4040
4331
|
getScales: () => {
|
|
4041
|
-
if (!_optionalChain([context, 'optionalAccess',
|
|
4332
|
+
if (!_optionalChain([context, 'optionalAccess', _215 => _215.xScale]) || !_optionalChain([context, 'optionalAccess', _216 => _216.yScale])) return null;
|
|
4042
4333
|
return {
|
|
4043
4334
|
xScale: context.xScale,
|
|
4044
4335
|
yScale: context.yScale
|
|
@@ -4061,10 +4352,10 @@ var HoverGlyphs = ({
|
|
|
4061
4352
|
}) => {
|
|
4062
4353
|
const dataContext = _react.useContext.call(void 0, _xychart.DataContext);
|
|
4063
4354
|
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',
|
|
4355
|
+
const xScale = _optionalChain([dataContext, 'optionalAccess', _217 => _217.xScale]);
|
|
4356
|
+
const yScale = _optionalChain([dataContext, 'optionalAccess', _218 => _218.yScale]);
|
|
4357
|
+
const tooltipOpen = _optionalChain([tooltipContext, 'optionalAccess', _219 => _219.tooltipOpen]);
|
|
4358
|
+
const nearestDatum = _optionalChain([tooltipContext, 'optionalAccess', _220 => _220.tooltipData, 'optionalAccess', _221 => _221.nearestDatum, 'optionalAccess', _222 => _222.datum]);
|
|
4068
4359
|
if (!tooltipOpen || !xScale || !yScale || !nearestDatum || !nearestDatum.date || stacked && stackOffset !== "none") {
|
|
4069
4360
|
return null;
|
|
4070
4361
|
}
|
|
@@ -4077,8 +4368,8 @@ var HoverGlyphs = ({
|
|
|
4077
4368
|
series,
|
|
4078
4369
|
index
|
|
4079
4370
|
} of visibleSeries) {
|
|
4080
|
-
const datum = series.data.find((d) => _optionalChain([d, 'access',
|
|
4081
|
-
const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess',
|
|
4371
|
+
const datum = series.data.find((d) => _optionalChain([d, 'access', _223 => _223.date, 'optionalAccess', _224 => _224.getTime, 'call', _225 => _225()]) === hoveredTime);
|
|
4372
|
+
const value = _nullishCoalesce(_optionalChain([datum, 'optionalAccess', _226 => _226.value]), () => ( 0));
|
|
4082
4373
|
if (stacked) {
|
|
4083
4374
|
cumulative += value;
|
|
4084
4375
|
}
|
|
@@ -4137,6 +4428,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4137
4428
|
onPointerUp,
|
|
4138
4429
|
onPointerMove,
|
|
4139
4430
|
onPointerOut,
|
|
4431
|
+
zoomable = false,
|
|
4432
|
+
rescaleYOnLegendToggle = true,
|
|
4140
4433
|
children,
|
|
4141
4434
|
gridVisibility,
|
|
4142
4435
|
gap = "md"
|
|
@@ -4151,6 +4444,15 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4151
4444
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
4152
4445
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
4153
4446
|
const internalChartRef = _react.useRef.call(void 0, null);
|
|
4447
|
+
const zoom = useXZoom({
|
|
4448
|
+
enabled: zoomable,
|
|
4449
|
+
chartRef: internalChartRef,
|
|
4450
|
+
userHandlers: {
|
|
4451
|
+
onPointerDown,
|
|
4452
|
+
onPointerMove,
|
|
4453
|
+
onPointerUp
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4154
4456
|
const {
|
|
4155
4457
|
legendChildren,
|
|
4156
4458
|
nonLegendChildren
|
|
@@ -4161,8 +4463,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4161
4463
|
setMeasuredChartHeight(chartHeight);
|
|
4162
4464
|
}, [height]);
|
|
4163
4465
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
4164
|
-
getScales: () => _optionalChain([internalChartRef, 'access',
|
|
4165
|
-
getChartDimensions: () => _optionalChain([internalChartRef, 'access',
|
|
4466
|
+
getScales: () => _optionalChain([internalChartRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.getScales, 'call', _229 => _229()]) || null,
|
|
4467
|
+
getChartDimensions: () => _optionalChain([internalChartRef, 'access', _230 => _230.current, 'optionalAccess', _231 => _231.getChartDimensions, 'call', _232 => _232()]) || {
|
|
4166
4468
|
width: 0,
|
|
4167
4469
|
height: 0,
|
|
4168
4470
|
margin: {}
|
|
@@ -4201,10 +4503,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4201
4503
|
isNavigating,
|
|
4202
4504
|
setIsNavigating,
|
|
4203
4505
|
chartRef,
|
|
4204
|
-
totalPoints: _optionalChain([dataSorted, 'access',
|
|
4506
|
+
totalPoints: _optionalChain([dataSorted, 'access', _233 => _233[0], 'optionalAccess', _234 => _234.data, 'access', _235 => _235.length]) || 0
|
|
4205
4507
|
});
|
|
4206
4508
|
const fixedYDomain = _react.useMemo.call(void 0, () => {
|
|
4207
|
-
if (!legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
|
|
4509
|
+
if (rescaleYOnLegendToggle || !legendInteractive || !dataSorted.length || !dataSorted[0].data.length || stacked && stackOffset !== "none") {
|
|
4208
4510
|
return void 0;
|
|
4209
4511
|
}
|
|
4210
4512
|
if (stacked) {
|
|
@@ -4215,7 +4517,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4215
4517
|
let posSum = 0;
|
|
4216
4518
|
let negSum = 0;
|
|
4217
4519
|
for (const series of dataSorted) {
|
|
4218
|
-
const v = Number(_optionalChain([series, 'access',
|
|
4520
|
+
const v = Number(_optionalChain([series, 'access', _236 => _236.data, 'access', _237 => _237[i], 'optionalAccess', _238 => _238.value]));
|
|
4219
4521
|
if (Number.isNaN(v)) continue;
|
|
4220
4522
|
if (v >= 0) posSum += v;
|
|
4221
4523
|
else negSum += v;
|
|
@@ -4229,7 +4531,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4229
4531
|
let min = Infinity;
|
|
4230
4532
|
for (const series of dataSorted) {
|
|
4231
4533
|
for (const point of series.data) {
|
|
4232
|
-
const v = Number(_optionalChain([point, 'optionalAccess',
|
|
4534
|
+
const v = Number(_optionalChain([point, 'optionalAccess', _239 => _239.value]));
|
|
4233
4535
|
if (!Number.isNaN(v)) {
|
|
4234
4536
|
if (v > max) max = v;
|
|
4235
4537
|
if (v < min) min = v;
|
|
@@ -4238,9 +4540,9 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4238
4540
|
}
|
|
4239
4541
|
if (max === -Infinity) return void 0;
|
|
4240
4542
|
return [Math.min(0, min), max];
|
|
4241
|
-
}, [dataSorted, stacked, stackOffset, legendInteractive]);
|
|
4543
|
+
}, [dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle]);
|
|
4242
4544
|
const chartOptions = _react.useMemo.call(void 0, () => {
|
|
4243
|
-
const formatter = _optionalChain([options, 'optionalAccess',
|
|
4545
|
+
const formatter = _optionalChain([options, 'optionalAccess', _240 => _240.axis, 'optionalAccess', _241 => _241.x, 'optionalAccess', _242 => _242.tickFormat]) || getFormatter(dataSorted);
|
|
4244
4546
|
return {
|
|
4245
4547
|
axis: {
|
|
4246
4548
|
x: {
|
|
@@ -4248,19 +4550,22 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4248
4550
|
numTicks: guessOptimalNumTicks(dataSorted, width, formatter),
|
|
4249
4551
|
tickFormat: formatter,
|
|
4250
4552
|
display: true,
|
|
4251
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4553
|
+
..._optionalChain([options, 'optionalAccess', _243 => _243.axis, 'optionalAccess', _244 => _244.x])
|
|
4252
4554
|
},
|
|
4253
4555
|
y: {
|
|
4254
4556
|
orientation: "left",
|
|
4255
4557
|
numTicks: 4,
|
|
4256
4558
|
tickFormat: _numberformatters.formatNumberCompact,
|
|
4257
4559
|
display: true,
|
|
4258
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4560
|
+
..._optionalChain([options, 'optionalAccess', _245 => _245.axis, 'optionalAccess', _246 => _246.y])
|
|
4259
4561
|
}
|
|
4260
4562
|
},
|
|
4261
4563
|
xScale: {
|
|
4262
4564
|
type: "time",
|
|
4263
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4565
|
+
..._optionalChain([options, 'optionalAccess', _247 => _247.xScale]),
|
|
4566
|
+
...zoom.domain ? {
|
|
4567
|
+
domain: zoom.domain
|
|
4568
|
+
} : {}
|
|
4264
4569
|
},
|
|
4265
4570
|
yScale: {
|
|
4266
4571
|
type: "linear",
|
|
@@ -4270,10 +4575,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4270
4575
|
...fixedYDomain ? {
|
|
4271
4576
|
domain: fixedYDomain
|
|
4272
4577
|
} : {},
|
|
4273
|
-
..._optionalChain([options, 'optionalAccess',
|
|
4578
|
+
..._optionalChain([options, 'optionalAccess', _248 => _248.yScale])
|
|
4274
4579
|
}
|
|
4275
4580
|
};
|
|
4276
|
-
}, [options, dataSorted, width, stacked, fixedYDomain]);
|
|
4581
|
+
}, [options, dataSorted, width, stacked, fixedYDomain, zoom.domain]);
|
|
4277
4582
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);
|
|
4278
4583
|
const error = validateData2(dataSorted);
|
|
4279
4584
|
const isDataValid = !error;
|
|
@@ -4298,21 +4603,21 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4298
4603
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
4299
4604
|
const animationEnabled = !!animation && !prefersReducedMotion;
|
|
4300
4605
|
const accessors = {
|
|
4301
|
-
xAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4302
|
-
yAccessor: (d) => _optionalChain([d, 'optionalAccess',
|
|
4606
|
+
xAccessor: (d) => _optionalChain([d, 'optionalAccess', _249 => _249.date]),
|
|
4607
|
+
yAccessor: (d) => _optionalChain([d, 'optionalAccess', _250 => _250.value])
|
|
4303
4608
|
};
|
|
4304
4609
|
const zeroYAccessor = _react.useCallback.call(void 0, () => 0, []);
|
|
4305
4610
|
const visibleLabels = _react.useMemo.call(void 0, () => new Set(seriesWithVisibility.filter((s) => s.isVisible).map((s) => s.series.label)), [seriesWithVisibility]);
|
|
4306
4611
|
const filteredRenderTooltip = _react.useCallback.call(void 0, (params) => {
|
|
4307
4612
|
if (!legendInteractive) return renderTooltip(params);
|
|
4308
|
-
const datumByKey = _optionalChain([params, 'optionalAccess',
|
|
4613
|
+
const datumByKey = _optionalChain([params, 'optionalAccess', _251 => _251.tooltipData, 'optionalAccess', _252 => _252.datumByKey]);
|
|
4309
4614
|
if (!datumByKey) return renderTooltip(params);
|
|
4310
4615
|
const filtered = Object.fromEntries(Object.entries(datumByKey).filter(([key]) => visibleLabels.has(key)));
|
|
4311
4616
|
if (Object.keys(filtered).length === 0) return null;
|
|
4312
|
-
const nearestDatum = _optionalChain([params, 'optionalAccess',
|
|
4617
|
+
const nearestDatum = _optionalChain([params, 'optionalAccess', _253 => _253.tooltipData, 'optionalAccess', _254 => _254.nearestDatum]);
|
|
4313
4618
|
const nextNearest = nearestDatum && visibleLabels.has(nearestDatum.key) ? nearestDatum : {
|
|
4314
4619
|
...Object.values(filtered)[0],
|
|
4315
|
-
distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess',
|
|
4620
|
+
distance: _nullishCoalesce(_optionalChain([nearestDatum, 'optionalAccess', _255 => _255.distance]), () => ( 0))
|
|
4316
4621
|
};
|
|
4317
4622
|
return renderTooltip({
|
|
4318
4623
|
...params,
|
|
@@ -4361,7 +4666,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4361
4666
|
index
|
|
4362
4667
|
});
|
|
4363
4668
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.AnimatedAreaSeries, {
|
|
4364
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess',
|
|
4669
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _256 => _256.label]),
|
|
4365
4670
|
data: seriesData.data,
|
|
4366
4671
|
xAccessor: accessors.xAccessor,
|
|
4367
4672
|
yAccessor: isVisible || !legendInteractive ? accessors.yAccessor : zeroYAccessor,
|
|
@@ -4375,7 +4680,7 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4375
4680
|
stroke: color,
|
|
4376
4681
|
...lineStyles
|
|
4377
4682
|
}
|
|
4378
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
4683
|
+
}, _optionalChain([seriesData, 'optionalAccess', _257 => _257.label]) || index);
|
|
4379
4684
|
};
|
|
4380
4685
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SingleChartContext.Provider, {
|
|
4381
4686
|
value: {
|
|
@@ -4409,9 +4714,14 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4409
4714
|
onKeyDown: onChartKeyDown,
|
|
4410
4715
|
onFocus: onChartFocus,
|
|
4411
4716
|
onBlur: onChartBlur,
|
|
4412
|
-
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.
|
|
4717
|
+
children: chartHeight > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4413
4718
|
ref: chartRef,
|
|
4414
|
-
|
|
4719
|
+
style: {
|
|
4720
|
+
position: "relative"
|
|
4721
|
+
},
|
|
4722
|
+
children: [zoomable && zoom.domain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomResetButton, {
|
|
4723
|
+
onClick: zoom.reset
|
|
4724
|
+
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _xychart.XYChart, {
|
|
4415
4725
|
theme,
|
|
4416
4726
|
width,
|
|
4417
4727
|
height: chartHeight,
|
|
@@ -4421,9 +4731,9 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4421
4731
|
},
|
|
4422
4732
|
xScale: chartOptions.xScale,
|
|
4423
4733
|
yScale: chartOptions.yScale,
|
|
4424
|
-
onPointerDown,
|
|
4425
|
-
onPointerUp,
|
|
4426
|
-
onPointerMove,
|
|
4734
|
+
onPointerDown: zoom.handlers.onPointerDown,
|
|
4735
|
+
onPointerUp: zoom.handlers.onPointerUp,
|
|
4736
|
+
onPointerMove: zoom.handlers.onPointerMove,
|
|
4427
4737
|
onPointerOut,
|
|
4428
4738
|
pointerEventsDataKey: "nearest",
|
|
4429
4739
|
children: [gridVisibility !== "none" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Grid, {
|
|
@@ -4450,8 +4760,8 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4450
4760
|
snapTooltipToDatumX: true,
|
|
4451
4761
|
snapTooltipToDatumY: !stacked,
|
|
4452
4762
|
renderTooltip: filteredRenderTooltip,
|
|
4453
|
-
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4454
|
-
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess',
|
|
4763
|
+
showVerticalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _258 => _258.showVertical]),
|
|
4764
|
+
showHorizontalCrosshair: _optionalChain([withTooltipCrosshairs, 'optionalAccess', _259 => _259.showHorizontal]),
|
|
4455
4765
|
selectedIndex,
|
|
4456
4766
|
tooltipRef,
|
|
4457
4767
|
keyboardFocusedClassName: area_chart_module_default["area-chart__tooltip--keyboard-focused"],
|
|
@@ -4468,8 +4778,10 @@ var AreaChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
4468
4778
|
width,
|
|
4469
4779
|
height: height || chartHeight,
|
|
4470
4780
|
margin
|
|
4781
|
+
}), zoomable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ZoomSelectionRect, {
|
|
4782
|
+
drag: zoom.drag
|
|
4471
4783
|
})]
|
|
4472
|
-
})
|
|
4784
|
+
})]
|
|
4473
4785
|
})
|
|
4474
4786
|
});
|
|
4475
4787
|
}
|
|
@@ -4642,12 +4954,12 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4642
4954
|
nice: true,
|
|
4643
4955
|
zero: false
|
|
4644
4956
|
};
|
|
4645
|
-
const labelFormatter = _optionalChain([data, 'optionalAccess',
|
|
4957
|
+
const labelFormatter = _optionalChain([data, 'optionalAccess', _260 => _260[0], 'optionalAccess', _261 => _261.data, 'optionalAccess', _262 => _262[0], 'optionalAccess', _263 => _263.label]) ? (label) => label : formatDateTick2;
|
|
4646
4958
|
const valueFormatter = _numberformatters.formatNumberCompact;
|
|
4647
|
-
const labelAccessor = (d) => _optionalChain([d, 'optionalAccess',
|
|
4959
|
+
const labelAccessor = (d) => _optionalChain([d, 'optionalAccess', _264 => _264.label]) || _optionalChain([d, 'optionalAccess', _265 => _265.date]);
|
|
4648
4960
|
const valueAccessor = (d) => {
|
|
4649
4961
|
const enhancedPoint = d;
|
|
4650
|
-
return _optionalChain([enhancedPoint, 'optionalAccess',
|
|
4962
|
+
return _optionalChain([enhancedPoint, 'optionalAccess', _266 => _266.visualValue]) !== void 0 ? enhancedPoint.visualValue : _optionalChain([d, 'optionalAccess', _267 => _267.value]);
|
|
4651
4963
|
};
|
|
4652
4964
|
return {
|
|
4653
4965
|
vertical: {
|
|
@@ -4686,9 +4998,9 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4686
4998
|
} = defaultOptions[orientationKey];
|
|
4687
4999
|
const xScale = { ...baseXScale, ...options.xScale || {} };
|
|
4688
5000
|
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',
|
|
5001
|
+
const providedToolTipLabelFormatter = horizontal ? _optionalChain([options, 'access', _268 => _268.axis, 'optionalAccess', _269 => _269.y, 'optionalAccess', _270 => _270.tickFormat]) : _optionalChain([options, 'access', _271 => _271.axis, 'optionalAccess', _272 => _272.x, 'optionalAccess', _273 => _273.tickFormat]);
|
|
5002
|
+
const { labelOverflow: xLabelOverflow, ...xAxisOptions } = _optionalChain([options, 'access', _274 => _274.axis, 'optionalAccess', _275 => _275.x]) || {};
|
|
5003
|
+
const { labelOverflow: yLabelOverflow, ...yAxisOptions } = _optionalChain([options, 'access', _276 => _276.axis, 'optionalAccess', _277 => _277.y]) || {};
|
|
4692
5004
|
return {
|
|
4693
5005
|
gridVisibility,
|
|
4694
5006
|
xScale,
|
|
@@ -4726,7 +5038,7 @@ function useBarChartOptions(data, horizontal, options = {}) {
|
|
|
4726
5038
|
// src/charts/bar-chart/bar-chart.tsx
|
|
4727
5039
|
|
|
4728
5040
|
var validateData3 = (data) => {
|
|
4729
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
5041
|
+
if (!_optionalChain([data, 'optionalAccess', _278 => _278.length])) return "No data available";
|
|
4730
5042
|
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
5043
|
if (hasInvalidData) return "Invalid data";
|
|
4732
5044
|
return null;
|
|
@@ -4776,7 +5088,7 @@ var BarChartInternal = ({
|
|
|
4776
5088
|
}, [height]);
|
|
4777
5089
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
4778
5090
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
4779
|
-
const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access',
|
|
5091
|
+
const totalPoints = Math.max(0, ...data.map((series) => _optionalChain([series, 'access', _279 => _279.data, 'optionalAccess', _280 => _280.length]) || 0)) * data.length;
|
|
4780
5092
|
const {
|
|
4781
5093
|
tooltipRef,
|
|
4782
5094
|
onChartFocus,
|
|
@@ -4820,13 +5132,13 @@ var BarChartInternal = ({
|
|
|
4820
5132
|
const renderDefaultTooltip2 = _react.useCallback.call(void 0, ({
|
|
4821
5133
|
tooltipData
|
|
4822
5134
|
}) => {
|
|
4823
|
-
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess',
|
|
5135
|
+
const nearestDatum = _optionalChain([tooltipData, 'optionalAccess', _281 => _281.nearestDatum, 'optionalAccess', _282 => _282.datum]);
|
|
4824
5136
|
if (!nearestDatum) return null;
|
|
4825
5137
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4826
5138
|
className: bar_chart_module_default["bar-chart__tooltip"],
|
|
4827
5139
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
4828
5140
|
className: bar_chart_module_default["bar-chart__tooltip-header"],
|
|
4829
|
-
children: _optionalChain([tooltipData, 'optionalAccess',
|
|
5141
|
+
children: _optionalChain([tooltipData, 'optionalAccess', _283 => _283.nearestDatum, 'optionalAccess', _284 => _284.key])
|
|
4830
5142
|
}), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4831
5143
|
className: bar_chart_module_default["bar-chart__tooltip-row"],
|
|
4832
5144
|
children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", {
|
|
@@ -5025,12 +5337,12 @@ var BarChartInternal = ({
|
|
|
5025
5337
|
return null;
|
|
5026
5338
|
}
|
|
5027
5339
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.BarSeries, {
|
|
5028
|
-
dataKey: _optionalChain([seriesData, 'optionalAccess',
|
|
5340
|
+
dataKey: _optionalChain([seriesData, 'optionalAccess', _285 => _285.label]),
|
|
5029
5341
|
data: seriesData.data,
|
|
5030
5342
|
yAccessor: chartOptions.accessors.yAccessor,
|
|
5031
5343
|
xAccessor: chartOptions.accessors.xAccessor,
|
|
5032
5344
|
colorAccessor: getBarBackground(index)
|
|
5033
|
-
}, _optionalChain([seriesData, 'optionalAccess',
|
|
5345
|
+
}, _optionalChain([seriesData, 'optionalAccess', _286 => _286.label]));
|
|
5034
5346
|
})
|
|
5035
5347
|
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xychart.Axis, {
|
|
5036
5348
|
...chartOptions.axis.x
|
|
@@ -5084,7 +5396,7 @@ var BarChartResponsive = attachSubComponents(withResponsive(BarChartWithProvider
|
|
|
5084
5396
|
|
|
5085
5397
|
var getScaleBandwidth2 = (scale) => {
|
|
5086
5398
|
const s = scale;
|
|
5087
|
-
return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
5399
|
+
return s && "bandwidth" in s ? _nullishCoalesce(_optionalChain([s, 'optionalAccess', _287 => _287.bandwidth, 'call', _288 => _288()]), () => ( 0)) : 0;
|
|
5088
5400
|
};
|
|
5089
5401
|
var DefaultLabelComponent = ({
|
|
5090
5402
|
textProps,
|
|
@@ -5145,7 +5457,7 @@ var AxisRenderer = ({
|
|
|
5145
5457
|
delete textProps.dx;
|
|
5146
5458
|
const sum = data.reduce((acc, {
|
|
5147
5459
|
data: seriesData
|
|
5148
|
-
}) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access',
|
|
5460
|
+
}) => acc + (_nullishCoalesce(_optionalChain([seriesData, 'access', _289 => _289[index], 'optionalAccess', _290 => _290.value]), () => ( 0))), 0);
|
|
5149
5461
|
const y = from2.y + yOffset;
|
|
5150
5462
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _group.Group, {
|
|
5151
5463
|
children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelComponent, {
|
|
@@ -5313,7 +5625,7 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5313
5625
|
(stepId) => {
|
|
5314
5626
|
if (clickedStep === stepId) {
|
|
5315
5627
|
setClickedStep(null);
|
|
5316
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5628
|
+
_optionalChain([hideTooltip, 'optionalCall', _291 => _291()]);
|
|
5317
5629
|
} else {
|
|
5318
5630
|
setClickedStep(stepId);
|
|
5319
5631
|
}
|
|
@@ -5326,21 +5638,21 @@ var useFunnelSelection = (hideTooltip) => {
|
|
|
5326
5638
|
event.preventDefault();
|
|
5327
5639
|
if (clickedStep === stepId) {
|
|
5328
5640
|
setClickedStep(null);
|
|
5329
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5641
|
+
_optionalChain([hideTooltip, 'optionalCall', _292 => _292()]);
|
|
5330
5642
|
} else {
|
|
5331
5643
|
setClickedStep(stepId);
|
|
5332
5644
|
}
|
|
5333
5645
|
} else if (event.key === "Escape") {
|
|
5334
5646
|
event.preventDefault();
|
|
5335
5647
|
setClickedStep(null);
|
|
5336
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5648
|
+
_optionalChain([hideTooltip, 'optionalCall', _293 => _293()]);
|
|
5337
5649
|
}
|
|
5338
5650
|
},
|
|
5339
5651
|
[clickedStep, hideTooltip]
|
|
5340
5652
|
);
|
|
5341
5653
|
const clearSelection = _react.useCallback.call(void 0, () => {
|
|
5342
5654
|
setClickedStep(null);
|
|
5343
|
-
_optionalChain([hideTooltip, 'optionalCall',
|
|
5655
|
+
_optionalChain([hideTooltip, 'optionalCall', _294 => _294()]);
|
|
5344
5656
|
}, [hideTooltip]);
|
|
5345
5657
|
const getStepState = _react.useCallback.call(void 0,
|
|
5346
5658
|
(stepId) => ({
|
|
@@ -5502,7 +5814,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5502
5814
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
5503
5815
|
};
|
|
5504
5816
|
}, [clearSelectionAndRef]);
|
|
5505
|
-
const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess',
|
|
5817
|
+
const resolvedHeight = _nullishCoalesce(_nullishCoalesce(height, () => ( _optionalChain([style, 'optionalAccess', _295 => _295.height]))), () => ( "100%"));
|
|
5506
5818
|
const {
|
|
5507
5819
|
primaryColor,
|
|
5508
5820
|
backgroundColor,
|
|
@@ -5517,7 +5829,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
5517
5829
|
}) : {
|
|
5518
5830
|
color: primaryColor || "#000000"
|
|
5519
5831
|
};
|
|
5520
|
-
const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess',
|
|
5832
|
+
const isPositiveChange = _optionalChain([changeIndicator, 'optionalAccess', _296 => _296.startsWith, 'call', _297 => _297("+")]);
|
|
5521
5833
|
const changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;
|
|
5522
5834
|
const barBackgroundColor = backgroundColor || hexToRgba(barColor, 0.08) || "rgba(0, 0, 0, 0.08)";
|
|
5523
5835
|
const renderDefaultMainMetric = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
|
|
@@ -5548,8 +5860,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
5548
5860
|
const chartMetadata = _react.useMemo.call(void 0, () => ({
|
|
5549
5861
|
mainRate,
|
|
5550
5862
|
changeIndicator,
|
|
5551
|
-
stepsCount: _optionalChain([steps, 'optionalAccess',
|
|
5552
|
-
}), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess',
|
|
5863
|
+
stepsCount: _optionalChain([steps, 'optionalAccess', _298 => _298.length]) || 0
|
|
5864
|
+
}), [mainRate, changeIndicator, _optionalChain([steps, 'optionalAccess', _299 => _299.length])]);
|
|
5553
5865
|
useChartRegistration({
|
|
5554
5866
|
chartId,
|
|
5555
5867
|
legendItems: [],
|
|
@@ -5635,8 +5947,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
5635
5947
|
direction: "column",
|
|
5636
5948
|
justify: "flex-end",
|
|
5637
5949
|
className: conversion_funnel_chart_module_default["bar-container"],
|
|
5638
|
-
onClick: _optionalChain([stepHandlers, 'access',
|
|
5639
|
-
onKeyDown: _optionalChain([stepHandlers, 'access',
|
|
5950
|
+
onClick: _optionalChain([stepHandlers, 'access', _300 => _300.get, 'call', _301 => _301(step.id), 'optionalAccess', _302 => _302.onClick]),
|
|
5951
|
+
onKeyDown: _optionalChain([stepHandlers, 'access', _303 => _303.get, 'call', _304 => _304(step.id), 'optionalAccess', _305 => _305.onKeyDown]),
|
|
5640
5952
|
role: "button",
|
|
5641
5953
|
tabIndex: isBlurred ? -1 : 0,
|
|
5642
5954
|
"aria-label": step.label,
|
|
@@ -7186,10 +7498,10 @@ var jsx = function jsx2(type, props) {
|
|
|
7186
7498
|
}
|
|
7187
7499
|
return React7.createElement.apply(null, createElementArgArray);
|
|
7188
7500
|
};
|
|
7189
|
-
(function(
|
|
7501
|
+
(function(_jsx33) {
|
|
7190
7502
|
var JSX;
|
|
7191
7503
|
/* @__PURE__ */ (function(_JSX) {
|
|
7192
|
-
})(JSX || (JSX =
|
|
7504
|
+
})(JSX || (JSX = _jsx33.JSX || (_jsx33.JSX = {})));
|
|
7193
7505
|
})(jsx || (jsx = {}));
|
|
7194
7506
|
function css() {
|
|
7195
7507
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -7649,7 +7961,7 @@ function contextConnect(Component2, namespace) {
|
|
|
7649
7961
|
});
|
|
7650
7962
|
}
|
|
7651
7963
|
function _contextConnect(Component2, namespace, options) {
|
|
7652
|
-
const WrappedComponent = _optionalChain([options, 'optionalAccess',
|
|
7964
|
+
const WrappedComponent = _optionalChain([options, 'optionalAccess', _306 => _306.forwardsRef]) ? _react.forwardRef.call(void 0, Component2) : Component2;
|
|
7653
7965
|
if (typeof namespace === "undefined") {
|
|
7654
7966
|
globalThis.SCRIPT_DEBUG === true ? warning("contextConnect: Please provide a namespace") : void 0;
|
|
7655
7967
|
}
|
|
@@ -7685,7 +7997,7 @@ function useContextSystem(props, namespace) {
|
|
|
7685
7997
|
if (typeof namespace === "undefined") {
|
|
7686
7998
|
globalThis.SCRIPT_DEBUG === true ? warning("useContextSystem: Please provide a namespace") : void 0;
|
|
7687
7999
|
}
|
|
7688
|
-
const contextProps = _optionalChain([contextSystemProps, 'optionalAccess',
|
|
8000
|
+
const contextProps = _optionalChain([contextSystemProps, 'optionalAccess', _307 => _307[namespace]]) || {};
|
|
7689
8001
|
const finalComponentProps = {
|
|
7690
8002
|
...getConnectedNamespace(),
|
|
7691
8003
|
...getNamespace(namespace)
|
|
@@ -8066,7 +8378,7 @@ function useLeaderboardLegendItems({
|
|
|
8066
8378
|
overrideColor: primaryColor || leaderboardChartSettings.primaryColor
|
|
8067
8379
|
});
|
|
8068
8380
|
items.push({
|
|
8069
|
-
label: _optionalChain([legendLabels, 'optionalAccess',
|
|
8381
|
+
label: _optionalChain([legendLabels, 'optionalAccess', _308 => _308.primary]) || _i18n.__.call(void 0, "Current period", "jetpack-charts"),
|
|
8070
8382
|
color: resolvedPrimaryColor
|
|
8071
8383
|
});
|
|
8072
8384
|
if (withComparison && !withOverlayLabel) {
|
|
@@ -8075,7 +8387,7 @@ function useLeaderboardLegendItems({
|
|
|
8075
8387
|
overrideColor: secondaryColor || leaderboardChartSettings.secondaryColor
|
|
8076
8388
|
});
|
|
8077
8389
|
items.push({
|
|
8078
|
-
label: _optionalChain([legendLabels, 'optionalAccess',
|
|
8390
|
+
label: _optionalChain([legendLabels, 'optionalAccess', _309 => _309.comparison]) || _i18n.__.call(void 0, "Previous period", "jetpack-charts"),
|
|
8079
8391
|
color: resolvedSecondaryColor
|
|
8080
8392
|
});
|
|
8081
8393
|
}
|
|
@@ -8734,11 +9046,11 @@ var PieChartInternal = ({
|
|
|
8734
9046
|
groupProps.onMouseLeave = onMouseLeave;
|
|
8735
9047
|
}
|
|
8736
9048
|
const svgLabelSmall = providerTheme.svgLabelSmall;
|
|
8737
|
-
const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess',
|
|
9049
|
+
const fontSize = _nullishCoalesce(resolveFontSize(_optionalChain([svgLabelSmall, 'optionalAccess', _310 => _310.fontSize])), () => ( 12));
|
|
8738
9050
|
const estimatedTextWidth = _chunk7OZEQ5HEcjs.getStringWidth.call(void 0, arc.data.label, {
|
|
8739
9051
|
fontSize,
|
|
8740
|
-
fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess',
|
|
8741
|
-
fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess',
|
|
9052
|
+
fontFamily: _optionalChain([svgLabelSmall, 'optionalAccess', _311 => _311.fontFamily]),
|
|
9053
|
+
fontWeight: _optionalChain([svgLabelSmall, 'optionalAccess', _312 => _312.fontWeight])
|
|
8742
9054
|
});
|
|
8743
9055
|
const labelPadding = 6;
|
|
8744
9056
|
const backgroundWidth = estimatedTextWidth + labelPadding * 2;
|
|
@@ -9188,7 +9500,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9188
9500
|
animation
|
|
9189
9501
|
}, ref) => {
|
|
9190
9502
|
const theme = useGlobalChartsTheme();
|
|
9191
|
-
const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access',
|
|
9503
|
+
const themeStrokeWidth = _nullishCoalesce(_optionalChain([theme, 'access', _313 => _313.sparkline, 'optionalAccess', _314 => _314.strokeWidth]), () => ( 1.5));
|
|
9192
9504
|
const strokeWidth = _nullishCoalesce(strokeWidthProp, () => ( themeStrokeWidth));
|
|
9193
9505
|
const seriesData = _react.useMemo.call(void 0, () => {
|
|
9194
9506
|
if (!data || data.length === 0) {
|
|
@@ -9197,7 +9509,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9197
9509
|
return transformToSeriesData(data, color, strokeWidth);
|
|
9198
9510
|
}, [data, color, strokeWidth]);
|
|
9199
9511
|
const finalMargin = _react.useMemo.call(void 0, () => {
|
|
9200
|
-
const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access',
|
|
9512
|
+
const themeMargin = _nullishCoalesce(_optionalChain([theme, 'access', _315 => _315.sparkline, 'optionalAccess', _316 => _316.margin]), () => ( {
|
|
9201
9513
|
top: 2,
|
|
9202
9514
|
right: 2,
|
|
9203
9515
|
bottom: 2,
|
|
@@ -9208,7 +9520,7 @@ var SparklineComponent = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
9208
9520
|
...themeMargin,
|
|
9209
9521
|
...margin
|
|
9210
9522
|
};
|
|
9211
|
-
}, [marginProp, _optionalChain([theme, 'access',
|
|
9523
|
+
}, [marginProp, _optionalChain([theme, 'access', _317 => _317.sparkline, 'optionalAccess', _318 => _318.margin])]);
|
|
9212
9524
|
const seriesWithGradient = _react.useMemo.call(void 0, () => {
|
|
9213
9525
|
if (!gradient || seriesData.length === 0) {
|
|
9214
9526
|
return seriesData;
|