@box/blueprint-web 7.1.1 → 7.2.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.
@@ -11,6 +11,7 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<(Omit<
11
11
  label: string;
12
12
  type?: "text" | undefined;
13
13
  hideLabel?: boolean | undefined;
14
+ invalid?: boolean | undefined;
14
15
  disabled?: boolean | undefined;
15
16
  required?: boolean | undefined;
16
17
  error?: import("react").ReactNode;
@@ -20,6 +21,7 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<(Omit<
20
21
  label: string;
21
22
  type?: "text" | undefined;
22
23
  hideLabel?: boolean | undefined;
24
+ invalid?: boolean | undefined;
23
25
  disabled?: boolean | undefined;
24
26
  required?: boolean | undefined;
25
27
  error?: import("react").ReactNode;
@@ -20,6 +20,7 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
20
20
  label,
21
21
  type = 'text',
22
22
  disabled,
23
+ invalid = false,
23
24
  hideLabel,
24
25
  error,
25
26
  loading = false,
@@ -34,12 +35,13 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
34
35
  inputRef.current?.focus();
35
36
  }, []);
36
37
  const hasError = !!error && !disabled;
38
+ const shouldMarkError = (!!error || invalid) && !disabled;
37
39
  const isLoading = !disabled && loading && loadingAriaLabel;
38
40
  return jsxs(Fragment, {
39
41
  children: [jsxs("div", {
40
42
  className: clsx([styles.textInputContainer], {
41
43
  [styles.disabled]: disabled,
42
- [styles.error]: hasError
44
+ [styles.error]: shouldMarkError
43
45
  }, className),
44
46
  children: [jsx("label", {
45
47
  className: clsx([styles.label], {
@@ -55,10 +57,10 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
55
57
  'aria-describedby': inlineErrorId
56
58
  }),
57
59
  ref: useForkRef(inputRef, forwardedRef),
58
- "aria-invalid": hasError,
60
+ "aria-invalid": shouldMarkError,
59
61
  "aria-required": required,
60
62
  className: clsx([styles.textInput], {
61
- [styles.error]: hasError,
63
+ [styles.error]: shouldMarkError,
62
64
  [styles.loading]: isLoading
63
65
  }),
64
66
  disabled: disabled,
@@ -13,6 +13,12 @@ export type TextInputProps = React.ComponentPropsWithRef<'input'> & {
13
13
  type?: 'text';
14
14
  /** When true label text is hidden */
15
15
  hideLabel?: boolean;
16
+ /**
17
+ * When true it enforces the error state, without error message.
18
+ * Developer is responsible for connecting the error message with TextInput using aria-describedby.
19
+ * This prop should not be used in conjunction with error prop.
20
+ * */
21
+ invalid?: boolean;
16
22
  /** When true prevents user interaction with input */
17
23
  disabled?: boolean;
18
24
  /** When true it indicates input field must be filled out */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -58,7 +58,7 @@
58
58
  "@box/storybook-utils": "^0.1.0",
59
59
  "react-stately": "^3.31.1"
60
60
  },
61
- "gitHead": "bd812a57eb43d2b270bb8c6281fb1eaec038c76e",
61
+ "gitHead": "0958a7b410ffc0894fb5e04ccb513fdb571a544b",
62
62
  "module": "lib-esm/index.js",
63
63
  "main": "lib-esm/index.js",
64
64
  "exports": {