@redsift/dashboard 7.7.0-alpha.0 → 7.7.0-alpha.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ColorTheme, getColorScale, scheme, StyledHorizontalBarChartTitle, StyledHorizontalBarChartCaption, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant, StyledPieChartTitle, StyledPieChartCenterText, StyledPieChartLabel, StyledPieChartCaption } from '@redsift/charts';
1
+ import { ColorTheme, getColorScale, scheme, StyledHorizontalBarChartTitle, StyledHorizontalBarChartCaption, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant, StyledPieChartTitle, StyledPieChartCenterText, StyledPieChartLabel, StyledPieChartCaption, monochrome } from '@redsift/charts';
2
2
  export { ColorTheme, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
3
3
  import React, { useContext, useState, useLayoutEffect, useMemo, useEffect, useRef, useCallback, forwardRef, useReducer, useId } from 'react';
4
4
  import styled, { css } from 'styled-components';
@@ -9,7 +9,10 @@ import { config, rowChart, redrawAll, filterAll, pieChart, barChart, filters } f
9
9
  import { saveAs } from 'file-saver';
10
10
  import { Font, StyleSheet, Document, Page, View, Image, Text as Text$1, pdf } from '@react-pdf/renderer';
11
11
  import domToImage from 'dom-to-image';
12
+ import * as d3 from 'd3';
12
13
  import { sum, utcParse, timeFormat, isoParse, timeMonth, scaleTime, timeMonths, timeYear, timeYears, timeWeek, timeWeeks, timeDay, timeDays, timeHour, timeHours } from 'd3';
14
+ import * as fc from 'd3fc';
15
+ import * as d3Annotation from 'd3-svg-annotation';
13
16
 
14
17
  const groupReduceCount = d => d.group().reduceCount();
15
18
  const COUNT = groupReduceCount;
@@ -18,6 +21,9 @@ const groupReduceSum = field => d => d.group().reduceSum(d => d[field]);
18
21
  const SUM = groupReduceSum;
19
22
 
20
23
  // Material Design Icons v7.1.96
24
+ var mdiCheckboxBlankOutline = "M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z";
25
+ var mdiCheckboxMarked = "M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z";
26
+ var mdiMinusBox = "M17,13H7V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z";
21
27
  var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
22
28
 
23
29
  /**
@@ -65,6 +71,24 @@ const NeutralColorPalette = {
65
71
 
66
72
  const RedsiftColorDefaultPrimary = '#0079e1';
67
73
 
74
+ /**
75
+ * Display a warning if no label was found for screen readers and assistive technologies.
76
+ *
77
+ * @param props Component props containing the aria-label and aria-labelledby params to check for.
78
+ * @param additionalKeysToCheck Additional props to check that can act as a label for screen readers (i.e. children).
79
+ */
80
+ const warnIfNoAccessibleLabelFound = (props, additionalKeysToCheck) => {
81
+ const {
82
+ 'aria-label': ariaLabel,
83
+ 'aria-labelledby': ariaLabelledby
84
+ } = props;
85
+ const hasText = additionalKeysToCheck && additionalKeysToCheck.filter(key => !!key).length > 0;
86
+ const hasAriaLabel = Boolean(ariaLabel || ariaLabelledby);
87
+ if (!hasAriaLabel && !hasText) {
88
+ console.warn('You must provide a label for accessibility');
89
+ }
90
+ };
91
+
68
92
  /*
69
93
  * Copyright 2020 Adobe. All rights reserved.
70
94
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1934,6 +1958,11 @@ let $507fabe10e71c6fb$var$changeHandlers = new Set();
1934
1958
  let $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
1935
1959
  let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
1936
1960
  let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
1961
+ // Only Tab or Esc keys will make focus visible on text input elements
1962
+ const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
1963
+ Tab: true,
1964
+ Escape: true
1965
+ };
1937
1966
  function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
1938
1967
  for (let handler of $507fabe10e71c6fb$var$changeHandlers)handler(modality, e);
1939
1968
  }
@@ -2018,9 +2047,95 @@ if (typeof document !== "undefined") {
2018
2047
  if (document.readyState !== "loading") $507fabe10e71c6fb$var$setupGlobalFocusEvents();
2019
2048
  else document.addEventListener("DOMContentLoaded", $507fabe10e71c6fb$var$setupGlobalFocusEvents);
2020
2049
  }
2050
+ function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
2051
+ return $507fabe10e71c6fb$var$currentModality !== "pointer";
2052
+ }
2021
2053
  function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
2022
2054
  return $507fabe10e71c6fb$var$currentModality;
2023
2055
  }
2056
+ /**
2057
+ * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
2058
+ * focus visible style can be properly set.
2059
+ */ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
2060
+ return !(isTextInput && modality === "keyboard" && e instanceof KeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
2061
+ }
2062
+ function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
2063
+ $507fabe10e71c6fb$var$setupGlobalFocusEvents();
2064
+ (useEffect)(()=>{
2065
+ let handler = (modality, e)=>{
2066
+ if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(opts === null || opts === void 0 ? void 0 : opts.isTextInput, modality, e)) return;
2067
+ fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
2068
+ };
2069
+ $507fabe10e71c6fb$var$changeHandlers.add(handler);
2070
+ return ()=>{
2071
+ $507fabe10e71c6fb$var$changeHandlers.delete(handler);
2072
+ };
2073
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2074
+ }, deps);
2075
+ }
2076
+
2077
+
2078
+ /*
2079
+ * Copyright 2020 Adobe. All rights reserved.
2080
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
2081
+ * you may not use this file except in compliance with the License. You may obtain a copy
2082
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
2083
+ *
2084
+ * Unless required by applicable law or agreed to in writing, software distributed under
2085
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
2086
+ * OF ANY KIND, either express or implied. See the License for the specific language
2087
+ * governing permissions and limitations under the License.
2088
+ */ // Portions of the code in this file are based on code from react.
2089
+ // Original licensing for the following can be found in the
2090
+ // NOTICE file in the root directory of this source tree.
2091
+ // See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
2092
+
2093
+
2094
+ function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
2095
+ let { isDisabled: isDisabled , onBlurWithin: onBlurWithin , onFocusWithin: onFocusWithin , onFocusWithinChange: onFocusWithinChange } = props;
2096
+ let state = (useRef)({
2097
+ isFocusWithin: false
2098
+ });
2099
+ let onBlur = (useCallback)((e)=>{
2100
+ // We don't want to trigger onBlurWithin and then immediately onFocusWithin again
2101
+ // when moving focus inside the element. Only trigger if the currentTarget doesn't
2102
+ // include the relatedTarget (where focus is moving).
2103
+ if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
2104
+ state.current.isFocusWithin = false;
2105
+ if (onBlurWithin) onBlurWithin(e);
2106
+ if (onFocusWithinChange) onFocusWithinChange(false);
2107
+ }
2108
+ }, [
2109
+ onBlurWithin,
2110
+ onFocusWithinChange,
2111
+ state
2112
+ ]);
2113
+ let onSyntheticFocus = ($8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
2114
+ let onFocus = (useCallback)((e)=>{
2115
+ if (!state.current.isFocusWithin) {
2116
+ if (onFocusWithin) onFocusWithin(e);
2117
+ if (onFocusWithinChange) onFocusWithinChange(true);
2118
+ state.current.isFocusWithin = true;
2119
+ onSyntheticFocus(e);
2120
+ }
2121
+ }, [
2122
+ onFocusWithin,
2123
+ onFocusWithinChange,
2124
+ onSyntheticFocus
2125
+ ]);
2126
+ if (isDisabled) return {
2127
+ focusWithinProps: {
2128
+ onFocus: null,
2129
+ onBlur: null
2130
+ }
2131
+ };
2132
+ return {
2133
+ focusWithinProps: {
2134
+ onFocus: onFocus,
2135
+ onBlur: onBlur
2136
+ }
2137
+ };
2138
+ }
2024
2139
 
2025
2140
 
2026
2141
  /*
@@ -2207,6 +2322,60 @@ new $9bf71ea28793e738$var$Tree();
2207
2322
 
2208
2323
 
2209
2324
 
2325
+
2326
+
2327
+ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
2328
+ let { autoFocus: autoFocus = false , isTextInput: isTextInput , within: within } = props;
2329
+ let state = (useRef)({
2330
+ isFocused: false,
2331
+ isFocusVisible: autoFocus || ($507fabe10e71c6fb$export$b9b3dfddab17db27)()
2332
+ });
2333
+ let [isFocused, setFocused] = (useState)(false);
2334
+ let [isFocusVisibleState, setFocusVisible] = (useState)(()=>state.current.isFocused && state.current.isFocusVisible);
2335
+ let updateState = (useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
2336
+ let onFocusChange = (useCallback)((isFocused)=>{
2337
+ state.current.isFocused = isFocused;
2338
+ setFocused(isFocused);
2339
+ updateState();
2340
+ }, [
2341
+ updateState
2342
+ ]);
2343
+ ($507fabe10e71c6fb$export$ec71b4b83ac08ec3)((isFocusVisible)=>{
2344
+ state.current.isFocusVisible = isFocusVisible;
2345
+ updateState();
2346
+ }, [], {
2347
+ isTextInput: isTextInput
2348
+ });
2349
+ let { focusProps: focusProps } = ($a1ea59d68270f0dd$export$f8168d8dd8fd66e6)({
2350
+ isDisabled: within,
2351
+ onFocusChange: onFocusChange
2352
+ });
2353
+ let { focusWithinProps: focusWithinProps } = ($9ab94262bd0047c7$export$420e68273165f4ec)({
2354
+ isDisabled: !within,
2355
+ onFocusWithinChange: onFocusChange
2356
+ });
2357
+ return {
2358
+ isFocused: isFocused,
2359
+ isFocusVisible: state.current.isFocused && isFocusVisibleState,
2360
+ focusProps: within ? focusWithinProps : focusProps
2361
+ };
2362
+ }
2363
+
2364
+
2365
+ /*
2366
+ * Copyright 2020 Adobe. All rights reserved.
2367
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
2368
+ * you may not use this file except in compliance with the License. You may obtain a copy
2369
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
2370
+ *
2371
+ * Unless required by applicable law or agreed to in writing, software distributed under
2372
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
2373
+ * OF ANY KIND, either express or implied. See the License for the specific language
2374
+ * governing permissions and limitations under the License.
2375
+ */
2376
+
2377
+
2378
+
2210
2379
  let $e6afbd83fe6ebbd2$var$FocusableContext = /*#__PURE__*/ (React).createContext(null);
