@mw-kit/mw-ui 1.7.87 → 1.7.89

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.
@@ -12225,131 +12225,126 @@ var EllipsisContainer$1 = function EllipsisContainer$1(props) {
12225
12225
  }));
12226
12226
  };
12227
12227
 
12228
- 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;
12229
- 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) {
12230
- var onClick = _ref.onClick,
12231
- disabled = _ref.disabled;
12232
- if (!onClick || disabled) return;
12233
- return css(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
12234
- });
12235
- var ChildrenContainer = styled(EllipsisContainer$1)(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 100%;\n height: 100%;\n bottom: 0;\n left: 0;\n line-height: 19px;\n display: flex;\n gap: calc(", " / 2);\n"])), function (_ref2) {
12236
- var theme = _ref2.theme;
12228
+ 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;
12229
+ var IconContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n position: absolute;\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 17px;\n\n background-color: transparent;\n border: none;\n box-shadow: none;\n padding: 0;\n"])));
12230
+ var ChildrenContainer = styled(EllipsisContainer$1)(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 100%;\n height: 100%;\n bottom: 0;\n left: 0;\n line-height: 19px;\n display: flex;\n gap: calc(", " / 2);\n"])), function (_ref) {
12231
+ var theme = _ref.theme;
12237
12232
  return theme.spacings.s1;
12238
12233
  });
