@semcore/d3-chart 2.4.7 → 2.4.8

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 CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [2.4.8] - 2022-11-02
6
+
7
+ ### Fixed
8
+
9
+ - Fixed display of minimum bar size in `StackBar`.
10
+
11
+ ### Added
12
+
13
+ - Added display of minimum bar size in `HorizontalBar`.
14
+
5
15
  ## [2.4.7] - 2022-11-01
6
16
 
7
17
  ### Fixed
package/lib/cjs/Area.js CHANGED
@@ -48,18 +48,18 @@ var style = (
48
48
  /*__reshadow_css_start__*/
49
49
  _core.sstyled.insert(
50
50
  /*__inner_css_start__*/
51
- ".___SArea_5d4tg_gg_{fill:#2bb3ff;fill-opacity:.2}.___SArea_5d4tg_gg_.__color_5d4tg_gg_{fill:var(--color_5d4tg)}.___SAreaLine_5d4tg_gg_{stroke:#2bb3ff;stroke-width:3;fill:transparent}.___SAreaLine_5d4tg_gg_.__color_5d4tg_gg_{stroke:var(--color_5d4tg)}.___SArea_5d4tg_gg_,.___SAreaLine_5d4tg_gg_{transition-property:d;transition-duration:var(--duration_5d4tg);transition-timing-function:ease-in-out}.___SNull_5d4tg_gg_{fill:transparent;stroke:#8a8e9b;stroke-dasharray:4}.___SNull_5d4tg_gg_.__hide_5d4tg_gg_{display:none}"
51
+ ".___SArea_1uicu_gg_{fill:#2bb3ff;fill-opacity:.2}.___SArea_1uicu_gg_.__color_1uicu_gg_{fill:var(--color_1uicu)}.___SAreaLine_1uicu_gg_{stroke:#2bb3ff;stroke-width:3;fill:transparent}.___SAreaLine_1uicu_gg_.__color_1uicu_gg_{stroke:var(--color_1uicu)}.___SArea_1uicu_gg_,.___SAreaLine_1uicu_gg_{transition-property:d;transition-duration:var(--duration_1uicu);transition-timing-function:ease-in-out}.___SNull_1uicu_gg_{fill:transparent;stroke:#8a8e9b;stroke-dasharray:4}.___SNull_1uicu_gg_.__hide_1uicu_gg_{display:none}"
52
52
  /*__inner_css_end__*/
53
- , "5d4tg_gg_")
53
+ , "1uicu_gg_")
54
54
  /*__reshadow_css_end__*/
55
55
  , {
56
- "__SArea": "___SArea_5d4tg_gg_",
57
- "_color": "__color_5d4tg_gg_",
58
- "--color": "--color_5d4tg",
59
- "__SAreaLine": "___SAreaLine_5d4tg_gg_",
60
- "--duration": "--duration_5d4tg",
61
- "__SNull": "___SNull_5d4tg_gg_",
62
- "_hide": "__hide_5d4tg_gg_"
56
+ "__SArea": "___SArea_1uicu_gg_",
57
+ "_color": "__color_1uicu_gg_",
58
+ "--color": "--color_1uicu",
59
+ "__SAreaLine": "___SAreaLine_1uicu_gg_",
60
+ "--duration": "--duration_1uicu",
61
+ "__SNull": "___SNull_1uicu_gg_",
62
+ "_hide": "__hide_1uicu_gg_"
63
63
  });
64
64
 
65
65
  var AreaRoot = /*#__PURE__*/function (_Component) {
package/lib/cjs/Axis.js CHANGED
@@ -44,23 +44,23 @@ var style = (
44
44
  /*__reshadow_css_start__*/
45
45
  _core.sstyled.insert(
46
46
  /*__inner_css_start__*/
47
- ".___SAxis_130py_gg_{stroke:#c4c7cf}.___SAxis_130py_gg_.__hide_130py_gg_{display:none}.___STick_130py_gg_{font-size:12px;fill:#6c6e79}.___STick_130py_gg_.__hide_130py_gg_{display:none}.___SGrid_130py_gg_{fill:transparent;stroke:#e0e1e9}.___STitle_130py_gg_{font-size:12px;fill:#6c6e79;transform-origin:var(--transform-origin_130py)}.___STitle_130py_gg_._position_top_130py_gg_{text-anchor:middle}.___STitle_130py_gg_._position_bottom_130py_gg_{text-anchor:middle;alignment-baseline:hanging}.___STitle_130py_gg_._position_right_130py_gg_{transform:rotate(-90deg);alignment-baseline:middle;text-anchor:middle}.___STitle_130py_gg_._position_left_130py_gg_{transform:rotate(-90deg);text-anchor:middle;alignment-baseline:middle}.___STick_130py_gg_._position_top_130py_gg_{transform:translateY(-12px);text-anchor:middle}.___STick_130py_gg_._position_bottom_130py_gg_{transform:translateY(12px);text-anchor:middle;alignment-baseline:hanging}.___STick_130py_gg_._position_right_130py_gg_{transform:translateX(16px);text-anchor:start;alignment-baseline:middle}.___STick_130py_gg_._position_left_130py_gg_{transform:translateX(-16px);text-anchor:end;alignment-baseline:middle}.___STick_130py_gg_._position_custom_0_130py_gg_{transform:translateY(12px);text-anchor:middle;alignment-baseline:hanging}.___STick_130py_gg_._position_custom_1_130py_gg_{transform:translateX(-16px);text-anchor:end;alignment-baseline:middle}"
47
+ ".___SAxis_15rvl_gg_{stroke:#c4c7cf}.___SAxis_15rvl_gg_.__hide_15rvl_gg_{display:none}.___STick_15rvl_gg_{font-size:12px;fill:#6c6e79}.___STick_15rvl_gg_.__hide_15rvl_gg_{display:none}.___SGrid_15rvl_gg_{fill:transparent;stroke:#e0e1e9}.___STitle_15rvl_gg_{font-size:12px;fill:#6c6e79;transform-origin:var(--transform-origin_15rvl)}.___STitle_15rvl_gg_._position_top_15rvl_gg_{text-anchor:middle}.___STitle_15rvl_gg_._position_bottom_15rvl_gg_{text-anchor:middle;alignment-baseline:hanging}.___STitle_15rvl_gg_._position_right_15rvl_gg_{transform:rotate(-90deg);alignment-baseline:middle;text-anchor:middle}.___STitle_15rvl_gg_._position_left_15rvl_gg_{transform:rotate(-90deg);text-anchor:middle;alignment-baseline:middle}.___STick_15rvl_gg_._position_top_15rvl_gg_{transform:translateY(-12px);text-anchor:middle}.___STick_15rvl_gg_._position_bottom_15rvl_gg_{transform:translateY(12px);text-anchor:middle;alignment-baseline:hanging}.___STick_15rvl_gg_._position_right_15rvl_gg_{transform:translateX(16px);text-anchor:start;alignment-baseline:middle}.___STick_15rvl_gg_._position_left_15rvl_gg_{transform:translateX(-16px);text-anchor:end;alignment-baseline:middle}.___STick_15rvl_gg_._position_custom_0_15rvl_gg_{transform:translateY(12px);text-anchor:middle;alignment-baseline:hanging}.___STick_15rvl_gg_._position_custom_1_15rvl_gg_{transform:translateX(-16px);text-anchor:end;alignment-baseline:middle}"
48
48
  /*__inner_css_end__*/
49
- , "130py_gg_")
49
+ , "15rvl_gg_")
50
50
  /*__reshadow_css_end__*/
51
51
  , {
52
- "__SAxis": "___SAxis_130py_gg_",
53
- "_hide": "__hide_130py_gg_",
54
- "__STick": "___STick_130py_gg_",
55
- "__SGrid": "___SGrid_130py_gg_",
56
- "__STitle": "___STitle_130py_gg_",
57
- "--transform-origin": "--transform-origin_130py",
58
- "_position_top": "_position_top_130py_gg_",
59
- "_position_bottom": "_position_bottom_130py_gg_",
60
- "_position_right": "_position_right_130py_gg_",
61
- "_position_left": "_position_left_130py_gg_",
62
- "_position_custom_0": "_position_custom_0_130py_gg_",
63
- "_position_custom_1": "_position_custom_1_130py_gg_"
52
+ "__SAxis": "___SAxis_15rvl_gg_",
53
+ "_hide": "__hide_15rvl_gg_",
54
+ "__STick": "___STick_15rvl_gg_",
55
+ "__SGrid": "___SGrid_15rvl_gg_",
56
+ "__STitle": "___STitle_15rvl_gg_",
57
+ "--transform-origin": "--transform-origin_15rvl",
58
+ "_position_top": "_position_top_15rvl_gg_",
59
+ "_position_bottom": "_position_bottom_15rvl_gg_",
60
+ "_position_right": "_position_right_15rvl_gg_",
61
+ "_position_left": "_position_left_15rvl_gg_",
62
+ "_position_custom_0": "_position_custom_0_15rvl_gg_",
63
+ "_position_custom_1": "_position_custom_1_15rvl_gg_"
64
64
  });
