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