@mw-kit/mw-ui 1.7.74 → 1.7.76

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,5 +1,5 @@
1
1
  import 'semantic-ui-css/semantic.min.css';
2
- import React__default, { useState, useEffect, useImperativeHandle, createElement, useCallback } from 'react';
2
+ import React__default, { useState, useEffect, useCallback, useImperativeHandle, createElement } from 'react';
3
3
  import styled, { css, keyframes, createGlobalStyle, ThemeProvider as ThemeProvider$1 } from 'styled-components';
4
4
  import { Icon as Icon$1, Popup } from 'semantic-ui-react';
5
5
  export * from 'semantic-ui-react';
@@ -640,7 +640,8 @@ var Container = styled.div(_templateObject17 || (_templateObject17 = _taggedTemp
640
640
  });
641
641
 
642
642
  var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef) {
643
- var open = props.open;
643
+ var open = props.open,
644
+ boundRef = props.boundRef;
644
645
  var center = props.center || {
645
646
  x: 50,
646
647
  y: 75
@@ -651,15 +652,28 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
651
652
  ref = _useState[0],
652
653
  setRef = _useState[1];
653
654
 
654
- var getPosition = function getPosition() {
655
+ var getPosition = useCallback(function () {
655
656
  if (!ref) return null;
656
- var width = window.innerWidth;
657
- var height = window.innerHeight;
658
-
659
- var _ref$getBoundingClien = ref.getBoundingClientRect(),
660
- top = _ref$getBoundingClien.top,
661
- left = _ref$getBoundingClien.left;
662
657
 
658
+ var _ref = boundRef ? {
659
+ offsetTop: boundRef.offsetTop,
660
+ offsetLeft: boundRef.offsetLeft,
661
+ width: boundRef.offsetWidth,
662
+ height: boundRef.offsetHeight
663
+ } : {
664
+ offsetTop: 0,
665
+ offsetLeft: 0,
666
+ width: window.innerWidth,
667
+ height: window.innerHeight
668
+ },
669
+ width = _ref.width,
670
+ height = _ref.height,
671
+ offsetTop = _ref.offsetTop,
672
+ offsetLeft = _ref.offsetLeft;
673
+
674
+ var rect = ref.getBoundingClientRect();
675
+ var top = rect.top - offsetTop;
676
+ var left = rect.left - offsetLeft;
663
677
  var x = left * 100 / width;
664
678
  var y = top * 100 / height;
665
679
 
@@ -677,7 +691,7 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
677
691
 
678
692
  return _newPosition;
679
693
  }
680
- };
694
+ }, [ref, boundRef]);
681
695
 
682
696
  var _useState2 = useState(props.position || getPosition),
683
697
  position = _useState2[0],
@@ -689,7 +703,7 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
689
703
  useEffect(function () {
690
704
  if (props.position) return;
691
705
  setPosition(getPosition);
692
- }, [ref]);
706
+ }, [getPosition]);
693
707
  var htmlProps = filterObject(props, ['center', 'position', 'children', 'content']);
694
708
  var cssKeys = {
695
709
  width: 'width',
@@ -12208,7 +12222,7 @@ var EllipsisContainer$1 = function EllipsisContainer$1(props) {
12208
12222
  }));
12209
12223
  };
12210
12224
 
12211
- var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$3, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17$1, _templateObject18$1, _templateObject19$1, _templateObject20$1, _templateObject21$1;
12225
+ var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$3, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17$1, _templateObject18$1, _templateObject19$1, _templateObject20$1, _templateObject21$1, _templateObject22$1;
12212
12226
  var IconContainer = styled.button(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 17px;\n\n background-color: transparent;\n border: none;\n box-shadow: none;\n padding: 0;\n\n ", "\n"])), function (_ref) {
12213
12227
  var onClick = _ref.onClick,
12214
12228
  disabled = _ref.disabled;
@@ -12286,8 +12300,9 @@ var Label = styled.label(_templateObject13$1 || (_templateObject13$1 = _taggedTe
12286
12300
  var width = _ref16.$width;
12287
12301
  return width || '100%';
12288
12302
  }, function (_ref17) {
12289
- var disabled = _ref17.$disabled;
12290
- if (!disabled) return;
12303
+ var disabled = _ref17.$disabled,
12304
+ viewMode = _ref17.$viewMode;
12305
+ if (!disabled || viewMode) return;
12291
12306
  return css(_templateObject14$1 || (_templateObject14$1 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
12292
12307
  }, InputContainer, IconContainer, function (_ref18) {
12293
12308
  var theme = _ref18.theme,
@@ -12314,20 +12329,24 @@ var Label = styled.label(_templateObject13$1 || (_templateObject13$1 = _taggedTe
12314
12329
 
12315
12330
  return css(_templateObject17$1 || (_templateObject17$1 = _taggedTemplateLiteralLoose(["\n > ", " > ", " {\n width: ", ";\n left: calc(", " / 2);\n }\n\n > ", " > ", " {\n padding-left: calc(", " + ", ");\n ~ ", " {\n padding-left: calc(", " + ", ");\n }\n }\n "])), InputContainer, IconContainer, width, padding, InputContainer, Input, padding, width, ChildrenContainer, padding, width);
12316
12331
  });
12317
- var LabelText = styled.div(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n margin-bottom: ", ";\n\n ", "\n"])), function (_ref21) {
12318
- var theme = _ref21.theme,
12319
- viewMode = _ref21.$viewMode;
12320
- return theme.spacings[viewMode ? 's3' : 's1'];
12332
+ var LabelText = styled.div(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n\n ", "\n\n margin-bottom: ", ";\n\n ", "\n"])), function (_ref21) {
12333
+ var viewMode = _ref21.$viewMode;
12334
+ if (!viewMode) return;
12335
+ return css(_templateObject19$1 || (_templateObject19$1 = _taggedTemplateLiteralLoose(["\n font-weight: bold;\n "])));
12321
12336
  }, function (_ref22) {
12322
- var required = _ref22.$required,
12337
+ var theme = _ref22.theme,
12323
12338
  viewMode = _ref22.$viewMode;
12339
+ return theme.spacings[viewMode ? 's3' : 's1'];
12340
+ }, function (_ref23) {
12341
+ var required = _ref23.$required,
12342
+ viewMode = _ref23.$viewMode;
12324
12343
  if (!required || viewMode) return;
12325
- return css(_templateObject19$1 || (_templateObject19$1 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
12344
+ return css(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
12326
12345
  });
12327
- var ViewModeContainer = styled.div(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref23) {
12328
- var children = _ref23.children;
12346
+ var ViewModeContainer = styled.div(_templateObject21$1 || (_templateObject21$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref24) {
12347
+ var children = _ref24.children;
12329
12348
  if (children) return;
12330
- return css(_templateObject21$1 || (_templateObject21$1 = _taggedTemplateLiteralLoose(["\n :before {\n content: ' ';\n white-space: pre;\n }\n "])));
12349
+ return css(_templateObject22$1 || (_templateObject22$1 = _taggedTemplateLiteralLoose(["\n :before {\n content: ' ';\n white-space: pre;\n }\n "])));
12331
12350
  });
12332
12351
 
12333
12352
  var defaultValue = {
@@ -12549,7 +12568,8 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12549
12568
  "$invalid": invalid,
12550
12569
  "$paddingless": paddingless,
12551
12570
  "$icon": iconProps,
12552
- "$width": width
12571
+ "$width": width,
12572
+ "$viewMode": viewMode
12553
12573
  }, label && React__default.createElement(LabelText, {
12554
12574
  "$required": required,
12555
12575
  "$viewMode": viewMode