65
65
  var CUSTOM_0 = Symbol('custom_0');
66
66
  var CUSTOM_1 = Symbol('custom_1');
package/lib/cjs/Bar.js CHANGED
@@ -44,17 +44,17 @@ var style = (
44
44
  /*__reshadow_css_start__*/
45
45
  _core.sstyled.insert(
46
46
  /*__inner_css_start__*/
47
- ".___SBar_10ufx_gg_{fill:#2bb3ff;transition-property:height,width,y;transition-duration:var(--duration_10ufx);transition-timing-function:ease-in-out}.___SBar_10ufx_gg_.__color_10ufx_gg_{fill:var(--color_10ufx)}.___SBar_10ufx_gg_.__hide_10ufx_gg_{display:none}.___SBackground_10ufx_gg_{fill:#c4c7cf}"
47
+ ".___SBar_bbmmd_gg_{fill:#2bb3ff;transition-property:height,width,y;transition-duration:var(--duration_bbmmd);transition-timing-function:ease-in-out}.___SBar_bbmmd_gg_.__color_bbmmd_gg_{fill:var(--color_bbmmd)}.___SBar_bbmmd_gg_.__hide_bbmmd_gg_{display:none}.___SBackground_bbmmd_gg_{fill:#c4c7cf}"
48
48
  /*__inner_css_end__*/
49
- , "10ufx_gg_")
49
+ , "bbmmd_gg_")
50
50
  /*__reshadow_css_end__*/
51
51
  , {
52
- "__SBar": "___SBar_10ufx_gg_",
53
- "--duration": "--duration_10ufx",
54
- "_color": "__color_10ufx_gg_",
55
- "--color": "--color_10ufx",
56
- "_hide": "__hide_10ufx_gg_",
57
- "__SBackground": "___SBackground_10ufx_gg_"
52
+ "__SBar": "___SBar_bbmmd_gg_",
53
+ "--duration": "--duration_bbmmd",
54
+ "_color": "__color_bbmmd_gg_",
55
+ "--color": "--color_bbmmd",
56
+ "_hide": "__hide_bbmmd_gg_",
57
+ "__SBackground": "___SBackground_bbmmd_gg_"
58
58
  });
59
59
 
60
60
  var BarRoot = /*#__PURE__*/function (_Component) {
package/lib/cjs/Bubble.js CHANGED
@@ -56,19 +56,19 @@ var style = (
56
56
  /*__reshadow_css_start__*/
57
57
  _core.sstyled.insert(
58
58
  /*__inner_css_start__*/
59
- ".___SBubble_u3846_gg_{fill:#2bb3ff;stroke:#fff;stroke-width:2px;transition-property:cx,cy;transition-duration:var(--duration_u3846);transition-timing-function:ease-in-out;opacity:.5}.___SBubble_u3846_gg_:hover{opacity:.8}.___SBubble_u3846_gg_.__color_u3846_gg_{fill:var(--color_u3846)}.___SCenter_u3846_gg_{text-anchor:middle;font-size:11px;stroke:#2bb3ff}.___SCenter_u3846_gg_.__color_u3846_gg_{stroke:var(--color_u3846)}.___SLabel_u3846_gg_{fill:#2bb3ff}.___SLabel_u3846_gg_._position_right_u3846_gg_{text-anchor:end}.___SLabel_u3846_gg_._position_left_u3846_gg_{text-anchor:start}.___SLabel_u3846_gg_.__color_u3846_gg_{fill:var(--color_u3846)}"
59
+ ".___SBubble_1un3j_gg_{fill:#2bb3ff;stroke:#fff;stroke-width:2px;transition-property:cx,cy;transition-duration:var(--duration_1un3j);transition-timing-function:ease-in-out;opacity:.5}.___SBubble_1un3j_gg_:hover{opacity:.8}.___SBubble_1un3j_gg_.__color_1un3j_gg_{fill:var(--color_1un3j)}.___SCenter_1un3j_gg_{text-anchor:middle;font-size:11px;stroke:#2bb3ff}.___SCenter_1un3j_gg_.__color_1un3j_gg_{stroke:var(--color_1un3j)}.___SLabel_1un3j_gg_{fill:#2bb3ff}.___SLabel_1un3j_gg_._position_right_1un3j_gg_{text-anchor:end}.___SLabel_1un3j_gg_._position_left_1un3j_gg_{text-anchor:start}.___SLabel_1un3j_gg_.__color_1un3j_gg_{fill:var(--color_1un3j)}"
60
60
  /*__inner_css_end__*/
61
- , "u3846_gg_")
61
+ , "1un3j_gg_")
62
62
  /*__reshadow_css_end__*/
63
63
  , {
64
- "__SBubble": "___SBubble_u3846_gg_",
65
- "--duration": "--duration_u3846",
66
- "_color": "__color_u3846_gg_",
67
- "--color": "--color_u3846",
68
- "__SCenter": "___SCenter_u3846_gg_",
69
- "__SLabel": "___SLabel_u3846_gg_",
70
- "_position_right": "_position_right_u3846_gg_",
71
- "_position_left": "_position_left_u3846_gg_"
64
+ "__SBubble": "___SBubble_1un3j_gg_",
65
+ "--duration": "--duration_1un3j",
66
+ "_color": "__color_1un3j_gg_",
67
+ "--color": "--color_1un3j",
68
+ "__SCenter": "___SCenter_1un3j_gg_",
69
+ "__SLabel": "___SLabel_1un3j_gg_",
70
+ "_position_right": "_position_right_1un3j_gg_",
71
+ "_position_left": "_position_left_1un3j_gg_"
72
72
  });
73
73
 
74
74
  var BubbleRoot = /*#__PURE__*/function (_Component) {
package/lib/cjs/Donut.js CHANGED
@@ -66,16 +66,16 @@ var style = (
66
66
  /*__reshadow_css_start__*/
67
67
  _core.sstyled.insert(
68
68
  /*__inner_css_start__*/
69
- ".___SPie_141mu_gg_{stroke:#fff;fill:#2bb3ff}.___SPie_141mu_gg_.__color_141mu_gg_{fill:var(--color_141mu)}.___SEmptyData_141mu_gg_{fill:#e0e1e9}.___SEmptyData_141mu_gg_.__color_141mu_gg_{fill:var(--color_141mu)}.___SLabel_141mu_gg_{text-anchor:middle;vertical-anchor:middle}"
69
+ ".___SPie_1yoih_gg_{stroke:#fff;fill:#2bb3ff}.___SPie_1yoih_gg_.__color_1yoih_gg_{fill:var(--color_1yoih)}.___SEmptyData_1yoih_gg_{fill:#e0e1e9}.___SEmptyData_1yoih_gg_.__color_1yoih_gg_{fill:var(--color_1yoih)}.___SLabel_1yoih_gg_{text-anchor:middle;vertical-anchor:middle}"
70
70
  /*__inner_css_end__*/
71
- , "141mu_gg_")
71
+ , "1yoih_gg_")
72
72
  /*__reshadow_css_end__*/
73
73
  , {
74
- "__SPie": "___SPie_141mu_gg_",
75
- "_color": "__color_141mu_gg_",
76
- "--color": "--color_141mu",
77
- "__SEmptyData": "___SEmptyData_141mu_gg_",
78
- "__SLabel": "___SLabel_141mu_gg_"
74
+ "__SPie": "___SPie_1yoih_gg_",
75
+ "_color": "__color_1yoih_gg_",
76
+ "--color": "--color_1yoih",
77
+ "__SEmptyData": "___SEmptyData_1yoih_gg_",
78
+ "__SLabel": "___SLabel_1yoih_gg_"
79
79
  });
