intergalactic 15.100.0 → 15.101.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 +22 -0
- package/components.json +13 -13
- package/d3-chart/CompactHorizontalBar.d.ts +88 -0
- package/d3-chart/component/Chart/CompactHorizontalBarChart.d.ts +2 -0
- package/d3-chart/component/Chart/CompactHorizontalBarChart.type.d.ts +19 -0
- package/d3-chart/component/Chart/index.d.ts +1 -0
- package/d3-chart/index.d.ts +3 -0
- package/d3-chart/lib/cjs/Area.js +11 -11
- package/d3-chart/lib/cjs/Axis.js +14 -14
- package/d3-chart/lib/cjs/Bar.js +16 -10
- package/d3-chart/lib/cjs/Bar.js.map +1 -1
- package/d3-chart/lib/cjs/Bubble.js +12 -12
- package/d3-chart/lib/cjs/CompactHorizontalBar.js +591 -0
- package/d3-chart/lib/cjs/CompactHorizontalBar.js.map +1 -0
- package/d3-chart/lib/cjs/Donut.js +9 -9
- package/d3-chart/lib/cjs/Dots.js +8 -8
- package/d3-chart/lib/cjs/HorizontalBar.js +16 -10
- package/d3-chart/lib/cjs/HorizontalBar.js.map +1 -1
- package/d3-chart/lib/cjs/Hover.js +3 -3
- package/d3-chart/lib/cjs/Line.js +9 -9
- package/d3-chart/lib/cjs/Plot.js +3 -3
- package/d3-chart/lib/cjs/Radar.js +19 -19
- package/d3-chart/lib/cjs/RadialTree.js +11 -11
- package/d3-chart/lib/cjs/Reference.js +12 -12
- package/d3-chart/lib/cjs/ScatterPlot.js +9 -9
- package/d3-chart/lib/cjs/Tooltip.js +9 -9
- package/d3-chart/lib/cjs/Venn.js +9 -9
- package/d3-chart/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/d3-chart/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/d3-chart/lib/cjs/component/Chart/CompactHorizontalBarChart.js +126 -0
- package/d3-chart/lib/cjs/component/Chart/CompactHorizontalBarChart.js.map +1 -0
- package/d3-chart/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js +2 -0
- package/d3-chart/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -0
- package/d3-chart/lib/cjs/component/Chart/index.js +3 -1
- package/d3-chart/lib/cjs/component/Chart/index.js.map +1 -1
- package/d3-chart/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/d3-chart/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/d3-chart/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/d3-chart/lib/cjs/index.js +7 -0
- package/d3-chart/lib/cjs/index.js.map +1 -1
- package/d3-chart/lib/cjs/style/bar.shadow.css +36 -0
- package/d3-chart/lib/cjs/types/CompactHorizontalBar.d.js +2 -0
- package/d3-chart/lib/cjs/types/CompactHorizontalBar.d.js.map +1 -0
- package/d3-chart/lib/cjs/types/index.d.js +19 -0
- package/d3-chart/lib/cjs/types/index.d.js.map +1 -1
- package/d3-chart/lib/es6/Area.js +11 -11
- package/d3-chart/lib/es6/Axis.js +14 -14
- package/d3-chart/lib/es6/Bar.js +16 -10
- package/d3-chart/lib/es6/Bar.js.map +1 -1
- package/d3-chart/lib/es6/Bubble.js +12 -12
- package/d3-chart/lib/es6/CompactHorizontalBar.js +587 -0
- package/d3-chart/lib/es6/CompactHorizontalBar.js.map +1 -0
- package/d3-chart/lib/es6/Donut.js +9 -9
- package/d3-chart/lib/es6/Dots.js +8 -8
- package/d3-chart/lib/es6/HorizontalBar.js +16 -10
- package/d3-chart/lib/es6/HorizontalBar.js.map +1 -1
- package/d3-chart/lib/es6/Hover.js +3 -3
- package/d3-chart/lib/es6/Line.js +9 -9
- package/d3-chart/lib/es6/Plot.js +3 -3
- package/d3-chart/lib/es6/Radar.js +19 -19
- package/d3-chart/lib/es6/RadialTree.js +11 -11
- package/d3-chart/lib/es6/Reference.js +12 -12
- package/d3-chart/lib/es6/ScatterPlot.js +9 -9
- package/d3-chart/lib/es6/Tooltip.js +9 -9
- package/d3-chart/lib/es6/Venn.js +9 -9
- package/d3-chart/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/d3-chart/lib/es6/a11y/PlotA11yView.js +2 -2
- package/d3-chart/lib/es6/component/Chart/CompactHorizontalBarChart.js +118 -0
- package/d3-chart/lib/es6/component/Chart/CompactHorizontalBarChart.js.map +1 -0
- package/d3-chart/lib/es6/component/Chart/CompactHorizontalBarChart.type.js +2 -0
- package/d3-chart/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -0
- package/d3-chart/lib/es6/component/Chart/index.js +3 -1
- package/d3-chart/lib/es6/component/Chart/index.js.map +1 -1
- package/d3-chart/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/d3-chart/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/d3-chart/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/d3-chart/lib/es6/index.js +1 -0
- package/d3-chart/lib/es6/index.js.map +1 -1
- package/d3-chart/lib/es6/style/bar.shadow.css +36 -0
- package/d3-chart/lib/es6/types/CompactHorizontalBar.d.js +2 -0
- package/d3-chart/lib/es6/types/CompactHorizontalBar.d.js.map +1 -0
- package/d3-chart/lib/es6/types/index.d.js +2 -0
- package/d3-chart/lib/es6/types/index.d.js.map +1 -1
- package/d3-chart/lib/types/CompactHorizontalBar.d.ts +88 -0
- package/d3-chart/lib/types/component/Chart/CompactHorizontalBarChart.d.ts +2 -0
- package/d3-chart/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +19 -0
- package/d3-chart/lib/types/component/Chart/index.d.ts +1 -0
- package/d3-chart/lib/types/index.d.ts +3 -0
- package/data-table/lib/cjs/Body.js +3 -3
- package/data-table/lib/cjs/DataTable.js +37 -37
- package/data-table/lib/es6/Body.js +3 -3
- package/data-table/lib/es6/DataTable.js +37 -37
- package/dropdown/lib/cjs/Dropdown.js +2 -2
- package/dropdown/lib/es6/Dropdown.js +2 -2
- package/dropdown-menu/lib/cjs/DropdownMenu.js +21 -21
- package/dropdown-menu/lib/es6/DropdownMenu.js +21 -21
- package/feature-popover/lib/cjs/FeaturePopover.js +10 -10
- package/feature-popover/lib/es6/FeaturePopover.js +10 -10
- package/input-tags/lib/cjs/InputTags.js +12 -12
- package/input-tags/lib/es6/InputTags.js +12 -12
- package/package.json +1 -1
- package/popper/lib/cjs/Popper.js +23 -14
- package/popper/lib/cjs/Popper.js.map +1 -1
- package/popper/lib/es6/Popper.js +23 -14
- package/popper/lib/es6/Popper.js.map +1 -1
- package/scroll-area/lib/cjs/ScrollArea.js +23 -22
- package/scroll-area/lib/cjs/ScrollArea.js.map +1 -1
- package/scroll-area/lib/cjs/ScrollBar.js +6 -6
- package/scroll-area/lib/es6/ScrollArea.js +23 -22
- package/scroll-area/lib/es6/ScrollArea.js.map +1 -1
- package/scroll-area/lib/es6/ScrollBar.js +6 -6
- package/select/lib/cjs/InputSearch.js +6 -6
- package/select/lib/cjs/Select.js +8 -8
- package/select/lib/es6/InputSearch.js +6 -6
- package/select/lib/es6/Select.js +8 -8
- package/skeleton/index.d.ts +2 -0
- package/skeleton/lib/cjs/Charts/Area.js +9 -9
- package/skeleton/lib/cjs/Charts/Bar.js +9 -9
- package/skeleton/lib/cjs/Charts/Bubble.js +9 -9
- package/skeleton/lib/cjs/Charts/CompactHorizontalBar.js +39 -0
- package/skeleton/lib/cjs/Charts/CompactHorizontalBar.js.map +1 -0
- package/skeleton/lib/cjs/Charts/Donut.js +9 -9
- package/skeleton/lib/cjs/Charts/Histogram.js +9 -9
- package/skeleton/lib/cjs/Charts/Line.js +9 -9
- package/skeleton/lib/cjs/Charts/RadialTree.js +9 -9
- package/skeleton/lib/cjs/Charts/ScatterPlot.js +9 -9
- package/skeleton/lib/cjs/Charts/Venn.js +9 -9
- package/skeleton/lib/cjs/Charts/index.js +7 -0
- package/skeleton/lib/cjs/Charts/index.js.map +1 -1
- package/skeleton/lib/cjs/Skeleton.js +8 -8
- package/skeleton/lib/cjs/index.d.js.map +1 -1
- package/skeleton/lib/cjs/svg/compact-horizontal-bar-chart.svg +8 -0
- package/skeleton/lib/es6/Charts/Area.js +9 -9
- package/skeleton/lib/es6/Charts/Bar.js +9 -9
- package/skeleton/lib/es6/Charts/Bubble.js +9 -9
- package/skeleton/lib/es6/Charts/CompactHorizontalBar.js +31 -0
- package/skeleton/lib/es6/Charts/CompactHorizontalBar.js.map +1 -0
- package/skeleton/lib/es6/Charts/Donut.js +9 -9
- package/skeleton/lib/es6/Charts/Histogram.js +9 -9
- package/skeleton/lib/es6/Charts/Line.js +9 -9
- package/skeleton/lib/es6/Charts/RadialTree.js +9 -9
- package/skeleton/lib/es6/Charts/ScatterPlot.js +9 -9
- package/skeleton/lib/es6/Charts/Venn.js +9 -9
- package/skeleton/lib/es6/Charts/index.js +1 -0
- package/skeleton/lib/es6/Charts/index.js.map +1 -1
- package/skeleton/lib/es6/Skeleton.js +8 -8
- package/skeleton/lib/es6/index.d.js.map +1 -1
- package/skeleton/lib/es6/svg/compact-horizontal-bar-chart.svg +8 -0
- package/skeleton/lib/types/index.d.ts +2 -0
- package/slider/lib/cjs/Slider.js +9 -8
- package/slider/lib/cjs/Slider.js.map +1 -1
- package/slider/lib/es6/Slider.js +9 -8
- package/slider/lib/es6/Slider.js.map +1 -1
- package/time-picker/lib/cjs/TimePicker.js +12 -12
- package/time-picker/lib/es6/TimePicker.js +12 -12
- package/tooltip/lib/cjs/Tooltip.js +11 -11
- package/tooltip/lib/es6/Tooltip.js +11 -11
@@ -0,0 +1,591 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = exports.MIN_WIDTH = void 0;
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
12
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
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 _index = require("intergalactic/utils/lib/core/index");
|
17
|
+
var _core = require("intergalactic/core");
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
19
|
+
var _uniqueID = _interopRequireDefault(require("intergalactic/utils/lib/uniqueID"));
|
20
|
+
var _createElement = _interopRequireDefault(require("./createElement"));
|
21
|
+
var _AnimatedClipPath = _interopRequireDefault(require("./AnimatedClipPath"));
|
22
|
+
var _utils = require("./utils");
|
23
|
+
var _Pattern = require("./Pattern");
|
24
|
+
var _rafTrottle = _interopRequireDefault(require("intergalactic/utils/lib/rafTrottle"));
|
25
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
26
|
+
var _assignProps5 = require("intergalactic/utils/lib/assignProps");
|
27
|
+
var _canUseDOM = _interopRequireDefault(require("intergalactic/utils/lib/canUseDOM"));
|
28
|
+
var _flexBox = require("intergalactic/flex-box");
|
29
|
+
/*__reshadow-styles__:"./style/bar.shadow.css"*/
|
30
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SBar_1g3k3_gg_{fill:var(--intergalactic-chart-palette-order-1, #2bb3ff);transition-property:height,width,y;transition-duration:var(--duration_1g3k3);transition-timing-function:ease-in-out}.___SBar_1g3k3_gg_.__color_1g3k3_gg_{fill:var(--color_1g3k3)}.___SBar_1g3k3_gg_.__pattern_1g3k3_gg_.__color_1g3k3_gg_{fill:var(--pattern_1g3k3);stroke:var(--color_1g3k3);stroke-width:1px}.___SBar_1g3k3_gg_.__hide_1g3k3_gg_{display:none}.___SBar_1g3k3_gg_.__transparent_1g3k3_gg_{opacity:.3}.___SBackground_1g3k3_gg_.__onClick_1g3k3_gg_,.___SBar_1g3k3_gg_.__onClick_1g3k3_gg_{cursor:pointer}.___SBackground_1g3k3_gg_{fill:var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9)}.___SBarAnnotation_1g3k3_gg_{display:flex;justify-content:space-between}.___SBarLabel_1g3k3_gg_{color:var(--intergalactic-text-primary, #191b23);margin-right:auto}.___SBarLabel_1g3k3_gg_,.___SBarPercent_1g3k3_gg_,.___SBarValue_1g3k3_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SBarPercent_1g3k3_gg_{color:var(--intergalactic-text-secondary, #6c6e79);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SBarValue_1g3k3_gg_{min-width:52px;display:flex;justify-content:flex-end;color:var(--intergalactic-text-primary, #191b23);text-align:right}.___SCompactHorizontalBarHoverRect_1g3k3_gg_{fill:var(--intergalactic-chart-grid-bar-chart-hover, rgba(196, 199, 207, 0.3))}" /*__inner_css_end__*/, "1g3k3_gg_") /*__reshadow_css_end__*/, {
|
31
|
+
"__SBar": "___SBar_1g3k3_gg_",
|
32
|
+
"--duration": "--duration_1g3k3",
|
33
|
+
"_color": "__color_1g3k3_gg_",
|
34
|
+
"--color": "--color_1g3k3",
|
35
|
+
"_pattern": "__pattern_1g3k3_gg_",
|
36
|
+
"--pattern": "--pattern_1g3k3",
|
37
|
+
"_hide": "__hide_1g3k3_gg_",
|
38
|
+
"_transparent": "__transparent_1g3k3_gg_",
|
39
|
+
"_onClick": "__onClick_1g3k3_gg_",
|
40
|
+
"__SBackground": "___SBackground_1g3k3_gg_",
|
41
|
+
"__SBarAnnotation": "___SBarAnnotation_1g3k3_gg_",
|
42
|
+
"__SBarLabel": "___SBarLabel_1g3k3_gg_",
|
43
|
+
"__SBarPercent": "___SBarPercent_1g3k3_gg_",
|
44
|
+
"__SBarValue": "___SBarValue_1g3k3_gg_",
|
45
|
+
"__SCompactHorizontalBarHoverRect": "___SCompactHorizontalBarHoverRect_1g3k3_gg_"
|
46
|
+
});
|
47
|
+
var MIN_WIDTH = 4;
|
48
|
+
exports.MIN_WIDTH = MIN_WIDTH;
|
49
|
+
var barHeight = 20;
|
50
|
+
var hoverOffset = 6;
|
51
|
+
var CompactHorizontalBarRoot = /*#__PURE__*/function (_Component) {
|
52
|
+
(0, _inherits2["default"])(CompactHorizontalBarRoot, _Component);
|
53
|
+
var _super = (0, _createSuper2["default"])(CompactHorizontalBarRoot);
|
54
|
+
function CompactHorizontalBarRoot() {
|
55
|
+
var _this;
|
56
|
+
(0, _classCallCheck2["default"])(this, CompactHorizontalBarRoot);
|
57
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
58
|
+
args[_key] = arguments[_key];
|
59
|
+
}
|
60
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
61
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "percentFormatter", null);
|
62
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "percentFormatterLocale", null);
|
63
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "valueFormatter", null);
|
64
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "valueFormatterLocale", null);
|
65
|
+
return _this;
|
66
|
+
}
|
67
|
+
(0, _createClass2["default"])(CompactHorizontalBarRoot, [{
|
68
|
+
key: "getBarProps",
|
69
|
+
value: function getBarProps(_props, index) {
|
70
|
+
return {
|
71
|
+
index: index
|
72
|
+
};
|
73
|
+
}
|
74
|
+
}, {
|
75
|
+
key: "getBarBackgroundProps",
|
76
|
+
value: function getBarBackgroundProps(_props, index) {
|
77
|
+
var _this$asProps = this.asProps,
|
78
|
+
data = _this$asProps.data,
|
79
|
+
scale = _this$asProps.scale;
|
80
|
+
var bar = this.computeBarData(data[index], index);
|
81
|
+
return {
|
82
|
+
scale: scale,
|
83
|
+
index: index,
|
84
|
+
x: bar.x,
|
85
|
+
y: bar.y + bar.height - barHeight - hoverOffset,
|
86
|
+
height: barHeight,
|
87
|
+
width: bar.fullWidth
|
88
|
+
};
|
89
|
+
}
|
90
|
+
}, {
|
91
|
+
key: "getBarFillProps",
|
92
|
+
value: function getBarFillProps(_props, index) {
|
93
|
+
var _this$asProps2 = this.asProps,
|
94
|
+
data = _this$asProps2.data,
|
95
|
+
uid = _this$asProps2.uid,
|
96
|
+
patterns = _this$asProps2.patterns,
|
97
|
+
color = _this$asProps2.color,
|
98
|
+
transparent = _this$asProps2.transparent,
|
99
|
+
hide = _this$asProps2.hide,
|
100
|
+
scale = _this$asProps2.scale;
|
101
|
+
var bar = this.computeBarData(data[index], index);
|
102
|
+
return {
|
103
|
+
x: bar.x,
|
104
|
+
y: bar.y + bar.height - barHeight - hoverOffset,
|
105
|
+
height: barHeight,
|
106
|
+
width: bar.width,
|
107
|
+
i: index,
|
108
|
+
uid: uid,
|
109
|
+
resolveColor: this.asProps.resolveColor,
|
110
|
+
patterns: patterns,
|
111
|
+
color: color,
|
112
|
+
transparent: transparent,
|
113
|
+
hide: hide,
|
114
|
+
scale: scale
|
115
|
+
};
|
116
|
+
}
|
117
|
+
}, {
|
118
|
+
key: "getAnnotationProps",
|
119
|
+
value: function getAnnotationProps(_props, index) {
|
120
|
+
var _this$asProps3 = this.asProps,
|
121
|
+
data = _this$asProps3.data,
|
122
|
+
size = _this$asProps3.size;
|
123
|
+
var bar = this.computeBarData(data[index], index);
|
124
|
+
return {
|
125
|
+
y: bar.y,
|
126
|
+
height: barHeight * 2,
|
127
|
+
width: size[0]
|
128
|
+
};
|
129
|
+
}
|
130
|
+
}, {
|
131
|
+
key: "getLabelProps",
|
132
|
+
value: function getLabelProps(_props, index) {
|
133
|
+
var _this$asProps4 = this.asProps,
|
134
|
+
data = _this$asProps4.data,
|
135
|
+
y = _this$asProps4.y;
|
136
|
+
var label = data[index][y];
|
137
|
+
return {
|
138
|
+
children: label
|
139
|
+
};
|
140
|
+
}
|
141
|
+
}, {
|
142
|
+
key: "getPercentFormatter",
|
143
|
+
value: function getPercentFormatter() {
|
144
|
+
if (!this.percentFormatter || this.percentFormatterLocale !== this.asProps.locale) {
|
145
|
+
this.percentFormatter = new Intl.NumberFormat(this.asProps.locale, {
|
146
|
+
style: 'percent'
|
147
|
+
});
|
148
|
+
this.percentFormatterLocale = this.asProps.locale;
|
149
|
+
}
|
150
|
+
return this.percentFormatter;
|
151
|
+
}
|
152
|
+
}, {
|
153
|
+
key: "getValueFormatter",
|
154
|
+
value: function getValueFormatter() {
|
155
|
+
if (!this.valueFormatter || this.valueFormatterLocale !== this.asProps.locale) {
|
156
|
+
this.valueFormatter = new Intl.NumberFormat(this.asProps.locale);
|
157
|
+
this.valueFormatterLocale = this.asProps.locale;
|
158
|
+
}
|
159
|
+
return this.valueFormatter;
|
160
|
+
}
|
161
|
+
}, {
|
162
|
+
key: "getPercentProps",
|
163
|
+
value: function getPercentProps(_props, index) {
|
164
|
+
var _this$asProps5 = this.asProps,
|
165
|
+
data = _this$asProps5.data,
|
166
|
+
x = _this$asProps5.x,
|
167
|
+
scale = _this$asProps5.scale;
|
168
|
+
var value = data[index][x];
|
169
|
+
var domain = scale[0].domain();
|
170
|
+
var percent = value / domain[1];
|
171
|
+
var formatter = this.getPercentFormatter();
|
172
|
+
var formatted = formatter.format(percent);
|
173
|
+
return {
|
174
|
+
children: formatted,
|
175
|
+
formatted: formatted,
|
176
|
+
percent: percent
|
177
|
+
};
|
178
|
+
}
|
179
|
+
}, {
|
180
|
+
key: "getValueProps",
|
181
|
+
value: function getValueProps(_props, index) {
|
182
|
+
var _this$asProps6 = this.asProps,
|
183
|
+
data = _this$asProps6.data,
|
184
|
+
x = _this$asProps6.x;
|
185
|
+
var value = data[index][x];
|
186
|
+
var formatter = this.getValueFormatter();
|
187
|
+
var formatted = formatter.format(value);
|
188
|
+
return {
|
189
|
+
children: formatted,
|
190
|
+
formatted: formatted,
|
191
|
+
value: value
|
192
|
+
};
|
193
|
+
}
|
194
|
+
}, {
|
195
|
+
key: "getHoverProps",
|
196
|
+
value: function getHoverProps(_props, index) {
|
197
|
+
var _this2 = this;
|
198
|
+
var data = this.asProps.data;
|
199
|
+
return {
|
200
|
+
data: data,
|
201
|
+
getBarData: function getBarData(index) {
|
202
|
+
return _this2.computeBarData(data[index], index);
|
203
|
+
},
|
204
|
+
render: index === 0
|
205
|
+
};
|
206
|
+
}
|
207
|
+
}, {
|
208
|
+
key: "getTooltipProps",
|
209
|
+
value: function getTooltipProps(_props, index) {
|
210
|
+
return {
|
211
|
+
render: index === 0
|
212
|
+
};
|
213
|
+
}
|
214
|
+
}, {
|
215
|
+
key: "computeBarData",
|
216
|
+
value: function computeBarData(d) {
|
217
|
+
var _this$asProps7 = this.asProps,
|
218
|
+
x = _this$asProps7.x,
|
219
|
+
y = _this$asProps7.y,
|
220
|
+
scale = _this$asProps7.scale,
|
221
|
+
offsetProps = _this$asProps7.offset,
|
222
|
+
wMin = _this$asProps7.wMin,
|
223
|
+
heightProps = _this$asProps7.height,
|
224
|
+
_this$asProps7$maxBar = _this$asProps7.maxBarSize,
|
225
|
+
maxBarSize = _this$asProps7$maxBar === void 0 ? Infinity : _this$asProps7$maxBar,
|
226
|
+
size = _this$asProps7.size;
|
227
|
+
var offset = typeof offsetProps === 'function' ? offsetProps(i) : offsetProps;
|
228
|
+
var _scale = (0, _slicedToArray2["default"])(scale, 2),
|
229
|
+
xScale = _scale[0],
|
230
|
+
yScale = _scale[1];
|
231
|
+
var absWidth = xScale(d[x]);
|
232
|
+
var bandHeight = heightProps || (0, _utils.scaleToBand)(yScale).bandwidth();
|
233
|
+
var height = Math.min(bandHeight, maxBarSize);
|
234
|
+
var width = absWidth === 0 ? 0 : Math.max(absWidth, wMin);
|
235
|
+
var barY = yScale(d[y]) + bandHeight / 2 - height / 2 + offset[1];
|
236
|
+
return {
|
237
|
+
x: 0,
|
238
|
+
y: barY,
|
239
|
+
width: width,
|
240
|
+
fullWidth: size[0],
|
241
|
+
height: height
|
242
|
+
};
|
243
|
+
}
|
244
|
+
}, {
|
245
|
+
key: "renderBar",
|
246
|
+
value: function renderBar(d, i) {
|
247
|
+
var _ref5;
|
248
|
+
var SCompactHorizontalBarGroup = this.Element;
|
249
|
+
var _this$asProps8 = this.asProps,
|
250
|
+
styles = _this$asProps8.styles,
|
251
|
+
groupKey = _this$asProps8.groupKey;
|
252
|
+
var _this$computeBarData = this.computeBarData(d, i),
|
253
|
+
x = _this$computeBarData.x,
|
254
|
+
y = _this$computeBarData.y;
|
255
|
+
this.asProps.dataHintsHandler.describeValueEntity("".concat(i, ".").concat(x), groupKey !== null && groupKey !== void 0 ? groupKey : d[y]);
|
256
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
257
|
+
key: "horizontal-bar-".concat(i)
|
258
|
+
}, (_ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCompactHorizontalBarGroup, _ref5.cn("SCompactHorizontalBarGroup", {
|
259
|
+
"render": 'g'
|
260
|
+
}))));
|
261
|
+
}
|
262
|
+
}, {
|
263
|
+
key: "renderBars",
|
264
|
+
value: function renderBars() {
|
265
|
+
var data = this.asProps.data;
|
266
|
+
return data.map(this.renderBar.bind(this));
|
267
|
+
}
|
268
|
+
}, {
|
269
|
+
key: "render",
|
270
|
+
value: function render() {
|
271
|
+
var _this$asProps9 = this.asProps,
|
272
|
+
uid = _this$asProps9.uid,
|
273
|
+
size = _this$asProps9.size,
|
274
|
+
duration = _this$asProps9.duration;
|
275
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.renderBars(), duration && /*#__PURE__*/_react["default"].createElement(_AnimatedClipPath["default"], {
|
276
|
+
"aria-hidden": true,
|
277
|
+
duration: duration,
|
278
|
+
id: uid,
|
279
|
+
x: "0",
|
280
|
+
y: "0",
|
281
|
+
width: 0,
|
282
|
+
height: size[1]
|
283
|
+
}));
|
284
|
+
}
|
285
|
+
}]);
|
286
|
+
return CompactHorizontalBarRoot;
|
287
|
+
}(_core.Component);
|
288
|
+
(0, _defineProperty2["default"])(CompactHorizontalBarRoot, "displayName", 'CompactHorizontalBar');
|
289
|
+
(0, _defineProperty2["default"])(CompactHorizontalBarRoot, "enhance", [(0, _uniqueID["default"])()]);
|
290
|
+
(0, _defineProperty2["default"])(CompactHorizontalBarRoot, "style", style);
|
291
|
+
(0, _defineProperty2["default"])(CompactHorizontalBarRoot, "defaultProps", {
|
292
|
+
offset: [0, 0],
|
293
|
+
duration: 500,
|
294
|
+
wMin: MIN_WIDTH,
|
295
|
+
locale: 'en',
|
296
|
+
color: 'chart-palette-order-1'
|
297
|
+
});
|
298
|
+
function Annotation(props) {
|
299
|
+
var _ref6;
|
300
|
+
var Children = props.Children,
|
301
|
+
y = props.y,
|
302
|
+
height = props.height,
|
303
|
+
width = props.width,
|
304
|
+
styles = props.styles;
|
305
|
+
var SBarAnnotation = 'div';
|
306
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement("foreignObject", _ref6.cn("foreignObject", {
|
307
|
+
"x": '0',
|
308
|
+
"y": y - barHeight,
|
309
|
+
"height": height,
|
310
|
+
"width": width
|
311
|
+
}), /*#__PURE__*/_react["default"].createElement(SBarAnnotation, _ref6.cn("SBarAnnotation", {}), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {}))));
|
312
|
+
}
|
313
|
+
var excludeProps = ['data', 'scale', 'value', 'offset'];
|
314
|
+
function Label(props) {
|
315
|
+
var _ref = arguments[0],
|
316
|
+
_ref7;
|
317
|
+
var SBarLabel = _flexBox.Box;
|
318
|
+
var styles = props.styles,
|
319
|
+
Children = props.Children;
|
320
|
+
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBarLabel, _ref7.cn("SBarLabel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
321
|
+
"__excludeProps": excludeProps
|
322
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref7.cn("Children", {})));
|
323
|
+
}
|
324
|
+
function Percent(props) {
|
325
|
+
var _ref2 = arguments[0],
|
326
|
+
_ref8;
|
327
|
+
var SBarPercent = _flexBox.Box;
|
328
|
+
var styles = props.styles,
|
329
|
+
Children = props.Children;
|
330
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBarPercent, _ref8.cn("SBarPercent", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
331
|
+
"__excludeProps": excludeProps
|
332
|
+
}, _ref2))), /*#__PURE__*/_react["default"].createElement(Children, _ref8.cn("Children", {})));
|
333
|
+
}
|
334
|
+
function Value(props) {
|
335
|
+
var _ref3 = arguments[0],
|
336
|
+
_ref9;
|
337
|
+
var SBarValue = _flexBox.Box;
|
338
|
+
var styles = props.styles,
|
339
|
+
Children = props.Children;
|
340
|
+
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBarValue, _ref9.cn("SBarValue", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
341
|
+
"__excludeProps": excludeProps
|
342
|
+
}, _ref3))), /*#__PURE__*/_react["default"].createElement(Children, _ref9.cn("Children", {})));
|
343
|
+
}
|
344
|
+
var BarContext = /*#__PURE__*/_react["default"].createContext({});
|
345
|
+
function Bar(props) {
|
346
|
+
var Children = props.Children,
|
347
|
+
index = props.index,
|
348
|
+
onClick = props.onClick,
|
349
|
+
transparent = props.transparent,
|
350
|
+
hide = props.hide;
|
351
|
+
var onClickHandler = _react["default"].useCallback(function (event) {
|
352
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(index, event);
|
353
|
+
}, [onClick, index]);
|
354
|
+
var contextValue = _react["default"].useMemo(function () {
|
355
|
+
return {
|
356
|
+
onClick: onClickHandler,
|
357
|
+
transparent: transparent,
|
358
|
+
hide: hide
|
359
|
+
};
|
360
|
+
}, [onClickHandler, transparent, hide]);
|
361
|
+
return /*#__PURE__*/_react["default"].createElement(BarContext.Provider, {
|
362
|
+
value: contextValue
|
363
|
+
}, /*#__PURE__*/_react["default"].createElement(Children, null));
|
364
|
+
}
|
365
|
+
function BarFill(props) {
|
366
|
+
var _ref10;
|
367
|
+
var SBar = props.Element,
|
368
|
+
styles = props.styles,
|
369
|
+
color = props.color,
|
370
|
+
x = props.x,
|
371
|
+
y = props.y,
|
372
|
+
width = props.width,
|
373
|
+
height = props.height,
|
374
|
+
uid = props.uid,
|
375
|
+
duration = props.duration,
|
376
|
+
resolveColor = props.resolveColor,
|
377
|
+
patterns = props.patterns,
|
378
|
+
i = props.i,
|
379
|
+
scale = props.scale;
|
380
|
+
var _scale2 = (0, _slicedToArray2["default"])(scale, 1),
|
381
|
+
xScale = _scale2[0];
|
382
|
+
var xRange = xScale.range();
|
383
|
+
var backgroundWidth = xRange[1] - xRange[0];
|
384
|
+
var radius = 0; // left it here in case we will change our mind and return to rounded bars
|
385
|
+
var pathD = _react["default"].useMemo(function () {
|
386
|
+
if (backgroundWidth - radius > width) {
|
387
|
+
return (0, _utils.roundedPath)(x, y, width, height, radius);
|
388
|
+
}
|
389
|
+
return (0, _utils.roundedPath)(x, y, width, height, radius, false, true, false, true);
|
390
|
+
}, [x, y, height, width, radius]);
|
391
|
+
var barProps = _react["default"].useContext(BarContext);
|
392
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (_ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBar, _ref10.cn("SBar", {
|
393
|
+
"aria-hidden": true,
|
394
|
+
"render": 'path',
|
395
|
+
"d": pathD,
|
396
|
+
"clipPath": "url(#".concat(uid, ")"),
|
397
|
+
"__excludeProps": ['data', 'scale', 'value', 'offset'],
|
398
|
+
"childrenPosition": 'above',
|
399
|
+
"index": i,
|
400
|
+
"color": resolveColor(color),
|
401
|
+
"pattern": patterns ? "url(#".concat(uid, "-").concat(i, "-pattern)") : undefined,
|
402
|
+
"x": x,
|
403
|
+
"y": y,
|
404
|
+
"width": width,
|
405
|
+
"height": height,
|
406
|
+
"use:duration": "".concat(duration, "ms"),
|
407
|
+
"onClick": (0, _assignProps5.callAllEventHandlers)(props.onClick, barProps.onClick),
|
408
|
+
"transparent": barProps.transparent || props.transparent,
|
409
|
+
"hide": barProps.hide || props.hide
|
410
|
+
}))), patterns && /*#__PURE__*/_react["default"].createElement(_Pattern.PatternFill, _ref10.cn("PatternFill", {
|
411
|
+
"id": "".concat(uid, "-").concat(i, "-pattern"),
|
412
|
+
"patternKey": color,
|
413
|
+
"color": resolveColor(color),
|
414
|
+
"patterns": patterns
|
415
|
+
})));
|
416
|
+
}
|
417
|
+
function BarBackground(props) {
|
418
|
+
var _ref11;
|
419
|
+
var SBackground = props.Element,
|
420
|
+
styles = props.styles,
|
421
|
+
scale = props.scale,
|
422
|
+
y = props.y,
|
423
|
+
x = props.x,
|
424
|
+
height = props.height;
|
425
|
+
var _scale3 = (0, _slicedToArray2["default"])(scale, 1),
|
426
|
+
xScale = _scale3[0];
|
427
|
+
var xRange = xScale.range();
|
428
|
+
var width = xRange[1] - xRange[0];
|
429
|
+
var radius = 0; // left it here in case we will change our mind and return to rounded bars
|
430
|
+
var pathD = _react["default"].useMemo(function () {
|
431
|
+
return (0, _utils.roundedPath)(x, y, width, height, radius, false, true, false, true);
|
432
|
+
}, [x, y, height, width, radius]);
|
433
|
+
var barProps = _react["default"].useContext(BarContext);
|
434
|
+
return _ref11 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SBackground, _ref11.cn("SBackground", {
|
435
|
+
"aria-hidden": true,
|
436
|
+
"render": 'path',
|
437
|
+
"d": pathD,
|
438
|
+
"childrenPosition": 'above',
|
439
|
+
"width": xRange[1] - xRange[0],
|
440
|
+
"height": height,
|
441
|
+
"x": x,
|
442
|
+
"y": y,
|
443
|
+
"transparent": barProps.transparent,
|
444
|
+
"onClick": (0, _assignProps5.callAllEventHandlers)(props.onClick, barProps.onClick)
|
445
|
+
}));
|
446
|
+
}
|
447
|
+
var Hover = /*#__PURE__*/function (_Component2) {
|
448
|
+
(0, _inherits2["default"])(Hover, _Component2);
|
449
|
+
var _super2 = (0, _createSuper2["default"])(Hover);
|
450
|
+
function Hover() {
|
451
|
+
var _this3;
|
452
|
+
(0, _classCallCheck2["default"])(this, Hover);
|
453
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
454
|
+
args[_key2] = arguments[_key2];
|
455
|
+
}
|
456
|
+
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
457
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
|
458
|
+
index: null
|
459
|
+
});
|
460
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "virtualElement", (0, _canUseDOM["default"])() ? document.createElement('div') : {});
|
461
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "unsubscribeMouseMoveRoot", null);
|
462
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "unsubscribeMouseLeaveRoot", null);
|
463
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "handlerMouseMoveRoot", (0, _rafTrottle["default"])(function (e) {
|
464
|
+
var _this3$asProps = _this3.asProps,
|
465
|
+
eventEmitter = _this3$asProps.eventEmitter,
|
466
|
+
rootRef = _this3$asProps.rootRef,
|
467
|
+
patterns = _this3$asProps.patterns;
|
468
|
+
var point = (0, _utils.eventToPoint)(e, rootRef.current);
|
469
|
+
var clientX = e.clientX,
|
470
|
+
clientY = e.clientY;
|
471
|
+
var index = _this3.getIndex(point);
|
472
|
+
_this3.setState({
|
473
|
+
index: index
|
474
|
+
}, function () {
|
475
|
+
eventEmitter.emit('setTooltipPosition', clientX, clientY);
|
476
|
+
eventEmitter.emit('setTooltipRenderingProps', {}, {
|
477
|
+
index: index,
|
478
|
+
patterns: patterns
|
479
|
+
});
|
480
|
+
eventEmitter.emit('setTooltipVisible', index !== null);
|
481
|
+
});
|
482
|
+
}));
|
483
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "handlerMouseLeaveRoot", (0, _rafTrottle["default"])(function () {
|
484
|
+
_this3.setState({
|
485
|
+
index: null
|
486
|
+
}, function () {
|
487
|
+
_this3.asProps.eventEmitter.emit('setTooltipVisible', false);
|
488
|
+
});
|
489
|
+
}));
|
490
|
+
return _this3;
|
491
|
+
}
|
492
|
+
(0, _createClass2["default"])(Hover, [{
|
493
|
+
key: "generateGetBoundingClientRect",
|
494
|
+
value: function generateGetBoundingClientRect() {
|
495
|
+
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
496
|
+
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
497
|
+
return function () {
|
498
|
+
return {
|
499
|
+
width: 0,
|
500
|
+
height: 0,
|
501
|
+
top: y,
|
502
|
+
right: x,
|
503
|
+
bottom: y,
|
504
|
+
left: x
|
505
|
+
};
|
506
|
+
};
|
507
|
+
}
|
508
|
+
}, {
|
509
|
+
key: "getIndex",
|
510
|
+
value: function getIndex(point) {
|
511
|
+
var _this$asProps10 = this.asProps,
|
512
|
+
data = _this$asProps10.data,
|
513
|
+
getBarData = _this$asProps10.getBarData;
|
514
|
+
for (var _i = 0; _i < data.length; _i++) {
|
515
|
+
var bar = getBarData(_i);
|
516
|
+
if (point[0] >= bar.x && point[0] <= bar.x + bar.fullWidth && point[1] >= bar.y && point[1] <= bar.y + bar.height) {
|
517
|
+
return _i;
|
518
|
+
}
|
519
|
+
}
|
520
|
+
return null;
|
521
|
+
}
|
522
|
+
}, {
|
523
|
+
key: "componentDidMount",
|
524
|
+
value: function componentDidMount() {
|
525
|
+
var _this4 = this;
|
526
|
+
var eventEmitter = this.asProps.eventEmitter;
|
527
|
+
this.unsubscribeMouseMoveRoot = eventEmitter.subscribe('onMouseMoveRoot', function (e) {
|
528
|
+
e.persist();
|
529
|
+
_this4.handlerMouseMoveRoot(e);
|
530
|
+
});
|
531
|
+
this.unsubscribeMouseLeaveRoot = eventEmitter.subscribe('onMouseLeaveRoot', this.handlerMouseLeaveRoot);
|
532
|
+
}
|
533
|
+
}, {
|
534
|
+
key: "componentWillUnmount",
|
535
|
+
value: function componentWillUnmount() {
|
536
|
+
if (this.unsubscribeMouseMoveRoot) {
|
537
|
+
this.unsubscribeMouseMoveRoot();
|
538
|
+
}
|
539
|
+
if (this.unsubscribeMouseLeaveRoot) {
|
540
|
+
this.unsubscribeMouseLeaveRoot();
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}, {
|
544
|
+
key: "render",
|
545
|
+
value: function render() {
|
546
|
+
var _ref12;
|
547
|
+
var _this$asProps11 = this.asProps,
|
548
|
+
styles = _this$asProps11.styles,
|
549
|
+
getBarData = _this$asProps11.getBarData,
|
550
|
+
render = _this$asProps11.render;
|
551
|
+
if (!render) return null;
|
552
|
+
var index = this.state.index;
|
553
|
+
var SCompactHorizontalBarHoverRect = this.Element;
|
554
|
+
if (index === null) return null;
|
555
|
+
var bar = getBarData(index);
|
556
|
+
return _ref12 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCompactHorizontalBarHoverRect, _ref12.cn("SCompactHorizontalBarHoverRect", {
|
557
|
+
"render": 'rect',
|
558
|
+
"x": bar.x,
|
559
|
+
"y": bar.y + bar.height - barHeight - hoverOffset * 2,
|
560
|
+
"width": bar.fullWidth,
|
561
|
+
"height": barHeight + hoverOffset * 2
|
562
|
+
}));
|
563
|
+
}
|
564
|
+
}]);
|
565
|
+
return Hover;
|
566
|
+
}(_core.Component);
|
567
|
+
var CompactHorizontalBarTooltip = function CompactHorizontalBarTooltip(props) {
|
568
|
+
var _ref4 = arguments[0],
|
569
|
+
_ref13;
|
570
|
+
if (!props.render) return null;
|
571
|
+
var SCompactHorizontalBarRadarTooltip = _Tooltip["default"];
|
572
|
+
return _ref13 = (0, _core.sstyled)(props.styles), /*#__PURE__*/_react["default"].createElement(SCompactHorizontalBarRadarTooltip, _ref13.cn("SCompactHorizontalBarRadarTooltip", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
573
|
+
"tag": CompactHorizontalBar.Hover,
|
574
|
+
"excludeAnchorProps": true
|
575
|
+
}, _ref4))));
|
576
|
+
};
|
577
|
+
var CompactHorizontalBar = (0, _createElement["default"])(CompactHorizontalBarRoot, {
|
578
|
+
Annotation: Annotation,
|
579
|
+
Label: Label,
|
580
|
+
Percent: Percent,
|
581
|
+
Value: Value,
|
582
|
+
Bar: [Bar, {
|
583
|
+
Fill: BarFill,
|
584
|
+
Background: BarBackground
|
585
|
+
}],
|
586
|
+
Hover: Hover,
|
587
|
+
Tooltip: [CompactHorizontalBarTooltip, _Tooltip["default"]._______childrenComponents]
|
588
|
+
});
|
589
|
+
var _default = CompactHorizontalBar;
|
590
|
+
exports["default"] = _default;
|
591
|
+
//# sourceMappingURL=CompactHorizontalBar.js.map
|