@semcore/d3-chart 3.60.0 → 3.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/Area.js +14 -12
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +17 -15
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +19 -17
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +15 -13
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +19 -17
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +12 -10
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +11 -9
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +19 -17
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +6 -4
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +12 -10
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +6 -4
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +22 -20
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +15 -13
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/Reference.js +15 -13
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +12 -10
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/Tooltip.js +12 -10
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +12 -10
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +5 -3
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +5 -3
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/es6/Area.js +14 -12
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +17 -15
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +19 -17
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +15 -13
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +19 -17
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +12 -10
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +11 -9
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/HorizontalBar.js +19 -17
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +6 -4
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +12 -10
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +6 -4
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +22 -20
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +15 -13
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/Reference.js +15 -13
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ScatterPlot.js +12 -10
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/Tooltip.js +12 -10
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +12 -10
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +5 -3
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +5 -3
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +54 -0
- package/lib/esm/Area.mjs +189 -0
- package/lib/esm/Axis.mjs +406 -0
- package/lib/esm/Bar.mjs +201 -0
- package/lib/esm/Bubble.mjs +216 -0
- package/lib/esm/CompactHorizontalBar.mjs +518 -0
- package/lib/esm/Donut.mjs +415 -0
- package/lib/esm/Dots.mjs +120 -0
- package/lib/esm/GroupBar.mjs +94 -0
- package/lib/esm/HorizontalBar.mjs +181 -0
- package/lib/esm/Hover.mjs +217 -0
- package/lib/esm/Line.mjs +199 -0
- package/lib/esm/Pattern.mjs +520 -0
- package/lib/esm/Plot.mjs +137 -0
- package/lib/esm/Radar.mjs +706 -0
- package/lib/esm/RadialTree.mjs +565 -0
- package/lib/esm/Reference.mjs +243 -0
- package/lib/esm/ResponsiveContainer.mjs +99 -0
- package/lib/esm/ScatterPlot.mjs +194 -0
- package/lib/esm/StackBar.mjs +177 -0
- package/lib/esm/StackedArea.mjs +84 -0
- package/lib/esm/Tooltip.mjs +255 -0
- package/lib/esm/Venn.mjs +234 -0
- package/lib/esm/a11y/DataAccessibilityTable.mjs +100 -0
- package/lib/esm/a11y/PlotA11yModule.mjs +117 -0
- package/lib/esm/a11y/PlotA11yView.mjs +146 -0
- package/lib/esm/a11y/bezier.mjs +32 -0
- package/lib/esm/a11y/focus.mjs +44 -0
- package/lib/esm/a11y/hints.mjs +122 -0
- package/lib/esm/a11y/insights.mjs +700 -0
- package/lib/esm/a11y/intl.mjs +17 -0
- package/lib/esm/a11y/locale.mjs +39 -0
- package/lib/esm/a11y/serialize.mjs +363 -0
- package/lib/esm/a11y/summarize.mjs +14 -0
- package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/module/de.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/en.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/es.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/fr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/it.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ja.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ko.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/nl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pt.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/sv.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/tr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/vi.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/zh.json.mjs +14 -0
- package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/view/de.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/en.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/es.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/fr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/it.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ja.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ko.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/nl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pt.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/sv.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/tr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/vi.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/zh.json.mjs +48 -0
- package/lib/esm/color.mjs +127 -0
- package/lib/esm/component/Chart/AbstractChart.mjs +408 -0
- package/lib/esm/component/Chart/AreaChart.mjs +145 -0
- package/lib/esm/component/Chart/BarChart.mjs +240 -0
- package/lib/esm/component/Chart/BubbleChart.mjs +135 -0
- package/lib/esm/component/Chart/CigaretteChart.mjs +294 -0
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +113 -0
- package/lib/esm/component/Chart/DonutChart.mjs +113 -0
- package/lib/esm/component/Chart/HistogramChart.mjs +166 -0
- package/lib/esm/component/Chart/LineChart.mjs +131 -0
- package/lib/esm/component/Chart/RadarChart.mjs +115 -0
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +144 -0
- package/lib/esm/component/Chart/VennChart.mjs +141 -0
- package/lib/esm/component/Chart/index.mjs +27 -0
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +91 -0
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +86 -0
- package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +12 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +240 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +4 -0
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +129 -0
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +90 -0
- package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +19 -0
- package/lib/esm/component/ChartLegend/index.mjs +5 -0
- package/lib/esm/component/Cigarette/Cigarette.mjs +139 -0
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +141 -0
- package/lib/esm/createElement.mjs +104 -0
- package/lib/esm/index.mjs +70 -0
- package/lib/esm/style/area.shadow.css +50 -0
- package/lib/esm/style/axis.shadow.css +88 -0
- package/lib/esm/style/bar.shadow.css +66 -0
- package/lib/esm/style/bubble.shadow.css +64 -0
- package/lib/esm/style/donut.shadow.css +36 -0
- package/lib/esm/style/dot.shadow.css +27 -0
- package/lib/esm/style/hover.shadow.css +9 -0
- package/lib/esm/style/line.shadow.css +43 -0
- package/lib/esm/style/plot.shadow.css +19 -0
- package/lib/esm/style/plotA11yModule.shadow.css +12 -0
- package/lib/esm/style/plotA11yView.shadow.css +39 -0
- package/lib/esm/style/radar.shadow.css +80 -0
- package/lib/esm/style/radial-tree.shadow.css +54 -0
- package/lib/esm/style/reference.shadow.css +43 -0
- package/lib/esm/style/scatterplot.shadow.css +41 -0
- package/lib/esm/style/tooltip.shadow.css +42 -0
- package/lib/esm/style/venn.shadow.css +48 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +31 -0
- package/lib/esm/translations/en.json.mjs +12 -0
- package/lib/esm/translations/es.json.mjs +11 -0
- package/lib/esm/translations/fr.json.mjs +11 -0
- package/lib/esm/translations/it.json.mjs +11 -0
- package/lib/esm/translations/ja.json.mjs +11 -0
- package/lib/esm/translations/ko.json.mjs +11 -0
- package/lib/esm/translations/nl.json.mjs +11 -0
- package/lib/esm/translations/pl.json.mjs +11 -0
- package/lib/esm/translations/pt.json.mjs +11 -0
- package/lib/esm/translations/sv.json.mjs +11 -0
- package/lib/esm/translations/tr.json.mjs +11 -0
- package/lib/esm/translations/vi.json.mjs +11 -0
- package/lib/esm/translations/zh.json.mjs +11 -0
- package/lib/esm/utils.mjs +266 -0
- package/package.json +11 -11
- package/vite.config.ts +2 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Box, Flex } from "@semcore/flex-box";
|
|
12
|
+
import Checkbox from "@semcore/checkbox";
|
|
13
|
+
import { Text } from "@semcore/typography";
|
|
14
|
+
import { StaticShapes } from "./LegendItem.type.mjs";
|
|
15
|
+
import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
16
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
17
|
+
import { PatternSymbol } from "../../../Pattern.mjs";
|
|
18
|
+
import { getChartDefaultColorName } from "../../../utils.mjs";
|
|
19
|
+
var _excluded = ["id", "checked", "color", "onChangeLegendItem", "shape"];
|
|
20
|
+
/*!__reshadow-styles__:"./legend-item.shadow.css"*/
|
|
21
|
+
var style = (
|
|
22
|
+
/*__reshadow_css_start__*/
|
|
23
|
+
(sstyled.insert(
|
|
24
|
+
/*__inner_css_start__*/
|
|
25
|
+
'.___SLegendItem_1u2d7_gg_{min-width:0;align-items:flex-start}@media (hover:hover){.___SLegendItem_1u2d7_gg_:hover{cursor:pointer}.___SLegendItem_1u2d7_gg_.__disabled_1u2d7_gg_:hover{cursor:default}}.___SPointShape_1u2d7_gg_.__color_1u2d7_gg_{background-color:var(--color_1u2d7);margin-right:8px;flex-shrink:0}.___SPointShape_1u2d7_gg_._shape_Circle_1u2d7_gg_._size_l_1u2d7_gg_{width:16px;height:16px;border-radius:8px;margin-top:4px}.___SPointShape_1u2d7_gg_._shape_Circle_1u2d7_gg_._size_m_1u2d7_gg_{width:12px;height:12px;border-radius:6px;margin-top:4px}.___SPointShape_1u2d7_gg_._shape_Line_1u2d7_gg_._size_l_1u2d7_gg_{width:16px;height:4px;border-radius:3px;margin-top:9px}.___SPointShape_1u2d7_gg_._shape_Line_1u2d7_gg_._size_m_1u2d7_gg_{width:12px;height:4px;border-radius:3px;margin-top:8px}.___SPointShape_1u2d7_gg_._shape_Square_1u2d7_gg_._size_l_1u2d7_gg_{width:16px;height:16px;border-radius:2px;margin-top:4px}.___SPointShape_1u2d7_gg_._shape_Square_1u2d7_gg_._size_m_1u2d7_gg_{width:12px;height:12px;border-radius:2px;margin-top:4px}.___SPointShape_1u2d7_gg_._shape_Pattern_1u2d7_gg_{background-color:transparent;margin-right:4px}.___SIcon_1u2d7_gg_{line-height:0;margin-right:4px}.___SIcon_1u2d7_gg_._size_l_1u2d7_gg_{margin-top:4px}.___SIcon_1u2d7_gg_._size_m_1u2d7_gg_{margin-top:2px}.___SLabel_1u2d7_gg_{min-width:0}.___SAdditionalLabel_1u2d7_gg_._size_l_1u2d7_gg_,.___SCount_1u2d7_gg_._size_l_1u2d7_gg_,.___SLabel_1u2d7_gg_._size_l_1u2d7_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SAdditionalLabel_1u2d7_gg_._size_m_1u2d7_gg_,.___SCount_1u2d7_gg_._size_m_1u2d7_gg_,.___SLabel_1u2d7_gg_._size_m_1u2d7_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SAdditionalLabel_1u2d7_gg_,.___SCount_1u2d7_gg_{margin-left:4px}.___SAdditionalLabel_1u2d7_gg_{white-space:nowrap;display:flex;align-items:flex-start}.___SAdditionalLabel_1u2d7_gg_::before{content:"";display:inline-block;background-color:var(--intergalactic-text-secondary, #6c6e79);height:4px;width:4px;border-radius:2px;margin-right:4px}.___SAdditionalLabel_1u2d7_gg_._size_l_1u2d7_gg_::before{margin-top:10px}.___SAdditionalLabel_1u2d7_gg_._size_m_1u2d7_gg_::before{margin-top:8px}.___SPatternSymbol_1u2d7_gg_{transform:scale(.8)}',
|
|
26
|
+
/*__inner_css_end__*/
|
|
27
|
+
"1u2d7_gg_"
|
|
28
|
+
), /*__reshadow_css_end__*/
|
|
29
|
+
{
|
|
30
|
+
"__SLegendItem": "___SLegendItem_1u2d7_gg_",
|
|
31
|
+
"_disabled": "__disabled_1u2d7_gg_",
|
|
32
|
+
"__SPointShape": "___SPointShape_1u2d7_gg_",
|
|
33
|
+
"_color": "__color_1u2d7_gg_",
|
|
34
|
+
"--color": "--color_1u2d7",
|
|
35
|
+
"_shape_Circle": "_shape_Circle_1u2d7_gg_",
|
|
36
|
+
"_size_l": "_size_l_1u2d7_gg_",
|
|
37
|
+
"_size_m": "_size_m_1u2d7_gg_",
|
|
38
|
+
"_shape_Line": "_shape_Line_1u2d7_gg_",
|
|
39
|
+
"_shape_Square": "_shape_Square_1u2d7_gg_",
|
|
40
|
+
"_shape_Pattern": "_shape_Pattern_1u2d7_gg_",
|
|
41
|
+
"__SIcon": "___SIcon_1u2d7_gg_",
|
|
42
|
+
"__SLabel": "___SLabel_1u2d7_gg_",
|
|
43
|
+
"__SAdditionalLabel": "___SAdditionalLabel_1u2d7_gg_",
|
|
44
|
+
"__SCount": "___SCount_1u2d7_gg_",
|
|
45
|
+
"__SPatternSymbol": "___SPatternSymbol_1u2d7_gg_"
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
var enhance = [resolveColorEnhance(), uniqueIDEnhancement()];
|
|
49
|
+
var LegendItemRoot = /* @__PURE__ */ function(_Component) {
|
|
50
|
+
_inherits(LegendItemRoot2, _Component);
|
|
51
|
+
var _super = _createSuper(LegendItemRoot2);
|
|
52
|
+
function LegendItemRoot2() {
|
|
53
|
+
_classCallCheck(this, LegendItemRoot2);
|
|
54
|
+
return _super.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
_createClass(LegendItemRoot2, [{
|
|
57
|
+
key: "getUniqueID",
|
|
58
|
+
value: function getUniqueID() {
|
|
59
|
+
var uid = this.asProps.uid;
|
|
60
|
+
return "chart-legend-item-".concat(uid);
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "getShapeProps",
|
|
64
|
+
value: function getShapeProps() {
|
|
65
|
+
var _this$asProps = this.asProps, checked = _this$asProps.checked, color = _this$asProps.color, shape = _this$asProps.shape, label = _this$asProps.label, id = _this$asProps.id, size = _this$asProps.size, resolveColor = _this$asProps.resolveColor, patterns = _this$asProps.patterns, onChangeLegendItem = _this$asProps.onChangeLegendItem;
|
|
66
|
+
return {
|
|
67
|
+
label,
|
|
68
|
+
shape,
|
|
69
|
+
checked,
|
|
70
|
+
color: resolveColor(color),
|
|
71
|
+
patternKey: color,
|
|
72
|
+
patterns,
|
|
73
|
+
size,
|
|
74
|
+
onChange: function onChange(value) {
|
|
75
|
+
onChangeLegendItem(id, value);
|
|
76
|
+
},
|
|
77
|
+
"aria-labelledby": shape === "Checkbox" ? this.getUniqueID() : null
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "getIconProps",
|
|
82
|
+
value: function getIconProps() {
|
|
83
|
+
var props = this.asProps;
|
|
84
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
85
|
+
children: props.icon
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "getLabelProps",
|
|
90
|
+
value: function getLabelProps() {
|
|
91
|
+
var _this$asProps2 = this.asProps, id = _this$asProps2.id, checked = _this$asProps2.checked;
|
|
92
|
+
_this$asProps2.color;
|
|
93
|
+
var onChangeLegendItem = _this$asProps2.onChangeLegendItem;
|
|
94
|
+
_this$asProps2.shape;
|
|
95
|
+
var props = _objectWithoutProperties(_this$asProps2, _excluded);
|
|
96
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
+
id: this.getUniqueID(),
|
|
98
|
+
checked,
|
|
99
|
+
onClick: function onClick() {
|
|
100
|
+
return onChangeLegendItem(id, !checked);
|
|
101
|
+
},
|
|
102
|
+
children: props.label
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "getAdditionalLabelProps",
|
|
107
|
+
value: function getAdditionalLabelProps() {
|
|
108
|
+
var props = this.asProps;
|
|
109
|
+
var additionalInfo = props.additionalInfo;
|
|
110
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
111
|
+
children: additionalInfo && "label" in additionalInfo ? "".concat(additionalInfo.label) : void 0
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "getCountProps",
|
|
116
|
+
value: function getCountProps() {
|
|
117
|
+
var props = this.asProps;
|
|
118
|
+
var additionalInfo = props.additionalInfo;
|
|
119
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
120
|
+
children: additionalInfo && "count" in additionalInfo ? "(".concat(additionalInfo.count, ")") : void 0
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "render",
|
|
125
|
+
value: function render() {
|
|
126
|
+
var _ref = this.asProps, _ref7;
|
|
127
|
+
var SLegendItem = Flex;
|
|
128
|
+
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, Children = _this$asProps3.Children, shape = _this$asProps3.shape;
|
|
129
|
+
var disabled = StaticShapes.includes(shape);
|
|
130
|
+
return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLegendItem, _ref7.cn("SLegendItem", _objectSpread({}, assignProps({
|
|
131
|
+
"disabled": disabled,
|
|
132
|
+
"__excludeProps": ["id"]
|
|
133
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
|
|
134
|
+
}
|
|
135
|
+
}]);
|
|
136
|
+
return LegendItemRoot2;
|
|
137
|
+
}(Component);
|
|
138
|
+
_defineProperty(LegendItemRoot, "displayName", "LegendItem");
|
|
139
|
+
_defineProperty(LegendItemRoot, "style", style);
|
|
140
|
+
_defineProperty(LegendItemRoot, "enhance", enhance);
|
|
141
|
+
_defineProperty(LegendItemRoot, "defaultProps", function() {
|
|
142
|
+
return {
|
|
143
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(LegendItemComponent.Shape, null), /* @__PURE__ */ React.createElement(LegendItemComponent.Icon, null), /* @__PURE__ */ React.createElement(LegendItemComponent.Label, null), /* @__PURE__ */ React.createElement(LegendItemComponent.AdditionalLabel, null), /* @__PURE__ */ React.createElement(LegendItemComponent.Count, null))
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
function Shape(props) {
|
|
147
|
+
var _ref2 = arguments[0], _ref10;
|
|
148
|
+
var SPointShape = Box;
|
|
149
|
+
var SPatternSymbol = PatternSymbol;
|
|
150
|
+
var styles = props.styles, size = props.size, shape = props.shape, checked = props.checked, color = props.color, _props$patternKey = props.patternKey, patternKey = _props$patternKey === void 0 ? getChartDefaultColorName(0) : _props$patternKey, Children = props.Children, hasChildren = props.children, patterns = props.patterns, onChange = props.onChange;
|
|
151
|
+
if (hasChildren) {
|
|
152
|
+
return /* @__PURE__ */ React.createElement(Children, null);
|
|
153
|
+
}
|
|
154
|
+
if (shape === "Pattern") {
|
|
155
|
+
var _ref8;
|
|
156
|
+
return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(Box, _ref8.cn("Box", {
|
|
157
|
+
"mr": 1
|
|
158
|
+
}), /* @__PURE__ */ React.createElement(SPatternSymbol, _ref8.cn("SPatternSymbol", {
|
|
159
|
+
"color": color,
|
|
160
|
+
"patternKey": patternKey,
|
|
161
|
+
"aria-hidden": true
|
|
162
|
+
})));
|
|
163
|
+
}
|
|
164
|
+
if (shape === "Checkbox") {
|
|
165
|
+
var _ref9;
|
|
166
|
+
return _ref9 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Checkbox, _ref9.cn("Checkbox", {
|
|
167
|
+
"size": size,
|
|
168
|
+
"checked": checked,
|
|
169
|
+
"theme": checked ? color : void 0,
|
|
170
|
+
"onChange": onChange,
|
|
171
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
172
|
+
})), patterns && /* @__PURE__ */ React.createElement(Box, _ref9.cn("Box", {
|
|
173
|
+
"mt": "2px",
|
|
174
|
+
"mr": 1
|
|
175
|
+
}), /* @__PURE__ */ React.createElement(SPatternSymbol, _ref9.cn("SPatternSymbol", {
|
|
176
|
+
"color": color,
|
|
177
|
+
"patternKey": patternKey,
|
|
178
|
+
"aria-hidden": true
|
|
179
|
+
}))));
|
|
180
|
+
}
|
|
181
|
+
return _ref10 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPointShape, _ref10.cn("SPointShape", _objectSpread({}, assignProps({}, _ref2))), /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})));
|
|
182
|
+
}
|
|
183
|
+
function Icon(_ref15) {
|
|
184
|
+
var _ref3 = arguments[0], _ref11;
|
|
185
|
+
var styles = _ref15.styles, hasChildren = _ref15.children, Children = _ref15.Children;
|
|
186
|
+
var SIcon = Box;
|
|
187
|
+
if (!hasChildren) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return _ref11 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SIcon, _ref11.cn("SIcon", _objectSpread({}, assignProps({
|
|
191
|
+
"tag": "span"
|
|
192
|
+
}, _ref3))), /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {})));
|
|
193
|
+
}
|
|
194
|
+
Icon.displayName = "Icon";
|
|
195
|
+
function Label(_ref16) {
|
|
196
|
+
var _ref4 = arguments[0], _ref12;
|
|
197
|
+
var styles = _ref16.styles, hasChildren = _ref16.children, Children = _ref16.Children;
|
|
198
|
+
var SLabel = Text;
|
|
199
|
+
if (!hasChildren) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return _ref12 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLabel, _ref12.cn("SLabel", _objectSpread({}, assignProps({
|
|
203
|
+
"use": "primary"
|
|
204
|
+
}, _ref4))), /* @__PURE__ */ React.createElement(Children, _ref12.cn("Children", {})));
|
|
205
|
+
}
|
|
206
|
+
Label.displayName = "Label";
|
|
207
|
+
function AdditionalLabel(_ref17) {
|
|
208
|
+
var _ref5 = arguments[0], _ref13;
|
|
209
|
+
var styles = _ref17.styles, hasChildren = _ref17.children, Children = _ref17.Children;
|
|
210
|
+
var SAdditionalLabel = Text;
|
|
211
|
+
if (!hasChildren) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return _ref13 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SAdditionalLabel, _ref13.cn("SAdditionalLabel", _objectSpread({}, assignProps({
|
|
215
|
+
"use": "secondary"
|
|
216
|
+
}, _ref5))), /* @__PURE__ */ React.createElement(Children, _ref13.cn("Children", {})));
|
|
217
|
+
}
|
|
218
|
+
AdditionalLabel.displayName = "AdditionalLabel";
|
|
219
|
+
function Count(_ref18) {
|
|
220
|
+
var _ref6 = arguments[0], _ref14;
|
|
221
|
+
var styles = _ref18.styles, hasChildren = _ref18.children, Children = _ref18.Children;
|
|
222
|
+
var SCount = Text;
|
|
223
|
+
if (!hasChildren) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
return _ref14 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCount, _ref14.cn("SCount", _objectSpread({}, assignProps({
|
|
227
|
+
"use": "secondary"
|
|
228
|
+
}, _ref6))), /* @__PURE__ */ React.createElement(Children, _ref14.cn("Children", {})));
|
|
229
|
+
}
|
|
230
|
+
Count.displayName = "Count";
|
|
231
|
+
var LegendItemComponent = createComponent(LegendItemRoot, {
|
|
232
|
+
Shape,
|
|
233
|
+
Icon,
|
|
234
|
+
Label,
|
|
235
|
+
AdditionalLabel,
|
|
236
|
+
Count
|
|
237
|
+
});
|
|
238
|
+
export {
|
|
239
|
+
LegendItemComponent
|
|
240
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
SLegendItem {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
SLegendItem:hover {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
SLegendItem[disabled]:hover {
|
|
11
|
+
cursor: default;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
SPointShape[color] {
|
|
15
|
+
background-color: var(--color);
|
|
16
|
+
margin-right: 8px;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SPointShape[shape='Circle'][size='l'] {
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
margin-top: 4px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
SPointShape[shape='Circle'][size='m'] {
|
|
28
|
+
width: 12px;
|
|
29
|
+
height: 12px;
|
|
30
|
+
border-radius: 6px;
|
|
31
|
+
margin-top: 4px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SPointShape[shape='Line'][size='l'] {
|
|
35
|
+
width: 16px;
|
|
36
|
+
height: 4px;
|
|
37
|
+
border-radius: 3px;
|
|
38
|
+
margin-top: 9px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
SPointShape[shape='Line'][size='m'] {
|
|
42
|
+
width: 12px;
|
|
43
|
+
height: 4px;
|
|
44
|
+
border-radius: 3px;
|
|
45
|
+
margin-top: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SPointShape[shape='Square'][size='l'] {
|
|
49
|
+
width: 16px;
|
|
50
|
+
height: 16px;
|
|
51
|
+
border-radius: 2px;
|
|
52
|
+
margin-top: 4px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
SPointShape[shape='Square'][size='m'] {
|
|
56
|
+
width: 12px;
|
|
57
|
+
height: 12px;
|
|
58
|
+
border-radius: 2px;
|
|
59
|
+
margin-top: 4px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
SPointShape[shape='Pattern'] {
|
|
63
|
+
background-color: transparent;
|
|
64
|
+
margin-right: 4px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SIcon {
|
|
68
|
+
line-height: 0;
|
|
69
|
+
margin-right: 4px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
SIcon[size='l'] {
|
|
73
|
+
margin-top: 4px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
SIcon[size='m'] {
|
|
77
|
+
margin-top: 2px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
SLabel {
|
|
81
|
+
min-width: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
SLabel[size='l'],
|
|
85
|
+
SAdditionalLabel[size='l'],
|
|
86
|
+
SCount[size='l'] {
|
|
87
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
88
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SLabel[size='m'],
|
|
92
|
+
SAdditionalLabel[size='m'],
|
|
93
|
+
SCount[size='m'] {
|
|
94
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
95
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
SAdditionalLabel,
|
|
99
|
+
SCount {
|
|
100
|
+
margin-left: 4px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
SAdditionalLabel {
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: flex-start;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
SAdditionalLabel::before {
|
|
110
|
+
content: '';
|
|
111
|
+
display: inline-block;
|
|
112
|
+
background-color: var(--intergalactic-text-secondary, #6c6e79);
|
|
113
|
+
height: 4px;
|
|
114
|
+
width: 4px;
|
|
115
|
+
border-radius: 2px;
|
|
116
|
+
margin-right: 4px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
SAdditionalLabel[size='l']::before {
|
|
120
|
+
margin-top: 10px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
SAdditionalLabel[size='m']::before {
|
|
124
|
+
margin-top: 8px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
SPatternSymbol {
|
|
128
|
+
transform: scale(0.8);
|
|
129
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
8
|
+
import createComponent, { sstyled as sstyled$1, assignProps } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import { LegendItemComponent } from "../LegendItem/LegendItem.mjs";
|
|
12
|
+
import { BaseLegend } from "../BaseLegend.mjs";
|
|
13
|
+
/*!__reshadow-styles__:"./legend-table.shadow.css"*/
|
|
14
|
+
var style = (
|
|
15
|
+
/*__reshadow_css_start__*/
|
|
16
|
+
(sstyled.insert(
|
|
17
|
+
/*__inner_css_start__*/
|
|
18
|
+
'.___SLegendTable_1viv3_gg_.__columns-count_1viv3_gg_{font-feature-settings:"tnum";font-variant-numeric:tabular-nums;display:grid;grid-template-columns:auto .2fr;align-items:center;height:-moz-fit-content;height:fit-content;grid-column-gap:16px;grid-row-gap:8px}.___SColumnItem_1viv3_gg_._size_l_1viv3_gg_{font-size:var(--intergalactic-fs-300, 16px);text-align:right}.___SColumnItem_1viv3_gg_._size_m_1viv3_gg_{font-size:var(--intergalactic-fs-200, 14px);text-align:right}',
|
|
19
|
+
/*__inner_css_end__*/
|
|
20
|
+
"1viv3_gg_"
|
|
21
|
+
), /*__reshadow_css_end__*/
|
|
22
|
+
{
|
|
23
|
+
"__SLegendTable": "___SLegendTable_1viv3_gg_",
|
|
24
|
+
"_columns-count": "__columns-count_1viv3_gg_",
|
|
25
|
+
"__SColumnItem": "___SColumnItem_1viv3_gg_",
|
|
26
|
+
"_size_l": "_size_l_1viv3_gg_",
|
|
27
|
+
"_size_m": "_size_m_1viv3_gg_"
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
var LegendTableRoot = /* @__PURE__ */ function(_BaseLegend) {
|
|
31
|
+
_inherits(LegendTableRoot2, _BaseLegend);
|
|
32
|
+
var _super = _createSuper(LegendTableRoot2);
|
|
33
|
+
function LegendTableRoot2() {
|
|
34
|
+
_classCallCheck(this, LegendTableRoot2);
|
|
35
|
+
return _super.apply(this, arguments);
|
|
36
|
+
}
|
|
37
|
+
_createClass(LegendTableRoot2, [{
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _ref = this.asProps, _ref3, _items$;
|
|
41
|
+
var SLegendTable = Box;
|
|
42
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, Children = _this$asProps.Children, _this$asProps$size = _this$asProps.size, size = _this$asProps$size === void 0 ? "m" : _this$asProps$size, items = _this$asProps.items;
|
|
43
|
+
var columnsCount = (_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.columns.length;
|
|
44
|
+
return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLegendTable, _ref3.cn("SLegendTable", _objectSpread({}, assignProps({
|
|
45
|
+
"columns-count": columnsCount + 1,
|
|
46
|
+
"role": "group"
|
|
47
|
+
}, _ref))), items.map(function(_ref5, index) {
|
|
48
|
+
var id = _ref5.id, _ref5$columns = _ref5.columns, columns = _ref5$columns === void 0 ? [] : _ref5$columns;
|
|
49
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
50
|
+
key: id
|
|
51
|
+
}, /* @__PURE__ */ React.createElement(Children, null), columns.map(function(item, index2) {
|
|
52
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
53
|
+
key: "".concat(id, "__").concat(index2)
|
|
54
|
+
}, /* @__PURE__ */ React.createElement(LegendTable.Column, {
|
|
55
|
+
index: index2,
|
|
56
|
+
size,
|
|
57
|
+
styles
|
|
58
|
+
}, item));
|
|
59
|
+
}));
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
return LegendTableRoot2;
|
|
64
|
+
}(BaseLegend);
|
|
65
|
+
_defineProperty(LegendTableRoot, "displayName", "LegendTable");
|
|
66
|
+
_defineProperty(LegendTableRoot, "style", style);
|
|
67
|
+
_defineProperty(LegendTableRoot, "defaultProps", function() {
|
|
68
|
+
return {
|
|
69
|
+
children: /* @__PURE__ */ React.createElement(LegendTable.LegendItem, null)
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
function ColumnComponent(props) {
|
|
73
|
+
var _ref2 = arguments[0], _ref4;
|
|
74
|
+
var SColumnItem = Box;
|
|
75
|
+
var styles = props.styles, index = props.index, size = props.size, Children = props.Children;
|
|
76
|
+
return _ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SColumnItem, _ref4.cn("SColumnItem", _objectSpread({}, assignProps({
|
|
77
|
+
"style": {
|
|
78
|
+
gridColumnStart: "".concat(index + 2),
|
|
79
|
+
gridColumnEnd: "".concat(index + 3)
|
|
80
|
+
},
|
|
81
|
+
"size": size
|
|
82
|
+
}, _ref2))), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})));
|
|
83
|
+
}
|
|
84
|
+
var LegendTable = createComponent(LegendTableRoot, {
|
|
85
|
+
LegendItem: LegendItemComponent,
|
|
86
|
+
Column: ColumnComponent
|
|
87
|
+
});
|
|
88
|
+
export {
|
|
89
|
+
LegendTable
|
|
90
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
SLegendTable[columns-count] {
|
|
2
|
+
font-variant-numeric: tabular-nums;
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: auto 0.2fr;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: fit-content;
|
|
7
|
+
grid-column-gap: 16px;
|
|
8
|
+
grid-row-gap: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
SColumnItem[size='l'] {
|
|
12
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
13
|
+
text-align: right;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SColumnItem[size='m'] {
|
|
17
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
18
|
+
text-align: right;
|
|
19
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { sstyled, Component } from "@semcore/core";
|
|
9
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
10
|
+
import createElement from "../../createElement.mjs";
|
|
11
|
+
import { roundedPath } from "../../utils.mjs";
|
|
12
|
+
import { PatternFill } from "../../Pattern.mjs";
|
|
13
|
+
import { callAllEventHandlers } from "@semcore/utils/lib/assignProps";
|
|
14
|
+
var CigaretteBarRoot = /* @__PURE__ */ function(_Component) {
|
|
15
|
+
_inherits(CigaretteBarRoot2, _Component);
|
|
16
|
+
var _super = _createSuper(CigaretteBarRoot2);
|
|
17
|
+
function CigaretteBarRoot2() {
|
|
18
|
+
var _this;
|
|
19
|
+
_classCallCheck(this, CigaretteBarRoot2);
|
|
20
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
args[_key] = arguments[_key];
|
|
22
|
+
}
|
|
23
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "refElement", /* @__PURE__ */ React.createRef());
|
|
25
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseMove", function() {
|
|
26
|
+
_this.handlers.hovered(true);
|
|
27
|
+
_this.setCursor("pointer");
|
|
28
|
+
});
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function() {
|
|
30
|
+
_this.handlers.hovered(false);
|
|
31
|
+
_this.setCursor("auto");
|
|
32
|
+
});
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function(e) {
|
|
34
|
+
var _this$asProps = _this.asProps, onClick = _this$asProps.onClick, dataKey = _this$asProps.dataKey;
|
|
35
|
+
if (onClick && e.currentTarget.tagName === "path") {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
onClick(dataKey, e);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "setCursor", function(value) {
|
|
42
|
+
var onClick = _this.asProps.onClick;
|
|
43
|
+
if (onClick) {
|
|
44
|
+
var _this$refElement$curr;
|
|
45
|
+
(_this$refElement$curr = _this.refElement.current) === null || _this$refElement$curr === void 0 ? void 0 : _this$refElement$curr.style.setProperty("cursor", value);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
_createClass(CigaretteBarRoot2, [{
|
|
51
|
+
key: "uncontrolledProps",
|
|
52
|
+
value: function uncontrolledProps() {
|
|
53
|
+
return {
|
|
54
|
+
hovered: false
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "getRect",
|
|
59
|
+
value: function getRect() {
|
|
60
|
+
var _this$asProps2 = this.asProps, x = _this$asProps2.x, y = _this$asProps2.y, width = _this$asProps2.width, height = _this$asProps2.height, radius = _this$asProps2.r, direction = _this$asProps2.direction, index = _this$asProps2.index, hovered = _this$asProps2.hovered;
|
|
61
|
+
var xV = x;
|
|
62
|
+
var yV = y;
|
|
63
|
+
var widthV = width;
|
|
64
|
+
var heightV = height;
|
|
65
|
+
if (hovered && direction === "horizontal") {
|
|
66
|
+
yV = yV - 2;
|
|
67
|
+
heightV = heightV + 4;
|
|
68
|
+
}
|
|
69
|
+
if (hovered && direction === "vertical") {
|
|
70
|
+
xV = xV - 2;
|
|
71
|
+
widthV = widthV + 4;
|
|
72
|
+
}
|
|
73
|
+
if (radius) {
|
|
74
|
+
if (direction === "horizontal") {
|
|
75
|
+
if (index === 0) {
|
|
76
|
+
return roundedPath(xV, yV, widthV, heightV, radius, true, false, true, false);
|
|
77
|
+
} else {
|
|
78
|
+
return roundedPath(xV, yV, widthV, heightV, radius, false, true, false, true);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
if (index === 0) {
|
|
82
|
+
return roundedPath(xV, yV, widthV, heightV, radius, true, true, false, false);
|
|
83
|
+
} else {
|
|
84
|
+
return roundedPath(xV, yV, widthV, heightV, radius, false, false, true, true);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return roundedPath(xV, yV, widthV, heightV, radius);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "render",
|
|
92
|
+
value: function render() {
|
|
93
|
+
var _ref;
|
|
94
|
+
var SBar = this.Element;
|
|
95
|
+
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, color = _this$asProps3.color, data = _this$asProps3.data, dataKey = _this$asProps3.dataKey, index = _this$asProps3.index, hide = _this$asProps3.hide, uid = _this$asProps3.uid, duration = _this$asProps3.duration, onMouseMove = _this$asProps3.onMouseMove, onMouseLeave = _this$asProps3.onMouseLeave, transparent = _this$asProps3.transparent, resolveColor = _this$asProps3.resolveColor, patterns = _this$asProps3.patterns;
|
|
96
|
+
var dSvg = this.getRect();
|
|
97
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
98
|
+
key: "horizontal-bar-".concat(index)
|
|
99
|
+
}, (_ref = sstyled(styles), /* @__PURE__ */ React.createElement(SBar, _ref.cn("SBar", {
|
|
100
|
+
"ref": this.refElement,
|
|
101
|
+
"aria-hidden": true,
|
|
102
|
+
"render": "path",
|
|
103
|
+
"clipPath": "url(#".concat(uid, ")"),
|
|
104
|
+
"__excludeProps": ["data", "scale", "value", "offset"],
|
|
105
|
+
"childrenPosition": "above",
|
|
106
|
+
"value": data[dataKey],
|
|
107
|
+
"index": index,
|
|
108
|
+
"hide": hide,
|
|
109
|
+
"fill": resolveColor(color),
|
|
110
|
+
"pattern": patterns ? "url(#".concat(uid, "-").concat(index, "-pattern)") : void 0,
|
|
111
|
+
"transparent": transparent,
|
|
112
|
+
"d": dSvg,
|
|
113
|
+
"use:duration": "".concat(duration, "ms"),
|
|
114
|
+
"onMouseMove": callAllEventHandlers(onMouseMove, this.handleMouseMove),
|
|
115
|
+
"onMouseLeave": callAllEventHandlers(onMouseLeave, this.handleMouseLeave),
|
|
116
|
+
"use:onClick": this.handleClick
|
|
117
|
+
}))), patterns && /* @__PURE__ */ React.createElement(PatternFill, _ref.cn("PatternFill", {
|
|
118
|
+
"id": "".concat(uid, "-").concat(index, "-pattern"),
|
|
119
|
+
"patternKey": color,
|
|
120
|
+
"color": resolveColor(color),
|
|
121
|
+
"patterns": patterns
|
|
122
|
+
})));
|
|
123
|
+
}
|
|
124
|
+
}]);
|
|
125
|
+
return CigaretteBarRoot2;
|
|
126
|
+
}(Component);
|
|
127
|
+
_defineProperty(CigaretteBarRoot, "displayName", "Cigarette.BarItem");
|
|
128
|
+
_defineProperty(CigaretteBarRoot, "enhance", [uniqueIDEnhancement()]);
|
|
129
|
+
_defineProperty(CigaretteBarRoot, "style", {});
|
|
130
|
+
_defineProperty(CigaretteBarRoot, "defaultProps", {
|
|
131
|
+
offset: [0, 0],
|
|
132
|
+
duration: 500,
|
|
133
|
+
direction: "horizontal",
|
|
134
|
+
defaultHovered: false
|
|
135
|
+
});
|
|
136
|
+
const Cigarette = createElement(CigaretteBarRoot);
|
|
137
|
+
export {
|
|
138
|
+
Cigarette as default
|
|
139
|
+
};
|