80
80
  var DEFAULT_INSTANCE = Symbol('DEFAULT_INSTANCE');
81
81
 
package/lib/cjs/Dots.js CHANGED
@@ -32,18 +32,18 @@ var style = (
32
32
  /*__reshadow_css_start__*/
33
33
  _core.sstyled.insert(
34
34
  /*__inner_css_start__*/
35
- ".___SDots_1cixh_gg_ .___SDot_1cixh_gg_{transition-duration:var(--duration_1cixh)}.___SDot_1cixh_gg_{stroke-width:2px;stroke:#fff;r:6px;fill:#2bb3ff;transition-property:cx,cy;transition-timing-function:ease-in-out}.___SDot_1cixh_gg_.__hide_1cixh_gg_{display:none}.___SDot_1cixh_gg_.__active_1cixh_gg_{r:8px}.___SDot_1cixh_gg_.__color_1cixh_gg_{fill:var(--color_1cixh)}"
35
+ ".___SDots_czaw2_gg_ .___SDot_czaw2_gg_{transition-duration:var(--duration_czaw2)}.___SDot_czaw2_gg_{stroke-width:2px;stroke:#fff;r:6px;fill:#2bb3ff;transition-property:cx,cy;transition-timing-function:ease-in-out}.___SDot_czaw2_gg_.__hide_czaw2_gg_{display:none}.___SDot_czaw2_gg_.__active_czaw2_gg_{r:8px}.___SDot_czaw2_gg_.__color_czaw2_gg_{fill:var(--color_czaw2)}"
36
36
  /*__inner_css_end__*/
37
- , "1cixh_gg_")
37
+ , "czaw2_gg_")
38
38
  /*__reshadow_css_end__*/
39
39
  , {
40
- "__SDots": "___SDots_1cixh_gg_",
41
- "__SDot": "___SDot_1cixh_gg_",
42
- "--duration": "--duration_1cixh",
43
- "_hide": "__hide_1cixh_gg_",
44
- "_active": "__active_1cixh_gg_",
45
- "_color": "__color_1cixh_gg_",
46
- "--color": "--color_1cixh"
40
+ "__SDots": "___SDots_czaw2_gg_",
41
+ "__SDot": "___SDot_czaw2_gg_",
42
+ "--duration": "--duration_czaw2",
43
+ "_hide": "__hide_czaw2_gg_",
44
+ "_active": "__active_czaw2_gg_",
45
+ "_color": "__color_czaw2_gg_",
46
+ "--color": "--color_czaw2"
47
47
  });
48
48
  var EXCLUDE_PROPS = ['data', 'scale', 'value', 'display'];
49
49
 
@@ -42,17 +42,17 @@ var style = (
42
42
  /*__reshadow_css_start__*/
43
43
  _core.sstyled.insert(
44
44
  /*__inner_css_start__*/
45
- ".___SBar_10ufx_gg_{fill:#2bb3ff;transition-property:height,width,y;transition-duration:var(--duration_10ufx);transition-timing-function:ease-in-out}.___SBar_10ufx_gg_.__color_10ufx_gg_{fill:var(--color_10ufx)}.___SBar_10ufx_gg_.__hide_10ufx_gg_{display:none}.___SBackground_10ufx_gg_{fill:#c4c7cf}"
45
+ ".___SBar_bbmmd_gg_{fill:#2bb3ff;transition-property:height,width,y;transition-duration:var(--duration_bbmmd);transition-timing-function:ease-in-out}.___SBar_bbmmd_gg_.__color_bbmmd_gg_{fill:var(--color_bbmmd)}.___SBar_bbmmd_gg_.__hide_bbmmd_gg_{display:none}.___SBackground_bbmmd_gg_{fill:#c4c7cf}"
46
46
  /*__inner_css_end__*/
47
- , "10ufx_gg_")
47
+ , "bbmmd_gg_")
48
48
  /*__reshadow_css_end__*/
49
49
  , {
50
- "__SBar": "___SBar_10ufx_gg_",
51
- "--duration": "--duration_10ufx",
52
- "_color": "__color_10ufx_gg_",
53
- "--color": "--color_10ufx",
54
- "_hide": "__hide_10ufx_gg_",
55
- "__SBackground": "___SBackground_10ufx_gg_"
50
+ "__SBar": "___SBar_bbmmd_gg_",
51
+ "--duration": "--duration_bbmmd",
52
+ "_color": "__color_bbmmd_gg_",
53
+ "--color": "--color_bbmmd",
54
+ "_hide": "__hide_bbmmd_gg_",
55
+ "__SBackground": "___SBackground_bbmmd_gg_"
56
56
  });
57
57
 
58
58
  var HorizontalBarRoot = /*#__PURE__*/function (_Component) {
@@ -93,6 +93,7 @@ var HorizontalBarRoot = /*#__PURE__*/function (_Component) {
93
93
  uid = _this$asProps2.uid,
94
94
  duration = _this$asProps2.duration,
95
95
  r = _this$asProps2.r,
96
+ wMin = _this$asProps2.wMin,
96
97
  heightProps = _this$asProps2.height,
97
98
  onMouseMove = _this$asProps2.onMouseMove,
98
99
  onMouseLeave = _this$asProps2.onMouseLeave,
@@ -103,16 +104,16 @@ var HorizontalBarRoot = /*#__PURE__*/function (_Component) {
103
104
  yScale = _scale[1];
104
105
 
105
106
  var barY = yScale(d[y]) + offset[1];
106
- var barX = xScale(Math.min((_d$x = d[x0]) !== null && _d$x !== void 0 ? _d$x : 0, d[x])) + offset[0];
107
+ var barX = xScale(Math.min((_d$x = d[x0]) !== null && _d$x !== void 0 ? _d$x : 0, d[x])) + offset[0] - (Object.is(d[x], -0) ? wMin : 0);
107
108
  var height = heightProps || (0, _utils.getBandwidth)(yScale);
108
- var width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale((_d$x2 = d[x0]) !== null && _d$x2 !== void 0 ? _d$x2 : 0)));
109
+ var width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale((_d$x2 = d[x0]) !== null && _d$x2 !== void 0 ? _d$x2 : 0))) || wMin;
109
110
  var dSvg = getHorizontalRect({
110
111
  x: barX,
111
112
  y: barY,
112
113
  width: width,
113
114
  height: height,
114
115
  radius: Array.isArray(r) ? r[i] : r,
115
- position: d[x] > 0 ? 'right' : 'left'
116
+ position: d[x] > 0 || Object.is(d[x], 0) ? 'right' : 'left'
116
117
  });
117
118
 