2211
2380
  function $e6afbd83fe6ebbd2$var$useFocusableContext(ref) {
2212
2381
  let context = (useContext)($e6afbd83fe6ebbd2$var$FocusableContext) || {};
@@ -2641,10 +2810,10 @@ const StyledIcon = styled.span`
2641
2810
  }}
2642
2811
  `;
2643
2812
 
2644
- const _excluded$b = ["aria-hidden", "aria-label", "badge", "className", "color", "icon", "size", "svgProps"];
2645
- const COMPONENT_NAME$b = 'Icon';
2646
- const CLASSNAME$b = 'redsift-icon';
2647
- const DEFAULT_PROPS$a = {
2813
+ const _excluded$e = ["aria-hidden", "aria-label", "badge", "className", "color", "icon", "size", "svgProps"];
2814
+ const COMPONENT_NAME$e = 'Icon';
2815
+ const CLASSNAME$e = 'redsift-icon';
2816
+ const DEFAULT_PROPS$d = {
2648
2817
  size: IconSize.medium
2649
2818
  };
2650
2819
 
@@ -2662,7 +2831,7 @@ const Icon = /*#__PURE__*/forwardRef((props, ref) => {
2662
2831
  size,
2663
2832
  svgProps
2664
2833
  } = props,
2665
- forwardedProps = _objectWithoutProperties(props, _excluded$b);
2834
+ forwardedProps = _objectWithoutProperties(props, _excluded$e);
2666
2835
  return /*#__PURE__*/React.createElement(StyledIcon, _extends({}, forwardedProps, {
2667
2836
  $color: color,
2668
2837
  $size: size,
@@ -2684,9 +2853,9 @@ const Icon = /*#__PURE__*/forwardRef((props, ref) => {
2684
2853
  fill: "currentColor"
2685
2854
  })), badge ? badge : null);
2686
2855
  });
2687
- Icon.className = CLASSNAME$b;
2688
- Icon.defaultProps = DEFAULT_PROPS$a;
2689
- Icon.displayName = COMPONENT_NAME$b;
2856
+ Icon.className = CLASSNAME$e;
2857
+ Icon.defaultProps = DEFAULT_PROPS$d;
2858
+ Icon.displayName = COMPONENT_NAME$e;
2690
2859
 
2691
2860
  /**
2692
2861
  * Component variant.
@@ -2869,7 +3038,7 @@ var spinnerTools = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My
2869
3038
 
2870
3039
  var spinnerWebsite = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDAwIDQwMCIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iIHRleHQtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogIDxzdHlsZT4KICAgIC5zcGlubmluZyB7CiAgICAgIGFuaW1hdGlvbjogc3Bpbm5pbmcta2V5ZnJhbWVzIDMwMDBtcyBsaW5lYXIgaW5maW5pdGUgbm9ybWFsIGZvcndhcmRzOwogICAgICB0cmFuc2Zvcm0tb3JpZ2luOiBjZW50ZXI7CiAgICAgIGFuaW1hdGlvbi10aW1pbmctZnVuY3Rpb246IGN1YmljLWJlemllcigwLjQyLCAwLCAwLjU4LCAxKTsKICAgIH0KICAgIEBrZXlmcmFtZXMgc3Bpbm5pbmcta2V5ZnJhbWVzIHsKICAgICAgMCUgewogICAgICAgIHRyYW5zZm9ybTogIHJvdGF0ZSgwZGVnKTsKICAgICAgfQoKICAgICAgMzMlIHsKICAgICAgICB0cmFuc2Zvcm06ICByb3RhdGUoMTgwZGVnKTsKICAgICAgfQoKICAgICAgNTAlIHsKICAgICAgICB0cmFuc2Zvcm06IHJvdGF0ZSgxODBkZWcpOwogICAgICB9CgogICAgICA4MyUgewogICAgICAgIHRyYW5zZm9ybTogIHJvdGF0ZSgzNjBkZWcpOwogICAgICB9CgogICAgICAxMDAlIHsKICAgICAgICB0cmFuc2Zvcm06ICByb3RhdGUoMzYwZGVnKQogICAgICB9CiAgICB9CiAgPC9zdHlsZT4KICA8cGF0aAogICAgbWFzaz0idXJsKCNzcGlubmVyLXUtbWFza3MpIgogICAgZmlsbD0iIzAwNzllMSIKICAgIGQ9Ik0zMTggMTg2LjlWMTA4LjhMMjAwIDU3IDgyIDEwOC44djc4LjFDODIgMjU5IDEzMi4zIDMyNi40IDIwMCAzNDNjNjcuNy0xNi42IDExOC04NCAxMTgtMTU2LjF6TTQwMCAyMDBjMCAxMTAuNS04OS41IDIwMC0yMDAgMjAwUzAgMzEwLjUgMCAyMDAgODkuNSAwIDIwMCAwczIwMCA4OS41IDIwMCAyMDB6IgogIC8+CiAgPG1hc2sgaWQ9InNwaW5uZXItdS1tYXNrcyI+CiAgICA8cGF0aAogICAgICBjbGFzcz0ic3Bpbm5pbmciCiAgICAgIGQ9Ik0wLDIwMEMwLDg5LjU0MzA1LDg5LjU0MzA1LDAsMjAwLDB2NDAwQzg5LjU0MzA1LDQwMCwwLDMxMC40NTY5NSwwLDIwMFoiCiAgICAgIGZpbGw9IiNmZmYiCiAgICAvPgogIDwvbWFzaz4KICA8cGF0aAogICAgbWFzaz0idXJsKCNzcGlubmVyLXUtbWFza3MyKSIKICAgIGZpbGw9IiMwMDc5ZTEiCiAgICBkPSJNODIsMTg2LjkzOXYtNzguMDg5TDIwMCw1N2wxMTgsNTEuODV2NzguMDg5QzMxOCwyNTkuMDAyLDI2Ny42ODYsMzI2LjQwMiwyMDAsMzQzQzEzMi4zMTQsMzI2LjQwMiw4MiwyNTkuMDAyLDgyLDE4Ni45MzlaIgogIC8+CiAgPG1hc2sgaWQ9InNwaW5uZXItdS1tYXNrczIiPgogICAgPHBhdGgKICAgICAgY2xhc3M9InNwaW5uaW5nIgogICAgICBkPSJNNDAwIDIwMEM0MDAgMzEwLjUgMzEwLjUgNDAwIDIwMCA0MDBWMGMxMTAuNSAwIDIwMCA4OS41IDIwMCAyMDB6IgogICAgICBmaWxsPSIjZmZmIgogICAgLz4KICA8L21hc2s+Cjwvc3ZnPg==';
2871
3040
 
2872
- const _excluded$a = ["aria-hidden", "aria-label", "className", "color", "size"];
3041
+ const _excluded$d = ["aria-hidden", "aria-label", "className", "color", "size"];
2873
3042
  const colorToFile = {
2874
3043
  default: spinnerDefault,
2875
3044
  hardenize: spinnerHardenize,
@@ -2881,13 +3050,13 @@ const colorToFile = {
2881
3050
  tools: spinnerTools,
2882
3051
  website: spinnerWebsite
2883
3052
  };
2884
- const COMPONENT_NAME$a = 'Spinner';
2885
- const CLASSNAME$a = 'redsift-shield';
2886
- const DEFAULT_PROPS$9 = {
3053
+ const COMPONENT_NAME$d = 'Spinner';
3054
+ const CLASSNAME$d = 'redsift-shield';
3055
+ const DEFAULT_PROPS$c = {
2887
3056
  color: ColorPalette.default,
2888
3057
  size: SpinnerSize.medium
2889
3058
  };
2890
- const sizeToDimension$3 = size => {
3059
+ const sizeToDimension$4 = size => {
2891
3060
  switch (size) {
2892
3061
  case SpinnerSize.xsmall:
2893
3062
  return {
@@ -2924,11 +3093,11 @@ const Spinner = /*#__PURE__*/forwardRef((props, ref) => {
2924
3093
  color: propsColor,
2925
3094
  size
2926
3095
  } = props,
2927
- forwardedProps = _objectWithoutProperties(props, _excluded$a);
3096
+ forwardedProps = _objectWithoutProperties(props, _excluded$d);
2928
3097
  const {
2929
3098
  width,
2930
3099
  height
2931
- } = sizeToDimension$3(size);
3100
+ } = sizeToDimension$4(size);
2932
3101
  const appContainerState = useContext(AppContainerContext);
2933
3102
  const color = propsColor === ColorPalette.default && appContainerState && appContainerState.productTheme ? appContainerState.productTheme : propsColor;
2934
3103
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1(intlMessages);
@@ -2946,14 +3115,14 @@ const Spinner = /*#__PURE__*/forwardRef((props, ref) => {
2946
3115
  $size: size
2947
3116
  }));
2948
3117
  });
2949
- Spinner.className = CLASSNAME$a;
2950
- Spinner.defaultProps = DEFAULT_PROPS$9;
2951
- Spinner.displayName = COMPONENT_NAME$a;
2952
-
2953
- const _excluded$9 = ["children", "className", "color", "disabled", "fullWidth", "isActive", "isDisabled", "isLoading", "leftIcon", "onPress", "rightIcon", "variant"];
2954
- const COMPONENT_NAME$9 = 'Button';
2955
- const CLASSNAME$9 = 'redsift-button';
2956
- const DEFAULT_PROPS$8 = {
3118
+ Spinner.className = CLASSNAME$d;
3119
+ Spinner.defaultProps = DEFAULT_PROPS$c;
3120
+ Spinner.displayName = COMPONENT_NAME$d;
3121
+
3122
+ const _excluded$c = ["children", "className", "color", "disabled", "fullWidth", "isActive", "isDisabled", "isLoading", "leftIcon", "onPress", "rightIcon", "variant"];
3123
+ const COMPONENT_NAME$c = 'Button';
3124
+ const CLASSNAME$c = 'redsift-button';
3125
+ const DEFAULT_PROPS$b = {
2957
3126
  color: ColorPalette.default,
2958
3127
  height: 'fit-content',
2959
3128
  variant: ButtonVariant.primary
@@ -2990,7 +3159,7 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
2990
3159
  rightIcon,
2991
3160
  variant
2992
3161
  } = props,
2993
- forwardedProps = _objectWithoutProperties(props, _excluded$9);
3162
+ forwardedProps = _objectWithoutProperties(props, _excluded$c);
2994
3163
  return /*#__PURE__*/React.createElement(StyledButton, _extends({}, forwardedProps, buttonProps, {
2995
3164
  $color: color,
2996
3165
  $fullWidth: fullWidth,
@@ -3014,9 +3183,9 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
3014
3183
  className: "right"
3015
3184
  }) : null);
3016
3185
  });
3017
- Button.className = CLASSNAME$9;
3018
- Button.defaultProps = DEFAULT_PROPS$8;
3019
- Button.displayName = COMPONENT_NAME$9;
3186
+ Button.className = CLASSNAME$c;
3187
+ Button.defaultProps = DEFAULT_PROPS$b;
3188
+ Button.displayName = COMPONENT_NAME$c;
3020
3189
 
3021
3190
  /**
3022
3191
  * Component style.
@@ -3034,10 +3203,10 @@ const StyledFlexbox = styled.div`
3034
3203
  ${baseFlexbox}
3035
3204
  `;
3036
3205
 
3037
- const _excluded$8 = ["children", "className"];
3038
- const COMPONENT_NAME$8 = 'Flexbox';
3039
- const CLASSNAME$8 = 'redsift-flex-box';
3040
- const DEFAULT_PROPS$7 = {
3206
+ const _excluded$b = ["children", "className"];
3207
+ const COMPONENT_NAME$b = 'Flexbox';
3208
+ const CLASSNAME$b = 'redsift-flex-box';
3209
+ const DEFAULT_PROPS$a = {
3041
3210
  gap: '16px'
3042
3211
  };
3043
3212
 
@@ -3049,15 +3218,418 @@ const Flexbox = /*#__PURE__*/forwardRef((props, ref) => {
3049
3218
  children,
3050
3219
  className
3051
3220
  } = props,
3052
- forwardedProps = _objectWithoutProperties(props, _excluded$8);
3221
+ forwardedProps = _objectWithoutProperties(props, _excluded$b);
3053
3222
  return /*#__PURE__*/React.createElement(StyledFlexbox, _extends({}, forwardedProps, {
3054
3223
  className: classNames(Flexbox.className, className),
3055
3224
  ref: ref
3056
3225
  }), children);
3057
3226
  });
