@luscii-healthtech/web-ui 6.2.0 → 6.2.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.
@@ -2580,7 +2580,38 @@ const keyCodes = {
2580
2580
  SHIFT: 16,
2581
2581
  ESC: 27
2582
2582
  };
2583
- const _Dropdown = class _Dropdown extends React.PureComponent {
2583
+ const addHighlightIndexToItems = (items) => {
2584
+ let index = 0;
2585
+ return items.map((item) => {
2586
+ if (!item.subItems) {
2587
+ const currentIndex = index;
2588
+ index = index + 1;
2589
+ return __spreadProps$4(__spreadValues$5({}, item), {
2590
+ highlightIndex: currentIndex
2591
+ });
2592
+ } else {
2593
+ return __spreadProps$4(__spreadValues$5({}, item), {
2594
+ subItems: item.subItems.map((subItem) => {
2595
+ const currentIndex = index;
2596
+ index = index + 1;
2597
+ return __spreadProps$4(__spreadValues$5({}, subItem), {
2598
+ highlightIndex: currentIndex
2599
+ });
2600
+ })
2601
+ });
2602
+ }
2603
+ });
2604
+ };
2605
+ const getTotalItemCount = (items) => {
2606
+ return items.reduce((acc, item) => {
2607
+ if (!item.subItems) {
2608
+ return acc + 1;
2609
+ } else {
2610
+ return acc + item.subItems.length;
2611
+ }
2612
+ }, 0);
2613
+ };
2614
+ class Dropdown extends React.PureComponent {
2584
2615
  constructor(props) {
2585
2616
  super(props);
2586
2617
  __publicField$2(this, "handleClickOutside", (event) => {
@@ -2764,14 +2795,14 @@ const _Dropdown = class _Dropdown extends React.PureComponent {
2764
2795
  )
2765
2796
  );
2766
2797
  });
2767
- const items = _Dropdown.addHighlightIndexToItems(props.items);
2798
+ const items = addHighlightIndexToItems(props.items);
2768
2799
  const selectedItem = props.initialSelectedItemId ? this.findItem(
2769
2800
  items,
2770
2801
  ITEM_QUERY_FIELD_NAMES.ID,
2771
2802
  props.initialSelectedItemId
2772
2803
  ) : null;
2773
2804
  this.state = {
2774
- totalItemCount: _Dropdown.getTotalItemCount(items),
2805
+ totalItemCount: getTotalItemCount(items),
2775
2806
  isDropdownOpen: false,
2776
2807
  highlightIndex: null,
2777
2808
  selectedItem,
@@ -2779,10 +2810,10 @@ const _Dropdown = class _Dropdown extends React.PureComponent {
2779
2810
  };
2780
2811
  }
2781
2812
  static getDerivedStateFromProps(nextProps, prevState) {
2782
- const items = _Dropdown.addHighlightIndexToItems(nextProps.items);
2813
+ const items = addHighlightIndexToItems(nextProps.items);
2783
2814
  return __spreadProps$4(__spreadValues$5({}, prevState), {
2784
2815
  items,
2785
- totalItemCount: _Dropdown.getTotalItemCount(items)
2816
+ totalItemCount: getTotalItemCount(items)
2786
2817
  });
2787
2818
  }
2788
2819
  componentDidMount() {
@@ -2852,39 +2883,7 @@ const _Dropdown = class _Dropdown extends React.PureComponent {
2852
2883
  this.renderItems()
2853
2884
  );
2854
2885
  }
2855
- };
2856
- __publicField$2(_Dropdown, "addHighlightIndexToItems", (items) => {
2857
- let index = 0;
2858
- return items.map((item) => {
2859
- if (!item.subItems) {
2860
- const currentIndex = index;
2861
- index = index + 1;
2862
- return __spreadProps$4(__spreadValues$5({}, item), {
2863
- highlightIndex: currentIndex
2864
- });
2865
- } else {
2866
- return __spreadProps$4(__spreadValues$5({}, item), {
2867
- subItems: item.subItems.map((subItem) => {
2868
- const currentIndex = index;
2869
- index = index + 1;
2870
- return __spreadProps$4(__spreadValues$5({}, subItem), {
2871
- highlightIndex: currentIndex
2872
- });
2873
- })
2874
- });
2875
- }
2876
- });
2877
- });
2878
- __publicField$2(_Dropdown, "getTotalItemCount", (items) => {
2879
- return items.reduce((acc, item) => {
2880
- if (!item.subItems) {
2881
- return acc + 1;
2882
- } else {
2883
- return acc + item.subItems.length;
2884
- }
2885
- }, 0);
2886
- });
2887
- let Dropdown = _Dropdown;
2886
+ }
2888
2887
  Dropdown.propTypes = {
2889
2888
  items: PropTypes__default.default.arrayOf(
2890
2889
  PropTypes__default.default.oneOfType([