Skip to content

Commit bc1153e

Browse files
authored
refactor: delete remnants of deprecated TextInput components (#18914)
1 parent c9849c8 commit bc1153e

File tree

4 files changed

+4
-264
lines changed

4 files changed

+4
-264
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 0 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -8559,240 +8559,6 @@ Map {
85598559
},
85608560
"TextInput" => Object {
85618561
"$$typeof": Symbol(react.forward_ref),
8562-
"ControlledPasswordInput": Object {
8563-
"$$typeof": Symbol(react.forward_ref),
8564-
"propTypes": Object {
8565-
"className": Object {
8566-
"type": "string",
8567-
},
8568-
"defaultValue": Object {
8569-
"args": Array [
8570-
Array [
8571-
Object {
8572-
"type": "string",
8573-
},
8574-
Object {
8575-
"type": "number",
8576-
},
8577-
],
8578-
],
8579-
"type": "oneOfType",
8580-
},
8581-
"disabled": Object {
8582-
"type": "bool",
8583-
},
8584-
"helperText": Object {
8585-
"type": "node",
8586-
},
8587-
"hideLabel": Object {
8588-
"type": "bool",
8589-
},
8590-
"hidePasswordLabel": Object {
8591-
"type": "string",
8592-
},
8593-
"id": Object {
8594-
"isRequired": true,
8595-
"type": "string",
8596-
},
8597-
"invalid": Object {
8598-
"type": "bool",
8599-
},
8600-
"invalidText": Object {
8601-
"type": "node",
8602-
},
8603-
"labelText": Object {
8604-
"isRequired": true,
8605-
"type": "node",
8606-
},
8607-
"light": [Function],
8608-
"onChange": Object {
8609-
"type": "func",
8610-
},
8611-
"onClick": Object {
8612-
"type": "func",
8613-
},
8614-
"placeholder": Object {
8615-
"type": "string",
8616-
},
8617-
"showPasswordLabel": Object {
8618-
"type": "string",
8619-
},
8620-
"size": Object {
8621-
"args": Array [
8622-
Array [
8623-
"sm",
8624-
"md",
8625-
"lg",
8626-
],
8627-
],
8628-
"type": "oneOf",
8629-
},
8630-
"tooltipAlignment": Object {
8631-
"args": Array [
8632-
Array [
8633-
"start",
8634-
"center",
8635-
"end",
8636-
],
8637-
],
8638-
"type": "oneOf",
8639-
},
8640-
"tooltipPosition": Object {
8641-
"args": Array [
8642-
Array [
8643-
"top",
8644-
"right",
8645-
"bottom",
8646-
"left",
8647-
],
8648-
],
8649-
"type": "oneOf",
8650-
},
8651-
"value": Object {
8652-
"args": Array [
8653-
Array [
8654-
Object {
8655-
"type": "string",
8656-
},
8657-
Object {
8658-
"type": "number",
8659-
},
8660-
],
8661-
],
8662-
"type": "oneOfType",
8663-
},
8664-
},
8665-
"render": [Function],
8666-
},
8667-
"PasswordInput": Object {
8668-
"$$typeof": Symbol(react.forward_ref),
8669-
"propTypes": Object {
8670-
"className": Object {
8671-
"type": "string",
8672-
},
8673-
"defaultValue": Object {
8674-
"args": Array [
8675-
Array [
8676-
Object {
8677-
"type": "string",
8678-
},
8679-
Object {
8680-
"type": "number",
8681-
},
8682-
],
8683-
],
8684-
"type": "oneOfType",
8685-
},
8686-
"disabled": Object {
8687-
"type": "bool",
8688-
},
8689-
"helperText": Object {
8690-
"type": "node",
8691-
},
8692-
"hideLabel": Object {
8693-
"type": "bool",
8694-
},
8695-
"hidePasswordLabel": Object {
8696-
"type": "string",
8697-
},
8698-
"id": Object {
8699-
"isRequired": true,
8700-
"type": "string",
8701-
},
8702-
"inline": Object {
8703-
"type": "bool",
8704-
},
8705-
"invalid": Object {
8706-
"type": "bool",
8707-
},
8708-
"invalidText": Object {
8709-
"type": "node",
8710-
},
8711-
"labelText": Object {
8712-
"isRequired": true,
8713-
"type": "node",
8714-
},
8715-
"light": [Function],
8716-
"onChange": Object {
8717-
"type": "func",
8718-
},
8719-
"onClick": Object {
8720-
"type": "func",
8721-
},
8722-
"onTogglePasswordVisibility": Object {
8723-
"type": "func",
8724-
},
8725-
"placeholder": Object {
8726-
"type": "string",
8727-
},
8728-
"readOnly": Object {
8729-
"type": "bool",
8730-
},
8731-
"showPasswordLabel": Object {
8732-
"type": "string",
8733-
},
8734-
"size": Object {
8735-
"args": Array [
8736-
Array [
8737-
"sm",
8738-
"md",
8739-
"lg",
8740-
],
8741-
],
8742-
"type": "oneOf",
8743-
},
8744-
"tooltipAlignment": Object {
8745-
"args": Array [
8746-
Array [
8747-
"start",
8748-
"center",
8749-
"end",
8750-
],
8751-
],
8752-
"type": "oneOf",
8753-
},
8754-
"tooltipPosition": Object {
8755-
"args": Array [
8756-
Array [
8757-
"top",
8758-
"right",
8759-
"bottom",
8760-
"left",
8761-
],
8762-
],
8763-
"type": "oneOf",
8764-
},
8765-
"type": Object {
8766-
"args": Array [
8767-
Array [
8768-
"password",
8769-
"text",
8770-
],
8771-
],
8772-
"type": "oneOf",
8773-
},
8774-
"value": Object {
8775-
"args": Array [
8776-
Array [
8777-
Object {
8778-
"type": "string",
8779-
},
8780-
Object {
8781-
"type": "number",
8782-
},
8783-
],
8784-
],
8785-
"type": "oneOfType",
8786-
},
8787-
"warn": Object {
8788-
"type": "bool",
8789-
},
8790-
"warnText": Object {
8791-
"type": "node",
8792-
},
8793-
},
8794-
"render": [Function],
8795-
},
87968562
"propTypes": Object {
87978563
"className": Object {
87988564
"type": "string",

packages/react/src/components/TextInput/ControlledPasswordInput.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
/**
2-
* Copyright IBM Corp. 2023, 2024
2+
* Copyright IBM Corp. 2023, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import React, { useRef } from 'react';
8+
import React from 'react';
99
import classNames from 'classnames';
1010
import PropTypes from 'prop-types';
1111
import { View, ViewOff, WarningFilled } from '@carbon/icons-react';
1212
import { textInputProps } from './util';
13-
import { warning } from '../../internal/warning';
1413
import deprecate from '../../prop-types/deprecate';
1514
import { usePrefix } from '../../internal/usePrefix';
1615
import { useId } from '../../internal/useId';
1716
import { ReactAttr } from '../../types/common';
1817
import { noopFn } from '../../internal/noopFn';
1918

20-
let didWarnAboutDeprecation = false;
21-
2219
export interface ControlledPasswordInputProps
2320
extends ReactAttr<HTMLInputElement> {
2421
/**
@@ -155,13 +152,6 @@ const ControlledPasswordInput = React.forwardRef(
155152
) {
156153
const prefix = usePrefix();
157154
const controlledPasswordInstanceId = useId();
158-
if (process.env.NODE_ENV !== 'production') {
159-
warning(
160-
didWarnAboutDeprecation,
161-
'`<TextInput.ControlledPasswordInput>` has been deprecated in favor of `<TextInput.PasswordInput />` and will be removed in the next major release of `carbon-components-react`'
162-
);
163-
didWarnAboutDeprecation = true;
164-
}
165155

166156
const errorId = id + '-error-msg';
167157
const textInputClasses = classNames(

packages/react/src/components/TextInput/TextInput.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -15,8 +15,6 @@ import React, {
1515
} from 'react';
1616
import classNames from 'classnames';
1717
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps';
18-
import PasswordInput from './PasswordInput';
19-
import ControlledPasswordInput from './ControlledPasswordInput';
2018
import deprecate from '../../prop-types/deprecate';
2119
import { textInputProps } from './util';
2220
import { FormContext } from '../FluidForm';
@@ -411,8 +409,6 @@ const TextInput = React.forwardRef(function TextInput(
411409
});
412410

413411
TextInput.displayName = 'TextInput';
414-
(TextInput as any).PasswordInput = PasswordInput;
415-
(TextInput as any).ControlledPasswordInput = ControlledPasswordInput;
416412
TextInput.propTypes = {
417413
/**
418414
* Specify an optional className to be applied to the `<input>` node

packages/react/src/components/TextInput/index.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
7-
import { deprecateFieldOnObject } from '../../internal/deprecateFieldOnObject';
87

9-
import ControlledPasswordInput from './ControlledPasswordInput';
10-
import PasswordInput from './PasswordInput';
118
import TextInput, { type TextInputProps } from './TextInput';
129
import { type TextInputSkeletonProps } from './TextInput.Skeleton';
1310

14-
if (process.env.NODE_ENV !== 'production') {
15-
deprecateFieldOnObject(
16-
TextInput,
17-
'ControlledPasswordInput',
18-
ControlledPasswordInput
19-
);
20-
deprecateFieldOnObject(TextInput, 'PasswordInput', PasswordInput);
21-
}
22-
2311
export { default as TextInputSkeleton } from './TextInput.Skeleton';
2412
export default TextInput;
2513
export { type TextInputSkeletonProps };

0 commit comments

Comments
 (0)