3058
- Flexbox.className = CLASSNAME$8;
3059
- Flexbox.defaultProps = DEFAULT_PROPS$7;
3060
- Flexbox.displayName = COMPONENT_NAME$8;
3227
+ Flexbox.className = CLASSNAME$b;
3228
+ Flexbox.defaultProps = DEFAULT_PROPS$a;
3229
+ Flexbox.displayName = COMPONENT_NAME$b;
3230
+
3231
+ /**
3232
+ * Context props.
3233
+ */
3234
+
3235
+ /**
3236
+ * Component orientation.
3237
+ */
3238
+ const CheckboxGroupOrientation = {
3239
+ horizontal: 'horizontal',
3240
+ vertical: 'vertical'
3241
+ };
3242
+
3243
+ const CheckboxGroupContext = /*#__PURE__*/React.createContext(null);
3244
+
3245
+ /**
3246
+ * Component style.
3247
+ */
3248
+ const StyledCheckboxGroup = styled.div`
3249
+ ${baseStyling}
3250
+
3251
+ display: flex;
3252
+ flex-direction: column;
3253
+
3254
+ ${_ref => {
3255
+ let {
3256
+ $orientation
3257
+ } = _ref;
3258
+ return $orientation === CheckboxGroupOrientation.vertical ? `
3259
+ div.redsift-checkbox-group-boxes {
3260
+ display: flex;
3261
+ flex-direction: column;
3262
+ }
3263
+ ` : `
3264
+ div.redsift-checkbox-group-boxes {
3265
+ display: flex;
3266
+ flex-direction: row;
3267
+ flex-wrap: wrap;
3268
+ }
3269
+ `;
3270
+ }}
3271
+
3272
+ span.redsift-checkbox-group-label {
3273
+ font-family: var(--redsift-typography-body-font-family);
3274
+ font-weight: var(--redsift-typography-body-font-weight);
3275
+ font-size: var(--redsift-typography-body-font-size);
3276
+ line-height: var(--redsift-typography-body-line-height);
3277
+
3278
+ color: var(--redsift-color-neutral-black);
3279
+ ${_ref2 => {
3280
+ let {
3281
+ $isDisabled
3282
+ } = _ref2;
3283
+ return $isDisabled ? `
3284
+ color: var(--redsift-color-neutral-midgrey);
3285
+ ` : '';
3286
+ }}
3287
+ ${_ref3 => {
3288
+ let {
3289
+ $isInvalid
3290
+ } = _ref3;
3291
+ return $isInvalid ? `
3292
+ color: var(--redsift-color-error-primary);
3293
+ ` : '';
3294
+ }}
3295
+ }
3296
+
3297
+ span.redsift-checkbox-group-description {
3298
+ font-family: var(--redsift-typography-helper-font-family);
3299
+ font-weight: var(--redsift-typography-helper-font-weight);
3300
+ font-size: var(--redsift-typography-helper-font-size);
3301
+ line-height: var(--redsift-typography-helper-line-height);
3302
+
3303
+ color: var(--redsift-color-neutral-darkgrey);
3304
+ ${_ref4 => {
3305
+ let {
3306
+ $isDisabled
3307
+ } = _ref4;
3308
+ return $isDisabled ? `
3309
+ color: var(--redsift-color-neutral-midgrey);
3310
+ ` : '';
3311
+ }}
3312
+ ${_ref5 => {
3313
+ let {
3314
+ $isInvalid
3315
+ } = _ref5;
3316
+ return $isInvalid ? `
3317
+ color: var(--redsift-color-error-primary);
3318
+ ` : '';
3319
+ }}
3320
+ }
3321
+ `;
3322
+
3323
+ const _excluded$a = ["children", "className", "defaultValues", "description", "isDisabled", "isInvalid", "isReadOnly", "isRequired", "label", "onChange", "orientation", "possibleValues", "value"];
3324
+ const COMPONENT_NAME$a = 'CheckboxGroup';
3325
+ const CLASSNAME$a = 'redsift-checkbox-group';
3326
+ const DEFAULT_PROPS$9 = {
3327
+ color: ColorPalette.default,
3328
+ orientation: CheckboxGroupOrientation.vertical
3329
+ };
3330
+
3331
+ /**
3332
+ * The CheckboxGroup component.
3333
+ * Can be used as controlled or uncontrolled.
3334
+ */
3335
+ const CheckboxGroup = /*#__PURE__*/forwardRef((props, ref) => {
3336
+ const {
3337
+ children,
3338
+ className,
3339
+ defaultValues,
3340
+ description,
3341
+ isDisabled,
3342
+ isInvalid,
3343
+ isReadOnly,
3344
+ isRequired,
3345
+ label,
3346
+ onChange,
3347
+ orientation,
3348
+ possibleValues,
3349
+ value
3350
+ } = props,
3351
+ forwardedProps = _objectWithoutProperties(props, _excluded$a);
3352
+ const [selectedValues, setValue] = useState(value || defaultValues || []);
3353
+ useEffect(() => {
3354
+ if (value) {
3355
+ state.setValue(value);
3356
+ }
3357
+ }, [value]);
3358
+ const state = {
3359
+ value: selectedValues,
3360
+ isDisabled: isDisabled || false,
3361
+ isReadOnly: isReadOnly || false,
3362
+ possibleValues: possibleValues,
3363
+ setValue(values) {
3364
+ if (isReadOnly || isDisabled) {
3365
+ return;
3366
+ }
3367
+ setValue(values);
3368
+ },
3369
+ addValue(value) {
3370
+ if (!selectedValues.includes(value)) {
3371
+ setValue(selectedValues.concat(value));
3372
+ if (onChange) {
3373
+ onChange(selectedValues.concat(value));
3374
+ }
3375
+ }
3376
+ },
3377
+ removeValue(value) {
3378
+ if (selectedValues.includes(value)) {
3379
+ setValue(selectedValues.filter(existingValue => existingValue !== value));
3380
+ if (onChange) {
3381
+ onChange(selectedValues.filter(existingValue => existingValue !== value));
3382
+ }
3383
+ }
3384
+ }
3385
+ };
3386
+ return /*#__PURE__*/React.createElement(StyledCheckboxGroup, _extends({}, forwardedProps, {
3387
+ $isDisabled: isDisabled,
3388
+ $isInvalid: isInvalid || isRequired && selectedValues.length === 0,
3389
+ $isReadOnly: isReadOnly,
3390
+ $orientation: orientation,
3391
+ "aria-disabled": isDisabled,
3392
+ className: classNames(CheckboxGroup.className, className),
3393
+ ref: ref,
3394
+ role: "group"
3395
+ }), /*#__PURE__*/React.createElement("span", {
3396
+ className: `${CheckboxGroup.className}-label`
3397
+ }, label, isRequired ? ' *' : null), /*#__PURE__*/React.createElement("div", {
3398
+ className: `${CheckboxGroup.className}-boxes`
3399
+ }, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
3400
+ value: state
3401
+ }, children)), /*#__PURE__*/React.createElement("span", {
3402
+ className: `${CheckboxGroup.className}-description`
3403
+ }, description));
3404
+ });
3405
+ CheckboxGroup.className = CLASSNAME$a;
3406
+ CheckboxGroup.defaultProps = DEFAULT_PROPS$9;
3407
+ CheckboxGroup.displayName = COMPONENT_NAME$a;
3408
+
3409
+ /**
3410
+ * Component style.
3411
+ */
3412
+ const StyledCheckbox = styled.label`
3413
+ height: fit-content;
3414
+ position: relative;
3415
+ width: fit-content;
3416
+ ${baseStyling}
3417
+
3418
+ align-items: baseline;
3419
+ background: none;
3420
+ border: none;
3421
+ display: inline-flex;
3422
+
3423
+ input {
3424
+ height: 100%;
3425
+ margin: 0;
3426
+ opacity: 0;
3427
+ overflow: visible;
3428
+ padding: 0;
3429
+ position: absolute;
3430
+ width: 100%;
3431
+ }
3432
+
3433
+ span.label {
3434
+ ${_ref => {
3435
+ let {
3436
+ $isDisabled,
3437
+ $isInvalid
3438
+ } = _ref;
3439
+ return $isDisabled ? css`
3440
+ color: var(--redsift-color-neutral-midgrey);
3441
+ ` : $isInvalid ? css`
3442
+ color: var(--redsift-color-error-primary);
3443
+ ` : css`
3444
+ color: var(--redsift-color-neutral-black);
3445
+ `;
3446
+ }}
3447
+
3448
+ font-family: var(--redsift-typography-body-font-family);
3449
+ font-size: var(--redsift-typography-body-font-size);
3450
+ font-weight: var(--redsift-typography-body-font-weight);
3451
+ line-height: var(--redsift-typography-body-line-height);
3452
+ padding-left: 4px;
3453
+ padding-right: 16px;
3454
+ position: relative;
3455
+ top: -4px;
3456
+
3457
+ [dir='rtl'] & {
3458
+ padding-left: 16px;
3459
+ padding-right: 4px;
3460
+ }
3461
+ }
3462
+
3463
+ .redsift-icon {
3464
+ padding: 2px;
3465
+ width: 24px;
3466
+
3467
+ ${_ref2 => {
3468
+ let {
3469
+ $isColored,
3470
+ $isDisabled,
3471
+ $isInvalid,
3472
+ $isFocusVisible
3473
+ } = _ref2;
3474
+ return css`
3475
+ ${$isDisabled ? css`
3476
+ color: var(--redsift-color-neutral-midgrey);
3477
+ ` : $isInvalid ? css`
3478
+ color: var(--redsift-color-error-primary);
3479
+ ` : css`
3480
+ color: var(
3481
+ --redsift-color-${$isColored ? 'default' : 'question'}-primary
3482
+ );
3483
+ `}
3484
+
3485
+ ${$isFocusVisible && !$isDisabled ? css`
3486
+ background-color: var(
3487
+ --redsift-color-${$isColored ? 'default' : 'question'}-hover
3488
+ );
3489
+ ` : ''}
3490
+ `;
3491
+ }}
3492
+ }
3493
+
3494
+ &:hover,
3495
+ &:focus-visible {
3496
+ outline: none;
3497
+
3498
+ ${_ref3 => {
3499
+ let {
3500
+ $isColored,
3501
+ $isDisabled
3502
+ } = _ref3;
3503
+ return !$isDisabled ? css`
3504
+ .redsift-icon {
3505
+ background-color: var(
3506
+ --redsift-color-${$isColored ? 'default' : 'question'}-hover
3507
+ );
3508
+ }
3509
+ ` : '';
3510
+ }}
3511
+ }
3512
+ `;
3513
+
3514
+ const _excluded$9 = ["aria-label", "aria-labelledby", "autoFocus", "children", "className", "defaultSelected", "inputProps", "inputRef", "isColored", "isControlled", "isDisabled", "isIndeterminate", "isInvalid", "isReadOnly", "isRequired", "isSelected", "name", "onChange", "value"];
3515
+ const COMPONENT_NAME$9 = 'Checkbox';
3516
+ const CLASSNAME$9 = 'redsift-checkbox';
3517
+ const DEFAULT_PROPS$8 = {
3518
+ isColored: true
3519
+ };
3520
+
3521
+ /**
3522
+ * The Checkbox component.
3523
+ * Works both inside a CheckboxGroup or as standalone.
3524
+ * Can be used as controlled or uncontrolled.
3525
+ */
3526
+ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
3527
+ var _isDisabled, _isReadOnly, _ref;
3528
+ const groupState = useContext(CheckboxGroupContext);
3529
+ let {
3530
+ 'aria-label': ariaLabel,
3531
+ 'aria-labelledby': ariaLabelledby,
3532
+ autoFocus,
3533
+ children,
3534
+ className,
3535
+ defaultSelected,
3536
+ inputProps,
3537
+ inputRef,
3538
+ isColored,
3539
+ isControlled,
3540
+ isDisabled,
3541
+ isIndeterminate,
3542
+ isInvalid,
3543
+ isReadOnly,
3544
+ isRequired,
3545
+ isSelected: propsIsSelected,
3546
+ name,
3547
+ onChange,
3548
+ value
3549
+ } = props,
3550
+ forwardedProps = _objectWithoutProperties(props, _excluded$9);
3551
+ const {
3552
+ isFocusVisible,
3553
+ focusProps
3554
+ } = $f7dceffc5ad7768b$export$4e328f61c538687f({
3555
+ autoFocus
3556
+ });
3557
+ isDisabled = (_isDisabled = isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : groupState === null || groupState === void 0 ? void 0 : groupState.isDisabled;
3558
+ isReadOnly = (_isReadOnly = isReadOnly) !== null && _isReadOnly !== void 0 ? _isReadOnly : groupState === null || groupState === void 0 ? void 0 : groupState.isReadOnly;
3559
+ const [isSelected, setSelected] = useState((_ref = propsIsSelected !== null && propsIsSelected !== void 0 ? propsIsSelected : defaultSelected) !== null && _ref !== void 0 ? _ref : groupState === null || groupState === void 0 ? void 0 : groupState.value.includes(value));
3560
+ useEffect(() => {
3561
+ setSelected(propsIsSelected !== null && propsIsSelected !== void 0 ? propsIsSelected : defaultSelected);
3562
+ }, [propsIsSelected, defaultSelected]);
3563
+ useEffect(() => {
3564
+ if (groupState) {
3565
+ setSelected(groupState.value.includes(value));
3566
+ }
3567
+ }, [groupState === null || groupState === void 0 ? void 0 : groupState.value]);
3568
+ warnIfNoAccessibleLabelFound(props, [children]);
3569
+ if (groupState && !isControlled) {
3570
+ if (propsIsSelected != null) {
3571
+ console.warn('isSelected is unsupported on individual <Checkbox> elements within a <CheckboxGroup> unless the <Checkbox> is controlled. Please apply this prop to the group instead or pass isControlled to the component.');
3572
+ }
3573
+ if (defaultSelected != null) {
3574
+ console.warn('defaultSelected is unsupported on individual <Checkbox> elements within a <CheckboxGroup> unless the <Checkbox> is controlled. Please apply this prop to the group instead or pass isControlled to the component.');
3575
+ }
3576
+ if (props.value == null) {
3577
+ console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property unless the <Checkbox> is controlled.');
3578
+ }
3579
+ }
3580
+ const handleChange = useCallback(event => {
3581
+ if (isDisabled || isReadOnly) {
3582
+ return;
3583
+ }
3584
+ if (groupState) {
3585
+ if (!groupState.value.includes(value)) {
3586
+ groupState.addValue(value);
3587
+ } else {
3588
+ groupState.removeValue(value);
3589
+ }
3590
+ }
3591
+ if (onChange) {
3592
+ onChange(!isSelected, value, name, event, groupState);
3593
+ }
3594
+ setSelected(event.target.checked);
3595
+ }, [onChange, groupState]);
3596
+ return /*#__PURE__*/React.createElement(StyledCheckbox, _extends({}, forwardedProps, {
3597
+ $isColored: isColored,
3598
+ $isDisabled: isDisabled,
3599
+ $isFocusVisible: isFocusVisible,
3600
+ $isInvalid: isInvalid || isRequired && !isSelected,
3601
+ $isRequired: isRequired,
3602
+ $isSelected: isSelected,
3603
+ className: classNames(Checkbox.className, className),
3604
+ ref: ref
3605
+ }), /*#__PURE__*/React.createElement("input", _extends({}, inputProps, focusProps, {
3606
+ "aria-checked": isSelected || isControlled && propsIsSelected ? 'true' : isIndeterminate ? 'mixed' : 'false',
3607
+ "aria-disabled": isDisabled,
3608
+ "aria-invalid": isInvalid || isRequired && !isSelected,
3609
+ "aria-label": ariaLabel,
3610
+ "aria-labelledby": ariaLabelledby,
3611
+ "aria-readonly": isReadOnly,
3612
+ "aria-required": isRequired,
3613
+ checked: isSelected ? true : false,
3614
+ disabled: isDisabled,
3615
+ name: name,
3616
+ onChange: handleChange,
3617
+ ref: inputRef,
3618
+ type: "checkbox",
3619
+ value: value
3620
+ })), isSelected || isControlled && propsIsSelected ? /*#__PURE__*/React.createElement(Icon, {
3621
+ icon: mdiCheckboxMarked
3622
+ }) : isIndeterminate ? /*#__PURE__*/React.createElement(Icon, {
3623
+ icon: mdiMinusBox
3624
+ }) : /*#__PURE__*/React.createElement(Icon, {
3625
+ icon: mdiCheckboxBlankOutline
3626
+ }), children ? /*#__PURE__*/React.createElement("span", {
3627
+ className: "label"
3628
+ }, children) : null);
3629
+ });
3630
+ Checkbox.className = CLASSNAME$9;
3631
+ Checkbox.defaultProps = DEFAULT_PROPS$8;
3632
+ Checkbox.displayName = COMPONENT_NAME$9;
3061
3633
 
