@mw-kit/mw-ui 1.7.4 → 1.7.5

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,6 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import { InputProps } from '../Input/interfaces';
2
3
  export declare type IntervalType = 'day' | 'week' | 'month' | 'custom';
3
- export interface DateIntervalPickerProps extends Omit<InputProps, 'type' | 'mask' | 'icon' | 'htmlDisabled' | 'clearable' | 'onPressEnter' | 'min' | 'max' | 'setValue'> {
4
+ export interface DateIntervalPickerProps extends React.HTMLAttributes<HTMLInputElement>, Pick<InputProps, 'label' | 'invalid' | 'required' | 'disabled' | 'width' | 'borderless' | 'paddingless'> {
4
5
  type: 'date-interval-picker';
5
6
  value: [string, string];
6
7
  setValue: (value: [string, string]) => void;
@@ -8,7 +8,12 @@ interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
8
8
  invalid: 1 | 0;
9
9
  disabled: 1 | 0;
10
10
  paddingless: 1 | 0;
11
+ borderless: 1 | 0;
11
12
  }
12
13
  export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContainerProps, never>;
13
14
  export declare const Button: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
15
+ interface StyledLabelTextProps {
16
+ required: 1 | 0;
17
+ }
18
+ export declare const LabelText: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, StyledLabelTextProps, never>;
14
19
  export {};
package/dist/index.js CHANGED
@@ -15322,8 +15322,8 @@ var parse = function parse(value) {
15322
15322
  });
15323
15323
  };
15324
15324
 
