@semcore/d3-chart 3.16.0 → 3.17.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 +7 -1
- 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 +10 -10
- package/lib/cjs/HorizontalBar.js +8 -8
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +9 -9
- package/lib/cjs/Plot.js +4 -4
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +17 -17
- package/lib/cjs/RadialTree.js +10 -10
- package/lib/cjs/ReferenceLine.js +9 -9
- package/lib/cjs/ScatterPlot.js +7 -7
- package/lib/cjs/Tooltip.js +8 -8
- package/lib/cjs/Venn.js +7 -7
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +3 -3
- package/lib/cjs/a11y/insights.js +12 -8
- package/lib/cjs/a11y/insights.js.map +1 -1
- package/lib/cjs/a11y/serialize.js +2 -1
- package/lib/cjs/a11y/serialize.js.map +1 -1
- package/lib/cjs/component/ChartLegend/BaseLegend.js +108 -0
- package/lib/cjs/component/ChartLegend/BaseLegend.js.map +1 -0
- package/lib/cjs/component/ChartLegend/BaseLegend.type.js +2 -0
- package/lib/cjs/component/ChartLegend/BaseLegend.type.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +93 -0
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.type.js +2 -0
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendFlex/legend-flex.shadow.css +11 -0
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +230 -0
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js +13 -0
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +109 -0
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +100 -0
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js +2 -0
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -0
- package/lib/cjs/component/ChartLegend/LegendTable/legend-table.shadow.css +16 -0
- package/lib/cjs/component/ChartLegend/index.js +23 -0
- package/lib/cjs/component/ChartLegend/index.js.map +1 -0
- package/lib/cjs/index.js +20 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +37 -0
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/lib/cjs/translations/de.json +3 -0
- package/lib/cjs/translations/en.json +3 -0
- package/lib/cjs/translations/es.json +3 -0
- package/lib/cjs/translations/fr.json +3 -0
- package/lib/cjs/translations/it.json +3 -0
- package/lib/cjs/translations/ja.json +3 -0
- package/lib/cjs/translations/ko.json +3 -0
- package/lib/cjs/translations/nl.json +3 -0
- package/lib/cjs/translations/pl.json +3 -0
- package/lib/cjs/translations/pt.json +3 -0
- package/lib/cjs/translations/sv.json +3 -0
- package/lib/cjs/translations/tr.json +3 -0
- package/lib/cjs/translations/vi.json +3 -0
- package/lib/cjs/translations/zh.json +3 -0
- package/lib/cjs/types/Plot.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +73 -14
- package/lib/cjs/types/index.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 +10 -10
- package/lib/es6/HorizontalBar.js +8 -8
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +9 -9
- package/lib/es6/Plot.js +4 -4
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +17 -17
- package/lib/es6/RadialTree.js +10 -10
- package/lib/es6/ReferenceLine.js +9 -9
- package/lib/es6/ScatterPlot.js +7 -7
- package/lib/es6/Tooltip.js +8 -8
- package/lib/es6/Venn.js +7 -7
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +3 -3
- package/lib/es6/a11y/insights.js +12 -8
- package/lib/es6/a11y/insights.js.map +1 -1
- package/lib/es6/a11y/serialize.js +2 -1
- package/lib/es6/a11y/serialize.js.map +1 -1
- package/lib/es6/component/ChartLegend/BaseLegend.js +100 -0
- package/lib/es6/component/ChartLegend/BaseLegend.js.map +1 -0
- package/lib/es6/component/ChartLegend/BaseLegend.type.js +2 -0
- package/lib/es6/component/ChartLegend/BaseLegend.type.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +86 -0
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.type.js +2 -0
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendFlex/legend-flex.shadow.css +11 -0
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +228 -0
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js +6 -0
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +109 -0
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +94 -0
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js +2 -0
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -0
- package/lib/es6/component/ChartLegend/LegendTable/legend-table.shadow.css +16 -0
- package/lib/es6/component/ChartLegend/index.js +5 -0
- package/lib/es6/component/ChartLegend/index.js.map +1 -0
- package/lib/es6/index.js +2 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +29 -0
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/lib/es6/translations/de.json +3 -0
- package/lib/es6/translations/en.json +3 -0
- package/lib/es6/translations/es.json +3 -0
- package/lib/es6/translations/fr.json +3 -0
- package/lib/es6/translations/it.json +3 -0
- package/lib/es6/translations/ja.json +3 -0
- package/lib/es6/translations/ko.json +3 -0
- package/lib/es6/translations/nl.json +3 -0
- package/lib/es6/translations/pl.json +3 -0
- package/lib/es6/translations/pt.json +3 -0
- package/lib/es6/translations/sv.json +3 -0
- package/lib/es6/translations/tr.json +3 -0
- package/lib/es6/translations/vi.json +3 -0
- package/lib/es6/translations/zh.json +3 -0
- package/lib/es6/types/Plot.d.js.map +1 -1
- package/lib/es6/types/index.d.js +20 -8
- package/lib/es6/types/index.d.js.map +1 -1
- package/lib/types/Plot.d.ts +5 -0
- package/lib/types/a11y/insights.d.ts +1 -0
- package/lib/types/component/ChartLegend/BaseLegend.d.ts +14 -0
- package/lib/types/component/ChartLegend/BaseLegend.type.d.ts +27 -0
- package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.d.ts +2 -0
- package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.type.d.ts +38 -0
- package/lib/types/component/ChartLegend/LegendItem/LegendItem.d.ts +2 -0
- package/lib/types/component/ChartLegend/LegendItem/LegendItem.type.d.ts +67 -0
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.d.ts +2 -0
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +21 -0
- package/lib/types/component/ChartLegend/index.d.ts +4 -0
- package/lib/types/index.d.ts +20 -8
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +41 -0
- package/package.json +3 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import { Component } from '@semcore/core';
|
|
9
|
+
import { makeDataHintsHandlers } from '../../a11y/hints';
|
|
10
|
+
export var BaseLegend = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(BaseLegend, _Component);
|
|
12
|
+
var _super = _createSuper(BaseLegend);
|
|
13
|
+
function BaseLegend() {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, BaseLegend);
|
|
16
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
+
args[_key] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
20
|
+
_defineProperty(_assertThisInitialized(_this), "bindOnChange", function (id) {
|
|
21
|
+
var item = _this.asProps.items.find(function (item) {
|
|
22
|
+
return item.id === id;
|
|
23
|
+
});
|
|
24
|
+
return function () {
|
|
25
|
+
var _this$props$onChangeV, _this$props;
|
|
26
|
+
var checked = !(item !== null && item !== void 0 && item.checked);
|
|
27
|
+
(_this$props$onChangeV = (_this$props = _this.props).onChangeVisibleItem) === null || _this$props$onChangeV === void 0 ? void 0 : _this$props$onChangeV.call(_this$props, id, checked);
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "bindOnMouseEnterItem", function (id) {
|
|
31
|
+
return function (e) {
|
|
32
|
+
var _this$props$onMouseEn, _this$props2;
|
|
33
|
+
(_this$props$onMouseEn = (_this$props2 = _this.props).onMouseEnterItem) === null || _this$props$onMouseEn === void 0 ? void 0 : _this$props$onMouseEn.call(_this$props2, id, e);
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "bindOnMouseLeaveItem", function (id) {
|
|
37
|
+
return function (e) {
|
|
38
|
+
var _this$props$onMouseLe, _this$props3;
|
|
39
|
+
(_this$props$onMouseLe = (_this$props3 = _this.props).onMouseLeaveItem) === null || _this$props$onMouseLe === void 0 ? void 0 : _this$props$onMouseLe.call(_this$props3, id, e);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
_createClass(BaseLegend, [{
|
|
45
|
+
key: "componentDidMount",
|
|
46
|
+
value: function componentDidMount() {
|
|
47
|
+
this.setHints();
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "componentDidUpdate",
|
|
51
|
+
value: function componentDidUpdate(prevProps) {
|
|
52
|
+
if (prevProps.items !== this.props.items || prevProps.dataHints !== this.props.dataHints) {
|
|
53
|
+
this.setHints();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "setHints",
|
|
58
|
+
value: function setHints() {
|
|
59
|
+
var _this$asProps = this.asProps,
|
|
60
|
+
items = _this$asProps.items,
|
|
61
|
+
dataHints = _this$asProps.dataHints;
|
|
62
|
+
var dataHintsHandler = dataHints ? makeDataHintsHandlers(dataHints) : undefined;
|
|
63
|
+
items.forEach(function (legendItem) {
|
|
64
|
+
dataHintsHandler === null || dataHintsHandler === void 0 ? void 0 : dataHintsHandler.labelKey('value', legendItem.id, legendItem.label);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "getItem",
|
|
69
|
+
value: function getItem(index) {
|
|
70
|
+
var line = this.asProps.items[index];
|
|
71
|
+
if (line === undefined) {
|
|
72
|
+
throw new Error("No index \"".concat(index, "\" in lines"));
|
|
73
|
+
}
|
|
74
|
+
return line;
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "getLegendItemProps",
|
|
78
|
+
value: function getLegendItemProps(_, index) {
|
|
79
|
+
var _this$asProps2 = this.asProps,
|
|
80
|
+
_this$asProps2$shape = _this$asProps2.shape,
|
|
81
|
+
shape = _this$asProps2$shape === void 0 ? 'Checkbox' : _this$asProps2$shape,
|
|
82
|
+
_this$asProps2$size = _this$asProps2.size,
|
|
83
|
+
size = _this$asProps2$size === void 0 ? 'm' : _this$asProps2$size;
|
|
84
|
+
var line = this.getItem(index);
|
|
85
|
+
return _objectSpread(_objectSpread({}, line), {}, {
|
|
86
|
+
shape: shape,
|
|
87
|
+
size: size,
|
|
88
|
+
onClick: this.bindOnChange(line.id),
|
|
89
|
+
onMouseEnter: this.bindOnMouseEnterItem(line.id),
|
|
90
|
+
onMouseLeave: this.bindOnMouseLeaveItem(line.id),
|
|
91
|
+
style: {
|
|
92
|
+
gridRowStart: "".concat(index + 1),
|
|
93
|
+
gridRowEnd: "".concat(index + 2)
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}]);
|
|
98
|
+
return BaseLegend;
|
|
99
|
+
}(Component);
|
|
100
|
+
//# sourceMappingURL=BaseLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseLegend.js","names":["Component","makeDataHintsHandlers","BaseLegend","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","id","item","asProps","items","find","_this$props$onChangeV","_this$props","checked","props","onChangeVisibleItem","e","_this$props$onMouseEn","_this$props2","onMouseEnterItem","_this$props$onMouseLe","_this$props3","onMouseLeaveItem","_createClass","key","value","componentDidMount","setHints","componentDidUpdate","prevProps","dataHints","_this$asProps","dataHintsHandler","undefined","forEach","legendItem","labelKey","label","getItem","index","line","Error","getLegendItemProps","_","_this$asProps2","_this$asProps2$shape","shape","_this$asProps2$size","size","_objectSpread","onClick","bindOnChange","onMouseEnter","bindOnMouseEnterItem","onMouseLeave","bindOnMouseLeaveItem","style","gridRowStart","gridRowEnd"],"sources":["../../../../src/component/ChartLegend/BaseLegend.tsx"],"sourcesContent":["import React from 'react';\nimport { Component, Intergalactic } from '@semcore/core';\nimport { LegendItemKey, LegendItemProps } from './LegendItem/LegendItem.type';\nimport { LegendProps } from './BaseLegend.type';\nimport { makeDataHintsHandlers } from '../../a11y/hints';\n\nexport abstract class BaseLegend<T extends LegendProps> extends Component<T> {\n componentDidMount() {\n this.setHints();\n }\n\n componentDidUpdate(prevProps: T) {\n if (prevProps.items !== this.props.items || prevProps.dataHints !== this.props.dataHints) {\n this.setHints();\n }\n }\n\n setHints() {\n const { items, dataHints } = this.asProps;\n const dataHintsHandler = dataHints ? makeDataHintsHandlers(dataHints) : undefined;\n\n items.forEach((legendItem) => {\n dataHintsHandler?.labelKey('value', legendItem.id, legendItem.label);\n });\n }\n\n getItem(index: number) {\n const line = this.asProps.items[index];\n\n if (line === undefined) {\n throw new Error(`No index \"${index}\" in lines`);\n }\n\n return line;\n }\n\n getLegendItemProps(\n _: {},\n index: number,\n ): LegendItemProps & Intergalactic.InternalTypings.ComponentPropsNesting<'div'> {\n const { shape = 'Checkbox', size = 'm' } = this.asProps;\n const line = this.getItem(index);\n\n return {\n ...line,\n shape,\n size,\n onClick: this.bindOnChange(line.id),\n onMouseEnter: this.bindOnMouseEnterItem(line.id),\n onMouseLeave: this.bindOnMouseLeaveItem(line.id),\n style: { gridRowStart: `${index + 1}`, gridRowEnd: `${index + 2}` },\n };\n }\n\n bindOnChange = (id: LegendItemKey) => {\n const item = this.asProps.items.find((item) => item.id === id);\n\n return () => {\n const checked = !item?.checked;\n\n this.props.onChangeVisibleItem?.(id, checked);\n };\n };\n\n bindOnMouseEnterItem = (id: LegendItemKey) => {\n return (e: React.SyntheticEvent) => {\n this.props.onMouseEnterItem?.(id, e);\n };\n };\n\n bindOnMouseLeaveItem = (id: LegendItemKey) => {\n return (e: React.SyntheticEvent) => {\n this.props.onMouseLeaveItem?.(id, e);\n };\n };\n}\n"],"mappings":";;;;;;;AACA,SAASA,SAAS,QAAuB,eAAe;AAGxD,SAASC,qBAAqB,QAAQ,kBAAkB;AAExD,WAAsBC,UAAU,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,UAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,UAAA;EAAA,SAAAA,WAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,UAAA;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,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,mBAgDf,UAACa,EAAiB,EAAK;MACpC,IAAMC,IAAI,GAAGd,KAAA,CAAKe,OAAO,CAACC,KAAK,CAACC,IAAI,CAAC,UAACH,IAAI;QAAA,OAAKA,IAAI,CAACD,EAAE,KAAKA,EAAE;MAAA,EAAC;MAE9D,OAAO,YAAM;QAAA,IAAAK,qBAAA,EAAAC,WAAA;QACX,IAAMC,OAAO,GAAG,EAACN,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEM,OAAO;QAE9B,CAAAF,qBAAA,IAAAC,WAAA,GAAAnB,KAAA,CAAKqB,KAAK,EAACC,mBAAm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EAAE,CAAC;QACnC8C,YAAY,EAAE,IAAI,CAACC,oBAAoB,CAACb,IAAI,CAAClC,EAAE,CAAC;QAChDgD,YAAY,EAAE,IAAI,CAACC,oBAAoB,CAACf,IAAI,CAAClC,EAAE,CAAC;QAChDkD,KAAK,EAAE;UAAEC,YAAY,KAAAtD,MAAA,CAAKoC,KAAK,GAAG,CAAC,CAAE;UAAEmB,UAAU,KAAAvD,MAAA,CAAKoC,KAAK,GAAG,CAAC;QAAG;MAAC;IAEvE;EAAC;EAAA,OAAAnD,UAAA;AAAA,EA9C6DF,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseLegend.type.js","names":[],"sources":["../../../../src/component/ChartLegend/BaseLegend.type.ts"],"sourcesContent":["import { BoxProps } from '@semcore/flex-box';\nimport { LegendItem, LegendItemKey, ShapeType } from './LegendItem/LegendItem.type';\nimport { DataStructureHints } from '../../a11y/hints';\n\nexport type LSize = 'm' | 'l';\n\nexport type BaseChartLegendProps = {\n /**\n * Size for legend items\n */\n size?: LSize;\n /**\n * Shape of data item on Legend panel\n */\n shape?: ShapeType;\n /**\n * Handler for change visible for data items. Doesn't work if Shape one of 'Circle' | 'Line' | 'Square'\n */\n onChangeVisibleItem?: (key: LegendItemKey, isVisible: boolean) => void;\n\n onMouseEnterItem?: (key: LegendItemKey, e?: React.SyntheticEvent) => void;\n\n onMouseLeaveItem?: (key: LegendItemKey, e?: React.SyntheticEvent) => void;\n\n dataHints?: DataStructureHints;\n};\n\nexport type LegendProps = BoxProps &\n BaseChartLegendProps & {\n /**\n * Legend items\n */\n items: LegendItem[];\n };\n"],"mappings":""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
8
|
+
import { assignProps as _assignProps } from "@semcore/core";
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import createComponent, { sstyled, Root } from '@semcore/core';
|
|
11
|
+
import { Flex } from '@semcore/flex-box';
|
|
12
|
+
/*__reshadow-styles__:"./legend-flex.shadow.css"*/
|
|
13
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendFlex_rzdp9_gg_._direction_row_rzdp9_gg_{align-items:center;flex-wrap:wrap;grid-gap:8px 16px;gap:8px 16px}.___SLegendFlex_rzdp9_gg_._direction_column_rzdp9_gg_{align-items:flex-start;flex-wrap:wrap;grid-gap:8px;gap:8px}" /*__inner_css_end__*/, "rzdp9_gg_") /*__reshadow_css_end__*/, {
|
|
14
|
+
"__SLegendFlex": "___SLegendFlex_rzdp9_gg_",
|
|
15
|
+
"_direction_row": "_direction_row_rzdp9_gg_",
|
|
16
|
+
"_direction_column": "_direction_column_rzdp9_gg_"
|
|
17
|
+
});
|
|
18
|
+
import { LegendItemComponent } from '../LegendItem/LegendItem';
|
|
19
|
+
import Divider from '@semcore/divider';
|
|
20
|
+
import Checkbox from '@semcore/checkbox';
|
|
21
|
+
import { BaseLegend } from '../BaseLegend';
|
|
22
|
+
import { localizedMessages } from '../../../translations/__intergalactic-dynamic-locales';
|
|
23
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
24
|
+
var LegendFlexRoot = /*#__PURE__*/function (_BaseLegend) {
|
|
25
|
+
_inherits(LegendFlexRoot, _BaseLegend);
|
|
26
|
+
var _super = _createSuper(LegendFlexRoot);
|
|
27
|
+
function LegendFlexRoot() {
|
|
28
|
+
_classCallCheck(this, LegendFlexRoot);
|
|
29
|
+
return _super.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
_createClass(LegendFlexRoot, [{
|
|
32
|
+
key: "renderTrend",
|
|
33
|
+
value: function renderTrend() {
|
|
34
|
+
var _ref3 = this.asProps,
|
|
35
|
+
onTrendIsVisibleChange = _ref3.onTrendIsVisibleChange,
|
|
36
|
+
trendIsVisible = _ref3.trendIsVisible,
|
|
37
|
+
trendLabel = _ref3.trendLabel,
|
|
38
|
+
size = _ref3.size,
|
|
39
|
+
getI18nText = _ref3.getI18nText;
|
|
40
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
41
|
+
checked: trendIsVisible,
|
|
42
|
+
onChange: onTrendIsVisibleChange,
|
|
43
|
+
theme: 'gray-400',
|
|
44
|
+
label: trendLabel !== null && trendLabel !== void 0 ? trendLabel : getI18nText('trend'),
|
|
45
|
+
size: size
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
var _ref = this.asProps,
|
|
52
|
+
_ref2;
|
|
53
|
+
var SLegendFlex = Flex;
|
|
54
|
+
var _this$asProps = this.asProps,
|
|
55
|
+
styles = _this$asProps.styles,
|
|
56
|
+
Children = _this$asProps.Children,
|
|
57
|
+
direction = _this$asProps.direction,
|
|
58
|
+
withTrend = _this$asProps.withTrend,
|
|
59
|
+
suffix = _this$asProps.suffix,
|
|
60
|
+
items = _this$asProps.items;
|
|
61
|
+
var orientation = direction === 'row' ? 'vertical' : 'horizontal';
|
|
62
|
+
return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SLegendFlex, _ref2.cn("SLegendFlex", _objectSpread({}, _assignProps({}, _ref))), items.map(function (_ref4) {
|
|
63
|
+
var id = _ref4.id;
|
|
64
|
+
return /*#__PURE__*/React.createElement(Children, {
|
|
65
|
+
key: id
|
|
66
|
+
});
|
|
67
|
+
}), (withTrend || suffix) && /*#__PURE__*/React.createElement(Divider, _ref2.cn("Divider", {
|
|
68
|
+
"orientation": orientation
|
|
69
|
+
})), withTrend && this.renderTrend(), suffix ? suffix : null);
|
|
70
|
+
}
|
|
71
|
+
}]);
|
|
72
|
+
return LegendFlexRoot;
|
|
73
|
+
}(BaseLegend);
|
|
74
|
+
_defineProperty(LegendFlexRoot, "displayName", 'LegendFlex');
|
|
75
|
+
_defineProperty(LegendFlexRoot, "style", style);
|
|
76
|
+
_defineProperty(LegendFlexRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
77
|
+
_defineProperty(LegendFlexRoot, "defaultProps", function () {
|
|
78
|
+
return {
|
|
79
|
+
direction: 'row',
|
|
80
|
+
children: /*#__PURE__*/React.createElement(LegendFlex.LegendItem, null)
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
export var LegendFlex = createComponent(LegendFlexRoot, {
|
|
84
|
+
LegendItem: LegendItemComponent
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=LegendFlex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendFlex.js","names":["React","createComponent","sstyled","Root","Flex","style","_sstyled","insert","LegendItemComponent","Divider","Checkbox","BaseLegend","localizedMessages","i18nEnhance","LegendFlexRoot","_BaseLegend","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","renderTrend","_ref3","asProps","onTrendIsVisibleChange","trendIsVisible","trendLabel","size","getI18nText","createElement","checked","onChange","theme","label","render","_ref","_ref2","SLegendFlex","_this$asProps","styles","Children","direction","withTrend","suffix","items","orientation","cn","_objectSpread","_assignProps","map","_ref4","id","_defineProperty","children","LegendFlex","LegendItem"],"sources":["../../../../../src/component/ChartLegend/LegendFlex/LegendFlex.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { sstyled, Root } from '@semcore/core';\nimport { Flex } from '@semcore/flex-box';\nimport style from './legend-flex.shadow.css';\nimport { LegendFlexType, LegendFlexProps, TrendProps } from './LegendFlex.type';\nimport { LegendItemComponent } from '../LegendItem/LegendItem';\nimport Divider from '@semcore/divider';\nimport Checkbox from '@semcore/checkbox';\nimport { BaseLegend } from '../BaseLegend';\nimport { localizedMessages } from '../../../translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\n\nclass LegendFlexRoot extends BaseLegend<LegendFlexProps> {\n static displayName = 'LegendFlex';\n static style = style;\n\n static enhance = [i18nEnhance(localizedMessages)];\n\n static defaultProps = () => ({\n direction: 'row',\n children: <LegendFlex.LegendItem />,\n });\n\n renderTrend() {\n const { onTrendIsVisibleChange, trendIsVisible, trendLabel, size, getI18nText } = this\n .asProps as TrendProps & LegendFlexProps & { getI18nText: (s: string) => string };\n\n return (\n <Checkbox\n checked={trendIsVisible}\n onChange={onTrendIsVisibleChange}\n theme={'gray-400'}\n label={trendLabel ?? getI18nText('trend')}\n size={size}\n />\n );\n }\n\n render() {\n const SLegendFlex = Root;\n const { styles, Children, direction, withTrend, suffix, items } = this.asProps;\n const orientation = direction === 'row' ? 'vertical' : 'horizontal';\n\n return sstyled(styles)(\n <SLegendFlex render={Flex}>\n {items.map(({ id }) => {\n return <Children key={id} />;\n })}\n {(withTrend || suffix) && <Divider orientation={orientation} />}\n {withTrend && this.renderTrend()}\n {suffix ? suffix : null}\n </SLegendFlex>,\n );\n }\n}\n\nexport const LegendFlex: LegendFlexType = createComponent(LegendFlexRoot, {\n LegendItem: LegendItemComponent,\n});\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAC9D,SAASC,IAAI,QAAQ,mBAAmB;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;AAAA;AAGzC,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,iBAAiB,QAAQ,uDAAu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sources":["../../../../../src/component/ChartLegend/LegendFlex/LegendFlex.type.ts"],"sourcesContent":["import { Flex, FlexProps } from '@semcore/flex-box';\nimport { Intergalactic } from '@semcore/core';\nimport { LegendItemType } from '../LegendItem/LegendItem.type';\nimport { LegendProps } from '../BaseLegend.type';\n\nexport type TrendProps = {\n /**\n * Flag for include trend LegendItem in Legend\n */\n withTrend: true;\n /**\n * Trend label (for localization)\n */\n trendLabel?: string;\n /**\n * Flag for describe are trend is visible\n */\n trendIsVisible: boolean;\n /**\n * Handler for change trend visibility\n */\n onTrendIsVisibleChange: (isVisible: boolean) => void;\n};\n\ntype SuffixProps = {\n /**\n * Element after all Legend items\n */\n suffix?: React.ReactElement;\n};\n\ntype AddonProps = ({ withTrend?: never } & SuffixProps) | ({ suffix?: never } & TrendProps);\n\nexport type LegendFlexProps = LegendProps & AddonProps & FlexProps;\n\nexport type LegendFlexType = Intergalactic.Component<typeof Flex, LegendFlexProps> & {\n LegendItem: LegendItemType;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
|
+
import { assignProps as _assignProps6 } from "@semcore/core";
|
|
10
|
+
import { assignProps as _assignProps5 } from "@semcore/core";
|
|
11
|
+
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
12
|
+
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
13
|
+
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
14
|
+
import { assignProps as _assignProps } from "@semcore/core";
|
|
15
|
+
var _excluded = ["color"];
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
18
|
+
import { Flex, Box } from '@semcore/flex-box';
|
|
19
|
+
import Checkbox from '@semcore/checkbox';
|
|
20
|
+
import { Text as TypographyText } from '@semcore/typography';
|
|
21
|
+
/*__reshadow-styles__:"./legend-item.shadow.css"*/
|
|
22
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendItem_1d8wv_gg_{align-items:flex-start}@media (hover:hover){.___SLegendItem_1d8wv_gg_:hover{cursor:pointer}.___SLegendItem_1d8wv_gg_.__disabled_1d8wv_gg_:hover{cursor:default}}.___SPointShape_1d8wv_gg_.__color_1d8wv_gg_{background-color:var(--color_1d8wv);margin-right:8px}.___SPointShape_1d8wv_gg_._shape_Circle_1d8wv_gg_._size_l_1d8wv_gg_{width:16px;height:16px;border-radius:8px;margin-top:4px}.___SPointShape_1d8wv_gg_._shape_Circle_1d8wv_gg_._size_m_1d8wv_gg_{width:12px;height:12px;border-radius:6px;margin-top:4px}.___SPointShape_1d8wv_gg_._shape_Line_1d8wv_gg_._size_l_1d8wv_gg_{width:16px;height:4px;border-radius:3px;margin-top:9px}.___SPointShape_1d8wv_gg_._shape_Line_1d8wv_gg_._size_m_1d8wv_gg_{width:12px;height:4px;border-radius:3px;margin-top:8px}.___SPointShape_1d8wv_gg_._shape_Square_1d8wv_gg_._size_l_1d8wv_gg_{width:16px;height:16px;border-radius:2px;margin-top:4px}.___SPointShape_1d8wv_gg_._shape_Square_1d8wv_gg_._size_m_1d8wv_gg_{width:12px;height:12px;border-radius:2px;margin-top:4px}.___SIcon_1d8wv_gg_{line-height:0;margin-right:4px}.___SIcon_1d8wv_gg_._size_l_1d8wv_gg_{margin-top:4px}.___SIcon_1d8wv_gg_._size_m_1d8wv_gg_{margin-top:2px}.___SAdditionalLabel_1d8wv_gg_._size_l_1d8wv_gg_,.___SCount_1d8wv_gg_._size_l_1d8wv_gg_,.___SLabel_1d8wv_gg_._size_l_1d8wv_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SAdditionalLabel_1d8wv_gg_._size_m_1d8wv_gg_,.___SCount_1d8wv_gg_._size_m_1d8wv_gg_,.___SLabel_1d8wv_gg_._size_m_1d8wv_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SAdditionalLabel_1d8wv_gg_,.___SCount_1d8wv_gg_{margin-left:4px}.___SAdditionalLabel_1d8wv_gg_{white-space:nowrap;display:flex;align-items:flex-start}.___SAdditionalLabel_1d8wv_gg_::before{content:\"\";display:inline-block;background-color:var(--intergalactic-text-secondary, #6c6e79);height:4px;width:4px;border-radius:2px;margin-right:4px}.___SAdditionalLabel_1d8wv_gg_._size_l_1d8wv_gg_::before{margin-top:10px}.___SAdditionalLabel_1d8wv_gg_._size_m_1d8wv_gg_::before{margin-top:8px}" /*__inner_css_end__*/, "1d8wv_gg_") /*__reshadow_css_end__*/, {
|
|
23
|
+
"__SLegendItem": "___SLegendItem_1d8wv_gg_",
|
|
24
|
+
"_disabled": "__disabled_1d8wv_gg_",
|
|
25
|
+
"__SPointShape": "___SPointShape_1d8wv_gg_",
|
|
26
|
+
"_color": "__color_1d8wv_gg_",
|
|
27
|
+
"--color": "--color_1d8wv",
|
|
28
|
+
"_shape_Circle": "_shape_Circle_1d8wv_gg_",
|
|
29
|
+
"_size_l": "_size_l_1d8wv_gg_",
|
|
30
|
+
"_size_m": "_size_m_1d8wv_gg_",
|
|
31
|
+
"_shape_Line": "_shape_Line_1d8wv_gg_",
|
|
32
|
+
"_shape_Square": "_shape_Square_1d8wv_gg_",
|
|
33
|
+
"__SIcon": "___SIcon_1d8wv_gg_",
|
|
34
|
+
"__SLabel": "___SLabel_1d8wv_gg_",
|
|
35
|
+
"__SAdditionalLabel": "___SAdditionalLabel_1d8wv_gg_",
|
|
36
|
+
"__SCount": "___SCount_1d8wv_gg_"
|
|
37
|
+
});
|
|
38
|
+
import { StaticShapes } from './LegendItem.type';
|
|
39
|
+
var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
40
|
+
_inherits(LegendItemRoot, _Component);
|
|
41
|
+
var _super = _createSuper(LegendItemRoot);
|
|
42
|
+
function LegendItemRoot() {
|
|
43
|
+
_classCallCheck(this, LegendItemRoot);
|
|
44
|
+
return _super.apply(this, arguments);
|
|
45
|
+
}
|
|
46
|
+
_createClass(LegendItemRoot, [{
|
|
47
|
+
key: "getShapeProps",
|
|
48
|
+
value: function getShapeProps() {
|
|
49
|
+
var _this$asProps = this.asProps,
|
|
50
|
+
checked = _this$asProps.checked,
|
|
51
|
+
color = _this$asProps.color,
|
|
52
|
+
shape = _this$asProps.shape,
|
|
53
|
+
label = _this$asProps.label,
|
|
54
|
+
id = _this$asProps.id,
|
|
55
|
+
size = _this$asProps.size,
|
|
56
|
+
onClick = _this$asProps.onClick;
|
|
57
|
+
return {
|
|
58
|
+
id: id,
|
|
59
|
+
label: label,
|
|
60
|
+
shape: shape,
|
|
61
|
+
checked: checked,
|
|
62
|
+
color: color,
|
|
63
|
+
size: size,
|
|
64
|
+
onKeyUp: function onKeyUp(e) {
|
|
65
|
+
if (onClick && e.key === ' ') {
|
|
66
|
+
onClick();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "getIconProps",
|
|
73
|
+
value: function getIconProps() {
|
|
74
|
+
var props = this.asProps;
|
|
75
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
76
|
+
children: props.icon
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "getLabelProps",
|
|
81
|
+
value: function getLabelProps() {
|
|
82
|
+
var _this$asProps2 = this.asProps,
|
|
83
|
+
color = _this$asProps2.color,
|
|
84
|
+
props = _objectWithoutProperties(_this$asProps2, _excluded);
|
|
85
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
86
|
+
children: props.label
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "getAdditionalLabelProps",
|
|
91
|
+
value: function getAdditionalLabelProps() {
|
|
92
|
+
var props = this.asProps;
|
|
93
|
+
var additionalInfo = props.additionalInfo;
|
|
94
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
95
|
+
children: additionalInfo && 'label' in additionalInfo ? "".concat(additionalInfo.label) : undefined
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "getCountProps",
|
|
100
|
+
value: function getCountProps() {
|
|
101
|
+
var props = this.asProps;
|
|
102
|
+
var additionalInfo = props.additionalInfo;
|
|
103
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
104
|
+
children: additionalInfo && 'count' in additionalInfo ? "(".concat(additionalInfo.count, ")") : undefined
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "render",
|
|
109
|
+
value: function render() {
|
|
110
|
+
var _ref = this.asProps,
|
|
111
|
+
_ref7;
|
|
112
|
+
var SLegendItem = Flex;
|
|
113
|
+
var _this$asProps3 = this.asProps,
|
|
114
|
+
styles = _this$asProps3.styles,
|
|
115
|
+
Children = _this$asProps3.Children,
|
|
116
|
+
shape = _this$asProps3.shape;
|
|
117
|
+
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
var disabled = StaticShapes.includes(shape);
|
|
120
|
+
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SLegendItem, _ref7.cn("SLegendItem", _objectSpread({}, _assignProps({
|
|
121
|
+
"disabled": disabled
|
|
122
|
+
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
|
|
123
|
+
}
|
|
124
|
+
}]);
|
|
125
|
+
return LegendItemRoot;
|
|
126
|
+
}(Component);
|
|
127
|
+
_defineProperty(LegendItemRoot, "displayName", 'LegendItem');
|
|
128
|
+
_defineProperty(LegendItemRoot, "style", style);
|
|
129
|
+
_defineProperty(LegendItemRoot, "defaultProps", function () {
|
|
130
|
+
return {
|
|
131
|
+
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))
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
function Shape(props) {
|
|
135
|
+
var _ref2 = arguments[0],
|
|
136
|
+
_ref8;
|
|
137
|
+
var SPointShape = Box;
|
|
138
|
+
var styles = props.styles,
|
|
139
|
+
size = props.size,
|
|
140
|
+
shape = props.shape,
|
|
141
|
+
checked = props.checked,
|
|
142
|
+
color = props.color,
|
|
143
|
+
Children = props.Children,
|
|
144
|
+
hasChildren = props.children,
|
|
145
|
+
onKeyUp = props.onKeyUp,
|
|
146
|
+
label = props.label;
|
|
147
|
+
if (hasChildren) {
|
|
148
|
+
return /*#__PURE__*/React.createElement(Children, null);
|
|
149
|
+
}
|
|
150
|
+
if (shape === 'Checkbox') {
|
|
151
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
152
|
+
size: size,
|
|
153
|
+
checked: checked,
|
|
154
|
+
theme: checked ? color : undefined,
|
|
155
|
+
onKeyUp: onKeyUp,
|
|
156
|
+
"aria-label": label
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SPointShape, _ref8.cn("SPointShape", _objectSpread({}, _assignProps2({}, _ref2))), /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {})));
|
|
160
|
+
}
|
|
161
|
+
function Icon(_ref13) {
|
|
162
|
+
var _ref3 = arguments[0],
|
|
163
|
+
_ref9;
|
|
164
|
+
var styles = _ref13.styles,
|
|
165
|
+
hasChildren = _ref13.children,
|
|
166
|
+
Children = _ref13.Children;
|
|
167
|
+
var SIcon = Box;
|
|
168
|
+
if (!hasChildren) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SIcon, _ref9.cn("SIcon", _objectSpread({}, _assignProps3({
|
|
172
|
+
"tag": 'span'
|
|
173
|
+
}, _ref3))), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {})));
|
|
174
|
+
}
|
|
175
|
+
Icon.displayName = 'Icon';
|
|
176
|
+
function Label(_ref14) {
|
|
177
|
+
var _ref4 = arguments[0],
|
|
178
|
+
_ref10;
|
|
179
|
+
var styles = _ref14.styles,
|
|
180
|
+
hasChildren = _ref14.children,
|
|
181
|
+
Children = _ref14.Children;
|
|
182
|
+
var SLabel = TypographyText;
|
|
183
|
+
if (!hasChildren) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref10.cn("SLabel", _objectSpread({}, _assignProps4({
|
|
187
|
+
"use": 'primary'
|
|
188
|
+
}, _ref4))), /*#__PURE__*/React.createElement(Children, _ref10.cn("Children", {})));
|
|
189
|
+
}
|
|
190
|
+
Label.displayName = 'Label';
|
|
191
|
+
function AdditionalLabel(_ref15) {
|
|
192
|
+
var _ref5 = arguments[0],
|
|
193
|
+
_ref11;
|
|
194
|
+
var styles = _ref15.styles,
|
|
195
|
+
hasChildren = _ref15.children,
|
|
196
|
+
Children = _ref15.Children;
|
|
197
|
+
var SAdditionalLabel = TypographyText;
|
|
198
|
+
if (!hasChildren) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
return _ref11 = sstyled(styles), /*#__PURE__*/React.createElement(SAdditionalLabel, _ref11.cn("SAdditionalLabel", _objectSpread({}, _assignProps5({
|
|
202
|
+
"use": 'secondary'
|
|
203
|
+
}, _ref5))), /*#__PURE__*/React.createElement(Children, _ref11.cn("Children", {})));
|
|
204
|
+
}
|
|
205
|
+
AdditionalLabel.displayName = 'AdditionalLabel';
|
|
206
|
+
function Count(_ref16) {
|
|
207
|
+
var _ref6 = arguments[0],
|
|
208
|
+
_ref12;
|
|
209
|
+
var styles = _ref16.styles,
|
|
210
|
+
hasChildren = _ref16.children,
|
|
211
|
+
Children = _ref16.Children;
|
|
212
|
+
var SCount = TypographyText;
|
|
213
|
+
if (!hasChildren) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(SCount, _ref12.cn("SCount", _objectSpread({}, _assignProps6({
|
|
217
|
+
"use": 'secondary'
|
|
218
|
+
}, _ref6))), /*#__PURE__*/React.createElement(Children, _ref12.cn("Children", {})));
|
|
219
|
+
}
|
|
220
|
+
Count.displayName = 'Count';
|
|
221
|
+
export var LegendItemComponent = createComponent(LegendItemRoot, {
|
|
222
|
+
Shape: Shape,
|
|
223
|
+
Icon: Icon,
|
|
224
|
+
Label: Label,
|
|
225
|
+
AdditionalLabel: AdditionalLabel,
|
|
226
|
+
Count: Count
|
|
227
|
+
});
|
|
228
|
+
//# sourceMappingURL=LegendItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendItem.js","names":["React","createComponent","Component","sstyled","Root","Flex","Box","Checkbox","Text","TypographyText","style","_sstyled","insert","StaticShapes","LegendItemRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getShapeProps","_this$asProps","asProps","checked","color","shape","label","id","size","onClick","onKeyUp","e","getIconProps","props","_objectSpread","children","icon","getLabelProps","_this$asProps2","_objectWithoutProperties","_excluded","getAdditionalLabelProps","additionalInfo","concat","undefined","getCountProps","count","render","_ref","_ref7","SLegendItem","_this$asProps3","styles","Children","disabled","includes","createElement","cn","_assignProps","_defineProperty","Fragment","LegendItemComponent","Shape","Icon","Label","AdditionalLabel","Count","_ref2","arguments[0]","_ref8","SPointShape","hasChildren","theme","_assignProps2","_ref13","_ref3","_ref9","SIcon","_assignProps3","displayName","_ref14","_ref4","_ref10","SLabel","_assignProps4","_ref15","_ref5","_ref11","SAdditionalLabel","_assignProps5","_ref16","_ref6","_ref12","SCount","_assignProps6"],"sources":["../../../../../src/component/ChartLegend/LegendItem/LegendItem.tsx"],"sourcesContent":["import React, { DOMAttributes } from 'react';\nimport createComponent, { Component, sstyled, Root, IRootComponentProps } from '@semcore/core';\nimport { Flex, Box } from '@semcore/flex-box';\nimport Checkbox, { CheckboxProps } from '@semcore/checkbox';\nimport { Text as TypographyText } from '@semcore/typography';\n\nimport style from './legend-item.shadow.css';\nimport {\n ShapeProps,\n LegendItemProps,\n LegendItemType,\n LegendItem,\n StaticShapes,\n} from './LegendItem.type';\n\nclass LegendItemRoot extends Component<LegendItemProps> {\n static displayName = 'LegendItem';\n static style = style;\n\n static defaultProps = () => ({\n children: (\n <>\n <LegendItemComponent.Shape />\n <LegendItemComponent.Icon />\n <LegendItemComponent.Label />\n <LegendItemComponent.AdditionalLabel />\n <LegendItemComponent.Count />\n </>\n ),\n });\n\n getShapeProps(): ShapeProps & DOMAttributes<HTMLLabelElement> {\n const { checked, color, shape, label, id, size, onClick } = this.asProps;\n\n return {\n id,\n label,\n shape,\n checked,\n color,\n size,\n onKeyUp: (e: React.KeyboardEvent<HTMLLabelElement>) => {\n if (onClick && e.key === ' ') {\n onClick();\n }\n },\n };\n }\n\n getIconProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n return {\n ...props,\n children: props.icon,\n };\n }\n\n getLabelProps(): Omit<LegendItem, 'color'> & IRootComponentProps {\n const { color, ...props } = this.asProps;\n\n return {\n ...props,\n children: props.label,\n };\n }\n\n getAdditionalLabelProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n const { additionalInfo } = props;\n\n return {\n ...props,\n children: additionalInfo && 'label' in additionalInfo ? `${additionalInfo.label}` : undefined,\n };\n }\n\n getCountProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n const { additionalInfo } = props;\n\n return {\n ...props,\n children:\n additionalInfo && 'count' in additionalInfo ? `(${additionalInfo.count})` : undefined,\n };\n }\n\n render() {\n const SLegendItem = Root;\n const { styles, Children, shape } = this.asProps;\n\n // @ts-ignore\n const disabled = StaticShapes.includes(shape);\n\n return sstyled(styles)(\n <SLegendItem render={Flex} disabled={disabled}>\n <Children />\n </SLegendItem>,\n );\n }\n}\n\nfunction Shape(props: IRootComponentProps & ShapeProps & DOMAttributes<HTMLLabelElement>) {\n const SPointShape = Root;\n const {\n styles,\n size,\n shape,\n checked,\n color,\n Children,\n children: hasChildren,\n onKeyUp,\n label,\n } = props;\n\n if (hasChildren) {\n return <Children />;\n }\n\n if (shape === 'Checkbox') {\n return (\n <Checkbox\n size={size}\n checked={checked}\n theme={checked ? color : undefined}\n onKeyUp={onKeyUp}\n aria-label={label}\n />\n );\n }\n\n return sstyled(styles)(\n <SPointShape render={Box}>\n <Children />\n </SPointShape>,\n );\n}\n\nfunction Icon({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SIcon = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SIcon render={Box} tag={'span'}>\n <Children />\n </SIcon>,\n );\n}\nIcon.displayName = 'Icon';\n\nfunction Label({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SLabel render={TypographyText} use={'primary'}>\n <Children />\n </SLabel>,\n );\n}\nLabel.displayName = 'Label';\n\nfunction AdditionalLabel({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SAdditionalLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SAdditionalLabel render={TypographyText} use={'secondary'}>\n <Children />\n </SAdditionalLabel>,\n );\n}\nAdditionalLabel.displayName = 'AdditionalLabel';\n\nfunction Count({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SCount = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SCount render={TypographyText} use={'secondary'}>\n <Children />\n </SCount>,\n );\n}\nCount.displayName = 'Count';\n\nexport const LegendItemComponent: LegendItemType = createComponent(LegendItemRoot, {\n Shape,\n Icon,\n Label,\n AdditionalLabel,\n Count,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAyB,OAAO;AAC5C,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAA6B,eAAe;AAC9F,SAASC,IAAI,EAAEC,GAAG,QAAQ,mBAAmB;AAC7C,OAAOC,QAAQ,MAAyB,mBAAmB;AAC3D,SAASC,IAAI,IAAIC,cAAc,QAAQ,qBAAqB;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAG7D,SAKEC,YAAY,QACP,mBAAmB;AAAC,IAErBC,cAAc,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,cAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,cAAA;EAAA,SAAAA,eAAA;IAAAK,eAAA,OAAAL,cAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,cAAA;IAAAS,GAAA;IAAAC,KAAA,EAgBlB,SAAAC,cAAA,EAA8D;MAC5D,IAAAC,aAAA,GAA4D,IAAI,CAACC,OAAO;QAAhEC,OAAO,GAAAF,aAAA,CAAPE,OAAO;QAAEC,KAAK,GAAAH,aAAA,CAALG,KAAK;QAAEC,KAAK,GAAAJ,aAAA,CAALI,KAAK;QAAEC,KAAK,GAAAL,aAAA,CAALK,KAAK;QAAEC,EAAE,GAAAN,aAAA,CAAFM,E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AM,EAAAD,MAAA,CAAAnC,EAAA,WAAAvB,aAAA,KAAA4D,aAAA;IAAA,OAA8B;EAAW,GAAAH,KAAA,kBAC9ChG,KAAA,CAAA6D,aAAA,CAACH,QAAQ,EAAAuC,MAAA,CAAAnC,EAAA,iBAAG,CACL;AAEb;AACAS,KAAK,CAACa,WAAW,GAAG,OAAO;AAE3B,OAAO,IAAMlB,mBAAmC,GAAGjE,eAAe,CAACa,cAAc,EAAE;EACjFqD,KAAK,EAALA,KAAK;EACLC,IAAI,EAAJA,IAAI;EACJC,KAAK,EAALA,KAAK;EACLC,eAAe,EAAfA,eAAe;EACfC,KAAK,EAALA;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendItem.type.js","names":["StaticShapes"],"sources":["../../../../../src/component/ChartLegend/LegendItem/LegendItem.type.ts"],"sourcesContent":["import { Flex } from '@semcore/flex-box';\nimport { Intergalactic, Root } from '@semcore/core';\nimport Icon from '@semcore/icon';\nimport { Text } from '@semcore/typography';\nimport { LSize } from '../BaseLegend.type';\n\n/**\n * Key of chart data item\n */\nexport type LegendItemKey = string;\n\nexport type LegendItem = {\n /**\n * One of keys from data set\n */\n id: LegendItemKey;\n /**\n * Label for data item in Legend\n */\n label: string;\n /**\n * Flag for selected data item\n */\n checked: boolean;\n /**\n * Color of data item\n */\n color: string;\n /**\n * Icon before label\n */\n icon?: typeof Icon;\n /**\n * Additional info with sub-label or count\n */\n additionalInfo?: { label: string } | { count: number };\n};\n\nexport type LegendItemProps = LegendItem & {\n /**\n * Size for legend item\n */\n size: LSize;\n /**\n * Shape of data item on Legend panel\n */\n shape: ShapeType;\n /**\n * Handler for select/deselect legend item.\n * !Need to redefine onClick, because we don't have `event` in it.\n */\n onClick: () => void;\n};\n\nexport type ShapeProps = LegendItem & {\n size: LSize;\n shape: ShapeType;\n};\n\nexport const StaticShapes = ['Circle', 'Line', 'Square'] as const;\n\nexport type ShapeType = 'Checkbox' | typeof StaticShapes[number];\n\nexport type LegendItemType = Intergalactic.Component<typeof Flex, Partial<LegendItemProps>> & {\n Shape: Intergalactic.Component<typeof Root, Partial<ShapeProps>>;\n Icon: Intergalactic.Component<typeof Icon, Partial<LegendItem>>;\n Label: Intergalactic.Component<typeof Text, Partial<Omit<LegendItem, 'theme'>>>;\n AdditionalLabel: Intergalactic.Component<typeof Text, Partial<LegendItem>>;\n Count: Intergalactic.Component<typeof Text, Partial<LegendItem>>;\n};\n"],"mappings":"AAMA;AACA;AACA;;AAmDA,OAAO,IAAMA,YAAY,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAU"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
SLegendItem {
|
|
2
|
+
align-items: flex-start;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
SLegendItem:hover {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
SLegendItem[disabled]:hover {
|
|
10
|
+
cursor: default;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
SPointShape[color] {
|
|
14
|
+
background-color: var(--color);
|
|
15
|
+
margin-right: 8px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
SPointShape[shape='Circle'][size='l'] {
|
|
19
|
+
width: 16px;
|
|
20
|
+
height: 16px;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
margin-top: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
SPointShape[shape='Circle'][size='m'] {
|
|
26
|
+
width: 12px;
|
|
27
|
+
height: 12px;
|
|
28
|
+
border-radius: 6px;
|
|
29
|
+
margin-top: 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
SPointShape[shape='Line'][size='l'] {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 4px;
|
|
35
|
+
border-radius: 3px;
|
|
36
|
+
margin-top: 9px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
SPointShape[shape='Line'][size='m'] {
|
|
40
|
+
width: 12px;
|
|
41
|
+
height: 4px;
|
|
42
|
+
border-radius: 3px;
|
|
43
|
+
margin-top: 8px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
SPointShape[shape='Square'][size='l'] {
|
|
47
|
+
width: 16px;
|
|
48
|
+
height: 16px;
|
|
49
|
+
border-radius: 2px;
|
|
50
|
+
margin-top: 4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SPointShape[shape='Square'][size='m'] {
|
|
54
|
+
width: 12px;
|
|
55
|
+
height: 12px;
|
|
56
|
+
border-radius: 2px;
|
|
57
|
+
margin-top: 4px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
SIcon {
|
|
61
|
+
line-height: 0;
|
|
62
|
+
margin-right: 4px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SIcon[size='l'] {
|
|
66
|
+
margin-top: 4px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
SIcon[size='m'] {
|
|
70
|
+
margin-top: 2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
SLabel[size='l'], SAdditionalLabel[size='l'], SCount[size='l'] {
|
|
74
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
75
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
SLabel[size='m'], SAdditionalLabel[size='m'], SCount[size='m'] {
|
|
79
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
80
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SAdditionalLabel, SCount {
|
|
84
|
+
margin-left: 4px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
SAdditionalLabel {
|
|
88
|
+
white-space: nowrap;
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: flex-start;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
SAdditionalLabel::before {
|
|
94
|
+
content: '';
|
|
95
|
+
display: inline-block;
|
|
96
|
+
background-color: var(--intergalactic-text-secondary, #6c6e79);
|
|
97
|
+
height: 4px;
|
|
98
|
+
width: 4px;
|
|
99
|
+
border-radius: 2px;
|
|
100
|
+
margin-right: 4px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
SAdditionalLabel[size='l']::before {
|
|
104
|
+
margin-top: 10px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
SAdditionalLabel[size='m']::before {
|
|
108
|
+
margin-top: 8px;
|
|
109
|
+
}
|