3062
3634
  /**
3063
3635
  * Component variant.
@@ -3176,10 +3748,10 @@ const StyledText = styled.span`
3176
3748
  }}
3177
3749
  `;
3178
3750
 
3179
- const _excluded$7 = ["as", "children", "className", "color", "fontFamily", "fontSize", "lineHeight", "noWrap", "variant"];
3180
- const COMPONENT_NAME$7 = 'Text';
3181
- const CLASSNAME$7 = 'redsift-text';
3182
- const DEFAULT_PROPS$6 = {
3751
+ const _excluded$8 = ["as", "children", "className", "color", "fontFamily", "fontSize", "lineHeight", "noWrap", "variant"];
3752
+ const COMPONENT_NAME$8 = 'Text';
3753
+ const CLASSNAME$8 = 'redsift-text';
3754
+ const DEFAULT_PROPS$7 = {
3183
3755
  fontFamily: FontFamily.raleway
3184
3756
  };
3185
3757
 
@@ -3198,7 +3770,7 @@ const Text = /*#__PURE__*/forwardRef((props, ref) => {
3198
3770
  noWrap,
3199
3771
  variant
3200
3772
  } = props,
3201
- forwardedProps = _objectWithoutProperties(props, _excluded$7);
3773
+ forwardedProps = _objectWithoutProperties(props, _excluded$8);
3202
3774
  return /*#__PURE__*/React.createElement(StyledText, _extends({
3203
3775
  as: as
3204
3776
  }, forwardedProps, {
@@ -3213,9 +3785,9 @@ const Text = /*#__PURE__*/forwardRef((props, ref) => {
3213
3785
  $variant: variant
3214
3786
  }), children);
3215
3787
  });
3216
- Text.className = CLASSNAME$7;
3217
- Text.defaultProps = DEFAULT_PROPS$6;
3218
- Text.displayName = COMPONENT_NAME$7;
3788
+ Text.className = CLASSNAME$8;
3789
+ Text.defaultProps = DEFAULT_PROPS$7;
3790
+ Text.displayName = COMPONENT_NAME$8;
3219
3791
 
3220
3792
  /**
3221
3793
  * Component style.
@@ -3224,10 +3796,10 @@ const StyledNumber = styled(StyledText)`
3224
3796
  font-family: var(--redsift-typography-font-family-source-code-pro);
3225
3797
  `;
3226
3798
 
3227
- const _excluded$6 = ["as", "className", "color", "compactDisplay", "currency", "currencyDisplay", "currencySign", "fontSize", "lineHeight", "localeMatcher", "maximumFractionDigits", "maximumSignificantDigits", "minimumFractionDigits", "minimumIntegerDigits", "minimumSignificantDigits", "notation", "noWrap", "numberingSystem", "roundingIncrement", "roundingMode", "roundingPriority", "signDisplay", "trailingZeroDisplay", "type", "unit", "unitDisplay", "useGrouping", "value", "variant"];
3228
- const COMPONENT_NAME$6 = 'Number';
3229
- const CLASSNAME$6 = 'redsift-number';
3230
- const DEFAULT_PROPS$5 = {
3799
+ const _excluded$7 = ["as", "className", "color", "compactDisplay", "currency", "currencyDisplay", "currencySign", "fontSize", "lineHeight", "localeMatcher", "maximumFractionDigits", "maximumSignificantDigits", "minimumFractionDigits", "minimumIntegerDigits", "minimumSignificantDigits", "notation", "noWrap", "numberingSystem", "roundingIncrement", "roundingMode", "roundingPriority", "signDisplay", "trailingZeroDisplay", "type", "unit", "unitDisplay", "useGrouping", "value", "variant"];
3800
+ const COMPONENT_NAME$7 = 'Number';
3801
+ const CLASSNAME$7 = 'redsift-number';
3802
+ const DEFAULT_PROPS$6 = {
3231
3803
  compactDisplay: 'short',
3232
3804
  currencyDisplay: 'symbol',
3233
3805
  currencySign: 'standard',
@@ -3276,7 +3848,7 @@ const Number$1 = /*#__PURE__*/forwardRef((props, ref) => {
3276
3848
  value,
3277
3849
  variant
3278
3850
  } = props,
3279
- forwardedProps = _objectWithoutProperties(props, _excluded$6);
3851
+ forwardedProps = _objectWithoutProperties(props, _excluded$7);
3280
3852
  const formatter = $a916eb452884faea$export$b7a616150fdb9f44(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
3281
3853
  compactDisplay,
3282
3854
  currency,
@@ -3323,9 +3895,9 @@ const Number$1 = /*#__PURE__*/forwardRef((props, ref) => {
3323
3895
  $variant: variant
3324
3896
  }), formatter.format(value));
3325
3897
  });
3326
- Number$1.className = CLASSNAME$6;
3327
- Number$1.defaultProps = DEFAULT_PROPS$5;
3328
- Number$1.displayName = COMPONENT_NAME$6;
3898
+ Number$1.className = CLASSNAME$7;
3899
+ Number$1.defaultProps = DEFAULT_PROPS$6;
3900
+ Number$1.displayName = COMPONENT_NAME$7;
3329
3901
 
3330
3902
  /**
3331
3903
  * Component style.
@@ -3357,9 +3929,9 @@ const StyledResetButton = styled(Button)`
3357
3929
  margin-top: 8px;
3358
3930
  `;
3359
3931
 
3360
- const COMPONENT_NAME$5 = 'ChartEmptyState';
3361
- const CLASSNAME$5 = 'redsift-chart-empty-state';
3362
- const DEFAULT_PROPS$4 = {
3932
+ const COMPONENT_NAME$6 = 'ChartEmptyState';
3933
+ const CLASSNAME$6 = 'redsift-chart-empty-state';
3934
+ const DEFAULT_PROPS$5 = {
3363
3935
  title: 'No Data Available',
3364
3936
  subtitle: 'Please check the applied filters',
3365
3937
  resetLabel: 'Reset all filters'
@@ -3508,9 +4080,9 @@ const ChartEmptyState = /*#__PURE__*/forwardRef((props, ref) => {
3508
4080
  onPress: onReset
3509
4081
  }, resetLabel) : null);
3510
4082
  });
3511
- ChartEmptyState.className = CLASSNAME$5;
3512
- ChartEmptyState.defaultProps = DEFAULT_PROPS$4;
3513
- ChartEmptyState.displayName = COMPONENT_NAME$5;
4083
+ ChartEmptyState.className = CLASSNAME$6;
4084
+ ChartEmptyState.defaultProps = DEFAULT_PROPS$5;
4085
+ ChartEmptyState.displayName = COMPONENT_NAME$6;
3514
4086
 
3515
4087
  const initialState = {
3516
4088
  tableFilters: []
@@ -3592,10 +4164,10 @@ const DashboardReducer = (state, action) => {
3592
4164
  }
3593
4165
  };
3594
4166
 
3595
- const _excluded$5 = ["children", "className", "data"];
3596
- const COMPONENT_NAME$4 = 'Dashboard';
3597
- const CLASSNAME$4 = 'redsift-dashboard-container';
3598
- const DEFAULT_PROPS$3 = {};
4167
+ const _excluded$6 = ["children", "className", "data"];
4168
+ const COMPONENT_NAME$5 = 'Dashboard';
4169
+ const CLASSNAME$5 = 'redsift-dashboard-container';
4170
+ const DEFAULT_PROPS$4 = {};
3599
4171
  const Dashboard = /*#__PURE__*/forwardRef((props, ref) => {
3600
4172
  const providerRef = ref || useRef();
3601
4173
  const dataGridApiRef = useGridApiRef();
@@ -3604,7 +4176,7 @@ const Dashboard = /*#__PURE__*/forwardRef((props, ref) => {
3604
4176
  className,
3605
4177
  data
3606
4178
  } = props,
3607
- forwardedProps = _objectWithoutProperties(props, _excluded$5);
4179
+ forwardedProps = _objectWithoutProperties(props, _excluded$6);
3608
4180
  const [state, dispatch] = useReducer(DashboardReducer, {
3609
4181
  tableFilters: []
3610
4182
  });
@@ -3623,17 +4195,17 @@ const Dashboard = /*#__PURE__*/forwardRef((props, ref) => {
3623
4195
  value: value
3624
4196
  }, children));
3625
4197
  });
