@elliemae/ds-dataviz 3.61.5-rc.1 → 3.70.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js +28 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +16 -10
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +15 -12
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +13 -11
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +1 -1
- package/dist/cjs/package.json +4 -1
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +28 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +17 -11
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +16 -13
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +14 -12
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +1 -1
- package/dist/esm/package.json +4 -1
- package/dist/types/graphs/Chart/react-desc-prop-types.d.ts +2 -2
- package/package.json +7 -7
|
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(SingleStackedBar_exports);
|
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
38
|
-
var
|
|
38
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
39
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
40
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
41
41
|
var import_react = __toESM(require("react"));
|
|
@@ -44,9 +44,20 @@ var import_exported_related = require("./exported-related/index.js");
|
|
|
44
44
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
45
45
|
var import_styles = require("./styles.js");
|
|
46
46
|
const Bar = import_react.default.memo((props) => {
|
|
47
|
-
const [referenceElement, setReferenceElement] = (0, import_react.useState)(null);
|
|
48
47
|
const [isHover, setIsHover] = (0, import_react.useState)(false);
|
|
49
48
|
const { height, TooltipRenderer, datum, tabIndex, isFocused, borderRadius, bg } = props;
|
|
49
|
+
const isTooltipOpen = (isFocused || isHover) && !!TooltipRenderer;
|
|
50
|
+
const {
|
|
51
|
+
refs,
|
|
52
|
+
floatingStyles,
|
|
53
|
+
arrowStyles,
|
|
54
|
+
context,
|
|
55
|
+
isOpen: isFloatingOpen
|
|
56
|
+
} = (0, import_ds_floating_context.useFloatingContext)({
|
|
57
|
+
externallyControlledIsOpen: isTooltipOpen,
|
|
58
|
+
withoutAnimation: true,
|
|
59
|
+
customOffset: [0, 14]
|
|
60
|
+
});
|
|
50
61
|
const handleRefCallback = (0, import_react.useCallback)(
|
|
51
62
|
(_ref) => {
|
|
52
63
|
if (isFocused) {
|
|
@@ -62,10 +73,20 @@ const Bar = import_react.default.memo((props) => {
|
|
|
62
73
|
setIsHover(false);
|
|
63
74
|
}, []);
|
|
64
75
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
TooltipRenderer && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
77
|
+
import_ds_floating_context.FloatingWrapper,
|
|
78
|
+
{
|
|
79
|
+
innerRef: refs.setFloating,
|
|
80
|
+
isOpen: isFloatingOpen,
|
|
81
|
+
floatingStyles,
|
|
82
|
+
context,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipRenderer, { datum }) }),
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
69
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
91
|
import_styles.StyledBar,
|
|
71
92
|
{
|
|
@@ -74,7 +95,7 @@ const Bar = import_react.default.memo((props) => {
|
|
|
74
95
|
bg,
|
|
75
96
|
height,
|
|
76
97
|
borderRadius,
|
|
77
|
-
innerRef: (0, import_ds_system.mergeRefs)(handleRefCallback,
|
|
98
|
+
innerRef: (0, import_ds_system.mergeRefs)(handleRefCallback, refs.setReference),
|
|
78
99
|
tabIndex,
|
|
79
100
|
role: "img",
|
|
80
101
|
"aria-label": `${datum.name} value: ${datum.data}`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/SingleStackedBar/SingleStackedBar.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useFloatingContext, FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport React, { useCallback, useMemo, useState, type WeakValidationMap } from 'react';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\nimport { DSSingleStackedBarName } from './exported-related/index.js';\nimport { DSSingleStackedBarPropTypes, defaultProps, type DSSingleStackedBarT } from './react-desc-prop-types.js';\nimport { StyledBar, StyledMouseOverDetectionBox, StyledTooltipContainer, Wrapper } from './styles.js';\nconst Bar = React.memo((props: DSSingleStackedBarT.BarT) => {\n const [isHover, setIsHover] = useState(false);\n const { height, TooltipRenderer, datum, tabIndex, isFocused, borderRadius, bg } = props;\n\n const isTooltipOpen = (isFocused || isHover) && !!TooltipRenderer;\n const {\n refs,\n floatingStyles,\n arrowStyles,\n context,\n isOpen: isFloatingOpen,\n } = useFloatingContext({\n externallyControlledIsOpen: isTooltipOpen,\n withoutAnimation: true,\n customOffset: [0, 14],\n });\n\n const handleRefCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (isFocused) {\n _ref?.focus();\n }\n },\n [isFocused],\n );\n\n const handleMouseEnter = useCallback(() => {\n setIsHover(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHover(false);\n }, []);\n return (\n <div>\n {TooltipRenderer && (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isFloatingOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer datum={datum} />\n </StyledTooltipContainer>\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n )}\n <StyledBar\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n bg={bg}\n height={height}\n borderRadius={borderRadius}\n innerRef={mergeRefs(handleRefCallback, refs.setReference)}\n tabIndex={tabIndex}\n role=\"img\"\n // until uziel work is merged we keep this default value\n aria-label={`${datum.name} value: ${datum.data}`}\n />\n </div>\n );\n});\n\nconst DSSingleStackedBar: React.ComponentType<DSSingleStackedBarT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSSingleStackedBarT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, DSSingleStackedBarPropTypes, 'DSSingleStackedBar');\n\n const globalAttributes = useGetGlobalAttributes<DSSingleStackedBarT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefaults,\n );\n\n const xstyledProps = useGetXstyledProps(propsWithDefaults);\n\n const { data, LegendRenderer, gutter, height } = propsWithDefaults;\n const [keyBarFocused, setKeyBarFocused] = useState<number>(0);\n const [isChartFocused, setIsChartFocused] = useState(false);\n\n const total = useMemo(() => data.map((datum) => datum.data).reduce((acc, curr) => acc + curr, 0), [data]);\n const cols = useMemo(() => data.map((datum) => `${Math.ceil(datum.data * 100) / total}%`), [data, total]);\n const rows = useMemo(\n () => (LegendRenderer !== undefined ? [`${height}px`, 'auto'] : [`${height}px`]),\n [LegendRenderer, height],\n );\n const barNames = useMemo(() => data.map((datum) => datum.name), [data]);\n const getBorderRadius = useCallback(\n (index: number) => {\n if (index === 0) return '50px 0 0 50px';\n if (index === data.length - 1) return '0 50px 50px 0';\n return undefined;\n },\n [data.length],\n );\n\n const handleOnKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowRight') {\n if (barNames[keyBarFocused + 1]) {\n setKeyBarFocused(keyBarFocused + 1);\n } else {\n setKeyBarFocused(0);\n }\n }\n if (e.code === 'ArrowLeft') {\n if (barNames[keyBarFocused - 1]) {\n setKeyBarFocused(keyBarFocused - 1);\n } else {\n setKeyBarFocused(barNames.length - 1);\n }\n }\n },\n [keyBarFocused, barNames],\n );\n\n return (\n <Wrapper\n cols={cols}\n gutter={gutter}\n role=\"region\"\n onKeyDown={handleOnKeyDown}\n tabIndex={-1}\n onFocus={() => setIsChartFocused(true)}\n onBlur={(e) => e.currentTarget !== e.target && setIsChartFocused(false)}\n {...xstyledProps}\n {...globalAttributes}\n >\n {data.map((datum, i) => (\n <Grid rows={rows}>\n <Bar\n key={datum.name}\n datum={datum}\n isFocused={barNames[keyBarFocused] === datum.name && isChartFocused}\n borderRadius={getBorderRadius(i)}\n bg={COLOR_PALLET[datum.color as keyof typeof COLOR_PALLET] ?? datum.color}\n tabIndex={i === keyBarFocused ? 0 : -1}\n {...props}\n />\n {LegendRenderer !== undefined ? <LegendRenderer key={`${datum.name}-legend`} datum={datum} /> : null}\n </Grid>\n ))}\n </Wrapper>\n );\n};\n\nDSSingleStackedBar.displayName = DSSingleStackedBarName;\nconst DSSingleStackedBarWithSchema = describe(DSSingleStackedBar);\nDSSingleStackedBarWithSchema.propTypes =\n DSSingleStackedBarPropTypes as unknown as WeakValidationMap<DSSingleStackedBarT.Props>;\n\nexport { DSSingleStackedBar, DSSingleStackedBarWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqDf;AAnDR,qBAAqB;AACrB,iCAAkE;AAClE,8BAMO;AACP,uBAA0B;AAC1B,mBAA8E;AAC9E,yBAA6B;AAC7B,8BAAuC;AACvC,mCAAoF;AACpF,oBAAwF;AACxF,MAAM,MAAM,aAAAA,QAAM,KAAK,CAAC,UAAoC;AAC1D,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,EAAE,QAAQ,iBAAiB,OAAO,UAAU,WAAW,cAAc,GAAG,IAAI;AAElF,QAAM,iBAAiB,aAAa,YAAY,CAAC,CAAC;AAClD,Q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A,IACF;AAAA,IACA,CAAC,eAAe,QAAQ;AAAA,EAC1B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU;AAAA,MACV,SAAS,MAAM,kBAAkB,IAAI;AAAA,MACrC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,UAAU,kBAAkB,KAAK;AAAA,MACrE,GAAG;AAAA,MACH,GAAG;AAAA,MAEH,eAAK,IAAI,CAAC,OAAO,MAChB,6CAAC,uBAAK,MACJ;AAAA;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA,WAAW,SAAS,aAAa,MAAM,MAAM,QAAQ;AAAA,YACrD,cAAc,gBAAgB,CAAC;AAAA,YAC/B,IAAI,gCAAa,MAAM,KAAkC,KAAK,MAAM;AAAA,YACpE,UAAU,MAAM,gBAAgB,IAAI;AAAA,YACnC,GAAG;AAAA;AAAA,UANC,MAAM;AAAA,QAOb;AAAA,QACC,mBAAmB,SAAY,4CAAC,kBAA4C,SAAxB,GAAG,MAAM,IAAI,SAAyB,IAAK;AAAA,SAClG,CACD;AAAA;AAAA,EACH;AAEJ;AAEA,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,kCAAS,kBAAkB;AAChE,6BAA6B,YAC3B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -34,28 +34,34 @@ module.exports = __toCommonJS(FocusableRegion_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var
|
|
37
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_styles = require("../styles.js");
|
|
40
40
|
const FocusableRegion = (props) => {
|
|
41
|
-
const [referenceElement, setReferenceElement] = (0, import_react.useState)(null);
|
|
42
41
|
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
43
42
|
const { content, ...rest } = props;
|
|
43
|
+
const { refs, floatingStyles, arrowStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
|
|
44
|
+
externallyControlledIsOpen: true,
|
|
45
|
+
withoutAnimation: true,
|
|
46
|
+
customOffset: [0, 14]
|
|
47
|
+
});
|
|
44
48
|
return (0, import_react.useMemo)(
|
|
45
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", { ...rest, ref:
|
|
46
|
-
|
|
49
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", { ...rest, ref: refs.setReference, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
50
|
+
import_ds_floating_context.FloatingWrapper,
|
|
47
51
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
innerRef: refs.setFloating,
|
|
53
|
+
isOpen: true,
|
|
54
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
55
|
+
context,
|
|
52
56
|
children: [
|
|
53
57
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
54
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, { children: content })
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, { children: content }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
|
|
55
60
|
]
|
|
56
61
|
}
|
|
57
62
|
) }),
|
|
58
|
-
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
[content, refs, floatingStyles, context, rest, theme.zIndex.tooltip]
|
|
59
65
|
);
|
|
60
66
|
};
|
|
61
67
|
//# sourceMappingURL=FocusableRegion.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/FocusableRegion.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useContext, useMemo } from 'react';\nimport { useFloatingContext, FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledTooltipContainer, StyledMouseOverDetectionBox } from '../styles.js';\n\ninterface FocusableRegionProps {\n content: React.ReactNode;\n id: string;\n width: number;\n height: number;\n x?: number;\n y?: number;\n transform?: string;\n tabIndex?: number;\n style?: React.CSSProperties;\n}\n\nexport const FocusableRegion: React.ComponentType<FocusableRegionProps> = (props) => {\n const theme = useContext(ThemeContext);\n const { content, ...rest } = props;\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n externallyControlledIsOpen: true,\n withoutAnimation: true,\n customOffset: [0, 14],\n });\n\n return useMemo(\n () => (\n <foreignObject {...rest} ref={refs.setReference as React.Ref<SVGForeignObjectElement>}>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>{content}</StyledTooltipContainer>\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n </foreignObject>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [content, refs, floatingStyles, context, rest, theme.zIndex.tooltip],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+Bf;AA9BR,mBAA2C;AAC3C,iCAAkE;AAClE,uBAA6B;AAC7B,oBAAoE;AAc7D,MAAM,kBAA6D,CAAC,UAAU;AACnF,QAAM,YAAQ,yBAAW,6BAAY;AACrC,QAAM,EAAE,SAAS,GAAG,KAAK,IAAI;AAE7B,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,QAAI,+CAAmB;AAAA,IACxE,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,IAClB,cAAc,CAAC,GAAG,EAAE;AAAA,EACtB,CAAC;AAED,aAAO;AAAA,IACL,MACE,4CAAC,mBAAe,GAAG,MAAM,KAAK,KAAK,cACjC;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAM;AAAA,QACN,gBAAgB,EAAE,GAAG,gBAAgB,QAAQ,MAAM,OAAO,QAAQ;AAAA,QAClE;AAAA,QAEA;AAAA,sDAAC,6CAA4B;AAAA,UAC7B,4CAAC,wCAAwB,mBAAQ;AAAA,UACjC,4CAAC,2CAAc,GAAG,aAAa;AAAA;AAAA;AAAA,IACjC,GACF;AAAA;AAAA,IAGF,CAAC,SAAS,MAAM,gBAAgB,SAAS,MAAM,MAAM,OAAO,OAAO;AAAA,EACrE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(ScrapperLine_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var
|
|
37
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_ChartContext = require("../../ChartContext.js");
|
|
40
40
|
var import_styles = require("../../styles.js");
|
|
@@ -49,25 +49,28 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
49
49
|
props: { TooltipRenderer, scrapper }
|
|
50
50
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
51
51
|
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
52
|
-
const [referenceElement, setReferenceElement] = (0, import_react.useState)(null);
|
|
53
52
|
const yPositionString = yPosition;
|
|
53
|
+
const isActive = scrapperPosY === yPositionString;
|
|
54
|
+
const { refs, floatingStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
|
|
55
|
+
externallyControlledIsOpen: isActive && !!TooltipRenderer,
|
|
56
|
+
withoutAnimation: true,
|
|
57
|
+
customOffset: [0, 5],
|
|
58
|
+
placement: scrapper?.tooltipPreference
|
|
59
|
+
});
|
|
54
60
|
const handleOnMouseEnter = (0, import_react.useCallback)(() => {
|
|
55
61
|
if (!isGrabbed) setScrapperPosY(yPositionString);
|
|
56
62
|
setActivePoint(null);
|
|
57
63
|
}, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);
|
|
58
64
|
const strokeDetectorWidth = yScale?.type === "BAND" ? yScale?.getBandwidth() : "4px";
|
|
59
65
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
|
|
60
|
-
|
|
66
|
+
isActive ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
|
|
61
67
|
TooltipRenderer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
62
|
-
|
|
68
|
+
import_ds_floating_context.FloatingWrapper,
|
|
63
69
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
showPopover: true,
|
|
69
|
-
zIndex: theme.zIndex.tooltip,
|
|
70
|
-
startPlacementPreference: scrapper?.tooltipPreference,
|
|
70
|
+
innerRef: refs.setFloating,
|
|
71
|
+
isOpen: isActive,
|
|
72
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
73
|
+
context,
|
|
71
74
|
children: [
|
|
72
75
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
73
76
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipRenderer, { data: datum }) })
|
|
@@ -77,7 +80,7 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
77
80
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
81
|
"line",
|
|
79
82
|
{
|
|
80
|
-
ref:
|
|
83
|
+
ref: refs.setReference,
|
|
81
84
|
x1: innerWidth,
|
|
82
85
|
strokeWidth: "2px",
|
|
83
86
|
stroke: "transparent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/graphs/Chart/parts/Scrapper/ScrapperLine.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext.js';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles.js';\nimport type { DSChartT } from '../../react-desc-prop-types.js';\ninterface ScrapperLineProps {\n yPosition: number;\n datum: DSChartT.ScrapperDatum[];\n}\n\nexport const ScrapperLine: React.ComponentType<ScrapperLineProps> = ({ yPosition, datum }) => {\n const {\n scrapperPosY,\n setScrapperPosY,\n innerWidth,\n yScale,\n setActivePoint,\n isGrabbed,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n const yPositionString = yPosition;\n const isActive = scrapperPosY === yPositionString;\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: isActive && !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n placement: scrapper?.tooltipPreference,\n });\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosY(yPositionString);\n setActivePoint(null);\n }, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);\n\n const strokeDetectorWidth = yScale?.type === 'BAND' ? yScale?.getBandwidth() : '4px';\n\n return (\n <g>\n {isActive ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isActive}\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n x1={0}\n strokeWidth=\"2px\"\n stroke=\"grey\"\n strokeDasharray=\"4 4\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n ) : null}\n <line\n onMouseEnter={handleOnMouseEnter}\n x1={0}\n strokeWidth={strokeDetectorWidth}\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8CT;AA9Cd,mBAA+C;AAC/C,iCAAoD;AACpD,uBAA6B;AAC7B,0BAA6B;AAC7B,oBAAoE;AAO7D,MAAM,eAAuD,CAAC,EAAE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AAA,UACZ,QAAO;AAAA,UACP,iBAAgB;AAAA,UAChB,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA;AAAA,MACN;AAAA,OACF,IACE;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,cAAc;AAAA,QACd,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,QAAO;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA;AAAA,IACN;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(VerticalScrapperLine_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var
|
|
37
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_styles = require("../../styles.js");
|
|
40
40
|
const VerticalScrapperLine = import_react.default.memo(
|
|
@@ -52,8 +52,13 @@ const VerticalScrapperLine = import_react.default.memo(
|
|
|
52
52
|
scrapper
|
|
53
53
|
}) => {
|
|
54
54
|
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
55
|
-
const [referenceElement, setReferenceElement] = (0, import_react.useState)();
|
|
56
55
|
const isActive = scrapperPosX === xPosition;
|
|
56
|
+
const { refs, floatingStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
|
|
57
|
+
externallyControlledIsOpen: isActive && !isGrabbed && !!TooltipRenderer,
|
|
58
|
+
withoutAnimation: true,
|
|
59
|
+
customOffset: [0, 5],
|
|
60
|
+
placement: scrapper.tooltipPreference
|
|
61
|
+
});
|
|
57
62
|
const handleOnMouseEnter = (0, import_react.useCallback)(() => {
|
|
58
63
|
if (!isGrabbed) setScrapperPosX(xPosition);
|
|
59
64
|
setActivePoint(null);
|
|
@@ -62,15 +67,12 @@ const VerticalScrapperLine = import_react.default.memo(
|
|
|
62
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { transform: `translate(${nonNullXscale.type === "BAND" ? nonNullXscale.getBandwidth() / 2 : 0}, 0)`, children: [
|
|
63
68
|
isActive && !isGrabbed ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
|
|
64
69
|
TooltipRenderer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
65
|
-
|
|
70
|
+
import_ds_floating_context.FloatingWrapper,
|
|
66
71
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
showPopover: true,
|
|
72
|
-
zIndex: theme.zIndex.tooltip,
|
|
73
|
-
startPlacementPreference: scrapper.tooltipPreference,
|
|
72
|
+
innerRef: refs.setFloating,
|
|
73
|
+
isOpen: isActive && !isGrabbed,
|
|
74
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
75
|
+
context,
|
|
74
76
|
children: [
|
|
75
77
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
76
78
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipRenderer, { data }) })
|
|
@@ -80,7 +82,7 @@ const VerticalScrapperLine = import_react.default.memo(
|
|
|
80
82
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
83
|
"line",
|
|
82
84
|
{
|
|
83
|
-
ref:
|
|
85
|
+
ref: refs.setReference,
|
|
84
86
|
x1: xPosition,
|
|
85
87
|
strokeWidth: "2px",
|
|
86
88
|
stroke: scrapper.color,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapperLine.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext, useCallback
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles.js';\nimport type { DSChartT } from '../../react-desc-prop-types.js';\nimport type { ScaleT } from '../../scales/index.js';\ninterface VerticalScrapperLineProps {\n rectDetector?: { left: number; right: number };\n xPosition: number;\n data: DSChartT.ScrapperDatum[];\n scrapperPosX: number;\n setScrapperPosX: (x: number) => void;\n isGrabbed: boolean;\n xScale: ScaleT | null;\n setActivePoint: React.Dispatch<React.SetStateAction<DSChartT.InternalDatum | null>>;\n innerHeight: number;\n TooltipRenderer?:\n | React.ComponentType<{\n data: {\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n datum: DSChartT.InternalDatum;\n }[];\n }>\n | undefined;\n scrapper: DSChartT.ScrapperT;\n}\n\nexport const VerticalScrapperLine: React.ComponentType<VerticalScrapperLineProps> = React.memo(\n ({\n rectDetector,\n xPosition,\n data,\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n TooltipRenderer,\n scrapper,\n }) => {\n const theme = useContext(ThemeContext);\n const isActive = scrapperPosX === xPosition;\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: isActive && !isGrabbed && !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n placement: scrapper.tooltipPreference,\n });\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n // the code was abusing `xScale?.` even in place where it could lead to NaN\n // I am not sure what the `?.` was solving but xScale typescript says | null\n // this line is a monkeypatch to avoid the NaN but it charts should be properly revisited to use typesafe code and algorithms\n const nonNullXscale = xScale ?? { type: 'notBANDAndEverythingElseIsCurrentlyTreatedTheSame' };\n return (\n <g transform={`translate(${nonNullXscale.type === 'BAND' ? nonNullXscale.getBandwidth() / 2 : 0}, 0)`}>\n {isActive && !isGrabbed ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isActive && !isGrabbed}\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={data} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={xPosition}\n strokeWidth=\"2px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n strokeDasharray=\"4 4\"\n />\n </g>\n ) : null}\n <rect\n onMouseOver={handleOnMouseEnter}\n x={\n nonNullXscale.type === 'BAND'\n ? xPosition - nonNullXscale.getBandwidth() / 2\n : xPosition - (rectDetector?.left ?? 0)\n }\n fill=\"transparent\"\n y={0}\n width={\n nonNullXscale.type === 'BAND'\n ? nonNullXscale.getBandwidth()\n : (rectDetector?.right ?? 0) + (rectDetector?.left ?? 0)\n }\n height={innerHeight}\n />\n </g>\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoEP;AAnEhB,mBAA+C;AAC/C,iCAAoD;AACpD,uBAA6B;AAC7B,oBAAoE;AA0B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ACJ,IAAI;AAAA,YACJ,iBAAgB;AAAA;AAAA,QAClB;AAAA,SACF,IACE;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,GACE,cAAc,SAAS,SACnB,YAAY,cAAc,aAAa,IAAI,IAC3C,aAAa,cAAc,QAAQ;AAAA,UAEzC,MAAK;AAAA,UACL,GAAG;AAAA,UACH,OACE,cAAc,SAAS,SACnB,cAAc,aAAa,KAC1B,cAAc,SAAS,MAAM,cAAc,QAAQ;AAAA,UAE1D,QAAQ;AAAA;AAAA,MACV;AAAA,OACF;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/graphs/Chart/react-desc-prop-types.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { Series, ScaleLinear, ScaleBand } from 'd3';\nimport { type
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { Series, ScaleLinear, ScaleBand } from 'd3';\nimport { type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport { type SERIE_TYPES } from '../constants.js';\nexport declare namespace DSChartT {\n export type AxisTypeT = 'log' | 'band' | 'time' | 'linear';\n\n export type LinearScale = ScaleLinear<number, number, never>;\n export type BandScale = ScaleBand<string>;\n export type SeriesTypes = (typeof SERIE_TYPES)[keyof typeof SERIE_TYPES];\n export type Scales = LinearScale | BandScale;\n export interface SeriesT {\n name: string;\n data: Array<number | null | { x: number | string | Date; y: number }>;\n type: SeriesTypes;\n scale?: string;\n color: string;\n // line\n dashStyle?: string;\n pointRadius?: number;\n pointStyle?: string;\n }\n\n export interface ScrapperT {\n type: 'horizontal' | 'vertical';\n color: string;\n tooltipPreference: DSHookFloatingContextT.PopperPlacementsT;\n }\n\n export interface SerieComponentT {\n serie: InternalSerie;\n }\n\n export interface LegendT {\n position: 'right' | 'bottom' | 'left' | 'top';\n preventFilterAction?: boolean;\n }\n\n export interface AxisTickT {\n tickValues?: number[] | Date[];\n tickFormat?: ((value: string | number | Date) => string) | string;\n tickCount?: number;\n tickRotation?: number;\n overwriteTicks?: boolean;\n color?: string;\n }\n\n export type IntervalT = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';\n\n export interface AxisT {\n type: AxisTypeT;\n showGrid?: boolean;\n color?: string;\n label?: string;\n cols?: string[];\n domainPadding?: number | number[];\n intervalType?: IntervalT;\n hideAxis?: boolean;\n beginAtZero?: boolean;\n advanced?: {\n pointSpacing: {\n type: string;\n value: number;\n };\n };\n tick?: AxisTickT;\n plotRange?: number[];\n min?: number | Date;\n max?: number | Date;\n domainPaddingType?: string;\n }\n\n export interface InternalDatum {\n key: string;\n value: number | { x: number; y: number };\n position: number;\n serie: string;\n scale: string;\n color: string;\n }\n\n export interface InternalSerie {\n key: string;\n data: InternalDatum[];\n name: string;\n type: SeriesTypes;\n scale?: string | undefined;\n color: string;\n dashStyle?: string;\n pointRadius?: number;\n pointStyle?: string;\n curveStyle?: string;\n }\n\n export type InternalData = InternalSerie[];\n export interface TooltipRenderDataT {\n data: {\n datum: InternalDatum;\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n }[];\n }\n export interface OptionalProps {\n groups?: string[][];\n types?: 'scatter';\n scrapper?: ScrapperT;\n withTrendHighlight?: boolean;\n TooltipRenderer?: React.ComponentType<TooltipRenderDataT>;\n height?: number;\n width?: number;\n legend?: LegendT;\n xScroll?: boolean;\n yScroll?: boolean;\n y2Axis?: AxisT;\n yAxis: AxisT;\n xAxis: AxisT;\n }\n\n export interface DefaultProps {\n series: SeriesT[];\n }\n\n export interface RequiredProps {}\n\n export interface Props extends OptionalProps, DefaultProps, RequiredProps {}\n\n export type StackedSeriesByGroupT = Series<\n {\n [key: string]: number;\n },\n string\n >[][];\n\n export interface ScrapperDatum {\n position: number | undefined;\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n key: number;\n datum: DSChartT.InternalDatum;\n }\n}\n\nexport const defaultProps: DSChartT.DefaultProps = {\n series: [\n {\n name: '1',\n data: [0],\n color: 'grey-100',\n type: 'bar',\n },\n ],\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n height: PropTypes.number.isRequired.description('height').defaultValue(''),\n width: PropTypes.number.isRequired.description('height').defaultValue(''),\n margin: PropTypes.shape({\n top: PropTypes.number,\n bottom: PropTypes.number,\n left: PropTypes.number,\n right: PropTypes.number,\n })\n .isRequired.description('margin')\n .defaultValue(''),\n series: PropTypes.arrayOf(PropTypes.object).description('yValue').defaultValue(''),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAqD;AAgJ9C,MAAM,eAAsC;AAAA,EACjD,QAAQ;AAAA,IACN;AAAA,MACE,MAAM;AAAA,MACN,MAAM,CAAC,CAAC;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,QAAQ,kCAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACzE,OAAO,kCAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACxE,QAAQ,kCAAU,MAAM;AAAA,IACtB,KAAK,kCAAU;AAAA,IACf,QAAQ,kCAAU;AAAA,IAClB,MAAM,kCAAU;AAAA,IAChB,OAAO,kCAAU;AAAA,EACnB,CAAC,EACE,WAAW,YAAY,QAAQ,EAC/B,aAAa,EAAE;AAAA,EAClB,QAAQ,kCAAU,QAAQ,kCAAU,MAAM,EAAE,YAAY,QAAQ,EAAE,aAAa,EAAE;AACnF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
-
import {
|
|
4
|
+
import { useFloatingContext, FloatingWrapper, PopoverArrow } from "@elliemae/ds-floating-context";
|
|
5
5
|
import {
|
|
6
6
|
describe,
|
|
7
7
|
useGetGlobalAttributes,
|
|
@@ -16,9 +16,20 @@ import { DSSingleStackedBarName } from "./exported-related/index.js";
|
|
|
16
16
|
import { DSSingleStackedBarPropTypes, defaultProps } from "./react-desc-prop-types.js";
|
|
17
17
|
import { StyledBar, StyledMouseOverDetectionBox, StyledTooltipContainer, Wrapper } from "./styles.js";
|
|
18
18
|
const Bar = React2.memo((props) => {
|
|
19
|
-
const [referenceElement, setReferenceElement] = useState(null);
|
|
20
19
|
const [isHover, setIsHover] = useState(false);
|
|
21
20
|
const { height, TooltipRenderer, datum, tabIndex, isFocused, borderRadius, bg } = props;
|
|
21
|
+
const isTooltipOpen = (isFocused || isHover) && !!TooltipRenderer;
|
|
22
|
+
const {
|
|
23
|
+
refs,
|
|
24
|
+
floatingStyles,
|
|
25
|
+
arrowStyles,
|
|
26
|
+
context,
|
|
27
|
+
isOpen: isFloatingOpen
|
|
28
|
+
} = useFloatingContext({
|
|
29
|
+
externallyControlledIsOpen: isTooltipOpen,
|
|
30
|
+
withoutAnimation: true,
|
|
31
|
+
customOffset: [0, 14]
|
|
32
|
+
});
|
|
22
33
|
const handleRefCallback = useCallback(
|
|
23
34
|
(_ref) => {
|
|
24
35
|
if (isFocused) {
|
|
@@ -34,10 +45,20 @@ const Bar = React2.memo((props) => {
|
|
|
34
45
|
setIsHover(false);
|
|
35
46
|
}, []);
|
|
36
47
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
TooltipRenderer && /* @__PURE__ */ jsxs(
|
|
49
|
+
FloatingWrapper,
|
|
50
|
+
{
|
|
51
|
+
innerRef: refs.setFloating,
|
|
52
|
+
isOpen: isFloatingOpen,
|
|
53
|
+
floatingStyles,
|
|
54
|
+
context,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, {}),
|
|
57
|
+
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: /* @__PURE__ */ jsx(TooltipRenderer, { datum }) }),
|
|
58
|
+
/* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
41
62
|
/* @__PURE__ */ jsx(
|
|
42
63
|
StyledBar,
|
|
43
64
|
{
|
|
@@ -46,7 +67,7 @@ const Bar = React2.memo((props) => {
|
|
|
46
67
|
bg,
|
|
47
68
|
height,
|
|
48
69
|
borderRadius,
|
|
49
|
-
innerRef: mergeRefs(handleRefCallback,
|
|
70
|
+
innerRef: mergeRefs(handleRefCallback, refs.setReference),
|
|
50
71
|
tabIndex,
|
|
51
72
|
role: "img",
|
|
52
73
|
"aria-label": `${datum.name} value: ${datum.data}`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/SingleStackedBar/SingleStackedBar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useFloatingContext, FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport React, { useCallback, useMemo, useState, type WeakValidationMap } from 'react';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\nimport { DSSingleStackedBarName } from './exported-related/index.js';\nimport { DSSingleStackedBarPropTypes, defaultProps, type DSSingleStackedBarT } from './react-desc-prop-types.js';\nimport { StyledBar, StyledMouseOverDetectionBox, StyledTooltipContainer, Wrapper } from './styles.js';\nconst Bar = React.memo((props: DSSingleStackedBarT.BarT) => {\n const [isHover, setIsHover] = useState(false);\n const { height, TooltipRenderer, datum, tabIndex, isFocused, borderRadius, bg } = props;\n\n const isTooltipOpen = (isFocused || isHover) && !!TooltipRenderer;\n const {\n refs,\n floatingStyles,\n arrowStyles,\n context,\n isOpen: isFloatingOpen,\n } = useFloatingContext({\n externallyControlledIsOpen: isTooltipOpen,\n withoutAnimation: true,\n customOffset: [0, 14],\n });\n\n const handleRefCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (isFocused) {\n _ref?.focus();\n }\n },\n [isFocused],\n );\n\n const handleMouseEnter = useCallback(() => {\n setIsHover(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHover(false);\n }, []);\n return (\n <div>\n {TooltipRenderer && (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isFloatingOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer datum={datum} />\n </StyledTooltipContainer>\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n )}\n <StyledBar\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n bg={bg}\n height={height}\n borderRadius={borderRadius}\n innerRef={mergeRefs(handleRefCallback, refs.setReference)}\n tabIndex={tabIndex}\n role=\"img\"\n // until uziel work is merged we keep this default value\n aria-label={`${datum.name} value: ${datum.data}`}\n />\n </div>\n );\n});\n\nconst DSSingleStackedBar: React.ComponentType<DSSingleStackedBarT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSSingleStackedBarT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, DSSingleStackedBarPropTypes, 'DSSingleStackedBar');\n\n const globalAttributes = useGetGlobalAttributes<DSSingleStackedBarT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefaults,\n );\n\n const xstyledProps = useGetXstyledProps(propsWithDefaults);\n\n const { data, LegendRenderer, gutter, height } = propsWithDefaults;\n const [keyBarFocused, setKeyBarFocused] = useState<number>(0);\n const [isChartFocused, setIsChartFocused] = useState(false);\n\n const total = useMemo(() => data.map((datum) => datum.data).reduce((acc, curr) => acc + curr, 0), [data]);\n const cols = useMemo(() => data.map((datum) => `${Math.ceil(datum.data * 100) / total}%`), [data, total]);\n const rows = useMemo(\n () => (LegendRenderer !== undefined ? [`${height}px`, 'auto'] : [`${height}px`]),\n [LegendRenderer, height],\n );\n const barNames = useMemo(() => data.map((datum) => datum.name), [data]);\n const getBorderRadius = useCallback(\n (index: number) => {\n if (index === 0) return '50px 0 0 50px';\n if (index === data.length - 1) return '0 50px 50px 0';\n return undefined;\n },\n [data.length],\n );\n\n const handleOnKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowRight') {\n if (barNames[keyBarFocused + 1]) {\n setKeyBarFocused(keyBarFocused + 1);\n } else {\n setKeyBarFocused(0);\n }\n }\n if (e.code === 'ArrowLeft') {\n if (barNames[keyBarFocused - 1]) {\n setKeyBarFocused(keyBarFocused - 1);\n } else {\n setKeyBarFocused(barNames.length - 1);\n }\n }\n },\n [keyBarFocused, barNames],\n );\n\n return (\n <Wrapper\n cols={cols}\n gutter={gutter}\n role=\"region\"\n onKeyDown={handleOnKeyDown}\n tabIndex={-1}\n onFocus={() => setIsChartFocused(true)}\n onBlur={(e) => e.currentTarget !== e.target && setIsChartFocused(false)}\n {...xstyledProps}\n {...globalAttributes}\n >\n {data.map((datum, i) => (\n <Grid rows={rows}>\n <Bar\n key={datum.name}\n datum={datum}\n isFocused={barNames[keyBarFocused] === datum.name && isChartFocused}\n borderRadius={getBorderRadius(i)}\n bg={COLOR_PALLET[datum.color as keyof typeof COLOR_PALLET] ?? datum.color}\n tabIndex={i === keyBarFocused ? 0 : -1}\n {...props}\n />\n {LegendRenderer !== undefined ? <LegendRenderer key={`${datum.name}-legend`} datum={datum} /> : null}\n </Grid>\n ))}\n </Wrapper>\n );\n};\n\nDSSingleStackedBar.displayName = DSSingleStackedBarName;\nconst DSSingleStackedBarWithSchema = describe(DSSingleStackedBar);\nDSSingleStackedBarWithSchema.propTypes =\n DSSingleStackedBarPropTypes as unknown as WeakValidationMap<DSSingleStackedBarT.Props>;\n\nexport { DSSingleStackedBar, DSSingleStackedBarWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqDf,SAME,KANF;AAnDR,SAAS,YAAY;AACrB,SAAS,oBAAoB,iBAAiB,oBAAoB;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,OAAOA,UAAS,aAAa,SAAS,gBAAwC;AAC9E,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,6BAA6B,oBAA8C;AACpF,SAAS,WAAW,6BAA6B,wBAAwB,eAAe;AACxF,MAAM,MAAMA,OAAM,KAAK,CAAC,UAAoC;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,EAAE,QAAQ,iBAAiB,OAAO,UAAU,WAAW,cAAc,GAAG,IAAI;AAElF,QAA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AC;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,eAAe,QAAQ;AAAA,EAC1B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU;AAAA,MACV,SAAS,MAAM,kBAAkB,IAAI;AAAA,MACrC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,UAAU,kBAAkB,KAAK;AAAA,MACrE,GAAG;AAAA,MACH,GAAG;AAAA,MAEH,eAAK,IAAI,CAAC,OAAO,MAChB,qBAAC,QAAK,MACJ;AAAA;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA,WAAW,SAAS,aAAa,MAAM,MAAM,QAAQ;AAAA,YACrD,cAAc,gBAAgB,CAAC;AAAA,YAC/B,IAAI,aAAa,MAAM,KAAkC,KAAK,MAAM;AAAA,YACpE,UAAU,MAAM,gBAAgB,IAAI;AAAA,YACnC,GAAG;AAAA;AAAA,UANC,MAAM;AAAA,QAOb;AAAA,QACC,mBAAmB,SAAY,oBAAC,kBAA4C,SAAxB,GAAG,MAAM,IAAI,SAAyB,IAAK;AAAA,SAClG,CACD;AAAA;AAAA,EACH;AAEJ;AAEA,mBAAmB,cAAc;AACjC,MAAM,+BAA+B,SAAS,kBAAkB;AAChE,6BAA6B,YAC3B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { useFloatingContext, FloatingWrapper, PopoverArrow } from "@elliemae/ds-floating-context";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
6
|
import { StyledTooltipContainer, StyledMouseOverDetectionBox } from "../styles.js";
|
|
7
7
|
const FocusableRegion = (props) => {
|
|
8
|
-
const [referenceElement, setReferenceElement] = useState(null);
|
|
9
8
|
const theme = useContext(ThemeContext);
|
|
10
9
|
const { content, ...rest } = props;
|
|
10
|
+
const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({
|
|
11
|
+
externallyControlledIsOpen: true,
|
|
12
|
+
withoutAnimation: true,
|
|
13
|
+
customOffset: [0, 14]
|
|
14
|
+
});
|
|
11
15
|
return useMemo(
|
|
12
|
-
() => /* @__PURE__ */ jsx("foreignObject", { ...rest, ref:
|
|
13
|
-
|
|
16
|
+
() => /* @__PURE__ */ jsx("foreignObject", { ...rest, ref: refs.setReference, children: /* @__PURE__ */ jsxs(
|
|
17
|
+
FloatingWrapper,
|
|
14
18
|
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
innerRef: refs.setFloating,
|
|
20
|
+
isOpen: true,
|
|
21
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
22
|
+
context,
|
|
19
23
|
children: [
|
|
20
24
|
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, {}),
|
|
21
|
-
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: content })
|
|
25
|
+
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: content }),
|
|
26
|
+
/* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
|
|
22
27
|
]
|
|
23
28
|
}
|
|
24
29
|
) }),
|
|
25
|
-
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
[content, refs, floatingStyles, context, rest, theme.zIndex.tooltip]
|
|
26
32
|
);
|
|
27
33
|
};
|
|
28
34
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/FocusableRegion.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useContext, useMemo } from 'react';\nimport { useFloatingContext, FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledTooltipContainer, StyledMouseOverDetectionBox } from '../styles.js';\n\ninterface FocusableRegionProps {\n content: React.ReactNode;\n id: string;\n width: number;\n height: number;\n x?: number;\n y?: number;\n transform?: string;\n tabIndex?: number;\n style?: React.CSSProperties;\n}\n\nexport const FocusableRegion: React.ComponentType<FocusableRegionProps> = (props) => {\n const theme = useContext(ThemeContext);\n const { content, ...rest } = props;\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n externallyControlledIsOpen: true,\n withoutAnimation: true,\n customOffset: [0, 14],\n });\n\n return useMemo(\n () => (\n <foreignObject {...rest} ref={refs.setReference as React.Ref<SVGForeignObjectElement>}>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>{content}</StyledTooltipContainer>\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n </foreignObject>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [content, refs, floatingStyles, context, rest, theme.zIndex.tooltip],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC+Bf,SAME,KANF;AA9BR,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB,iBAAiB,oBAAoB;AAClE,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,mCAAmC;AAc7D,MAAM,kBAA6D,CAAC,UAAU;AACnF,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,EAAE,SAAS,GAAG,KAAK,IAAI;AAE7B,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,IAAI,mBAAmB;AAAA,IACxE,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,IAClB,cAAc,CAAC,GAAG,EAAE;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACL,MACE,oBAAC,mBAAe,GAAG,MAAM,KAAK,KAAK,cACjC;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAM;AAAA,QACN,gBAAgB,EAAE,GAAG,gBAAgB,QAAQ,MAAM,OAAO,QAAQ;AAAA,QAClE;AAAA,QAEA;AAAA,8BAAC,+BAA4B;AAAA,UAC7B,oBAAC,0BAAwB,mBAAQ;AAAA,UACjC,oBAAC,gBAAc,GAAG,aAAa;AAAA;AAAA;AAAA,IACjC,GACF;AAAA;AAAA,IAGF,CAAC,SAAS,MAAM,gBAAgB,SAAS,MAAM,MAAM,OAAO,OAAO;AAAA,EACrE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useCallback
|
|
4
|
-
import {
|
|
3
|
+
import { useContext, useCallback } from "react";
|
|
4
|
+
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
6
|
import { ChartContext } from "../../ChartContext.js";
|
|
7
7
|
import { StyledMouseOverDetectionBox, StyledTooltipContainer } from "../../styles.js";
|
|
@@ -16,25 +16,28 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
16
16
|
props: { TooltipRenderer, scrapper }
|
|
17
17
|
} = useContext(ChartContext);
|
|
18
18
|
const theme = useContext(ThemeContext);
|
|
19
|
-
const [referenceElement, setReferenceElement] = useState(null);
|
|
20
19
|
const yPositionString = yPosition;
|
|
20
|
+
const isActive = scrapperPosY === yPositionString;
|
|
21
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
22
|
+
externallyControlledIsOpen: isActive && !!TooltipRenderer,
|
|
23
|
+
withoutAnimation: true,
|
|
24
|
+
customOffset: [0, 5],
|
|
25
|
+
placement: scrapper?.tooltipPreference
|
|
26
|
+
});
|
|
21
27
|
const handleOnMouseEnter = useCallback(() => {
|
|
22
28
|
if (!isGrabbed) setScrapperPosY(yPositionString);
|
|
23
29
|
setActivePoint(null);
|
|
24
30
|
}, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);
|
|
25
31
|
const strokeDetectorWidth = yScale?.type === "BAND" ? yScale?.getBandwidth() : "4px";
|
|
26
32
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
27
|
-
|
|
33
|
+
isActive ? /* @__PURE__ */ jsxs("g", { children: [
|
|
28
34
|
TooltipRenderer ? /* @__PURE__ */ jsx("foreignObject", { children: /* @__PURE__ */ jsxs(
|
|
29
|
-
|
|
35
|
+
FloatingWrapper,
|
|
30
36
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
showPopover: true,
|
|
36
|
-
zIndex: theme.zIndex.tooltip,
|
|
37
|
-
startPlacementPreference: scrapper?.tooltipPreference,
|
|
37
|
+
innerRef: refs.setFloating,
|
|
38
|
+
isOpen: isActive,
|
|
39
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
40
|
+
context,
|
|
38
41
|
children: [
|
|
39
42
|
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, {}),
|
|
40
43
|
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: /* @__PURE__ */ jsx(TooltipRenderer, { data: datum }) })
|
|
@@ -44,7 +47,7 @@ const ScrapperLine = ({ yPosition, datum }) => {
|
|
|
44
47
|
/* @__PURE__ */ jsx(
|
|
45
48
|
"line",
|
|
46
49
|
{
|
|
47
|
-
ref:
|
|
50
|
+
ref: refs.setReference,
|
|
48
51
|
x1: innerWidth,
|
|
49
52
|
strokeWidth: "2px",
|
|
50
53
|
stroke: "transparent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/ScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext.js';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles.js';\nimport type { DSChartT } from '../../react-desc-prop-types.js';\ninterface ScrapperLineProps {\n yPosition: number;\n datum: DSChartT.ScrapperDatum[];\n}\n\nexport const ScrapperLine: React.ComponentType<ScrapperLineProps> = ({ yPosition, datum }) => {\n const {\n scrapperPosY,\n setScrapperPosY,\n innerWidth,\n yScale,\n setActivePoint,\n isGrabbed,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n const yPositionString = yPosition;\n const isActive = scrapperPosY === yPositionString;\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: isActive && !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n placement: scrapper?.tooltipPreference,\n });\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosY(yPositionString);\n setActivePoint(null);\n }, [isGrabbed, setScrapperPosY, setActivePoint, yPositionString]);\n\n const strokeDetectorWidth = yScale?.type === 'BAND' ? yScale?.getBandwidth() : '4px';\n\n return (\n <g>\n {isActive ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isActive}\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={innerWidth}\n strokeWidth=\"2px\"\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n <line\n x1={0}\n strokeWidth=\"2px\"\n stroke=\"grey\"\n strokeDasharray=\"4 4\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n ) : null}\n <line\n onMouseEnter={handleOnMouseEnter}\n x1={0}\n strokeWidth={strokeDetectorWidth}\n stroke=\"transparent\"\n y1={yPosition}\n x2={innerWidth}\n y2={yPosition}\n />\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC8CT,SAME,KANF;AA9Cd,SAAgB,YAAY,mBAAmB;AAC/C,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;AAO7D,MAAM,eAAuD,CAAC,EAAE,WAAW,MAAM,MAAM;AAC5F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,EACrC,IAAI,WAAW,YAAY;AAC3B,QAAM,QAAQ,WAAW,YAAY;AAErC,QAAM,kBAAkB;AACxB,QAAM,WAAW,iBAAiB;AAElC,QAAM,EAAE,MAAM,gBAAgB,QAAQ,IAAI,mBAAmB;AAAA,IAC3D,4BAA4B,YAAY,CAAC,CAAC;AAAA,IAC1C,kBAAkB;AAAA,IAClB,cAAc,CAAC,GAAG,CAAC;AAAA,IACnB,WAAW,UAAU;AAAA,EACvB,CAAC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-
import React2, { useContext, useCallback
|
|
4
|
-
import {
|
|
3
|
+
import React2, { useContext, useCallback } from "react";
|
|
4
|
+
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
5
5
|
import { ThemeContext } from "@elliemae/ds-system";
|
|
6
6
|
import { StyledMouseOverDetectionBox, StyledTooltipContainer } from "../../styles.js";
|
|
7
7
|
const VerticalScrapperLine = React2.memo(
|
|
@@ -19,8 +19,13 @@ const VerticalScrapperLine = React2.memo(
|
|
|
19
19
|
scrapper
|
|
20
20
|
}) => {
|
|
21
21
|
const theme = useContext(ThemeContext);
|
|
22
|
-
const [referenceElement, setReferenceElement] = useState();
|
|
23
22
|
const isActive = scrapperPosX === xPosition;
|
|
23
|
+
const { refs, floatingStyles, context } = useFloatingContext({
|
|
24
|
+
externallyControlledIsOpen: isActive && !isGrabbed && !!TooltipRenderer,
|
|
25
|
+
withoutAnimation: true,
|
|
26
|
+
customOffset: [0, 5],
|
|
27
|
+
placement: scrapper.tooltipPreference
|
|
28
|
+
});
|
|
24
29
|
const handleOnMouseEnter = useCallback(() => {
|
|
25
30
|
if (!isGrabbed) setScrapperPosX(xPosition);
|
|
26
31
|
setActivePoint(null);
|
|
@@ -29,15 +34,12 @@ const VerticalScrapperLine = React2.memo(
|
|
|
29
34
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${nonNullXscale.type === "BAND" ? nonNullXscale.getBandwidth() / 2 : 0}, 0)`, children: [
|
|
30
35
|
isActive && !isGrabbed ? /* @__PURE__ */ jsxs("g", { children: [
|
|
31
36
|
TooltipRenderer ? /* @__PURE__ */ jsx("foreignObject", { children: /* @__PURE__ */ jsxs(
|
|
32
|
-
|
|
37
|
+
FloatingWrapper,
|
|
33
38
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
showPopover: true,
|
|
39
|
-
zIndex: theme.zIndex.tooltip,
|
|
40
|
-
startPlacementPreference: scrapper.tooltipPreference,
|
|
39
|
+
innerRef: refs.setFloating,
|
|
40
|
+
isOpen: isActive && !isGrabbed,
|
|
41
|
+
floatingStyles: { ...floatingStyles, zIndex: theme.zIndex.tooltip },
|
|
42
|
+
context,
|
|
41
43
|
children: [
|
|
42
44
|
/* @__PURE__ */ jsx(StyledMouseOverDetectionBox, {}),
|
|
43
45
|
/* @__PURE__ */ jsx(StyledTooltipContainer, { children: /* @__PURE__ */ jsx(TooltipRenderer, { data }) })
|
|
@@ -47,7 +49,7 @@ const VerticalScrapperLine = React2.memo(
|
|
|
47
49
|
/* @__PURE__ */ jsx(
|
|
48
50
|
"line",
|
|
49
51
|
{
|
|
50
|
-
ref:
|
|
52
|
+
ref: refs.setReference,
|
|
51
53
|
x1: xPosition,
|
|
52
54
|
strokeWidth: "2px",
|
|
53
55
|
stroke: scrapper.color,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext, useCallback
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext, useCallback } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles.js';\nimport type { DSChartT } from '../../react-desc-prop-types.js';\nimport type { ScaleT } from '../../scales/index.js';\ninterface VerticalScrapperLineProps {\n rectDetector?: { left: number; right: number };\n xPosition: number;\n data: DSChartT.ScrapperDatum[];\n scrapperPosX: number;\n setScrapperPosX: (x: number) => void;\n isGrabbed: boolean;\n xScale: ScaleT | null;\n setActivePoint: React.Dispatch<React.SetStateAction<DSChartT.InternalDatum | null>>;\n innerHeight: number;\n TooltipRenderer?:\n | React.ComponentType<{\n data: {\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n datum: DSChartT.InternalDatum;\n }[];\n }>\n | undefined;\n scrapper: DSChartT.ScrapperT;\n}\n\nexport const VerticalScrapperLine: React.ComponentType<VerticalScrapperLineProps> = React.memo(\n ({\n rectDetector,\n xPosition,\n data,\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n TooltipRenderer,\n scrapper,\n }) => {\n const theme = useContext(ThemeContext);\n const isActive = scrapperPosX === xPosition;\n\n const { refs, floatingStyles, context } = useFloatingContext({\n externallyControlledIsOpen: isActive && !isGrabbed && !!TooltipRenderer,\n withoutAnimation: true,\n customOffset: [0, 5],\n placement: scrapper.tooltipPreference,\n });\n\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n // the code was abusing `xScale?.` even in place where it could lead to NaN\n // I am not sure what the `?.` was solving but xScale typescript says | null\n // this line is a monkeypatch to avoid the NaN but it charts should be properly revisited to use typesafe code and algorithms\n const nonNullXscale = xScale ?? { type: 'notBANDAndEverythingElseIsCurrentlyTreatedTheSame' };\n return (\n <g transform={`translate(${nonNullXscale.type === 'BAND' ? nonNullXscale.getBandwidth() / 2 : 0}, 0)`}>\n {isActive && !isGrabbed ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isActive && !isGrabbed}\n floatingStyles={{ ...floatingStyles, zIndex: theme.zIndex.tooltip }}\n context={context}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={data} />\n </StyledTooltipContainer>\n </FloatingWrapper>\n </foreignObject>\n ) : null}\n <line\n ref={refs.setReference as React.Ref<SVGLineElement>}\n x1={xPosition}\n strokeWidth=\"2px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n strokeDasharray=\"4 4\"\n />\n </g>\n ) : null}\n <rect\n onMouseOver={handleOnMouseEnter}\n x={\n nonNullXscale.type === 'BAND'\n ? xPosition - nonNullXscale.getBandwidth() / 2\n : xPosition - (rectDetector?.left ?? 0)\n }\n fill=\"transparent\"\n y={0}\n width={\n nonNullXscale.type === 'BAND'\n ? nonNullXscale.getBandwidth()\n : (rectDetector?.right ?? 0) + (rectDetector?.left ?? 0)\n }\n height={innerHeight}\n />\n </g>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoEP,SAME,KANF;AAnEhB,OAAOA,UAAS,YAAY,mBAAmB;AAC/C,SAAS,oBAAoB,uBAAuB;AACpD,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;AA0B7D,MAAM,uBAAuEA,OAAM;AAAA,EACxF,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAM;AACJ,UAAM,QAAQ,WAAW,YAAY;AACrC,UAAM,WAAW,iBAAiB;AAElC,UAAM,EAAE,MAAM,gBAAgB,QAAQ,IAAI,mBAAmB;AAAA,MAC3D,4BAA4B,YAAY,CAAC,aAAa,CAAC,CAAC;AAAA,MACxD,kBAAkB;AAAA,MAClB,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,WAAW,SAAS;AAAA,IACtB,CAAC;AAED,UAAM,qBAAqB,YAAY,MAAM;AAC3C,UAAI,CAAC,UAAW,iBAAgB,SAAS;AACzC,qBAAe,IAAI;AAAA,IACrB,GAAG,CAAC,WAAW,gBAAgB,iBAAiB,SAAS,CAAC;AAI1D,UAAM,gBAAgB,UAAU,EAAE,MAAM,oDAAoD;AAC5F,WACE,qBAAC,OAAE,WAAW,aAAa,cAAc,SAAS,SAAS,cAAc,aAAa,IAAI,IAAI,CAAC,QAC5F;AAAA,kBAAY,CAAC,YACZ,qBAAC,OACE;AAAA,0BACC,oBAAC,mBACC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ,YAAY,CAAC;AAAA,YACrB,gBAAgB,EAAE,GAAG,gBAAgB,QAAQ,MAAM,OAAO,QAAQ;AAAA,YAClE;AAAA,YAEA;AAAA,kCAAC,+BAA4B;AAAA,cAC7B,oBAAC,0BACC,8BAAC,mBAAgB,MAAY,GAC/B;AAAA;AAAA;AAAA,QACF,GACF,IACE;AAAA,QACJ;AAAA,UAAC;AAAA;AAAA,YACC,KAAK,KAAK;AAAA,YACV,IAAI;AAAA,YACJ,aAAY;AAAA,YACZ,QAAQ,SAAS;AAAA,YACjB,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,iBAAgB;AAAA;AAAA,QAClB;AAAA,SACF,IACE;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,GACE,cAAc,SAAS,SACnB,YAAY,cAAc,aAAa,IAAI,IAC3C,aAAa,cAAc,QAAQ;AAAA,UAEzC,MAAK;AAAA,UACL,GAAG;AAAA,UACH,OACE,cAAc,SAAS,SACnB,cAAc,aAAa,KAC1B,cAAc,SAAS,MAAM,cAAc,QAAQ;AAAA,UAE1D,QAAQ;AAAA;AAAA,MACV;AAAA,OACF;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/graphs/Chart/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { Series, ScaleLinear, ScaleBand } from 'd3';\nimport { type
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { Series, ScaleLinear, ScaleBand } from 'd3';\nimport { type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport { type SERIE_TYPES } from '../constants.js';\nexport declare namespace DSChartT {\n export type AxisTypeT = 'log' | 'band' | 'time' | 'linear';\n\n export type LinearScale = ScaleLinear<number, number, never>;\n export type BandScale = ScaleBand<string>;\n export type SeriesTypes = (typeof SERIE_TYPES)[keyof typeof SERIE_TYPES];\n export type Scales = LinearScale | BandScale;\n export interface SeriesT {\n name: string;\n data: Array<number | null | { x: number | string | Date; y: number }>;\n type: SeriesTypes;\n scale?: string;\n color: string;\n // line\n dashStyle?: string;\n pointRadius?: number;\n pointStyle?: string;\n }\n\n export interface ScrapperT {\n type: 'horizontal' | 'vertical';\n color: string;\n tooltipPreference: DSHookFloatingContextT.PopperPlacementsT;\n }\n\n export interface SerieComponentT {\n serie: InternalSerie;\n }\n\n export interface LegendT {\n position: 'right' | 'bottom' | 'left' | 'top';\n preventFilterAction?: boolean;\n }\n\n export interface AxisTickT {\n tickValues?: number[] | Date[];\n tickFormat?: ((value: string | number | Date) => string) | string;\n tickCount?: number;\n tickRotation?: number;\n overwriteTicks?: boolean;\n color?: string;\n }\n\n export type IntervalT = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';\n\n export interface AxisT {\n type: AxisTypeT;\n showGrid?: boolean;\n color?: string;\n label?: string;\n cols?: string[];\n domainPadding?: number | number[];\n intervalType?: IntervalT;\n hideAxis?: boolean;\n beginAtZero?: boolean;\n advanced?: {\n pointSpacing: {\n type: string;\n value: number;\n };\n };\n tick?: AxisTickT;\n plotRange?: number[];\n min?: number | Date;\n max?: number | Date;\n domainPaddingType?: string;\n }\n\n export interface InternalDatum {\n key: string;\n value: number | { x: number; y: number };\n position: number;\n serie: string;\n scale: string;\n color: string;\n }\n\n export interface InternalSerie {\n key: string;\n data: InternalDatum[];\n name: string;\n type: SeriesTypes;\n scale?: string | undefined;\n color: string;\n dashStyle?: string;\n pointRadius?: number;\n pointStyle?: string;\n curveStyle?: string;\n }\n\n export type InternalData = InternalSerie[];\n export interface TooltipRenderDataT {\n data: {\n datum: InternalDatum;\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n }[];\n }\n export interface OptionalProps {\n groups?: string[][];\n types?: 'scatter';\n scrapper?: ScrapperT;\n withTrendHighlight?: boolean;\n TooltipRenderer?: React.ComponentType<TooltipRenderDataT>;\n height?: number;\n width?: number;\n legend?: LegendT;\n xScroll?: boolean;\n yScroll?: boolean;\n y2Axis?: AxisT;\n yAxis: AxisT;\n xAxis: AxisT;\n }\n\n export interface DefaultProps {\n series: SeriesT[];\n }\n\n export interface RequiredProps {}\n\n export interface Props extends OptionalProps, DefaultProps, RequiredProps {}\n\n export type StackedSeriesByGroupT = Series<\n {\n [key: string]: number;\n },\n string\n >[][];\n\n export interface ScrapperDatum {\n position: number | undefined;\n name: string;\n xValue: string | number | Date | null;\n yValue: string | number | Date | null;\n key: number;\n datum: DSChartT.InternalDatum;\n }\n}\n\nexport const defaultProps: DSChartT.DefaultProps = {\n series: [\n {\n name: '1',\n data: [0],\n color: 'grey-100',\n type: 'bar',\n },\n ],\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n height: PropTypes.number.isRequired.description('height').defaultValue(''),\n width: PropTypes.number.isRequired.description('height').defaultValue(''),\n margin: PropTypes.shape({\n top: PropTypes.number,\n bottom: PropTypes.number,\n left: PropTypes.number,\n right: PropTypes.number,\n })\n .isRequired.description('margin')\n .defaultValue(''),\n series: PropTypes.arrayOf(PropTypes.object).description('yValue').defaultValue(''),\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,2BAA2B,iBAAiB;AAgJ9C,MAAM,eAAsC;AAAA,EACjD,QAAQ;AAAA,IACN;AAAA,MACE,MAAM;AAAA,MACN,MAAM,CAAC,CAAC;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,QAAQ,UAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACzE,OAAO,UAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACxE,QAAQ,UAAU,MAAM;AAAA,IACtB,KAAK,UAAU;AAAA,IACf,QAAQ,UAAU;AAAA,IAClB,MAAM,UAAU;AAAA,IAChB,OAAO,UAAU;AAAA,EACnB,CAAC,EACE,WAAW,YAAY,QAAQ,EAC/B,aAAa,EAAE;AAAA,EAClB,QAAQ,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,QAAQ,EAAE,aAAa,EAAE;AACnF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Series, ScaleLinear, ScaleBand } from 'd3';
|
|
2
|
-
import { type
|
|
2
|
+
import { type DSHookFloatingContextT } from '@elliemae/ds-floating-context';
|
|
3
3
|
import { type SERIE_TYPES } from '../constants.js';
|
|
4
4
|
export declare namespace DSChartT {
|
|
5
5
|
type AxisTypeT = 'log' | 'band' | 'time' | 'linear';
|
|
@@ -23,7 +23,7 @@ export declare namespace DSChartT {
|
|
|
23
23
|
interface ScrapperT {
|
|
24
24
|
type: 'horizontal' | 'vertical';
|
|
25
25
|
color: string;
|
|
26
|
-
tooltipPreference:
|
|
26
|
+
tooltipPreference: DSHookFloatingContextT.PopperPlacementsT;
|
|
27
27
|
}
|
|
28
28
|
interface SerieComponentT {
|
|
29
29
|
serie: InternalSerie;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dataviz",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.70.0-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - DataViz",
|
|
6
6
|
"files": [
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"d3": "~7.9.0",
|
|
40
40
|
"resize-observer-polyfill": "~1.5.1",
|
|
41
41
|
"uid": "^2.0.2",
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-system": "3.
|
|
42
|
+
"@elliemae/ds-floating-context": "3.70.0-next.10",
|
|
43
|
+
"@elliemae/ds-grid": "3.70.0-next.10",
|
|
44
|
+
"@elliemae/ds-props-helpers": "3.70.0-next.10",
|
|
45
|
+
"@elliemae/ds-system": "3.70.0-next.10"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@elliemae/pui-theme": "~2.13.0",
|
|
49
49
|
"@types/d3": "~7.4.0",
|
|
50
50
|
"jest": "^30.0.0",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
53
|
-
"@elliemae/ds-test-utils": "3.
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.70.0-next.10",
|
|
53
|
+
"@elliemae/ds-test-utils": "3.70.0-next.10"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@elliemae/pui-theme": "~2.13.0",
|