@mw-kit/mw-ui 1.7.11 → 1.7.13

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,13 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import { ElementOrString } from '../../../../interfaces';
3
3
  export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
4
- label?: ElementOrString;
4
+ label?: ElementOrString | {
5
+ label?: ElementOrString;
6
+ before?: ElementOrString;
7
+ after?: ElementOrString;
8
+ };
5
9
  required?: boolean;
6
10
  invalid?: boolean;
7
11
  type: 'switch';
8
12
  }
9
13
  export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
10
14
  disabled?: 1 | 0;
11
- required?: 1 | 0;
12
15
  invalid?: 1 | 0;
13
16
  }
17
+ export interface LabelContainerProps extends React.HTMLAttributes<HTMLDivElement> {
18
+ required?: 1 | 0;
19
+ }
@@ -1,3 +1,3 @@
1
- import { LabelProps } from './interfaces';
2
- export declare const LabelContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
1
+ import { LabelContainerProps, LabelProps } from './interfaces';
2
+ export declare const LabelContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, LabelContainerProps, never>;
3
3
  export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, LabelProps, never>;
@@ -30,6 +30,10 @@ export interface TabsProps {
30
30
  * Run an action when exceeding the maximum tab limit.
31
31
  */
32
32
  onMaxTabsExceeded?: (maxTabs?: number) => void;
33
+ /**
34
+ * disable close button
35
+ */
36
+ alwaysOpen?: true;
33
37
  }
