@mw-kit/mw-ui 1.7.106 → 1.7.108

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.
@@ -19503,6 +19503,14 @@ var hasChildren = function hasChildren(tabs, group) {
19503
19503
  return tab.group === group && !tab.primary;
19504
19504
  }) : false;
19505
19505
  };
19506
+ var mapComponents = function mapComponents(obj) {
19507
+ return obj;
19508
+ };
19509
+ var buildComponent = function buildComponent(component, provider) {
19510
+ return provider ? Object.assign(component, {
19511
+ provider: provider
19512
+ }) : component;
19513
+ };
19506
19514
 
19507
19515
  var _templateObject$19;
19508
19516
  var Close = styled.div(_templateObject$19 || (_templateObject$19 = _taggedTemplateLiteralLoose(["\n position: relative;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n background-color: var(--bgColor);\n color: var(--color);\n padding: 4px 8px;\n\n transition: --color 0.5s, --bgColor 0.5s;\n\n svg {\n width: 14px;\n height: 14px;\n\n * {\n transition: --color 0.5s;\n stroke: var(--color);\n }\n }\n"])));
@@ -19532,13 +19540,12 @@ var Close$1 = function Close$1(props) {
19532
19540
  return;
19533
19541
  }
19534
19542
 
19535
- if (index < active) {
19536
- setActive(active - 1, newOptions[active - 1].data);
19537
- } else if (active === index) {
19538
- var newactive = active > 0 ? active - 1 : active;
19539
- setActive(newactive, newOptions[newactive].data);
19540
- }
19543
+ var newactive = function () {
19544
+ if (index < active) return active - 1;
19545
+ return active > 0 ? active - 1 : active;
19546
+ }();
19541
19547
 
19548
+ setActive(newactive, newOptions[newactive].data);
19542
19549
  setOptions(newOptions);
19543
19550
  });
19544
19551
  } catch (e) {
@@ -19616,10 +19623,11 @@ var TabItem = function TabItem(props) {
19616
19623
  _props$tabs = props.tabs,
19617
19624
  tabs = _props$tabs[0],
19618
19625
  setTabs = _props$tabs[1],
19626
+ sortedTabs = props.sortedTabs,
19619
19627
  onClose = props.onClose,
19620
19628
  alwaysOpen = props.alwaysOpen;
19621
19629
  var CloseComponent = alwaysOpen || tabs.length < 2 ? VoidClose : Close$1;
19622
- return React__default.createElement(React__default.Fragment, null, tabs.map(function (_ref) {
19630
+ return React__default.createElement(React__default.Fragment, null, sortedTabs.map(function (_ref) {
19623
19631
  var index = _ref.index,
19624
19632
  tab = _objectWithoutPropertiesLoose(_ref, _excluded$3);
19625
19633
 
@@ -19681,7 +19689,9 @@ var VoidProvider = function VoidProvider(props) {
19681
19689
  });
19682
19690
  };
19683
19691
 
19684
- var Tabs$1 = function Tabs$1(props) {
19692
+ var Component$3 = function Component(props) {
19693
+ var components = props.components || {};
19694
+
19685
19695
  var _ref = typeof props.options[1] === 'function' ? props.options : useState(props.options),
19686
19696
  options = _ref[0],
19687
19697
  setOptions = _ref[1];
@@ -19709,17 +19719,20 @@ var Tabs$1 = function Tabs$1(props) {
19709
19719
  internal: props.internal
19710
19720
  }), React__default.createElement(TabItem, {
19711
19721
  active: [active, setActive],
19712
- tabs: [sortedTabs, setOptions],
19722
+ tabs: [options, setOptions],
19723
+ sortedTabs: sortedTabs,
19713
19724
  onClose: props.onClose,
19714
19725
  alwaysOpen: props.alwaysOpen,
19715
19726
  internal: props.internal
19716
19727
  }))), options.map(function (tab, index) {
19717
- if (!('component' in tab)) return React__default.createElement(React__default.Fragment, {
19718
- key: index
19719
- });
19720
- var _tab$provider = tab.provider,
19721
- Provider = _tab$provider === void 0 ? VoidProvider : _tab$provider,
19722
- Component = tab.component;
19728
+ if (tab.component === undefined) {
19729
+ return React__default.createElement(React__default.Fragment, {
19730
+ key: index
19731
+ });
19732
+ }
19733
+
19734
+ var Component = components[tab.component];
19735
+ var Provider = Component.provider || VoidProvider;
19723
19736
 
19724
19737
  var setTab = function setTab(s) {
19725
19738
  setOptions(function (prev) {
@@ -19747,10 +19760,11 @@ var Tabs$1 = function Tabs$1(props) {
19747
19760
  data: tab.data,
19748
19761
  setTab: setTab,
19749
19762
  setLabel: setLabel
19750
- }, index === activeTabIndex ? {
19763
+ }, index === active ? {
19751
19764
  active: true,
19752
19765
  children: React__default.createElement("div", null, React__default.createElement(Component, {
19753
19766
  data: tab.data,
19767
+ label: tab.label,
19754
19768
  setLabel: setLabel
19755
19769
  }))
19756
19770
  } : {
@@ -19759,6 +19773,11 @@ var Tabs$1 = function Tabs$1(props) {
19759
19773
  }));
19760
19774
  };
19761
19775
 
19776
+ var Tabs$1 = Object.assign(Component$3, {
19777
+ mapComponents: mapComponents,
19778
+ buildComponent: buildComponent
19779
+ });
19780
+
19762
19781
  var _templateObject$1d;
19763
19782
  var Container$q = styled.textarea(_templateObject$1d || (_templateObject$1d = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n resize: none;\n outline: 0;\n border: 1px solid #c8c8c8;\n padding: 14px;\n border-radius: 4px;\n color: #192338;\n"])), function (props) {
19764
19783
  return "" + props.width;