@purpurds/text-field 5.10.1 → 5.11.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpurds/text-field",
3
- "version": "5.10.1",
3
+ "version": "5.11.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "./dist/text-field.cjs.js",
6
6
  "types": "./dist/text-field.d.ts",
@@ -15,13 +15,13 @@
15
15
  "source": "src/text-field.tsx",
16
16
  "dependencies": {
17
17
  "classnames": "~2.5.0",
18
- "@purpurds/field-error-text": "5.10.1",
19
- "@purpurds/button": "5.10.1",
20
- "@purpurds/field-helper-text": "5.10.1",
21
- "@purpurds/icon": "5.10.1",
22
- "@purpurds/label": "5.10.1",
23
- "@purpurds/spinner": "5.10.1",
24
- "@purpurds/tokens": "5.10.1"
18
+ "@purpurds/field-error-text": "5.11.0",
19
+ "@purpurds/field-helper-text": "5.11.0",
20
+ "@purpurds/button": "5.11.0",
21
+ "@purpurds/icon": "5.11.0",
22
+ "@purpurds/label": "5.11.0",
23
+ "@purpurds/spinner": "5.11.0",
24
+ "@purpurds/tokens": "5.11.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@rushstack/eslint-patch": "~1.10.0",
@@ -3,7 +3,10 @@ import React, {
3
3
  ForwardedRef,
4
4
  forwardRef,
5
5
  HTMLInputTypeAttribute,
6
+ isValidElement,
7
+ ReactElement,
6
8
  ReactNode,
9
+ ReactPortal,
7
10
  useId,
8
11
  } from "react";
9
12
  import { Button } from "@purpurds/button";
@@ -256,3 +259,17 @@ const TextFieldComponent = (
256
259
 
257
260
  export const TextField = forwardRef(TextFieldComponent);
258
261
  TextField.displayName = "TextField";
262
+
263
+ export const isTextField = (
264
+ child:
265
+ | ReactElement
266
+ | Iterable<ReactNode>
267
+ | ReactPortal
268
+ | string
269
+ | number
270
+ | boolean
271
+ | null
272
+ | undefined
273
+ ): child is ReactElement<TextFieldProps> =>
274
+ isValidElement<TextFieldProps>(child) &&
275
+ (child.type as any).displayName === TextField.displayName; // eslint-disable-line @typescript-eslint/no-explicit-any