@true-engineering/true-react-common-ui-kit 4.0.0-alpha54 → 4.0.0-alpha61

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 (151) hide show
  1. package/README.md +1 -0
  2. package/dist/components/AddButton/AddButton.d.ts +1 -0
  3. package/dist/components/AddButton/AddButton.styles.d.ts +1 -1
  4. package/dist/components/Button/Button.styles.d.ts +1 -1
  5. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
  6. package/dist/components/ControlWrapper/ControlWrapper.d.ts +1 -1
  7. package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
  8. package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
  9. package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
  10. package/dist/components/Description/Description.styles.d.ts +1 -1
  11. package/dist/components/FileInput/FileInput.styles.d.ts +1 -1
  12. package/dist/components/FileItem/FileItem.styles.d.ts +1 -1
  13. package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +1 -1
  14. package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +2 -2
  15. package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +2 -2
  16. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +1 -1
  17. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +1 -1
  18. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
  19. package/dist/components/FiltersPane/types.d.ts +2 -1
  20. package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +1 -1
  21. package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
  22. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +1 -3
  23. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
  24. package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
  25. package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
  26. package/dist/components/List/components/ListItem/ListItem.styles.d.ts +1 -1
  27. package/dist/components/Modal/Modal.styles.d.ts +1 -1
  28. package/dist/components/MoreMenu/MoreMenu.styles.d.ts +1 -1
  29. package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -1
  30. package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +1 -1
  31. package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +1 -1
  32. package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
  33. package/dist/components/Notification/Notification.styles.d.ts +1 -1
  34. package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
  35. package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +1 -1
  36. package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -1
  37. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  38. package/dist/components/Select/Select.styles.d.ts +3 -3
  39. package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
  40. package/dist/components/Selector/Selector.styles.d.ts +1 -1
  41. package/dist/components/Status/Status.styles.d.ts +1 -1
  42. package/dist/components/Switch/Switch.d.ts +3 -2
  43. package/dist/components/Switch/Switch.styles.d.ts +3 -2
  44. package/dist/components/Switch/types.d.ts +3 -0
  45. package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
  46. package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
  47. package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +1 -1
  48. package/dist/components/TextWithTooltip/TextWithTooltip.d.ts +2 -0
  49. package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +1 -1
  50. package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
  51. package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +1 -1
  52. package/dist/components/Toaster/Toaster.styles.d.ts +1 -1
  53. package/dist/components/Tooltip/Tooltip.d.ts +3 -0
  54. package/dist/components/Tooltip/Tooltip.styles.d.ts +2 -1
  55. package/dist/components/Tooltip/types.d.ts +3 -0
  56. package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
  57. package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
  58. package/dist/components/WithTooltip/WithTooltip.d.ts +2 -0
  59. package/dist/helpers/misc.d.ts +2 -0
  60. package/dist/hooks/index.d.ts +1 -0
  61. package/dist/hooks/use-intersection-ref.d.ts +2 -1
  62. package/dist/hooks/use-resize-ref.d.ts +7 -0
  63. package/dist/hooks/use-tweak-styles.d.ts +3 -2
  64. package/dist/theme/Provider.d.ts +2 -12
  65. package/dist/theme/common.d.ts +34 -4
  66. package/dist/theme/helpers.d.ts +3 -16
  67. package/dist/theme/index.d.ts +0 -2
  68. package/dist/theme/types.d.ts +9 -8
  69. package/dist/true-react-common-ui-kit.js +12132 -10
  70. package/dist/true-react-common-ui-kit.js.map +1 -1
  71. package/dist/true-react-common-ui-kit.umd.cjs +2 -10
  72. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  73. package/dist/types.d.ts +3 -3
  74. package/package.json +1 -3
  75. package/src/components/AccountInfo/AccountInfo.tsx +2 -3
  76. package/src/components/AddButton/AddButton.tsx +3 -5
  77. package/src/components/Button/Button.tsx +76 -77
  78. package/src/components/CloseButton/CloseButton.tsx +2 -4
  79. package/src/components/Colors/Colors.stories.tsx +3 -2
  80. package/src/components/ControlWrapper/ControlWrapper.tsx +2 -2
  81. package/src/components/CssBaseline/CssBaseline.styles.ts +2 -0
  82. package/src/components/CssBaseline/CssBaseline.tsx +2 -3
  83. package/src/components/DateInput/DateInput.tsx +59 -61
  84. package/src/components/DatePicker/DatePicker.tsx +259 -262
  85. package/src/components/Description/Description.tsx +2 -3
  86. package/src/components/FileInput/FileInput.tsx +87 -95
  87. package/src/components/FileItem/FileItem.tsx +2 -4
  88. package/src/components/FiltersPane/FiltersPane.stories.tsx +3 -0
  89. package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +2 -3
  90. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +6 -3
  91. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +3 -2
  92. package/src/components/FiltersPane/types.ts +2 -0
  93. package/src/components/FlexibleTable/FlexibleTable.styles.ts +1 -0
  94. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +1 -0
  95. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +5 -2
  96. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +9 -7
  97. package/src/components/IconButton/IconButton.tsx +44 -48
  98. package/src/components/Input/Input.tsx +26 -24
  99. package/src/components/Input/InputBase.tsx +183 -187
  100. package/src/components/List/List.tsx +2 -3
  101. package/src/components/List/components/ListItem/ListItem.tsx +2 -4
  102. package/src/components/Modal/Modal.tsx +2 -4
  103. package/src/components/MoreMenu/MoreMenu.tsx +2 -4
  104. package/src/components/MultiSelect/MultiSelect.tsx +2 -4
  105. package/src/components/NewMoreMenu/NewMoreMenu.tsx +2 -4
  106. package/src/components/Notification/Notification.tsx +2 -3
  107. package/src/components/NumberInput/NumberInput.tsx +91 -93
  108. package/src/components/PhoneInput/PhoneInput.tsx +2 -3
  109. package/src/components/SearchInput/SearchInput.tsx +20 -19
  110. package/src/components/Select/Select.tsx +1 -1
  111. package/src/components/Selector/Selector.tsx +4 -6
  112. package/src/components/SmartInput/SmartInput.tsx +85 -87
  113. package/src/components/Status/Status.tsx +5 -4
  114. package/src/components/Switch/Switch.styles.ts +21 -13
  115. package/src/components/Switch/Switch.tsx +11 -6
  116. package/src/components/Switch/types.ts +5 -0
  117. package/src/components/TextArea/TextArea.tsx +128 -130
  118. package/src/components/TextButton/TextButton.tsx +68 -69
  119. package/src/components/TextWithInfo/TextWithInfo.tsx +2 -4
  120. package/src/components/TextWithTooltip/TextWithTooltip.tsx +6 -4
  121. package/src/components/ThemedPreloader/ThemedPreloader.tsx +2 -4
  122. package/src/components/Toaster/Toaster.tsx +2 -4
  123. package/src/components/Tooltip/Tooltip.stories.tsx +10 -0
  124. package/src/components/Tooltip/Tooltip.styles.ts +2 -1
  125. package/src/components/Tooltip/Tooltip.tsx +12 -5
  126. package/src/components/Tooltip/types.ts +5 -0
  127. package/src/components/WithMessages/WithMessages.tsx +41 -40
  128. package/src/components/WithTooltip/WithTooltip.tsx +4 -0
  129. package/src/helpers/misc.ts +6 -0
  130. package/src/hooks/index.ts +1 -0
  131. package/src/hooks/use-intersection-ref.ts +24 -6
  132. package/src/hooks/use-latest-ref.ts +6 -2
  133. package/src/hooks/use-resize-ref.ts +35 -0
  134. package/src/hooks/use-tweak-styles.ts +14 -51
  135. package/src/theme/Provider.tsx +4 -21
  136. package/src/theme/common.ts +33 -36
  137. package/src/theme/helpers.ts +50 -42
  138. package/src/theme/index.ts +0 -2
  139. package/src/theme/types.ts +13 -10
  140. package/src/types.ts +3 -3
  141. package/dist/theme/create-themed-styles.d.ts +0 -2
  142. package/dist/theme/true-jss/ThemedStylesManager.d.ts +0 -18
  143. package/dist/theme/true-jss/TweakStylesManager.d.ts +0 -34
  144. package/dist/theme/true-jss/index.d.ts +0 -2
  145. package/dist/theme/true-jss/jss-context.d.ts +0 -9
  146. package/dist/true-react-common-ui-kit.css +0 -756
  147. package/src/theme/create-themed-styles.ts +0 -78
  148. package/src/theme/true-jss/ThemedStylesManager.ts +0 -93
  149. package/src/theme/true-jss/TweakStylesManager.ts +0 -156
  150. package/src/theme/true-jss/index.ts +0 -2
  151. package/src/theme/true-jss/jss-context.tsx +0 -34
