@mw-kit/mw-ui 1.7.101 → 1.7.103

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.
@@ -19347,13 +19347,74 @@ var ProgressBar = function ProgressBar(props) {
19347
19347
  return React__default.createElement(Container$m, null, React__default.createElement(Progress, Object.assign({}, props), React__default.createElement("div", null)), React__default.createElement("span", null, " ", props.value || '0', "%"));
19348
19348
  };
19349
19349
 
19350
- var _templateObject$17, _templateObject2$Q, _templateObject3$J, _templateObject4$x, _templateObject5$t, _templateObject6$q, _templateObject7$q, _templateObject8$n, _templateObject9$k;
19351
- var Container$n = styled.div(_templateObject$17 || (_templateObject$17 = _taggedTemplateLiteralLoose(["\n display: block;\n"])));
19350
+ var _templateObject$17;
19351
+ var Close = styled.div(_templateObject$17 || (_templateObject$17 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: calc(50% - ", " / 2);\n right: ", ";\n\n + div {\n /** icon width + tab gap + tab right padding */\n padding-right: ", ";\n }\n\n svg > * {\n transition-property: stroke;\n transition-duration: 0.25s;\n transition-timing-function: ease-in-out;\n }\n"])), function (_ref) {
19352
+ var theme = _ref.theme;
19353
+ return theme.spacings.s3;
19354
+ }, function (_ref2) {
19355
+ var theme = _ref2.theme;
19356
+ return theme.spacings.s3;
19357
+ }, function (_ref3) {
19358
+ var theme = _ref3.theme;
19359
+ return "calc(" + theme.spacings.s3 + " + " + theme.spacings.s3 + " + " + theme.spacings.s3 + ")";
19360
+ });
19361
+
19362
+ var Close$1 = function Close$1(props) {
19363
+ var index = props.index,
19364
+ _props$active = props.active,
19365
+ active = _props$active[0],
19366
+ setActive = _props$active[1],
19367
+ _props$options = props.options,
19368
+ options = _props$options[0],
19369
+ setOptions = _props$options[1];
19370
+
19371
+ var onClose = props.onClose || function () {
19372
+ return true;
19373
+ };
19374
+
19375
+ var onClickClose = useCallback(function (event) {
19376
+ try {
19377
+ var _exit2 = false;
19378
+ if (options.length === 1) return Promise.resolve();
19379
+ var newOptions = [].concat(options);
19380
+ newOptions.splice(index, 1);
19381
+ return Promise.resolve(onClose(index, options[index], event)).then(function (_onClose) {
19382
+ if (!_onClose) {
19383
+ _exit2 = true;
19384
+ return;
19385
+ }
19386
+
19387
+ if (index < active) {
19388
+ setActive(active - 1, newOptions[active - 1].data);
19389
+ } else if (active === index) {
19390
+ var newactive = active > 0 ? active - 1 : active;
19391
+ setActive(newactive, newOptions[newactive].data);
19392
+ }
19393
+
19394
+ setOptions(newOptions);
19395
+ });
19396
+ } catch (e) {
19397
+ return Promise.reject(e);
19398
+ }
19399
+ }, [options, active, index, onClose]);
19400
+ return React__default.createElement(Close, null, React__default.createElement(Icon, {
19401
+ type: 'feather',
19402
+ icon: 'x',
19403
+ onClick: onClickClose,
19404
+ width: '14px',
19405
+ height: '14px',
19406
+ strokeWidth: '3px',
19407
+ color: active === index ? 'white' : 'darkBlue'
19408
+ }));
19409
+ };
19410
+
19411
+ var _templateObject$18, _templateObject2$Q, _templateObject3$J, _templateObject4$x, _templateObject5$t, _templateObject6$q, _templateObject7$q, _templateObject8$n, _templateObject9$k;
19412
+ var Container$n = styled.div(_templateObject$18 || (_templateObject$18 = _taggedTemplateLiteralLoose(["\n display: block;\n"])));
19352
19413
  var delimiters = {
19353
19414
  blue: ['blue'],
19354
19415
  grey: ['warningGray']
19355
19416
  };
