@mw-kit/mw-ui 1.7.96 → 1.7.98

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.
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TabProps, TabsProps } from '../../interfaces';
3
- declare const Close: <T>(props: Pick<TabsProps<T>, "onClose"> & {
3
+ declare const Close: (props: Pick<TabsProps, 'onClose'> & {
4
4
  index: number;
5
- active: [number, React.Dispatch<React.SetStateAction<number>>];
6
- options: [TabProps<T>[], React.Dispatch<React.SetStateAction<TabProps<T>[]>>];
5
+ active: Exclude<TabsProps['active'], number>;
6
+ options: [TabProps[], React.Dispatch<React.SetStateAction<TabProps[]>>];
7
7
  }) => JSX.Element;
8
8
  export default Close;
@@ -35,7 +35,7 @@ export interface TabsProps<T = {}> extends React.HTMLAttributes<HTMLDivElement>
35
35
  /**
36
36
  * React state to control which tab is active.
37
37
  */
38
- active: number | [number, React.Dispatch<React.SetStateAction<number>>];
38
+ active: number | [number, (active: number, data: T) => void];
39
39
  /**
40
40
  * Sets the style of the tabs to internal.
41
41
  */
package/dist/index.js CHANGED
@@ -14648,7 +14648,7 @@ var HiddenInput = styled__default.input(_templateObject4$a || (_templateObject4$
14648
14648
 
14649
14649
  var isAvailable = function isAvailable(index, option) {
14650
14650
  return !option.disabled && !(option.rules || []).some(function (rule) {
14651
- return rule(index, option) !== true;
14651
+ return rule(index, option.data) !== true;
14652
14652
  });
14653
14653
  };
14654
14654
 
@@ -14704,7 +14704,9 @@ var useNavigation = function useNavigation(props) {
14704
14704
  }, [highlight, options]);
14705
14705
 
14706
14706
  var onFocus = function onFocus() {
14707
- setHighlight(0);
14707
+ setHighlight(options.findIndex(function (e, i) {
14708
+ return isAvailable(i, e);
14709
+ }));
14708
14710
  };
14709
14711
 
14710
14712
  var onBlur = function onBlur() {
@@ -19433,8 +19435,11 @@ var Close$1 = function Close$1(props) {
19433
19435
  newOptions.splice(index, 1);
19434
19436
  onClose(index, options[index], event);
19435
19437
 
19436
- if (index < active || active === index && active > 0) {
19437
- setActive(active - 1);
19438
+ if (index < active) {
19439
+ setActive(active - 1, newOptions[active - 1].data);
19440
+ } else if (active === index) {
19441
+ var newactive = active > 0 ? active - 1 : active;
19442
+ setActive(newactive, newOptions[newactive].data);
19438
19443
  }
19439
19444
 
19440
19445
  setOptions(newOptions);
@@ -19486,7 +19491,7 @@ var Tabs$1 = function Tabs$1(props) {
19486
19491
  $active: true
19487
19492
  } : {
19488
19493
  onClick: function onClick() {
19489
- return setActive(index);
19494
+ return setActive(index, tab.data);
19490
19495
  }
19491
19496
  }, {
19492
19497
  "$internal": props.internal,