118
119
  if (groupKey) {
@@ -173,7 +174,8 @@ var HorizontalBarRoot = /*#__PURE__*/function (_Component) {
173
174
  (0, _defineProperty2["default"])(HorizontalBarRoot, "defaultProps", {
174
175
  offset: [0, 0],
175
176
  duration: 500,
176
- r: 2
177
+ r: 2,
178
+ wMin: 4
177
179
  });
178
180
 
179
181
  function Background(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalBar.js","names":["HorizontalBarRoot","props","index","asProps","data","y","value","d","i","SBar","Element","styles","color","x","x0","scale","hide","offset","uid","duration","r","heightProps","height","onMouseMove","onMouseLeave","groupKey","xScale","yScale","barY","barX","Math","min","getBandwidth","width","abs","max","domain","dSvg","getHorizontalRect","radius","Array","isArray","position","dataHintsHandler","describeGroupedValues","describeValueEntity","sstyled","size","map","renderBar","bind","rect","setAttribute","Component","uniqueIDEnhancement","style","Background","SBackground","xRange","range","bandwidth","roundedPath","createElement"],"sources":["../../src/HorizontalBar.jsx"],"sourcesContent":["import React from 'react';\nimport { Component, sstyled } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport createElement from './createElement';\nimport ClipPath from './ClipPath';\nimport { getBandwidth, roundedPath } from './utils';\n\nimport style from './style/bar.shadow.css';\n\nclass HorizontalBarRoot extends Component {\n static displayName = 'HorizontalBar';\n static enhance = [uniqueIDEnhancement()];\n static style = style;\n\n static defaultProps = {\n offset: [0, 0],\n duration: 500,\n r: 2,\n };\n\n getBackgroundProps(props, index) {\n const { data, y } = this.asProps;\n return {\n value: data[index][y],\n };\n }\n\n renderBar(d, i) {\n const SBar = this.Element;\n const {\n styles,\n color,\n x,\n x0,\n y,\n scale,\n hide,\n offset,\n uid,\n duration,\n r,\n height: heightProps,\n onMouseMove,\n onMouseLeave,\n groupKey,\n } = this.asProps;\n\n const [xScale, yScale] = scale;\n const barY = yScale(d[y]) + offset[1];\n const barX = xScale(Math.min(d[x0] ?? 0, d[x])) + offset[0];\n const height = heightProps || getBandwidth(yScale);\n const width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale(d[x0] ?? 0)));\n const dSvg = getHorizontalRect({\n x: barX,\n y: barY,\n width,\n height,\n radius: Array.isArray(r) ? r[i] : r,\n position: d[x] > 0 ? 'right' : 'left',\n });\n\n if (groupKey) {\n this.asProps.dataHintsHandler.describeGroupedValues(groupKey, x);\n } else {\n this.asProps.dataHintsHandler.describeValueEntity(`${i}.${x}`, groupKey ?? d[y]);\n }\n\n return sstyled(styles)(\n <SBar\n aria-hidden\n key={`horizontal-bar-${i}`}\n render=\"path\"\n clipPath={`url(#${uid})`}\n __excludeProps={['data', 'scale', 'value']}\n childrenPosition=\"above\"\n value={d}\n index={i}\n hide={hide}\n color={color}\n x={barX}\n y={barY}\n width={width}\n height={height}\n d={dSvg}\n use:duration={`${duration}ms`}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n />,\n );\n }\n\n render() {\n const { data, uid, size, duration } = this.asProps;\n\n return (\n <>\n {data.map(this.renderBar.bind(this))}\n {duration && (\n <ClipPath\n aria-hidden\n setAttributeTag={(rect) => {\n rect.setAttribute('width', size[0]);\n }}\n id={uid}\n x=\"0\"\n y=\"0\"\n width={0}\n height={size[1]}\n transition={`width ${duration}ms ease-in-out`}\n />\n )}\n </>\n );\n }\n}\n\nfunction Background(props) {\n const { Element: SBackground, styles, scale, value } = props;\n const [xScale, yScale] = scale;\n const xRange = xScale.range();\n\n return sstyled(styles)(\n <SBackground\n aria-hidden\n render=\"rect\"\n childrenPosition=\"above\"\n width={xRange[1] - xRange[0]}\n height={yScale.bandwidth()}\n x={xRange[0]}\n y={yScale(value)}\n />,\n );\n}\n\nfunction getHorizontalRect({ x, y, width, height, radius, position }) {\n if (width <= radius) return '';\n if (radius) {\n if (position === 'right')\n return roundedPath(x, y, width, height, radius, false, true, false, true);\n return roundedPath(x, y, width, height, radius, true, false, true, false);\n }\n return roundedPath(x, y, width, height, radius);\n}\n\nexport default createElement(HorizontalBarRoot, { Background });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAIMA,iB;;;;;;;;;;;;WAWJ,4BAAmBC,KAAnB,EAA0BC,KAA1B,EAAiC;MAC/B,oBAAoB,KAAKC,OAAzB;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcC,CAAd,iBAAcA,CAAd;MACA,OAAO;QACLC,KAAK,EAAEF,IAAI,CAACF,KAAD,CAAJ,CAAYG,CAAZ;MADF,CAAP;IAGD;;;WAED,mBAAUE,CAAV,EAAaC,CAAb,EAAgB;MAAA;;MACd,IAAMC,IAAI,GAAG,KAAKC,OAAlB;MACA,qBAgBI,KAAKP,OAhBT;MAAA,IACEQ,MADF,kBACEA,MADF;MAAA,IAEEC,KAFF,kBAEEA,KAFF;MAAA,IAGEC,CAHF,kBAGEA,CAHF;MAAA,IAIEC,EAJF,kBAIEA,EAJF;MAAA,IAKET,CALF,kBAKEA,CALF;MAAA,IAMEU,KANF,kBAMEA,KANF;MAAA,IAOEC,IAPF,kBAOEA,IAPF;MAAA,IAQEC,MARF,kBAQEA,MARF;MAAA,IASEC,GAT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,CAAsC;EAAA,IAAnC4B,KAAmC,SAAnCA,KAAmC;EAAA,IAA5BX,MAA4B,SAA5BA,MAA4B;EAAA,IAApBiB,MAAoB,SAApBA,MAAoB;EAAA,IAAZG,QAAY,SAAZA,QAAY;EACpE,IAAIT,KAAK,IAAIM,MAAb,EAAqB,OAAO,EAAP;;EACrB,IAAIA,MAAJ,EAAY;IACV,IAAIG,QAAQ,KAAK,OAAjB,EACE,OAAO,IAAAmB,kBAAA,EAAYhD,CAAZ,EAAeR,CAAf,EAAkB4B,KAAlB,EAAyBX,MAAzB,EAAiCiB,MAAjC,EAAyC,KAAzC,EAAgD,IAAhD,EAAsD,KAAtD,EAA6D,IAA7D,CAAP;IACF,OAAO,IAAAsB,kBAAA,EAAYhD,CAAZ,EAAeR,CAAf,EAAkB4B,KAAlB,EAAyBX,MAAzB,EAAiCiB,MAAjC,EAAyC,IAAzC,EAA+C,KAA/C,EAAsD,IAAtD,EAA4D,KAA5D,CAAP;EACD;;EACD,OAAO,IAAAsB,kBAAA,EAAYhD,CAAZ,EAAeR,CAAf,EAAkB4B,KAAlB,EAAyBX,MAAzB,EAAiCiB,MAAjC,CAAP;AACD;;eAEc,IAAAuB,yBAAA,EAAc9D,iBAAd,EAAiC;EAAEwD,UAAU,EAAVA;AAAF,CAAjC,C"}
1
+ {"version":3,"file":"HorizontalBar.js","names":["HorizontalBarRoot","props","index","asProps","data","y","value","d","i","SBar","Element","styles","color","x","x0","scale","hide","offset","uid","duration","r","wMin","heightProps","height","onMouseMove","onMouseLeave","groupKey","xScale","yScale","barY","barX","Math","min","Object","is","getBandwidth","width","abs","max","domain","dSvg","getHorizontalRect","radius","Array","isArray","position","dataHintsHandler","describeGroupedValues","describeValueEntity","sstyled","size","map","renderBar","bind","rect","setAttribute","Component","uniqueIDEnhancement","style","Background","SBackground","xRange","range","bandwidth","roundedPath","createElement"],"sources":["../../src/HorizontalBar.jsx"],"sourcesContent":["import React from 'react';\nimport { Component, sstyled } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport createElement from './createElement';\nimport ClipPath from './ClipPath';\nimport { getBandwidth, roundedPath } from './utils';\n\nimport style from './style/bar.shadow.css';\n\nclass HorizontalBarRoot extends Component {\n static displayName = 'HorizontalBar';\n static enhance = [uniqueIDEnhancement()];\n static style = style;\n\n static defaultProps = {\n offset: [0, 0],\n duration: 500,\n r: 2,\n wMin: 4,\n };\n\n getBackgroundProps(props, index) {\n const { data, y } = this.asProps;\n return {\n value: data[index][y],\n };\n }\n\n renderBar(d, i) {\n const SBar = this.Element;\n const {\n styles,\n color,\n x,\n x0,\n y,\n scale,\n hide,\n offset,\n uid,\n duration,\n r,\n wMin,\n height: heightProps,\n onMouseMove,\n onMouseLeave,\n groupKey,\n } = this.asProps;\n\n const [xScale, yScale] = scale;\n const barY = yScale(d[y]) + offset[1];\n const barX = xScale(Math.min(d[x0] ?? 0, d[x])) + offset[0] - (Object.is(d[x], -0) ? wMin : 0);\n const height = heightProps || getBandwidth(yScale);\n const width =\n Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale(d[x0] ?? 0))) || wMin;\n const dSvg = getHorizontalRect({\n x: barX,\n y: barY,\n width,\n height,\n radius: Array.isArray(r) ? r[i] : r,\n position: d[x] > 0 || Object.is(d[x], 0) ? 'right' : 'left',\n });\n\n if (groupKey) {\n this.asProps.dataHintsHandler.describeGroupedValues(groupKey, x);\n } else {\n this.asProps.dataHintsHandler.describeValueEntity(`${i}.${x}`, groupKey ?? d[y]);\n }\n\n return sstyled(styles)(\n <SBar\n aria-hidden\n key={`horizontal-bar-${i}`}\n render=\"path\"\n clipPath={`url(#${uid})`}\n __excludeProps={['data', 'scale', 'value']}\n childrenPosition=\"above\"\n value={d}\n index={i}\n hide={hide}\n color={color}\n x={barX}\n y={barY}\n width={width}\n height={height}\n d={dSvg}\n use:duration={`${duration}ms`}\n onMouseMove={onMouseMove}\n onMouseLeave={onMouseLeave}\n />,\n );\n }\n\n render() {\n const { data, uid, size, duration } = this.asProps;\n\n return (\n <>\n {data.map(this.renderBar.bind(this))}\n {duration && (\n <ClipPath\n aria-hidden\n setAttributeTag={(rect) => {\n rect.setAttribute('width', size[0]);\n }}\n id={uid}\n x=\"0\"\n y=\"0\"\n width={0}\n height={size[1]}\n transition={`width ${duration}ms ease-in-out`}\n />\n )}\n </>\n );\n }\n}\n\nfunction Background(props) {\n const { Element: SBackground, styles, scale, value } = props;\n const [xScale, yScale] = scale;\n const xRange = xScale.range();\n\n return sstyled(styles)(\n <SBackground\n aria-hidden\n render=\"rect\"\n childrenPosition=\"above\"\n width={xRange[1] - xRange[0]}\n height={yScale.bandwidth()}\n x={xRange[0]}\n y={yScale(value)}\n />,\n );\n}\n\nfunction getHorizontalRect({ x, y, width, height, radius, position }) {\n if (width <= radius) return '';\n if (radius) {\n if (position === 'right')\n return roundedPath(x, y, width, height, radius, false, true, false, true);\n return roundedPath(x, y, width, height, radius, true, false, true, false);\n }\n return roundedPath(x, y, width, height, radius);\n}\n\nexport default createElement(HorizontalBarRoot, { Background });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAIMA,iB;;;;;;;;;;;;WAYJ,4BAAmBC,KAAnB,EAA0BC,KAA1B,EAAiC;MAC/B,oBAAoB,KAAKC,OAAzB;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcC,CAAd,iBAAcA,CAAd;MACA,OAAO;QACLC,KAAK,EAAEF,IAAI,CAACF,KAAD,CAAJ,CAAYG,CAAZ;MADF,CAAP;IAGD;;;WAED,mBAAUE,CAAV,EAAaC,CAAb,EAAgB;MAAA;;MACd,IAAMC,IAAI,GAAG,KAAKC,OAAlB;MACA,qBAiBI,KAAKP,OAjBT;MAAA,IACEQ,MADF,kBACEA,MADF;MAAA,IAEEC,KAFF,kBAEEA,KAFF;MAAA,IAGEC,CAHF,kBAGEA,CAHF;M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AU,EAAVA;AAAF,CAAjC,C"}
package/lib/cjs/Hover.js CHANGED
@@ -44,13 +44,13 @@ var style = (
44
44
  /*__reshadow_css_start__*/
45
45
  _core.sstyled.insert(
46
46
  /*__inner_css_start__*/
47
- ".___SHoverLine_1tplg_gg_{stroke:#a9abb6}.___SHoverRect_1tplg_gg_{fill:rgba(196,199,207,.3)}"
47
+ ".___SHoverLine_dlgw6_gg_{stroke:#a9abb6}.___SHoverRect_dlgw6_gg_{fill:rgba(196,199,207,.3)}"
48
48
  /*__inner_css_end__*/
49
- , "1tplg_gg_")
49
+ , "dlgw6_gg_")
50
50
  /*__reshadow_css_end__*/
51
51
  , {
52
- "__SHoverLine": "___SHoverLine_1tplg_gg_",
53
- "__SHoverRect": "___SHoverRect_1tplg_gg_"
52
+ "__SHoverLine": "___SHoverLine_dlgw6_gg_",
53
+ "__SHoverRect": "___SHoverRect_dlgw6_gg_"
54
54
  });
55
55
 
56
56
  var Hover = /*#__PURE__*/function (_Component) {
package/lib/cjs/Line.js CHANGED
@@ -46,17 +46,17 @@ var style = (
46
46
  /*__reshadow_css_start__*/
47
47
  _core.sstyled.insert(
48
48
  /*__inner_css_start__*/
49
- ".___SLine_5w2vj_gg_{fill:transparent;stroke-width:3;stroke:#2bb3ff;transition-property:d;transition-duration:var(--duration_5w2vj);transition-timing-function:ease-in-out}.___SLine_5w2vj_gg_.__color_5w2vj_gg_{stroke:var(--color_5w2vj)}.___SLine_5w2vj_gg_.__hide_5w2vj_gg_{display:none}.___SNull_5w2vj_gg_{fill:transparent;stroke:#c4c7cf;stroke-dasharray:4}.___SNull_5w2vj_gg_.__hide_5w2vj_gg_{display:none}"
49
+ ".___SLine_r2txj_gg_{fill:transparent;stroke-width:3;stroke:#2bb3ff;transition-property:d;transition-duration:var(--duration_r2txj);transition-timing-function:ease-in-out}.___SLine_r2txj_gg_.__color_r2txj_gg_{stroke:var(--color_r2txj)}.___SLine_r2txj_gg_.__hide_r2txj_gg_{display:none}.___SNull_r2txj_gg_{fill:transparent;stroke:#c4c7cf;stroke-dasharray:4}.___SNull_r2txj_gg_.__hide_r2txj_gg_{display:none}"
50
50
  /*__inner_css_end__*/
51
- , "5w2vj_gg_")
51
+ , "r2txj_gg_")
52
52
  /*__reshadow_css_end__*/
53
53
  , {
54
- "__SLine": "___SLine_5w2vj_gg_",
55
- "--duration": "--duration_5w2vj",
56
- "_color": "__color_5w2vj_gg_",
57
- "--color": "--color_5w2vj",
58
- "_hide": "__hide_5w2vj_gg_",
59
- "__SNull": "___SNull_5w2vj_gg_"
54
+ "__SLine": "___SLine_r2txj_gg_",
55
+ "--duration": "--duration_r2txj",
56
+ "_color": "__color_r2txj_gg_",
57
+ "--color": "--color_r2txj",
58
+ "_hide": "__hide_r2txj_gg_",
59
+ "__SNull": "___SNull_r2txj_gg_"
60
60
  });
61
61
 
62
62
  var LineRoot = /*#__PURE__*/function (_Component) {
package/lib/cjs/Plot.js CHANGED
@@ -58,13 +58,13 @@ var style = (
58
58
  /*__reshadow_css_start__*/
59
59
  _core.sstyled.insert(
60
60
  /*__inner_css_start__*/
61
- ".___SPlot_lq6m7_gg_{overflow:hidden}.___SPlot_lq6m7_gg_:active,.___SPlot_lq6m7_gg_:focus{outline:0;text-decoration:none}foreignObject[data-aria-only]{pointer-events:none}.___SPlot_lq6m7_gg_.__keyboardFocused_lq6m7_gg_{border:1px solid #008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}"
61
+ ".___SPlot_1ps46_gg_{overflow:hidden}.___SPlot_1ps46_gg_:active,.___SPlot_1ps46_gg_:focus{outline:0;text-decoration:none}foreignObject[data-aria-only]{pointer-events:none}.___SPlot_1ps46_gg_.__keyboardFocused_1ps46_gg_{border:1px solid #008ff8;box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}"
62
62
  /*__inner_css_end__*/
63
- , "lq6m7_gg_")
63
+ , "1ps46_gg_")
64
64
  /*__reshadow_css_end__*/
65
65
  , {
66
- "__SPlot": "___SPlot_lq6m7_gg_",
67
- "_keyboardFocused": "__keyboardFocused_lq6m7_gg_"
66
+ "__SPlot": "___SPlot_1ps46_gg_",
67
+ "_keyboardFocused": "__keyboardFocused_1ps46_gg_"
68
68
  });
69
69
 
70
70
  var PlotRoot = /*#__PURE__*/function (_Component) {
@@ -60,20 +60,20 @@ var style = (
60
60
  /*__reshadow_css_start__*/
61
61
  _core.sstyled.insert(
62
62
  /*__inner_css_start__*/
63
- ".___SRadian_snqov_gg_{cursor:pointer;fill:#008ff8}.___SLine_snqov_gg_{stroke:#008ff8}.___SLine_snqov_gg_.__color_snqov_gg_{stroke:var(--color_snqov)}.___SCap_snqov_gg_{transition:r .1s}.___SLabel_snqov_gg_{fill:var(--color_snqov);cursor:var(--text-cursor_snqov)}.___SRadian_snqov_gg_:hover .___SLabel_snqov_gg_{fill:var(--color-hovered_snqov)}@media (prefers-reduced-motion){.___SLineCap_snqov_gg_{transition:none}}"
63
+ ".___SRadian_g6fwx_gg_{cursor:pointer;fill:#008ff8}.___SLine_g6fwx_gg_{stroke:#008ff8}.___SLine_g6fwx_gg_.__color_g6fwx_gg_{stroke:var(--color_g6fwx)}.___SCap_g6fwx_gg_{transition:r .1s}.___SLabel_g6fwx_gg_{fill:var(--color_g6fwx);cursor:var(--text-cursor_g6fwx)}.___SRadian_g6fwx_gg_:hover .___SLabel_g6fwx_gg_{fill:var(--color-hovered_g6fwx)}@media (prefers-reduced-motion){.___SLineCap_g6fwx_gg_{transition:none}}"
64
64
  /*__inner_css_end__*/
65
- , "snqov_gg_")
65
+ , "g6fwx_gg_")
66
66
  /*__reshadow_css_end__*/
67
67
  , {
68
- "__SRadian": "___SRadian_snqov_gg_",
69
- "__SLine": "___SLine_snqov_gg_",
70
- "_color": "__color_snqov_gg_",
71
- "--color": "--color_snqov",
72
- "__SCap": "___SCap_snqov_gg_",
73
- "__SLabel": "___SLabel_snqov_gg_",
74
- "--text-cursor": "--text-cursor_snqov",
75
- "--color-hovered": "--color-hovered_snqov",
76
- "__SLineCap": "___SLineCap_snqov_gg_"
68
+ "__SRadian": "___SRadian_g6fwx_gg_",
69
+ "__SLine": "___SLine_g6fwx_gg_",
70
+ "_color": "__color_g6fwx_gg_",
71
+ "--color": "--color_g6fwx",
72
+ "__SCap": "___SCap_g6fwx_gg_",
73
+ "__SLabel": "___SLabel_g6fwx_gg_",
74
+ "--text-cursor": "--text-cursor_g6fwx",
75
+ "--color-hovered": "--color-hovered_g6fwx",
76
+ "__SLineCap": "___SLineCap_g6fwx_gg_"
77
77
  });
78
78
  var baseAngle = -Math.PI / 2; // The top vertical line
79
79
 
@@ -42,19 +42,19 @@ var style = (
42
42
  /*__reshadow_css_start__*/
43
43
  _core.sstyled.insert(
44
44
  /*__inner_css_start__*/
45
- ".___SReferenceLine_1co9s_gg_{fill:none;stroke:#a9abb6}.___STitle_1co9s_gg_{font-size:12px;fill:#6c6e79;transform-origin:var(--transform-origin_1co9s)}.___STitle_1co9s_gg_._position_top_1co9s_gg_{text-anchor:middle}.___STitle_1co9s_gg_._position_bottom_1co9s_gg_{text-anchor:middle;alignment-baseline:hanging}.___STitle_1co9s_gg_._position_right_1co9s_gg_{transform:rotate(-90deg);alignment-baseline:middle;text-anchor:middle}.___STitle_1co9s_gg_._position_left_1co9s_gg_{transform:rotate(-90deg);text-anchor:middle;alignment-baseline:middle}.___SBackground_1co9s_gg_{fill:rgba(196,199,207,.2)}"
45
+ ".___SReferenceLine_1g3zy_gg_{fill:none;stroke:#a9abb6}.___STitle_1g3zy_gg_{font-size:12px;fill:#6c6e79;transform-origin:var(--transform-origin_1g3zy)}.___STitle_1g3zy_gg_._position_top_1g3zy_gg_{text-anchor:middle}.___STitle_1g3zy_gg_._position_bottom_1g3zy_gg_{text-anchor:middle;alignment-baseline:hanging}.___STitle_1g3zy_gg_._position_right_1g3zy_gg_{transform:rotate(-90deg);alignment-baseline:middle;text-anchor:middle}.___STitle_1g3zy_gg_._position_left_1g3zy_gg_{transform:rotate(-90deg);text-anchor:middle;alignment-baseline:middle}.___SBackground_1g3zy_gg_{fill:rgba(196,199,207,.2)}"
46
46
  /*__inner_css_end__*/
47
- , "1co9s_gg_")
47
+ , "1g3zy_gg_")
48
48
  /*__reshadow_css_end__*/
49
49
  , {
50
- "__SReferenceLine": "___SReferenceLine_1co9s_gg_",
51
- "__STitle": "___STitle_1co9s_gg_",
52
- "--transform-origin": "--transform-origin_1co9s",
53
- "_position_top": "_position_top_1co9s_gg_",
54
- "_position_bottom": "_position_bottom_1co9s_gg_",
55
- "_position_right": "_position_right_1co9s_gg_",
56
- "_position_left": "_position_left_1co9s_gg_",
57
- "__SBackground": "___SBackground_1co9s_gg_"
50
+ "__SReferenceLine": "___SReferenceLine_1g3zy_gg_",
51
+ "__STitle": "___STitle_1g3zy_gg_",
52
+ "--transform-origin": "--transform-origin_1g3zy",
53
+ "_position_top": "_position_top_1g3zy_gg_",
54
+ "_position_bottom": "_position_bottom_1g3zy_gg_",
55
+ "_position_right": "_position_right_1g3zy_gg_",
56
+ "_position_left": "_position_left_1g3zy_gg_",
57
+ "__SBackground": "___SBackground_1g3zy_gg_"
58
58
  });
59
59
  var side2direction = {
60
60
  left: 'vertical',
@@ -52,16 +52,16 @@ var style = (
52
52
  /*__reshadow_css_start__*/
53
53
  _core.sstyled.insert(
54
54
  /*__inner_css_start__*/
55
- ".___SScatterPlot_1mawy_gg_{fill:#2bb3ff;transition-property:cx,cy;transition-duration:var(--duration_1mawy);transition-timing-function:ease-in-out;opacity:.5}.___SScatterPlot_1mawy_gg_:hover{opacity:.8}.___SScatterPlot_1mawy_gg_.__color_1mawy_gg_{fill:var(--color_1mawy)}.___SValue_1mawy_gg_{text-anchor:middle;font-size:10px;stroke:#008ff8}.___SValue_1mawy_gg_.__color_1mawy_gg_{stroke:var(--color_1mawy)}"
55
+ ".___SScatterPlot_171zj_gg_{fill:#2bb3ff;transition-property:cx,cy;transition-duration:var(--duration_171zj);transition-timing-function:ease-in-out;opacity:.5}.___SScatterPlot_171zj_gg_:hover{opacity:.8}.___SScatterPlot_171zj_gg_.__color_171zj_gg_{fill:var(--color_171zj)}.___SValue_171zj_gg_{text-anchor:middle;font-size:10px;stroke:#008ff8}.___SValue_171zj_gg_.__color_171zj_gg_{stroke:var(--color_171zj)}"
56
56
  /*__inner_css_end__*/
57
- , "1mawy_gg_")
57
+ , "171zj_gg_")
58
58
  /*__reshadow_css_end__*/
59
59
  , {
60
- "__SScatterPlot": "___SScatterPlot_1mawy_gg_",
61
- "--duration": "--duration_1mawy",
62
- "_color": "__color_1mawy_gg_",
63
- "--color": "--color_1mawy",
64
- "__SValue": "___SValue_1mawy_gg_"
60
+ "__SScatterPlot": "___SScatterPlot_171zj_gg_",
61
+ "--duration": "--duration_171zj",
62
+ "_color": "__color_171zj_gg_",
63
+ "--color": "--color_171zj",
64
+ "__SValue": "___SValue_171zj_gg_"
65
65
  });
66
66
 
67
67
  var ScatterPlotRoot = /*#__PURE__*/function (_Component) {
@@ -105,6 +105,7 @@ var StackBarRoot = /*#__PURE__*/function (_Component) {
105
105
 
106
106
  return _objectSpread(_objectSpread({}, s.data), {}, (_objectSpread2 = {}, (0, _defineProperty2["default"])(_objectSpread2, y, s[1]), (0, _defineProperty2["default"])(_objectSpread2, XY0, s[0]), _objectSpread2));
107
107
  }),
108
+ hMin: 0,
108
109
  y0: XY0,
109
110
  x: x,
110
111
  r: rBar,
@@ -135,6 +136,7 @@ var StackBarRoot = /*#__PURE__*/function (_Component) {
135
136
 
136
137
  return _objectSpread(_objectSpread({}, s.data), {}, (_objectSpread3 = {}, (0, _defineProperty2["default"])(_objectSpread3, x, s[1]), (0, _defineProperty2["default"])(_objectSpread3, XY0, s[0]), _objectSpread3));
137
138
  }),
139
+ wMin: 0,
138
140
  x0: XY0,
139
141
  y: y,
140
142
  r: rBar,
@@ -1 +1 @@
1
- {"version":3,"file":"StackBar.js","names":["DEFAULT_INSTANCE","Symbol","XY0","StackBarRoot","asProps","Children","data","stack","keys","React","toArray","getOriginChildren","reduce","acc","child","isValidElement","type","StackBar","Bar","props","hide","push","y","HorizontalBar","x","r","seriesIndex","series","findIndex","s","key","rBar","map","i","slice","some","bar","y0","groupKey","x0","Element","getSeries","dataHintsHandler","establishDataType","Component","d3Stack","createElement"],"sources":["../../src/StackBar.jsx"],"sourcesContent":["import React from 'react';\nimport { stack as d3Stack } from 'd3-shape';\nimport { Component } from '@semcore/core';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport createElement from './createElement';\nimport Bar from './Bar';\nimport HorizontalBar from './HorizontalBar';\n\nconst DEFAULT_INSTANCE = Symbol('DEFAULT_INSTANCE');\nconst XY0 = Symbol('XY0');\n\nclass StackBarRoot extends Component {\n static displayName = 'StackBar';\n\n static defaultProps = () => {\n const stack = d3Stack();\n stack[DEFAULT_INSTANCE] = true;\n return { stack, r: 2 };\n };\n\n getSeries() {\n const { Children, data, stack } = this.asProps;\n\n if (stack[DEFAULT_INSTANCE]) {\n const keys = React.Children.toArray(getOriginChildren(Children)).reduce((acc, child) => {\n if (React.isValidElement(child) && child.type === StackBar.Bar && !child.props.hide) {\n acc.push(child.props.y);\n }\n if (\n React.isValidElement(child) &&\n child.type === StackBar.HorizontalBar &&\n !child.props.hide\n ) {\n acc.push(child.props.x);\n }\n return acc;\n }, []);\n stack.keys(keys);\n }\n\n return stack(data);\n }\n\n getBarProps({ y }) {\n const { x, r } = this.asProps;\n\n const seriesIndex = this.series.findIndex((s) => s.key === y);\n // or [] if hide bar\n const series = this.series[seriesIndex] || [];\n\n const rBar = series.map((s, i) =>\n this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,\n );\n\n return {\n data: series.map((s) => ({\n ...s.data,\n [y]: s[1],\n [XY0]: s[0],\n })),\n y0: XY0,\n x,\n r: rBar,\n groupKey: x,\n };\n }\n\n getHorizontalBarProps({ x }) {\n const { y, r } = this.asProps;\n\n const seriesIndex = this.series.findIndex((s) => s.key === x);\n const series = this.series[seriesIndex];\n\n const rBar = series.map((s, i) =>\n this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,\n );\n\n return {\n data: series.map((s) => ({\n ...s.data,\n [x]: s[1],\n [XY0]: s[0],\n })),\n x0: XY0,\n y,\n r: rBar,\n groupKey: y,\n };\n }\n\n render() {\n const Element = this.Element;\n this.series = this.getSeries();\n\n this.asProps.dataHintsHandler.establishDataType('grouped-values');\n\n return <Element aria-hidden render=\"g\" series={this.series} />;\n }\n}\n\nconst StackBar = createElement(StackBarRoot, {\n Bar,\n HorizontalBar,\n});\n\nexport default StackBar;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,gBAAgB,GAAGC,MAAM,CAAC,kBAAD,CAA/B;AACA,IAAMC,GAAG,GAAGD,MAAM,CAAC,KAAD,CAAlB;;IAEME,Y;;;;;;;;;;;;WASJ,qBAAY;MACV,oBAAkC,KAAKC,OAAvC;MAAA,IAAQC,QAAR,iBAAQA,QAAR;MAAA,IAAkBC,IAAlB,iBAAkBA,IAAlB;MAAA,IAAwBC,KAAxB,iBAAwBA,KAAxB;;MAEA,IAAIA,KAAK,CAACP,gBAAD,CAAT,EAA6B;QAC3B,IAAMQ,IAAI,GAAGC,iBAAA,CAAMJ,QAAN,CAAeK,OAAf,CAAuB,IAAAC,6BAAA,EAAkBN,QAAlB,CAAvB,EAAoDO,MAApD,CAA2D,UAACC,GAAD,EAAMC,KAAN,EAAgB;UACtF,IAAI,cAAAL,iBAAA,CAAMM,cAAN,CAAqBD,KAArB,KAA+BA,KAAK,CAACE,IAAN,KAAeC,QAAQ,CAACC,GAAvD,IAA8D,CAACJ,KAAK,CAACK,KAAN,CAAYC,IAA/E,EAAqF;YACnFP,GAAG,CAACQ,IAAJ,CAASP,KAAK,CAACK,KAAN,CAAYG,CAArB;UACD;;UACD,IACE,cAAAb,iBAAA,CAAMM,cAAN,CAAqBD,KAArB,KACAA,KAAK,CAACE,I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EA,KAAKrC,OAAL,CAAasC,gBAAb,CAA8BC,iBAA9B,CAAgD,gBAAhD;MAEA,oBAAO,gCAAC,OAAD;QAAS,mBAAT;QAAqB,MAAM,EAAC,GAA5B;QAAgC,MAAM,EAAE,KAAKhB;MAA7C,EAAP;IACD;;;EAtFwBiB,e;;iCAArBzC,Y,iBACiB,U;iCADjBA,Y,kBAGkB,YAAM;EAC1B,IAAMI,KAAK,GAAG,IAAAsC,cAAA,GAAd;EACAtC,KAAK,CAACP,gBAAD,CAAL,GAA0B,IAA1B;EACA,OAAO;IAAEO,KAAK,EAALA,KAAF;IAASkB,CAAC,EAAE;EAAZ,CAAP;AACD,C;AAkFH,IAAMR,QAAQ,GAAG,IAAA6B,yBAAA,EAAc3C,YAAd,EAA4B;EAC3Ce,GAAG,EAAHA,eAD2C;EAE3CK,aAAa,EAAbA;AAF2C,CAA5B,CAAjB;eAKeN,Q"}
1
+ {"version":3,"file":"StackBar.js","names":["DEFAULT_INSTANCE","Symbol","XY0","StackBarRoot","asProps","Children","data","stack","keys","React","toArray","getOriginChildren","reduce","acc","child","isValidElement","type","StackBar","Bar","props","hide","push","y","HorizontalBar","x","r","seriesIndex","series","findIndex","s","key","rBar","map","i","slice","some","bar","hMin","y0","groupKey","wMin","x0","Element","getSeries","dataHintsHandler","establishDataType","Component","d3Stack","createElement"],"sources":["../../src/StackBar.jsx"],"sourcesContent":["import React from 'react';\nimport { stack as d3Stack } from 'd3-shape';\nimport { Component } from '@semcore/core';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport createElement from './createElement';\nimport Bar from './Bar';\nimport HorizontalBar from './HorizontalBar';\n\nconst DEFAULT_INSTANCE = Symbol('DEFAULT_INSTANCE');\nconst XY0 = Symbol('XY0');\n\nclass StackBarRoot extends Component {\n static displayName = 'StackBar';\n\n static defaultProps = () => {\n const stack = d3Stack();\n stack[DEFAULT_INSTANCE] = true;\n return { stack, r: 2 };\n };\n\n getSeries() {\n const { Children, data, stack } = this.asProps;\n\n if (stack[DEFAULT_INSTANCE]) {\n const keys = React.Children.toArray(getOriginChildren(Children)).reduce((acc, child) => {\n if (React.isValidElement(child) && child.type === StackBar.Bar && !child.props.hide) {\n acc.push(child.props.y);\n }\n if (\n React.isValidElement(child) &&\n child.type === StackBar.HorizontalBar &&\n !child.props.hide\n ) {\n acc.push(child.props.x);\n }\n return acc;\n }, []);\n stack.keys(keys);\n }\n\n return stack(data);\n }\n\n getBarProps({ y }) {\n const { x, r } = this.asProps;\n\n const seriesIndex = this.series.findIndex((s) => s.key === y);\n // or [] if hide bar\n const series = this.series[seriesIndex] || [];\n\n const rBar = series.map((s, i) =>\n this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,\n );\n\n return {\n data: series.map((s) => ({\n ...s.data,\n [y]: s[1],\n [XY0]: s[0],\n })),\n hMin: 0,\n y0: XY0,\n x,\n r: rBar,\n groupKey: x,\n };\n }\n\n getHorizontalBarProps({ x }) {\n const { y, r } = this.asProps;\n\n const seriesIndex = this.series.findIndex((s) => s.key === x);\n const series = this.series[seriesIndex];\n\n const rBar = series.map((s, i) =>\n this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,\n );\n\n return {\n data: series.map((s) => ({\n ...s.data,\n [x]: s[1],\n [XY0]: s[0],\n })),\n wMin: 0,\n x0: XY0,\n y,\n r: rBar,\n groupKey: y,\n };\n }\n\n render() {\n const Element = this.Element;\n this.series = this.getSeries();\n\n this.asProps.dataHintsHandler.establishDataType('grouped-values');\n\n return <Element aria-hidden render=\"g\" series={this.series} />;\n }\n}\n\nconst StackBar = createElement(StackBarRoot, {\n Bar,\n HorizontalBar,\n});\n\nexport default StackBar;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,gBAAgB,GAAGC,MAAM,CAAC,kBAAD,CAA/B;AACA,IAAMC,GAAG,G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Ac7C,YAAd,EAA4B;EAC3Ce,GAAG,EAAHA,eAD2C;EAE3CK,aAAa,EAAbA;AAF2C,CAA5B,CAAjB;eAKeN,Q"}
@@ -60,17 +60,17 @@ var style = (
60
60
  /*__reshadow_css_start__*/
61
61
  _core.sstyled.insert(
62
62
  /*__inner_css_start__*/
63
- ".___STooltip_rfk5a_gg_{font-size:12px;line-height:1.33;position:relative;background-color:#fff;border-radius:6px;border:1px solid #e0e1e9;box-sizing:border-box;box-shadow:0px 1px 12px 0px rgba(25, 27, 35, 0.15);padding:12px}.___STitle_rfk5a_gg_{color:#6c6e79;margin-bottom:8px}.___SDotGroup_rfk5a_gg_{display:flex;align-items:center}.___SDot_rfk5a_gg_{width:8px;height:8px;border-radius:50%;margin-right:8px;background:#2bb3ff}.___SDot_rfk5a_gg_.__color_rfk5a_gg_{background:var(--color_rfk5a)}"
63
+ ".___STooltip_n7bly_gg_{font-size:12px;line-height:1.33;position:relative;background-color:#fff;border-radius:6px;border:1px solid #e0e1e9;box-sizing:border-box;box-shadow:0px 1px 12px 0px rgba(25, 27, 35, 0.15);padding:12px}.___STitle_n7bly_gg_{color:#6c6e79;margin-bottom:8px}.___SDotGroup_n7bly_gg_{display:flex;align-items:center}.___SDot_n7bly_gg_{width:8px;height:8px;border-radius:50%;margin-right:8px;background:#2bb3ff}.___SDot_n7bly_gg_.__color_n7bly_gg_{background:var(--color_n7bly)}"
64
64
  /*__inner_css_end__*/
65
- , "rfk5a_gg_")
65
+ , "n7bly_gg_")
66
66
  /*__reshadow_css_end__*/
67
67
  , {
68
- "__STooltip": "___STooltip_rfk5a_gg_",
69
- "__STitle": "___STitle_rfk5a_gg_",
70
- "__SDotGroup": "___SDotGroup_rfk5a_gg_",
71
- "__SDot": "___SDot_rfk5a_gg_",
72
- "_color": "__color_rfk5a_gg_",
73
- "--color": "--color_rfk5a"
68
+ "__STooltip": "___STooltip_n7bly_gg_",
69
+ "__STitle": "___STitle_n7bly_gg_",
70
+ "__SDotGroup": "___SDotGroup_n7bly_gg_",
71
+ "__SDot": "___SDot_n7bly_gg_",
72
+ "_color": "__color_n7bly_gg_",
73
+ "--color": "--color_n7bly"
74
74
  });
75
75
 
76
76
  var TooltipRoot = /*#__PURE__*/function (_Component) {
package/lib/cjs/Venn.js CHANGED
@@ -48,16 +48,16 @@ var style = (
48
48
  /*__reshadow_css_start__*/
49
49
  _core.sstyled.insert(
50
50
  /*__inner_css_start__*/
51
- ".___SCircle_y54uo_gg_{fill:#59ddaa;stroke:#fff;stroke-width:2px;fill-opacity:.5;transition-property:cx,cy;transition-duration:var(--duration_y54uo);transition-timing-function:ease-in-out}.___SCircle_y54uo_gg_:hover{fill-opacity:.7}.___SCircle_y54uo_gg_.__color_y54uo_gg_{fill:var(--color_y54uo)}.___SIntersection_y54uo_gg_{stroke:#fff;stroke-width:2px;fill-opacity:0}.___SIntersection_y54uo_gg_:hover{fill-opacity:.1}"
51
+ ".___SCircle_16on8_gg_{fill:#59ddaa;stroke:#fff;stroke-width:2px;fill-opacity:.5;transition-property:cx,cy;transition-duration:var(--duration_16on8);transition-timing-function:ease-in-out}.___SCircle_16on8_gg_:hover{fill-opacity:.7}.___SCircle_16on8_gg_.__color_16on8_gg_{fill:var(--color_16on8)}.___SIntersection_16on8_gg_{stroke:#fff;stroke-width:2px;fill-opacity:0}.___SIntersection_16on8_gg_:hover{fill-opacity:.1}"
52
52
  /*__inner_css_end__*/
53
- , "y54uo_gg_")
53
+ , "16on8_gg_")
54
54
  /*__reshadow_css_end__*/
55
55
  , {
56
- "__SCircle": "___SCircle_y54uo_gg_",
57
- "--duration": "--duration_y54uo",
58
- "_color": "__color_y54uo_gg_",
59
- "--color": "--color_y54uo",
60
- "__SIntersection": "___SIntersection_y54uo_gg_"
56
+ "__SCircle": "___SCircle_16on8_gg_",
57
+ "--duration": "--duration_16on8",
58
+ "_color": "__color_16on8_gg_",
59
+ "--color": "--color_16on8",
60
+ "__SIntersection": "___SIntersection_16on8_gg_"
61
61
  });
62
62
 
63
63
  var VennRoot = /*#__PURE__*/function (_Component) {