@mw-kit/mw-ui 1.7.62 → 1.7.63

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,6 @@
1
- declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
1
+ declare type InputProps = {
2
2
  $activeBullet: boolean;
3
- }, never>;
3
+ $bulletSize: number;
4
+ };
5
+ declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, InputProps, never>;
4
6
  export default Input;
@@ -1,5 +1,6 @@
1
1
  declare type NavBarProps = {
2
- position: 'bottom' | 'top';
2
+ $position: 'bottom' | 'top';
3
+ $strict: boolean | undefined;
3
4
  };
4
5
  declare const NavBar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, NavBarProps, never>;
5
6
  export default NavBar;
package/dist/index.js CHANGED
@@ -15605,18 +15605,21 @@ var Switch = function Switch(props) {
15605
15605
  };
15606
15606
 
15607
15607
  var _templateObject$q, _templateObject2$m;
15608
- var bullet = styled.css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n appearance: none;\n width: ", ";\n height: ", ";\n border-radius: 100%;\n border-width: 1px;\n border-style: solid;\n box-shadow: 0px 1px 3px ", ";\n\n background-color: ", ";\n\n transition: background-color 0.2s ease-in-out;\n"])), function (_ref) {
15609
- var theme = _ref.theme;
15610
- return theme.spacings.s4;
15608
+ var bullet = styled.css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n appearance: none;\n width: ", "px;\n height: ", "px;\n border-radius: 100%;\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n\n box-shadow: 0px 1px 3px ", ";\n box-sizing: border-box;\n\n background-color: ", ";\n\n transition: background-color 0.2s ease-in-out;\n"])), function (_ref) {
15609
+ var bulletSize = _ref.$bulletSize;
15610
+ return bulletSize;
15611
15611
  }, function (_ref2) {
15612
- var theme = _ref2.theme;
15613
- return theme.spacings.s4;
15612
+ var bulletSize = _ref2.$bulletSize;
15613
+ return bulletSize;
15614
15614
  }, function (_ref3) {
15615
15615
  var theme = _ref3.theme;
15616
- return theme.getColor('black', 10);
15616
+ return theme.colors.platinum;
15617
15617
  }, function (_ref4) {
15618
- var theme = _ref4.theme,
15619
- activeBullet = _ref4.$activeBullet;
15618
+ var theme = _ref4.theme;
15619
+ return theme.getColor('black', 10);
15620
+ }, function (_ref5) {
15621
+ var theme = _ref5.theme,
15622
+ activeBullet = _ref5.$activeBullet;
15620
15623
  return theme.colors[activeBullet ? 'blue' : 'white'];
15621
15624
  });