@@ -63,193 +63,189 @@ export interface IInputBaseProps
63
63
  onChange: (value: string, event: IChangeInputEvent, eventType: 'change' | 'clear') => void;
64
64
  }
65
65
 
66
- export const InputBase = forwardRef<HTMLInputElement, IInputBaseProps>(
67
- (
68
- {
69
- value = '',
70
- placeholder,
71
- label,
72
- type = 'text',
73
- isDisabled,
74
- autoComplete,
75
- inputMode: initialInputMode,
76
- isReadonly,
77
- isInvalid,
78
- isActive,
79
- isClearable,
80
- isAutoSized,
81
- name,
82
- tweakStyles,
83
- maxLength,
84
- shouldFocusOnMount,
85
- units,
86
- testId,
87
- tabIndex,
88
- shouldAlwaysShowPlaceholder,
89
- onChange,
90
- onPaste,
91
- onFocus,
92
- onBlur,
93
- onKeyDown,
94
- // Пропсы react-input-mask
95
- mask,
96
- maskPlaceholder,
97
- alwaysShowMask,
98
- beforeMaskedStateChange,
99
- // Пропсы ControlWrapper
100
- data,
101
- groupPlacement,
102
- startIcon,
103
- icon,
104
- endIcon = icon,
105
- isLoading,
106
- isRequired,
107
- size,
108
- children,
109
- ...inputProps
66
+ export const InputBase = forwardRef<HTMLInputElement, IInputBaseProps>(function InputBase(
67
+ {
68
+ value = '',
69
+ placeholder,
70
+ label,
71
+ type = 'text',
72
+ isDisabled,
73
+ autoComplete,
74
+ inputMode: initialInputMode,
75
+ isReadonly,
76
+ isInvalid,
77
+ isActive,
78
+ isClearable,
79
+ isAutoSized,
80
+ name,
81
+ tweakStyles,
82
+ maxLength,
83
+ shouldFocusOnMount,
84
+ units,
85
+ testId,
86
+ tabIndex,
87
+ shouldAlwaysShowPlaceholder,
88
+ onChange,
89
+ onPaste,
90
+ onFocus,
91
+ onBlur,
92
+ onKeyDown,
93
+ // Пропсы react-input-mask
94
+ mask,
95
+ maskPlaceholder,
96
+ alwaysShowMask,
97
+ beforeMaskedStateChange,
98
+ // Пропсы ControlWrapper
99
+ data,
100
+ groupPlacement,
101
+ startIcon,
102
+ icon,
103
+ endIcon = icon,
104
+ isLoading,
105
+ isRequired,
106
+ size,
107
+ children,
108
+ ...inputProps
109
+ },
110
+ ref,
111
+ ) {
112
+ const classes = useStyles({ theme: tweakStyles });
113
+
114
+ const tweakControlWrapperStyles = useTweakStyles({
115
+ tweakStyles,
116
+ className: 'tweakControlWrapper',
117
+ currentComponentName: 'Input',
118
+ });
119
+
120
+ const [isFocused, setFocused] = useState(false);
121
+ const [unitsWidth, setUnitsWidth] = useState<number>();
122
+
123
+ const inputRef = useRef<HTMLInputElement>(null);
124
+ const mergedRef = useMergedRefs([ref, inputRef]);
125
+
126
+ // Try to guess input-mode if possible
127
+ const inputMode: IInputBaseProps['inputMode'] =
128
+ initialInputMode ??
129
+ (['email', 'tel', 'url'].includes(type) ? (type as 'email' | 'tel' | 'url') : undefined);
130
+
131
+ const hasFocus = isFocused || isActive;
132
+ const hasValue = isArrayLikeNotEmpty(value);
133
+ const hasUnits = isReactNodeNotEmpty(units);
134
+ const hasPlaceholder =
135
+ (!isReactNodeNotEmpty(label) || hasFocus || shouldAlwaysShowPlaceholder) &&
136
+ isStringNotEmpty(placeholder);
137
+
138
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
139
+ onChange(event.currentTarget.value, event, 'change');
140
+ };
141
+
142
+ const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
143
+ setFocused(true);
144
+ onFocus?.(event);
145
+ };
146
+
147
+ const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
148
+ setFocused(false);
149
+ onBlur?.(event);
150
+ };
151
+
152
+ // для SmartInput нужен event, иначе onChange не вызовется
153
+ const handleInputClear = async (event: IClickHandlerEvent) => {
154
+ // await не убирать (важно для порядка выполнения (сначала onChange, затем focus)
155
+ await onChange('', event, 'clear');
156
+ inputRef.current?.focus();
157
+ };
158
+
159
+ const unitsRef = useCallback(
160
+ (node: HTMLDivElement | null) => {
161
+ setUnitsWidth(node?.clientWidth);
110
162
  },
111
- ref,
112
- ) => {
113
- const classes = useStyles({ theme: tweakStyles });
114
-
115
- const tweakControlWrapperStyles = useTweakStyles({
116
- tweakStyles,
117
- className: 'tweakControlWrapper',
118
- currentComponentName: 'Input',
119
- });
120
-
121
- const [isFocused, setFocused] = useState(false);
122
- const [unitsWidth, setUnitsWidth] = useState<number>();
123
-
124
- const inputRef = useRef<HTMLInputElement>(null);
125
- const mergedRef = useMergedRefs([ref, inputRef]);
126
-
127
- // Try to guess input-mode if possible
128
- const inputMode: IInputBaseProps['inputMode'] =
129
- initialInputMode ??
130
- (['email', 'tel', 'url'].includes(type) ? (type as 'email' | 'tel' | 'url') : undefined);
131
-
132
- const hasFocus = isFocused || isActive;
133
- const hasValue = isArrayLikeNotEmpty(value);
134
- const hasUnits = isReactNodeNotEmpty(units);
135
- const hasPlaceholder =
136
- (!isReactNodeNotEmpty(label) || hasFocus || shouldAlwaysShowPlaceholder) &&
137
- isStringNotEmpty(placeholder);
138
-
139
- const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
140
- onChange(event.currentTarget.value, event, 'change');
141
- };
142
-
143
- const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
144
- setFocused(true);
145
- onFocus?.(event);
146
- };
147
-
148
- const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
149
- setFocused(false);
150
- onBlur?.(event);
151
- };
152
-
153
- // для SmartInput нужен event, иначе onChange не вызовется
154
- const handleInputClear = async (event: IClickHandlerEvent) => {
155
- // await не убирать (важно для порядка выполнения (сначала onChange, затем focus)
156
- await onChange('', event, 'clear');
163
+ [units],
164
+ );
165
+
166
+ const props: InputHTMLAttributes<HTMLInputElement> = {
167
+ className: clsx(classes.input, {
168
+ [classes.withUnits]: hasUnits,
169
+ [classes.withValue]: hasValue,
170
+ [classes.withLabel]: isReactNodeNotEmpty(label),
171
+ [classes.autoSized]: isAutoSized,
172
+ [classes.focusedInput]: isFocused,
173
+ [classes.disabledInput]: isDisabled,
174
+ [classes.invalidInput]: isInvalid,
175
+ }),
176
+ style:
177
+ hasUnits && hasValue ? ({ '--units-width': `${unitsWidth}px` } as CSSProperties) : undefined,
178
+ value,
179
+ type,
180
+ autoComplete,
181
+ inputMode,
182
+ disabled: isDisabled,
183
+ placeholder: hasPlaceholder ? placeholder : undefined,
184
+ name,
185
+ maxLength,
186
+ readOnly: isReadonly,
187
+ tabIndex,
188
+ onKeyDown,
189
+ onPaste,
190
+ onFocus: handleFocus,
191
+ onBlur: handleBlur,
192
+ onChange: handleChange,
193
+ ...addDataTestId(testId),
194
+ ...inputProps,
195
+ };
196
+
197
+ useEffect(() => {
198
+ // It works much better than autoFocus for mobile devices
199
+ if (shouldFocusOnMount) {
157
200
  inputRef.current?.focus();
158
- };
159
-
160
- const unitsRef = useCallback(
161
- (node: HTMLDivElement | null) => {
162
- setUnitsWidth(node?.clientWidth);
163
- },
164
- [units],
165
- );
166
-
167
- const props: InputHTMLAttributes<HTMLInputElement> = {
168
- className: clsx(classes.input, {
169
- [classes.withUnits]: hasUnits,
170
- [classes.withValue]: hasValue,
171
- [classes.withLabel]: isReactNodeNotEmpty(label),
172
- [classes.autoSized]: isAutoSized,
173
- [classes.focusedInput]: isFocused,
174
- [classes.disabledInput]: isDisabled,
175
- [classes.invalidInput]: isInvalid,
176
- }),
177
- style:
178
- hasUnits && hasValue
179
- ? ({ '--units-width': `${unitsWidth}px` } as CSSProperties)
180
- : undefined,
181
- value,
182
- type,
183
- autoComplete,
184
- inputMode,
185
- disabled: isDisabled,
186
- placeholder: hasPlaceholder ? placeholder : undefined,
187
- name,
188
- maxLength,
189
- readOnly: isReadonly,
190
- tabIndex,
191
- onKeyDown,
192
- onPaste,
193
- onFocus: handleFocus,
194
- onBlur: handleBlur,
195
- onChange: handleChange,
196
- ...addDataTestId(testId),
197
- ...inputProps,
198
- };
199
-
200
- useEffect(() => {
201
- // It works much better than autoFocus for mobile devices
202
- if (shouldFocusOnMount) {
203
- inputRef.current?.focus();
204
- }
205
- }, [shouldFocusOnMount]);
206
-
207
- return (
208
- <ControlWrapper
209
- label={label}
210
- isDisabled={isDisabled}
211
- isFocused={hasFocus}
212
- isActive={hasPlaceholder}
213
- isInvalid={isInvalid}
214
- hasValue={hasValue}
215
- isFullWidth={!isAutoSized}
216
- tweakStyles={tweakControlWrapperStyles}
217
- onClear={isClearable && hasValue ? handleInputClear : undefined}
218
- data={data}
219
- groupPlacement={groupPlacement}
220
- startIcon={startIcon}
221
- endIcon={endIcon}
222
- isLoading={isLoading}
223
- isRequired={isRequired}
224
- size={size}
201
+ }
202
+ }, [shouldFocusOnMount]);
203
+
204
+ return (
205
+ <ControlWrapper
206
+ label={label}
207
+ isDisabled={isDisabled}
208
+ isFocused={hasFocus}
209
+ isActive={hasPlaceholder}
210
+ isInvalid={isInvalid}
211
+ hasValue={hasValue}
212
+ isFullWidth={!isAutoSized}
213
+ tweakStyles={tweakControlWrapperStyles}
214
+ onClear={isClearable && hasValue ? handleInputClear : undefined}
215
+ data={data}
216
+ groupPlacement={groupPlacement}
217
+ startIcon={startIcon}
218
+ endIcon={endIcon}
219
+ isLoading={isLoading}
220
+ isRequired={isRequired}
221
+ size={size}
222
+ >
223
+ <div
224
+ className={clsx(classes.defaultWrapper, {
225
+ [classes.autoSizeWrapper]: hasUnits || isAutoSized,
226
+ })}
225
227
  >
226
- <div
227
- className={clsx(classes.defaultWrapper, {
228
- [classes.autoSizeWrapper]: hasUnits || isAutoSized,
229
- })}
230
- >
231
- {isNotEmpty(mask) ? (
232
- <InputMask
233
- ref={mergedRef as unknown as MutableRefObject<InputMask>}
234
- mask={mask}
235
- maskPlaceholder={maskPlaceholder}
236
- alwaysShowMask={alwaysShowMask}
237
- beforeMaskedStateChange={beforeMaskedStateChange}
238
- {...props}
239
- />
240
- ) : (
241
- <input ref={mergedRef} {...props} />
242
- )}
243
-
244
- {(hasUnits || isAutoSized) && <div className={classes.fakeValue}>{value}</div>}
245
- {hasUnits && hasValue && (
246
- <div className={classes.units} ref={unitsRef}>
247
- {units}
248
- </div>
249
- )}
250
- </div>
251
- {children}
252
- </ControlWrapper>
253
- );
254
- },
255
- );
228
+ {isNotEmpty(mask) ? (
229
+ <InputMask
230
+ ref={mergedRef as unknown as MutableRefObject<InputMask>}
231
+ mask={mask}
232
+ maskPlaceholder={maskPlaceholder}
233
+ alwaysShowMask={alwaysShowMask}
234
+ beforeMaskedStateChange={beforeMaskedStateChange}
235
+ {...props}
236
+ />
237
+ ) : (
238
+ <input ref={mergedRef} {...props} />
239
+ )}
240
+
241
+ {(hasUnits || isAutoSized) && <div className={classes.fakeValue}>{value}</div>}
242
+ {hasUnits && hasValue && (
243
+ <div className={classes.units} ref={unitsRef}>
244
+ {units}
245
+ </div>
246
+ )}
247
+ </div>
248
+ {children}
249
+ </ControlWrapper>
250
+ );
251
+ });
@@ -1,11 +1,10 @@
1
1
  import { FC, Fragment, KeyboardEvent, MouseEvent } from 'react';
