@box/blueprint-web 7.8.0 → 7.9.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.
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { type ContentFieldProps } from './types';
3
3
  export declare const contentFieldButtonTestId = "ContentField-button";
4
- export declare const ContentField: ({ clearButtonAriaLabel, itemIcon, hintText, isSharedFolder, onClick, onClickClearButton, title, error, }: ContentFieldProps) => JSX.Element;
4
+ export declare const ContentField: import("react").ForwardRefExoticComponent<ContentFieldProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -4,7 +4,7 @@ import { FolderShared } from '@box/blueprint-web-assets/icons/Content';
4
4
  import { XMark, Folder } from '@box/blueprint-web-assets/icons/Fill';
5
5
  import { Space6, Space4 } from '@box/blueprint-web-assets/tokens/tokens';
6
6
  import clsx from 'clsx';
7
- import { createRef } from 'react';
7
+ import { forwardRef, createRef } from 'react';
8
8
  import { InlineError } from '../primitives/inline-error/inline-error.js';
9
9
  import { useFullTextTooltip } from '../utils/useFullTextTooltip.js';
10
10
  import styles from './content-field.module.js';
@@ -47,7 +47,7 @@ const handleOnClickClearButton = ({
47
47
  onClickClearButton(e);
48
48
  };
49
49
  const contentFieldButtonTestId = 'ContentField-button';
50
- const ContentField = ({
50
+ const ContentField = /*#__PURE__*/forwardRef(({
51
51
  clearButtonAriaLabel,
52
52
  itemIcon,
53
53
  hintText,
@@ -56,13 +56,13 @@ const ContentField = ({
56
56
  onClickClearButton,
57
57
  title,
58
58
  error
59
- }) => {
60
- const ref = /*#__PURE__*/createRef();
59
+ }, forwardedRef) => {
60
+ const labelRef = /*#__PURE__*/createRef();
61
61
  const {
62
62
  Wrapper: Tooltip,
63
63
  wrapperProps
64
64
  } = useFullTextTooltip({
65
- ref,
65
+ ref: labelRef,
66
66
  textValue: title ?? hintText
67
67
  });
68
68
  return jsxs("div", {
@@ -72,6 +72,7 @@ const ContentField = ({
72
72
  children: [jsx(Tooltip, {
73
73
  ...wrapperProps,
74
74
  children: jsxs(Button, {
75
+ ref: forwardedRef,
75
76
  className: clsx(styles.contentButton, {
76
77
  [styles.hasSelection]: title,
77
78
  [styles.error]: !!error
@@ -85,7 +86,7 @@ const ContentField = ({
85
86
  }), jsx("div", {
86
87
  className: styles.contentLabelWrapper,
87
88
  children: jsx("div", {
88
- ref: ref,
89
+ ref: labelRef,
89
90
  className: styles.contentLabel,
90
91
  children: title ?? hintText
91
92
  })
@@ -98,7 +99,7 @@ const ContentField = ({
98
99
  [styles.error]: !!error
99
100
  }),
100
101
  onClick: handleOnClickClearButton({
101
- ref,
102
+ ref: labelRef,
102
103
  onClickClearButton
103
104
  }),
104
105
  type: "button",
@@ -113,6 +114,6 @@ const ContentField = ({
113
114
  children: error
114
115
  })]
115
116
  });
116
- };
117
+ });
117
118
 
118
119
  export { ContentField, contentFieldButtonTestId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -57,7 +57,7 @@
57
57
  "@box/storybook-utils": "^0.2.1",
58
58
  "react-stately": "^3.31.1"
59
59
  },
60
- "gitHead": "cca3b51a9667470b94e0898699f1c2ed8ccdc4cd",
60
+ "gitHead": "45ac61f3a57a0a09042ff5d5737dfe9e30e682fd",
61
61
  "module": "lib-esm/index.js",
62
62
  "main": "lib-esm/index.js",
63
63
  "exports": {