@redsift/charts 7.0.2 → 7.1.1-alpha.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.
Files changed (4) hide show
  1. package/index.d.ts +126 -17
  2. package/index.js +734 -201
  3. package/index.js.map +1 -1
  4. package/package.json +7 -8
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { scaleOrdinal, pie, arc, sum } from 'd3';
1
+ import { scaleOrdinal, select, axisBottom, scaleLinear, sum, pie, arc } from 'd3';
2
2
  import React, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useLayoutEffect, useId } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import ReactDOM from 'react-dom';
@@ -10,21 +10,76 @@ const ColorTheme = {
10
10
  monochrome: 'monochrome'
11
11
  };
12
12
 
13
- const monochrome = '#B6DAEE';
13
+ /**
14
+ * Do not edit directly
15
+ * Generated on Wed, 14 Dec 2022 17:05:36 GMT
16
+ */
17
+ const RedsiftDataVizColorPurpleDefault = '#C1AAEA';
18
+ const RedsiftDataVizColorPurpleDark = '#A78ADB';
19
+ const RedsiftDataVizColorPurpleDarker = '#8D6CC9';
20
+ const RedsiftDataVizColorPurpleLight = '#D9CAF5';
21
+ const RedsiftDataVizColorPurpleLighter = '#F0E9FC';
22
+ const RedsiftDataVizColorBlueDefault = '#B6DAEE';
23
+ const RedsiftDataVizColorBlueDark = '#97C5DE';
24
+ const RedsiftDataVizColorBlueDarker = '#73ADCC';
25
+ const RedsiftDataVizColorBlueLight = '#D8EDF8';
26
+ const RedsiftDataVizColorBlueLighter = '#F6FBFE';
27
+ const RedsiftDataVizColorGreenDefault = '#B3E3C5';
28
+ const RedsiftDataVizColorGreenDark = '#90D2A9';
29
+ const RedsiftDataVizColorGreenDarker = '#6DBE8B';
30
+ const RedsiftDataVizColorGreenLight = '#D3F0DE';
31
+ const RedsiftDataVizColorGreenLighter = '#EDFAF1';
32
+ const RedsiftDataVizColorRedDefault = '#EAADAC';
33
+ const RedsiftDataVizColorRedDark = '#D18785';
34
+ const RedsiftDataVizColorRedDarker = '#BA6361';
35
+ const RedsiftDataVizColorRedLight = '#FFD3D2';
36
+ const RedsiftDataVizColorRedLighter = '#FFE5E5';
37
+ const RedsiftDataVizColorPinkDefault = '#E2A7D7';
38
+ const RedsiftDataVizColorPinkDark = '#D185C3';
39
+ const RedsiftDataVizColorPinkDarker = '#BD63AC';
40
+ const RedsiftDataVizColorPinkLight = '#EFC8E8';
41
+ const RedsiftDataVizColorPinkLighter = '#F9E6F6';
42
+ const RedsiftDataVizColorCyanDefault = '#AFF5F3';
43
+ const RedsiftDataVizColorCyanDark = '#8CEAE6';
44
+ const RedsiftDataVizColorCyanDarker = '#6CDCD8';
45
+ const RedsiftDataVizColorCyanLight = '#D4FCFA';
46
+ const RedsiftDataVizColorCyanLighter = '#E1FFFF';
47
+ const RedsiftDataVizColorOrangeDefault = '#F2D39E';
48
+ const RedsiftDataVizColorOrangeDark = '#D8B475';
49
+ const RedsiftDataVizColorOrangeDarker = '#BD954F';
50
+ const RedsiftDataVizColorOrangeLight = '#FFE8C0';
51
+ const RedsiftDataVizColorOrangeLighter = '#FFF0D7';
52
+ const RedsiftDataVizColorYellowDefault = '#F6EFC7';
53
+ const RedsiftDataVizColorYellowDark = '#DED4A0';
54
+ const RedsiftDataVizColorYellowDarker = '#C6BB7A';
55
+ const RedsiftDataVizColorYellowLight = '#FFFBE1';
56
+ const RedsiftDataVizColorYellowLighter = '#FFFDF0';
57
+ const RedsiftDataVizColorBrownDefault = '#E6C2A0';
58
+ const RedsiftDataVizColorBrownDark = '#CDA279';
59
+ const RedsiftDataVizColorBrownDarker = '#B58556';
60
+ const RedsiftDataVizColorBrownLight = '#FFE3C9';
61
+ const RedsiftDataVizColorBrownLighter = '#FFEEDE';
62
+ const RedsiftDataVizColorGreyDefault = '#E5E5E5';
63
+ const RedsiftDataVizColorGreyDark = '#BDBDBD';
64
+ const RedsiftDataVizColorGreyDarker = '#666666';
65
+ const RedsiftDataVizColorGreyLight = '#F5F5F5';
66
+ const RedsiftDataVizColorGreyLighter = '#FFFFFF';
67
+
68
+ const monochrome = RedsiftDataVizColorBlueDefault;
14
69
  const scheme = {
15
- default: ['#C1AAEA', '#B6DAEE', '#B3E3C5', '#EAADAC', '#E2A7D7', '#AFF5F3', '#F2D39E', '#F6EFC7', '#E6C2A0', '#E5E5E5'],
16
- dark: ['#A78ADB', '#97C5DE', '#90D2A9', '#D18785', '#D185C3', '#8CEAE6', '#D8B475', '#DED4A0', '#CDA279', '#BDBDBD'],
17
- darker: ['#8D6CC9', '#73ADCC', '#6DBE8B', '#BA6361', '#BD63AC', '#6CDCD8', '#BD954F', '#C6BB7A', '#B58556', '#666666'],
18
- light: ['#D9CAF5', '#D8EDF8', '#D3F0DE', '#FFD3D2', '#EFC8E8', '#D4FCFA', '#FFE8C0', '#FFFBE1', '#FFE3C9', '#F5F5F5'],
19
- lighter: ['#F0E9FC', '#F6FBFE', '#EDFAF1', '#FFE5E5', '#F9E6F6', '#E1FFFF', '#FFF0D7', '#FFFDF0', '#FFEEDE', '#FFFFFF'],
70
+ default: [RedsiftDataVizColorPurpleDefault, RedsiftDataVizColorBlueDefault, RedsiftDataVizColorGreenDefault, RedsiftDataVizColorRedDefault, RedsiftDataVizColorPinkDefault, RedsiftDataVizColorCyanDefault, RedsiftDataVizColorOrangeDefault, RedsiftDataVizColorYellowDefault, RedsiftDataVizColorBrownDefault, RedsiftDataVizColorGreyDefault],
71
+ dark: [RedsiftDataVizColorPurpleDark, RedsiftDataVizColorBlueDark, RedsiftDataVizColorGreenDark, RedsiftDataVizColorRedDark, RedsiftDataVizColorPinkDark, RedsiftDataVizColorCyanDark, RedsiftDataVizColorOrangeDark, RedsiftDataVizColorYellowDark, RedsiftDataVizColorBrownDark, RedsiftDataVizColorGreyDark],
72
+ darker: [RedsiftDataVizColorPurpleDarker, RedsiftDataVizColorBlueDarker, RedsiftDataVizColorGreenDarker, RedsiftDataVizColorRedDarker, RedsiftDataVizColorPinkDarker, RedsiftDataVizColorCyanDarker, RedsiftDataVizColorOrangeDarker, RedsiftDataVizColorYellowDarker, RedsiftDataVizColorBrownDarker, RedsiftDataVizColorGreyDarker],
73
+ light: [RedsiftDataVizColorPurpleLight, RedsiftDataVizColorBlueLight, RedsiftDataVizColorGreenLight, RedsiftDataVizColorRedLight, RedsiftDataVizColorPinkLight, RedsiftDataVizColorCyanLight, RedsiftDataVizColorOrangeLight, RedsiftDataVizColorYellowLight, RedsiftDataVizColorBrownLight, RedsiftDataVizColorGreyLight],
74
+ lighter: [RedsiftDataVizColorPurpleLighter, RedsiftDataVizColorBlueLighter, RedsiftDataVizColorGreenLighter, RedsiftDataVizColorRedLighter, RedsiftDataVizColorPinkLighter, RedsiftDataVizColorCyanLighter, RedsiftDataVizColorOrangeLighter, RedsiftDataVizColorYellowLighter, RedsiftDataVizColorBrownLighter, RedsiftDataVizColorGreyLighter],
20
75
  monochrome: [monochrome],
21
- empty: ['#BDBDBD']
76
+ empty: [RedsiftDataVizColorGreyDark]
22
77
  };