2
2
  import {
3
- addDataTestId,
3
+ addDataAttributes,
4
4
  getTestId,
5
5
  isArrayNotEmpty,
6
6
  isNotEmpty,
7
7
  } from '@true-engineering/true-react-platform-helpers';
8
- import { addDataAttributes } from '../../helpers';
9
8
  import { ICommonProps } from '../../types';
10
9
  import { WithPopup } from '../WithPopup';
11
10
  import { IListItemProps, ListItem } from './components';
@@ -33,7 +32,7 @@ export const List: FC<IListProps> = ({ items, testId, data, tweakStyles, onClick
33
32
  const filteredItems = items.filter(({ isHidden }) => !isHidden);
34
33
 
35
34
  return (
36
- <div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
35
+ <div className={classes.root} {...addDataAttributes(data, testId)}>
37
36
  {filteredItems.map((item, i) => {
38
37
  const itemProps: IListItemProps = {
39
38
  testId: getTestId(testId, `item-${i}`),
@@ -2,11 +2,10 @@ import { FC, MouseEvent, KeyboardEvent, ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  addClickHandler,
5
- addDataTestId,
5
+ addDataAttributes,
6
6
  isArrayNotEmpty,
7
7
  isReactNodeNotEmpty,
8
8
  } from '@true-engineering/true-react-platform-helpers';
9
- import { addDataAttributes } from '../../../../helpers';
10
9
  import { ICommonProps } from '../../../../types';
11
10
  import { renderIcon, IIcon, Icon } from '../../../Icon';
12
11
  import { useStyles, IListItemStyles } from './ListItem.styles';
@@ -51,8 +50,7 @@ export const ListItem: FC<IListItemProps> = ({
51
50
  [classes.focused]: isFocused,
52
51
  })}
53
52
  {...addClickHandler(onClick, !isDisabled)}
54
- {...addDataTestId(testId)}
55
- {...addDataAttributes({ ...data, disabled: isDisabled ? true : undefined })}
53
+ {...addDataAttributes({ ...data, disabled: isDisabled ? true : undefined }, testId)}
56
54
  >
57
55
  {isReactNodeNotEmpty(icon) && <span className={classes.icon}>{renderIcon(icon)}</span>}
58
56
  <span className={classes.content}>{item}</span>
@@ -3,12 +3,11 @@ import { RemoveScroll } from 'react-remove-scroll';
3
3
  import { CSSTransition } from 'react-transition-group';
4
4
  import clsx from 'clsx';
5
5
  import {
6
- addDataTestId,
6
+ addDataAttributes,
7
7
  getTestId,
8
8
  isArrayNotEmpty,
9
9
  isReactNodeNotEmpty,
10
10
  } from '@true-engineering/true-react-platform-helpers';
11
- import { addDataAttributes } from '../../helpers';
12
11
  import { useTweakStyles } from '../../hooks';
13
12
  import { ICommonProps } from '../../types';
14
13
  import { IconButton } from '../IconButton';
@@ -142,8 +141,7 @@ export const Modal: FC<IModalProps> = ({
142
141
  [classes.fixedPosition]: position !== 'static',
143
142
  })}
144
143
  style={{ zIndex }}
145
- {...addDataTestId(testId)}
146
- {...addDataAttributes(data)}
144
+ {...addDataAttributes(data, testId)}
147
145
  >
148
146
  <div
149
147
  ref={overlay}
@@ -1,7 +1,6 @@
1
1
  import { FC, MouseEvent, useRef, useState } from 'react';
2
2
  import clsx from 'clsx';
3
- import { addDataTestId, getTestId } from '@true-engineering/true-react-platform-helpers';
4
- import { addDataAttributes } from '../../helpers';
3
+ import { addDataAttributes, getTestId } from '@true-engineering/true-react-platform-helpers';
5
4
  import { useTweakStyles, useOnClickOutsideWithRef } from '../../hooks';
6
5
  import { ICommonProps } from '../../types';
7
6
  import { Icon } from '../Icon';
@@ -71,8 +70,7 @@ export const MoreMenu: FC<IMoreMenuProps> = ({
71
70
  [classes.active]: isMenuShown,
72
71
  })}
73
72
  onClick={!isButtonDisabled ? toggleMenu : undefined}
74
- {...addDataTestId(testId)}
75
- {...addDataAttributes(data)}
73
+ {...addDataAttributes(data, testId)}
76
74
  >
77
75
  <div className={classes.icon}>
78
76
  <Icon type="menu" />
@@ -1,7 +1,6 @@
1
1
  import { useRef, useState } from 'react';
2
2
  import clsx from 'clsx';
3
- import { addDataTestId } from '@true-engineering/true-react-platform-helpers';
4
- import { addDataAttributes } from '../../helpers';
3
+ import { addDataAttributes } from '@true-engineering/true-react-platform-helpers';
5
4
  import { useOnClickOutside, useTweakStyles } from '../../hooks';
6
5
  import { ICommonProps } from '../../types';
7
6
  import {
@@ -76,8 +75,7 @@ export function MultiSelect<Value = string>({
76
75
  isRequired && classes.required,
77
76
  isDisabled && classes.disabled,
78
77
  )}
79
- {...addDataTestId(testId)}
80
- {...addDataAttributes(data)}
78
+ {...addDataAttributes(data, testId)}
81
79
  >
82
80
  {/* Input */}
83
81
  <MultiSelectInput
@@ -1,7 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import clsx from 'clsx';
3
- import { addDataTestId, isArrayEmpty } from '@true-engineering/true-react-platform-helpers';
4
- import { addDataAttributes } from '../../helpers';
3
+ import { addDataAttributes, isArrayEmpty } from '@true-engineering/true-react-platform-helpers';
5
4
  import { useTweakStyles } from '../../hooks';
6
5
  import { ICommonProps } from '../../types';
7
6
  import { Icon } from '../Icon';
@@ -63,8 +62,7 @@ export const NewMoreMenu: FC<INewMoreMenuProps> = ({
63
62
  [classes.active]: triggerProps.isActive,
64
63
  })}
65
64
  disabled={triggerProps.isDisabled}
66
- {...addDataTestId(testId)}
67
- {...addDataAttributes(data)}
65
+ {...addDataAttributes(data, testId)}
68
66
  {...referenceProps}
69
67
  >
70
68
  <div className={classes.icon}>
@@ -1,11 +1,11 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
+ addDataAttributes,
4
5
  addDataTestId,
5
6
  isReactNodeNotEmpty,
6
7
  isStringNotEmpty,
7
8
  } from '@true-engineering/true-react-platform-helpers';
8
- import { addDataAttributes } from '../../helpers';
9
9
  import { ICommonProps } from '../../types';
10
10
  import { Icon, IIcon, renderIcon } from '../Icon';
11
11
  import { INotificationType } from './types';
@@ -49,8 +49,7 @@ export const Notification: FC<INotificationProps> = ({
49
49
  [classes.withTitle]: hasTitle,
50
50
  [classes.withText]: hasText,
51
51
  })}
52
- {...addDataTestId(testId)}
53
- {...addDataAttributes(data)}
52
+ {...addDataAttributes(data, testId)}
54
53
  >
55
54
  {hasIcon && (
56
55
  <div className={classes.icon}>