19356
- var Tabs = styled.ul(_templateObject2$Q || (_templateObject2$Q = _taggedTemplateLiteralLoose(["\n user-select: none;\n list-style: none;\n display: inline-flex;\n width: 100%;\n\n ", "\n\n ", ";\n\n gap: ", ";\n\n > li {\n position: relative;\n }\n"])), function (_ref) {
19417
+ var Tabs = styled.ul(_templateObject2$Q || (_templateObject2$Q = _taggedTemplateLiteralLoose(["\n user-select: none;\n list-style: none;\n display: inline-flex;\n width: 100%;\n\n overflow-x: auto;\n scrollbar-width: none;\n\n ", "\n\n ", ";\n\n gap: ", ";\n\n > li {\n position: relative;\n }\n"])), function (_ref) {
19357
19418
  var spacing = _ref.$spacing;
19358
19419
 
19359
19420
  var _getSpacings$split = getSpacings(spacing || {}, {
@@ -19387,14 +19448,14 @@ var Tabs = styled.ul(_templateObject2$Q || (_templateObject2$Q = _taggedTemplate
19387
19448
  internal = _ref3.$internal;
19388
19449
  return internal ? theme.spacings.s6 : 0;
19389
19450
  });
19390
- var Tab = styled.div(_templateObject5$t || (_templateObject5$t = _taggedTemplateLiteralLoose(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ", "\n\n transition-property: padding-right, background-color, color;\n transition-duration: 0.25s;\n transition-timing-function: ease-in-out;\n"])), function (_ref4) {
19451
+ var Tab = styled.div(_templateObject5$t || (_templateObject5$t = _taggedTemplateLiteralLoose(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n white-space: nowrap;\n\n ", "\n\n transition-property: padding-right, background-color, color;\n transition-duration: 0.25s;\n transition-timing-function: ease-in-out;\n"])), function (_ref4) {
19391
19452
  var onClick = _ref4.onClick;
19392
19453
  return onClick && css(_templateObject6$q || (_templateObject6$q = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
19393
19454
  }, function (_ref5) {
19394
19455
  var theme = _ref5.theme,
19395
19456
  active = _ref5.$active,
19396
19457
  internal = _ref5.$internal;
19397
- return css(_templateObject7$q || (_templateObject7$q = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: ", ";\n gap: ", ";\n\n ", "\n\n color: ", ";\n "])), theme.colors[active ? 'blue' : 'white'], theme.spacings.s3, theme.spacings.s3, internal ? css(_templateObject8$n || (_templateObject8$n = _taggedTemplateLiteralLoose(["\n border-radius: 4px 4px 0 0;\n\n ", "\n line-height: 17px;\n "])), function (_ref6) {
19458
+ return css(_templateObject7$q || (_templateObject7$q = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: calc(", " * 1.5) ", ";\n gap: ", ";\n\n ", "\n\n color: ", ";\n "])), theme.colors[active ? 'blue' : 'white'], theme.spacings.s1, theme.spacings.s3, theme.spacings.s3, internal ? css(_templateObject8$n || (_templateObject8$n = _taggedTemplateLiteralLoose(["\n border-radius: 4px 4px 0 0;\n\n ", "\n line-height: 17px;\n "])), function (_ref6) {
19398
19459
  var theme = _ref6.theme;
19399
19460
  return theme.useTypography('h4');
19400
19461
  }) : css(_templateObject9$k || (_templateObject9$k = _taggedTemplateLiteralLoose(["\n box-shadow: 0px 3px 6px ", ";\n\n ", "\n line-height: 19px;\n "])), theme.getColor('black', 15), function (_ref7) {
@@ -19403,55 +19464,6 @@ var Tab = styled.div(_templateObject5$t || (_templateObject5$t = _taggedTemplate
19403
19464
  }), theme.colors[active ? 'white' : 'darkBlue']);
19404
19465
  });
19405
19466
 
19406
- var _templateObject$18;
19407
- var Close = styled.div(_templateObject$18 || (_templateObject$18 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: calc(50% - ", " / 2);\n right: ", ";\n\n + ", " {\n /** icon width + tab gap + tab right padding */\n padding-right: ", ";\n }\n\n svg > * {\n transition-property: stroke;\n transition-duration: 0.25s;\n transition-timing-function: ease-in-out;\n }\n"])), function (_ref) {
19408
- var theme = _ref.theme;
19409
- return theme.spacings.s3;
19410
- }, function (_ref2) {
19411
- var theme = _ref2.theme;
19412
- return theme.spacings.s3;
19413
- }, Tab, function (_ref3) {
19414
- var theme = _ref3.theme;
19415
- return "calc(" + theme.spacings.s3 + " + " + theme.spacings.s3 + " + " + theme.spacings.s3 + ")";
19416
- });
19417
-
19418
- var Close$1 = function Close$1(props) {
19419
- var index = props.index,
19420
- _props$active = props.active,
19421
- active = _props$active[0],
19422
- setActive = _props$active[1],
19423
- _props$options = props.options,
19424
- options = _props$options[0],
19425
- setOptions = _props$options[1];
19426
-
19427
- var onClose = props.onClose || function () {};
19428
-
19429
- var onClickClose = useCallback(function (event) {
19430
- if (options.length === 1) return;
19431
- var newOptions = [].concat(options);
19432
- newOptions.splice(index, 1);
19433
- onClose(index, options[index], event);
19434
-
19435
- if (index < active) {
19436
- setActive(active - 1, newOptions[active - 1].data);
19437
- } else if (active === index) {
19438
- var newactive = active > 0 ? active - 1 : active;
19439
- setActive(newactive, newOptions[newactive].data);
19440
- }
19441
-
19442
- setOptions(newOptions);
19443
- }, [options, active, index]);
19444
- return React__default.createElement(Close, null, React__default.createElement(Icon, {
19445
- type: 'feather',
19446
- icon: 'x',
19447
- onClick: onClickClose,
19448
- width: '14px',
19449
- height: '14px',
19450
- strokeWidth: '3px',
19451
- color: active === index ? 'white' : 'darkBlue'
19452
- }));
19453
- };
19454
-
19455
19467
  var VoidClose = function VoidClose() {
19456
19468
  return React__default.createElement(React__default.Fragment, null);
19457
19469
  };
@@ -19476,14 +19488,31 @@ var Tabs$1 = function Tabs$1(props) {
19476
19488
  return React__default.createElement(Container$n, Object.assign({}, divProps), React__default.createElement(Tabs, {
19477
19489
  "$internal": props.internal,
19478
19490
  "$delimiter": props.delimiter,
19479
- "$spacing": props.spacing
19491
+ "$spacing": props.spacing,
19492
+ onWheel: function onWheel(e) {
19493
+ var target = function () {
19494
+ var target = e.target;
19495
+
19496
+ while (target && target.tagName !== 'UL') {
19497
+ target = target.parentElement;
19498
+ }
19499
+
19500
+ return target;
19501
+ }();
19502
+
19503
+ if (!target) return;
19504
+ var x = target.offsetWidth * 100 / target.scrollWidth;
19505
+ target.scrollLeft += x * (e.deltaY > 0 ? 1 : -1) * 2;
19506
+ e.preventDefault();
19507
+ }
19480
19508
  }, options.map(function (tab, index) {
19481
19509
  return React__default.createElement("li", {
19482
19510
  key: index
19483
19511
  }, React__default.createElement(CloseComponent, {
19484
19512
  index: index,
19485
19513
  active: [active, setActive],
19486
- options: [options, setOptions]
19514
+ options: [options, setOptions],
19515
+ onClose: props.onClose
19487
19516
  }), React__default.createElement(Tab, Object.assign({}, index === active ? {
19488
19517
  $active: true
19489
19518
  } : {