@skbkontur/react-ui 5.4.3 → 5.4.5

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  3. package/cjs/components/DateRangePicker/DateRangePicker.js +24 -1
  4. package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
  5. package/cjs/components/DateRangePicker/DateRangePickerInput.js +2 -2
  6. package/cjs/components/DateRangePicker/DateRangePickerInput.js.map +1 -1
  7. package/cjs/components/MaskedInput/MaskedInput.d.ts +20 -17
  8. package/cjs/components/MaskedInput/MaskedInput.js +6 -3
  9. package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
  10. package/cjs/components/MenuItem/MenuItem.styles.js +3 -3
  11. package/cjs/components/MenuItem/MenuItem.styles.js.map +1 -1
  12. package/cjs/components/TokenInput/TokenInput.d.ts +13 -4
  13. package/cjs/components/TokenInput/TokenInput.js +63 -28
  14. package/cjs/components/TokenInput/TokenInput.js.map +1 -1
  15. package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  16. package/cjs/internal/themes/BasicTheme.d.ts +1 -0
  17. package/cjs/internal/themes/BasicTheme.js +2 -1
  18. package/cjs/internal/themes/BasicTheme.js.map +1 -1
  19. package/components/DateRangePicker/DateRangePicker/DateRangePicker.js +14 -1
  20. package/components/DateRangePicker/DateRangePicker/DateRangePicker.js.map +1 -1
  21. package/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  22. package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js +2 -2
  23. package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js.map +1 -1
  24. package/components/MaskedInput/MaskedInput/MaskedInput.js +1 -3
  25. package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
  26. package/components/MaskedInput/MaskedInput.d.ts +20 -17
  27. package/components/MenuItem/MenuItem.styles/MenuItem.styles.js +1 -1
  28. package/components/MenuItem/MenuItem.styles/MenuItem.styles.js.map +1 -1
  29. package/components/TokenInput/TokenInput/TokenInput.js +77 -48
  30. package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
  31. package/components/TokenInput/TokenInput.d.ts +13 -4
  32. package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  33. package/internal/themes/BasicTheme/BasicTheme.js +1 -0
  34. package/internal/themes/BasicTheme/BasicTheme.js.map +1 -1
  35. package/internal/themes/BasicTheme.d.ts +1 -0
  36. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"names":["_Emotion","require","_Mixins","_MenuItem","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","_templateObject19","_templateObject20","_templateObject21","getMenuItemPaddings","exports","_ref","menuItemPaddingX","menuItemPaddingY","paddingX","paddingY","styles","memoizeStyle","root","t","css","_taggedTemplateLiteralLoose2","default","resetButton","menuItemDisplay","menuItemTextColor","menuItemBorderRadius","menuItemGap","rootSmall","menuItemSizeMixin","menuItemPaddingXSmall","menuItemPaddingYSmall","menuItemLineHeightSmall","menuItemFontSizeSmall","rootMedium","menuItemPaddingXMedium","menuItemPaddingYMedium","menuItemLineHeightMedium","menuItemFontSizeMedium","rootLarge","menuItemPaddingXLarge","menuItemPaddingYLarge","menuItemLineHeightLarge","menuItemFontSizeLarge","rootMobile","menuItemFontSizeMobile","menuItemLineHeightMobile","menuItemPaddingMobile","hover","menuItemHoverBg","menuItemHoverColor","selected","menuItemSelectedBg","disabled","menuItemDisabledBg","menuItemDisabledColor","nonSelectable","link","menuItemLinkColor","loose","withIconSmall","withIconSizeMixin","menuItemPaddingForIconSmall","withIconMedium","menuItemPaddingForIconMedium","withIconLarge","menuItemPaddingForIconLarge","comment","menuItemCommentColor","menuItemCommentOpacity","commentHover","menuItemCommentColorHover","icon","iconSmall","iconSizeMixin","menuItemIconWidthSmall","iconMedium","menuItemIconWidthMedium","iconLarge","menuItemIconWidthLarge","mobileContentWithIcon"],"sources":["MenuItem.styles.ts"],"sourcesContent":["import type { Theme } from '../../lib/theming/Theme';\nimport { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nimport { iconSizeMixin, menuItemSizeMixin, withIconSizeMixin } from './MenuItem.mixins';\n\nexport const getMenuItemPaddings = ({\n menuItemPaddingX,\n menuItemPaddingY,\n}: Record<'menuItemPaddingX' | 'menuItemPaddingY', string>) => {\n const paddingX = menuItemPaddingX;\n const paddingY = menuItemPaddingY;\n\n return { paddingX, paddingY };\n};\n\nexport const styles = memoizeStyle({\n root(t: Theme) {\n return css`\n ${resetButton()};\n\n cursor: pointer;\n display: ${t.menuItemDisplay};\n position: relative;\n text-decoration: none;\n color: ${t.menuItemTextColor};\n border-radius: ${t.menuItemBorderRadius};\n\n button& {\n min-width: 100%;\n }\n\n &:nth-last-of-type(n + 2) {\n margin-bottom: ${t.menuItemGap};\n }\n `;\n },\n\n rootSmall(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXSmall,\n t.menuItemPaddingYSmall,\n t.menuItemLineHeightSmall,\n t.menuItemFontSizeSmall,\n )};\n `;\n },\n rootMedium(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXMedium,\n t.menuItemPaddingYMedium,\n t.menuItemLineHeightMedium,\n t.menuItemFontSizeMedium,\n )};\n `;\n },\n rootLarge(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXLarge,\n t.menuItemPaddingYLarge,\n t.menuItemLineHeightLarge,\n t.menuItemFontSizeLarge,\n )};\n `;\n },\n\n rootMobile(t: Theme) {\n return css`\n font-size: ${t.menuItemFontSizeMobile};\n line-height: ${t.menuItemLineHeightMobile};\n padding: ${t.menuItemPaddingMobile};\n `;\n },\n\n hover(t: Theme) {\n // Color with !important in purpose to override `a:hover`\n return css`\n background: ${t.menuItemHoverBg} !important;\n color: ${t.menuItemHoverColor} !important;\n `;\n },\n selected(t: Theme) {\n return css`\n background: ${t.menuItemSelectedBg} !important;\n `;\n },\n disabled(t: Theme) {\n return css`\n background: ${t.menuItemDisabledBg};\n color: ${t.menuItemDisabledColor};\n cursor: default;\n `;\n },\n nonSelectable() {\n return css`\n cursor: default;\n `;\n },\n link(t: Theme) {\n return css`\n color: ${t.menuItemLinkColor};\n `;\n },\n loose() {\n return css`\n padding-left: 15px;\n `;\n },\n withIconSmall(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconSmall)}\n `;\n },\n withIconMedium(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconMedium)}\n `;\n },\n withIconLarge(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconLarge)}\n `;\n },\n comment(t: Theme) {\n return css`\n color: ${t.menuItemCommentColor};\n opacity: ${t.menuItemCommentOpacity};\n white-space: normal;\n padding-top: 4px;\n `;\n },\n commentHover(t: Theme) {\n return css`\n color: ${t.menuItemCommentColorHover};\n opacity: 0.6;\n `;\n },\n icon() {\n return css`\n display: inline-block;\n position: absolute;\n transform: translateY(0px); // icon shifts one pixel up in firefox on medium size without this property\n `;\n },\n iconSmall(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthSmall, t.menuItemPaddingXSmall)};\n `;\n },\n iconMedium(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthMedium, t.menuItemPaddingXMedium)};\n `;\n },\n iconLarge(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthLarge, t.menuItemPaddingXLarge)};\n `;\n },\n mobileContentWithIcon() {\n return css`\n margin-left: 8px;\n `;\n },\n});\n"],"mappings":";AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;;AAEA,IAAAE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["_Emotion","require","_Mixins","_MenuItem","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","_templateObject14","_templateObject15","_templateObject16","_templateObject17","_templateObject18","_templateObject19","_templateObject20","_templateObject21","getMenuItemPaddings","exports","_ref","menuItemPaddingX","menuItemPaddingY","paddingX","paddingY","styles","memoizeStyle","root","t","css","_taggedTemplateLiteralLoose2","default","resetButton","menuItemDisplay","menuItemTextColor","menuItemBorderRadius","menuItemGap","rootSmall","menuItemSizeMixin","menuItemPaddingXSmall","menuItemPaddingYSmall","menuItemLineHeightSmall","menuItemFontSizeSmall","rootMedium","menuItemPaddingXMedium","menuItemPaddingYMedium","menuItemLineHeightMedium","menuItemFontSizeMedium","rootLarge","menuItemPaddingXLarge","menuItemPaddingYLarge","menuItemLineHeightLarge","menuItemFontSizeLarge","rootMobile","menuItemFontSizeMobile","menuItemLineHeightMobile","menuItemPaddingMobile","hover","menuItemHoverBg","menuItemHoverColor","selected","menuItemSelectedBg","disabled","menuItemDisabledBg","menuItemDisabledColor","nonSelectable","link","menuItemLinkColor","loose","withIconSmall","withIconSizeMixin","menuItemPaddingForIconSmall","withIconMedium","menuItemPaddingForIconMedium","withIconLarge","menuItemPaddingForIconLarge","comment","menuItemCommentColor","menuItemCommentOpacity","commentHover","menuItemCommentColorHover","menuItemCommentOpacityHover","icon","iconSmall","iconSizeMixin","menuItemIconWidthSmall","iconMedium","menuItemIconWidthMedium","iconLarge","menuItemIconWidthLarge","mobileContentWithIcon"],"sources":["MenuItem.styles.ts"],"sourcesContent":["import type { Theme } from '../../lib/theming/Theme';\nimport { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nimport { iconSizeMixin, menuItemSizeMixin, withIconSizeMixin } from './MenuItem.mixins';\n\nexport const getMenuItemPaddings = ({\n menuItemPaddingX,\n menuItemPaddingY,\n}: Record<'menuItemPaddingX' | 'menuItemPaddingY', string>) => {\n const paddingX = menuItemPaddingX;\n const paddingY = menuItemPaddingY;\n\n return { paddingX, paddingY };\n};\n\nexport const styles = memoizeStyle({\n root(t: Theme) {\n return css`\n ${resetButton()};\n\n cursor: pointer;\n display: ${t.menuItemDisplay};\n position: relative;\n text-decoration: none;\n color: ${t.menuItemTextColor};\n border-radius: ${t.menuItemBorderRadius};\n\n button& {\n min-width: 100%;\n }\n\n &:nth-last-of-type(n + 2) {\n margin-bottom: ${t.menuItemGap};\n }\n `;\n },\n\n rootSmall(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXSmall,\n t.menuItemPaddingYSmall,\n t.menuItemLineHeightSmall,\n t.menuItemFontSizeSmall,\n )};\n `;\n },\n rootMedium(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXMedium,\n t.menuItemPaddingYMedium,\n t.menuItemLineHeightMedium,\n t.menuItemFontSizeMedium,\n )};\n `;\n },\n rootLarge(t: Theme) {\n return css`\n ${menuItemSizeMixin(\n t.menuItemPaddingXLarge,\n t.menuItemPaddingYLarge,\n t.menuItemLineHeightLarge,\n t.menuItemFontSizeLarge,\n )};\n `;\n },\n\n rootMobile(t: Theme) {\n return css`\n font-size: ${t.menuItemFontSizeMobile};\n line-height: ${t.menuItemLineHeightMobile};\n padding: ${t.menuItemPaddingMobile};\n `;\n },\n\n hover(t: Theme) {\n // Color with !important in purpose to override `a:hover`\n return css`\n background: ${t.menuItemHoverBg} !important;\n color: ${t.menuItemHoverColor} !important;\n `;\n },\n selected(t: Theme) {\n return css`\n background: ${t.menuItemSelectedBg} !important;\n `;\n },\n disabled(t: Theme) {\n return css`\n background: ${t.menuItemDisabledBg};\n color: ${t.menuItemDisabledColor};\n cursor: default;\n `;\n },\n nonSelectable() {\n return css`\n cursor: default;\n `;\n },\n link(t: Theme) {\n return css`\n color: ${t.menuItemLinkColor};\n `;\n },\n loose() {\n return css`\n padding-left: 15px;\n `;\n },\n withIconSmall(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconSmall)}\n `;\n },\n withIconMedium(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconMedium)}\n `;\n },\n withIconLarge(t: Theme) {\n return css`\n ${withIconSizeMixin(t.menuItemPaddingForIconLarge)}\n `;\n },\n comment(t: Theme) {\n return css`\n color: ${t.menuItemCommentColor};\n opacity: ${t.menuItemCommentOpacity};\n white-space: normal;\n padding-top: 4px;\n `;\n },\n commentHover(t: Theme) {\n return css`\n color: ${t.menuItemCommentColorHover};\n opacity: ${t.menuItemCommentOpacityHover};\n `;\n },\n icon() {\n return css`\n display: inline-block;\n position: absolute;\n transform: translateY(0px); // icon shifts one pixel up in firefox on medium size without this property\n `;\n },\n iconSmall(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthSmall, t.menuItemPaddingXSmall)};\n `;\n },\n iconMedium(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthMedium, t.menuItemPaddingXMedium)};\n `;\n },\n iconLarge(t: Theme) {\n return css`\n ${iconSizeMixin(t.menuItemIconWidthLarge, t.menuItemPaddingXLarge)};\n `;\n },\n mobileContentWithIcon() {\n return css`\n margin-left: 8px;\n `;\n },\n});\n"],"mappings":";AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;;AAEA,IAAAE,SAAA,GAAAF,OAAA,sBAAwF,IAAAG,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA,EAAAC,iBAAA;;AAEjF,IAAMC,mBA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WAAOrD,YAAG,EAAAhB,iBAAA,KAAAA,iBAAA,OAAAiB,4BAAA,CAAAC,OAAA;;;;;EAKZ,CAAC;EACDoD,SAAS,WAAAA,UAACvD,CAAQ,EAAE;IAClB,WAAOC,YAAG,EAAAf,iBAAA,KAAAA,iBAAA,OAAAgB,4BAAA,CAAAC,OAAA;IACN,IAAAqD,uBAAa,EAACxD,CAAC,CAACyD,sBAAsB,EAAEzD,CAAC,CAACW,qBAAqB,CAAC;;EAEtE,CAAC;EACD+C,UAAU,WAAAA,WAAC1D,CAAQ,EAAE;IACnB,WAAOC,YAAG,EAAAd,iBAAA,KAAAA,iBAAA,OAAAe,4BAAA,CAAAC,OAAA;IACN,IAAAqD,uBAAa,EAACxD,CAAC,CAAC2D,uBAAuB,EAAE3D,CAAC,CAACgB,sBAAsB,CAAC;;EAExE,CAAC;EACD4C,SAAS,WAAAA,UAAC5D,CAAQ,EAAE;IAClB,WAAOC,YAAG,EAAAb,iBAAA,KAAAA,iBAAA,OAAAc,4BAAA,CAAAC,OAAA;IACN,IAAAqD,uBAAa,EAACxD,CAAC,CAAC6D,sBAAsB,EAAE7D,CAAC,CAACqB,qBAAqB,CAAC;;EAEtE,CAAC;EACDyC,qBAAqB,WAAAA,sBAAA,EAAG;IACtB,WAAO7D,YAAG,EAAAZ,iBAAA,KAAAA,iBAAA,OAAAa,4BAAA,CAAAC,OAAA;;;EAGZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { AriaAttributes, FocusEventHandler, HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
1
+ import type { AriaAttributes, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import type { TokenProps, TokenSize } from '../Token';
4
4
  import type { MenuItemState } from '../MenuItem';
@@ -28,6 +28,8 @@ export interface TokenInputProps<T> extends CommonProps, Pick<AriaAttributes, 'a
28
28
  /** Задает HTML-событие `onblur`.
29
29
  * @ignore */
30
30
  onBlur?: FocusEventHandler<HTMLTextAreaElement>;
31
+ /** Задает HTML-событие `onkeydown`. */
32
+ onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
31
33
  /** Устанавливает фокус на контроле после окончания загрузки страницы. */
32
34
  autoFocus?: boolean;
33
35
  /** Задает размер контрола. */
@@ -63,9 +65,11 @@ export interface TokenInputProps<T> extends CommonProps, Pick<AriaAttributes, 'a
63
65
  /** Задает функцию, которая отображает заданное содержимое при пустом результате поиска. Не работает, если рендерится `AddButton`. */
64
66
  renderNotFound?: () => React.ReactNode;
65
67
  /** Преобразует значение в элемент списка. */
66
- valueToItem?: (item: string) => T;
67
- /** Определяет уникальный ключ по элементу. */
68
+ valueToItem?: (value: string) => T;
69
+ /** @deprecated Используйте `itemToId` вместо `toKey`. */
68
70
  toKey?: (item: T) => string | number | undefined;
71
+ /** Задает функцию сравнения полученных результатов с value. */
72
+ itemToId?: (item: T) => string | number | undefined;
69
73
  /** Задает текст, который отображается если не введено никакое значение. */
70
74
  placeholder?: string;
71
75
  /** Задает символы, которые разделяют введённый текст на токены. */
@@ -129,7 +133,7 @@ export declare const TokenInputDataTids: {
129
133
  readonly tokenInputMenu: "TokenInputMenu__root";
130
134
  readonly label: "TokenInput__label";
131
135
  };
132
- type DefaultProps<T> = Required<Pick<TokenInputProps<T>, 'selectedItems' | 'delimiters' | 'renderItem' | 'renderValue' | 'valueToString' | 'valueToItem' | 'toKey' | 'onValueChange' | 'width' | 'onBlur' | 'onFocus' | 'onMouseEnter' | 'onMouseLeave' | 'menuWidth' | 'menuAlign'>>;
136
+ type DefaultProps<T> = Required<Pick<TokenInputProps<T>, 'selectedItems' | 'delimiters' | 'renderItem' | 'renderValue' | 'valueToString' | 'valueToItem' | 'toKey' | 'itemToId' | 'onValueChange' | 'width' | 'onBlur' | 'onFocus' | 'onMouseEnter' | 'onMouseLeave' | 'menuWidth' | 'menuAlign'>>;
133
137
  /**
134
138
  * Поле с токенами `TokenInput` — это поле ввода со списком подсказок.
135
139
  *
@@ -167,6 +171,10 @@ export declare class TokenInput<T = string> extends React.PureComponent<TokenInp
167
171
  * @public
168
172
  */
169
173
  blur(): void;
174
+ /** Кратковременно визуально подсвечивает поле ввода, чтобы привлечь внимание пользователя.
175
+ * @public
176
+ */
177
+ blink(): void;
170
178
  render(): React.JSX.Element;
171
179
  private getLabelSizeClassName;
172
180
  private getInputSizeClassName;
@@ -176,6 +184,7 @@ export declare class TokenInput<T = string> extends React.PureComponent<TokenInp
176
184
  * @public
177
185
  */
178
186
  reset(): void;
187
+ private isEqual;
179
188
  private hasValueInItems;
180
189
  private get showAddItemHint();
181
190
  private get type();
@@ -8,6 +8,7 @@
8
8
 
9
9
 
10
10
 
11
+
11
12
  var _react = _interopRequireDefault(require("react"));
12
13
  var _lodash = _interopRequireDefault(require("lodash.isequal"));
13
14
  var _globalObject = require("@skbkontur/global-object");
@@ -49,6 +50,7 @@ var _TokenView = require("../Token/TokenView");
49
50
  var _featureFlagsContext = require("../../lib/featureFlagsContext");
50
51
  var _SizeDecorator = require("../../lib/size/SizeDecorator");
51
52
 
53
+ var _blink2 = require("../../lib/blink");
52
54
 
53
55
 
54
56
  var _locale = require("./locale");
@@ -199,6 +201,12 @@ TokenInputType = exports.TokenInputType = /*#__PURE__*/function (TokenInputType)
199
201
 
200
202
 
201
203
 
204
+
205
+
206
+
207
+
208
+
209
+
202
210
 
203
211
 
204
212
 
@@ -244,6 +252,7 @@ var TokenInputDataTids = exports.TokenInputDataTids = {
244
252
 
245
253
 
246
254
 
255
+
247
256
 
248
257
 
249
258
  var defaultToKey = function defaultToKey(item) {return item.toString();};
@@ -313,6 +322,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
313
322
 
314
323
 
315
324
 
325
+
316
326
 
317
327
 
318
328
  state = DefaultState;_this.
@@ -565,15 +575,27 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
565
575
 
566
576
 
567
577
 
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+ isEqual = function (itemA, itemB) {
587
+ var _this$getProps = _this.getProps(),itemToId = _this$getProps.itemToId;
588
+ return (0, _lodash.default)(itemToId(itemA), itemToId(itemB));
589
+ };_this.
568
590
 
569
591
  hasValueInItems = function (items, value) {
592
+ var _this$getProps2 = _this.getProps(),valueToString = _this$getProps2.valueToString;
570
593
  if (typeof value === 'string') {
571
- return items.includes(value);
594
+ return items.map(function (item) {return valueToString(item);}).includes(value);
572
595
  }
573
- // todo: как то не очень
574
- return items.some(function (item) {return (0, _lodash.default)(item, value);});
575
- };_this.
576
596
 
597
+ return items.some(function (item) {return _this.isEqual(item, value);});
598
+ };_this.
577
599
 
578
600
 
579
601
 
@@ -746,7 +768,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
746
768
  return;
747
769
  }
748
770
  event.preventDefault();
749
- var _this$getProps = _this.getProps(),selectedItems = _this$getProps.selectedItems,valueToString = _this$getProps.valueToString,delimiters = _this$getProps.delimiters;
771
+ var _this$getProps3 = _this.getProps(),selectedItems = _this$getProps3.selectedItems,valueToString = _this$getProps3.valueToString,delimiters = _this$getProps3.delimiters;
750
772
  // упорядочивание токенов по индексу
751
773
  var tokens = _this.state.activeTokens.
752
774
  map(function (token) {return selectedItems.indexOf(token);}).
@@ -761,7 +783,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
761
783
  return;
762
784
  }
763
785
  var paste = event.clipboardData.getData('text');
764
- var _this$getProps2 = _this.getProps(),delimiters = _this$getProps2.delimiters,selectedItems = _this$getProps2.selectedItems,valueToItem = _this$getProps2.valueToItem,onValueChange = _this$getProps2.onValueChange;
786
+ var _this$getProps4 = _this.getProps(),delimiters = _this$getProps4.delimiters,selectedItems = _this$getProps4.selectedItems,valueToItem = _this$getProps4.valueToItem,onValueChange = _this$getProps4.onValueChange;
765
787
  if (delimiters.some(function (delimiter) {return paste.includes(delimiter);})) {
766
788
  event.preventDefault();
767
789
  event.stopPropagation();
@@ -778,17 +800,17 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
778
800
  }
779
801
  };_this.
