@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,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BaseLegend = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _core = require("@semcore/core");
|
|
16
|
+
var _hints = require("../../a11y/hints");
|
|
17
|
+
var BaseLegend = /*#__PURE__*/function (_Component) {
|
|
18
|
+
(0, _inherits2["default"])(BaseLegend, _Component);
|
|
19
|
+
var _super = (0, _createSuper2["default"])(BaseLegend);
|
|
20
|
+
function BaseLegend() {
|
|
21
|
+
var _this;
|
|
22
|
+
(0, _classCallCheck2["default"])(this, BaseLegend);
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
27
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindOnChange", function (id) {
|
|
28
|
+
var item = _this.asProps.items.find(function (item) {
|
|
29
|
+
return item.id === id;
|
|
30
|
+
});
|
|
31
|
+
return function () {
|
|
32
|
+
var _this$props$onChangeV, _this$props;
|
|
33
|
+
var checked = !(item !== null && item !== void 0 && item.checked);
|
|
34
|
+
(_this$props$onChangeV = (_this$props = _this.props).onChangeVisibleItem) === null || _this$props$onChangeV === void 0 ? void 0 : _this$props$onChangeV.call(_this$props, id, checked);
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindOnMouseEnterItem", function (id) {
|
|
38
|
+
return function (e) {
|
|
39
|
+
var _this$props$onMouseEn, _this$props2;
|
|
40
|
+
(_this$props$onMouseEn = (_this$props2 = _this.props).onMouseEnterItem) === null || _this$props$onMouseEn === void 0 ? void 0 : _this$props$onMouseEn.call(_this$props2, id, e);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindOnMouseLeaveItem", function (id) {
|
|
44
|
+
return function (e) {
|
|
45
|
+
var _this$props$onMouseLe, _this$props3;
|
|
46
|
+
(_this$props$onMouseLe = (_this$props3 = _this.props).onMouseLeaveItem) === null || _this$props$onMouseLe === void 0 ? void 0 : _this$props$onMouseLe.call(_this$props3, id, e);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
(0, _createClass2["default"])(BaseLegend, [{
|
|
52
|
+
key: "componentDidMount",
|
|
53
|
+
value: function componentDidMount() {
|
|
54
|
+
this.setHints();
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "componentDidUpdate",
|
|
58
|
+
value: function componentDidUpdate(prevProps) {
|
|
59
|
+
if (prevProps.items !== this.props.items || prevProps.dataHints !== this.props.dataHints) {
|
|
60
|
+
this.setHints();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "setHints",
|
|
65
|
+
value: function setHints() {
|
|
66
|
+
var _this$asProps = this.asProps,
|
|
67
|
+
items = _this$asProps.items,
|
|
68
|
+
dataHints = _this$asProps.dataHints;
|
|
69
|
+
var dataHintsHandler = dataHints ? (0, _hints.makeDataHintsHandlers)(dataHints) : undefined;
|
|
70
|
+
items.forEach(function (legendItem) {
|
|
71
|
+
dataHintsHandler === null || dataHintsHandler === void 0 ? void 0 : dataHintsHandler.labelKey('value', legendItem.id, legendItem.label);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "getItem",
|
|
76
|
+
value: function getItem(index) {
|
|
77
|
+
var line = this.asProps.items[index];
|
|
78
|
+
if (line === undefined) {
|
|
79
|
+
throw new Error("No index \"".concat(index, "\" in lines"));
|
|
80
|
+
}
|
|
81
|
+
return line;
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "getLegendItemProps",
|
|
85
|
+
value: function getLegendItemProps(_, index) {
|
|
86
|
+
var _this$asProps2 = this.asProps,
|
|
87
|
+
_this$asProps2$shape = _this$asProps2.shape,
|
|
88
|
+
shape = _this$asProps2$shape === void 0 ? 'Checkbox' : _this$asProps2$shape,
|
|
89
|
+
_this$asProps2$size = _this$asProps2.size,
|
|
90
|
+
size = _this$asProps2$size === void 0 ? 'm' : _this$asProps2$size;
|
|
91
|
+
var line = this.getItem(index);
|
|
92
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, line), {}, {
|
|
93
|
+
shape: shape,
|
|
94
|
+
size: size,
|
|
95
|
+
onClick: this.bindOnChange(line.id),
|
|
96
|
+
onMouseEnter: this.bindOnMouseEnterItem(line.id),
|
|
97
|
+
onMouseLeave: this.bindOnMouseLeaveItem(line.id),
|
|
98
|
+
style: {
|
|
99
|
+
gridRowStart: "".concat(index + 1),
|
|
100
|
+
gridRowEnd: "".concat(index + 2)
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}]);
|
|
105
|
+
return BaseLegend;
|
|
106
|
+
}(_core.Component);
|
|
107
|
+
exports.BaseLegend = BaseLegend;
|
|
108
|
+
//# sourceMappingURL=BaseLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseLegend.js","names":["_core","require","_hints","BaseLegend","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","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","_createClass2","key","value","componentDidMount","setHints","componentDidUpdate","prevProps","dataHints","_this$asProps","dataHintsHandler","makeDataHintsHandlers","undefined","forEach","legendItem","labelKey","label","getItem","index","line","Error","getLegendItemProps","_","_this$asProps2","_this$asProps2$shape","shape","_this$asProps2$size","size","_objectSpread2","onClick","bindOnChange","onMouseEnter","bindOnMouseEnterItem","onMouseLeave","bindOnMouseLeaveItem","style","gridRowStart","gridRowEnd","Component","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAAyD,IAEnCE,UAAU,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,UAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,UAAA;EAAA,SAAAA,WAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,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,MA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;IAAAjB,GAAA;IAAAC,KAAA,EAED,SAAAkB,mBACEC,CAAK,EACLJ,KAAa,EACiE;MAC9E,IAAAK,cAAA,GAA2C,IAAI,CAACrC,OAAO;QAAAsC,oBAAA,GAAAD,cAAA,CAA/CE,KAAK;QAALA,KAAK,GAAAD,oBAAA,cAAG,UAAU,GAAAA,oBAAA;QAAAE,mBAAA,GAAAH,cAAA,CAAEI,IAAI;QAAJA,IAAI,GAAAD,mBAAA,cAAG,GAAG,GAAAA,mBAAA;MACtC,IAAMP,IAAI,GAAG,IAAI,CAACF,OAAO,CAACC,KAAK,CAAC;MAEhC,WAAAU,cAAA,iBAAAA,cAAA,iBACKT,IAAI;QACPM,KAAK,EAALA,KAAK;QACLE,IAAI,EAAJA,IAAI;QACJE,OAAO,EAAE,IAAI,CAACC,YAAY,CAACX,IAAI,CAACnC,EAAE,CAAC;QACnC+C,YAAY,EAAE,IAAI,CAACC,oBAAoB,CAACb,IAAI,CAACnC,EAAE,CAAC;QAChDiD,YAAY,EAAE,IAAI,CAACC,oBAAoB,CAACf,IAAI,CAACnC,EAAE,CAAC;QAChDmD,KAAK,EAAE;UAAEC,YAAY,KAAAvD,MAAA,CAAKqC,KAAK,GAAG,CAAC,CAAE;UAAEmB,UAAU,KAAAxD,MAAA,CAAKqC,KAAK,GAAG,CAAC;QAAG;MAAC;IAEvE;EAAC;EAAA,OAAApD,UAAA;AAAA,EA9C6DwE,eAAS;AAAAC,OAAA,CAAAzE,UAAA,GAAAA,UAAA"}
|
|
@@ -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,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LegendFlex = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _flexBox = require("@semcore/flex-box");
|
|
18
|
+
var _LegendItem = require("../LegendItem/LegendItem");
|
|
19
|
+
var _divider = _interopRequireDefault(require("@semcore/divider"));
|
|
20
|
+
var _checkbox = _interopRequireDefault(require("@semcore/checkbox"));
|
|
21
|
+
var _BaseLegend2 = require("../BaseLegend");
|
|
22
|
+
var _intergalacticDynamicLocales = require("../../../translations/__intergalactic-dynamic-locales");
|
|
23
|
+
var _i18nEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/i18nEnhance"));
|
|
24
|
+
/*__reshadow-styles__:"./legend-flex.shadow.css"*/
|
|
25
|
+
var style = ( /*__reshadow_css_start__*/_core.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__*/, {
|
|
26
|
+
"__SLegendFlex": "___SLegendFlex_rzdp9_gg_",
|
|
27
|
+
"_direction_row": "_direction_row_rzdp9_gg_",
|
|
28
|
+
"_direction_column": "_direction_column_rzdp9_gg_"
|
|
29
|
+
});
|
|
30
|
+
var LegendFlexRoot = /*#__PURE__*/function (_BaseLegend) {
|
|
31
|
+
(0, _inherits2["default"])(LegendFlexRoot, _BaseLegend);
|
|
32
|
+
var _super = (0, _createSuper2["default"])(LegendFlexRoot);
|
|
33
|
+
function LegendFlexRoot() {
|
|
34
|
+
(0, _classCallCheck2["default"])(this, LegendFlexRoot);
|
|
35
|
+
return _super.apply(this, arguments);
|
|
36
|
+
}
|
|
37
|
+
(0, _createClass2["default"])(LegendFlexRoot, [{
|
|
38
|
+
key: "renderTrend",
|
|
39
|
+
value: function renderTrend() {
|
|
40
|
+
var _ref3 = this.asProps,
|
|
41
|
+
onTrendIsVisibleChange = _ref3.onTrendIsVisibleChange,
|
|
42
|
+
trendIsVisible = _ref3.trendIsVisible,
|
|
43
|
+
trendLabel = _ref3.trendLabel,
|
|
44
|
+
size = _ref3.size,
|
|
45
|
+
getI18nText = _ref3.getI18nText;
|
|
46
|
+
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
47
|
+
checked: trendIsVisible,
|
|
48
|
+
onChange: onTrendIsVisibleChange,
|
|
49
|
+
theme: 'gray-400',
|
|
50
|
+
label: trendLabel !== null && trendLabel !== void 0 ? trendLabel : getI18nText('trend'),
|
|
51
|
+
size: size
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var _ref = this.asProps,
|
|
58
|
+
_ref2;
|
|
59
|
+
var SLegendFlex = _flexBox.Flex;
|
|
60
|
+
var _this$asProps = this.asProps,
|
|
61
|
+
styles = _this$asProps.styles,
|
|
62
|
+
Children = _this$asProps.Children,
|
|
63
|
+
direction = _this$asProps.direction,
|
|
64
|
+
withTrend = _this$asProps.withTrend,
|
|
65
|
+
suffix = _this$asProps.suffix,
|
|
66
|
+
items = _this$asProps.items;
|
|
67
|
+
var orientation = direction === 'row' ? 'vertical' : 'horizontal';
|
|
68
|
+
return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLegendFlex, _ref2.cn("SLegendFlex", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref))), items.map(function (_ref4) {
|
|
69
|
+
var id = _ref4.id;
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(Children, {
|
|
71
|
+
key: id
|
|
72
|
+
});
|
|
73
|
+
}), (withTrend || suffix) && /*#__PURE__*/_react["default"].createElement(_divider["default"], _ref2.cn("Divider", {
|
|
74
|
+
"orientation": orientation
|
|
75
|
+
})), withTrend && this.renderTrend(), suffix ? suffix : null);
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
return LegendFlexRoot;
|
|
79
|
+
}(_BaseLegend2.BaseLegend);
|
|
80
|
+
(0, _defineProperty2["default"])(LegendFlexRoot, "displayName", 'LegendFlex');
|
|
81
|
+
(0, _defineProperty2["default"])(LegendFlexRoot, "style", style);
|
|
82
|
+
(0, _defineProperty2["default"])(LegendFlexRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages)]);
|
|
83
|
+
(0, _defineProperty2["default"])(LegendFlexRoot, "defaultProps", function () {
|
|
84
|
+
return {
|
|
85
|
+
direction: 'row',
|
|
86
|
+
children: /*#__PURE__*/_react["default"].createElement(LegendFlex.LegendItem, null)
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
var LegendFlex = (0, _core["default"])(LegendFlexRoot, {
|
|
90
|
+
LegendItem: _LegendItem.LegendItemComponent
|
|
91
|
+
});
|
|
92
|
+
exports.LegendFlex = LegendFlex;
|
|
93
|
+
//# sourceMappingURL=LegendFlex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendFlex.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_LegendItem","_divider","_checkbox","_BaseLegend2","_intergalacticDynamicLocales","_i18nEnhance","style","sstyled","insert","LegendFlexRoot","_BaseLegend","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","renderTrend","_ref3","asProps","onTrendIsVisibleChange","trendIsVisible","trendLabel","size","getI18nText","createElement","checked","onChange","theme","label","render","_ref","_ref2","SLegendFlex","Flex","_this$asProps","styles","Children","direction","withTrend","suffix","items","orientation","cn","_objectSpread2","assignProps","map","_ref4","id","BaseLegend","_defineProperty2","i18nEnhance","localizedMessages","children","LegendFlex","LegendItem","createComponent","LegendItemComponent","exports"],"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":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAGA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,4BAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAP,sBAAA,CAAAF,OAAA;AAAkE;AAAA,IAAAU,KAAA,+BA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cAAc,EAAE;EACxEiD,UAAU,EAAEE;AACd,CAAC,CAAC;AAACC,OAAA,CAAAJ,UAAA,GAAAA,UAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendFlex.type.js","names":[],"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,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LegendItemComponent = void 0;
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
17
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
var _flexBox = require("@semcore/flex-box");
|
|
19
|
+
var _checkbox = _interopRequireDefault(require("@semcore/checkbox"));
|
|
20
|
+
var _typography = require("@semcore/typography");
|
|
21
|
+
var _LegendItem = require("./LegendItem.type");
|
|
22
|
+
var _excluded = ["color"];
|
|
23
|
+
/*__reshadow-styles__:"./legend-item.shadow.css"*/
|
|
24
|
+
var style = ( /*__reshadow_css_start__*/_core.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__*/, {
|
|
25
|
+
"__SLegendItem": "___SLegendItem_1d8wv_gg_",
|
|
26
|
+
"_disabled": "__disabled_1d8wv_gg_",
|
|
27
|
+
"__SPointShape": "___SPointShape_1d8wv_gg_",
|
|
28
|
+
"_color": "__color_1d8wv_gg_",
|
|
29
|
+
"--color": "--color_1d8wv",
|
|
30
|
+
"_shape_Circle": "_shape_Circle_1d8wv_gg_",
|
|
31
|
+
"_size_l": "_size_l_1d8wv_gg_",
|
|
32
|
+
"_size_m": "_size_m_1d8wv_gg_",
|
|
33
|
+
"_shape_Line": "_shape_Line_1d8wv_gg_",
|
|
34
|
+
"_shape_Square": "_shape_Square_1d8wv_gg_",
|
|
35
|
+
"__SIcon": "___SIcon_1d8wv_gg_",
|
|
36
|
+
"__SLabel": "___SLabel_1d8wv_gg_",
|
|
37
|
+
"__SAdditionalLabel": "___SAdditionalLabel_1d8wv_gg_",
|
|
38
|
+
"__SCount": "___SCount_1d8wv_gg_"
|
|
39
|
+
});
|
|
40
|
+
var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
41
|
+
(0, _inherits2["default"])(LegendItemRoot, _Component);
|
|
42
|
+
var _super = (0, _createSuper2["default"])(LegendItemRoot);
|
|
43
|
+
function LegendItemRoot() {
|
|
44
|
+
(0, _classCallCheck2["default"])(this, LegendItemRoot);
|
|
45
|
+
return _super.apply(this, arguments);
|
|
46
|
+
}
|
|
47
|
+
(0, _createClass2["default"])(LegendItemRoot, [{
|
|
48
|
+
key: "getShapeProps",
|
|
49
|
+
value: function getShapeProps() {
|
|
50
|
+
var _this$asProps = this.asProps,
|
|
51
|
+
checked = _this$asProps.checked,
|
|
52
|
+
color = _this$asProps.color,
|
|
53
|
+
shape = _this$asProps.shape,
|
|
54
|
+
label = _this$asProps.label,
|
|
55
|
+
id = _this$asProps.id,
|
|
56
|
+
size = _this$asProps.size,
|
|
57
|
+
onClick = _this$asProps.onClick;
|
|
58
|
+
return {
|
|
59
|
+
id: id,
|
|
60
|
+
label: label,
|
|
61
|
+
shape: shape,
|
|
62
|
+
checked: checked,
|
|
63
|
+
color: color,
|
|
64
|
+
size: size,
|
|
65
|
+
onKeyUp: function onKeyUp(e) {
|
|
66
|
+
if (onClick && e.key === ' ') {
|
|
67
|
+
onClick();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "getIconProps",
|
|
74
|
+
value: function getIconProps() {
|
|
75
|
+
var props = this.asProps;
|
|
76
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
77
|
+
children: props.icon
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "getLabelProps",
|
|
82
|
+
value: function getLabelProps() {
|
|
83
|
+
var _this$asProps2 = this.asProps,
|
|
84
|
+
color = _this$asProps2.color,
|
|
85
|
+
props = (0, _objectWithoutProperties2["default"])(_this$asProps2, _excluded);
|
|
86
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
87
|
+
children: props.label
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "getAdditionalLabelProps",
|
|
92
|
+
value: function getAdditionalLabelProps() {
|
|
93
|
+
var props = this.asProps;
|
|
94
|
+
var additionalInfo = props.additionalInfo;
|
|
95
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
96
|
+
children: additionalInfo && 'label' in additionalInfo ? "".concat(additionalInfo.label) : undefined
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "getCountProps",
|
|
101
|
+
value: function getCountProps() {
|
|
102
|
+
var props = this.asProps;
|
|
103
|
+
var additionalInfo = props.additionalInfo;
|
|
104
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
105
|
+
children: additionalInfo && 'count' in additionalInfo ? "(".concat(additionalInfo.count, ")") : undefined
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "render",
|
|
110
|
+
value: function render() {
|
|
111
|
+
var _ref = this.asProps,
|
|
112
|
+
_ref7;
|
|
113
|
+
var SLegendItem = _flexBox.Flex;
|
|
114
|
+
var _this$asProps3 = this.asProps,
|
|
115
|
+
styles = _this$asProps3.styles,
|
|
116
|
+
Children = _this$asProps3.Children,
|
|
117
|
+
shape = _this$asProps3.shape;
|
|
118
|
+
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
var disabled = _LegendItem.StaticShapes.includes(shape);
|
|
121
|
+
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLegendItem, _ref7.cn("SLegendItem", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
122
|
+
"disabled": disabled
|
|
123
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref7.cn("Children", {})));
|
|
124
|
+
}
|
|
125
|
+
}]);
|
|
126
|
+
return LegendItemRoot;
|
|
127
|
+
}(_core.Component);
|
|
128
|
+
(0, _defineProperty2["default"])(LegendItemRoot, "displayName", 'LegendItem');
|
|
129
|
+
(0, _defineProperty2["default"])(LegendItemRoot, "style", style);
|
|
130
|
+
(0, _defineProperty2["default"])(LegendItemRoot, "defaultProps", function () {
|
|
131
|
+
return {
|
|
132
|
+
children: /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(LegendItemComponent.Shape, null), /*#__PURE__*/_react["default"].createElement(LegendItemComponent.Icon, null), /*#__PURE__*/_react["default"].createElement(LegendItemComponent.Label, null), /*#__PURE__*/_react["default"].createElement(LegendItemComponent.AdditionalLabel, null), /*#__PURE__*/_react["default"].createElement(LegendItemComponent.Count, null))
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
function Shape(props) {
|
|
136
|
+
var _ref2 = arguments[0],
|
|
137
|
+
_ref8;
|
|
138
|
+
var SPointShape = _flexBox.Box;
|
|
139
|
+
var styles = props.styles,
|
|
140
|
+
size = props.size,
|
|
141
|
+
shape = props.shape,
|
|
142
|
+
checked = props.checked,
|
|
143
|
+
color = props.color,
|
|
144
|
+
Children = props.Children,
|
|
145
|
+
hasChildren = props.children,
|
|
146
|
+
onKeyUp = props.onKeyUp,
|
|
147
|
+
label = props.label;
|
|
148
|
+
if (hasChildren) {
|
|
149
|
+
return /*#__PURE__*/_react["default"].createElement(Children, null);
|
|
150
|
+
}
|
|
151
|
+
if (shape === 'Checkbox') {
|
|
152
|
+
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
153
|
+
size: size,
|
|
154
|
+
checked: checked,
|
|
155
|
+
theme: checked ? color : undefined,
|
|
156
|
+
onKeyUp: onKeyUp,
|
|
157
|
+
"aria-label": label
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SPointShape, _ref8.cn("SPointShape", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref2))), /*#__PURE__*/_react["default"].createElement(Children, _ref8.cn("Children", {})));
|
|
161
|
+
}
|
|
162
|
+
function Icon(_ref13) {
|
|
163
|
+
var _ref3 = arguments[0],
|
|
164
|
+
_ref9;
|
|
165
|
+
var styles = _ref13.styles,
|
|
166
|
+
hasChildren = _ref13.children,
|
|
167
|
+
Children = _ref13.Children;
|
|
168
|
+
var SIcon = _flexBox.Box;
|
|
169
|
+
if (!hasChildren) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIcon, _ref9.cn("SIcon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
173
|
+
"tag": 'span'
|
|
174
|
+
}, _ref3))), /*#__PURE__*/_react["default"].createElement(Children, _ref9.cn("Children", {})));
|
|
175
|
+
}
|
|
176
|
+
Icon.displayName = 'Icon';
|
|
177
|
+
function Label(_ref14) {
|
|
178
|
+
var _ref4 = arguments[0],
|
|
179
|
+
_ref10;
|
|
180
|
+
var styles = _ref14.styles,
|
|
181
|
+
hasChildren = _ref14.children,
|
|
182
|
+
Children = _ref14.Children;
|
|
183
|
+
var SLabel = _typography.Text;
|
|
184
|
+
if (!hasChildren) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref10.cn("SLabel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
188
|
+
"use": 'primary'
|
|
189
|
+
}, _ref4))), /*#__PURE__*/_react["default"].createElement(Children, _ref10.cn("Children", {})));
|
|
190
|
+
}
|
|
191
|
+
Label.displayName = 'Label';
|
|
192
|
+
function AdditionalLabel(_ref15) {
|
|
193
|
+
var _ref5 = arguments[0],
|
|
194
|
+
_ref11;
|
|
195
|
+
var styles = _ref15.styles,
|
|
196
|
+
hasChildren = _ref15.children,
|
|
197
|
+
Children = _ref15.Children;
|
|
198
|
+
var SAdditionalLabel = _typography.Text;
|
|
199
|
+
if (!hasChildren) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return _ref11 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SAdditionalLabel, _ref11.cn("SAdditionalLabel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
203
|
+
"use": 'secondary'
|
|
204
|
+
}, _ref5))), /*#__PURE__*/_react["default"].createElement(Children, _ref11.cn("Children", {})));
|
|
205
|
+
}
|
|
206
|
+
AdditionalLabel.displayName = 'AdditionalLabel';
|
|
207
|
+
function Count(_ref16) {
|
|
208
|
+
var _ref6 = arguments[0],
|
|
209
|
+
_ref12;
|
|
210
|
+
var styles = _ref16.styles,
|
|
211
|
+
hasChildren = _ref16.children,
|
|
212
|
+
Children = _ref16.Children;
|
|
213
|
+
var SCount = _typography.Text;
|
|
214
|
+
if (!hasChildren) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
return _ref12 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCount, _ref12.cn("SCount", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
218
|
+
"use": 'secondary'
|
|
219
|
+
}, _ref6))), /*#__PURE__*/_react["default"].createElement(Children, _ref12.cn("Children", {})));
|
|
220
|
+
}
|
|
221
|
+
Count.displayName = 'Count';
|
|
222
|
+
var LegendItemComponent = (0, _core["default"])(LegendItemRoot, {
|
|
223
|
+
Shape: Shape,
|
|
224
|
+
Icon: Icon,
|
|
225
|
+
Label: Label,
|
|
226
|
+
AdditionalLabel: AdditionalLabel,
|
|
227
|
+
Count: Count
|
|
228
|
+
});
|
|
229
|
+
exports.LegendItemComponent = LegendItemComponent;
|
|
230
|
+
//# sourceMappingURL=LegendItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendItem.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_checkbox","_typography","_LegendItem","_excluded","style","sstyled","insert","LegendItemRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","getShapeProps","_this$asProps","asProps","checked","color","shape","label","id","size","onClick","onKeyUp","e","getIconProps","props","_objectSpread2","children","icon","getLabelProps","_this$asProps2","_objectWithoutProperties2","getAdditionalLabelProps","additionalInfo","concat","undefined","getCountProps","count","render","_ref","_ref7","SLegendItem","Flex","_this$asProps3","styles","Children","disabled","StaticShapes","includes","createElement","cn","assignProps","Component","_defineProperty2","Fragment","LegendItemComponent","Shape","Icon","Label","AdditionalLabel","Count","_ref2","arguments[0]","_ref8","SPointShape","Box","hasChildren","theme","_ref13","_ref3","_ref9","SIcon","displayName","_ref14","_ref4","_ref10","SLabel","TypographyText","_ref15","_ref5","_ref11","SAdditionalLabel","_ref16","_ref6","_ref12","SCount","createComponent","exports"],"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":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAGA,IAAAM,WAA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,IAAI,EAAJA,IAAI;EACJC,KAAK,EAALA,KAAK;EACLC,eAAe,EAAfA,eAAe;EACfC,KAAK,EAALA;AACF,CAAC,CAAC;AAAC2B,OAAA,CAAAhC,mBAAA,GAAAA,mBAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StaticShapes = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Key of chart data item
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var StaticShapes = ['Circle', 'Line', 'Square'];
|
|
12
|
+
exports.StaticShapes = StaticShapes;
|
|
13
|
+
//# sourceMappingURL=LegendItem.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegendItem.type.js","names":["StaticShapes","exports"],"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;;AAmDO,IAAMA,YAAY,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAU;AAACC,OAAA,CAAAD,YAAA,GAAAA,YAAA"}
|