12239
- var Input = styled.input(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteralLoose(["\n ", ";\n\n color: ", ";\n\n line-height: 17px;\n\n ::placeholder {\n color: ", ";\n\n line-height: 17px;\n\n ", "\n }\n\n display: block;\n width: 100%;\n box-sizing: border-box;\n\n ", ";\n\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: 4px;\n\n ", ";\n\n box-shadow: none;\n outline: none;\n\n ", "\n\n ", "\n"])), function (_ref3) {
12240
- var theme = _ref3.theme;
12234
+ var Input = styled.input(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n ", ";\n\n color: ", ";\n\n line-height: 17px;\n\n ::placeholder {\n color: ", ";\n\n line-height: 17px;\n\n ", "\n }\n\n display: block;\n width: 100%;\n box-sizing: border-box;\n\n ", ";\n\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: 4px;\n\n ", ";\n\n box-shadow: none;\n outline: none;\n\n ", "\n\n ", "\n"])), function (_ref2) {
12235
+ var theme = _ref2.theme;
12241
12236
  return theme.useTypography('p');
12237
+ }, function (_ref3) {
12238
+ var theme = _ref3.theme,
12239
+ invalid = _ref3.$invalid;
12240
+ return invalid ? theme.colors.warningRed : theme.colors.darkBlue;
12242
12241
  }, function (_ref4) {
12243
12242
  var theme = _ref4.theme,
12244
12243
  invalid = _ref4.$invalid;
12245
- return invalid ? theme.colors.warningRed : theme.colors.darkBlue;
12246
- }, function (_ref5) {
12247
- var theme = _ref5.theme,
12248
- invalid = _ref5.$invalid;
12249
12244
  return invalid ? theme.colors.warningRed : theme.colors.darkGrey;
12250
- }, function (_ref6) {
12251
- var placeholder = _ref6.placeholder;
12245
+ }, function (_ref5) {
12246
+ var placeholder = _ref5.placeholder;
12252
12247
 
12253
12248
  if (placeholder !== '••••••••') {
12254
- return css(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteralLoose(["\n ", ";\n opacity: 1;\n "])), function (_ref7) {
12255
- var theme = _ref7.theme;
12249
+ return css(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteralLoose(["\n ", ";\n opacity: 1;\n "])), function (_ref6) {
12250
+ var theme = _ref6.theme;
12256
12251
  return theme.useTypography('p');
12257
12252
  });
12258
12253
  }
12259
12254
 
12260
- return css(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n font-size: 14px;\n letter-spacing: 0px;\n "])));
12261
- }, function (_ref8) {
12262
- var theme = _ref8.theme,
12263
- paddingless = _ref8.$paddingless;
12255
+ return css(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n font-size: 14px;\n letter-spacing: 0px;\n "])));
12256
+ }, function (_ref7) {
12257
+ var theme = _ref7.theme,
12258
+ paddingless = _ref7.$paddingless;
12264
12259
 
12265
12260
  if (paddingless) {
12266
- return css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n padding: 0;\n "])));
12261
+ return css(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteralLoose(["\n padding: 0;\n "])));
12267
12262
  }
12268
12263
 
12269
- return css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteralLoose(["\n padding: ", " ", ";\n ~ ", " {\n padding: ", " ", ";\n }\n "])), theme.spacings.s2, theme.spacings.s3, ChildrenContainer, theme.spacings.s2, theme.spacings.s3);
12270
- }, function (_ref9) {
12271
- var theme = _ref9.theme,
12272
- invalid = _ref9.$invalid,
12273
- borderless = _ref9.$borderless;
12264
+ return css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n padding: ", " ", ";\n ~ ", " {\n padding: ", " ", ";\n }\n "])), theme.spacings.s2, theme.spacings.s3, ChildrenContainer, theme.spacings.s2, theme.spacings.s3);
12265
+ }, function (_ref8) {
12266
+ var theme = _ref8.theme,
12267
+ invalid = _ref8.$invalid,
12268
+ borderless = _ref8.$borderless;
12274
12269
  if (borderless) return 'transparent';
12275
12270
  return invalid ? theme.colors.warningRed : theme.colors.lightGrey;
12276
- }, function (_ref10) {
12277
- var theme = _ref10.theme,
12278
- invalid = _ref10.$invalid;
12271
+ }, function (_ref9) {
12272
+ var theme = _ref9.theme,
12273
+ invalid = _ref9.$invalid;
12279
12274
  var color = invalid ? theme.getColor('warningRed', 5) : theme.colors.white;
12280
- return css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n /** google chrome blue background */\n -webkit-box-shadow: 0 0 0px 1000px ", " inset !important;\n "])), color, color);
12281
- }, function (_ref11) {
12282
- var arrows = _ref11.$arrows;
12275
+ return css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n /** google chrome blue background */\n -webkit-box-shadow: 0 0 0px 1000px ", " inset !important;\n "])), color, color);
12276
+ }, function (_ref10) {
12277
+ var arrows = _ref10.$arrows;
12283
12278
  if (arrows) return;
12284
- return css(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteralLoose(["\n /* Chrome, Safari, Edge, Opera */\n :-webkit-outer-spin-button,\n :-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n -moz-appearance: textfield;\n "])));
12285
- }, function (_ref12) {
12286
- var readOnly = _ref12.readOnly,
12287
- onClick = _ref12.onClick,
12288
- disabled = _ref12.disabled;
12289
- if (readOnly || !onClick || disabled) return;
12290
- return css(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
12279
+ return css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n /* Chrome, Safari, Edge, Opera */\n :-webkit-outer-spin-button,\n :-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n -moz-appearance: textfield;\n "])));
12280
+ }, function (_ref11) {
12281
+ var readOnly = _ref11.readOnly,
12282
+ onClick = _ref11.onClick,
12283
+ disabled = _ref11.disabled;
12284
+ if (!readOnly || !onClick || disabled) return;
12285
+ return css(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
12291
12286
  });
12292
- var InputContainer = styled.div(_templateObject12$1 || (_templateObject12$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: ", ";\n"])), function (_ref13) {
12293
- var width = _ref13.width;
12287
+ var InputContainer = styled.div(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: ", ";\n"])), function (_ref12) {
12288
+ var width = _ref12.width;
12294
12289
  return width || '100%';
12295
12290
  });
12296
- var Label = styled.label(_templateObject13$1 || (_templateObject13$1 = _taggedTemplateLiteralLoose(["\n ", ";\n line-height: 17px;\n\n color: ", ";\n\n width: ", ";\n box-sizing: border-box;\n display: block;\n\n ", "\n\n > ", " > ", " {\n bottom: ", ";\n }\n\n ", "\n\n ", "\n"])), function (_ref14) {
12297
- var theme = _ref14.theme;
12291
+ var Label = styled.label(_templateObject12$1 || (_templateObject12$1 = _taggedTemplateLiteralLoose(["\n ", ";\n line-height: 17px;\n\n color: ", ";\n\n width: ", ";\n box-sizing: border-box;\n display: block;\n\n ", "\n\n > ", " > ", " {\n bottom: ", ";\n }\n\n ", "\n\n ", "\n"])), function (_ref13) {
12292
+ var theme = _ref13.theme;
12298
12293
  return theme.useTypography('p');
12299
- }, function (_ref15) {
12300
- var theme = _ref15.theme;
12294
+ }, function (_ref14) {
12295
+ var theme = _ref14.theme;
12301
12296
  return theme.colors.greyishBlue;
12302
- }, function (_ref16) {
12303
- var width = _ref16.$width;
12297
+ }, function (_ref15) {
12298
+ var width = _ref15.$width;
12304
12299
  return width || '100%';
12305
- }, function (_ref17) {
12306
- var disabled = _ref17.$disabled,
12307
- viewMode = _ref17.$viewMode;
12300
+ }, function (_ref16) {
12301
+ var disabled = _ref16.$disabled,
12302
+ viewMode = _ref16.$viewMode;
12308
12303
  if (!disabled || viewMode) return;
12309
- return css(_templateObject14$1 || (_templateObject14$1 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
12310
- }, InputContainer, IconContainer, function (_ref18) {
12311
- var theme = _ref18.theme,
12312
- paddingless = _ref18.$paddingless;
12304
+ return css(_templateObject13$1 || (_templateObject13$1 = _taggedTemplateLiteralLoose(["\n opacity: 0.5;\n "])));
12305
+ }, InputContainer, IconContainer, function (_ref17) {
12306
+ var theme = _ref17.theme,
12307
+ paddingless = _ref17.$paddingless;
12313
12308
  return paddingless ? '2px' : "calc(" + theme.spacings.s2 + " + 1px)";
12314
- }, function (_ref19) {
12315
- var readOnly = _ref19.$readOnly,
12316
- disabled = _ref19.$disabled,
12317
- loading = _ref19.$loading;
12309
+ }, function (_ref18) {
12310
+ var readOnly = _ref18.$readOnly,
12311
+ disabled = _ref18.$disabled,
12312
+ loading = _ref18.$loading;
12318
12313
  if (loading || readOnly || disabled) return;
12319
- return css(_templateObject15$1 || (_templateObject15$1 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
12320
- }, function (_ref20) {
12321
- var theme = _ref20.theme,
12322
- icon = _ref20.$icon,
12323
- paddingless = _ref20.$paddingless;
12324
- if (!icon) return;
12325
- var width = icon.width,
12326
- position = icon.position;
12314
+ return css(_templateObject14$1 || (_templateObject14$1 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n "])));
12315
+ }, function (_ref19) {
12316
+ var theme = _ref19.theme,
12317
+ iconWidths = _ref19.$iconWidths,
12318
+ position = _ref19.$iconPosition,
12319
+ paddingless = _ref19.$paddingless;
12320
+ if (iconWidths.length < 1) return;
12321
+ var width = "calc(" + iconWidths.join(' + ') + " + " + theme.spacings.s1 + " / 2 * " + (iconWidths.length - 1) + ")";
12327
12322
  var padding = paddingless ? '0px' : theme.spacings.s3;
12328
12323
 
12329
12324
  if (position === 'right') {
12330
- return css(_templateObject16$1 || (_templateObject16$1 = _taggedTemplateLiteralLoose(["\n > ", " > ", " {\n width: ", ";\n right: calc(", " / 2);\n }\n\n > ", " > ", " {\n padding-right: calc(", " + ", ");\n ~ ", " {\n padding-right: calc(", " + ", ");\n }\n }\n "])), InputContainer, IconContainer, width, padding, InputContainer, Input, padding, width, ChildrenContainer, padding, width);
12325
+ return css(_templateObject15$1 || (_templateObject15$1 = _taggedTemplateLiteralLoose(["\n > ", " > ", " {\n width: ", ";\n right: calc(", " / 2);\n }\n\n > ", " > ", " {\n padding-right: calc(", " + ", ");\n ~ ", " {\n padding-right: calc(", " + ", ");\n }\n }\n "])), InputContainer, IconContainer, width, padding, InputContainer, Input, padding, width, ChildrenContainer, padding, width);
12331
12326
  }
12332
12327
 
12333
- 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);
12328
+ return css(_templateObject16$1 || (_templateObject16$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);
12334
12329
  });
12335
- var LabelText = styled.div(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n\n ", "\n\n margin-bottom: ", ";\n\n ", "\n"])), function (_ref21) {
12336
- var viewMode = _ref21.$viewMode;
12330
+ var LabelText = styled.div(_templateObject17$1 || (_templateObject17$1 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n\n ", "\n\n margin-bottom: ", ";\n\n ", "\n"])), function (_ref20) {
12331
+ var viewMode = _ref20.$viewMode;
12337
12332
  if (!viewMode) return;
12338
- return css(_templateObject19$1 || (_templateObject19$1 = _taggedTemplateLiteralLoose(["\n font-weight: bold;\n "])));
12333
+ return css(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n font-weight: bold;\n "])));
12334
+ }, function (_ref21) {
12335
+ var theme = _ref21.theme,
12336
+ viewMode = _ref21.$viewMode;
12337
+ return theme.spacings[viewMode ? 's3' : 's1'];
12339
12338
  }, function (_ref22) {
12340
- var theme = _ref22.theme,
12339
+ var required = _ref22.$required,
12341
12340
  viewMode = _ref22.$viewMode;
12342
- return theme.spacings[viewMode ? 's3' : 's1'];
12343
- }, function (_ref23) {
12344
- var required = _ref23.$required,
12345
- viewMode = _ref23.$viewMode;
12346
12341
  if (!required || viewMode) return;
12347
- return css(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
12342
+ return css(_templateObject19$1 || (_templateObject19$1 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
12348
12343
  });
12349
- var ViewModeContainer = styled.div(_templateObject21$1 || (_templateObject21$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref24) {
12350
- var children = _ref24.children;
12344
+ var ViewModeContainer = styled.div(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref23) {
12345
+ var children = _ref23.children;
12351
12346
  if (children) return;
12352
- return css(_templateObject22$1 || (_templateObject22$1 = _taggedTemplateLiteralLoose(["\n :before {\n content: ' ';\n white-space: pre;\n }\n "])));
12347
+ return css(_templateObject21$1 || (_templateObject21$1 = _taggedTemplateLiteralLoose(["\n :before {\n content: ' ';\n white-space: pre;\n }\n "])));
12353
12348
  });
12354
12349
 
12355
12350
  var defaultValue = {
@@ -12427,6 +12422,8 @@ var Form = Object.assign(React__default.forwardRef(Object.assign(function (props
12427
12422
  });
12428
12423
 
12429
12424
  var Input$1 = React__default.forwardRef(function (props, ref) {
12425
+ var _props$icon;
12426
+
12430
12427
  var _props = _extends({}, props),
12431
12428
  label = _props.label,
12432
12429
  loading = _props.loading,
@@ -12454,21 +12451,6 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12454
12451
  var required = isRequired() || props.required;
12455
12452
  var disabled = isDisabled() || props.disabled;
12456
12453
  var viewMode = isViewMode() || props.viewMode;
12457
- var position;
12458
- var iconWidth;
12459
- var iconSubmit;
12460
- var iconOnClick;
12461
- var icon;
12462
-
12463
- if (props.icon) {
12464
- icon = _extends({}, props.icon.icon);
12465
- position = props.icon.position || 'right';
12466
- if (invalid) icon.color = 'warningRed';
12467
- iconWidth = icon.width;
12468
- iconSubmit = props.icon.submit;
12469
- iconOnClick = props.icon.onClick;
12470
- }
12471
-
12472
12454
  var inputProps = filterObject(props, ['label', 'invalid', 'required', 'icon', 'mask', 'loading', 'clearable', 'setValue', 'onPressEnter', 'htmlDisabled', 'htmlReadOnly', 'viewMode', 'width', 'inputWidth', 'arrows', 'borderless', 'paddingless', 'children'], {
12473
12455
  $invalid: invalid,
12474
12456
  type: 'text',
@@ -12537,31 +12519,40 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12537
12519
  };
12538
12520
  }
12539
12521
 
12540
- if (loading) {
12541
- position = position || 'right';
12542
- icon = {
12543
- type: 'jsx',
12544
- icon: React__default.createElement(Loader, {
12545
- size: '14px'
12546
- }),
12547
- width: '14px'
12548
- };
12549
- } else if (clearable) {
12550
- position = position || 'right';
12551
- iconOnClick = typeof clearable === 'function' ? clearable : function () {
12552
- return setValue('');
12553
- };
12554
- icon = {
12555
- type: 'feather',
12556
- icon: 'x',
12557
- width: '14px'
12522
+ var icon = function () {
12523
+ var icon = _extends({}, invalid ? {
12524
+ color: 'warningRed'
12525
+ } : {});
12526
+
12527
+ if (clearable) {
12528
+ var callback = typeof clearable === 'function' ? clearable : function () {
12529
+ return setValue('');
12530
+ };
12531
+ return _extends({}, icon, {
12532
+ type: 'feather',
12533
+ icon: 'x',
12534
+ width: '14px',
12535
+ onClick: function onClick(e) {
12536
+ e.preventDefault();
12537
+ callback();
12538
+ }
12539
+ });
12540
+ }
12541
+
12542
+ if (!props.icon) return props.icon;
12543
+ return _extends({}, icon, props.icon.icon);
12544
+ }();
12545
+
12546
+ var dirty = props.dirty;
12547
+
12548
+ var onDirty = function () {
12549
+ if (dirty === undefined || typeof dirty === 'function') return dirty;
12550
+ if (props.value === dirty) return undefined;
12551
+ return function () {
12552
+ return setValue(dirty);
12558
12553
  };
12559
- }
12554
+ }();
12560
12555
 
12561
- var iconProps = position ? {
12562
- position: position,
12563
- width: iconWidth || '24px'
12564
- } : undefined;
12565
12556
  if (props.htmlDisabled) inputProps.disabled = true;
12566
12557
  if (props.htmlReadOnly) inputProps.readOnly = true;
12567
12558
  return React__default.createElement(Label, {
@@ -12570,7 +12561,8 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12570
12561
  "$loading": loading,
12571
12562
  "$invalid": invalid,
12572
12563
  "$paddingless": paddingless,
12573
- "$icon": iconProps,
12564
+ "$iconPosition": ((_props$icon = props.icon) === null || _props$icon === void 0 ? void 0 : _props$icon.position) || 'right',
12565
+ "$iconWidths": [].concat(icon ? [icon.width || '24px'] : [], onDirty ? ['10px'] : []),
12574
12566
  "$width": width,
12575
12567
  "$viewMode": viewMode
12576
12568
  }, label && React__default.createElement(LabelText, {
@@ -12584,11 +12576,25 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12584
12576
  ref: ref
12585
12577
  })), props.children && React__default.createElement(ChildrenContainer, {
12586
12578
  children: props.children
12587
- }), icon && React__default.createElement(IconContainer, {
12588
- type: iconSubmit ? 'submit' : 'button',
12589
- onClick: props.disabled ? undefined : iconOnClick,
12590
- tabIndex: -1
12591
- }, React__default.createElement(Icon, Object.assign({}, icon)))));
12579
+ }), React__default.createElement(IconContainer, null, loading ? React__default.createElement(Icon, {
12580
+ type: 'jsx',
12581
+ icon: React__default.createElement(Loader, {
12582
+ size: '14px'
12583
+ }),
12584
+ width: '14px'
12585
+ }) : React__default.createElement(React__default.Fragment, null, onDirty && React__default.createElement(Icon, Object.assign({}, _extends({
12586
+ type: 'semantic',
12587
+ icon: 'undo alternate',
12588
+ width: '10px',
12589
+ onClick: props.disabled ? undefined : function (e) {
12590
+ e.preventDefault();
12591
+ onDirty();
12592
+ }
12593
+ }, invalid ? {
12594
+ color: 'warningRed'
12595
+ } : {}))), icon && React__default.createElement(Icon, Object.assign({}, icon, 'onClick' in icon && props.disabled ? {
12596
+ onClick: undefined
12597
+ } : {}))))));
12592
12598
  });
12593
12599
  Input$1.displayName = 'Input';
12594
12600
 
@@ -14547,14 +14553,14 @@ var Date$1 = React__default.forwardRef(function (props, ref) {
14547
14553
  var icon = picker ? {
14548
14554
  icon: {
14549
14555
  type: 'feather',
14550
- icon: 'calendar'
14556
+ icon: 'calendar',
14557
+ onClick: function onClick() {
14558
+ return setOpen(function (prev) {
14559
+ return !prev;
14560
+ });
14561
+ }
14551
14562
  },
14552
- position: 'right',
14553
- onClick: function onClick() {
14554
- return setOpen(function (prev) {
14555
- return !prev;
14556
- });
14557
- }
14563
+ position: 'right'
14558
14564
  } : undefined;
14559
14565
  var inputProps = filterObject(props, ['picker', 'min', 'max']);
14560
14566
  return React__default.createElement(RelativeContainer$1, {
@@ -14626,9 +14632,9 @@ var Header$1 = function Header() {
14626
14632
  icon: {
14627
14633
  icon: {
14628
14634
  type: 'feather',
14629
- icon: 'search'
14630
- },
14631
- onClick: onSearch
14635
+ icon: 'search',
14636
+ onClick: onSearch
14637
+ }
14632
14638
  },
14633
14639
  loading: loading
14634
14640
  }));
@@ -14693,12 +14699,14 @@ var getInputContent = function getInputContent(props, selectedOption) {
14693
14699
  });
14694
14700
  };
14695
14701
 
14696
- var useSelect = function useSelect(props) {
14697
- var _useState = useState([]),
14698
- options = _useState[0],
14699
- setOptions = _useState[1];
14702
+ var useSelect = function useSelect(props, _ref2) {
14703
+ var options = _ref2[0],
14704
+ setOptions = _ref2[1];
14705
+
14706
+ var _ref3 = typeof props.value === 'string' ? [getSelected(props.value, options), props.value] : [props.value, props.value.value],
14707
+ selectedOption = _ref3[0],
14708
+ value = _ref3[1];
14700
14709
 
14701
- var selectedOption = typeof props.value === 'string' ? getSelected(props.value, options) : props.value;
14702
14710
  var parsedOptions = getOptions(props.setValue, options, selectedOption);
14703
14711
 
14704
14712
  var onReset = function onReset() {};
@@ -14723,7 +14731,17 @@ var useSelect = function useSelect(props) {
14723
14731
  }, children);
14724
14732
  }
14725
14733
  };
14726
- var onClear = props.onClear;
14734
+ var onClear = props.onClear,
14735
+ dirty = props.dirty;
14736
+
14737
+ parsed.dirty = function () {
14738
+ if (dirty === undefined || typeof dirty === 'function') return dirty;
14739
+ if (value === dirty.value) return undefined;
14740
+ return function () {
14741
+ return props.setValue(dirty.value, dirty.data);
14742
+ };
14743
+ }();
14744
+
14727
14745
  if (onClear) parsed.onClear = function () {
14728
14746
  return onClear('');
14729
14747
  };
@@ -14847,9 +14865,9 @@ var Header$2 = function Header() {
14847
14865
  icon: {
14848
14866
  icon: {
14849
14867
  type: 'feather',
14850
- icon: 'search'
14851
- },
14852
- onClick: onSearch
14868
+ icon: 'search',
14869
+ onClick: onSearch
14870
+ }
14853
14871
  },
14854
14872
  loading: loading
14855
14873
  }));
@@ -14944,16 +14962,14 @@ var parseValue = function parseValue(value) {
14944
14962
  return parsed;
14945
14963
  };
14946
14964
 
14947
- var useSelectMultiple = function useSelectMultiple(props) {
14948
- var _useState = useState([]),
14949
- options = _useState[0],
14950
- setOptions = _useState[1];
14951
-
14965
+ var useSelectMultiple = function useSelectMultiple(props, _ref) {
14966
+ var options = _ref[0],
14967
+ setOptions = _ref[1];
14952
14968
  var initial = parseValue(props.value);
14953
14969
 
14954
- var _useState2 = useState([].concat(initial)),
14955
- checked = _useState2[0],
14956
- setChecked = _useState2[1];
14970
+ var _useState = useState([].concat(initial)),
14971
+ checked = _useState[0],
14972
+ setChecked = _useState[1];
14957
14973
 
14958
14974
  var parsedOptions = getOptions$1(options, initial);
14959
14975
  var inputContent = getInputContent$1(props.value);
@@ -14989,6 +15005,31 @@ var useSelectMultiple = function useSelectMultiple(props) {
14989
15005
  return props.setValue([], []);
14990
15006
  }
14991
15007
  };
15008
+ var dirty = props.dirty;
15009
+
15010
+ returnData.dirty = function () {
15011
+ if (dirty === undefined || typeof dirty === 'function') return dirty;
15012
+ var values = [initial, dirty].map(function (e) {
15013
+ return e.map(function (e) {
15014
+ return e.value;
15015
+ }).sort();
15016
+ });
15017
+
15018
+ if (values[0].join(',') === values[1].join(',')) {
15019
+ return undefined;
15020
+ }
15021
+
15022
+ var _dirty$reduce = dirty.reduce(function (r, e) {
15023
+ return [[].concat(r[0], [e.value]), [].concat(r[1], [e.data])];
15024
+ }, [[], []]),
15025
+ value = _dirty$reduce[0],
15026
+ data = _dirty$reduce[1];
15027
+
15028
+ return function () {
15029
+ return props.setValue(value, data);
15030
+ };
15031
+ }();
15032
+
14992
15033
  return returnData;
14993
15034
  };
14994
15035
 
@@ -15004,41 +15045,45 @@ var EmptyContentContainer = styled.div(_templateObject3$f || (_templateObject3$f
15004
15045
 
15005
15046
  var Select = React__default.forwardRef(function (props, ref) {
15006
15047
  var position = props.position,
15007
- loader = props.loader;
15048
+ loader = props.loader,
15049
+ initialLoader = props.initialLoader;
15008
15050
 
15009
- var _ref = props.type === 'select-multiple' ? useSelectMultiple(props) : useSelect(props),
15051
+ var _useState = useState([].concat(initialLoader ? initialLoader() : [])),
15052
+ options = _useState[0],
15053
+ setOptions = _useState[1];
15054
+
15055
+ var _ref = props.type === 'select-multiple' ? useSelectMultiple(props, [options, setOptions]) : useSelect(props, [options, setOptions]),
15010
15056
  parsedOptions = _ref.parsedOptions,
15011
15057
  inputContent = _ref.inputContent,
15012
- _ref$options = _ref.options,
15013
- setOptions = _ref$options[1],
15014
15058
  onReset = _ref.onReset,
15015
15059
  menuProps = _ref.menu,
15016
15060
  getContext = _ref.getContext,
15017
- onClear = _ref.onClear;
15018
-
15019
- var _useState = useState(true),
15020
- _loading = _useState[0],
15021
- setLoading = _useState[1];
15061
+ onClear = _ref.onClear,
15062
+ dirty = _ref.dirty;
15022
15063
 
15023
- var _useState2 = useState(''),
15024
- search = _useState2[0],
15025
- _setSearch = _useState2[1];
15064
+ var _useState2 = useState(true),
15065
+ _loading = _useState2[0],
15066
+ setLoading = _useState2[1];
15026
15067
 
15027
15068
  var _useState3 = useState(''),
15028
- searchInput = _useState3[0],
15029
- setSearchInput = _useState3[1];
15069
+ search = _useState3[0],
15070
+ _setSearch = _useState3[1];
15030
15071
 
15031
- var _useState4 = useState(1),
15032
- page = _useState4[0],
15033
- setPage = _useState4[1];
15072
+ var _useState4 = useState(''),
15073
+ searchInput = _useState4[0],
15074
+ setSearchInput = _useState4[1];
15034
15075
 
15035
- var _useState5 = useState(false),
15036
- lastPage = _useState5[0],
15037
- setLastPage = _useState5[1];
15076
+ var _useState5 = useState(1),
15077
+ page = _useState5[0],
15078
+ setPage = _useState5[1];
15038
15079
 
15039
15080
  var _useState6 = useState(false),
15040
- open = _useState6[0],
15041
- setOpen = _useState6[1];
15081
+ lastPage = _useState6[0],
15082
+ setLastPage = _useState6[1];
15083
+
15084
+ var _useState7 = useState(false),
15085
+ open = _useState7[0],
15086
+ setOpen = _useState7[1];
15042
15087
 
15043
15088
  var loading = props.loading || _loading;
15044
15089
 
@@ -15048,7 +15093,7 @@ var Select = React__default.forwardRef(function (props, ref) {
15048
15093
  setPage(1);
15049
15094
  };
15050
15095
 
15051
- var inputProps = filterObject(props, ['type', 'onScrollEnd', 'position', 'value', 'onClear', 'placeholder']);
15096
+ var inputProps = filterObject(props, ['type', 'onScrollEnd', 'position', 'value', 'onClear', 'placeholder', 'initialLoader']);
15052
15097
 
15053
15098
  var _onScrollEnd = props.onScrollEnd || function () {};
15054
15099
 
@@ -15066,27 +15111,33 @@ var Select = React__default.forwardRef(function (props, ref) {
15066
15111
  try {
15067
15112
  setLoading(true);
15068
15113
  return Promise.resolve(loader(search, page)).then(function (optionsResult) {
15069
- if (Array.isArray(optionsResult)) {
15070
- setOptions(page === 1 ? optionsResult : function (prev) {
15071
- return prev.concat(optionsResult);
15072
- });
15073
- setLastPage(true);
15074
- } else {
15075
- setOptions(page === 1 ? optionsResult.options : function (prev) {
15076
- return prev.concat(optionsResult.options);
15114
+ if (optionsResult === null) return;
15115
+
15116
+ var _ref2 = Array.isArray(optionsResult) ? [optionsResult, true] : [optionsResult.options, optionsResult.lastPage],
15117
+ options = _ref2[0],
15118
+ lastPage = _ref2[1];
15119
+
15120
+ var initial = initialLoader ? initialLoader() : [];
15121
+ var filtered = initialLoader ? options.filter(function (x) {
15122
+ return !initial.some(function (y) {
15123
+ return x.value === y.value;
15077
15124
  });
15078
- setLastPage(optionsResult.lastPage);
15079
- }
15125
+ }) : options;
15080
15126
 
15127
+ var getWithOptions = function getWithOptions() {
15128
+ return !search && initialLoader ? [].concat(initial, filtered) : options;
15129
+ };
15130
+
15131
+ setOptions(page === 1 ? getWithOptions() : function (prev) {
15132
+ return prev.concat(filtered);
15133
+ });
15134
+ setLastPage(lastPage);
15081
15135
  setLoading(false);
15082
15136
  });
15083
15137
  } catch (e) {
15084
15138
  return Promise.reject(e);
15085
15139
  }
15086
- }, [loader, search, page]);
15087
- useEffect(function () {
15088
- setSearch('');
15089
- }, [loader]);
15140
+ }, [loader, search, page, initialLoader]);
15090
15141
  useEffect(function () {
15091
15142
  var timeoutId = setTimeout(function () {
15092
15143
  return onSubmit();
@@ -15137,14 +15188,15 @@ var Select = React__default.forwardRef(function (props, ref) {
15137
15188
  htmlReadOnly: true,
15138
15189
  onClick: onClick,
15139
15190
  loading: loading,
15191
+ dirty: dirty,
15140
15192
  icon: {
15141
- position: 'right',
15142
15193
  icon: {
15143
15194
  type: 'semantic',
15144
15195
  icon: open ? 'caret up' : 'caret down',
15145
- width: '14px'
15196
+ width: '14px',
15197
+ onClick: function onClick() {}
15146
15198
  },
15147
- onClick: onClick
15199
+ position: 'right'
15148
15200
  },
15149
15201
  ref: ref
15150
15202
  }, isEmpty ? {
@@ -15202,17 +15254,17 @@ var Password = React__default.forwardRef(function (props, ref) {
15202
15254
  }
15203
15255
  }
15204
15256
  };
15205
- var icon = {
15257
+
15258
+ var icon = _extends({
15206
15259
  type: 'feather',
15207
- icon: icons[visibility].icon,
15208
15260
  width: '19px'
15209
- };
15261
+ }, icons[visibility]);
15262
+
15210
15263
  return React__default.createElement(Input$1, Object.assign({}, props, {
15211
15264
  type: visibility === 'visible' ? 'text' : 'PASSWORD',
15212
15265
  icon: {
15213
15266
  icon: icon,
15214
- position: 'right',
15215
- onClick: icons[visibility].onClick
15267
+ position: 'right'
15216
15268
  },
15217
15269
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
15218
15270
  ref: ref
@@ -15459,8 +15511,16 @@ var Button$2 = function Button(props) {
15459
15511
  var _props$country = props.country,
15460
15512
  country = _props$country[0],
15461
15513
  _props$open = props.open,
15462
- open = _props$open[0];
15463
- return React__default.createElement(IconContainer$1, null, React__default.createElement(Flag, {
15514
+ open = _props$open[0],
15515
+ setOpen = _props$open[1],
15516
+ disabled = props.disabled;
15517
+ return React__default.createElement(IconContainer$1, Object.assign({}, disabled ? {} : {
15518
+ onClick: function onClick() {
15519
+ return setOpen(function (prev) {
15520
+ return !prev;
15521
+ });
15522
+ }
15523
+ }), React__default.createElement(Flag, {
15464
15524
  iso: country.iso
15465
15525
  }), React__default.createElement(Icon, {
15466
15526
  type: 'semantic',
@@ -15556,11 +15616,6 @@ var Component = React__default.forwardRef(function (props, ref) {
15556
15616
  type: 'jsx',
15557
15617
  width: '35px'
15558
15618
  },
15559
- onClick: function onClick() {
15560
- return setOpen(function (prev) {
15561
- return !prev;
15562
- });
15563
- },
15564
15619
  position: 'left'
15565
15620
  },
15566
15621
  ref: ref
@@ -15664,14 +15719,14 @@ var DatePicker = React__default.forwardRef(function (props, ref) {
15664
15719
  icon: {
15665
15720
  type: 'feather',
15666
15721
  icon: 'calendar',
15667
- width: '24px'
15722
+ width: '24px',
15723
+ onClick: function onClick() {
15724
+ return setOpen(function (prev) {
15725
+ return !prev;
15726
+ });
15727
+ }
15668
15728
  },
15669
- position: 'right',
15670
- onClick: function onClick() {
15671
- return setOpen(function (prev) {
15672
- return !prev;
15673
- });
15674
- }
15729
+ position: 'right'
15675
15730
  } : undefined;
15676
15731
  var inputProps = filterObject(props, ['picker', 'min', 'max']);
15677
15732
  return React__default.createElement(RelativeContainer$4, {
@@ -17220,14 +17275,14 @@ var DateTime = React__default.forwardRef(function (props, ref) {
17220
17275
  var icon = picker ? {
17221
17276
  icon: {
17222
17277
  type: 'feather',
17223
- icon: 'calendar'
17278
+ icon: 'calendar',
17279
+ onClick: function onClick() {
17280
+ return setOpen(function (prev) {
17281
+ return !prev;
17282
+ });
17283
+ }
17224
17284
  },
17225
- position: 'right',
17226
- onClick: function onClick() {
17227
- return setOpen(function (prev) {
17228
- return !prev;
17229
- });
17230
- }
17285
+ position: 'right'
17231
17286
  } : undefined;
17232
17287
  var inputProps = filterObject(props, ['picker', 'min', 'max']);
17233
17288
  return React__default.createElement(RelativeContainer$6, {
@@ -17482,9 +17537,9 @@ var AppliedFiltersMenu = function AppliedFiltersMenu(props) {
17482
17537
  icon: {
17483
17538
  icon: {
17484
17539
  type: 'feather',
17485
- icon: 'search'
17486
- },
17487
- onClick: onSubmitSearch
17540
+ icon: 'search',
17541
+ onClick: onSubmitSearch
17542
+ }
17488
17543
  },
17489
17544
  clearable: search !== '' && search === searched ? onClearSearch : undefined
17490
17545
  })), React__default.createElement(ScrollContainer, null, appliedFilters.filter(function (_ref) {
@@ -17668,9 +17723,9 @@ var Header$4 = function Header(props) {
17668
17723
  icon: {
17669
17724
  icon: {
17670
17725
  type: 'feather',
17671
- icon: 'search'
17672
- },
17673
- onClick: onSubmit
17726
+ icon: 'search',
17727
+ onClick: onSubmit
17728
+ }
17674
17729
  }
17675
17730
  }));
17676
17731
  };
@@ -17829,7 +17884,11 @@ var Submenu = function Submenu(props) {
17829
17884
  _setSearch(value);
17830
17885
 
17831
17886
  setPage(1);
17832
- if (force && changed === false) onSearch();
17887
+
17888
+ if (force && changed === false) {
17889
+ setLoading(true);
17890
+ onSearch();
17891
+ }
17833
17892
  };
17834
17893
 
17835
17894
  useEffect(function () {