@dt-dds/react-text-field 1.0.0-beta.68 → 1.0.0-beta.71

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @dt-ui/react-text-field
2
2
 
3
+ ## 1.0.0-beta.71
4
+
5
+ ### Patch Changes
6
+
7
+ - @dt-dds/react-spinner@1.0.0-beta.66
8
+
9
+ ## 1.0.0-beta.70
10
+
11
+ ### Minor Changes
12
+
13
+ - feat: add testId prop to text-field
14
+
15
+ ### Patch Changes
16
+
17
+ - @dt-dds/react-spinner@1.0.0-beta.65
18
+
19
+ ## 1.0.0-beta.69
20
+
21
+ ### Patch Changes
22
+
23
+ - @dt-dds/react-spinner@1.0.0-beta.64
24
+
3
25
  ## 1.0.0-beta.68
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -38,6 +38,7 @@ export const App = () => {
38
38
  | `extraPrefix` | `ExtraComponent` | - | Component to be rendered on the left side inside the input field |
39
39
  | `extraSuffix` | `ExtraComponent` | - | Component to be rendered on the right side inside the input field |
40
40
  | `id` | `string` | - | The unique identifier used to link the element to the corresponding element via the htmlFor attribute |
41
+ | `dataTestId` | `string` | `label`-text-field | Customizable test identifier |
41
42
  | `...` | `InputHTMLAttributes` | - | All available attributes from native html input |
42
43
 
43
44
  ## Stack
package/dist/index.d.mts CHANGED
@@ -28,7 +28,7 @@ interface TextFieldProps extends ComponentPropsWithoutRef<'input'>, BaseProps {
28
28
  backgroundFill?: TextFieldBackgroundFill;
29
29
  onResetInput?: () => void;
30
30
  }
31
- declare const TextField: ({ hasError, extraPrefix, extraSuffix, label, labelIcon, isFloatingLabel, name, id, required, requiredMessage, style, children, initialValue, inputRef, message: messageProp, type, variant, backgroundFill, disabled, onChange, onResetInput, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
31
+ declare const TextField: ({ dataTestId, hasError, extraPrefix, extraSuffix, label, labelIcon, isFloatingLabel, name, id, required, requiredMessage, style, children, initialValue, inputRef, message: messageProp, type, variant, backgroundFill, disabled, onChange, onResetInput, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
32
32
 
33
33
  interface InputFieldStyledProps {
34
34
  isFloatingLabel: boolean;
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ interface TextFieldProps extends ComponentPropsWithoutRef<'input'>, BaseProps {
28
28
  backgroundFill?: TextFieldBackgroundFill;
29
29
  onResetInput?: () => void;
30
30
  }
31
- declare const TextField: ({ hasError, extraPrefix, extraSuffix, label, labelIcon, isFloatingLabel, name, id, required, requiredMessage, style, children, initialValue, inputRef, message: messageProp, type, variant, backgroundFill, disabled, onChange, onResetInput, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
31
+ declare const TextField: ({ dataTestId, hasError, extraPrefix, extraSuffix, label, labelIcon, isFloatingLabel, name, id, required, requiredMessage, style, children, initialValue, inputRef, message: messageProp, type, variant, backgroundFill, disabled, onChange, onResetInput, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
32
32
 
33
33
  interface InputFieldStyledProps {
34
34
  isFloatingLabel: boolean;
package/dist/index.js CHANGED
@@ -259,6 +259,7 @@ var InputWrapperStyled = import_styled.default.div`
259
259
  var import_jsx_runtime = require("react/jsx-runtime");
260
260
  var TextField = (_a) => {
261
261
  var _b = _a, {
262
+ dataTestId,
262
263
  hasError = false,
263
264
  extraPrefix,
264
265
  extraSuffix,
@@ -281,6 +282,7 @@ var TextField = (_a) => {
281
282
  onChange = () => null,
282
283
  onResetInput = () => null
283
284
  } = _b, rest = __objRest(_b, [
285
+ "dataTestId",
284
286
  "hasError",
285
287
  "extraPrefix",
286
288
  "extraSuffix",
@@ -307,6 +309,7 @@ var TextField = (_a) => {
307
309
  const [inputValue, setInputValue] = (0, import_react.useState)("");
308
310
  const [hasRequiredError, setHasRequiredError] = (0, import_react.useState)(false);
309
311
  const textFieldId = id != null ? id : label.replaceAll(" ", "-").toLowerCase();
312
+ const testId = dataTestId != null ? dataTestId : `${label.replaceAll(" ", "-").toLowerCase()}-text-field`;
310
313
  (0, import_react.useEffect)(() => {
311
314
  if (!!initialValue) {
312
315
  setInputValue(initialValue);
@@ -402,7 +405,7 @@ var TextField = (_a) => {
402
405
  InputFieldStyled,
403
406
  __spreadProps(__spreadValues({
404
407
  "data-error": showError,
405
- "data-testid": "input-field",
408
+ "data-testid": testId,
406
409
  disabled,
407
410
  id: textFieldId,
408
411
  isFloatingLabel,
package/dist/index.mjs CHANGED
@@ -222,6 +222,7 @@ var InputWrapperStyled = styled.div`
222
222
  import { jsx, jsxs } from "react/jsx-runtime";
223
223
  var TextField = (_a) => {
224
224
  var _b = _a, {
225
+ dataTestId,
225
226
  hasError = false,
226
227
  extraPrefix,
227
228
  extraSuffix,
@@ -244,6 +245,7 @@ var TextField = (_a) => {
244
245
  onChange = () => null,
245
246
  onResetInput = () => null
246
247
  } = _b, rest = __objRest(_b, [
248
+ "dataTestId",
247
249
  "hasError",
248
250
  "extraPrefix",
249
251
  "extraSuffix",
@@ -270,6 +272,7 @@ var TextField = (_a) => {
270
272
  const [inputValue, setInputValue] = useState("");
271
273
  const [hasRequiredError, setHasRequiredError] = useState(false);
272
274
  const textFieldId = id != null ? id : label.replaceAll(" ", "-").toLowerCase();
275
+ const testId = dataTestId != null ? dataTestId : `${label.replaceAll(" ", "-").toLowerCase()}-text-field`;
273
276
  useEffect(() => {
274
277
  if (!!initialValue) {
275
278
  setInputValue(initialValue);
@@ -365,7 +368,7 @@ var TextField = (_a) => {
365
368
  InputFieldStyled,
366
369
  __spreadProps(__spreadValues({
367
370
  "data-error": showError,
368
- "data-testid": "input-field",
371
+ "data-testid": testId,
369
372
  disabled,
370
373
  id: textFieldId,
371
374
  isFloatingLabel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-dds/react-text-field",
3
- "version": "1.0.0-beta.68",
3
+ "version": "1.0.0-beta.71",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@dt-dds/react-core": "1.0.0-beta.49",
24
- "@dt-dds/react-spinner": "1.0.0-beta.63",
24
+ "@dt-dds/react-spinner": "1.0.0-beta.66",
25
25
  "@dt-dds/react-label-field": "1.0.0-beta.47",
26
26
  "@dt-dds/react-typography": "1.0.0-beta.40",
27
27
  "@dt-dds/react-icon-button": "1.0.0-beta.17",