3626
- Dashboard.className = CLASSNAME$4;
3627
- Dashboard.defaultProps = DEFAULT_PROPS$3;
3628
- Dashboard.displayName = COMPONENT_NAME$4;
4198
+ Dashboard.className = CLASSNAME$5;
4199
+ Dashboard.defaultProps = DEFAULT_PROPS$4;
4200
+ Dashboard.displayName = COMPONENT_NAME$5;
3629
4201
 
3630
- const _excluded$4 = ["rows", "onFilter"];
4202
+ const _excluded$5 = ["rows", "onFilter"];
3631
4203
  const DataGrid = _ref => {
3632
4204
  let {
3633
4205
  rows,
3634
4206
  onFilter
3635
4207
  } = _ref,
3636
- props = _objectWithoutProperties(_ref, _excluded$4);
4208
+ props = _objectWithoutProperties(_ref, _excluded$5);
3637
4209
  const {
3638
4210
  state,
3639
4211
  data,
@@ -3896,10 +4468,10 @@ const useChartAsListbox = _ref => {
3896
4468
  }, [chart]);
3897
4469
  };
3898
4470
 
3899
- const _excluded$3 = ["aria-label", "aria-labelledby", "areXLabelsRotated", "caping", "caption", "className", "data", "datagridFilter", "dimension", "group", "isDimensionArray", "isResetable", "localeText", "onFilter", "others", "setLabels", "size", "theme", "title"];
3900
- const COMPONENT_NAME$3 = 'HorizontalBarChart';
3901
- const CLASSNAME$3 = 'redsift-horizontal-barchart';
3902
- const DEFAULT_PROPS$2 = {
4471
+ const _excluded$4 = ["aria-label", "aria-labelledby", "areXLabelsRotated", "caping", "caption", "className", "data", "datagridFilter", "dimension", "group", "isDimensionArray", "isResetable", "localeText", "onFilter", "others", "setLabels", "size", "theme", "title"];
4472
+ const COMPONENT_NAME$4 = 'HorizontalBarChart';
4473
+ const CLASSNAME$4 = 'redsift-horizontal-barchart';
4474
+ const DEFAULT_PROPS$3 = {
3903
4475
  isResetable: true,
3904
4476
  localeText: {
3905
4477
  resetLabel: 'Reset'
@@ -3908,7 +4480,7 @@ const DEFAULT_PROPS$2 = {
3908
4480
  size: HorizontalBarChartSize.medium,
3909
4481
  theme: HorizontalBarChartTheme.default
3910
4482
  };
3911
- const sizeToDimension$2 = size => {
4483
+ const sizeToDimension$3 = size => {
3912
4484
  switch (size) {
3913
4485
  case HorizontalBarChartSize.small:
3914
4486
  return {
@@ -3956,7 +4528,7 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
3956
4528
  theme,
3957
4529
  title
3958
4530
  } = props,
3959
- forwardedProps = _objectWithoutProperties(props, _excluded$3);
4531
+ forwardedProps = _objectWithoutProperties(props, _excluded$4);
3960
4532
 
3961
4533
  // Get overriden labels and texts.
3962
4534
  const {
@@ -3964,10 +4536,10 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
3964
4536
  emptyChartSubtitle,
3965
4537
  emptyChartResetLabel,
3966
4538
  resetLabel
3967
- } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$2.localeText), localeText);
4539
+ } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$3.localeText), localeText);
3968
4540
 
3969
4541
  // Get charts dimensions based on the selected size.
3970
- const chartDimensions = sizeToDimension$2(size);
4542
+ const chartDimensions = sizeToDimension$3(size);
3971
4543
 
3972
4544
  // Get ndx from context or initialize it.
3973
4545
  const {
@@ -4142,9 +4714,9 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
4142
4714
  id: `id${id}__caption`
4143
4715
  }, caption) : null);
4144
4716
  });
4145
- HorizontalBarChart.className = CLASSNAME$3;
4146
- HorizontalBarChart.defaultProps = DEFAULT_PROPS$2;
4147
- HorizontalBarChart.displayName = COMPONENT_NAME$3;
4717
+ HorizontalBarChart.className = CLASSNAME$4;
4718
+ HorizontalBarChart.defaultProps = DEFAULT_PROPS$3;
4719
+ HorizontalBarChart.displayName = COMPONENT_NAME$4;
4148
4720
 
4149
4721
  const BACKGROUND_COLOR = '#F8F8F8';
4150
4722
  const GREY_1 = '#E2E6EA';
@@ -4453,9 +5025,9 @@ const PdfDocument = _ref5 => {
4453
5025
  }))));
4454
5026
  };
4455
5027
 
4456
- const _excluded$2 = ["children", "className", "componentRef", "fileName", "introduction", "localeText", "logo", "onClick", "primaryColor"];
4457
- const COMPONENT_NAME$2 = 'PdfExportButton';
4458
- const CLASSNAME$2 = 'redsift-pdf-export-button';
5028
+ const _excluded$3 = ["children", "className", "componentRef", "fileName", "introduction", "localeText", "logo", "onClick", "primaryColor"];
5029
+ const COMPONENT_NAME$3 = 'PdfExportButton';
5030
+ const CLASSNAME$3 = 'redsift-pdf-export-button';
4459
5031
  const getDashboardImage = async componentRef => {
4460
5032
  var _componentRef$current, _componentRef$current2, _componentRef$current3, _componentRef$current4;
4461
5033
  const filter = el => {
@@ -4487,7 +5059,7 @@ const PdfExportButton = /*#__PURE__*/forwardRef((props, ref) => {
4487
5059
  onClick,
4488
5060
  primaryColor
4489
5061
  } = props,
4490
- forwardedProps = _objectWithoutProperties(props, _excluded$2);
5062
+ forwardedProps = _objectWithoutProperties(props, _excluded$3);
4491
5063
  const [componentRef, setComponentRef] = useState(propComponentRef);
4492
5064
  const [isLoading, setIsLoading] = useState(false);
4493
5065
  const {
@@ -4547,8 +5119,8 @@ const PdfExportButton = /*#__PURE__*/forwardRef((props, ref) => {
4547
5119
  color: "no-data"
4548
5120
  }) : null, ' ', children);
4549
5121
  });
4550
- PdfExportButton.className = CLASSNAME$2;
4551
- PdfExportButton.displayName = COMPONENT_NAME$2;
5122
+ PdfExportButton.className = CLASSNAME$3;
5123
+ PdfExportButton.displayName = COMPONENT_NAME$3;
4552
5124
 
4553
5125
  /**
4554
5126
  * Component style.
@@ -4647,10 +5219,10 @@ const StyledPieChartContainer = styled.div`
4647
5219
  }
4648
5220
  `;
4649
5221
 
4650
- const _excluded$1 = ["aria-label", "aria-labelledby", "caping", "caption", "className", "data", "datagridFilter", "isResetable", "labelVariant", "dimension", "group", "isDimensionArray", "localeText", "onFilter", "others", "setLabels", "size", "text", "middleText", "subtext", "theme", "title", "variant"];
4651
- const COMPONENT_NAME$1 = 'PieChart';
4652
- const CLASSNAME$1 = 'redsift-piechart';
4653
- const DEFAULT_PROPS$1 = {
5222
+ const _excluded$2 = ["aria-label", "aria-labelledby", "caping", "caption", "className", "data", "datagridFilter", "isResetable", "labelVariant", "dimension", "group", "isDimensionArray", "localeText", "onFilter", "others", "setLabels", "size", "text", "middleText", "subtext", "theme", "title", "variant"];
5223
+ const COMPONENT_NAME$2 = 'PieChart';
5224
+ const CLASSNAME$2 = 'redsift-piechart';
5225
+ const DEFAULT_PROPS$2 = {
4654
5226
  isResetable: true,
4655
5227
  labelVariant: PieChartLabelVariant.internal,
4656
5228
  localeText: {
@@ -4661,7 +5233,7 @@ const DEFAULT_PROPS$1 = {
4661
5233
  theme: PieChartTheme.default,
4662
5234
  variant: PieChartVariant.plain
4663
5235
  };
4664
- const sizeToDimension$1 = size => {
5236
+ const sizeToDimension$2 = size => {
4665
5237
  switch (size) {
4666
5238
  case PieChartSize.small:
4667
5239
  return {
@@ -4745,7 +5317,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
4745
5317
  title,
4746
5318
  variant
4747
5319
  } = props,
4748
- forwardedProps = _objectWithoutProperties(props, _excluded$1);
5320
+ forwardedProps = _objectWithoutProperties(props, _excluded$2);
4749
5321
 
4750
5322
  // Get overriden labels and texts.
4751
5323
  const {
@@ -4753,10 +5325,10 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
4753
5325
  emptyChartSubtitle,
4754
5326
  emptyChartResetLabel,
4755
5327
  resetLabel
4756
- } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$1.localeText), localeText);
5328
+ } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$2.localeText), localeText);
4757
5329
 
4758
5330
  // Get charts dimensions based on the selected size.
4759
- const chartDimensions = sizeToDimension$1(size);
5331
+ const chartDimensions = sizeToDimension$2(size);
4760
5332
  const externalRadiusPadding = 8;
4761
5333
  const innerRadius = sizeToInnerRadius(size);
4762
5334
 
@@ -4954,9 +5526,9 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
4954
5526
  id: `id${id}__caption`
4955
5527
  }, caption) : null);
4956
5528
  });
4957
- PieChart.className = CLASSNAME$1;
4958
- PieChart.defaultProps = DEFAULT_PROPS$1;
4959
- PieChart.displayName = COMPONENT_NAME$1;
5529
+ PieChart.className = CLASSNAME$2;
5530
+ PieChart.defaultProps = DEFAULT_PROPS$2;
5531
+ PieChart.displayName = COMPONENT_NAME$2;
4960
5532
 
4961
5533
  /**
4962
5534
  * Component size.
@@ -5055,10 +5627,10 @@ const StyledTimeSeriesBarChartContainer = styled.div`
5055
5627
  }
5056
5628
  `;
5057
5629
 
5058
- const _excluded = ["areXLabelsRotated", "caption", "className", "columnToFilter", "data", "dateTimeFieldName", "dateTimeFormat", "dateTimeGroup", "dimension", "isResetable", "localeText", "onFilter", "size", "theme", "title", "stackedCategory", "xAxisLabel", "yAxisLabel"];
5059
- const COMPONENT_NAME = 'TimeSeriesBarChart';
5060
- const CLASSNAME = 'redsift-timeseries-barchart';
5061
- const DEFAULT_PROPS = {
5630
+ const _excluded$1 = ["areXLabelsRotated", "caption", "className", "columnToFilter", "data", "dateTimeFieldName", "dateTimeFormat", "dateTimeGroup", "dimension", "isResetable", "localeText", "onFilter", "size", "theme", "title", "stackedCategory", "xAxisLabel", "yAxisLabel"];
5631
+ const COMPONENT_NAME$1 = 'TimeSeriesBarChart';
5632
+ const CLASSNAME$1 = 'redsift-timeseries-barchart';
5633
+ const DEFAULT_PROPS$1 = {
5062
5634
  dateTimeFormat: '%Y-%m-%d %H:%M:%S',
5063
5635
  dateTimeGroup: 'month',
5064
5636
  isResetable: true,
@@ -5069,7 +5641,7 @@ const DEFAULT_PROPS = {
5069
5641
  };
5070
5642
  const getStartDate = dates => new Date(Math.min(...dates.map(Number)));
5071
5643
  const getEndDate = dates => new Date(Math.max(...dates.map(Number)));
5072
- const sizeToDimension = size => {
5644
+ const sizeToDimension$1 = size => {
5073
5645
  switch (size) {
5074
5646
  case TimeSeriesBarChartSize.small:
5075
5647
  return {
@@ -5156,20 +5728,20 @@ const TimeSeriesBarChart = /*#__PURE__*/forwardRef((props, ref) => {
5156
5728
  columnToFilter,
5157
5729
  data,
5158
5730
  dateTimeFieldName,
5159
- dateTimeFormat = DEFAULT_PROPS.dateTimeFormat,
5160
- dateTimeGroup = DEFAULT_PROPS.dateTimeGroup,
5731
+ dateTimeFormat = DEFAULT_PROPS$1.dateTimeFormat,
5732
+ dateTimeGroup = DEFAULT_PROPS$1.dateTimeGroup,
5161
5733
  dimension,
5162
5734
  isResetable,
5163
5735
  localeText,
5164
5736
  onFilter,
5165
- size = DEFAULT_PROPS.size,
5737
+ size = DEFAULT_PROPS$1.size,
5166
5738
  theme = props.stackedCategory ? TimeSeriesBarChartTheme.default : TimeSeriesBarChartTheme.monochrome,
5167
5739
  title,
5168
5740
  stackedCategory,
5169
5741
  xAxisLabel,
5170
5742
  yAxisLabel
5171
5743
  } = props,
5172
- forwardedProps = _objectWithoutProperties(props, _excluded);
5744
+ forwardedProps = _objectWithoutProperties(props, _excluded$1);
5173
5745
 
5174
5746
  // Get overriden labels and texts.
5175
5747
  const {
@@ -5177,10 +5749,10 @@ const TimeSeriesBarChart = /*#__PURE__*/forwardRef((props, ref) => {
5177
5749
  emptyChartSubtitle,
5178
5750
  emptyChartResetLabel,
5179
5751
  resetLabel
5180
- } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS.localeText), localeText);
5752
+ } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$1.localeText), localeText);
5181
5753
 
