@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.
- package/README.md +1 -0
- package/dist/components/AddButton/AddButton.d.ts +1 -0
- package/dist/components/AddButton/AddButton.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/Description/Description.styles.d.ts +1 -1
- package/dist/components/FileInput/FileInput.styles.d.ts +1 -1
- package/dist/components/FileItem/FileItem.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +2 -1
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +1 -3
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
- package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
- package/dist/components/List/components/ListItem/ListItem.styles.d.ts +1 -1
- package/dist/components/Modal/Modal.styles.d.ts +1 -1
- package/dist/components/MoreMenu/MoreMenu.styles.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -1
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +1 -1
- package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +1 -1
- package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/Select/Select.styles.d.ts +3 -3
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Selector/Selector.styles.d.ts +1 -1
- package/dist/components/Status/Status.styles.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +3 -2
- package/dist/components/Switch/Switch.styles.d.ts +3 -2
- package/dist/components/Switch/types.d.ts +3 -0
- package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
- package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
- package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +1 -1
- package/dist/components/TextWithTooltip/TextWithTooltip.d.ts +2 -0
- package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +1 -1
- package/dist/components/Toaster/Toaster.styles.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.styles.d.ts +2 -1
- package/dist/components/Tooltip/types.d.ts +3 -0
- package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithTooltip/WithTooltip.d.ts +2 -0
- package/dist/helpers/misc.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-intersection-ref.d.ts +2 -1
- package/dist/hooks/use-resize-ref.d.ts +7 -0
- package/dist/hooks/use-tweak-styles.d.ts +3 -2
- package/dist/theme/Provider.d.ts +2 -12
- package/dist/theme/common.d.ts +34 -4
- package/dist/theme/helpers.d.ts +3 -16
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/types.d.ts +9 -8
- package/dist/true-react-common-ui-kit.js +12132 -10
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +2 -10
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +1 -3
- package/src/components/AccountInfo/AccountInfo.tsx +2 -3
- package/src/components/AddButton/AddButton.tsx +3 -5
- package/src/components/Button/Button.tsx +76 -77
- package/src/components/CloseButton/CloseButton.tsx +2 -4
- package/src/components/Colors/Colors.stories.tsx +3 -2
- package/src/components/ControlWrapper/ControlWrapper.tsx +2 -2
- package/src/components/CssBaseline/CssBaseline.styles.ts +2 -0
- package/src/components/CssBaseline/CssBaseline.tsx +2 -3
- package/src/components/DateInput/DateInput.tsx +59 -61
- package/src/components/DatePicker/DatePicker.tsx +259 -262
- package/src/components/Description/Description.tsx +2 -3
- package/src/components/FileInput/FileInput.tsx +87 -95
- package/src/components/FileItem/FileItem.tsx +2 -4
- package/src/components/FiltersPane/FiltersPane.stories.tsx +3 -0
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +2 -3
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +6 -3
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +3 -2
- package/src/components/FiltersPane/types.ts +2 -0
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +1 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +1 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +5 -2
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +9 -7
- package/src/components/IconButton/IconButton.tsx +44 -48
- package/src/components/Input/Input.tsx +26 -24
- package/src/components/Input/InputBase.tsx +183 -187
- package/src/components/List/List.tsx +2 -3
- package/src/components/List/components/ListItem/ListItem.tsx +2 -4
- package/src/components/Modal/Modal.tsx +2 -4
- package/src/components/MoreMenu/MoreMenu.tsx +2 -4
- package/src/components/MultiSelect/MultiSelect.tsx +2 -4
- package/src/components/NewMoreMenu/NewMoreMenu.tsx +2 -4
- package/src/components/Notification/Notification.tsx +2 -3
- package/src/components/NumberInput/NumberInput.tsx +91 -93
- package/src/components/PhoneInput/PhoneInput.tsx +2 -3
- package/src/components/SearchInput/SearchInput.tsx +20 -19
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/Selector/Selector.tsx +4 -6
- package/src/components/SmartInput/SmartInput.tsx +85 -87
- package/src/components/Status/Status.tsx +5 -4
- package/src/components/Switch/Switch.styles.ts +21 -13
- package/src/components/Switch/Switch.tsx +11 -6
- package/src/components/Switch/types.ts +5 -0
- package/src/components/TextArea/TextArea.tsx +128 -130
- package/src/components/TextButton/TextButton.tsx +68 -69
- package/src/components/TextWithInfo/TextWithInfo.tsx +2 -4
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +6 -4
- package/src/components/ThemedPreloader/ThemedPreloader.tsx +2 -4
- package/src/components/Toaster/Toaster.tsx +2 -4
- package/src/components/Tooltip/Tooltip.stories.tsx +10 -0
- package/src/components/Tooltip/Tooltip.styles.ts +2 -1
- package/src/components/Tooltip/Tooltip.tsx +12 -5
- package/src/components/Tooltip/types.ts +5 -0
- package/src/components/WithMessages/WithMessages.tsx +41 -40
- package/src/components/WithTooltip/WithTooltip.tsx +4 -0
- package/src/helpers/misc.ts +6 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-intersection-ref.ts +24 -6
- package/src/hooks/use-latest-ref.ts +6 -2
- package/src/hooks/use-resize-ref.ts +35 -0
- package/src/hooks/use-tweak-styles.ts +14 -51
- package/src/theme/Provider.tsx +4 -21
- package/src/theme/common.ts +33 -36
- package/src/theme/helpers.ts +50 -42
- package/src/theme/index.ts +0 -2
- package/src/theme/types.ts +13 -10
- package/src/types.ts +3 -3
- package/dist/theme/create-themed-styles.d.ts +0 -2
- package/dist/theme/true-jss/ThemedStylesManager.d.ts +0 -18
- package/dist/theme/true-jss/TweakStylesManager.d.ts +0 -34
- package/dist/theme/true-jss/index.d.ts +0 -2
- package/dist/theme/true-jss/jss-context.d.ts +0 -9
- package/dist/true-react-common-ui-kit.css +0 -756
- package/src/theme/create-themed-styles.ts +0 -78
- package/src/theme/true-jss/ThemedStylesManager.ts +0 -93
- package/src/theme/true-jss/TweakStylesManager.ts +0 -156
- package/src/theme/true-jss/index.ts +0 -2
- 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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
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} {...
|
|
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
|
-
|
|
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
|
-
{...
|
|
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
|
-
|
|
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
|
-
{...
|
|
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 {
|
|
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
|
-
{...
|
|
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 {
|
|
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
|
-
{...
|
|
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 {
|
|
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
|
-
{...
|
|
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
|
-
{...
|
|
53
|
-
{...addDataAttributes(data)}
|
|
52
|
+
{...addDataAttributes(data, testId)}
|
|
54
53
|
>
|
|
55
54
|
{hasIcon && (
|
|
56
55
|
<div className={classes.icon}>
|