780
802
 
781
- tryGetItems = /*#__PURE__*/function () {var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {var autocompleteItems, _this$getProps3, selectedItems, valueToItem, valueToString, isSelectedItem, isEditingItem, autocompleteItemsUnique, editingItem, selectItemIndex;return _regenerator.default.wrap(function _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:if (query === void 0) {query = '';}if (!(
803
+ tryGetItems = /*#__PURE__*/function () {var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {var autocompleteItems, _this$getProps5, selectedItems, valueToItem, valueToString, isSelectedItem, isEditingItem, autocompleteItemsUnique, editingItem, selectItemIndex;return _regenerator.default.wrap(function _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:if (query === void 0) {query = '';}if (!(
782
804
  _this.props.getItems && (_this.isInputValueChanged || !_this.props.hideMenuIfEmptyInputValue))) {_context.next = 15;break;}
783
805
  _this.dispatch({ type: 'SET_LOADING', payload: true });_context.next = 5;return (
784
806
  _this.props.getItems(query));case 5:autocompleteItems = _context.sent;
785
- _this.dispatch({ type: 'SET_LOADING', payload: false });_this$getProps3 =
807
+ _this.dispatch({ type: 'SET_LOADING', payload: false });_this$getProps5 =
786
808
 
787
- _this.getProps(), selectedItems = _this$getProps3.selectedItems, valueToItem = _this$getProps3.valueToItem, valueToString = _this$getProps3.valueToString;
809
+ _this.getProps(), selectedItems = _this$getProps5.selectedItems, valueToItem = _this$getProps5.valueToItem, valueToString = _this$getProps5.valueToString;
788
810
  isSelectedItem = function isSelectedItem(item) {return _this.hasValueInItems(selectedItems, item);};
789
811
  isEditingItem = function isEditingItem(item) {
790
812
  var editingItem = selectedItems[_this.state.editingTokenIndex];
791
- return !!editingItem && (0, _lodash.default)(item, editingItem);
813
+ return !!editingItem && _this.isEqual(item, editingItem);
792
814
  };
793
815
 
794
816
  autocompleteItemsUnique = autocompleteItems.filter(function (item) {return !isSelectedItem(item) || isEditingItem(item);});
@@ -796,7 +818,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
796
818
  if (_this.isEditingMode) {
797
819
  editingItem = selectedItems[_this.state.editingTokenIndex];
798
820
  if (
799
- (0, _lodash.default)(editingItem, valueToItem(_this.state.inputValue)) &&
821
+ _this.isEqual(editingItem, valueToItem(_this.state.inputValue)) &&
800
822
  !_this.hasValueInItems(autocompleteItemsUnique, editingItem))
801
823
  {
802
824
  autocompleteItemsUnique.unshift(editingItem);
@@ -817,6 +839,12 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
817
839
 
818
840
 
819
841
  handleKeyDown = function (event) {
842
+ _this.props.onKeyDown == null || _this.props.onKeyDown(event);
843
+
844
+ if (event.defaultPrevented) {
845
+ return;
846
+ }
847
+
820
848
  if (_this.isCursorVisible) {
821
849
  _this.handleInputKeyDown(event);
822
850
  } else {
@@ -824,7 +852,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
824
852
  }
825
853
  };_this.
826
854
 
827
- handleInputKeyDown = function (e) {var _this$input3, _this$input4;
855
+ handleInputKeyDown = function (e) {var _this$state$autocompl, _this$state$autocompl2, _this$input3, _this$input4;
828
856
  e.stopPropagation();
829
857
 
830
858
  if (
@@ -843,9 +871,11 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
843
871
  }
844
872
  }
845
873
  var isRightmostTokenNotDisabled = !_this.isTokenDisabled(_this.getProps().selectedItems.length - 1);
874
+ var canSetValueToInput = _this.showAddItemHint || ((_this$state$autocompl = (_this$state$autocompl2 = _this.state.autocompleteItems) == null ? void 0 : _this$state$autocompl2.length) != null ? _this$state$autocompl : 0) > 0;
875
+
846
876
  switch (true) {
847
877
  case (0, _identifiers.isKeyEnter)(e):
848
- if (_this.menuRef) {
878
+ if (canSetValueToInput && _this.menuRef) {
849
879
  _this.menuRef.enter(e);
850
880
  }
851
881
  // don't allow textarea
@@ -900,7 +930,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
900
930
  };_this.
901
931
 
902
932
  handleWrapperKeyDown = function (e) {var _this$wrapper2;
903
- var _this$getProps4 = _this.getProps(),selectedItems = _this$getProps4.selectedItems,onValueChange = _this$getProps4.onValueChange;
933
+ var _this$getProps6 = _this.getProps(),selectedItems = _this$getProps6.selectedItems,onValueChange = _this$getProps6.onValueChange;
904
934
  switch (true) {
905
935
  case (0, _identifiers.isKeyBackspace)(e):
906
936
  case (0, _identifiers.isKeyDelete)(e):{
@@ -968,7 +998,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
968
998
  handleWrapperArrowsWithShift = function (isLeftEdge, isRightEdge, newItemIndex) {
969
999
  if (!isLeftEdge && !isRightEdge) {
970
1000
  var itemNew = _this.getProps().selectedItems[newItemIndex];
971
- var itemsNew = [itemNew].concat(_this.state.activeTokens.filter(function (item) {return !(0, _lodash.default)(item, itemNew);}));
1001
+ var itemsNew = [itemNew].concat(_this.state.activeTokens.filter(function (item) {return !_this.isEqual(item, itemNew);}));
972
1002
  _this.dispatch({ type: 'SET_ACTIVE_TOKENS', payload: itemsNew });
973
1003
  }
974
1004
  };_this.
@@ -985,7 +1015,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
985
1015
  };_this.
986
1016
 
987
1017
  selectItem = function (item) {
988
- var _this$getProps5 = _this.getProps(),selectedItems = _this$getProps5.selectedItems,valueToString = _this$getProps5.valueToString;
1018
+ var _this$getProps7 = _this.getProps(),selectedItems = _this$getProps7.selectedItems,valueToString = _this$getProps7.valueToString;
989
1019
  if (_this.isEditingMode) {
990
1020
  _this.dispatch({ type: 'UPDATE_QUERY', payload: valueToString(item) }, _this.finishTokenEdit);
991
1021
  } else if (!_this.hasValueInItems(selectedItems, item)) {
@@ -996,8 +1026,8 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
996
1026
  };_this.
997
1027
 
998
1028
  handleRemoveToken = function (item) {
999
- _this.props.onValueChange == null || _this.props.onValueChange(_this.getProps().selectedItems.filter(function (_) {return !(0, _lodash.default)(_, item);}));
1000
- var filteredActiveTokens = _this.state.activeTokens.filter(function (_) {return !(0, _lodash.default)(_, item);});
1029
+ _this.props.onValueChange == null || _this.props.onValueChange(_this.getProps().selectedItems.filter(function (_) {return !_this.isEqual(_, item);}));
1030
+ var filteredActiveTokens = _this.state.activeTokens.filter(function (_) {return !_this.isEqual(_, item);});
1001
1031
 
1002
1032
  _this.dispatch({ type: 'SET_ACTIVE_TOKENS', payload: filteredActiveTokens });
1003
1033
  if (filteredActiveTokens.length === 0) {
@@ -1011,7 +1041,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
1011
1041
  var items = _this.state.activeTokens;
1012
1042
  if (event.ctrlKey) {
1013
1043
  var newItems = _this.hasValueInItems(_this.state.activeTokens, itemNew) ?
1014
- items.filter(function (item) {return !(0, _lodash.default)(item, itemNew);}) : [].concat(
1044
+ items.filter(function (item) {return !_this.isEqual(item, itemNew);}) : [].concat(
1015
1045
  items, [itemNew]);
1016
1046
  _this.dispatch({ type: 'SET_ACTIVE_TOKENS', payload: newItems });
1017
1047
  } else {
@@ -1021,7 +1051,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
1021
1051
  };_this.
1022
1052
 
1023
1053
  handleTokenEdit = function (itemNew) {
1024
- var _this$getProps6 = _this.getProps(),selectedItems = _this$getProps6.selectedItems,valueToString = _this$getProps6.valueToString;
1054
+ var _this$getProps8 = _this.getProps(),selectedItems = _this$getProps8.selectedItems,valueToString = _this$getProps8.valueToString;
1025
1055
  var editingTokenIndex = selectedItems.findIndex(function (item) {return item === itemNew;});
1026
1056
  _this.dispatch({ type: 'SET_EDITING_TOKEN_INDEX', payload: editingTokenIndex });
1027
1057
 
@@ -1036,10 +1066,13 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
1036
1066
  _this.tryGetItems();
1037
1067
  };_this.
1038
1068
 
1039
- finishTokenEdit = function () {
1040
- var selectedItems = _this.getProps().selectedItems;
1041
- var _this$state2 = _this.state,editingTokenIndex = _this$state2.editingTokenIndex,inputValue = _this$state2.inputValue,reservedInputValue = _this$state2.reservedInputValue;
1042
- var editedItem = _this.getProps().valueToItem(inputValue);
1069
+ finishTokenEdit = function () {var _autocompleteItems$fi;
1070
+ var _this$getProps9 = _this.getProps(),selectedItems = _this$getProps9.selectedItems,valueToString = _this$getProps9.valueToString;
1071
+ var _this$state2 = _this.state,editingTokenIndex = _this$state2.editingTokenIndex,inputValue = _this$state2.inputValue,reservedInputValue = _this$state2.reservedInputValue,autocompleteItems = _this$state2.autocompleteItems;
1072
+
1073
+ var editedItem = (_autocompleteItems$fi =
1074
+ autocompleteItems == null ? void 0 : autocompleteItems.find(function (item) {return valueToString(item) === inputValue;})) != null ? _autocompleteItems$fi : _this.getProps().valueToItem(inputValue);
1075
+
1043
1076
  var newItems = selectedItems.concat([]);
1044
1077
 
1045
1078
  if (!_this.hasValueInItems(selectedItems, editedItem)) {
@@ -1212,7 +1245,7 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
1212
1245
  };_this.
1213
1246
 
1214
1247
  getAvailableTokenIndex = function (startIndex, isDirectionLeft) {if (isDirectionLeft === void 0) {isDirectionLeft = true;}
1215
- var _this$getProps7 = _this.getProps(),selectedItems = _this$getProps7.selectedItems;
1248
+ var _this$getProps10 = _this.getProps(),selectedItems = _this$getProps10.selectedItems;
1216
1249
  var step = isDirectionLeft ? -1 : +1;
1217
1250
  var availableIndex = startIndex + step;
1218
1251
 
@@ -1230,12 +1263,14 @@ TokenInput = exports.TokenInput = (_dec = (0, _decorators.locale)('TokenInput',
1230
1263
  * @public
1231
1264
  */;_proto.focus = function focus() {var _this$input8;(_this$input8 = this.input) == null || _this$input8.focus();} /**
1232
1265
  * @public
1233
- */;_proto.blur = function blur() {var _this$input9;(_this$input9 = this.input) == null || _this$input9.blur();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Consumer, null, function (flags) {_this2.featureFlags = (0, _featureFlagsContext.getFullReactUIFlagsContext)(flags);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});});};_proto.getLabelSizeClassName = function getLabelSizeClassName() {switch (this.size) {case 'large':return _TokenInput2.styles.labelLarge(this.theme);case 'medium':return _TokenInput2.styles.labelMedium(this.theme);case 'small':default:return _TokenInput2.styles.labelSmall(this.theme);}};_proto.getInputSizeClassName = function getInputSizeClassName() {switch (this.size) {case 'large':return _TokenInput2.styles.inputLarge(this.theme);case 'medium':return _TokenInput2.styles.inputMedium(this.theme);case 'small':default:return _TokenInput2.styles.inputSmall(this.theme);}};_proto.renderMain = function renderMain() {var _cx, _cx2, _cx3;if (this.type !== TokenInputType.WithoutReference && !this.props.getItems) {throw Error('Missed getItems for type ' + this.type);}var _this$props2 = this.props,maxMenuHeight = _this$props2.maxMenuHeight,error = _this$props2.error,warning = _this$props2.warning,disabled = _this$props2.disabled,renderNotFound = _this$props2.renderNotFound,hideMenuIfEmptyInputValue = _this$props2.hideMenuIfEmptyInputValue,inputMode = _this$props2.inputMode,renderTotalCount = _this$props2.renderTotalCount,totalCount = _this$props2.totalCount,ariaDescribedby = _this$props2['aria-describedby'],ariaLabel = _this$props2['aria-label'];var _this$getProps8 = this.getProps(),selectedItems = _this$getProps8.selectedItems,width = _this$getProps8.width,onMouseEnter = _this$getProps8.onMouseEnter,onMouseLeave = _this$getProps8.onMouseLeave,menuWidth = _this$getProps8.menuWidth,menuAlign = _this$getProps8.menuAlign,renderItem = _this$getProps8.renderItem;var _this$state3 = this.state,activeTokens = _this$state3.activeTokens,inFocus = _this$state3.inFocus,inputValueWidth = _this$state3.inputValueWidth,inputValueHeight = _this$state3.inputValueHeight,inputValue = _this$state3.inputValue,reservedInputValue = _this$state3.reservedInputValue,autocompleteItems = _this$state3.autocompleteItems,loading = _this$state3.loading;var showMenu = this.type !== TokenInputType.WithoutReference && this.isCursorVisible && activeTokens.length === 0 && (this.isInputValueChanged || !hideMenuIfEmptyInputValue);var theme = this.theme;var inputInlineStyles = { // вычисляем ширину чтобы input автоматически перенёсся на следующую строку при необходимости
1266
+ */;_proto.blur = function blur() {var _this$input9;(_this$input9 = this.input) == null || _this$input9.blur();} /** Кратковременно визуально подсвечивает поле ввода, чтобы привлечь внимание пользователя.
1267
+ * @public
1268
+ */;_proto.blink = function blink() {(0, _blink2.blink)({ el: this.wrapper, blinkColor: this.theme.inputBlinkColor });};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Consumer, null, function (flags) {_this2.featureFlags = (0, _featureFlagsContext.getFullReactUIFlagsContext)(flags);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});});};_proto.getLabelSizeClassName = function getLabelSizeClassName() {switch (this.size) {case 'large':return _TokenInput2.styles.labelLarge(this.theme);case 'medium':return _TokenInput2.styles.labelMedium(this.theme);case 'small':default:return _TokenInput2.styles.labelSmall(this.theme);}};_proto.getInputSizeClassName = function getInputSizeClassName() {switch (this.size) {case 'large':return _TokenInput2.styles.inputLarge(this.theme);case 'medium':return _TokenInput2.styles.inputMedium(this.theme);case 'small':default:return _TokenInput2.styles.inputSmall(this.theme);}};_proto.renderMain = function renderMain() {var _cx, _cx2, _cx3;if (this.type !== TokenInputType.WithoutReference && !this.props.getItems) {throw Error('Missed getItems for type ' + this.type);}var _this$props2 = this.props,maxMenuHeight = _this$props2.maxMenuHeight,error = _this$props2.error,warning = _this$props2.warning,disabled = _this$props2.disabled,renderNotFound = _this$props2.renderNotFound,hideMenuIfEmptyInputValue = _this$props2.hideMenuIfEmptyInputValue,inputMode = _this$props2.inputMode,renderTotalCount = _this$props2.renderTotalCount,totalCount = _this$props2.totalCount,ariaDescribedby = _this$props2['aria-describedby'],ariaLabel = _this$props2['aria-label'];var _this$getProps11 = this.getProps(),selectedItems = _this$getProps11.selectedItems,width = _this$getProps11.width,onMouseEnter = _this$getProps11.onMouseEnter,onMouseLeave = _this$getProps11.onMouseLeave,menuWidth = _this$getProps11.menuWidth,menuAlign = _this$getProps11.menuAlign,renderItem = _this$getProps11.renderItem;var _this$state3 = this.state,activeTokens = _this$state3.activeTokens,inFocus = _this$state3.inFocus,inputValueWidth = _this$state3.inputValueWidth,inputValueHeight = _this$state3.inputValueHeight,inputValue = _this$state3.inputValue,reservedInputValue = _this$state3.reservedInputValue,autocompleteItems = _this$state3.autocompleteItems,loading = _this$state3.loading;var showMenu = this.type !== TokenInputType.WithoutReference && this.isCursorVisible && activeTokens.length === 0 && (this.isInputValueChanged || !hideMenuIfEmptyInputValue);var theme = this.theme;var inputInlineStyles = { // вычисляем ширину чтобы input автоматически перенёсся на следующую строку при необходимости
1234
1269
  width: inputValueWidth, height: inputValueHeight, // в ie не работает, но альтернативный способ --- дать tabindex для label --- предположительно ещё сложнее
1235
1270
  caretColor: this.isCursorVisible ? undefined : 'transparent' };var labelClassName = (0, _Emotion.cx)(_TokenInput2.styles.label(theme), this.getLabelSizeClassName(), (_cx = {}, _cx[_TokenInput2.styles.hovering(this.theme)] = !inFocus && !disabled && !warning && !error, _cx[_TokenInput2.styles.labelDisabled(theme)] = !!disabled, _cx[_TokenInput2.styles.labelFocused(theme)] = !!inFocus, _cx[_TokenInput2.styles.error(theme)] = !!error, _cx[_TokenInput2.styles.warning(theme)] = !!warning, _cx));var inputClassName = (0, _Emotion.cx)(_TokenInput2.styles.input(theme), this.getInputSizeClassName(), (_cx2 = {}, _cx2[_TokenInput2.styles.inputDisabled(theme)] = !!disabled, _cx2));var placeholder = selectedItems.length === 0 && !inputValue ? this.props.placeholder : '';var inputNode = /*#__PURE__*/_react.default.createElement(_TokenView.TokenView, { size: this.size, className: (0, _Emotion.cx)((_cx3 = {}, _cx3[_TokenInput2.styles.inputPlaceholderWrapper()] = Boolean(placeholder), _cx3)), hideCloseButton: Boolean(placeholder) }, /*#__PURE__*/_react.default.createElement("textarea", { id: this.textareaId, ref: this.inputRef, value: inputValue, style: inputInlineStyles, spellCheck: false, disabled: disabled, className: inputClassName, placeholder: placeholder, onFocus: this.handleInputFocus, onBlur: this.handleInputBlur, onChange: this.handleChangeInputValue, onKeyDown: this.handleKeyDown, onPaste: this.handleInputPaste, inputMode: inputMode, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby }));return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": TokenInputDataTids.root, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, /*#__PURE__*/_react.default.createElement("label", { ref: this.wrapperRef, style: { width: width }, className: labelClassName, onMouseDown: this.handleWrapperMouseDown, onMouseUp: this.handleWrapperMouseUp, htmlFor: this.textareaId, "aria-controls": this.rootId, "data-tid": TokenInputDataTids.label }, /*#__PURE__*/_react.default.createElement(_TextWidthHelper.TextWidthHelper, { ref: this.textHelperRef, text: inputValue, theme: this.theme, size: this.size }), this.renderTokensStart(), inputNode, showMenu && /*#__PURE__*/_react.default.createElement(_TokenInputMenu.TokenInputMenu, { popupMenuId: this.rootId, ref: this.tokensInputMenuRef, items: autocompleteItems, loading: loading, opened: showMenu, maxMenuHeight: maxMenuHeight, anchorElementForCursor: this.input, anchorElementRoot: this.wrapper, renderNotFound: renderNotFound, renderItem: renderItem, onValueChange: this.selectItem, renderAddButton: this.renderAddButton, menuWidth: menuWidth, menuAlign: menuAlign, renderTotalCount: renderTotalCount, totalCount: totalCount, size: this.size }), this.renderTokensEnd(), this.isEditingMode ? /*#__PURE__*/_react.default.createElement(_TokenView.TokenView, { size: this.size }, /*#__PURE__*/_react.default.createElement("span", { className: _TokenInput2.styles.reservedInput(theme) }, reservedInputValue)) : null)));} /**
1236
1271
  * Сбрасывает введенное пользователем значение
1237
1272
  * @public
1238
1273
  */;_proto.reset = function reset() {this.dispatch({ type: 'RESET' });};_proto.isCursorVisibleForState = function isCursorVisibleForState(state) {return state.inFocus && (this.isInputValueChanged || state.activeTokens.length === 0);};_proto.updateInputTextWidth = function updateInputTextWidth() {if (this.textHelper) {// в IE текст иногда не помещается в input
1239
1274
  // из-за округления, поэтому округляем явно
1240
- var inputValueWidth = parseFloat(this.textHelper.getTextWidth().toFixed(2));var inputValueHeight = parseFloat(this.textHelper.getTextHeight().toFixed(2));this.dispatch({ type: 'SET_INPUT_VALUE_WIDTH', payload: inputValueWidth }, LayoutEvents.emit);this.dispatch({ type: 'SET_INPUT_VALUE_HEIGHT', payload: inputValueHeight }, LayoutEvents.emit);}};_proto.moveFocusToLastToken = function moveFocusToLastToken() {var items = this.getProps().selectedItems;if (this.state.inputValue === '' && items && items.length > 0) {this.dispatch({ type: 'SET_ACTIVE_TOKENS', payload: items.slice(-1) });}};return (0, _createClass2.default)(TokenInput, [{ key: "textareaId", get: function get() {var _this$props$id;return (_this$props$id = this.props.id) != null ? _this$props$id : this._textareaId;} }, { key: "showAddItemHint", get: function get() {var items = this.state.autocompleteItems;var value = this.getProps().valueToItem(this.state.inputValue);if (items && this.hasValueInItems(items, value)) {return false;}var selectedItems = this.getProps().selectedItems;if (selectedItems && this.hasValueInItems(selectedItems, value)) {return false;}if (this.type === TokenInputType.Combined && this.isInputValueChanged) {return true;}} }, { key: "type", get: function get() {return this.props.type ? this.props.type : TokenInputType.WithReference;} }, { key: "menuRef", get: function get() {return this.tokensInputMenu && this.tokensInputMenu.getMenuRef();} }, { key: "isCursorVisible", get: function get() {return this.isCursorVisibleForState(this.state);} }, { key: "isEditingMode", get: function get() {return this.state.editingTokenIndex > -1;} }, { key: "isInputChanged", get: function get() {if (this.isEditingMode) {return this.isTokenValueChanged;}return this.isInputValueChanged;} }, { key: "isInputValueChanged", get: function get() {var inputValue = this.state.inputValue;return inputValue !== '';} }, { key: "isTokenValueChanged", get: function get() {var _this$state4 = this.state,inputValue = _this$state4.inputValue,editingTokenIndex = _this$state4.editingTokenIndex;var _this$getProps9 = this.getProps(),valueToString = _this$getProps9.valueToString,selectedItems = _this$getProps9.selectedItems;if (this.isEditingMode) {return valueToString(selectedItems[editingTokenIndex]) !== inputValue;}return false;} }]);}(_react.default.PureComponent), _TokenInput.__KONTUR_REACT_UI__ = 'TokenInput', _TokenInput.displayName = 'TokenInput', _TokenInput.defaultProps = { selectedItems: [], // TEMP_FAKE_FLAG помогает узнать, остались ли разделители дефолтными или пользователь передал их равными дефолтным.
1241
- delimiters: [',', TEMP_FAKE_FLAG], renderItem: identity, renderValue: identity, valueToString: identity, valueToItem: function valueToItem(item) {return item;}, toKey: defaultToKey, onValueChange: function onValueChange() {return void 0;}, width: 250, onBlur: _utils.emptyHandler, onFocus: _utils.emptyHandler, onMouseEnter: _utils.emptyHandler, onMouseLeave: _utils.emptyHandler, menuWidth: 'auto', menuAlign: 'cursor' }, _TokenInput)) || _class) || _class) || _class);
1275
+ var inputValueWidth = parseFloat(this.textHelper.getTextWidth().toFixed(2));var inputValueHeight = parseFloat(this.textHelper.getTextHeight().toFixed(2));this.dispatch({ type: 'SET_INPUT_VALUE_WIDTH', payload: inputValueWidth }, LayoutEvents.emit);this.dispatch({ type: 'SET_INPUT_VALUE_HEIGHT', payload: inputValueHeight }, LayoutEvents.emit);}};_proto.moveFocusToLastToken = function moveFocusToLastToken() {var items = this.getProps().selectedItems;if (this.state.inputValue === '' && items && items.length > 0) {this.dispatch({ type: 'SET_ACTIVE_TOKENS', payload: items.slice(-1) });}};return (0, _createClass2.default)(TokenInput, [{ key: "textareaId", get: function get() {var _this$props$id;return (_this$props$id = this.props.id) != null ? _this$props$id : this._textareaId;} }, { key: "showAddItemHint", get: function get() {var items = this.state.autocompleteItems;var value = this.getProps().valueToItem(this.state.inputValue);if (items && this.hasValueInItems(items, value)) {return false;}var selectedItems = this.getProps().selectedItems;if (selectedItems && this.hasValueInItems(selectedItems, value)) {return false;}if (this.type === TokenInputType.Combined && this.isInputValueChanged) {return true;}} }, { key: "type", get: function get() {return this.props.type ? this.props.type : TokenInputType.WithReference;} }, { key: "menuRef", get: function get() {return this.tokensInputMenu && this.tokensInputMenu.getMenuRef();} }, { key: "isCursorVisible", get: function get() {return this.isCursorVisibleForState(this.state);} }, { key: "isEditingMode", get: function get() {return this.state.editingTokenIndex > -1;} }, { key: "isInputChanged", get: function get() {if (this.isEditingMode) {return this.isTokenValueChanged;}return this.isInputValueChanged;} }, { key: "isInputValueChanged", get: function get() {var inputValue = this.state.inputValue;return inputValue !== '';} }, { key: "isTokenValueChanged", get: function get() {var _this$state4 = this.state,inputValue = _this$state4.inputValue,editingTokenIndex = _this$state4.editingTokenIndex;var _this$getProps12 = this.getProps(),valueToString = _this$getProps12.valueToString,selectedItems = _this$getProps12.selectedItems;if (this.isEditingMode) {return valueToString(selectedItems[editingTokenIndex]) !== inputValue;}return false;} }]);}(_react.default.PureComponent), _TokenInput.__KONTUR_REACT_UI__ = 'TokenInput', _TokenInput.displayName = 'TokenInput', _TokenInput.defaultProps = { selectedItems: [], // TEMP_FAKE_FLAG помогает узнать, остались ли разделители дефолтными или пользователь передал их равными дефолтным.
1276
+ delimiters: [',', TEMP_FAKE_FLAG], renderItem: identity, renderValue: identity, valueToString: identity, valueToItem: function valueToItem(item) {return item;}, toKey: defaultToKey, itemToId: defaultToKey, onValueChange: function onValueChange() {return void 0;}, width: 250, onBlur: _utils.emptyHandler, onFocus: _utils.emptyHandler, onMouseEnter: _utils.emptyHandler, onMouseLeave: _utils.emptyHandler, menuWidth: 'auto', menuAlign: 'cursor' }, _TokenInput)) || _class) || _class) || _class);