15325
- var _templateObject$q, _templateObject2$l, _templateObject3$j, _templateObject4$g, _templateObject5$f, _templateObject6$d, _templateObject7$b, _templateObject8$7, _templateObject9$7, _templateObject10$5;
15326
- var RelativeContainer$5 = styled__default.div(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n position: relative;\n user-select: none;\n min-width: 220px;\n\n > :nth-child(1) input {\n color: transparent;\n }\n"])));
15325
+ var _templateObject$q, _templateObject2$l, _templateObject3$j, _templateObject4$g, _templateObject5$f, _templateObject6$d, _templateObject7$b, _templateObject8$7, _templateObject9$7, _templateObject10$5, _templateObject11$4;
15326
+ var RelativeContainer$5 = styled__default.div(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n position: relative;\n user-select: none;\n min-width: 220px;\n\n > input,\n > label > input {\n color: transparent;\n background-color: transparent;\n width: 1px;\n height: 1px;\n position: absolute;\n left: 0;\n bottom: 0;\n border: 0;\n padding: 0;\n overflow: hidden;\n outline: none;\n box-shadow: none;\n }\n"])));
15327
15327
  var LabelContainer$3 = styled__default.div(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n ", "\n line-height: 17px;\n flex: 1;\n text-align: center;\n\n ", ";\n"])), function (_ref) {
15328
15328
  var theme = _ref.theme;
15329
15329
  return theme.useTypography('p');
@@ -15332,42 +15332,50 @@ var LabelContainer$3 = styled__default.div(_templateObject2$l || (_templateObjec
15332
15332
  if (!onClick) return;
15333
15333
  return styled.css(_templateObject3$j || (_templateObject3$j = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
15334
15334
  });
15335
- var Container$a = styled__default.div(_templateObject4$g || (_templateObject4$g = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 1px;\n left: 1px;\n display: flex;\n align-items: center;\n border-radius: 4px;\n white-space: nowrap;\n gap: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n\n width: 100%;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref3) {
15335
+ var Container$a = styled__default.div(_templateObject4$g || (_templateObject4$g = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n border-radius: 4px;\n white-space: nowrap;\n gap: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n\n width: 100%;\n\n ", ";\n\n ", "\n\n ", "\n"])), function (_ref3) {
15336
15336
  var theme = _ref3.theme;
15337
15337
  return theme.spacings.s1;
15338
15338
  }, function (_ref4) {
15339
15339
  var theme = _ref4.theme,
15340
- invalid = _ref4.invalid;
15340
+ invalid = _ref4.invalid,
15341
+ borderless = _ref4.borderless;
15342
+ if (borderless) return 'transparent';
15341
15343
  return invalid ? theme.colors.warningRed : theme.colors.lightGrey;
15342
15344
  }, function (_ref5) {
15343
15345
  var theme = _ref5.theme,
15344
- paddingless = _ref5.paddingless;
15345
- if (paddingless) return;
15346
- return styled.css(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n padding: ", " ", " ", "\n ", ";\n "])), theme.spacings.s2, theme.spacings.s1, theme.spacings.s2, theme.spacings.s3);
15347
- }, function (_ref6) {
15348
- var invalid = _ref6.invalid,
15349
- theme = _ref6.theme;
15350
- if (!invalid) return;
15351
- return styled.css(_templateObject6$d || (_templateObject6$d = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), theme.colors.warningRed);
15346
+ invalid = _ref5.invalid;
15347
+
15348
+ var _ref6 = invalid ? [theme.getColor('warningRed', 5), theme.colors.warningRed] : [theme.colors.white, theme.colors.darkBlue],
15349
+ bgColor = _ref6[0],
15350
+ color = _ref6[1];
15351
+
15352
+ return styled.css(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n /** google chrome blue background */\n -webkit-box-shadow: 0 0 0px 1000px ", " inset !important;\n "])), color, bgColor, bgColor);
15352
15353
  }, function (_ref7) {
15353
- var invalid = _ref7.invalid,
15354
- theme = _ref7.theme;
15355
- if (!invalid) return;
15356
- return styled.css(_templateObject7$b || (_templateObject7$b = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), theme.colors.warningRed);
15354
+ var theme = _ref7.theme,
15355
+ paddingless = _ref7.paddingless;
15356
+ if (paddingless) return;
15357
+ return styled.css(_templateObject6$d || (_templateObject6$d = _taggedTemplateLiteralLoose(["\n padding: ", " ", " ", "\n ", ";\n "])), theme.spacings.s2, theme.spacings.s1, theme.spacings.s2, theme.spacings.s3);
15357
15358
  }, function (_ref8) {
15358
15359
  var disabled = _ref8.disabled;
15359
15360
  if (!disabled) return;
15360
- return styled.css(_templateObject8$7 || (_templateObject8$7 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
15361
+ return styled.css(_templateObject7$b || (_templateObject7$b = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
15361
15362
  });
15362
- var Button$4 = styled__default.button(_templateObject9$7 || (_templateObject9$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n background-color: transparent;\n border: none;\n padding: 0;\n box-shadow: none;\n\n ", ";\n"])), function (_ref9) {
15363
+ var Button$4 = styled__default.button(_templateObject8$7 || (_templateObject8$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n background-color: transparent;\n border: none;\n padding: 0;\n box-shadow: none;\n\n ", ";\n"])), function (_ref9) {
15363
15364
  var onClick = _ref9.onClick;
15364
15365
  if (!onClick) return;
15365
- return styled.css(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
15366
+ return styled.css(_templateObject9$7 || (_templateObject9$7 = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
15367
+ });
15368
+ var LabelText$1 = styled__default.label(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n margin-bottom: ", ";\n\n ", "\n"])), function (_ref10) {
15369
+ var theme = _ref10.theme;
15370
+ return theme.spacings.s1;
15371
+ }, function (_ref11) {
15372
+ var required = _ref11.required;
15373
+ if (!required) return;
15374
+ return styled.css(_templateObject11$4 || (_templateObject11$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
15366
15375
  });
15367
15376
 
15368
15377
  var Component$1 = React__default.forwardRef(function (props, ref) {
15369
15378
  var value = parse(props.value);
15370
- var disabled = props.disabled || props.loading;
15371
15379
 
15372
15380
  var _useState = React.useState(null),
15373
15381
  open = _useState[0],
@@ -15410,7 +15418,7 @@ var Component$1 = React__default.forwardRef(function (props, ref) {
15410
15418
  var newIntervalType = identify(value);
15411
15419
  setIntervalType(newIntervalType);
15412
15420
  }, [props.value, props.min, props.max]);
15413
- var inputProps = filterObject(props, ['min', 'max']);
15421
+ var inputProps = filterObject(props, ['label', 'invalid', 'required', 'disabled', 'width', 'borderless', 'paddingless', 'type', 'value', 'setValue', 'getLabel', 'max', 'min', 'only']);
15414
15422
 
15415
15423
  var getArrowProps = function getArrowProps(key) {
15416
15424
  if (value.some(function (v) {
@@ -15447,7 +15455,7 @@ var Component$1 = React__default.forwardRef(function (props, ref) {
15447
15455
  var invalid = props.invalid || !validate(value, min, max);
15448
15456
 
15449
15457
  var onClick = function () {
15450
- if (inputProps.disabled || !['custom', undefined].includes(props.only)) {
15458
+ if (props.disabled || !['custom', undefined].includes(props.only)) {
15451
15459
  return undefined;
15452
15460
  }
15453
15461
 
@@ -15459,23 +15467,23 @@ var Component$1 = React__default.forwardRef(function (props, ref) {
15459
15467
  };
15460
15468
  }();
15461
15469
 
15470
+ var input = React__default.createElement("input", Object.assign({}, inputProps, {
15471
+ type: 'text',
15472
+ ref: ref,
15473
+ readOnly: true
15474
+ }));
15462
15475
  return React__default.createElement(RelativeContainer$5, {
15463
15476
  ref: useOnClickOut(function () {
15464
15477
  return setOpen(null);
15465
15478
  }),
15466
15479
  invalid: invalid
15467
- }, React__default.createElement(Input$1, Object.assign({}, inputProps, {
15468
- style: {
15469
- width: 0
15470
- },
15471
- type: 'text',
15472
- ref: ref,
15473
- borderless: true,
15474
- htmlDisabled: true
15475
- })), React__default.createElement(Container$a, {
15480
+ }, props.label ? React__default.createElement(LabelText$1, {
15481
+ required: props.required ? 1 : 0
15482
+ }, props.label, input) : input, React__default.createElement(Container$a, {
15476
15483
  invalid: props.invalid ? 1 : 0,
15477
15484
  disabled: props.disabled ? 1 : 0,
15478
- paddingless: props.paddingless ? 1 : 0
15485
+ paddingless: props.paddingless ? 1 : 0,
15486
+ borderless: props.borderless ? 1 : 0
15479
15487
  }, function () {
15480
15488
  var label = React__default.createElement(LabelContainer$3, {
15481
15489
  onClick: onClick
@@ -15488,7 +15496,7 @@ var Component$1 = React__default.forwardRef(function (props, ref) {
15488
15496
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(Button$4, Object.assign({
15489
15497
  type: 'button'
15490
15498
  }, decrementProps, {
15491
- disabled: disabled || decrementProps.disabled
15499
+ disabled: props.disabled || decrementProps.disabled
15492
15500
  }), React__default.createElement(Icon, {
15493
15501
  type: 'feather',
15494
15502
  icon: 'chevron_left',
@@ -15497,7 +15505,7 @@ var Component$1 = React__default.forwardRef(function (props, ref) {
15497
15505
  })), label, React__default.createElement(Button$4, Object.assign({
15498
15506
  type: 'button'
15499
15507
  }, incrementProps, {
15500
- disabled: disabled || incrementProps.disabled
15508
+ disabled: props.disabled || incrementProps.disabled
15501
15509
  }), React__default.createElement(Icon, {
15502
15510
  type: 'feather',
15503
15511
  icon: 'chevron_right',
@@ -16498,7 +16506,7 @@ var Toast = function Toast(props) {
16498
16506
  })), React__default.createElement(IconContent, null, React__default.createElement("h4", null, props.title), React__default.createElement("p", null, " ", props.description)));
16499
16507
  };
16500
16508
 
16501
- var _templateObject$C, _templateObject2$r, _templateObject3$o, _templateObject4$k, _templateObject5$j, _templateObject6$h, _templateObject7$e, _templateObject8$a, _templateObject9$a, _templateObject10$8, _templateObject11$4;
16509
+ var _templateObject$C, _templateObject2$r, _templateObject3$o, _templateObject4$k, _templateObject5$j, _templateObject6$h, _templateObject7$e, _templateObject8$a, _templateObject9$a, _templateObject10$8, _templateObject11$5;
16502
16510
  var Container$e = styled__default.div(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 300px;\n position: absolute;\n padding: 14px;\n"])));
16503
16511
  var Header$4 = styled__default.div(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n display: flex;\n"])));
16504
16512
  var HeaderImage = styled__default.div(_templateObject3$o || (_templateObject3$o = _taggedTemplateLiteralLoose(["\n width: 43px;\n height: 44px;\n background-color: #ebebeb;\n"])));
@@ -16515,7 +16523,7 @@ var HeaderLine = styled__default.div(_templateObject6$h || (_templateObject6$h =
16515
16523
  }, function (props) {
16516
16524
  return props.size === 'large' && styled.css(_templateObject10$8 || (_templateObject10$8 = _taggedTemplateLiteralLoose(["\n width: 75%;\n "])));
16517
16525
  });
16518
- var MainLine = styled__default(HeaderLine)(_templateObject11$4 || (_templateObject11$4 = _taggedTemplateLiteralLoose(["\n margin-bottom: 14px;\n margin-left: 0;\n"])));
16526
+ var MainLine = styled__default(HeaderLine)(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n margin-bottom: 14px;\n margin-left: 0;\n"])));
16519
16527
 
16520
16528
  var Template1 = function Template1(props) {
16521
16529
  if (!props.loading) return React__default.createElement(React__default.Fragment, null);
@@ -16900,7 +16908,7 @@ var Template8$1 = function Template8(props) {
16900
16908
  })), React__default.createElement(Main$2, null, React__default.createElement(Circle$2, null)));
16901
16909
  };
16902
16910
 
16903
- var _templateObject$M, _templateObject2$B, _templateObject3$y, _templateObject4$t, _templateObject5$s, _templateObject6$p, _templateObject7$m, _templateObject8$i, _templateObject9$g, _templateObject10$b, _templateObject11$5;
16911
+ var _templateObject$M, _templateObject2$B, _templateObject3$y, _templateObject4$t, _templateObject5$s, _templateObject6$p, _templateObject7$m, _templateObject8$i, _templateObject9$g, _templateObject10$b, _templateObject11$6;
16904
16912
  var Container$n = styled__default.div(_templateObject$M || (_templateObject$M = _taggedTemplateLiteralLoose(["\n width: 395px;\n height: 245px;\n display: flex;\n flex-direction: column;\n align-items: center;\n background: #f5f5f5 0% 0% no-repeat padding-box;\n"])));
16905
16913
  var Header$a = styled__default.div(_templateObject2$B || (_templateObject2$B = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n padding: 14px;\n width: 100%;\n"])));
16906
16914
  var HeaderLine$9 = styled__default.div(_templateObject3$y || (_templateObject3$y = _taggedTemplateLiteralLoose(["\n height: ", ";\n background-color: #ebebeb;\n margin-left: 7px;\n\n & + div {\n margin-top: 7px;\n }\n\n ", "\n ", "\n\n ", "\n\n ", "\n"])), function (props) {
@@ -16923,7 +16931,7 @@ var CustomLine$6 = styled__default(HeaderLine$9)(_templateObject8$i || (_templat
16923
16931
  });
16924
16932
  var GraphLine = styled__default(CustomLine$6)(_templateObject9$g || (_templateObject9$g = _taggedTemplateLiteralLoose(["\n margin: 0 7px;\n"])));
16925
16933
  var Main$3 = styled__default.div(_templateObject10$b || (_templateObject10$b = _taggedTemplateLiteralLoose(["\n flex: 1;\n padding: 0 7px 72px 7px;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n justify-content: center;\n"])));
16926
- var Circle$3 = styled__default.div(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n width: 128px;\n height: 128px;\n background-color: #ebebeb;\n border-radius: 50%;\n"])));
16934
+ var Circle$3 = styled__default.div(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose(["\n width: 128px;\n height: 128px;\n background-color: #ebebeb;\n border-radius: 50%;\n"])));
16927
16935
 
16928
16936
  var Template10 = function Template10(props) {
16929
16937
  if (!props.loading) return React__default.createElement(React__default.Fragment, null);
@@ -17718,7 +17726,7 @@ var useContext$2 = function useContext() {
17718
17726
  return React__default.useContext(Provider$2);
17719
17727
  };
17720
17728
 
17721
- var _templateObject$S, _templateObject2$F, _templateObject3$C, _templateObject4$w, _templateObject5$u, _templateObject6$q, _templateObject7$n, _templateObject8$j, _templateObject9$h, _templateObject10$c, _templateObject11$6, _templateObject12$4, _templateObject13$4, _templateObject14$3, _templateObject15$2;
17729
+ var _templateObject$S, _templateObject2$F, _templateObject3$C, _templateObject4$w, _templateObject5$u, _templateObject6$q, _templateObject7$n, _templateObject8$j, _templateObject9$h, _templateObject10$c, _templateObject11$7, _templateObject12$4, _templateObject13$4, _templateObject14$3, _templateObject15$2;
17722
17730
  var aligns = {
17723
17731
  self: {
17724
17732
  horizontal: {
@@ -17809,7 +17817,7 @@ var Col = styled__default.div(_templateObject$S || (_templateObject$S = _taggedT
17809
17817
  var bordered = _ref5.bordered,
17810
17818
  lightestGrey = _ref5.theme.colors.lightestGrey;
17811
17819
  if (!bordered) return;
17812
- return styled.css(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose(["\n :not(:last-child) {\n border-right: 1px solid ", ";\n }\n "])), lightestGrey);
17820
+ return styled.css(_templateObject11$7 || (_templateObject11$7 = _taggedTemplateLiteralLoose(["\n :not(:last-child) {\n border-right: 1px solid ", ";\n }\n "])), lightestGrey);
17813
17821
  }, function (_ref6) {
17814
17822
  var fontColor = _ref6.fontColor,
17815
17823
  theme = _ref6.theme;