@semcore/d3-chart 3.0.1 → 3.1.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 +12 -0
- package/lib/cjs/Area.js +9 -9
- package/lib/cjs/Axis.js +14 -14
- package/lib/cjs/Bar.js +8 -8
- package/lib/cjs/Bubble.js +10 -10
- package/lib/cjs/Donut.js +7 -7
- package/lib/cjs/Dots.js +9 -9
- package/lib/cjs/HorizontalBar.js +8 -8
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +8 -8
- package/lib/cjs/Plot.js +3 -3
- package/lib/cjs/Radar.js +17 -17
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/ReferenceLine.js +9 -9
- package/lib/cjs/ScatterPlot.js +7 -7
- package/lib/cjs/Tooltip.js +12 -8
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +7 -7
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +5 -5
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/style/tooltip.shadow.css +3 -5
- package/lib/cjs/types/Donut.d.js.map +1 -1
- package/lib/cjs/types/Hover.d.js.map +1 -1
- package/lib/es6/Area.js +9 -9
- package/lib/es6/Axis.js +14 -14
- package/lib/es6/Bar.js +8 -8
- package/lib/es6/Bubble.js +10 -10
- package/lib/es6/Donut.js +7 -7
- package/lib/es6/Dots.js +9 -9
- package/lib/es6/HorizontalBar.js +8 -8
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +8 -8
- package/lib/es6/Plot.js +3 -3
- package/lib/es6/Radar.js +17 -17
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/ReferenceLine.js +9 -9
- package/lib/es6/ScatterPlot.js +7 -7
- package/lib/es6/Tooltip.js +12 -8
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +7 -7
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +5 -5
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/style/tooltip.shadow.css +3 -5
- package/lib/es6/types/Donut.d.js.map +1 -1
- package/lib/es6/types/Hover.d.js.map +1 -1
- package/lib/types/Donut.d.ts +1 -1
- package/lib/types/Hover.d.ts +2 -2
- package/package.json +2 -2
package/lib/es6/Tooltip.js
CHANGED
|
@@ -21,14 +21,14 @@ import resolveColor from '@semcore/utils/lib/color';
|
|
|
21
21
|
import createElement from './createElement';
|
|
22
22
|
import { CONSTANT } from './utils';
|
|
23
23
|
/*__reshadow-styles__:"./style/tooltip.shadow.css"*/
|
|
24
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
25
|
-
"__STooltip": "
|
|
26
|
-
"__STitle": "
|
|
27
|
-
"__SDotGroup": "
|
|
28
|
-
"__SDot": "
|
|
29
|
-
"_color": "
|
|
30
|
-
"--color": "--
|
|
31
|
-
"__SFooter": "
|
|
24
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___STooltip_ig05b_gg_{font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%);position:relative;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);border-radius:var(--intergalactic-popper-rounded, 6px);border:1px solid var(--intergalactic-border-secondary, #e0e1e9);box-sizing:border-box;box-shadow:var(--intergalactic-box-shadow-popper, 0px 1px 12px 0px rgba(25, 27, 35, 0.15));padding:var(--intergalactic-spacing-3x, 12px)}.___STitle_ig05b_gg_{color:var(--intergalactic-text-secondary, #6c6e79);margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SDotGroup_ig05b_gg_{display:flex;align-items:center}.___SDot_ig05b_gg_{width:8px;height:8px;border-radius:50%;margin-right:var(--intergalactic-spacing-2x, 8px);background:var(--intergalactic-icon-secondary-info, #2bb3ff)}.___SDot_ig05b_gg_.__color_ig05b_gg_{background:var(--color_ig05b)}.___SFooter_ig05b_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-1x, 4px) var(--intergalactic-spacing-3x, 12px);border-radius:0 0 var(--intergalactic-rounded-medium, 6px) var(--intergalactic-rounded-medium, 6px);margin:var(--intergalactic-spacing-3x, 12px) calc(-1*var(--intergalactic-spacing-3x, 12px)) calc(-1*var(--intergalactic-spacing-3x, 12px))}" /*__inner_css_end__*/, "ig05b_gg_") /*__reshadow_css_end__*/, {
|
|
25
|
+
"__STooltip": "___STooltip_ig05b_gg_",
|
|
26
|
+
"__STitle": "___STitle_ig05b_gg_",
|
|
27
|
+
"__SDotGroup": "___SDotGroup_ig05b_gg_",
|
|
28
|
+
"__SDot": "___SDot_ig05b_gg_",
|
|
29
|
+
"_color": "__color_ig05b_gg_",
|
|
30
|
+
"--color": "--color_ig05b",
|
|
31
|
+
"__SFooter": "___SFooter_ig05b_gg_"
|
|
32
32
|
});
|
|
33
33
|
var TooltipRoot = /*#__PURE__*/function (_Component) {
|
|
34
34
|
_inherits(TooltipRoot, _Component);
|
|
@@ -158,6 +158,7 @@ function PopperPopper(props) {
|
|
|
158
158
|
"y": y
|
|
159
159
|
}));
|
|
160
160
|
}
|
|
161
|
+
PopperPopper.style = style;
|
|
161
162
|
function Title(props) {
|
|
162
163
|
var _ref2 = arguments[0],
|
|
163
164
|
_ref6;
|
|
@@ -167,6 +168,7 @@ function Title(props) {
|
|
|
167
168
|
"__excludeProps": ['data', 'scale']
|
|
168
169
|
}, _ref2))));
|
|
169
170
|
}
|
|
171
|
+
Title.style = style;
|
|
170
172
|
function Dot(props) {
|
|
171
173
|
var _ref3 = arguments[0],
|
|
172
174
|
_ref7;
|
|
@@ -181,6 +183,7 @@ function Dot(props) {
|
|
|
181
183
|
"color": resolveColor(color)
|
|
182
184
|
})), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
|
|
183
185
|
}
|
|
186
|
+
Dot.style = style;
|
|
184
187
|
function Footer(props) {
|
|
185
188
|
var _ref4 = arguments[0],
|
|
186
189
|
_ref8;
|
|
@@ -190,6 +193,7 @@ function Footer(props) {
|
|
|
190
193
|
"__excludeProps": ['data', 'scale']
|
|
191
194
|
}, _ref4))));
|
|
192
195
|
}
|
|
196
|
+
Footer.style = style;
|
|
193
197
|
var Tooltip = createElement(TooltipRoot, {
|
|
194
198
|
Trigger: Popper.Trigger,
|
|
195
199
|
Popper: PopperPopper,
|
package/lib/es6/Tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["React","useCallback","Component","Root","sstyled","Popper","Box","findComponent","resolveColor","createElement","CONSTANT","style","_sstyled","insert","TooltipRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","$visible","anchorProps","tooltipProps","_createClass","key","value","getTriggerProps","_this$asProps","asProps","x","y","getPopperProps","excludeAnchorProps","_objectSpread","state","componentDidMount","_this2","_this$asProps2","eventEmitter","rootRef","unsubscribeTooltipVisible","subscribe","visible","node","setState","VIRTUAL_ELEMENT","current","contains","_this2$popper$current","setPopperTrigger","popper","update","componentWillUnmount","render","_ref","_this3","_this$asProps3","Children","children","tag","other","_objectWithoutProperties","_excluded","advanceMode","Tooltip","Trigger","displayName","_assignProps","handlerCancel","allowedAutoPlacements","_ref9","_this3$popper$current","setTrigger","Fragment","PopperPopper","props","_ref5","STooltip","Element","styles","cn","Title","_ref2","arguments[0]","_ref6","STitle","_assignProps2","Dot","_ref3","_ref7","color","SDotGroup","SDot","_assignProps3","Footer","_ref4","_ref8","SFooter","_assignProps4"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport { Component, Root, sstyled } from '@semcore/core';\nimport Popper from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport findComponent from '@semcore/utils/lib/findComponent';\nimport resolveColor from '@semcore/utils/lib/color';\nimport createElement from './createElement';\nimport { CONSTANT } from './utils';\n\nimport style from './style/tooltip.shadow.css';\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n\n static style = style;\n\n state = {\n $visible: false,\n anchorProps: {},\n tooltipProps: {},\n };\n\n handlerCancel = () => false;\n\n getTriggerProps() {\n // TODO: как то убрать\n const { x, y } = this.asProps;\n return { x, y };\n }\n\n getPopperProps() {\n if (this.asProps.excludeAnchorProps) {\n return {\n $visible: this.state.$visible,\n ...this.state.tooltipProps,\n };\n }\n\n return {\n $visible: this.state.$visible,\n ...this.state.anchorProps,\n ...this.state.tooltipProps,\n };\n }\n\n componentDidMount() {\n const { eventEmitter, rootRef } = this.asProps;\n this.unsubscribeTooltipVisible = eventEmitter.subscribe(\n 'onTooltipVisible',\n (visible, anchorProps, tooltipProps, node) => {\n this.setState(\n {\n anchorProps,\n tooltipProps,\n $visible: visible,\n },\n () => {\n if (node && (node[CONSTANT.VIRTUAL_ELEMENT] || rootRef.current.contains(node))) {\n this?.setPopperTrigger(node);\n this.popper.current?.update();\n }\n },\n );\n },\n );\n }\n\n componentWillUnmount() {\n if (this.unsubscribeTooltipVisible) {\n this.unsubscribeTooltipVisible();\n }\n }\n\n render() {\n const { Children, children, tag, ...other } = this.asProps;\n\n const advanceMode = !!findComponent(Children, [\n Tooltip.Trigger.displayName,\n Tooltip.Popper.displayName,\n ]);\n return (\n <Root\n render={Popper}\n visible={this.state.$visible}\n onFirstUpdate={this.handlerCancel}\n onOutsideClick={this.handlerCancel}\n interaction='none'\n offset={8}\n flip={{ allowedAutoPlacements: ['left', 'right'] }}\n >\n {({ popper, setTrigger }) => {\n this.setPopperTrigger = setTrigger;\n this.popper = popper;\n this.popper.current?.update();\n return advanceMode ? (\n <Children />\n ) : (\n <>\n {tag && <Tooltip.Trigger tag={tag} />}\n <Tooltip.Popper {...other}>{children}</Tooltip.Popper>\n </>\n );\n }}\n </Root>\n );\n }\n}\n\nfunction PopperPopper(props) {\n const { Element: STooltip, styles, $visible, x, y } = props;\n\n const handlerCancel = useCallback(() => false, []);\n\n if (!$visible) return null;\n\n return sstyled(styles)(\n <STooltip\n render={Popper.Popper}\n childrenPosition='inside'\n onMouseMove={handlerCancel}\n x={x}\n y={y}\n />,\n );\n}\n\nfunction Title(props) {\n const STitle = Root;\n const { styles } = props;\n return sstyled(styles)(<STitle render={Box} __excludeProps={['data', 'scale']} />);\n}\n\nfunction Dot(props) {\n const { styles, color, Children } = props;\n const SDotGroup = Root;\n const SDot = Box;\n return sstyled(styles)(\n <SDotGroup render={Box} __excludeProps={['data', 'scale']}>\n <SDot color={resolveColor(color)} />\n <Children />\n </SDotGroup>,\n );\n}\n\nfunction Footer(props) {\n const { styles } = props;\n const SFooter = Root;\n return sstyled(styles)(<SFooter render={Box} __excludeProps={['data', 'scale']} />);\n}\n\nconst Tooltip = createElement(TooltipRoot, {\n Trigger: Popper.Trigger,\n Popper: PopperPopper,\n Title,\n Footer,\n Dot,\n});\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACxD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,SAAS;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI7BC,WAAW,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,KAAA;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G,EAAHA;AACF,CAAC,CAAC;AAEF,eAAevB,OAAO"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["React","useCallback","Component","Root","sstyled","Popper","Box","findComponent","resolveColor","createElement","CONSTANT","style","_sstyled","insert","TooltipRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","$visible","anchorProps","tooltipProps","_createClass","key","value","getTriggerProps","_this$asProps","asProps","x","y","getPopperProps","excludeAnchorProps","_objectSpread","state","componentDidMount","_this2","_this$asProps2","eventEmitter","rootRef","unsubscribeTooltipVisible","subscribe","visible","node","setState","VIRTUAL_ELEMENT","current","contains","_this2$popper$current","setPopperTrigger","popper","update","componentWillUnmount","render","_ref","_this3","_this$asProps3","Children","children","tag","other","_objectWithoutProperties","_excluded","advanceMode","Tooltip","Trigger","displayName","_assignProps","handlerCancel","allowedAutoPlacements","_ref9","_this3$popper$current","setTrigger","Fragment","PopperPopper","props","_ref5","STooltip","Element","styles","cn","Title","_ref2","arguments[0]","_ref6","STitle","_assignProps2","Dot","_ref3","_ref7","color","SDotGroup","SDot","_assignProps3","Footer","_ref4","_ref8","SFooter","_assignProps4"],"sources":["../../src/Tooltip.jsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport { Component, Root, sstyled } from '@semcore/core';\nimport Popper from '@semcore/popper';\nimport { Box } from '@semcore/flex-box';\nimport findComponent from '@semcore/utils/lib/findComponent';\nimport resolveColor from '@semcore/utils/lib/color';\nimport createElement from './createElement';\nimport { CONSTANT } from './utils';\n\nimport style from './style/tooltip.shadow.css';\n\nclass TooltipRoot extends Component {\n static displayName = 'Tooltip';\n\n static style = style;\n\n state = {\n $visible: false,\n anchorProps: {},\n tooltipProps: {},\n };\n\n handlerCancel = () => false;\n\n getTriggerProps() {\n // TODO: как то убрать\n const { x, y } = this.asProps;\n return { x, y };\n }\n\n getPopperProps() {\n if (this.asProps.excludeAnchorProps) {\n return {\n $visible: this.state.$visible,\n ...this.state.tooltipProps,\n };\n }\n\n return {\n $visible: this.state.$visible,\n ...this.state.anchorProps,\n ...this.state.tooltipProps,\n };\n }\n\n componentDidMount() {\n const { eventEmitter, rootRef } = this.asProps;\n this.unsubscribeTooltipVisible = eventEmitter.subscribe(\n 'onTooltipVisible',\n (visible, anchorProps, tooltipProps, node) => {\n this.setState(\n {\n anchorProps,\n tooltipProps,\n $visible: visible,\n },\n () => {\n if (node && (node[CONSTANT.VIRTUAL_ELEMENT] || rootRef.current.contains(node))) {\n this?.setPopperTrigger(node);\n this.popper.current?.update();\n }\n },\n );\n },\n );\n }\n\n componentWillUnmount() {\n if (this.unsubscribeTooltipVisible) {\n this.unsubscribeTooltipVisible();\n }\n }\n\n render() {\n const { Children, children, tag, ...other } = this.asProps;\n\n const advanceMode = !!findComponent(Children, [\n Tooltip.Trigger.displayName,\n Tooltip.Popper.displayName,\n ]);\n return (\n <Root\n render={Popper}\n visible={this.state.$visible}\n onFirstUpdate={this.handlerCancel}\n onOutsideClick={this.handlerCancel}\n interaction='none'\n offset={8}\n flip={{ allowedAutoPlacements: ['left', 'right'] }}\n >\n {({ popper, setTrigger }) => {\n this.setPopperTrigger = setTrigger;\n this.popper = popper;\n this.popper.current?.update();\n return advanceMode ? (\n <Children />\n ) : (\n <>\n {tag && <Tooltip.Trigger tag={tag} />}\n <Tooltip.Popper {...other}>{children}</Tooltip.Popper>\n </>\n );\n }}\n </Root>\n );\n }\n}\n\nfunction PopperPopper(props) {\n const { Element: STooltip, styles, $visible, x, y } = props;\n\n const handlerCancel = useCallback(() => false, []);\n\n if (!$visible) return null;\n\n return sstyled(styles)(\n <STooltip\n render={Popper.Popper}\n childrenPosition='inside'\n onMouseMove={handlerCancel}\n x={x}\n y={y}\n />,\n );\n}\nPopperPopper.style = style;\n\nfunction Title(props) {\n const STitle = Root;\n const { styles } = props;\n return sstyled(styles)(<STitle render={Box} __excludeProps={['data', 'scale']} />);\n}\nTitle.style = style;\n\nfunction Dot(props) {\n const { styles, color, Children } = props;\n const SDotGroup = Root;\n const SDot = Box;\n return sstyled(styles)(\n <SDotGroup render={Box} __excludeProps={['data', 'scale']}>\n <SDot color={resolveColor(color)} />\n <Children />\n </SDotGroup>,\n );\n}\nDot.style = style;\n\nfunction Footer(props) {\n const { styles } = props;\n const SFooter = Root;\n return sstyled(styles)(<SFooter render={Box} __excludeProps={['data', 'scale']} />);\n}\nFooter.style = style;\n\nconst Tooltip = createElement(TooltipRoot, {\n Trigger: Popper.Trigger,\n Popper: PopperPopper,\n Title,\n Footer,\n Dot,\n});\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACxD,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,SAAS;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI7BC,WAAW,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,WAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IA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import createElement from './createElement';
|
|
|
18
18
|
import { CONSTANT } from './utils';
|
|
19
19
|
import Tooltip from './Tooltip';
|
|
20
20
|
/*__reshadow-styles__:"./style/venn.shadow.css"*/
|
|
21
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
22
|
-
"__SCircle": "
|
|
23
|
-
"--duration": "--
|
|
24
|
-
"_color": "
|
|
25
|
-
"--color": "--
|
|
26
|
-
"_transparent": "
|
|
27
|
-
"__SIntersection": "
|
|
21
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SCircle_z2fsg_gg_,.___SIntersection_z2fsg_gg_{stroke:var(--intergalactic-chart-grid-border, #ffffff);stroke-width:2px}.___SCircle_z2fsg_gg_{fill:var(--intergalactic-chart-palette-order-2, #59ddaa);fill-opacity:.5;transition-property:cx,cy;transition-duration:var(--duration_z2fsg);transition-timing-function:ease-in-out}@media (hover:hover){.___SCircle_z2fsg_gg_:hover{fill-opacity:.7}}.___SCircle_z2fsg_gg_.__color_z2fsg_gg_{fill:var(--color_z2fsg)}.___SCircle_z2fsg_gg_.__transparent_z2fsg_gg_{opacity:.3}.___SIntersection_z2fsg_gg_{fill-opacity:0}@media (hover:hover){.___SIntersection_z2fsg_gg_:hover{fill-opacity:.1}}.___SIntersection_z2fsg_gg_.__transparent_z2fsg_gg_{opacity:.3}" /*__inner_css_end__*/, "z2fsg_gg_") /*__reshadow_css_end__*/, {
|
|
22
|
+
"__SCircle": "___SCircle_z2fsg_gg_",
|
|
23
|
+
"--duration": "--duration_z2fsg",
|
|
24
|
+
"_color": "__color_z2fsg_gg_",
|
|
25
|
+
"--color": "--color_z2fsg",
|
|
26
|
+
"_transparent": "__transparent_z2fsg_gg_",
|
|
27
|
+
"__SIntersection": "___SIntersection_z2fsg_gg_"
|
|
28
28
|
});
|
|
29
29
|
var VennRoot = /*#__PURE__*/function (_Component) {
|
|
30
30
|
_inherits(VennRoot, _Component);
|
|
@@ -10,8 +10,8 @@ import { normalizeLocale } from './locale';
|
|
|
10
10
|
import { localizedMessages } from './translations/module/__intergalactic-dynamic-locales';
|
|
11
11
|
import { Root, sstyled } from '@semcore/core';
|
|
12
12
|
/*__reshadow-styles__:"../style/plotA11yModule.shadow.css"*/
|
|
13
|
-
var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
14
|
-
"__SPlotA11yModule": "
|
|
13
|
+
var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPlotA11yModule_ft6et_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0}.___SPlotA11yModule_ft6et_gg_:focus{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1}" /*__inner_css_end__*/, "ft6et_gg_") /*__reshadow_css_end__*/, {
|
|
14
|
+
"__SPlotA11yModule": "___SPlotA11yModule_ft6et_gg_"
|
|
15
15
|
});
|
|
16
16
|
import { Context as I18nContext, useI18n } from '@semcore/utils/lib/enhances/WithI18n';
|
|
17
17
|
import { Box } from '@semcore/flex-box';
|
|
@@ -12,9 +12,9 @@ import { getIntl } from './intl';
|
|
|
12
12
|
import { summarize } from './summarize';
|
|
13
13
|
import { Root, sstyled } from '@semcore/core';
|
|
14
14
|
/*__reshadow-styles__:"../style/plotA11yView.shadow.css"*/
|
|
15
|
-
var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
16
|
-
"__SPlotA11yView": "
|
|
17
|
-
"_focus-within": "__focus-
|
|
15
|
+
var styles = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPlotA11yView_1rkjx_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_1rkjx_gg_.__focus-within_1rkjx_gg_,.___SPlotA11yView_1rkjx_gg_:focus{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_1rkjx_gg_:focus,.___SPlotA11yView_1rkjx_gg_:focus-within{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_1rkjx_gg_ a{cursor:pointer;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_1rkjx_gg_ table,.___SPlotA11yView_1rkjx_gg_ td,.___SPlotA11yView_1rkjx_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}" /*__inner_css_end__*/, "1rkjx_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SPlotA11yView": "___SPlotA11yView_1rkjx_gg_",
|
|
17
|
+
"_focus-within": "__focus-within_1rkjx_gg_"
|
|
18
18
|
});
|
|
19
19
|
import { Box } from '@semcore/flex-box';
|
|
20
20
|
import { useAsyncI18nMessages } from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
@@ -130,7 +130,7 @@ export var PlotA11yView = function PlotA11yView(_ref3) {
|
|
|
130
130
|
(_heavyFindNextFocusab = heavyFindNextFocusableElement(plotRef.current)) === null || _heavyFindNextFocusab === void 0 ? void 0 : _heavyFindNextFocusab.focus();
|
|
131
131
|
}, []);
|
|
132
132
|
var handleSkipKeyboard = React.useCallback(function (event) {
|
|
133
|
-
if (event.
|
|
133
|
+
if (event.key !== 'Enter') return;
|
|
134
134
|
handleSkip();
|
|
135
135
|
}, [handleSkip]);
|
|
136
136
|
var handleGoToTable = React.useCallback(function () {
|
|
@@ -138,7 +138,7 @@ export var PlotA11yView = function PlotA11yView(_ref3) {
|
|
|
138
138
|
(_dataTableRef$current = dataTableRef.current) === null || _dataTableRef$current === void 0 ? void 0 : _dataTableRef$current.focus();
|
|
139
139
|
}, []);
|
|
140
140
|
var handleGoToTableKeyboard = React.useCallback(function (event) {
|
|
141
|
-
if (event.
|
|
141
|
+
if (event.key !== 'Enter') return;
|
|
142
142
|
handleGoToTable();
|
|
143
143
|
}, [handleGoToTable]);
|
|
144
144
|
var texts = React.useMemo(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlotA11yView.js","names":["React","heavyFindNextFocusableElement","makeDataSummarizationConfig","formatValue","getIntl","summarize","Root","sstyled","styles","_sstyled","insert","Box","useAsyncI18nMessages","localizedMessages","PlotA11yView","_ref3","_ref","arguments[0]","_ref2","id","providedData","data","hints","plotLabel","plotRef","providedConfig","config","locale","SPlotA11yView","translations","intl","useMemo","Array","isArray","keys","_fromHints","_fromHints2","_fromHints3","_fromHints4","_fromHints5","fromHints","push","apply","_toConsumableArray","fields","verticalAxes","horizontalAxes","valueAxes","additionalFields","Object","values","Set","filter","key","length","forEach","row","_fromHints6","duplicatedBaseKeys","baseKeys","titles","valuesAxes","map","has","axesTitle","vertical","horizontal","entry","undefined","doublicated","handled","_iterator","_createForOfIteratorHelper","_step","s","n","done","_step$value","_slicedToArray","value","label","err","e","f","renderTitle","useCallback","dataKey","_React$useState","useState","_React$useState2","summary","setSummary","_React$useState3","_React$useState4","generatingSummary","setGeneratingSummary","useEffect","disable","override","setTimeout","handleSkip","_heavyFindNextFocusab","current","focus","handleSkipKeyboard","event","code","handleGoToTable","_dataTableRef$current","dataTableRef","handleGoToTableKeyboard","texts","formatMessage","close","skipPlot","goToTable","summaryPlaceholder","table","useRef","createElement","cn","_objectSpread","_assignProps","concat","index","join"],"sources":["../../../src/a11y/PlotA11yView.tsx"],"sourcesContent":["import React from 'react';\nimport { heavyFindNextFocusableElement } from './focus';\nimport { makeDataSummarizationConfig } from './hints';\nimport type { A11yViewProps } from './PlotA11yModule';\nimport { formatValue } from './serialize';\nimport { getIntl } from './intl';\nimport { summarize } from './summarize';\nimport { Root, sstyled } from '@semcore/core';\nimport styles from '../style/plotA11yView.shadow.css';\nimport { Box } from '@semcore/flex-box';\nimport { useAsyncI18nMessages } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/view/__intergalactic-dynamic-locales';\n\nexport const PlotA11yView: React.FC<A11yViewProps> = ({\n id,\n data: providedData,\n hints,\n plotLabel,\n plotRef,\n config: providedConfig,\n locale,\n}) => {\n const SPlotA11yView = Root;\n const translations = useAsyncI18nMessages(localizedMessages, locale);\n const intl = React.useMemo(\n () => getIntl(locale, translations, localizedMessages),\n [locale, translations, localizedMessages],\n );\n const config = React.useMemo(() => makeDataSummarizationConfig(providedConfig), [providedConfig]);\n const data = React.useMemo(\n () => (Array.isArray(providedData) ? providedData : [providedData]),\n [providedData],\n );\n const keys = React.useMemo(() => {\n let fromHints: (string | number)[] = [];\n fromHints.push(...hints.fields.verticalAxes);\n fromHints.push(...hints.fields.horizontalAxes);\n fromHints.push(...hints.fields.valueAxes);\n fromHints.push(...config.additionalFields);\n fromHints.push(...Object.keys(hints.fields.values));\n\n fromHints = [...new Set(fromHints)].filter((key) => key in data[0]);\n\n if (fromHints.length === 0) {\n data.forEach((row) => fromHints.push(...Object.keys(row)));\n }\n\n return [...new Set(fromHints)];\n }, [data, hints]);\n const duplicatedBaseKeys = React.useMemo(() => {\n const baseKeys = keys\n .filter((key) => !hints.titles.valuesAxes[key])\n .map((key) => {\n if (hints.fields.verticalAxes.has(key) && hints.axesTitle.vertical)\n return [key, hints.axesTitle.vertical];\n if (hints.fields.horizontalAxes.has(key) && hints.axesTitle.horizontal)\n return [key, hints.axesTitle.horizontal];\n })\n .filter((entry) => entry !== undefined)\n .map((entry) => entry!);\n const doublicated: Record<string, true> = {};\n const handled: Record<string, string | number> = {};\n for (const [key, label] of baseKeys) {\n if (handled[label]) {\n doublicated[key] = true;\n doublicated[handled[label]] = true;\n }\n handled[label] = key;\n }\n return doublicated;\n }, [keys, hints]);\n const renderTitle = React.useCallback(\n (dataKey: string | number) => {\n if (hints.titles.valuesAxes[dataKey]) return hints.titles.valuesAxes[dataKey];\n if (!duplicatedBaseKeys[dataKey]) {\n if (hints.fields.verticalAxes.has(dataKey) && hints.axesTitle.vertical)\n return hints.axesTitle.vertical;\n if (hints.fields.horizontalAxes.has(dataKey) && hints.axesTitle.horizontal)\n return hints.axesTitle.horizontal;\n }\n\n return dataKey;\n },\n [data, hints, duplicatedBaseKeys],\n );\n\n const [summary, setSummary] = React.useState<string | null>(null);\n const [generatingSummary, setGeneratingSummary] = React.useState(true);\n\n React.useEffect(() => {\n if (config.disable) {\n setSummary('');\n setGeneratingSummary(false);\n return;\n }\n if (config.override) {\n setSummary(config.override);\n setGeneratingSummary(false);\n return;\n }\n setTimeout(() => {\n setSummary(summarize(providedData, hints, config, locale, translations, localizedMessages));\n setGeneratingSummary(false);\n }, 0);\n }, [providedData, hints, config, locale, translations, localizedMessages]);\n\n const handleSkip = React.useCallback(() => {\n if (!plotRef.current) return;\n\n heavyFindNextFocusableElement(plotRef.current)?.focus();\n }, []);\n const handleSkipKeyboard = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.code !== 'Enter') return;\n\n handleSkip();\n },\n [handleSkip],\n );\n const handleGoToTable = React.useCallback(() => {\n dataTableRef.current?.focus();\n }, []);\n const handleGoToTableKeyboard = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.code !== 'Enter') return;\n\n handleGoToTable();\n },\n [handleGoToTable],\n );\n\n const texts = React.useMemo(\n () => ({\n label: intl.formatMessage(\n { id: 'view-label' },\n { plotLabel: plotLabel ?? intl.formatMessage({ id: 'view-default-plot-label' }) },\n ),\n close: intl.formatMessage({ id: 'view-close' }),\n skipPlot: intl.formatMessage({ id: 'view-skip-plot' }),\n goToTable: intl.formatMessage({ id: 'view-go-to-table' }),\n summary: intl.formatMessage({ id: 'view-data-summary' }),\n summaryPlaceholder: intl.formatMessage({ id: 'view-summary-placeholder' }),\n table: intl.formatMessage({ id: 'view-table' }),\n }),\n [intl, plotLabel],\n );\n\n const dataTableRef = React.useRef<HTMLTableElement>(null);\n\n return sstyled(styles)(\n <SPlotA11yView render={Box} tabIndex={0} aria-label={texts.label}>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a aria-hidden onClick={handleSkip}>\n {texts.close}\n </a>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a role='link' tabIndex={0} onKeyDown={handleSkipKeyboard} onClick={handleSkip}>\n {texts.skipPlot}\n </a>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a role='link' tabIndex={0} onKeyDown={handleGoToTableKeyboard} onClick={handleGoToTable}>\n {texts.goToTable}\n </a>\n <strong>\n <label htmlFor={`${id}-data-summary`}>{texts.summary}</label>\n </strong>\n <div id={`${id}-data-summary`} aria-busy={generatingSummary} tabIndex={0}>\n {generatingSummary ? texts.summaryPlaceholder : summary}\n </div>\n <strong>\n <label htmlFor={`${id}-data-table`}>{texts.table}</label>\n </strong>\n <table id={`${id}-data-table`} tabIndex={0} ref={dataTableRef}>\n <thead>\n <tr>\n {keys.map((key, index) => (\n <th key={`${key}-${index}`}>{renderTitle(key)}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.map((row, index) => (\n <tr key={`${Object.values(row).join('-')}-${index}`}>\n {keys.map((key, index) => (\n <td key={`${key}-${index}`}>{formatValue(intl, row[key])}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </SPlotA11yView>,\n ) as React.ReactElement;\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SAASC,2BAA2B,QAAQ,SAAS;AAErD,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,IAAI,EAAEC,OAAO,QAAQ,e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C/D,CAAC,CACC;EAAA,CACN,CAAC,CACI,CACF,CACM;AAEpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"PlotA11yView.js","names":["React","heavyFindNextFocusableElement","makeDataSummarizationConfig","formatValue","getIntl","summarize","Root","sstyled","styles","_sstyled","insert","Box","useAsyncI18nMessages","localizedMessages","PlotA11yView","_ref3","_ref","arguments[0]","_ref2","id","providedData","data","hints","plotLabel","plotRef","providedConfig","config","locale","SPlotA11yView","translations","intl","useMemo","Array","isArray","keys","_fromHints","_fromHints2","_fromHints3","_fromHints4","_fromHints5","fromHints","push","apply","_toConsumableArray","fields","verticalAxes","horizontalAxes","valueAxes","additionalFields","Object","values","Set","filter","key","length","forEach","row","_fromHints6","duplicatedBaseKeys","baseKeys","titles","valuesAxes","map","has","axesTitle","vertical","horizontal","entry","undefined","doublicated","handled","_iterator","_createForOfIteratorHelper","_step","s","n","done","_step$value","_slicedToArray","value","label","err","e","f","renderTitle","useCallback","dataKey","_React$useState","useState","_React$useState2","summary","setSummary","_React$useState3","_React$useState4","generatingSummary","setGeneratingSummary","useEffect","disable","override","setTimeout","handleSkip","_heavyFindNextFocusab","current","focus","handleSkipKeyboard","event","handleGoToTable","_dataTableRef$current","dataTableRef","handleGoToTableKeyboard","texts","formatMessage","close","skipPlot","goToTable","summaryPlaceholder","table","useRef","createElement","cn","_objectSpread","_assignProps","concat","index","join"],"sources":["../../../src/a11y/PlotA11yView.tsx"],"sourcesContent":["import React from 'react';\nimport { heavyFindNextFocusableElement } from './focus';\nimport { makeDataSummarizationConfig } from './hints';\nimport type { A11yViewProps } from './PlotA11yModule';\nimport { formatValue } from './serialize';\nimport { getIntl } from './intl';\nimport { summarize } from './summarize';\nimport { Root, sstyled } from '@semcore/core';\nimport styles from '../style/plotA11yView.shadow.css';\nimport { Box } from '@semcore/flex-box';\nimport { useAsyncI18nMessages } from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/view/__intergalactic-dynamic-locales';\n\nexport const PlotA11yView: React.FC<A11yViewProps> = ({\n id,\n data: providedData,\n hints,\n plotLabel,\n plotRef,\n config: providedConfig,\n locale,\n}) => {\n const SPlotA11yView = Root;\n const translations = useAsyncI18nMessages(localizedMessages, locale);\n const intl = React.useMemo(\n () => getIntl(locale, translations, localizedMessages),\n [locale, translations, localizedMessages],\n );\n const config = React.useMemo(() => makeDataSummarizationConfig(providedConfig), [providedConfig]);\n const data = React.useMemo(\n () => (Array.isArray(providedData) ? providedData : [providedData]),\n [providedData],\n );\n const keys = React.useMemo(() => {\n let fromHints: (string | number)[] = [];\n fromHints.push(...hints.fields.verticalAxes);\n fromHints.push(...hints.fields.horizontalAxes);\n fromHints.push(...hints.fields.valueAxes);\n fromHints.push(...config.additionalFields);\n fromHints.push(...Object.keys(hints.fields.values));\n\n fromHints = [...new Set(fromHints)].filter((key) => key in data[0]);\n\n if (fromHints.length === 0) {\n data.forEach((row) => fromHints.push(...Object.keys(row)));\n }\n\n return [...new Set(fromHints)];\n }, [data, hints]);\n const duplicatedBaseKeys = React.useMemo(() => {\n const baseKeys = keys\n .filter((key) => !hints.titles.valuesAxes[key])\n .map((key) => {\n if (hints.fields.verticalAxes.has(key) && hints.axesTitle.vertical)\n return [key, hints.axesTitle.vertical];\n if (hints.fields.horizontalAxes.has(key) && hints.axesTitle.horizontal)\n return [key, hints.axesTitle.horizontal];\n })\n .filter((entry) => entry !== undefined)\n .map((entry) => entry!);\n const doublicated: Record<string, true> = {};\n const handled: Record<string, string | number> = {};\n for (const [key, label] of baseKeys) {\n if (handled[label]) {\n doublicated[key] = true;\n doublicated[handled[label]] = true;\n }\n handled[label] = key;\n }\n return doublicated;\n }, [keys, hints]);\n const renderTitle = React.useCallback(\n (dataKey: string | number) => {\n if (hints.titles.valuesAxes[dataKey]) return hints.titles.valuesAxes[dataKey];\n if (!duplicatedBaseKeys[dataKey]) {\n if (hints.fields.verticalAxes.has(dataKey) && hints.axesTitle.vertical)\n return hints.axesTitle.vertical;\n if (hints.fields.horizontalAxes.has(dataKey) && hints.axesTitle.horizontal)\n return hints.axesTitle.horizontal;\n }\n\n return dataKey;\n },\n [data, hints, duplicatedBaseKeys],\n );\n\n const [summary, setSummary] = React.useState<string | null>(null);\n const [generatingSummary, setGeneratingSummary] = React.useState(true);\n\n React.useEffect(() => {\n if (config.disable) {\n setSummary('');\n setGeneratingSummary(false);\n return;\n }\n if (config.override) {\n setSummary(config.override);\n setGeneratingSummary(false);\n return;\n }\n setTimeout(() => {\n setSummary(summarize(providedData, hints, config, locale, translations, localizedMessages));\n setGeneratingSummary(false);\n }, 0);\n }, [providedData, hints, config, locale, translations, localizedMessages]);\n\n const handleSkip = React.useCallback(() => {\n if (!plotRef.current) return;\n\n heavyFindNextFocusableElement(plotRef.current)?.focus();\n }, []);\n const handleSkipKeyboard = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter') return;\n\n handleSkip();\n },\n [handleSkip],\n );\n const handleGoToTable = React.useCallback(() => {\n dataTableRef.current?.focus();\n }, []);\n const handleGoToTableKeyboard = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key !== 'Enter') return;\n\n handleGoToTable();\n },\n [handleGoToTable],\n );\n\n const texts = React.useMemo(\n () => ({\n label: intl.formatMessage(\n { id: 'view-label' },\n { plotLabel: plotLabel ?? intl.formatMessage({ id: 'view-default-plot-label' }) },\n ),\n close: intl.formatMessage({ id: 'view-close' }),\n skipPlot: intl.formatMessage({ id: 'view-skip-plot' }),\n goToTable: intl.formatMessage({ id: 'view-go-to-table' }),\n summary: intl.formatMessage({ id: 'view-data-summary' }),\n summaryPlaceholder: intl.formatMessage({ id: 'view-summary-placeholder' }),\n table: intl.formatMessage({ id: 'view-table' }),\n }),\n [intl, plotLabel],\n );\n\n const dataTableRef = React.useRef<HTMLTableElement>(null);\n\n return sstyled(styles)(\n <SPlotA11yView render={Box} tabIndex={0} aria-label={texts.label}>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a aria-hidden onClick={handleSkip}>\n {texts.close}\n </a>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a role='link' tabIndex={0} onKeyDown={handleSkipKeyboard} onClick={handleSkip}>\n {texts.skipPlot}\n </a>\n {/* rome-ignore lint/a11y/useValidAnchor: <explanation> */}\n <a role='link' tabIndex={0} onKeyDown={handleGoToTableKeyboard} onClick={handleGoToTable}>\n {texts.goToTable}\n </a>\n <strong>\n <label htmlFor={`${id}-data-summary`}>{texts.summary}</label>\n </strong>\n <div id={`${id}-data-summary`} aria-busy={generatingSummary} tabIndex={0}>\n {generatingSummary ? texts.summaryPlaceholder : summary}\n </div>\n <strong>\n <label htmlFor={`${id}-data-table`}>{texts.table}</label>\n </strong>\n <table id={`${id}-data-table`} tabIndex={0} ref={dataTableRef}>\n <thead>\n <tr>\n {keys.map((key, index) => (\n <th key={`${key}-${index}`}>{renderTitle(key)}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.map((row, index) => (\n <tr key={`${Object.values(row).join('-')}-${index}`}>\n {keys.map((key, index) => (\n <td key={`${key}-${index}`}>{formatValue(intl, row[key])}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </SPlotA11yView>,\n ) as React.ReactElement;\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SAASC,2BAA2B,QAAQ,SAAS;AAErD,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAAC;AAAA,IAAAC,MAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;AAAA;AAE9C,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,oBAAoB,QAAQ,yCAAyC;AAC9E,SAASC,iBAAiB,QAAQ,qDAAqD;AAEvF,OAAO,IAAMC,YAAqC,GAAG,SAA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AAA,CAAAsH,aAAA,UAAApG,KAAA,CAAAqG,EAAA;IAAA,SAAAG,MAAA,CAAcvG,EAAE;IAAA,YAAyB,CAAC;IAAA,OAAOyF;EAAY,iBAC3D5G,KAAA,CAAAsH,aAAA,UAAApG,KAAA,CAAAqG,EAAA,4BACEvH,KAAA,CAAAsH,aAAA,OAAApG,KAAA,CAAAqG,EAAA,YACGrF,IAAI,CAAC4B,GAAG,CAAC,UAACT,GAAG,EAAEsE,KAAK;IAAA,oBACnB3H,KAAA,CAAAsH,aAAA;MAAIjE,GAAG,KAAAqE,MAAA,CAAKrE,GAAG,OAAAqE,MAAA,CAAIC,KAAK;IAAG,GAAEvC,WAAW,CAAC/B,GAAG,CAAC,CAAM;EAAA,CACpD,CAAC,CACC,CACC,eACRrD,KAAA,CAAAsH,aAAA,UAAApG,KAAA,CAAAqG,EAAA,eACGlG,IAAI,CAACyC,GAAG,CAAC,UAACN,GAAG,EAAEmE,KAAK;IAAA,oBACnB3H,KAAA,CAAAsH,aAAA;MAAIjE,GAAG,KAAAqE,MAAA,CAAKzE,MAAM,CAACC,MAAM,CAACM,GAAG,CAAC,CAACoE,IAAI,CAAC,GAAG,CAAC,OAAAF,MAAA,CAAIC,KAAK;IAAG,GACjDzF,IAAI,CAAC4B,GAAG,CAAC,UAACT,GAAG,EAAEsE,KAAK;MAAA,oBACnB3H,KAAA,CAAAsH,aAAA;QAAIjE,GAAG,KAAAqE,MAAA,CAAKrE,GAAG,OAAAqE,MAAA,CAAIC,KAAK;MAAG,GAAExH,WAAW,CAAC2B,IAAI,EAAE0B,GAAG,CAACH,GAAG,CAAC,CAAC,CAAM;IAAA,CAC/D,CAAC,CACC;EAAA,CACN,CAAC,CACI,CACF,CACM;AAEpB,CAAC"}
|
|
@@ -37,8 +37,6 @@ SDot[color] {
|
|
|
37
37
|
SFooter {
|
|
38
38
|
background: var(--intergalactic-bg-secondary-neutral, #f4f5f9);
|
|
39
39
|
padding: var(--intergalactic-spacing-1x, 4px) var(--intergalactic-spacing-3x, 12px);
|
|
40
|
-
border-radius: 0 0 var(--intergalactic-rounded-medium, 6px)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
calc(-1 * var(--intergalactic-spacing-3x, 12px));
|
|
44
|
-
}
|
|
40
|
+
border-radius: 0 0 var(--intergalactic-rounded-medium, 6px) var(--intergalactic-rounded-medium, 6px);
|
|
41
|
+
margin: var(--intergalactic-spacing-3x, 12px) calc(-1 * var(--intergalactic-spacing-3x, 12px)) calc(-1 * var(--intergalactic-spacing-3x, 12px));
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.js","names":[],"sources":["../../../src/types/Donut.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { TooltipType } from './Tooltip';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IDonutProps extends DonutProps, UnknownProperties {}\nexport type DonutProps = Context & {\n /** Inner radius\n * @default 0\n * */\n innerRadius?: number;\n /** Outer radius\n * @default calculated by the formula from width, height\n * */\n outerRadius?: number;\n /** Semi donut */\n halfsize?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n};\n\n/** @deprecated */\nexport interface IPieProps extends PieProps, UnknownProperties {}\nexport type PieProps = Context & {\n /**\n * Name of the field in the data\n * */\n dataKey: string;\n /**\n * Human readable name of the segment\n * */\n name: string;\n /** Color pie\n @default #50aef4\n **/\n color?: string;\n /**\n * Active sector\n * */\n active?: boolean;\n /** Enables element transparency */\n transparent?: boolean;\n};\n\n/** @deprecated */\nexport interface IEmptyDataProps extends EmptyDataProps, UnknownProperties {}\nexport type EmptyDataProps = Context & {};\n\n/** @deprecated */\nexport interface ILabelProps extends LabelProps, UnknownProperties {}\nexport type LabelProps = Context & {\n label?: string;\n};\n\ndeclare const Donut: IntergalacticD3Component<'g', DonutProps> & {\n Pie: IntergalacticD3Component<'path', PieProps>;\n EmptyData: IntergalacticD3Component<'path',
|
|
1
|
+
{"version":3,"file":"Donut.d.js","names":[],"sources":["../../../src/types/Donut.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { TooltipType } from './Tooltip';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IDonutProps extends DonutProps, UnknownProperties {}\nexport type DonutProps = Context & {\n /** Inner radius\n * @default 0\n * */\n innerRadius?: number;\n /** Outer radius\n * @default calculated by the formula from width, height\n * */\n outerRadius?: number;\n /** Semi donut */\n halfsize?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n};\n\n/** @deprecated */\nexport interface IPieProps extends PieProps, UnknownProperties {}\nexport type PieProps = Context & {\n /**\n * Name of the field in the data\n * */\n dataKey: string;\n /**\n * Human readable name of the segment\n * */\n name: string;\n /** Color pie\n @default #50aef4\n **/\n color?: string;\n /**\n * Active sector\n * */\n active?: boolean;\n /** Enables element transparency */\n transparent?: boolean;\n};\n\n/** @deprecated */\nexport interface IEmptyDataProps extends EmptyDataProps, UnknownProperties {}\nexport type EmptyDataProps = Context & {};\n\n/** @deprecated */\nexport interface ILabelProps extends LabelProps, UnknownProperties {}\nexport type LabelProps = Context & {\n label?: string;\n};\n\ndeclare const Donut: IntergalacticD3Component<'g', DonutProps> & {\n Pie: IntergalacticD3Component<'path', PieProps>;\n EmptyData: IntergalacticD3Component<'path', EmptyDataProps>;\n Label: IntergalacticD3Component<'text', LabelProps>;\n Tooltip: TooltipType<PieProps>;\n};\n\nexport default Donut;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport {
|
|
1
|
+
{"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport { BoxProps } from '@semcore/flex-box';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? string : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? string : never;\n }) => { children: ReturnEl };\n } & Omit<BoxProps, 'children'>,\n) => ReturnEl) &\n TooltipTypeBase;\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":""}
|
package/lib/types/Donut.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type LabelProps = Context & {
|
|
|
57
57
|
|
|
58
58
|
declare const Donut: IntergalacticD3Component<'g', DonutProps> & {
|
|
59
59
|
Pie: IntergalacticD3Component<'path', PieProps>;
|
|
60
|
-
EmptyData: IntergalacticD3Component<'path',
|
|
60
|
+
EmptyData: IntergalacticD3Component<'path', EmptyDataProps>;
|
|
61
61
|
Label: IntergalacticD3Component<'text', LabelProps>;
|
|
62
62
|
Tooltip: TooltipType<PieProps>;
|
|
63
63
|
};
|
package/lib/types/Hover.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { UnknownProperties } from '@semcore/core';
|
|
|
2
2
|
import { Context } from './context';
|
|
3
3
|
import { ReturnEl } from '@semcore/core';
|
|
4
4
|
import { TooltipTypeBase } from './Tooltip';
|
|
5
|
-
import {
|
|
5
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
6
6
|
import { IntergalacticD3Component } from './Plot';
|
|
7
7
|
|
|
8
8
|
/** @deprecated */
|
|
@@ -26,7 +26,7 @@ type HoverTooltip = (<X, Y>(
|
|
|
26
26
|
/** Index in `data` array of the current item */
|
|
27
27
|
yIndex: Y extends string ? string : never;
|
|
28
28
|
}) => { children: ReturnEl };
|
|
29
|
-
} & Omit<
|
|
29
|
+
} & Omit<BoxProps, 'children'>,
|
|
30
30
|
) => ReturnEl) &
|
|
31
31
|
TooltipTypeBase;
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/d3-chart",
|
|
3
3
|
"description": "Semrush D3 Chart Component",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@formatjs/intl": "2.3.0",
|
|
13
13
|
"@semcore/animation": "2.0.0",
|
|
14
14
|
"@semcore/flex-box": "5.0.0",
|
|
15
|
-
"@semcore/popper": "5.0.
|
|
15
|
+
"@semcore/popper": "5.0.2",
|
|
16
16
|
"@semcore/utils": "4.0.0",
|
|
17
17
|
"@types/d3-shape": "^3.1.0",
|
|
18
18
|
"@upsetjs/venn.js": "1.4.1",
|