@dt-dds/react-text-field 1.0.0-beta.100
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/CHANGELOG.md +1022 -0
- package/LICENSE.md +21 -0
- package/README.md +88 -0
- package/dist/index.d.mts +89 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +515 -0
- package/dist/index.mjs +478 -0
- package/package.json +61 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
|
|
59
|
+
// index.ts
|
|
60
|
+
var index_exports = {};
|
|
61
|
+
__export(index_exports, {
|
|
62
|
+
InputContainerStyled: () => InputContainerStyled,
|
|
63
|
+
InputExtraPrefixStyled: () => InputExtraPrefixStyled,
|
|
64
|
+
InputExtraSuffixStyled: () => InputExtraSuffixStyled,
|
|
65
|
+
InputFieldStyled: () => InputFieldStyled,
|
|
66
|
+
InputWrapperStyled: () => InputWrapperStyled,
|
|
67
|
+
TextField: () => TextField,
|
|
68
|
+
TextFieldMessageStyled: () => TextFieldMessageStyled,
|
|
69
|
+
TextFieldStyled: () => TextFieldStyled
|
|
70
|
+
});
|
|
71
|
+
module.exports = __toCommonJS(index_exports);
|
|
72
|
+
|
|
73
|
+
// src/TextField.tsx
|
|
74
|
+
var import_react = require("react");
|
|
75
|
+
var import_react_icon = require("@dt-dds/react-icon");
|
|
76
|
+
var import_react_icon_button = require("@dt-dds/react-icon-button");
|
|
77
|
+
var import_react_label_field = require("@dt-dds/react-label-field");
|
|
78
|
+
var import_react_typography = require("@dt-dds/react-typography");
|
|
79
|
+
|
|
80
|
+
// src/TextField.styled.ts
|
|
81
|
+
var import_styled = __toESM(require("@emotion/styled"));
|
|
82
|
+
|
|
83
|
+
// src/constants/helpers.ts
|
|
84
|
+
var getThemedBackgroundFill = (backgroundFill, theme) => ({
|
|
85
|
+
default: theme.palette.surface.default,
|
|
86
|
+
contrast: theme.palette.surface.contrast,
|
|
87
|
+
light: theme.palette.surface.light
|
|
88
|
+
})[backgroundFill] || theme.palette.surface.default;
|
|
89
|
+
|
|
90
|
+
// src/TextField.styled.ts
|
|
91
|
+
var TextFieldStyled = import_styled.default.div`
|
|
92
|
+
${({ theme, isFloatingLabel = true, hasPrefix = false }) => `
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: ${theme.spacing.spacing_20};
|
|
96
|
+
width: 100%;
|
|
97
|
+
position: relative;
|
|
98
|
+
|
|
99
|
+
${hasPrefix ? `
|
|
100
|
+
label {
|
|
101
|
+
left: 0;
|
|
102
|
+
padding-left: ${isFloatingLabel ? theme.spacing.l : ""};
|
|
103
|
+
}
|
|
104
|
+
` : ""}
|
|
105
|
+
|
|
106
|
+
:has(input[disabled]) {
|
|
107
|
+
i, label > span {
|
|
108
|
+
color: ${theme.palette.content.light};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:has(input[readonly]:not(input[disabled])) {
|
|
113
|
+
i, label, label > span {
|
|
114
|
+
color: ${theme.palette.content.medium};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
${!isFloatingLabel && `
|
|
119
|
+
&:has(input[readonly]:not([disabled]):focus) {
|
|
120
|
+
label {
|
|
121
|
+
color: ${theme.palette.informative.default};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`}
|
|
125
|
+
`}
|
|
126
|
+
|
|
127
|
+
input[type="search"]::-webkit-search-decoration,
|
|
128
|
+
input[type="search"]::-webkit-search-cancel-button,
|
|
129
|
+
input[type="search"]::-webkit-search-results-button,
|
|
130
|
+
input[type="search"]::-webkit-search-results-decoration {
|
|
131
|
+
display: none;
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
var InputContainerStyled = import_styled.default.div`
|
|
135
|
+
${({ theme, isFloatingLabel }) => `
|
|
136
|
+
position: relative;
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: ${isFloatingLabel ? "0" : theme.spacing.spacing_30};
|
|
140
|
+
`}
|
|
141
|
+
`;
|
|
142
|
+
var InputFieldStyled = import_styled.default.input`
|
|
143
|
+
${({ theme, isFloatingLabel, scale, isFocused }) => `
|
|
144
|
+
${theme.fontStyles.bodyMdRegular}
|
|
145
|
+
border: 0;
|
|
146
|
+
outline: 0;
|
|
147
|
+
width: 100%;
|
|
148
|
+
background-color: inherit;
|
|
149
|
+
|
|
150
|
+
&:focus {
|
|
151
|
+
outline: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&:read-only {
|
|
155
|
+
color: ${theme.palette.content.medium};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
input:-webkit-autofill,
|
|
159
|
+
input:-webkit-autofill:hover,
|
|
160
|
+
input:-webkit-autofill:focus,
|
|
161
|
+
input:-webkit-autofill:active {
|
|
162
|
+
transition: background-color 5000s ease-in-out 0s;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&[readonly]::placeholder,
|
|
166
|
+
&[readonly]:focus::placeholder {
|
|
167
|
+
color: transparent;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&::placeholder {
|
|
171
|
+
color: ${isFloatingLabel && !isFocused ? "transparent" : theme.palette.content.medium};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&:disabled {
|
|
175
|
+
color: ${theme.palette.content.light};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
color: ${theme.palette.content.default};
|
|
179
|
+
|
|
180
|
+
${scale === "compact" ? `
|
|
181
|
+
padding: ${isFloatingLabel ? `${theme.spacing.spacing_60} ${theme.spacing.spacing_40} ${theme.spacing.spacing_30} ${theme.spacing.spacing_40}` : `14px ${theme.spacing.spacing_30}`};
|
|
182
|
+
` : `
|
|
183
|
+
padding: ${isFloatingLabel ? `28px ${theme.spacing.spacing_40} ${theme.spacing.spacing_40}` : `20px ${theme.spacing.spacing_40}`};
|
|
184
|
+
`}
|
|
185
|
+
`}
|
|
186
|
+
`;
|
|
187
|
+
var InputExtraPrefixStyled = import_styled.default.div`
|
|
188
|
+
${({ theme, onClick }) => {
|
|
189
|
+
const isClickable = !!onClick;
|
|
190
|
+
return `
|
|
191
|
+
display: flex;
|
|
192
|
+
cursor: ${isClickable ? "pointer" : "default"};
|
|
193
|
+
padding-left: ${theme.spacing.spacing_40}};
|
|
194
|
+
|
|
195
|
+
&:focus-visible {
|
|
196
|
+
outline: 2px solid ${theme.palette.border.dark};
|
|
197
|
+
outline-offset: 1px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
${isClickable && `
|
|
201
|
+
&:hover > i {
|
|
202
|
+
color: ${theme.palette.content.dark};
|
|
203
|
+
}
|
|
204
|
+
`}
|
|
205
|
+
|
|
206
|
+
`;
|
|
207
|
+
}}
|
|
208
|
+
`;
|
|
209
|
+
var InputExtraSuffixStyled = import_styled.default.div`
|
|
210
|
+
${({ theme, onClick }) => {
|
|
211
|
+
const isClickable = !!onClick;
|
|
212
|
+
return `
|
|
213
|
+
display: flex;
|
|
214
|
+
cursor: ${isClickable ? "pointer" : "default"};
|
|
215
|
+
margin-right: ${theme.spacing.spacing_40}};
|
|
216
|
+
|
|
217
|
+
&:focus-visible {
|
|
218
|
+
outline: 2px solid ${theme.palette.border.dark};
|
|
219
|
+
outline-offset: 1px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
${isClickable && `
|
|
223
|
+
&:hover > i {
|
|
224
|
+
color: ${theme.palette.primary.default};
|
|
225
|
+
}
|
|
226
|
+
`}
|
|
227
|
+
`;
|
|
228
|
+
}}
|
|
229
|
+
`;
|
|
230
|
+
var TextFieldMessageStyled = import_styled.default.div`
|
|
231
|
+
padding-left: ${({ theme }) => theme.spacing.spacing_40};
|
|
232
|
+
`;
|
|
233
|
+
var InputWrapperStyled = import_styled.default.div`
|
|
234
|
+
${({ theme, isFloatingLabel, variant, backgroundFill, hasError }) => {
|
|
235
|
+
const borderColor = hasError ? theme.palette.error.default : theme.palette.border.medium;
|
|
236
|
+
const borderFocusColor = hasError ? theme.palette.error.default : theme.palette.informative.default;
|
|
237
|
+
return `
|
|
238
|
+
display:flex;
|
|
239
|
+
flex-direction: row;
|
|
240
|
+
align-items: center;
|
|
241
|
+
min-width: 198px;
|
|
242
|
+
width: 100%;
|
|
243
|
+
color: ${theme.palette.content.default};
|
|
244
|
+
background-color: ${getThemedBackgroundFill(backgroundFill, theme)};
|
|
245
|
+
|
|
246
|
+
${variant === "outlined" ? `border-radius: ${theme.shape.formField};
|
|
247
|
+
border: 1px solid ${borderColor};
|
|
248
|
+
|
|
249
|
+
&:focus-within,
|
|
250
|
+
&:hover:not([disabled]) {
|
|
251
|
+
border: 1px solid ${borderFocusColor};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
&:hover:([disabled]) {
|
|
255
|
+
border: 1px solid ${borderColor};
|
|
256
|
+
}
|
|
257
|
+
` : `border-radius: ${theme.shape.formField} ${theme.shape.formField} 0 0;
|
|
258
|
+
border-bottom: 1px solid ${borderColor};
|
|
259
|
+
|
|
260
|
+
&:focus-within,
|
|
261
|
+
&:hover:not([disabled]) {
|
|
262
|
+
border-bottom: 1px solid ${borderFocusColor};
|
|
263
|
+
}
|
|
264
|
+
`};
|
|
265
|
+
|
|
266
|
+
&:has(input[readonly]:not([disabled])) {
|
|
267
|
+
background-color: ${theme.palette.surface.light};
|
|
268
|
+
border: 1px solid ${theme.palette.surface.default};
|
|
269
|
+
|
|
270
|
+
&:focus-within, &:hover {
|
|
271
|
+
border: 1px solid ${theme.palette.informative.default};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&:has(input[disabled]), &:has(input[disabled]) > * {
|
|
276
|
+
cursor: not-allowed;
|
|
277
|
+
|
|
278
|
+
&:hover {
|
|
279
|
+
border-color: ${borderColor};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
input::placeholder {
|
|
283
|
+
color: ${isFloatingLabel ? "transparent" : theme.palette.content.light};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
`;
|
|
287
|
+
}}
|
|
288
|
+
`;
|
|
289
|
+
|
|
290
|
+
// src/TextField.tsx
|
|
291
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
292
|
+
var EXTRA_SUFFIX_DATA_TEST_ID = "extra-suffix";
|
|
293
|
+
var TextField = (0, import_react.forwardRef)(
|
|
294
|
+
(_a, ref) => {
|
|
295
|
+
var _b = _a, {
|
|
296
|
+
dataTestId,
|
|
297
|
+
hasError = false,
|
|
298
|
+
extraPrefix,
|
|
299
|
+
extraSuffix,
|
|
300
|
+
label,
|
|
301
|
+
labelIcon,
|
|
302
|
+
isFloatingLabel = true,
|
|
303
|
+
name,
|
|
304
|
+
id,
|
|
305
|
+
required,
|
|
306
|
+
requiredMessage,
|
|
307
|
+
style,
|
|
308
|
+
children,
|
|
309
|
+
initialValue,
|
|
310
|
+
inputRef,
|
|
311
|
+
isInputFocused,
|
|
312
|
+
message: messageProp = "",
|
|
313
|
+
type = "text",
|
|
314
|
+
variant = "outlined",
|
|
315
|
+
scale = "standard",
|
|
316
|
+
backgroundFill = "default",
|
|
317
|
+
disabled = false,
|
|
318
|
+
onChange = () => null,
|
|
319
|
+
onResetInput = () => null
|
|
320
|
+
} = _b, rest = __objRest(_b, [
|
|
321
|
+
"dataTestId",
|
|
322
|
+
"hasError",
|
|
323
|
+
"extraPrefix",
|
|
324
|
+
"extraSuffix",
|
|
325
|
+
"label",
|
|
326
|
+
"labelIcon",
|
|
327
|
+
"isFloatingLabel",
|
|
328
|
+
"name",
|
|
329
|
+
"id",
|
|
330
|
+
"required",
|
|
331
|
+
"requiredMessage",
|
|
332
|
+
"style",
|
|
333
|
+
"children",
|
|
334
|
+
"initialValue",
|
|
335
|
+
"inputRef",
|
|
336
|
+
"isInputFocused",
|
|
337
|
+
"message",
|
|
338
|
+
"type",
|
|
339
|
+
"variant",
|
|
340
|
+
"scale",
|
|
341
|
+
"backgroundFill",
|
|
342
|
+
"disabled",
|
|
343
|
+
"onChange",
|
|
344
|
+
"onResetInput"
|
|
345
|
+
]);
|
|
346
|
+
const [activeInput, setActiveInput] = (0, import_react.useState)(false);
|
|
347
|
+
const [inputValue, setInputValue] = (0, import_react.useState)("");
|
|
348
|
+
const [hasRequiredError, setHasRequiredError] = (0, import_react.useState)(false);
|
|
349
|
+
const textFieldId = id != null ? id : label.replaceAll(" ", "-").toLowerCase();
|
|
350
|
+
const testId = dataTestId != null ? dataTestId : `${label.replaceAll(" ", "-").toLowerCase()}-text-field`;
|
|
351
|
+
(0, import_react.useEffect)(() => {
|
|
352
|
+
if (!!initialValue) {
|
|
353
|
+
setInputValue(initialValue);
|
|
354
|
+
setHasRequiredError(false);
|
|
355
|
+
} else {
|
|
356
|
+
setInputValue("");
|
|
357
|
+
}
|
|
358
|
+
}, [initialValue]);
|
|
359
|
+
const handleChange = (event) => {
|
|
360
|
+
setInputValue(event.target.value);
|
|
361
|
+
setHasRequiredError(false);
|
|
362
|
+
if (onChange) {
|
|
363
|
+
onChange(event);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const onFocus = (event) => {
|
|
367
|
+
if (!rest.readOnly) {
|
|
368
|
+
setActiveInput(true);
|
|
369
|
+
}
|
|
370
|
+
if (rest.onFocus) {
|
|
371
|
+
rest.onFocus(event);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const onBlur = (event) => {
|
|
375
|
+
var _a2;
|
|
376
|
+
setActiveInput(false);
|
|
377
|
+
const isEmptyOrOnlySpaces = event.currentTarget.value.trim().length === 0;
|
|
378
|
+
const isExtraSuffixClicked = ((_a2 = event.relatedTarget) == null ? void 0 : _a2.getAttribute("data-testid")) === EXTRA_SUFFIX_DATA_TEST_ID;
|
|
379
|
+
if (isEmptyOrOnlySpaces && required && !isExtraSuffixClicked) {
|
|
380
|
+
setHasRequiredError(true);
|
|
381
|
+
}
|
|
382
|
+
if (rest.onBlur) {
|
|
383
|
+
rest.onBlur(event);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const handleResetInput = () => {
|
|
387
|
+
setInputValue("");
|
|
388
|
+
setActiveInput(false);
|
|
389
|
+
onResetInput();
|
|
390
|
+
};
|
|
391
|
+
const handleExtraPrefixEnter = (event) => event.code === "Enter" && (extraPrefix == null ? void 0 : extraPrefix.onClick) && extraPrefix.onClick(inputValue);
|
|
392
|
+
const handleExtraSuffixEnter = (event) => event.code === "Enter" && (extraSuffix == null ? void 0 : extraSuffix.onClick) && extraSuffix.onClick(inputValue);
|
|
393
|
+
const messageColor = disabled ? "content.light" : "content.medium";
|
|
394
|
+
const showError = hasError || hasRequiredError;
|
|
395
|
+
const message = hasRequiredError ? requiredMessage != null ? requiredMessage : messageProp : messageProp;
|
|
396
|
+
const isActiveInput = activeInput || !!inputValue.trim();
|
|
397
|
+
const isSearchType = type === "search";
|
|
398
|
+
const extraPrefixOnClick = (extraPrefix == null ? void 0 : extraPrefix.onClick) ? extraPrefix.onClick : null;
|
|
399
|
+
const extraSuffixOnClick = (extraSuffix == null ? void 0 : extraSuffix.onClick) ? extraSuffix.onClick : null;
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
401
|
+
TextFieldStyled,
|
|
402
|
+
{
|
|
403
|
+
"data-testid": testId,
|
|
404
|
+
hasPrefix: !!extraPrefix,
|
|
405
|
+
isFloatingLabel,
|
|
406
|
+
style,
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InputContainerStyled, { isFloatingLabel, ref, children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
410
|
+
import_react_label_field.LabelField,
|
|
411
|
+
{
|
|
412
|
+
hasError: showError,
|
|
413
|
+
htmlFor: textFieldId,
|
|
414
|
+
icon: labelIcon,
|
|
415
|
+
isActive: isInputFocused || activeInput,
|
|
416
|
+
isCentered: !isActiveInput && isFloatingLabel,
|
|
417
|
+
isDisabled: disabled,
|
|
418
|
+
isFloating: isFloatingLabel,
|
|
419
|
+
isInputFilled: !!inputValue,
|
|
420
|
+
isRequired: required,
|
|
421
|
+
scale,
|
|
422
|
+
children: label
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
426
|
+
InputWrapperStyled,
|
|
427
|
+
{
|
|
428
|
+
backgroundFill,
|
|
429
|
+
"data-testid": `${testId}-wrapper`,
|
|
430
|
+
hasError: showError,
|
|
431
|
+
isFloatingLabel,
|
|
432
|
+
variant,
|
|
433
|
+
children: [
|
|
434
|
+
(extraPrefix == null ? void 0 : extraPrefix.component) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
435
|
+
InputExtraPrefixStyled,
|
|
436
|
+
__spreadProps(__spreadValues({
|
|
437
|
+
"data-testid": "extra-prefix"
|
|
438
|
+
}, !!extraPrefixOnClick && {
|
|
439
|
+
tabIndex: 0,
|
|
440
|
+
onClick: () => !disabled && extraPrefixOnClick(inputValue),
|
|
441
|
+
onKeyDown: handleExtraPrefixEnter
|
|
442
|
+
}), {
|
|
443
|
+
children: extraPrefix.component
|
|
444
|
+
})
|
|
445
|
+
) : null,
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
447
|
+
InputFieldStyled,
|
|
448
|
+
__spreadProps(__spreadValues({
|
|
449
|
+
"data-error": showError,
|
|
450
|
+
"data-testid": `${testId}-input`,
|
|
451
|
+
disabled,
|
|
452
|
+
id: textFieldId,
|
|
453
|
+
isFloatingLabel,
|
|
454
|
+
isFocused: isActiveInput,
|
|
455
|
+
name: name != null ? name : textFieldId,
|
|
456
|
+
ref: inputRef,
|
|
457
|
+
scale,
|
|
458
|
+
type,
|
|
459
|
+
value: inputValue
|
|
460
|
+
}, rest), {
|
|
461
|
+
onBlur,
|
|
462
|
+
onChange: handleChange,
|
|
463
|
+
onFocus
|
|
464
|
+
})
|
|
465
|
+
),
|
|
466
|
+
isSearchType && !!inputValue ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
467
|
+
import_react_icon_button.IconButton,
|
|
468
|
+
{
|
|
469
|
+
dataTestId: "reset-icon",
|
|
470
|
+
onClick: handleResetInput,
|
|
471
|
+
style: { marginRight: 12 },
|
|
472
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icon.Icon, { code: "close" })
|
|
473
|
+
}
|
|
474
|
+
) : null,
|
|
475
|
+
(extraSuffix == null ? void 0 : extraSuffix.component) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
476
|
+
InputExtraSuffixStyled,
|
|
477
|
+
__spreadProps(__spreadValues({
|
|
478
|
+
"data-testid": EXTRA_SUFFIX_DATA_TEST_ID
|
|
479
|
+
}, !!extraSuffixOnClick && {
|
|
480
|
+
tabIndex: 0,
|
|
481
|
+
onClick: () => !disabled && extraSuffixOnClick(inputValue),
|
|
482
|
+
onKeyDown: handleExtraSuffixEnter
|
|
483
|
+
}), {
|
|
484
|
+
children: extraSuffix.component
|
|
485
|
+
})
|
|
486
|
+
) : null
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
] }),
|
|
491
|
+
message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextFieldMessageStyled, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
492
|
+
import_react_typography.Typography,
|
|
493
|
+
{
|
|
494
|
+
color: showError ? "error.default" : messageColor,
|
|
495
|
+
fontStyles: "bodySmRegular",
|
|
496
|
+
children: message
|
|
497
|
+
}
|
|
498
|
+
) }) : null,
|
|
499
|
+
children
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
506
|
+
0 && (module.exports = {
|
|
507
|
+
InputContainerStyled,
|
|
508
|
+
InputExtraPrefixStyled,
|
|
509
|
+
InputExtraSuffixStyled,
|
|
510
|
+
InputFieldStyled,
|
|
511
|
+
InputWrapperStyled,
|
|
512
|
+
TextField,
|
|
513
|
+
TextFieldMessageStyled,
|
|
514
|
+
TextFieldStyled
|
|
515
|
+
});
|