@mw-kit/mw-ui 1.7.63 → 1.7.65

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,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { TabsProps } from './interfaces';
3
- declare const Tabs: (props: TabsProps) => JSX.Element;
3
+ declare const Tabs: (props: React.PropsWithChildren<TabsProps>) => JSX.Element;
4
4
  export default Tabs;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { SpacingOrZero, Spacings } from '../../interfaces';
2
3
  export declare type TabProps = {
3
4
  /**
4
5
  * Define the tab label.
@@ -9,7 +10,7 @@ export declare type TabProps = {
9
10
  */
10
11
  component?: JSX.Element;
11
12
  };
12
- export interface TabsProps {
13
+ export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
13
14
  /**
14
15
  * Array with available tabs.
15
16
  */
@@ -34,14 +35,22 @@ export interface TabsProps {
34
35
  * disable close button
35
36
  */
36
37
  alwaysOpen?: true;
38
+ /**
39
+ * border bottom style
40
+ */
41
+ delimiter?: 'blue' | 'grey' | 'none';
42
+ /**
43
+ * container spacing
44
+ */
45
+ spacing?: SpacingOrZero | Spacings;
37
46
  }
38
47
  export interface StyledTabsProps {
39
48
  /**
40
49
  * Sets the style of the tabs to internal.
41
50
  */
42
- internal?: number;
51
+ $internal?: TabsProps['internal'];
43
52
  /**
44
53
  * Sets the style of the tab to active.
45
54
  */
46
- active?: number;
55
+ $active?: boolean;
47
56
  }
@@ -1,4 +1,10 @@
1
- import { StyledTabsProps } from './interfaces';
2
- export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledTabsProps, never>;
3
- export declare const Tabs: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, StyledTabsProps, never>;
1
+ import { StyledTabsProps, TabsProps } from './interfaces';
2
+ export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
+ declare type TabsContainerProps = {
4
+ $internal?: TabsProps['internal'];
5
+ $delimiter?: TabsProps['delimiter'];
6
+ $spacing?: TabsProps['spacing'];
7
+ };
8
+ export declare const Tabs: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, TabsContainerProps, never>;
4
9
  export declare const Tab: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, StyledTabsProps, never>;
10
+ export {};
package/dist/index.js CHANGED
@@ -18867,56 +18867,57 @@ var ProgressBar = function ProgressBar(props) {
18867
18867
  return React__default.createElement(Container$m, null, React__default.createElement(Progress, Object.assign({}, props), React__default.createElement("div", null)), React__default.createElement("span", null, " ", props.value || '0', "%"));
18868
18868
  };
18869
18869
 
18870
- var _path$4n;
18870
+ var _templateObject$13, _templateObject2$P, _templateObject3$I, _templateObject4$v, _templateObject5$s, _templateObject6$q, _templateObject7$q, _templateObject8$m;
18871
+ var Container$n = styled__default.div(_templateObject$13 || (_templateObject$13 = _taggedTemplateLiteralLoose(["\n display: block;\n"])));
18872
+ var delimiters = {
18873
+ blue: ['blue'],
18874
+ grey: ['warningGray']
18875
+ };
18876
+ var Tabs = styled__default.ul(_templateObject2$P || (_templateObject2$P = _taggedTemplateLiteralLoose(["\n user-select: none;\n list-style: none;\n display: inline-flex;\n width: 100%;\n\n ", "\n\n ", ";\n\n gap: ", ";\n"])), function (_ref) {
18877
+ var spacing = _ref.$spacing;
18871
18878
 
18872
- function _extends$4w() {
18873
- _extends$4w = Object.assign ? Object.assign.bind() : function (target) {
18874
- for (var i = 1; i < arguments.length; i++) {
18875
- var source = arguments[i];
18879
+ var _getSpacings$split = getSpacings(spacing || {}, {
18880
+ top: '0',
18881
+ right: '0',
18882
+ bottom: 's4',
18883
+ left: '0'
18884
+ }).split(' '),
18885
+ top = _getSpacings$split[0],
18886
+ right = _getSpacings$split[1],
18887
+ bottom = _getSpacings$split[2],
18888
+ left = _getSpacings$split[3];
18889
+
18890
+ return styled.css(_templateObject3$I || (_templateObject3$I = _taggedTemplateLiteralLoose(["\n margin: ", " 0 ", " 0;\n padding: 0 ", " 0 ", ";\n "])), top, bottom, right, left);
18891
+ }, function (_ref2) {
18892
+ var theme = _ref2.theme,
18893
+ internal = _ref2.$internal,
18894
+ delimiter = _ref2.$delimiter;
18876
18895
 
18877
- for (var key in source) {
18878
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18879
- target[key] = source[key];
18880
- }
18881
- }
18896
+ var border = function () {
18897
+ if (delimiter === 'none') {
18898
+ return 'none';
18882
18899
  }
18883
18900
 
18884
- return target;
18885
- };
18886
- return _extends$4w.apply(this, arguments);
18887
- }
18888
-
18889
- function SvgClose(props) {
18890
- return /*#__PURE__*/React.createElement("svg", _extends$4w({
18891
- xmlns: "http://www.w3.org/2000/svg",
18892
- width: 24,
18893
- height: 24,
18894
- fill: "none",
18895
- stroke: "currentColor",
18896
- strokeWidth: 2,
18897
- strokeLinecap: "round",
18898
- strokeLinejoin: "round",
18899
- className: "close_svg__feather close_svg__feather-x"
18900
- }, props), _path$4n || (_path$4n = /*#__PURE__*/React.createElement("path", {
18901
- d: "M18 6L6 18M6 6l12 12"
18902
- })));
18903
- }
18901
+ return internal ? "1px solid " + theme.getColor.apply(theme, delimiters[delimiter || 'grey']) : "2px solid " + theme.getColor.apply(theme, delimiters[delimiter || 'blue']);
18902
+ }();
18904
18903
 
18905
- var _templateObject$13, _templateObject2$P, _templateObject3$I, _templateObject4$v, _templateObject5$s, _templateObject6$q;
18906
- var Container$n = styled__default.div(_templateObject$13 || (_templateObject$13 = _taggedTemplateLiteralLoose(["\n display: block;\n border-bottom-style: solid;\n\n ", "\n"])), function (_ref) {
18907
- var theme = _ref.theme,
18908
- internal = _ref.internal;
18909
- return styled.css(_templateObject2$P || (_templateObject2$P = _taggedTemplateLiteralLoose(["\n margin-bottom: ", ";\n border-bottom-width: ", ";\n border-bottom-color: ", ";\n "])), theme.spacings.s2, internal ? '1px' : '2px', internal ? theme.getColor('lightestGrey', 50) : theme.colors.blue);
18910
- });
18911
- var Tabs = styled__default.ul(_templateObject3$I || (_templateObject3$I = _taggedTemplateLiteralLoose(["\n user-select: none;\n list-style: none;\n display: inline-flex;\n gap: 1px;\n padding: 0;\n margin: 0;\n\n ", "\n"])), function (_ref2) {
18912
- var theme = _ref2.theme,
18913
- internal = _ref2.internal;
18914
- return styled.css(_templateObject4$v || (_templateObject4$v = _taggedTemplateLiteralLoose(["\n height: ", ";\n box-shadow: 0 0 10px 0 ", ";\n "])), internal ? '41px' : '49px', theme.getColor('black', 10));
18915
- });
18916
- var Tab = styled__default.li(_templateObject5$s || (_templateObject5$s = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 4px 4px 0 0;\n\n svg {\n transform: scale(calc(18 / 24));\n stroke-width: 2px;\n }\n\n ", "\n"])), function (_ref3) {
18904
+ return styled.css(_templateObject4$v || (_templateObject4$v = _taggedTemplateLiteralLoose(["\n border-bottom: ", ";\n\n + div {\n border: 1px solid ", ";\n border-top-width: 0px;\n border-radius: 0px 0px 2px 2px;\n padding: ", ";\n }\n "])), border, theme.getColor.apply(theme, delimiters.grey), theme.spacings.s3);
18905
+ }, function (_ref3) {
18917
18906
  var theme = _ref3.theme,
18918
- active = _ref3.active;
18919
- return styled.css(_templateObject6$q || (_templateObject6$q = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 0 ", ";\n gap: ", ";\n\n span {\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n\n color: ", ";\n }\n\n svg {\n stroke: ", ";\n\n &:hover {\n stroke: ", ";\n }\n }\n "])), theme.colors[active ? 'blue' : 'white'], theme.spacings.s2, theme.spacings.s2, theme.typographies.h2.fontFamily, theme.typographies.h2.fontSize, theme.typographies.h2.fontWeight, theme.colors[active ? 'white' : 'darkBlue'], theme.colors[active ? 'white' : 'darkBlue'], theme.colors.red);
18907
+ internal = _ref3.$internal;
18908
+ return internal ? theme.spacings.s6 : 0;
18909
+ });
18910
+ var Tab = styled__default.li(_templateObject5$s || (_templateObject5$s = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ", "\n"])), function (_ref4) {
18911
+ var theme = _ref4.theme,
18912
+ active = _ref4.$active,
18913
+ internal = _ref4.$internal;
18914
+ return styled.css(_templateObject6$q || (_templateObject6$q = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: ", ";\n gap: ", ";\n\n ", "\n\n span {\n color: ", ";\n }\n "])), theme.colors[active ? 'blue' : 'white'], theme.spacings.s3, theme.spacings.s3, internal ? styled.css(_templateObject7$q || (_templateObject7$q = _taggedTemplateLiteralLoose(["\n border-radius: 4px 4px 0 0;\n\n > span {\n ", "\n line-height: 17px;\n }\n "])), function (_ref5) {
18915
+ var theme = _ref5.theme;
18916
+ return theme.useTypography('h4');
18917
+ }) : styled.css(_templateObject8$m || (_templateObject8$m = _taggedTemplateLiteralLoose(["\n box-shadow: 0px 3px 6px ", ";\n\n > span {\n ", "\n line-height: 19px;\n }\n "])), theme.getColor('black', 15), function (_ref6) {
18918
+ var theme = _ref6.theme;
18919
+ return theme.useTypography('h2');
18920
+ }), theme.colors[active ? 'white' : 'darkBlue']);
18920
18921
  });
18921
18922
 
18922
18923
  var initialStatus = function initialStatus(active, length) {
@@ -18927,8 +18928,7 @@ var initialStatus = function initialStatus(active, length) {
18927
18928
 
18928
18929
  var Tabs$1 = function Tabs$1(props) {
18929
18930
  var options = props.options,
18930
- activeState = props.activeState,
18931
- internal = props.internal;
18931
+ activeState = props.activeState;
18932
18932
  var active = activeState[0],
18933
18933
  setActive = activeState[1];
18934
18934
 
@@ -19014,25 +19014,34 @@ var Tabs$1 = function Tabs$1(props) {
19014
19014
  });
19015
19015
  };
19016
19016
 
19017
- var Close = props.alwaysOpen ? function () {
19018
- return null;
19019
- } : SvgClose;
19020
- return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
19021
- internal: +(internal || false)
19017
+ var divProps = filterObject(props, ['options', 'activeState', 'internal', 'maxTabs', 'onMaxTabsExceeded', 'alwaysOpen', 'delimiter', 'spacing']);
19018
+ return React__default.createElement(Container$n, Object.assign({}, divProps), React__default.createElement(Tabs, {
19019
+ "$internal": props.internal,
19020
+ "$delimiter": props.delimiter,
19021
+ "$spacing": props.spacing
19022
19022
  }, options.reduce(function (elements, tab, index) {
19023
19023
  if (status[index] === 'closed') return elements;
19024
19024
  return [].concat(elements, [React__default.createElement(Tab, {
19025
19025
  key: index,
19026
- active: +(status[index] === 'active'),
19026
+ "$active": status[index] === 'active',
19027
+ "$internal": props.internal,
19027
19028
  onClick: function onClick(event) {
19028
19029
  return onClickActivate(index, event);
19029
19030
  }
19030
- }, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
19031
+ }, React__default.createElement("span", null, tab.label), !props.alwaysOpen && React__default.createElement(Icon, {
19032
+ type: 'feather',
19033
+ icon: 'x',
19031
19034
  onClick: function onClick() {
19032
19035
  return onClickClose(index);
19033
- }
19036
+ },
19037
+ width: '14px',
19038
+ height: '14px',
19039
+ strokeWidth: '3px',
19040
+ color: status[index] === 'active' ? 'white' : 'darkBlue'
19034
19041
  }))]);
19035
- }, [])));
19042
+ }, [])), props.children && React__default.createElement("div", {
19043
+ children: props.children
19044
+ }));
19036
19045
  };
19037
19046
 
19038
19047
  var _templateObject$14;