23
78
  const successDangerScheme = {
24
- success: '#90D2A9',
25
- warning: '#D8B475',
26
- danger: '#D18785',
27
- neutral: '#BDBDBD'
79
+ success: RedsiftDataVizColorGreenDark,
80
+ warning: RedsiftDataVizColorOrangeDark,
81
+ danger: RedsiftDataVizColorRedDark,
82
+ neutral: RedsiftDataVizColorGreyDark
28
83
  };
29
84
  const getColorScale = (theme, isEmpty) => {
30
85
  let d3colors = scaleOrdinal(scheme.default);
@@ -60,6 +115,7 @@ function _objectSpread2(target) {
60
115
  return target;
61
116
  }
62
117
  function _defineProperty(obj, key, value) {
118
+ key = _toPropertyKey(key);
63
119
  if (key in obj) {
64
120
  Object.defineProperty(obj, key, {
65
121
  value: value,
@@ -113,42 +169,37 @@ function _objectWithoutProperties(source, excluded) {
113
169
  }
114
170
  return target;
115
171
  }
172
+ function _toPrimitive(input, hint) {
173
+ if (typeof input !== "object" || input === null) return input;
174
+ var prim = input[Symbol.toPrimitive];
175
+ if (prim !== undefined) {
176
+ var res = prim.call(input, hint || "default");
177
+ if (typeof res !== "object") return res;
178
+ throw new TypeError("@@toPrimitive must return a primitive value.");
179
+ }
180
+ return (hint === "string" ? String : Number)(input);
181
+ }
182
+ function _toPropertyKey(arg) {
183
+ var key = _toPrimitive(arg, "string");
184
+ return typeof key === "symbol" ? key : String(key);
185
+ }
116
186
 
117
187
  /**
118
188
  * Component size.
119
189
  */
120
- const PieChartSize = {
190
+ const HorizontalBarChartSize = {
121
191
  small: 'small',
122
192
  medium: 'medium',
123
193
  large: 'large'
124
194
  };
125
- /**
126
- * Component variant.
127
- */
128
- const PieChartVariant = {
129
- plain: 'plain',
130
- spaced: 'spaced',
131
- donut: 'donut',
132
- spacedDonut: 'spacedDonut'
133
- };
134
- /**
135
- * Component's labels variant.
136
- */
137
- const PieChartLabelVariant = {
138
- none: 'none',
139
- internal: 'internal',
140
- externalLabel: 'externalLabel',
141
- externalLabelValue: 'externalLabelValue',
142
- externalLabelPercent: 'externalLabelPercent'
143
- };
144
195
  /**
145
196
  * Component theme.
146
197
  */
147
- const PieChartTheme = ColorTheme;
198
+ const HorizontalBarChartTheme = ColorTheme;
148
199
  /**
149
200
  * Tooltip label variant.
150
201
  */
151
- const PieChartTooltipVariant = {
202
+ const HorizontalBarChartTooltipVariant = {
152
203
  none: 'none',
153
204
  label: 'label',
154
205
  value: 'value',
@@ -158,12 +209,12 @@ const PieChartTooltipVariant = {
158
209
  /**
159
210
  * Component style.
160
211
  */
161
- const StyledPieChart = styled.div`
212
+ const StyledHorizontalBarChart = styled.div`
162
213
  margin: 8px;
163
214
  padding: 8px;
164
215
  color: var(--redsift-color-neutral-black);
165
216
 
166
- .redsift-piechart__container {
217
+ .redsift-horizontal-barchart__container {
167
218
  display: flex;
168
219
  align-items: center;
169
220
  gap: 16px;
@@ -172,27 +223,32 @@ const StyledPieChart = styled.div`
172
223
  justify-content: center;
173
224
  margin: 8px 0;
174
225
 
175
- .redsift-piechart-container__chart {
226
+ .redsift-horizontal-barchart-container__chart {
176
227
  position: relative;
177
228
  }
178
229
  }
230
+
179
231
  svg {
180
232
  display: block;
233
+
234
+ g {
235
+ margin: 8px;
236
+ }
181
237
  }
182
238
  `;
183
- const StyledPieChartTitle = styled.div`
239
+ const StyledHorizontalBarChartTitle = styled.div`
184
240
  font-family: var(--redsift-typography-h4-font-family);
185
241
  font-size: var(--redsift-typography-h4-font-size);
186
242
  font-weight: var(--redsift-typography-h4-font-weight);
187
243
  line-height: var(--redsift-typography-h4-line-height);
188
244
  `;
189
- const StyledPieChartCaption = styled.p`
245
+ const StyledHorizontalBarChartCaption = styled.p`
190
246
  font-family: var(--redsift-typography-caption-font-family);
191
247
  font-size: var(--redsift-typography-caption-font-size);
192
248
  font-weight: var(--redsift-typography-caption-font-weight);
193
249
  line-height: var(--redsift-typography-caption-line-height);
194
250
  `;
195
- const StyledPieChartCenterText = styled.div`
251
+ const StyledHorizontalBarChartEmptyText = styled.div`
196
252
  position: absolute;
197
253
  top: 0;
198
254
  left: 0;
@@ -213,10 +269,9 @@ const StyledPieChartCenterText = styled.div`
213
269
  }}px;
214
270
  }
215
271
 
216
- > b {
217
- font-family: var(--redsift-typography-font-family-source-code-pro);
272
+ > span {
273
+ font-family: var(--redsift-typography-font-family-raleway);
218
274
  color: var(--redsift-color-neutral-black);
219
- font-weight: var(--redsift-typography-font-weight-medium);
220
275
  font-size: ${_ref2 => {
221
276
  let {
222
277
  $textSize
@@ -229,160 +284,39 @@ const StyledPieChartCenterText = styled.div`
229
284
  } = _ref3;
230
285
  return $textSize;
231
286
  }}px;
232
-
233
- &:nth-child(2) {
234
- font-weight: normal;
235
- margin-top: 8px;
236
- font-family: var(--redsift-typography-font-family-raleway);
237
- font-size: ${_ref4 => {
238
- let {
239
- $smallTextSize
240
- } = _ref4;
241
- return $smallTextSize;
242
- }}px;
243
- line-height: ${_ref5 => {
244
- let {
245
- $smallTextSize
246
- } = _ref5;
247
- return $smallTextSize;
248
- }}px;
249
- }
250
- }
251
- > span {
252
- color: var(--redsift-color-neutral-black);
253
- font-size: ${_ref6 => {
254
- let {
255
- $textSize
256
- } = _ref6;
257
- return $textSize;
258
- }}px;
259
- line-height: ${_ref7 => {
260
- let {
261
- $textSize
262
- } = _ref7;
263
- return $textSize;
264
- }}px;
265
- &:nth-child(3) {
266
- margin-top: 4px;
267
- font-size: ${_ref8 => {
268
- let {
269
- $smallTextSize
270
- } = _ref8;
271
- return $smallTextSize;
272
- }}px;
273
- line-height: ${_ref9 => {
274
- let {
275
- $smallTextSize
276
- } = _ref9;
277
- return $smallTextSize;
278
- }}px;
279
- }
280
- }
281
- > b + span {
282
- font-size: var(--redsift-typography-body-font-size);
283
- font-family: var(--redsift-typography-font-family-raleway);
284
- line-height: var(--redsift-typography-badge-line-height);
285
- color: rgba(0, 0, 0, 0.6);
286
- text-align: center;
287
- }
288
- `;
289
- const StyledPieChartEmptyText = styled.div`
290
- position: absolute;
291
- top: 0;
292
- left: 0;
293
- height: 100%;
294
- width: 100%;
295
- display: flex;
296
- flex-direction: column;
297
- justify-content: center;
298
- align-items: center;
299
- pointer-events: none;
300
-
301
- > * {
302
- max-width: ${_ref10 => {
303
- let {
304
- $maxWidth
305
- } = _ref10;
306
- return $maxWidth;
307
- }}px;
308
- }
309
-
310
- > span {
311
- font-family: var(--redsift-typography-font-family-raleway);
312
- color: ${_ref11 => {
313
- let {
314
- $isDonut
315
- } = _ref11;
316
- return $isDonut ? css`var(--redsift-color-neutral-midgrey)` : css`var(--redsift-color-neutral-black)`;
317
- }};
318
- font-size: ${_ref12 => {
319
- let {
320
- $textSize
321
- } = _ref12;
322
- return $textSize;
323
- }}px;
324
- line-height: ${_ref13 => {
325
- let {
326
- $textSize
327
- } = _ref13;
328
- return $textSize;
329
- }}px;
330
287
  }
331
288
  `;
332
- const StyledPieChartLabel = styled.li`
333
- display: flex;
334
- align-items: center;
335
- gap: 8px;
336
- width: 100%;
337
- max-width: 262px;
338
- font-family: var(--redsift-typography-font-family-raleway);
339
- font-weight: var(--redsift-typography-font-weight-regular);
340
- font-size: var(--redsift-typography-caption-font-size);
341
-
342
- > div {
343
- height: 16px;
344
- width: 16px;
345
- min-width: 16px;
346
- background-color: ${_ref14 => {
347
- let {
348
- $color
349
- } = _ref14;
350
- return $color;
351
- }};
352
- }
353
-
354
- > b {
355
- font-family: var(--redsift-typography-font-family-source-code-pro);
356
- font-weight: var(--redsift-typography-font-weight-bold);
357
- font-size: var(--redsift-typography-caption-font-size);
289
+ const StyledHorizontalBarChartBar = styled.g`
290
+ rect {
291
+ fill-opacity: 0.9;
358
292
  }
359
- `;
360
- const StyledPieChartArc = styled.g`
361
- ${_ref15 => {
362
- let {
363
- $spaced
364
- } = _ref15;
365
- return $spaced ? css`
366
- path {
367
- stroke-width: 2px;
368
- stroke: #fff;
369
- }
370
- ` : '';
371
- }}
372
293
 
373
- ${_ref16 => {
294
+ ${_ref4 => {
374
295
  let {
375
296
  $clickable
376
- } = _ref16;
297
+ } = _ref4;
377
298
  return $clickable ? css`
378
299
  cursor: pointer;
379
- &:hover {
380
- opacity: 0.8;
300
+
301
+ &:hover,
302
+ &:focus {
303
+ outline: none;
304
+ rect {
305
+ fill-opacity: 0.7;
306
+ }
307
+ }
308
+
309
+ &:focus-visible {
310
+ rect {
311
+ stroke: var(--redsift-color-default-primary);
312
+ stroke-width: 4px;
313
+ paint-order: stroke;
314
+ }
381
315
  }
382
316
  ` : '';
383
317
  }}}
384
318
  `;
385
- const Tooltip = styled.div`
319
+ const StyledHorizontalBarChartTooltip = styled.div`
386
320
  font-family: var(--redsift-typography-font-family-raleway);
387
321
  border: 1px solid rgb(0 0 0 / 20%);
388
322
  padding: 10px;
@@ -390,6 +324,18 @@ const Tooltip = styled.div`
390
324
  0 1px 3px 0 rgb(0 0 0 / 12%);
391
325
  background-color: var(--redsift-color-neutral-white);
392
326
  `;
327
+ const StyledHorizontalBarChartAxisBottom = styled.g`
328
+ line.grid-line {
329
+ fill: none;
330
+ stroke: #ccc;
331
+ shape-rendering: crispEdges;
332
+ }
333
+
334
+ text {
335
+ font-family: var(--redsift-typography-font-family-source-code-pro);
336
+ font-size: 10px;
337
+ }
338
+ `;
393
339
 
394
340
  function _extends() {
395
341
  _extends = Object.assign || function (target) {
@@ -1015,36 +961,620 @@ var Popup = /*#__PURE__*/forwardRef(function (_ref, ref) {
1015
961
  return React.createElement(React.Fragment, null, renderTrigger(), isOpen && ReactDOM.createPortal(content, getRootPopup()));
1016
962
  });
1017
963
 
1018
- const _excluded$1 = ["color", "data", "index", "onClick", "path", "spaced", "showTooltip", "tooltipPercent", "tooltipLabelOnly", "isEmpty"];
1019
- const COMPONENT_NAME$1 = 'RedSiftPieChartArc';
1020
- const CLASSNAME$1 = 'redsift-piechart-arc';
1021
- const DEFAULT_PROPS$1 = {};
1022
- const PieChartArc = /*#__PURE__*/forwardRef((props, ref) => {
964
+ const _excluded$4 = ["chartId", "color", "data", "gap", "height", "index", "isEmpty", "onClick", "role", "showTooltip", "tooltipLabelOnly", "tooltipPercent", "width"];
965
+ const COMPONENT_NAME$4 = 'RedSiftHorizontalBarChartBar';
966
+ const CLASSNAME$4 = 'redsift-horizontal-barchart-bar';
967
+ const DEFAULT_PROPS$4 = {};
968
+ const HorizontalBarChartBar = /*#__PURE__*/forwardRef((props, ref) => {
1023
969
  const {
970
+ chartId,
1024
971
  color,
1025
972
  data,
973
+ gap,
974
+ height,
1026
975
  index,
976
+ isEmpty,
1027
977
  onClick,
1028
- path,
1029
- spaced,
978
+ role,
1030
979
  showTooltip,
1031
- tooltipPercent,
1032
980
  tooltipLabelOnly,
1033
- isEmpty
981
+ tooltipPercent,
982
+ width
1034
983
  } = props,
1035
- forwardedProps = _objectWithoutProperties(props, _excluded$1);
984
+ forwardedProps = _objectWithoutProperties(props, _excluded$4);
985
+ const onKeyDown = event => {
986
+ if (onClick) {
987
+ event.stopPropagation();
988
+ if (event.code === 'Enter' || event.code === 'Space') {
989
+ event.preventDefault();
990
+ onClick();
991
+ }
992
+ }
993
+ };
994
+ const Bar = /*#__PURE__*/React.createElement(StyledHorizontalBarChartBar, _extends$1({
995
+ ref: ref
996
+ }, forwardedProps, {
997
+ "aria-label": showTooltip && !isEmpty ? `${data.name}: ${data.value}` : undefined,
998
+ "aria-labelledby": !showTooltip && !isEmpty ? `id${chartId}__slice-${index}-title` : undefined,
999
+ id: `id${chartId}__slice-${index}`,
1000
+ className: `row _${index}`,
1001
+ onClick: onClick,
1002
+ onKeyDown: onKeyDown,
1003
+ role: role ? role : onClick ? 'button' : undefined,
1004
+ tabIndex: onClick ? 0 : undefined,
1005
+ transform: `translate(0,${gap * (index + 1) + height * index})`,
1006
+ $clickable: Boolean(onClick)
1007
+ }), /*#__PURE__*/React.createElement("rect", {
1008
+ height: height,
1009
+ width: width,
1010
+ fill: color
1011
+ }), /*#__PURE__*/React.createElement("text", {
1012
+ x: "10",
1013
+ y: height / 2,
1014
+ dy: "0.35em",
1015
+ "aria-hidden": true
1016
+ }, data.name), !showTooltip && !isEmpty && /*#__PURE__*/React.createElement("title", null, `${data.name}: ${data.value}`));
1017
+ if (showTooltip) {
1018
+ const tooltipValue = tooltipPercent !== null ? `${tooltipPercent}%` : data.value;
1019
+ return /*#__PURE__*/React.createElement(Popup, {
1020
+ on: "hover",
1021
+ arrow: false,
1022
+ position: "right center",
1023
+ trigger: Bar
1024
+ }, /*#__PURE__*/React.createElement(StyledHorizontalBarChartTooltip, null, `${data.name}${tooltipLabelOnly ? '' : ` - ${tooltipValue}`}`));
1025
+ }
1026
+ return Bar;
1027
+ });
1028
+ HorizontalBarChartBar.className = CLASSNAME$4;
1029
+ HorizontalBarChartBar.defaultProps = DEFAULT_PROPS$4;
1030
+ HorizontalBarChartBar.displayName = COMPONENT_NAME$4;
1031
+
1032
+ const _excluded$3 = ["areXLabelsRotated", "chartHeight", "d3scale"];
1033
+ const COMPONENT_NAME$3 = 'RedSiftHorizontalBarChartAxisBottom';
1034
+ const CLASSNAME$3 = 'redsift-horizontal-barchart-axis-bottom';
1035
+ const DEFAULT_PROPS$3 = {};
1036
+ const HorizontalBarChartAxisBottom = /*#__PURE__*/forwardRef((props, ref) => {
1037
+ const {
1038
+ areXLabelsRotated,
1039
+ chartHeight,
1040
+ d3scale
1041
+ } = props,
1042
+ forwardedProps = _objectWithoutProperties(props, _excluded$3);
1043
+ const axisRef = ref || useRef();
1044
+ useEffect(() => {
1045
+ if (axisRef.current) {
1046
+ select(axisRef.current).call(axisBottom(d3scale).ticks(5));
1047
+ select(axisRef.current).selectAll('g.tick').select('line.grid-line').remove();
1048
+ select(axisRef.current).selectAll('g.tick').append('line').attr('class', 'grid-line').attr('x1', 0).attr('y1', 0).attr('x2', 0).attr('y2', () => -chartHeight);
1049
+ if (areXLabelsRotated) {
1050
+ select(axisRef.current).attr('text-anchor', 'end').selectAll('text').attr('transform', 'translate(-6,5) rotate(-45)');
1051
+ }
1052
+ }
1053
+ }, [d3scale]);
1054
+ return /*#__PURE__*/React.createElement(StyledHorizontalBarChartAxisBottom, _extends$1({
1055
+ className: "axis"
1056
+ }, forwardedProps, {
1057
+ ref: axisRef
1058
+ }));
1059
+ });
1060
+ HorizontalBarChartAxisBottom.className = CLASSNAME$3;
1061
+ HorizontalBarChartAxisBottom.defaultProps = DEFAULT_PROPS$3;
1062
+ HorizontalBarChartAxisBottom.displayName = COMPONENT_NAME$3;
1063
+
1064
+ const _excluded$2 = ["aria-label", "aria-labelledby", "areXLabelsRotated", "caping", "caption", "className", "data", "onBarClick", "others", "size", "barRole", "theme", "title", "tooltipVariant", "localeText"];
1065
+ const COMPONENT_NAME$2 = 'RedSiftHorizontalBarChart';
1066
+ const CLASSNAME$2 = 'redsift-horizontal-barchart';
1067
+ const DEFAULT_PROPS$2 = {
1068
+ others: true,
1069
+ size: HorizontalBarChartSize.medium,
1070
+ theme: HorizontalBarChartTheme.default,
1071
+ tooltipVariant: HorizontalBarChartTooltipVariant.value,
1072
+ localeText: {
1073
+ emptyChartText: 'No Data'
1074
+ }
1075
+ };
1076
+ const sizeToDimension$1 = size => {
1077
+ switch (size) {
1078
+ case HorizontalBarChartSize.small:
1079
+ return {
1080
+ width: 300,
1081
+ height: 200
1082
+ };
1083
+ case HorizontalBarChartSize.large:
1084
+ return {
1085
+ width: 500,
1086
+ height: 400
1087
+ };
1088
+ case HorizontalBarChartSize.medium:
1089
+ default:
1090
+ return {
1091
+ width: 400,
1092
+ height: 300
1093
+ };
1094
+ }
1095
+ };
1096
+ const sizeToFontSize$1 = size => {
1097
+ switch (size) {
1098
+ case HorizontalBarChartSize.small:
1099
+ return 30;
1100
+ case HorizontalBarChartSize.large:
1101
+ return 38;
1102
+ case HorizontalBarChartSize.medium:
1103
+ default:
1104
+ return 34;
1105
+ }
1106
+ };
1107
+ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
1108
+ const id = useId();
1109
+ const {
1110
+ 'aria-label': ariaLabel,
1111
+ 'aria-labelledby': ariaLabelledby,
1112
+ areXLabelsRotated,
1113
+ caping,
1114
+ caption,
1115
+ className,
1116
+ data: propData,
1117
+ onBarClick,
1118
+ others,
1119
+ size,
1120
+ barRole,
1121
+ theme,
1122
+ title,
1123
+ tooltipVariant,
1124
+ localeText
1125
+ } = props,
1126
+ forwardedProps = _objectWithoutProperties(props, _excluded$2);
1127
+ const {
1128
+ emptyChartText
1129
+ } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$2.localeText), localeText);
1130
+ const isEmpty = propData.every(d => d.value === 0);
1131
+ let data = propData.sort((a, b) => a.value < b.value ? 1 : -1);
1132
+ if (caping) {
1133
+ if (typeof others === 'boolean' && !others) {
1134
+ data = data.slice(0, caping);
1135
+ } else {
1136
+ data = data.reduce((acc, curr, index) => {
1137
+ if (index < caping) {
1138
+ acc[index] = curr;
1139
+ } else if (index === caping) {
1140
+ acc[index] = {
1141
+ name: typeof others === 'string' ? others : 'Others',
1142
+ value: curr.value
1143
+ };
1144
+ } else {
1145
+ acc[caping] = _objectSpread2(_objectSpread2({}, acc[caping]), {}, {
1146
+ value: acc[caping].value + curr.value
1147
+ });
1148
+ }
1149
+ return acc;
1150
+ }, []);
1151
+ }
1152
+ }
1153
+ if (isEmpty) {
1154
+ data = [];
1155
+ }
1156
+
1157
+ // Get charts dimensions based on the selected size.
1158
+ const chartDimensions = sizeToDimension$1(size);
1159
+ const width = chartDimensions.width - 16;
1160
+ const height = chartDimensions.height;
1161
+ const chartHeight = height - 48 - (areXLabelsRotated ? 30 : 0);
1162
+ const margins = {
1163
+ top: 16,
1164
+ left: 16,
1165
+ right: 16,
1166
+ bottom: 32
1167
+ };
1168
+ const numberOfRows = data.length;
1169
+ const gap = 5;
1170
+
1171
+ // Set color scheme.
1172
+ const d3colors = getColorScale(theme, isEmpty);
1173
+
1174
+ // Initialize the chart.
1175
+ const scaleX = scaleLinear().domain([0, Math.max(...data.map(_ref => {
1176
+ let {
1177
+ value
1178
+ } = _ref;
1179
+ return value;
1180
+ }))]).range([0, width - 32]);
1181
+ const barHeight = (chartHeight - (numberOfRows + 1) * gap) / numberOfRows;
1182
+ const total = sum(data, d => d.value);
1183
+ return /*#__PURE__*/React.createElement(StyledHorizontalBarChart, _extends$1({
1184
+ ref: ref
1185
+ }, forwardedProps, {
1186
+ className: className
1187
+ }), title ? /*#__PURE__*/React.createElement(StyledHorizontalBarChartTitle, {
1188
+ className: `${HorizontalBarChart.className}__title`,
1189
+ id: `id${id}__title`
1190
+ }, title) : null, /*#__PURE__*/React.createElement("div", {
1191
+ className: `${HorizontalBarChart.className}__container`
1192
+ }, /*#__PURE__*/React.createElement("div", {
1193
+ className: `${HorizontalBarChart.className}-container__chart`,
1194
+ "aria-label": ariaLabel ? ariaLabel : ariaLabelledby || title ? undefined : 'Horizontal Bar Chart',
1195
+ "aria-labelledby": ariaLabelledby ? ariaLabelledby : title ? `id${id}__title` : undefined
1196
+ }, isEmpty ? /*#__PURE__*/React.createElement(StyledHorizontalBarChartEmptyText, {
1197
+ $maxWidth: width,
1198
+ $textSize: sizeToFontSize$1(size) / 2
1199
+ }, /*#__PURE__*/React.createElement("span", null, emptyChartText)) : null, /*#__PURE__*/React.createElement("svg", {
1200
+ width: width,
1201
+ height: height
1202
+ }, /*#__PURE__*/React.createElement("g", {
1203
+ transform: `translate(${margins.left},${margins.top})`
1204
+ }, /*#__PURE__*/React.createElement(HorizontalBarChartAxisBottom, {
1205
+ areXLabelsRotated: !!areXLabelsRotated,
1206
+ chartHeight: chartHeight,
1207
+ d3scale: scaleX,
1208
+ transform: `translate(0,${chartHeight})`
1209
+ }), data.map((_ref2, index) => {
1210
+ let {
1211
+ value,
1212
+ name
1213
+ } = _ref2;
1214
+ const percent = (value / total * 100).toFixed(2);
1215
+ return /*#__PURE__*/React.createElement(HorizontalBarChartBar, {
1216
+ chartId: id,
1217
+ color: d3colors(name),
1218
+ data: {
1219
+ value,
1220
+ name
1221
+ },
1222
+ gap: gap,
1223
+ height: barHeight,
1224
+ index: index,
1225
+ isEmpty: isEmpty,
1226
+ key: `row _${index}`,
1227
+ onClick: onBarClick ? () => onBarClick(data[index]) : undefined,
1228
+ role: barRole,
1229
+ showTooltip: tooltipVariant !== HorizontalBarChartTooltipVariant.none && !isEmpty,
1230
+ tooltipLabelOnly: tooltipVariant == HorizontalBarChartTooltipVariant.label,
1231
+ tooltipPercent: tooltipVariant === HorizontalBarChartTooltipVariant.percent ? percent : null,
1232
+ width: Math.abs(scaleX(value))
1233
+ });
1234
+ }))))), caption ? /*#__PURE__*/React.createElement(StyledHorizontalBarChartCaption, {
1235
+ className: `${HorizontalBarChart.className}__caption`
1236
+ }, caption) : null);
1237
+ });
1238
+ HorizontalBarChart.className = CLASSNAME$2;
1239
+ HorizontalBarChart.defaultProps = DEFAULT_PROPS$2;
1240
+ HorizontalBarChart.displayName = COMPONENT_NAME$2;
1241
+
1242
+ /**
1243
+ * Component size.
1244
+ */
1245
+ const PieChartSize = {
1246
+ small: 'small',
1247
+ medium: 'medium',
1248
+ large: 'large'
1249
+ };
1250
+ /**
1251
+ * Component variant.
1252
+ */
1253
+ const PieChartVariant = {
1254
+ plain: 'plain',
1255
+ spaced: 'spaced',
1256
+ donut: 'donut',
1257
+ spacedDonut: 'spacedDonut'
1258
+ };
1259
+ /**
1260
+ * Component's labels variant.
1261
+ */
1262
+ const PieChartLabelVariant = {
1263
+ none: 'none',
1264
+ internal: 'internal',
1265
+ externalLabel: 'externalLabel',
1266
+ externalLabelValue: 'externalLabelValue',
1267
+ externalLabelPercent: 'externalLabelPercent'
1268
+ };
1269
+ /**
1270
+ * Component theme.
1271
+ */
1272
+ const PieChartTheme = ColorTheme;
1273
+ /**
1274
+ * Tooltip label variant.
1275
+ */
1276
+ const PieChartTooltipVariant = {
1277
+ none: 'none',
1278
+ label: 'label',
1279
+ value: 'value',
1280
+ percent: 'percent'
1281
+ };
1282
+
1283
+ /**
1284
+ * Component style.
1285
+ */
1286
+ const StyledPieChart = styled.div`
1287
+ margin: 8px;
1288
+ padding: 8px;
1289
+ color: var(--redsift-color-neutral-black);
1290
+
1291
+ .redsift-piechart__container {
1292
+ display: flex;
1293
+ align-items: center;
1294
+ gap: 16px;
1295
+ font-family: var(--redsift-typography-font-family-source-code-pro);
1296
+ font-size: 11px;
1297
+ justify-content: center;
1298
+ margin: 8px 0;
1299
+
1300
+ .redsift-piechart-container__chart {
1301
+ position: relative;
1302
+ }
1303
+ }
1304
+ svg {
1305
+ display: block;
1306
+ }
1307
+ `;
1308
+ const StyledPieChartTitle = styled.div`
1309
+ font-family: var(--redsift-typography-h4-font-family);
1310
+ font-size: var(--redsift-typography-h4-font-size);
1311
+ font-weight: var(--redsift-typography-h4-font-weight);
1312
+ line-height: var(--redsift-typography-h4-line-height);
1313
+ `;
1314
+ const StyledPieChartCaption = styled.p`
1315
+ font-family: var(--redsift-typography-caption-font-family);
1316
+ font-size: var(--redsift-typography-caption-font-size);
1317
+ font-weight: var(--redsift-typography-caption-font-weight);
1318
+ line-height: var(--redsift-typography-caption-line-height);
1319
+ `;
1320
+ const StyledPieChartCenterText = styled.div`
1321
+ position: absolute;
1322
+ top: 0;
1323
+ left: 0;
1324
+ height: 100%;
1325
+ width: 100%;
1326
+ display: flex;
1327
+ flex-direction: column;
1328
+ justify-content: center;
1329
+ align-items: center;
1330
+ pointer-events: none;
1331
+
1332
+ > * {
1333
+ max-width: ${_ref => {
1334
+ let {
1335
+ $maxWidth
1336
+ } = _ref;
1337
+ return $maxWidth;
1338
+ }}px;
1339
+ }
1340
+
1341
+ > b {
1342
+ font-family: var(--redsift-typography-font-family-source-code-pro);
1343
+ color: var(--redsift-color-neutral-black);
1344
+ font-weight: var(--redsift-typography-font-weight-medium);
1345
+ font-size: ${_ref2 => {
1346
+ let {
1347
+ $textSize
1348
+ } = _ref2;
1349
+ return $textSize;
1350
+ }}px;
1351
+ line-height: ${_ref3 => {
1352
+ let {
1353
+ $textSize
1354
+ } = _ref3;
1355
+ return $textSize;
1356
+ }}px;
1357
+
1358
+ &:nth-child(2) {
1359
+ font-weight: normal;
1360
+ margin-top: 8px;
1361
+ font-family: var(--redsift-typography-font-family-raleway);
1362
+ font-size: ${_ref4 => {
1363
+ let {
1364
+ $smallTextSize
1365
+ } = _ref4;
1366
+ return $smallTextSize;
1367
+ }}px;
1368
+ line-height: ${_ref5 => {
1369
+ let {
1370
+ $smallTextSize
1371
+ } = _ref5;
1372
+ return $smallTextSize;
1373
+ }}px;
1374
+ }
1375
+ }
1376
+ > span {
1377
+ color: var(--redsift-color-neutral-black);
1378
+ font-size: ${_ref6 => {
1379
+ let {
1380
+ $textSize
1381
+ } = _ref6;
1382
+ return $textSize;
1383
+ }}px;
1384
+ line-height: ${_ref7 => {
1385
+ let {
1386
+ $textSize
1387
+ } = _ref7;
1388
+ return $textSize;
1389
+ }}px;
1390
+ &:nth-child(3) {
1391
+ margin-top: 4px;
1392
+ font-size: ${_ref8 => {
1393
+ let {
1394
+ $smallTextSize
1395
+ } = _ref8;
1396
+ return $smallTextSize;
1397
+ }}px;
1398
+ line-height: ${_ref9 => {
1399
+ let {
1400
+ $smallTextSize
1401
+ } = _ref9;
1402
+ return $smallTextSize;
1403
+ }}px;
1404
+ }
1405
+ }
1406
+ > b + span {
1407
+ font-size: var(--redsift-typography-body-font-size);
1408
+ font-family: var(--redsift-typography-font-family-raleway);
1409
+ line-height: var(--redsift-typography-badge-line-height);
1410
+ color: rgba(0, 0, 0, 0.6);
1411
+ text-align: center;
1412
+ }
1413
+ `;
1414
+ const StyledPieChartEmptyText = styled.div`
1415
+ position: absolute;
1416
+ top: 0;
1417
+ left: 0;
1418
+ height: 100%;
1419
+ width: 100%;
1420
+ display: flex;
1421
+ flex-direction: column;
1422
+ justify-content: center;
1423
+ align-items: center;
1424
+ pointer-events: none;
1425
+
1426
+ > * {
1427
+ max-width: ${_ref10 => {
1428
+ let {
1429
+ $maxWidth
1430
+ } = _ref10;
1431
+ return $maxWidth;
1432
+ }}px;
1433
+ }
1434
+
1435
+ > span {
1436
+ font-family: var(--redsift-typography-font-family-raleway);
1437
+ color: ${_ref11 => {
1438
+ let {
1439
+ $isDonut
1440
+ } = _ref11;
1441
+ return $isDonut ? css`var(--redsift-color-neutral-midgrey)` : css`var(--redsift-color-neutral-black)`;
1442
+ }};
1443
+ font-size: ${_ref12 => {
1444
+ let {
1445
+ $textSize
1446
+ } = _ref12;
1447
+ return $textSize;
1448
+ }}px;
1449
+ line-height: ${_ref13 => {
1450
+ let {
1451
+ $textSize
1452
+ } = _ref13;
1453
+ return $textSize;
1454
+ }}px;
1455
+ }
1456
+ `;
1457
+ const StyledPieChartLabel = styled.li`
1458
+ display: flex;
1459
+ align-items: center;
1460
+ gap: 8px;
1461
+ width: 100%;
1462
+ max-width: 262px;
1463
+ font-family: var(--redsift-typography-font-family-raleway);
1464
+ font-weight: var(--redsift-typography-font-weight-regular);
1465
+ font-size: var(--redsift-typography-caption-font-size);
1466
+
1467
+ > div {
1468
+ height: 16px;
1469
+ width: 16px;
1470
+ min-width: 16px;
1471
+ background-color: ${_ref14 => {
1472
+ let {
1473
+ $color
1474
+ } = _ref14;
1475
+ return $color;
1476
+ }};
1477
+ }
1478
+
1479
+ > b {
1480
+ font-family: var(--redsift-typography-font-family-source-code-pro);
1481
+ font-weight: var(--redsift-typography-font-weight-bold);
1482
+ font-size: var(--redsift-typography-caption-font-size);
1483
+ }
1484
+ `;
1485
+ const StyledPieChartArc = styled.g`
1486
+ ${_ref15 => {
1487
+ let {
1488
+ $spaced
1489
+ } = _ref15;
1490
+ return $spaced ? css`
1491
+ path {
1492
+ stroke-width: 2px;
1493
+ stroke: #fff;
1494
+ }
1495
+ ` : '';
1496
+ }}
1497
+
1498
+ ${_ref16 => {
1499
+ let {
1500
+ $clickable
1501
+ } = _ref16;
1502
+ return $clickable ? css`
1503
+ cursor: pointer;
1504
+
1505
+ &:hover,
1506
+ &:focus {
1507
+ opacity: 0.8;
1508
+ outline: none;
1509
+ }
1510
+
1511
+ &:focus-visible {
1512
+ path {
1513
+ stroke: var(--redsift-color-default-primary);
1514
+ stroke-width: 4px;
1515
+ paint-order: stroke;
1516
+ }
1517
+ }
1518
+ ` : '';
1519
+ }}}
1520
+ `;
1521
+ const StyledPieChartTooltip = styled.div`
1522
+ font-family: var(--redsift-typography-font-family-raleway);
1523
+ border: 1px solid rgb(0 0 0 / 20%);
1524
+ padding: 10px;
1525
+ box-shadow: 0 2px 1px -1px rgb(0 0 0 / 20%), 0 1px 1px 0 rgb(0 0 0 / 14%),
1526
+ 0 1px 3px 0 rgb(0 0 0 / 12%);
1527
+ background-color: var(--redsift-color-neutral-white);
1528
+ `;
1529
+
1530
+ const _excluded$1 = ["chartId", "color", "data", "index", "onClick", "path", "role", "spaced", "showTooltip", "tooltipPercent", "tooltipLabelOnly", "isEmpty"];
1531
+ const COMPONENT_NAME$1 = 'RedSiftPieChartArc';
1532
+ const CLASSNAME$1 = 'redsift-piechart-arc';
1533
+ const DEFAULT_PROPS$1 = {};
1534
+ const PieChartArc = /*#__PURE__*/forwardRef((props, ref) => {
1535
+ const {
1536
+ chartId,
1537
+ color,
1538
+ data,
1539
+ index,
1540
+ onClick,
1541
+ path,
1542
+ role,
1543
+ spaced,
1544
+ showTooltip,
1545
+ tooltipPercent,
1546
+ tooltipLabelOnly,
1547
+ isEmpty
1548
+ } = props,
1549
+ forwardedProps = _objectWithoutProperties(props, _excluded$1);
1550
+ const onKeyDown = event => {
1551
+ if (onClick) {
1552
+ event.stopPropagation();
1553
+ if (event.code === 'Enter' || event.code === 'Space') {
1554
+ event.preventDefault();
1555
+ onClick();
1556
+ }
1557
+ }
1558
+ };
1036
1559
  const Arc = /*#__PURE__*/React.createElement(StyledPieChartArc, _extends$1({
1037
1560
  ref: ref
1038
1561
  }, forwardedProps, {
1039
- role: onClick ? 'button' : undefined,
1562
+ "aria-label": showTooltip && !isEmpty ? `${data.name}: ${data.value}` : undefined,
1563
+ "aria-labelledby": !showTooltip && !isEmpty ? `id${chartId}__slice-${index}-title` : undefined,
1040
1564
  className: `pie-slice _${index}`,
1565
+ id: `id${chartId}__slice-${index}`,
1041
1566
  onClick: onClick,
1567
+ onKeyDown: onKeyDown,
1568
+ role: role ? role : onClick ? 'button' : undefined,
1569
+ tabIndex: onClick ? 0 : undefined,
1042
1570
  $clickable: Boolean(onClick),
1043
1571
  $spaced: Boolean(spaced)
1044
1572
  }), /*#__PURE__*/React.createElement("path", {
1045
1573
  d: path,
1046
1574
  fill: color
1047
- }), !showTooltip && !isEmpty && /*#__PURE__*/React.createElement("title", null, `${data.name}: ${data.value}`));
1575
+ }), !showTooltip && !isEmpty ? /*#__PURE__*/React.createElement("title", {
1576
+ id: `id${chartId}__slice-${index}-title`
1577
+ }, `${data.name}: ${data.value}`) : null);
1048
1578
  if (showTooltip) {
1049
1579
  const tooltipValue = tooltipPercent !== null ? `${tooltipPercent}%` : data.value;
1050
1580
  return /*#__PURE__*/React.createElement(Popup, {
@@ -1052,7 +1582,7 @@ const PieChartArc = /*#__PURE__*/forwardRef((props, ref) => {
1052
1582
  arrow: false,
1053
1583
  position: "right center",
1054
1584
  trigger: Arc
1055
- }, /*#__PURE__*/React.createElement(Tooltip, null, `${data.name}${tooltipLabelOnly ? '' : ` - ${tooltipValue}`}`));
1585
+ }, /*#__PURE__*/React.createElement(StyledPieChartTooltip, null, `${data.name}${tooltipLabelOnly ? '' : ` - ${tooltipValue}`}`));
1056
1586
  }
1057
1587
  return Arc;
1058
1588
  });
@@ -1060,7 +1590,7 @@ PieChartArc.className = CLASSNAME$1;
1060
1590
  PieChartArc.defaultProps = DEFAULT_PROPS$1;
1061
1591
  PieChartArc.displayName = COMPONENT_NAME$1;
1062
1592
 
1063
- const _excluded = ["aria-label", "aria-labelledby", "caping", "caption", "className", "data", "labelVariant", "onSliceClick", "others", "size", "text", "middleText", "subtext", "theme", "title", "variant", "tooltipVariant", "localeText"];
1593
+ const _excluded = ["aria-label", "aria-labelledby", "caping", "caption", "className", "data", "labelVariant", "onSliceClick", "others", "size", "sliceRole", "text", "middleText", "subtext", "theme", "title", "variant", "tooltipVariant", "localeText"];
1064
1594
  const COMPONENT_NAME = 'RedSiftPieChart';
1065
1595
  const CLASSNAME = 'redsift-piechart';
1066
1596
  const DEFAULT_PROPS = {
@@ -1140,6 +1670,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
1140
1670
  onSliceClick,
1141
1671
  others,
1142
1672
  size,
1673
+ sliceRole,
1143
1674
  text,
1144
1675
  middleText,
1145
1676
  subtext,
@@ -1228,6 +1759,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
1228
1759
  }, pieData.map((datum, index) => {
1229
1760
  const percent = (datum.data.value / total * 100).toFixed(2);
1230
1761
  return /*#__PURE__*/React.createElement(PieChartArc, {
1762
+ chartId: id,
1231
1763
  color: d3colors(datum.data.name),
1232
1764
  data: datum.data,
1233
1765
  isEmpty: isEmpty,
@@ -1235,6 +1767,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
1235
1767
  key: `pie-slice _${index}`,
1236
1768
  onClick: onSliceClick ? () => onSliceClick(data[index]) : undefined,
1237
1769
  showTooltip: tooltipVariant !== PieChartTooltipVariant.none && !isEmpty,
1770
+ role: sliceRole,
1238
1771
  tooltipLabelOnly: tooltipVariant == PieChartTooltipVariant.label,
1239
1772
  tooltipPercent: tooltipVariant === PieChartTooltipVariant.percent ? percent : null,
1240
1773
  path: createArc(datum),
@@ -1244,7 +1777,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
1244
1777
  className: "pie-label-group"
1245
1778
  }, pieData.filter(datum => {
1246
1779
  const value = datum.data.value;
1247
- return value > 0 && value / total >= 0.10;
1780
+ return value > 0 && value / total >= 0.1;
1248
1781
  }).map((datum, index) => /*#__PURE__*/React.createElement("text", {
1249
1782
  className: `pie-slice pie-label _${index}`,
1250
1783
  key: `pie-slice pie-label _${index}`,
@@ -1267,5 +1800,5 @@ PieChart.className = CLASSNAME;
1267
1800
  PieChart.defaultProps = DEFAULT_PROPS;
1268
1801
  PieChart.displayName = COMPONENT_NAME;
1269
1802
 
1270
- export { ColorTheme, PieChart, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartTooltipVariant, PieChartVariant, StyledPieChart, StyledPieChartArc, StyledPieChartCaption, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartLabel, StyledPieChartTitle, Tooltip, getColorScale, monochrome, scheme, successDangerScheme };
1803
+ export { ColorTheme, HorizontalBarChart, HorizontalBarChartSize, HorizontalBarChartTheme, HorizontalBarChartTooltipVariant, PieChart, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartTooltipVariant, PieChartVariant, StyledHorizontalBarChart, StyledHorizontalBarChartAxisBottom, StyledHorizontalBarChartBar, StyledHorizontalBarChartCaption, StyledHorizontalBarChartEmptyText, StyledHorizontalBarChartTitle, StyledHorizontalBarChartTooltip, StyledPieChart, StyledPieChartArc, StyledPieChartCaption, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartLabel, StyledPieChartTitle, StyledPieChartTooltip, getColorScale, monochrome, scheme, successDangerScheme };
1271
1804
  //# sourceMappingURL=index.js.map