@mw-kit/mw-ui 1.7.12 → 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>;
package/dist/index.js CHANGED
@@ -15414,25 +15414,25 @@ var DatePicker = React__default.forwardRef(function (props, ref) {
15414
15414
  DatePicker.displayName = 'DatePicker';
15415
15415
 
15416
15416
  var _templateObject$r, _templateObject2$k, _templateObject3$g, _templateObject4$d, _templateObject5$c, _templateObject6$a, _templateObject7$9;
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"])), 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) {
15418
15418
  var theme = _ref.theme;
15419
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 "])));
15420
15424
  });
15421
- 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) {
15422
- 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;
15423
15427
  return theme.spacings.s1;
15424
- }, function (_ref3) {
15425
- var disabled = _ref3.disabled;
15428
+ }, function (_ref4) {
15429
+ var disabled = _ref4.disabled;
15426
15430
 
15427
15431
  if (!disabled) {
15428
- 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 "])));
15429
15433
  }
15430
15434
 
15431
- return styled.css(_templateObject4$d || (_templateObject4$d = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
15432
- }, function (_ref4) {
15433
- var required = _ref4.required;
15434
- if (!required) return;
15435
- 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 "])));
15436
15436
  }, function (_ref5) {
15437
15437
  var invalid = _ref5.invalid;
15438
15438
 
@@ -15477,18 +15477,21 @@ var Label$3 = styled__default.label(_templateObject2$k || (_templateObject2$k =
15477
15477
  });
15478
15478
 
15479
15479
  var Switch = function Switch(props) {
15480
- var label = props.label,
15481
- disabled = props.disabled,
15480
+ var disabled = props.disabled,
15482
15481
  required = props.required,
15483
15482
  invalid = props.invalid;
15483
+ var label = isObject(props.label) ? props.label : {
15484
+ label: props.label
15485
+ };
15484
15486
  var htmlProps = filterObject(props, ['label', 'invalid', 'required']);
15485
15487
  return React__default.createElement(Label$3, {
15486
15488
  disabled: disabled ? 1 : 0,
15487
- required: required ? 1 : 0,
15488
15489
  invalid: invalid ? 1 : 0
15489
- }, 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, {
15490
15493
  type: 'checkbox'
15491
- })), 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));
15492
15495
  };
15493
15496
 
15494
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;