34
38
  export interface StyledTabsProps {
35
39
  /**
package/dist/index.js CHANGED
@@ -12607,6 +12607,15 @@ var Tabs$1 = function Tabs$1(props) {
12607
12607
  });
12608
12608
  };
12609
12609
 
12610
+ var getClose = props.alwaysOpen ? function () {
12611
+ return undefined;
12612
+ } : function (index) {
12613
+ return React__default.createElement(SvgClose, {
12614
+ onClick: function onClick() {
12615
+ return removeTab(index);
12616
+ }
12617
+ });
12618
+ };
12610
12619
  return React__default.createElement(Container$6, null, React__default.createElement(Tabs, {
12611
12620
  internal: +(internal || false)
12612
12621
  }, tabs.map(function (tab, index) {
@@ -12616,11 +12625,7 @@ var Tabs$1 = function Tabs$1(props) {
12616
12625
  onClick: function onClick(event) {
12617
12626
  return updateActiveTab(index, event);
12618
12627
  }
12619
- }, React__default.createElement("span", null, tab.label), React__default.createElement(SvgClose, {
12620
- onClick: function onClick() {
12621
- return removeTab(index);
12622
- }
12623
- }));
12628
+ }, React__default.createElement("span", null, tab.label), getClose(index));
12624
12629
  })));
12625
12630
  };
12626
12631
 
@@ -15409,25 +15414,25 @@ var DatePicker = React__default.forwardRef(function (props, ref) {
15409
15414
  DatePicker.displayName = 'DatePicker';
15410
15415
 
15411
15416
  var _templateObject$r, _templateObject2$k, _templateObject3$g, _templateObject4$d, _templateObject5$c, _templateObject6$a, _templateObject7$9;
15412
- var LabelContainer$3 = styled__default.div(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n ", "\n line-height: 14px;\n display: flex;\n align-items: center;\n"])), function (_ref) {
15417
+ var LabelContainer$3 = styled__default.div(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n ", "\n line-height: 14px;\n display: flex;\n align-items: center;\n\n ", "\n"])), function (_ref) {
15413
15418
  var theme = _ref.theme;
15414
15419
  return theme.useTypography('p');
15420
+ }, function (_ref2) {
15421
+ var required = _ref2.required;
15422
+ if (!required) return;
15423
+ return styled.css(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n :after {\n content: '*';\n }\n "])));
15415
15424
  });
15416
- var Label$3 = styled__default.label(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: ", ";\n position: relative;\n\n ", "\n\n ", "\n\n ", "\n\n > input {\n position: absolute;\n height: 0%;\n width: 0%;\n opacity: 0;\n }\n\n > span {\n position: relative;\n width: 50px;\n height: calc(", " + 1px);\n background-color: ", ";\n border-radius: 20px;\n transition-property: background-color;\n transition-duration: 0.4s;\n transition-timing-function: ease-in-out;\n box-sizing: content-box;\n :before {\n content: '';\n transition-property: left;\n transition-duration: 0.4s;\n transition-timing-function: ease-in-out;\n position: absolute;\n border-width: 1px;\n border-style: solid;\n border-radius: 100%;\n left: 0;\n box-shadow: 0px 1px 3px ", ";\n width: calc(", " - 1px);\n height: calc(", " - 1px);\n background-color: ", ";\n }\n }\n\n > input:checked + span {\n :before {\n left: calc(100% - ", " - 1px);\n }\n }\n"])), function (_ref2) {
15417
- var theme = _ref2.theme;
15425
+ var Label$3 = styled__default.label(_templateObject3$g || (_templateObject3$g = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: ", ";\n position: relative;\n\n ", "\n\n ", "\n\n > input {\n position: absolute;\n height: 0%;\n width: 0%;\n opacity: 0;\n }\n\n > span {\n position: relative;\n width: 50px;\n height: calc(", " + 1px);\n background-color: ", ";\n border-radius: 20px;\n transition-property: background-color;\n transition-duration: 0.4s;\n transition-timing-function: ease-in-out;\n box-sizing: content-box;\n :before {\n content: '';\n transition-property: left;\n transition-duration: 0.4s;\n transition-timing-function: ease-in-out;\n position: absolute;\n border-width: 1px;\n border-style: solid;\n border-radius: 100%;\n left: 0;\n box-shadow: 0px 1px 3px ", ";\n width: calc(", " - 1px);\n height: calc(", " - 1px);\n background-color: ", ";\n }\n }\n\n > input:checked + span {\n :before {\n left: calc(100% - ", " - 1px);\n }\n }\n"])), function (_ref3) {
15426
+ var theme = _ref3.theme;
15418
15427
  return theme.spacings.s1;
15419
- }, function (_ref3) {
15420
- var disabled = _ref3.disabled;
15428
+ }, function (_ref4) {
15429
+ var disabled = _ref4.disabled;
15421
15430
 
15422
15431
  if (!disabled) {
15423
- return styled.css(_templateObject3$g || (_templateObject3$g = _taggedTemplateLiteralLoose(["\n > span {\n cursor: pointer;\n }\n "])));
15432
+ return styled.css(_templateObject4$d || (_templateObject4$d = _taggedTemplateLiteralLoose(["\n > span {\n cursor: pointer;\n }\n "])));
15424
15433
  }
15425
15434
 
15426
- return styled.css(_templateObject4$d || (_templateObject4$d = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
15427
- }, function (_ref4) {
15428
- var required = _ref4.required;
15429
- if (!required) return;
15430
- return styled.css(_templateObject5$c || (_templateObject5$c = _taggedTemplateLiteralLoose(["\n > ", " {\n :after {\n content: '*';\n }\n }\n "])), LabelContainer$3);
15435
+ return styled.css(_templateObject5$c || (_templateObject5$c = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
15431
15436
  }, function (_ref5) {
15432
15437
  var invalid = _ref5.invalid;
15433
15438
 
@@ -15472,18 +15477,21 @@ var Label$3 = styled__default.label(_templateObject2$k || (_templateObject2$k =
15472
15477
  });
15473
15478
 
15474
15479
  var Switch = function Switch(props) {
15475
- var label = props.label,
15476
- disabled = props.disabled,
15480
+ var disabled = props.disabled,
15477
15481
  required = props.required,
15478
15482
  invalid = props.invalid;
15483
+ var label = isObject(props.label) ? props.label : {
15484
+ label: props.label
15485
+ };
15479
15486
  var htmlProps = filterObject(props, ['label', 'invalid', 'required']);
15480
15487
  return React__default.createElement(Label$3, {
15481
15488
  disabled: disabled ? 1 : 0,
15482
- required: required ? 1 : 0,
15483
15489
  invalid: invalid ? 1 : 0
15484
- }, React__default.createElement("input", Object.assign({}, htmlProps, {
15490
+ }, label.label && React__default.createElement(LabelContainer$3, {
15491
+ required: required ? 1 : 0
15492
+ }, label.label), label.before && React__default.createElement(LabelContainer$3, null, label.before), React__default.createElement("input", Object.assign({}, htmlProps, {
15485
15493
  type: 'checkbox'
15486
- })), React__default.createElement("span", null), label && React__default.createElement(LabelContainer$3, null, label));
15494
+ })), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
15487
15495
  };
15488
15496
 
15489
15497
  var _templateObject$s, _templateObject2$l, _templateObject3$h, _templateObject4$e, _templateObject5$d, _templateObject6$b, _templateObject7$a, _templateObject8$7, _templateObject9$7, _templateObject10$4, _templateObject11$3, _templateObject12$2, _templateObject13$2, _templateObject14$2, _templateObject15$1, _templateObject16;