@homecode/ui 4.25.1 → 4.25.3

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.
@@ -10,54 +10,6 @@ import { Scroll } from '../Scroll/Scroll.js';
10
10
  import { capitalize } from '../../tools/string.js';
11
11
  import { generateUID } from '../../tools/uid.js';
12
12
  import S from './Input.styl.js';
13
- import '../Autocomplete/Autocomplete.styl.js';
14
- import '../Shimmer/Shimmer.styl.js';
15
- import debounce from '../../tools/debounce.js';
16
- import '../ButtonGroup/ButtonGroup.styl.js';
17
- import '../Calendar/Calendar.styl.js';
18
- import '../../tools/dom.js';
19
- import 'timen';
20
- import 'compareq';
21
- import 'lodash.pick';
22
- import '../../tools/queryParams.js';
23
- import '../Portal/Portal.js';
24
- import '../Paranja/Paranja.styl.js';
25
- import '../Popup/Popup.styl.js';
26
- import '../Select/Select.styl.js';
27
- import 'justorm/react';
28
- import 'lodash.omit';
29
- import '../Checkbox/Checkbox.styl.js';
30
- import '../Container/Container.styl.js';
31
- import '../DatePicker/DatePicker.styl.js';
32
- import 'moment';
33
- import '../DatePickerInput/DatePickerInput.styl.js';
34
- import '../Draggable/Draggable.styl.js';
35
- import '../Expand/Expand.styl.js';
36
- import '../Flex/Flex.styl.js';
37
- import '../Form/Form.styl.js';
38
- import '../Form/Validator.js';
39
- import '../Form/SubmitButtons/SubmitButtons.styl.js';
40
- import '../Spinner/Spinner.styl.js';
41
- import '../Gallery/Gallery.styl.js';
42
- import '../Heading/Heading.js';
43
- import '../InputFile/InputFile.styl.js';
44
- import '../InputFile/Item/Item.styl.js';
45
- import '../LightBox/LightBox.styl.js';
46
- import '../Menu/Menu.js';
47
- import '../Notifications/store.js';
48
- import '../Notifications/Notifications.styl.js';
49
- import '../PopupMenu/PopupMenu.styl.js';
50
- import '../Progress/Progress.styl.js';
51
- import '../ProgressCircular/ProgressCircular.styl.js';
52
- import '../Router/Router.js';
53
- import '../Table/Table.styl.js';
54
- import '../Tabs/Tabs.styl.js';
55
- import '../Tooltip/Tooltip.styl.js';
56
- import '../Text/Text.js';
57
- import '../Virtualized/Virtualized.styl.js';
58
- import '../Virtualized/List/List.styl.js';
59
- import '../Virtualized/List/ListScroll.styl.js';
60
- import '../../services/i18n.js';
61
13
 
62
14
  const TEXTAREA_SCROLL_TOP_OFFSET = {
63
15
  s: 30,
@@ -112,38 +64,23 @@ const Input = forwardRef((props, ref) => {
112
64
  return 0;
113
65
  }
114
66
  if (isTextArea)
115
- return inputRef.current.innerText.replace(/\n/g, '');
67
+ return inputRef.current.innerText; //.replace(/\n/g, '');
116
68
  return val;
117
69
  };
118
70
  const onTextareaPaste = e => {
119
- if (!isFocusedRef.current)
120
- return;
121
- e.preventDefault();
122
- e.stopPropagation();
123
- pasteToTextarea(e.clipboardData.getData('text/plain'));
71
+ // wait for native paste operation completes in DOM
72
+ setTimeout(() => {
73
+ if (inputRef.current) {
74
+ const newValue = inputRef.current.innerText;
75
+ onChangeValue(newValue);
76
+ }
77
+ }, 0);
124
78
  };
125
79
  const setTextareaValue = (value) => {
126
80
  // @ts-ignore
127
81
  if (inputRef.current)
128
82
  inputRef.current.innerText = value;
129
83
  };
130
- const pasteToTextarea = debounce((text) => {
131
- const sel = window.getSelection();
132
- const textarea = inputRef.current;
133
- const prevText = textarea.innerText;
134
- const startPos = sel.getRangeAt(0).startOffset;
135
- const nextText = prevText.substring(0, startPos) + text + prevText.substring(startPos);
136
- textarea.innerText = nextText;
137
- onChangeValue(nextText);
138
- setTimeout(() => {
139
- try {
140
- window
141
- .getSelection()
142
- .setPosition(textarea.firstChild, startPos + text.length);
143
- }
144
- catch (e) { }
145
- }, 100);
146
- }, 100);
147
84
  const onClearPress = e => {
148
85
  e.preventDefault();
149
86
  e.stopPropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.25.1",
3
+ "version": "4.25.3",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "jest",