15622
15625
  var Input$2 = styled__default.input(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n appearance: none;\n width: 100%;\n height: 10px;\n background-color: transparent;\n outline: none;\n position: relative;\n z-index: 3;\n margin: 0;\n\n :not(:disabled) {\n cursor: pointer;\n }\n\n /** firefox */\n ::-moz-range-thumb {\n ", "\n }\n /** ie */\n ::-ms-thumb {\n ", "\n }\n /** chrome */\n ::-webkit-slider-thumb {\n ", "\n }\n"])), bullet, bullet, bullet);
@@ -15649,47 +15652,26 @@ var LabelContainer$4 = styled__default.div(_templateObject$t || (_templateObject
15649
15652
  });
15650
15653
 
15651
15654
  var _templateObject$u, _templateObject2$o, _templateObject3$j;
15652
- var NavBar = styled__default.div(_templateObject$u || (_templateObject$u = _taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 2;\n\n left: 0;\n width: 100%;\n height: calc(33px + ", ");\n transition: height 0.25s ease-in-out;\n overflow: hidden;\n\n ", "\n\n > div:nth-child(1) {\n position: absolute;\n z-index: 2;\n\n width: 100px;\n background-color: ", ";\n color: ", ";\n padding: ", ";\n border-radius: 4px;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n > div:nth-child(2) {\n position: absolute;\n\n width: ", ";\n height: ", ";\n border-radius: 2px 0 0 0;\n\n transform: rotate(45deg);\n\n background-color: ", ";\n }\n"])), function (_ref) {
15655
+ var NavBar = styled__default.div(_templateObject$u || (_templateObject$u = _taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 2;\n\n left: 0;\n width: 100%;\n height: calc(33px + ", ");\n transition: height 0.25s ease-in-out;\n overflow: hidden;\n\n ", "\n\n > div:nth-child(1) {\n position: absolute;\n z-index: 2;\n\n width: 93px;\n /* height: 30px; */\n padding: 9px 7px;\n font-size: 13px;\n line-height: 16px;\n border-radius: 1px;\n\n background-color: ", ";\n color: ", ";\n padding: ", ";\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n > div:nth-child(2) {\n position: absolute;\n width: 0px;\n height: 0px;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-top: 5px solid ", ";\n }\n"])), function (_ref) {
15653
15656
  var theme = _ref.theme;
15654
15657
  return theme.spacings.s3;
15655
15658
  }, function (_ref2) {
15656
- var position = _ref2.position;
15657
- return position === 'bottom' ? styled.css(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n bottom: calc(100% + ", ");\n > div:nth-child(1) {\n bottom: ", ";\n }\n\n > div:nth-child(2) {\n top: calc(\n (100% - 19.8px / 2) - ", "\n );\n }\n "])), function (_ref3) {
15658
- var theme = _ref3.theme;
15659
- return theme.spacings.s1;
15660
- }, function (_ref4) {
15661
- var theme = _ref4.theme;
15662
- return theme.spacings.s1;
15663
- }, function (_ref5) {
15664
- var theme = _ref5.theme;
15665
- return theme.spacings.s1;
15666
- }) : styled.css(_templateObject3$j || (_templateObject3$j = _taggedTemplateLiteralLoose(["\n top: calc(100% + ", ");\n > div:nth-child(1) {\n top: ", ";\n }\n\n > div:nth-child(2) {\n bottom: calc(\n (100% - 19.8px / 2) - ", "\n );\n }\n "])), function (_ref6) {
15667
- var theme = _ref6.theme;
15668
- return theme.spacings.s1;
15669
- }, function (_ref7) {
15670
- var theme = _ref7.theme;
15671
- return theme.spacings.s1;
15672
- }, function (_ref8) {
15673
- var theme = _ref8.theme;
15674
- return theme.spacings.s1;
15675
- });
15676
- }, function (_ref9) {
15677
- var theme = _ref9.theme;
15659
+ var theme = _ref2.theme,
15660
+ position = _ref2.$position,
15661
+ strict = _ref2.$strict;
15662
+ var distance = strict ? "calc(" + theme.spacings.s1 + " / 2)" : '0px';
15663
+ return position === 'bottom' ? styled.css(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n bottom: calc(100% + ", ");\n > div:nth-child(1) {\n bottom: ", ";\n }\n\n > div:nth-child(2) {\n top: calc(100% - 7px);\n }\n "])), distance, theme.spacings.s1) : styled.css(_templateObject3$j || (_templateObject3$j = _taggedTemplateLiteralLoose(["\n top: calc(100% + ", ");\n > div:nth-child(1) {\n top: ", ";\n }\n\n > div:nth-child(2) {\n bottom: calc(100% - 7px);\n transform: rotate(180deg);\n }\n "])), distance, theme.spacings.s1);
15664
+ }, function (_ref3) {
15665
+ var theme = _ref3.theme;
15678
15666
  return theme.colors.blue;
15679
- }, function (_ref10) {
15680
- var theme = _ref10.theme;
15667
+ }, function (_ref4) {
15668
+ var theme = _ref4.theme;
15681
15669
  return theme.colors.white;
15682
- }, function (_ref11) {
15683
- var theme = _ref11.theme;
15670
+ }, function (_ref5) {
15671
+ var theme = _ref5.theme;
15684
15672
  return theme.spacings.s1;
15685
- }, function (_ref12) {
15686
- var theme = _ref12.theme;
15687
- return theme.spacings.s3;
15688
- }, function (_ref13) {
15689
- var theme = _ref13.theme;
15690
- return theme.spacings.s3;
15691
- }, function (_ref14) {
15692
- var theme = _ref14.theme;
15673
+ }, function (_ref6) {
15674
+ var theme = _ref6.theme;
15693
15675
  return theme.colors.blue;
15694
15676
  });
15695
15677
 
@@ -15728,10 +15710,10 @@ var LabelsContainer = styled__default.div(_templateObject$y || (_templateObject$
15728
15710
  var position = _ref.position;
15729
15711
 
15730
15712
  if (position === 'bottom') {
15731
- return styled.css(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n ", " {\n flex-direction: column-reverse;\n }\n\n ", " {\n :after {\n bottom: calc(100% + 10.5px);\n }\n }\n\n ", " {\n align-items: start;\n }\n "])), InputContainer$1, Marker, MinMaxLabelContainer);
15713
+ return styled.css(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n ", " {\n flex-direction: column-reverse;\n }\n\n ", " {\n :after {\n bottom: calc(100% + 10px);\n }\n }\n\n ", " {\n align-items: start;\n }\n "])), InputContainer$1, Marker, MinMaxLabelContainer);
15732
15714
  }
15733
15715
 
15734
- return styled.css(_templateObject3$l || (_templateObject3$l = _taggedTemplateLiteralLoose(["\n ", " {\n flex-direction: column;\n }\n\n ", " {\n :after {\n top: calc(100% + 8px);\n }\n }\n\n ", " {\n align-items: end;\n }\n "])), InputContainer$1, Marker, MinMaxLabelContainer);
15716
+ return styled.css(_templateObject3$l || (_templateObject3$l = _taggedTemplateLiteralLoose(["\n ", " {\n flex-direction: column;\n }\n\n ", " {\n :after {\n top: calc(100% + 9px);\n }\n }\n\n ", " {\n align-items: end;\n }\n "])), InputContainer$1, Marker, MinMaxLabelContainer);
15735
15717
  });
15736
15718
 
15737
15719
  var _templateObject$z;
@@ -15817,12 +15799,18 @@ var getMarkerLeft = function getMarkerLeft(markers, range, index, value, min, st
15817
15799
  return left;
15818
15800
  };
15819
15801
 
15820
- var getBarLeft = function getBarLeft(size, percent) {
15821
- return "min(max(calc(" + percent + "% - " + size / 2 + "px + 22px * " + (size / 2 - percent) / 100 + "), 0%), calc(100% - " + size + "px))";
15802
+ var getLeftCalc = function getLeftCalc(size, bullet, value, min, max) {
15803
+ var percent = (value - min) * 100 / (max - min);
15804
+ var calc = "calc(" + percent + "% - " + bullet * percent / 100 + "px + " + (bullet - size) / 2 + "px)";
15805
+ return calc;
15822
15806
  };
15823
15807
 
15824
- var getIndicatorLeft = function getIndicatorLeft(size, percent) {
15825
- return "min(max(calc(((" + percent + "% - " + size / 2 + "px + 22px * " + (size / 2 - percent) / 100 + ")) + (" + size / 2 + "px + 2px)), 0%), calc(100% - " + size + "px))";
15808
+ var getBarLeft = function getBarLeft(size, calc) {
15809
+ return "min(max(" + calc + ", 0%), calc(100% - " + size + "px))";
15810
+ };
15811
+
15812
+ var getIndicatorLeft = function getIndicatorLeft(size, calc) {
15813
+ return "min(max(" + calc + ", calc(0% - " + size + "px)), calc(100% - " + size + "px))";
15826
15814
  };
15827
15815
 
15828
15816
  var Range = React__default.forwardRef(function (props, ref) {
@@ -15923,6 +15911,7 @@ var Range = React__default.forwardRef(function (props, ref) {
15923
15911
  onChange: onChange,
15924
15912
  value: value
15925
15913
  });
15914
+ var bulletSize = strict === true ? 22 : 14;
15926
15915
  return React__default.createElement(Label$5, {
15927
15916
  required: required ? 1 : 0,
15928
15917
  disabled: disabled ? 1 : 0,
@@ -15935,7 +15924,7 @@ var Range = React__default.forwardRef(function (props, ref) {
15935
15924
  invalid: invalid ? 1 : 0
15936
15925
  }, markers.length > 0 && React__default.createElement(MarkersContainer, null, markers.map(function (marker, index) {
15937
15926
  var left = getMarkerLeft(markers.length, range, index, marker.value, min, strict);
15938
- var bullet = marker.value > currentValue ? 1 : 0;
15927
+ var bullet = strict || marker.value > currentValue && marker.value < max ? 1 : 0;
15939
15928
  return React__default.createElement(Marker, {
15940
15929
  key: index,
15941
15930
  left: left,
@@ -15944,26 +15933,34 @@ var Range = React__default.forwardRef(function (props, ref) {
15944
15933
  })), React__default.createElement("div", null, React__default.createElement(Input$2, Object.assign({
15945
15934
  ref: ref
15946
15935
  }, inputProps, {
15947
- "$activeBullet": (strict === true ? markers[value].value : value) !== 0
15936
+ "$activeBullet": (strict === true ? markers[value].value : value) !== 0,
15937
+ "$bulletSize": bulletSize
15948
15938
  })), React__default.createElement(NavBar, {
15949
- position: position
15939
+ "$position": position,
15940
+ "$strict": strict
15950
15941
  }, React__default.createElement("div", {
15951
15942
  style: {
15952
- left: getBarLeft(100, (value - min) * 100 / (max - min))
15943
+ left: getBarLeft(93, getLeftCalc(93, bulletSize, value, min, max))
15953
15944
  }
15954
15945
  }, React__default.createElement(Icon, {
15955
15946
  type: 'feather',
15956
15947
  icon: 'minus_circle',
15957
15948
  color: 'white',
15958
- onClick: canDecrement ? decrement : undefined
15949
+ onClick: canDecrement ? decrement : undefined,
15950
+ width: '12px',
15951
+ height: '12px',
15952
+ strokeWidth: '2.5px'
15959
15953
  }), currentValue, React__default.createElement(Icon, {
15960
15954
  type: 'feather',
15961
15955
  icon: 'plus_circle',
15962
15956
  color: 'white',
15963
- onClick: canIncrement ? increment : undefined
15957
+ onClick: canIncrement ? increment : undefined,
15958
+ width: '12px',
15959
+ height: '12px',
15960
+ strokeWidth: '2.5px'
15964
15961
  })), React__default.createElement("div", {
15965
15962
  style: {
15966
- left: getIndicatorLeft(14, (value - min) * 100 / (max - min))
15963
+ left: getIndicatorLeft(14, getLeftCalc(14, bulletSize, value, min, max))
15967
15964
  }
15968
15965
  })), React__default.createElement(SelectedArea, {
15969
15966
  percent: percent