5182
5754
  // Get charts dimensions based on the selected size.
5183
- const chartDimensions = sizeToDimension(size);
5755
+ const chartDimensions = sizeToDimension$1(size);
5184
5756
 
5185
5757
  // Get ndx from context or initialize it.
5186
5758
  const {
@@ -5399,9 +5971,783 @@ const TimeSeriesBarChart = /*#__PURE__*/forwardRef((props, ref) => {
5399
5971
  id: `id${id}__caption`
5400
5972
  }, caption) : null);
5401
5973
  });
5402
- TimeSeriesBarChart.className = CLASSNAME;
5403
- TimeSeriesBarChart.defaultProps = DEFAULT_PROPS;
5404
- TimeSeriesBarChart.displayName = COMPONENT_NAME;
5974
+ TimeSeriesBarChart.className = CLASSNAME$1;
5975
+ TimeSeriesBarChart.defaultProps = DEFAULT_PROPS$1;
5976
+ TimeSeriesBarChart.displayName = COMPONENT_NAME$1;
5977
+
5978
+ /**
5979
+ * Component size.
5980
+ */
5981
+ const ScatterPlotSize = {
5982
+ xlarge: 'xlarge',
5983
+ large: 'large',
5984
+ medium: 'medium',
5985
+ small: 'small'
5986
+ };
5987
+ /**
5988
+ * Component's labels variant.
5989
+ */
5990
+ const ScatterPlotLabelVariant = {
5991
+ none: 'none',
5992
+ label: 'label',
5993
+ labelValue: 'labelValue',
5994
+ labelPercent: 'labelPercent'
5995
+ };
5996
+ /**
5997
+ * Component theme.
5998
+ */
5999
+ const ScatterPlotTheme = ColorTheme;
6000
+
6001
+ /**
6002
+ * Component style.
6003
+ */
6004
+ const StyledScatterPlot = styled.div`
6005
+ margin: 8px;
6006
+ padding: 8px;
6007
+ color: var(--redsift-color-neutral-black);
6008
+
6009
+ .annotation-note-bg {
6010
+ fill-opacity: 0.8;
6011
+ }
6012
+
6013
+ .annotation-note-label,
6014
+ .annotation-note-title {
6015
+ fill: var(--redsift-color-neutral-black);
6016
+ }
6017
+
6018
+ .redsift-scatter-plot__chart {
6019
+ display: flex;
6020
+ font-family: var(--redsift-typography-font-family-source-code-pro);
6021
+ font-size: 12px;
6022
+ justify-content: center;
6023
+ margin: 8px 0;
6024
+ }
6025
+
6026
+ svg > g {
6027
+ margin: 8px;
6028
+ }
6029
+
6030
+ g.row {
6031
+ text {
6032
+ cursor: pointer;
6033
+ }
6034
+
6035
+ rect {
6036
+ fill-opacity: 0.9;
6037
+ cursor: pointer;
6038
+ }
6039
+
6040
+ rect.deselected {
6041
+ stroke: none;
6042
+ fill: var(--redsift-color-neutral-lightgrey);
6043
+ }
6044
+ }
6045
+
6046
+ g.row.focused,
6047
+ g.row:hover {
6048
+ rect {
6049
+ fill-opacity: 0.7;
6050
+ }
6051
+ }
6052
+
6053
+ g.row.focused rect.deselected {
6054
+ fill-opacity: 0.3;
6055
+ }
6056
+
6057
+ svg:hover,
6058
+ svg:focus {
6059
+ outline: none;
6060
+ }
6061
+
6062
+ svg:focus-visible {
6063
+ outline: auto;
6064
+ }
6065
+
6066
+ .axis {
6067
+ line.grid-line {
6068
+ fill: none;
6069
+ stroke: #ccc;
6070
+ shape-rendering: crispEdges;
6071
+ }
6072
+
6073
+ text {
6074
+ font-family: var(--redsift-typography-font-family-source-code-pro);
6075
+ font-size: 10px;
6076
+ }
6077
+ }
6078
+ `;
6079
+ const StyledScatterPlotTitle = styled(Flexbox)`
6080
+ font-family: var(--redsift-typography-h4-font-family);
6081
+ font-size: var(--redsift-typography-h4-font-size);
6082
+ font-weight: var(--redsift-typography-h4-font-weight);
6083
+ line-height: var(--redsift-typography-h4-line-height);
6084
+ `;
6085
+ const StyledScatterPlotCaption = styled.p`
6086
+ font-family: var(--redsift-typography-caption-font-family);
6087
+ font-size: var(--redsift-typography-caption-font-size);
6088
+ font-weight: var(--redsift-typography-caption-font-weight);
6089
+ line-height: var(--redsift-typography-caption-line-height);
6090
+ `;
6091
+ const StyledScatterPlotContainer = styled.div`
6092
+ display: flex;
6093
+ align-items: center;
6094
+ gap: 16px;
6095
+ font-family: var(--redsift-typography-font-family-source-code-pro);
6096
+ font-size: 11px;
6097
+ justify-content: center;
6098
+ margin: 8px 0;
6099
+ position: relative;
6100
+
6101
+ .redsift-scatter-plot-container__chart {
6102
+ position: relative;
6103
+ ${_ref => {
6104
+ let {
6105
+ $isEmpty
6106
+ } = _ref;
6107
+ return $isEmpty ? css`
6108
+ display: none;
6109
+ ` : '';
6110
+ }};
6111
+ }
6112
+ `;
6113
+ const StyledScatterPlotLabel = styled.li`
6114
+ display: flex;
6115
+ align-items: center;
6116
+ gap: 8px;
6117
+ width: 100%;
6118
+ max-width: 262px;
6119
+ font-size: var(--redsift-typography-caption-font-size);
6120
+ cursor: pointer;
6121
+ opacity: ${_ref2 => {
6122
+ let {
6123
+ $isSelected
6124
+ } = _ref2;
6125
+ return $isSelected ? 1 : 0.3;
6126
+ }};
6127
+
6128
+ > div {
6129
+ height: 16px;
6130
+ width: 16px;
6131
+ min-width: 16px;
6132
+ background-color: ${_ref3 => {
6133
+ let {
6134
+ $color
6135
+ } = _ref3;
6136
+ return $color;
6137
+ }};
6138
+ }
6139
+ `;
6140
+
6141
+ const getMinMax = (data, dimension) => {
6142
+ const xValues = data.map(d => dimension(d)[0]);
6143
+ const yValues = data.map(d => dimension(d)[1]);
6144
+ return {
6145
+ minX: Math.min(...xValues),
6146
+ maxX: Math.max(...xValues),
6147
+ minY: Math.min(...yValues),
6148
+ maxY: Math.max(...yValues)
6149
+ };
6150
+ };
6151
+
6152
+ const _excluded = ["annotations", "caption", "className", "data", "datagridFilter", "dimension", "isResetable", "labelVariant", "localeText", "size", "theme", "title"];
6153
+ const COMPONENT_NAME = 'ScatterPlot';
6154
+ const CLASSNAME = 'redsift-scatter-plot';
6155
+ const DEFAULT_PROPS = {
6156
+ isResetable: true,
6157
+ localeText: {
6158
+ resetLabel: 'Reset'
6159
+ },
6160
+ size: ScatterPlotSize.large,
6161
+ theme: ScatterPlotTheme.default,
6162
+ labelVariant: ScatterPlotLabelVariant.label
6163
+ };
6164
+ const sizeToDimension = size => {
6165
+ if (typeof size !== 'string') {
6166
+ return size;
6167
+ }
6168
+ switch (size) {
6169
+ case ScatterPlotSize.small:
6170
+ return {
6171
+ width: 300,
6172
+ height: 200,
6173
+ dotSize: 6
6174
+ };
6175
+ case ScatterPlotSize.medium:
6176
+ default:
6177
+ return {
6178
+ width: 450,
6179
+ height: 300,
6180
+ dotSize: 9
6181
+ };
6182
+ case ScatterPlotSize.large:
6183
+ return {
6184
+ width: 600,
6185
+ height: 450,
6186
+ dotSize: 12
6187
+ };
6188
+ case ScatterPlotSize.xlarge:
6189
+ return {
6190
+ width: 900,
6191
+ height: 600,
6192
+ dotSize: 15
6193
+ };
6194
+ }
6195
+ };
6196
+ const getCategory = dimension => d => dimension(d)[2];
6197
+ const countBy = (arr, getProp) => {
6198
+ const counts = arr.reduce((prev, curr) => (prev[getProp(curr)] = ++prev[getProp(curr)] || 1, prev), {});
6199
+ return Object.keys(counts).map(key => ({
6200
+ key: key,
6201
+ value: counts[key]
6202
+ })).sort((a, b) => b.value - a.value);
6203
+ };
6204
+ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
6205
+ const containerRef = ref || useRef();
6206
+ const chartRef = useRef();
6207
+ const scatterPlotRef = useRef();
6208
+ const tooltip = useRef([]);
6209
+ const brushedRange = useRef();
6210
+ const brushedXDomain = useRef();
6211
+ const brushedYDomain = useRef();
6212
+ const id = useId();
6213
+ const {
6214
+ annotations,
6215
+ caption,
6216
+ className,
6217
+ data,
6218
+ datagridFilter,
6219
+ dimension,
6220
+ isResetable,
6221
+ labelVariant,
6222
+ localeText,
6223
+ size,
6224
+ theme,
6225
+ title
6226
+ } = props,
6227
+ forwardedProps = _objectWithoutProperties(props, _excluded);
6228
+ const [selectedFields, setSelectedFields] = useState(Array.isArray(annotations) ? annotations.map(annotation => annotation.key) : annotations === null || annotations === void 0 ? void 0 : annotations.defaultSelectedFields);
6229
+ const selectedFieldsRef = useRef(selectedFields);
6230
+
6231
+ // Get overriden labels and texts.
6232
+ const {
6233
+ emptyChartTitle,
6234
+ emptyChartSubtitle,
6235
+ emptyChartResetLabel,
6236
+ resetLabel
6237
+ } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS.localeText), localeText);
6238
+
6239
+ // Get charts dimensions based on the selected size.
6240
+ const chartDimensions = sizeToDimension(size);
6241
+
6242
+ // Get ndx from context or initialize it.
6243
+ const {
6244
+ ndx = crossfilter(data),
6245
+ dispatch,
6246
+ data: contextData
6247
+ } = useContext(DashboardContext);
6248
+ const filteredData = useRef([...ndx.all()]);
6249
+ const hasCategories = filteredData.current.length === 0 ? false : dimension(filteredData.current[0]).length === 3;
6250
+ const categories = useRef(filteredData.current.reduce((acc, curr) => {
6251
+ if (acc.indexOf(getCategory(dimension)(curr)) === -1) {
6252
+ acc.push(getCategory(dimension)(curr));
6253
+ }
6254
+ return acc;
6255
+ }, []));
6256
+ const selectedCategoriesRef = useRef([]);
6257
+
6258
+ // Set color scheme.
6259
+ const d3colors = () => {
6260
+ if (categories.current.length) {
6261
+ if (typeof theme === 'object') {
6262
+ return getColorScale(theme);
6263
+ }
6264
+ return d3.scaleOrdinal().domain(categories.current).range(scheme[theme]).unknown(monochrome);
6265
+ }
6266
+ return getColorScale(ScatterPlotTheme.monochrome);
6267
+ };
6268
+
6269
+ // useEffect called only once to initialize the chart.
6270
+ useEffect(() => {
6271
+ if (chartRef.current) {
6272
+ // Compute dimension and group.
6273
+ const {
6274
+ minX,
6275
+ maxX,
6276
+ minY,
6277
+ maxY
6278
+ } = getMinMax(filteredData.current, dimension);
6279
+ const {
6280
+ width,
6281
+ height,
6282
+ dotSize
6283
+ } = chartDimensions;
6284
+ selectedFieldsRef.current = selectedFields;
6285
+ const seriesSvgAnnotation = () => {
6286
+ // the underlying component that we are wrapping
6287
+ const d3Annot = d3Annotation.annotation();
6288
+ let xScale = d3.scaleLinear();
6289
+ let yScale = d3.scaleLinear();
6290
+ const join = fc.dataJoin('g', 'annotation');
6291
+ const series = selection => {
6292
+ selection.each((data, index, group) => {
6293
+ const projectedData = data.map(d => _objectSpread2(_objectSpread2({}, d), {}, {
6294
+ x: xScale(dimension(d)[0]),
6295
+ y: yScale(dimension(d)[1])
6296
+ }));
6297
+ d3Annot.annotations(projectedData);
6298
+ join(d3.select(group[index]), projectedData).call(d3Annot);
6299
+ });
6300
+ };
6301
+ series.xScale = function () {
6302
+ if (!arguments.length) {
6303
+ return xScale;
6304
+ }
6305
+ xScale = arguments.length <= 0 ? undefined : arguments[0];
6306
+ return series;
6307
+ };
6308
+ series.yScale = function () {
6309
+ if (!arguments.length) {
6310
+ return yScale;
6311
+ }
6312
+ yScale = arguments.length <= 0 ? undefined : arguments[0];
6313
+ return series;
6314
+ };
6315
+ fc.rebindAll(series, d3Annot);
6316
+ return series;
6317
+ };
6318
+ const createAnnotationData = d => {
6319
+ const isLeft = dimension(d)[0] < maxX - (maxX - minX) / 2;
6320
+ const isTop = dimension(d)[1] >= maxY - (maxY - minY) / 2;
6321
+ const hasNoFieldsToDisplay = !selectedFieldsRef.current || selectedFieldsRef.current.length === 0;
6322
+ return {
6323
+ note: hasNoFieldsToDisplay ? {} : {
6324
+ label: Object.entries(d).filter(_ref => {
6325
+ let [key] = _ref;
6326
+ return selectedFieldsRef.current.includes(key);
6327
+ }).map(_ref2 => {
6328
+ var _ref3, _ref3$find;
6329
+ let [key, value] = _ref2;
6330
+ return `${(_ref3 = Array.isArray(annotations) ? annotations : annotations === null || annotations === void 0 ? void 0 : annotations.selectableFields) === null || _ref3 === void 0 ? void 0 : (_ref3$find = _ref3.find(_ref4 => {
6331
+ let {
6332
+ key: k
6333
+ } = _ref4;
6334
+ return k === key;
6335
+ })) === null || _ref3$find === void 0 ? void 0 : _ref3$find.value}: ${value}`;
6336
+ }).join('\n'),
6337
+ bgPadding: 5,
6338
+ wrapSplitter: /\n/
6339
+ },
6340
+ x: dimension(d)[0],
6341
+ y: dimension(d)[1],
6342
+ dx: hasNoFieldsToDisplay ? 0 : isLeft ? 20 : -20,
6343
+ dy: hasNoFieldsToDisplay ? 0 : isTop ? 20 : -20
6344
+ };
6345
+ };
6346
+ const annotationSeries = seriesSvgAnnotation().type(d3Annotation.annotationCallout);
6347
+ const xScale = d3.scaleLinear().domain([minX, maxX]);
6348
+ const yScale = d3.scaleLinear().domain([minY, maxY]);
6349
+ const xScaleCopy = xScale.copy();
6350
+ const yScaleCopy = yScale.copy();
6351
+ const pointer = fc.pointer().on('point', _ref5 => {
6352
+ let [point] = _ref5;
6353
+ // https://roadtolarissa.com/scan-sorted/
6354
+ if (!point) return;
6355
+ const coord = {
6356
+ x: xScale.invert(point.x),
6357
+ y: yScale.invert(point.y)
6358
+ };
6359
+ const minPoint = d3.least(ndx.allFiltered(), d => {
6360
+ var dx = dimension(d)[0] - coord.x;
6361
+ var dy = dimension(d)[1] - coord.y;
6362
+ return dx * dx + dy * dy;
6363
+ });
6364
+ if (minPoint) {
6365
+ // @ts-ignore
6366
+ tooltip.current[0] = createAnnotationData(minPoint);
6367
+ }
6368
+ // @ts-ignore
6369
+ d3.select('d3fc-svg').node().requestRedraw();
6370
+ });
6371
+ const pointSeries = fc.seriesWebglPoint().equals((a, b) => a === b).size(dotSize).crossValue(d => dimension(d)[0]).mainValue(d => dimension(d)[1]).decorate((program, data) => {
6372
+ fc.webglFillColor().value(d => {
6373
+ const {
6374
+ r,
6375
+ g,
6376
+ b
6377
+ } = d3.color(d3colors()(dimension(d)[2]));
6378
+ return [(d.selected === false ? Math.round(r * (1 - 0.75) + 255 * 0.75) : r) / 255, (d.selected === false ? Math.round(g * (1 - 0.75) + 255 * 0.75) : g) / 255, (d.selected === false ? Math.round(b * (1 - 0.75) + 255 * 0.75) : b) / 255, 1];
6379
+ }).data(data)(program);
6380
+ });
6381
+ const brush = fc.brush().on('start', () => {
6382
+ brushedRange.current = undefined;
6383
+ brushedXDomain.current = undefined;
6384
+ brushedYDomain.current = undefined;
6385
+ el.datum({
6386
+ data: ndx.allFiltered().map(d => {
6387
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6388
+ selected: selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6389
+ });
6390
+ }),
6391
+ annotations: tooltip.current,
6392
+ brushedRange: brushedRange.current
6393
+ }).call(scatterPlot);
6394
+ if (datagridFilter) {
6395
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6396
+ type: DashboardReducerActionType.ResetFilter,
6397
+ filter: {
6398
+ id: `scatter-plot-${id}-min-x`,
6399
+ columnField: datagridFilter.x,
6400
+ operatorValue: '>='
6401
+ }
6402
+ });
6403
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6404
+ type: DashboardReducerActionType.ResetFilter,
6405
+ filter: {
6406
+ id: `scatter-plot-${id}-max-x`,
6407
+ columnField: datagridFilter.x,
6408
+ operatorValue: '<='
6409
+ }
6410
+ });
6411
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6412
+ type: DashboardReducerActionType.ResetFilter,
6413
+ filter: {
6414
+ id: `scatter-plot-${id}-min-y`,
6415
+ columnField: datagridFilter.y,
6416
+ operatorValue: '>='
6417
+ }
6418
+ });
6419
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6420
+ type: DashboardReducerActionType.ResetFilter,
6421
+ filter: {
6422
+ id: `scatter-plot-${id}-max-y`,
6423
+ columnField: datagridFilter.y,
6424
+ operatorValue: '<='
6425
+ }
6426
+ });
6427
+ }
6428
+ }).on('end', e => {
6429
+ if (e.selection) {
6430
+ brushedRange.current = e.selection;
6431
+ brushedXDomain.current = e.xDomain;
6432
+ brushedYDomain.current = e.yDomain;
6433
+ tooltip.current = [];
6434
+ el.datum({
6435
+ data: ndx.allFiltered().map(d => {
6436
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6437
+ selected: dimension(d)[0] >= brushedXDomain.current[0] && dimension(d)[0] <= brushedXDomain.current[1] && dimension(d)[1] >= brushedYDomain.current[0] && dimension(d)[1] <= brushedYDomain.current[1] && (selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d)))
6438
+ });
6439
+ }),
6440
+ annotations: tooltip.current,
6441
+ brushedRange: brushedRange.current
6442
+ }).call(scatterPlot);
6443
+ if (datagridFilter) {
6444
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6445
+ type: DashboardReducerActionType.AppendFilterTableBatch,
6446
+ filter: [{
6447
+ id: `scatter-plot-${id}-min-x`,
6448
+ columnField: datagridFilter.x,
6449
+ operatorValue: '>=',
6450
+ value: e.xDomain[0]
6451
+ }, {
6452
+ id: `scatter-plot-${id}-max-x`,
6453
+ columnField: datagridFilter.x,
6454
+ operatorValue: '<=',
6455
+ value: e.xDomain[1]
6456
+ }, {
6457
+ id: `scatter-plot-${id}-min-y`,
6458
+ columnField: datagridFilter.y,
6459
+ operatorValue: '>=',
6460
+ value: e.yDomain[0]
6461
+ }, {
6462
+ id: `scatter-plot-${id}-max-y`,
6463
+ columnField: datagridFilter.y,
6464
+ operatorValue: '<=',
6465
+ value: e.yDomain[1]
6466
+ }]
6467
+ });
6468
+ }
6469
+ } else if (brushedRange) {
6470
+ brushedRange.current = undefined;
6471
+ brushedXDomain.current = undefined;
6472
+ brushedYDomain.current = undefined;
6473
+ el.datum({
6474
+ data: ndx.allFiltered().map(d => {
6475
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6476
+ selected: selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6477
+ });
6478
+ }),
6479
+ annotations: tooltip.current,
6480
+ brushedRange: brushedRange.current
6481
+ }).call(scatterPlot);
6482
+ if (datagridFilter) {
6483
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6484
+ type: DashboardReducerActionType.ResetFilter,
6485
+ filter: {
6486
+ id: `scatter-plot-${id}-min-x`,
6487
+ columnField: datagridFilter.x,
6488
+ operatorValue: '>='
6489
+ }
6490
+ });
6491
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6492
+ type: DashboardReducerActionType.ResetFilter,
6493
+ filter: {
6494
+ id: `scatter-plot-${id}-max-x`,
6495
+ columnField: datagridFilter.x,
6496
+ operatorValue: '<='
6497
+ }
6498
+ });
6499
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6500
+ type: DashboardReducerActionType.ResetFilter,
6501
+ filter: {
6502
+ id: `scatter-plot-${id}-min-y`,
6503
+ columnField: datagridFilter.y,
6504
+ operatorValue: '>='
6505
+ }
6506
+ });
6507
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6508
+ type: DashboardReducerActionType.ResetFilter,
6509
+ filter: {
6510
+ id: `scatter-plot-${id}-max-y`,
6511
+ columnField: datagridFilter.y,
6512
+ operatorValue: '<='
6513
+ }
6514
+ });
6515
+ }
6516
+ }
6517
+ });
6518
+ const scatterPlot = fc.chartCartesian(xScale, yScale).webglPlotArea(fc.seriesWebglMulti().series([pointSeries]).mapping(d => d.data)).svgPlotArea(fc.seriesSvgMulti().series([annotationSeries, brush]).mapping((data, index, series) => {
6519
+ switch (series[index]) {
6520
+ case annotationSeries:
6521
+ return data.annotations;
6522
+ case brush:
6523
+ return data.brushedRange;
6524
+ }
6525
+ })).yOrient('left').decorate(sel => sel.enter().select('d3fc-svg.plot-area').call(pointer));
6526
+ const el = d3.select(chartRef.current).datum({
6527
+ data: ndx.allFiltered(),
6528
+ annotations: tooltip.current,
6529
+ brushedRange: brushedRange.current
6530
+ }).call(scatterPlot);
6531
+ el.style('height', `${height}px`);
6532
+ el.style('width', `${width}px`);
6533
+ const zoom = d3.zoom().filter(event => {
6534
+ if (event.type === 'mousedown' && event.which !== 2) {
6535
+ return false;
6536
+ }
6537
+ return true;
6538
+ }).scaleExtent([1, 500]).translateExtent([[0, 0], [width, height]]).on('zoom', _ref6 => {
6539
+ let {
6540
+ transform
6541
+ } = _ref6;
6542
+ xScale.domain(transform.rescaleX(xScaleCopy).domain());
6543
+ yScale.domain(transform.rescaleY(yScaleCopy).domain());
6544
+ brushedRange.current = undefined;
6545
+ brushedXDomain.current = undefined;
6546
+ brushedYDomain.current = undefined;
6547
+ el.datum({
6548
+ data: ndx.allFiltered().map(d => {
6549
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6550
+ selected: selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6551
+ });
6552
+ }),
6553
+ annotations: tooltip.current,
6554
+ brushedRange: brushedRange.current
6555
+ }).call(scatterPlot);
6556
+ });
6557
+ el.select('d3fc-svg.plot-area').on('measure.range', _ref7 => {
6558
+ let {
6559
+ detail
6560
+ } = _ref7;
6561
+ xScaleCopy.range([0, detail.width]);
6562
+ yScaleCopy.range([detail.height, 0]);
6563
+ }).call(zoom).on('dblclick.zoom', () => {
6564
+ el.select('d3fc-svg.plot-area').transition().duration(750).call(zoom.transform, d3.zoomIdentity);
6565
+ });
6566
+ ndx.onChange(() => {
6567
+ filteredData.current = ndx.allFiltered().map(d => {
6568
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6569
+ selected: brushedRange.current ? dimension(d)[0] >= brushedXDomain.current[0] && dimension(d)[0] <= brushedXDomain.current[1] && dimension(d)[1] >= brushedYDomain.current[0] && dimension(d)[1] <= brushedYDomain.current[1] && (selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))) : selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6570
+ });
6571
+ });
6572
+ d3.select(chartRef.current).datum({
6573
+ data: filteredData.current,
6574
+ annotations: tooltip.current,
6575
+ brushedRange: brushedRange.current
6576
+ }).call(scatterPlot);
6577
+ });
6578
+ scatterPlotRef.current = scatterPlot;
6579
+ }
6580
+ }, [data, contextData, selectedFields]);
6581
+ return /*#__PURE__*/React.createElement(StyledScatterPlot, _extends({}, forwardedProps, {
6582
+ className: classNames(ScatterPlot.className, className),
6583
+ ref: containerRef,
6584
+ onMouseLeave: () => {
6585
+ tooltip.current = [];
6586
+ d3.select(chartRef.current).datum({
6587
+ data: filteredData.current.map(d => {
6588
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6589
+ selected: brushedRange.current ? dimension(d)[0] >= brushedXDomain.current[0] && dimension(d)[0] <= brushedXDomain.current[1] && dimension(d)[1] >= brushedYDomain.current[0] && dimension(d)[1] <= brushedYDomain.current[1] && (selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))) : selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6590
+ });
6591
+ }),
6592
+ annotations: tooltip.current,
6593
+ brushedRange: brushedRange.current
6594
+ }).call(scatterPlotRef.current);
6595
+ }
6596
+ }), /*#__PURE__*/React.createElement(StyledScatterPlotTitle, {
6597
+ className: `${ScatterPlot.className}__title`,
6598
+ alignItems: "center"
6599
+ }, title ? /*#__PURE__*/React.createElement("div", {
6600
+ id: `id${id}__title`
6601
+ }, title) : null, isResetable ? /*#__PURE__*/React.createElement(Button, {
6602
+ variant: "unstyled",
6603
+ onPress: () => {
6604
+ brushedRange.current = undefined;
6605
+ brushedXDomain.current = undefined;
6606
+ brushedYDomain.current = undefined;
6607
+ if (filteredData.current) {
6608
+ filteredData.current = filteredData.current.map(d => {
6609
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6610
+ selected: undefined
6611
+ });
6612
+ });
6613
+ }
6614
+ if (chartRef.current && scatterPlotRef.current) {
6615
+ d3.select(chartRef.current).datum({
6616
+ data: filteredData.current,
6617
+ annotations: tooltip.current,
6618
+ brushedRange: brushedRange.current
6619
+ }).call(scatterPlotRef.current);
6620
+ }
6621
+ if (datagridFilter) {
6622
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6623
+ type: DashboardReducerActionType.ResetFilter,
6624
+ filter: {
6625
+ id: `scatter-plot-${id}-min-x`,
6626
+ columnField: datagridFilter.x,
6627
+ operatorValue: '>='
6628
+ }
6629
+ });
6630
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6631
+ type: DashboardReducerActionType.ResetFilter,
6632
+ filter: {
6633
+ id: `scatter-plot-${id}-max-x`,
6634
+ columnField: datagridFilter.x,
6635
+ operatorValue: '<='
6636
+ }
6637
+ });
6638
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6639
+ type: DashboardReducerActionType.ResetFilter,
6640
+ filter: {
6641
+ id: `scatter-plot-${id}-min-y`,
6642
+ columnField: datagridFilter.y,
6643
+ operatorValue: '>='
6644
+ }
6645
+ });
6646
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6647
+ type: DashboardReducerActionType.ResetFilter,
6648
+ filter: {
6649
+ id: `scatter-plot-${id}-max-y`,
6650
+ columnField: datagridFilter.y,
6651
+ operatorValue: '<='
6652
+ }
6653
+ });
6654
+ }
6655
+ }
6656
+ }, resetLabel) : null), /*#__PURE__*/React.createElement(StyledScatterPlotContainer, {
6657
+ className: `${ScatterPlot.className}__container`,
6658
+ $isEmpty: filteredData.current.length === 0
6659
+ }, /*#__PURE__*/React.createElement("div", {
6660
+ className: `${ScatterPlot.className}-container__chart`,
6661
+ ref: chartRef
6662
+ }), filteredData.current.length === 0 ? /*#__PURE__*/React.createElement(ChartEmptyState, {
6663
+ title: emptyChartTitle,
6664
+ subtitle: emptyChartSubtitle,
6665
+ resetLabel: emptyChartResetLabel,
6666
+ onReset: () => {
6667
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6668
+ type: DashboardReducerActionType.ResetFilters
6669
+ });
6670
+ }
6671
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, labelVariant !== ScatterPlotLabelVariant.none && filteredData.current && categories.current && hasCategories ? /*#__PURE__*/React.createElement("ul", null, countBy(filteredData.current, getCategory(dimension)).map((_ref8, index) => {
6672
+ let {
6673
+ key,
6674
+ value
6675
+ } = _ref8;
6676
+ return /*#__PURE__*/React.createElement(StyledScatterPlotLabel, {
6677
+ key: `pie-external-label _${index}`,
6678
+ $color: d3colors()(key),
6679
+ $isSelected: selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(key),
6680
+ onMouseDown: () => {
6681
+ if (selectedCategoriesRef.current.includes(key)) {
6682
+ selectedCategoriesRef.current = selectedCategoriesRef.current.filter(k => k !== key);
6683
+ } else {
6684
+ selectedCategoriesRef.current = [...selectedCategoriesRef.current, key];
6685
+ }
6686
+ tooltip.current = [];
6687
+ filteredData.current = filteredData.current.map(d => {
6688
+ return _objectSpread2(_objectSpread2({}, d), {}, {
6689
+ selected: brushedRange.current ? dimension(d)[0] >= brushedXDomain.current[0] && dimension(d)[0] <= brushedXDomain.current[1] && dimension(d)[1] >= brushedYDomain.current[0] && dimension(d)[1] <= brushedYDomain.current[1] && (selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))) : selectedCategoriesRef.current.length === 0 || selectedCategoriesRef.current.includes(getCategory(dimension)(d))
6690
+ });
6691
+ });
6692
+ if (datagridFilter && datagridFilter.category) {
6693
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({
6694
+ type: DashboardReducerActionType.FilterTable,
6695
+ filter: {
6696
+ id: `scatter-plot-${id}-category`,
6697
+ columnField: datagridFilter.category,
6698
+ operatorValue: 'isAnyOf',
6699
+ value: selectedCategoriesRef.current
6700
+ }
6701
+ });
6702
+ }
6703
+ },
6704
+ onMouseUp: () => {
6705
+ d3.select(chartRef.current).datum({
6706
+ data: filteredData.current,
6707
+ annotations: tooltip.current,
6708
+ brushedRange: brushedRange.current
6709
+ }).call(scatterPlotRef.current);
6710
+ }
6711
+ }, /*#__PURE__*/React.createElement("div", null), labelVariant === ScatterPlotLabelVariant.labelValue ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Number$1, {
6712
+ as: "b",
6713
+ maximumFractionDigits: 2,
6714
+ value: value,
6715
+ variant: "inherit"
6716
+ }), /*#__PURE__*/React.createElement(Text, {
6717
+ variant: "caption"
6718
+ }, key)) : labelVariant === ScatterPlotLabelVariant.labelPercent ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Number$1, {
6719
+ as: "b",
6720
+ maximumFractionDigits: 2,
6721
+ type: "percent",
6722
+ value: value / d3.sum(countBy(filteredData.current, getCategory(dimension)), d => d.value),
6723
+ variant: "inherit"
6724
+ }), /*#__PURE__*/React.createElement(Text, {
6725
+ variant: "caption"
6726
+ }, key)) : /*#__PURE__*/React.createElement(Text, {
6727
+ variant: "caption"
6728
+ }, key));
6729
+ })) : null)), !Array.isArray(annotations) && filteredData.current && annotations && annotations.selectableFields.length > 0 ? /*#__PURE__*/React.createElement(CheckboxGroup, {
6730
+ "aria-label": "Fields to display when hovering a dot",
6731
+ onChange: setSelectedFields,
6732
+ value: selectedFields,
6733
+ orientation: "horizontal"
6734
+ }, annotations.selectableFields.map(_ref9 => {
6735
+ let {
6736
+ key,
6737
+ value
6738
+ } = _ref9;
6739
+ return /*#__PURE__*/React.createElement(Checkbox, {
6740
+ key: key,
6741
+ value: key
6742
+ }, value);
6743
+ })) : null, caption ? /*#__PURE__*/React.createElement(StyledScatterPlotCaption, {
6744
+ className: `${ScatterPlot.className}__caption`,
6745
+ id: `id${id}__caption`
6746
+ }, caption) : null);
6747
+ });
6748
+ ScatterPlot.className = CLASSNAME;
6749
+ ScatterPlot.defaultProps = DEFAULT_PROPS;
6750
+ ScatterPlot.displayName = COMPONENT_NAME;
5405
6751
 
5406
- export { COUNT, ChartEmptyState, Dashboard, DashboardContext, DashboardReducer, DashboardReducerActionType, DataGrid, HorizontalBarChart, HorizontalBarChartSize, HorizontalBarChartTheme, PdfExportButton, PieChart, SUM, TimeSeriesBarChart, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, groupReduceSum, initialState };
6752
+ export { COUNT, ChartEmptyState, Dashboard, DashboardContext, DashboardReducer, DashboardReducerActionType, DataGrid, HorizontalBarChart, HorizontalBarChartSize, HorizontalBarChartTheme, PdfExportButton, PieChart, SUM, ScatterPlot, ScatterPlotLabelVariant, ScatterPlotSize, ScatterPlotTheme, TimeSeriesBarChart, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, groupReduceSum, initialState };
5407
6753
  //# sourceMappingURL=index.js.map