@box/blueprint-web 19.1.1 → 19.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.
- package/dist/lib-esm/components.css +239 -199
- package/dist/lib-esm/grid-list-item/index.d.ts +2 -2
- package/dist/lib-esm/grid-list-v2/index.d.ts +2 -2
- package/dist/lib-esm/grid-list-v2/types.d.ts +3 -3
- package/dist/lib-esm/index.css +239 -199
- package/dist/lib-esm/large-list-item/index.d.ts +2 -2
- package/dist/lib-esm/large-list-v2/index.d.ts +2 -2
- package/dist/lib-esm/large-list-v2/types.d.ts +3 -3
- package/dist/lib-esm/small-list-item/index.d.ts +2 -2
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-header.d.ts +2 -2
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-header.js +27 -10
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-thumbnail.d.ts +2 -2
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-thumbnail.js +5 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.module.js +1 -1
- package/dist/lib-esm/util-components/base-grid-list-item/index.d.ts +3 -3
- package/dist/lib-esm/util-components/base-grid-list-item/types.d.ts +16 -0
- package/dist/lib-esm/utils/useFullTextTooltip.d.ts +3 -1
- package/dist/lib-esm/utils/useFullTextTooltip.js +3 -2
- package/dist/lib-esm/utils/useIsEllipsized.d.ts +2 -1
- package/dist/lib-esm/utils/useIsEllipsized.js +3 -2
- package/package.json +3 -3
|
@@ -50,11 +50,11 @@ export declare const LargeList: import("react").ForwardRefExoticComponent<import
|
|
|
50
50
|
/**
|
|
51
51
|
* Styled wrapper over an image or icon.
|
|
52
52
|
*/
|
|
53
|
-
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
53
|
+
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2ThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
54
54
|
/**
|
|
55
55
|
* Styled wrapper over the title of an item and potential Status components.
|
|
56
56
|
*/
|
|
57
|
-
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
57
|
+
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2HeaderProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
58
58
|
/**
|
|
59
59
|
* Styled wrapper over the subtitle of an item.
|
|
60
60
|
*/
|
|
@@ -24,13 +24,13 @@ export declare const LargeListV2: import("react").ForwardRefExoticComponent<impo
|
|
|
24
24
|
/** An individual item in the list. */
|
|
25
25
|
Item: import("react").ForwardRefExoticComponent<import("../util-components/base-grid-list-item").BaseGridListItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
26
|
/** Styled wrapper for the thumbnail/icon (4:3 aspect ratio). */
|
|
27
|
-
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
27
|
+
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2ThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
28
|
/** Content wrapper that groups header and subtitle. */
|
|
29
29
|
Content: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
30
30
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
31
31
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
32
|
/** Title/name of the item (15px/20px). */
|
|
33
|
-
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
33
|
+
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2HeaderProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
34
34
|
/** Text between the title and subtitle. Wraps to three lines. */
|
|
35
35
|
Description: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
36
36
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type BaseGridListActionIconButtonProps, type BaseGridListActionsProps, type
|
|
1
|
+
import { type BaseGridListActionIconButtonProps, type BaseGridListActionsProps, type BaseGridListItemProps, type BaseGridListProps, type BaseGridListSubtitleProps, type BaseGridListV2HeaderProps, type BaseGridListV2ThumbnailProps, type BaseGridListV2DescriptionProps } from '../util-components/base-grid-list-item/types';
|
|
2
2
|
export type LargeListV2Props = Omit<BaseGridListProps, 'layoutStyle' | 'centerText' | 'variant'>;
|
|
3
3
|
export type LargeListV2ItemProps = BaseGridListItemProps;
|
|
4
|
-
export type LargeListV2ThumbnailProps =
|
|
5
|
-
export type LargeListV2HeaderProps =
|
|
4
|
+
export type LargeListV2ThumbnailProps = BaseGridListV2ThumbnailProps;
|
|
5
|
+
export type LargeListV2HeaderProps = BaseGridListV2HeaderProps;
|
|
6
6
|
export type LargeListV2SubtitleProps = BaseGridListSubtitleProps;
|
|
7
7
|
export type LargeListV2DescriptionProps = BaseGridListV2DescriptionProps;
|
|
8
8
|
export type LargeListV2ActionsProps = BaseGridListActionsProps;
|
|
@@ -37,11 +37,11 @@ export declare const SmallList: import("react").ForwardRefExoticComponent<import
|
|
|
37
37
|
/**
|
|
38
38
|
* Styled wrapper over an image or icon.
|
|
39
39
|
*/
|
|
40
|
-
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
40
|
+
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2ThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
41
|
/**
|
|
42
42
|
* Styled wrapper over the title of an item.
|
|
43
43
|
*/
|
|
44
|
-
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").
|
|
44
|
+
Header: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListV2HeaderProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
45
45
|
/**
|
|
46
46
|
* Styled wrapper over the subtitle of an item.
|
|
47
47
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const BaseGridListHeader: import("react").ForwardRefExoticComponent<Omit<
|
|
1
|
+
import { type BaseGridListV2HeaderProps } from './types';
|
|
2
|
+
export declare const BaseGridListHeader: import("react").ForwardRefExoticComponent<Omit<BaseGridListV2HeaderProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { forwardRef, useRef } from 'react';
|
|
4
4
|
import { Ghost } from '../../ghost/ghost.js';
|
|
@@ -13,6 +13,7 @@ const BaseGridListHeader = /*#__PURE__*/forwardRef(function BaseGridListHeader(p
|
|
|
13
13
|
children,
|
|
14
14
|
className,
|
|
15
15
|
textValue,
|
|
16
|
+
statusBadge,
|
|
16
17
|
...rest
|
|
17
18
|
} = props;
|
|
18
19
|
const ref = useRef(null);
|
|
@@ -23,6 +24,8 @@ const BaseGridListHeader = /*#__PURE__*/forwardRef(function BaseGridListHeader(p
|
|
|
23
24
|
layoutStyle,
|
|
24
25
|
centerText
|
|
25
26
|
} = useBaseGridListContext();
|
|
27
|
+
const supportsBadge = layoutStyle === 'grid-v2' || layoutStyle === 'list-v2';
|
|
28
|
+
const hasBadge = supportsBadge && !loading && Boolean(statusBadge);
|
|
26
29
|
const {
|
|
27
30
|
Wrapper,
|
|
28
31
|
wrapperProps
|
|
@@ -30,28 +33,42 @@ const BaseGridListHeader = /*#__PURE__*/forwardRef(function BaseGridListHeader(p
|
|
|
30
33
|
ref,
|
|
31
34
|
children,
|
|
32
35
|
textValue,
|
|
33
|
-
skipOverflowCheck: loading
|
|
36
|
+
skipOverflowCheck: loading,
|
|
37
|
+
observeDeps: [hasBadge]
|
|
34
38
|
});
|
|
35
39
|
const isLargeItem = layoutStyle === 'list';
|
|
36
40
|
const isSmallListItem = layoutStyle === 'small-list';
|
|
37
41
|
const isGridV2 = layoutStyle === 'grid-v2';
|
|
42
|
+
const forkedRef = useForkRef(ref, forwardedRef);
|
|
43
|
+
const ghost = jsx(Ghost, {
|
|
44
|
+
borderRadius: isSmallListItem ? '2rem' : undefined,
|
|
45
|
+
height: isSmallListItem ? '0.75rem' : '1.25rem',
|
|
46
|
+
variant: "rectangle",
|
|
47
|
+
width: isLargeItem ? '80%' : '100%'
|
|
48
|
+
});
|
|
49
|
+
const content = hasBadge ? jsxs(Fragment, {
|
|
50
|
+
children: [jsx("span", {
|
|
51
|
+
ref: ref,
|
|
52
|
+
className: styles.headerTitle,
|
|
53
|
+
children: children
|
|
54
|
+
}), jsx("span", {
|
|
55
|
+
className: styles.headerBadge,
|
|
56
|
+
children: statusBadge
|
|
57
|
+
})]
|
|
58
|
+
}) : children;
|
|
38
59
|
return (
|
|
39
60
|
// @ts-expect-error Fix this type error
|
|
40
61
|
jsx(Wrapper, {
|
|
41
62
|
...wrapperProps,
|
|
42
63
|
children: jsx("span", {
|
|
43
64
|
...rest,
|
|
44
|
-
ref:
|
|
65
|
+
ref: hasBadge ? forwardedRef : forkedRef,
|
|
45
66
|
className: clsx(styles.header, {
|
|
46
67
|
[styles.loading]: loading,
|
|
47
|
-
[styles.textCentered]: isGridV2 && centerText
|
|
68
|
+
[styles.textCentered]: isGridV2 && centerText,
|
|
69
|
+
[styles.headerWithBadge]: hasBadge
|
|
48
70
|
}, className),
|
|
49
|
-
children: loading ?
|
|
50
|
-
borderRadius: isSmallListItem ? '2rem' : undefined,
|
|
51
|
-
height: isSmallListItem ? '0.75rem' : '1.25rem',
|
|
52
|
-
variant: "rectangle",
|
|
53
|
-
width: isLargeItem ? '80%' : '100%'
|
|
54
|
-
}) : children
|
|
71
|
+
children: loading ? ghost : content
|
|
55
72
|
})
|
|
56
73
|
})
|
|
57
74
|
);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const BaseGridListThumbnail: import("react").ForwardRefExoticComponent<Omit<
|
|
1
|
+
import { type BaseGridListV2ThumbnailProps } from './types';
|
|
2
|
+
export declare const BaseGridListThumbnail: import("react").ForwardRefExoticComponent<Omit<BaseGridListV2ThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -14,6 +14,7 @@ const BaseGridListThumbnail = /*#__PURE__*/forwardRef(function BaseGridListThumb
|
|
|
14
14
|
hasCustomSize,
|
|
15
15
|
fileExtension,
|
|
16
16
|
statusBadge,
|
|
17
|
+
badgeAlignment = 'right',
|
|
17
18
|
...rest
|
|
18
19
|
} = props;
|
|
19
20
|
const {
|
|
@@ -21,6 +22,7 @@ const BaseGridListThumbnail = /*#__PURE__*/forwardRef(function BaseGridListThumb
|
|
|
21
22
|
} = useBaseGridListItemContext();
|
|
22
23
|
// Normalize file extension to uppercase for display (e.g., "pdf" → "PDF")
|
|
23
24
|
const normalizedExtension = fileExtension?.toUpperCase();
|
|
25
|
+
const isLeftAligned = badgeAlignment === 'left';
|
|
24
26
|
const hasBadges = !loading && (statusBadge || normalizedExtension);
|
|
25
27
|
return jsxs("div", {
|
|
26
28
|
...rest,
|
|
@@ -34,7 +36,9 @@ const BaseGridListThumbnail = /*#__PURE__*/forwardRef(function BaseGridListThumb
|
|
|
34
36
|
borderRadius: "0.5rem",
|
|
35
37
|
height: "100%"
|
|
36
38
|
}) : children, hasBadges && jsxs("div", {
|
|
37
|
-
className: styles.thumbnailBadges,
|
|
39
|
+
className: clsx(styles.thumbnailBadges, {
|
|
40
|
+
[styles.thumbnailBadgesLeft]: isLeftAligned
|
|
41
|
+
}),
|
|
38
42
|
children: [statusBadge && jsx("span", {
|
|
39
43
|
className: styles.statusBadge,
|
|
40
44
|
children: statusBadge
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"smallList":"bp_base_grid_list_item_module_smallList--
|
|
2
|
+
var styles = {"smallList":"bp_base_grid_list_item_module_smallList--0554b","smallListItem":"bp_base_grid_list_item_module_smallListItem--0554b","loading":"bp_base_grid_list_item_module_loading--0554b","thumbnail":"bp_base_grid_list_item_module_thumbnail--0554b","thumbnailContent":"bp_base_grid_list_item_module_thumbnailContent--0554b","header":"bp_base_grid_list_item_module_header--0554b","subtitle":"bp_base_grid_list_item_module_subtitle--0554b","actions":"bp_base_grid_list_item_module_actions--0554b","selection":"bp_base_grid_list_item_module_selection--0554b","inner":"bp_base_grid_list_item_module_inner--0554b","actionsCheckboxWrapper":"bp_base_grid_list_item_module_actionsCheckboxWrapper--0554b","largeList":"bp_base_grid_list_item_module_largeList--0554b","largeListItem":"bp_base_grid_list_item_module_largeListItem--0554b","fade":"bp_base_grid_list_item_module_fade--0554b","description":"bp_base_grid_list_item_module_description--0554b","snippet":"bp_base_grid_list_item_module_snippet--0554b","snippetContent":"bp_base_grid_list_item_module_snippetContent--0554b","gridList":"bp_base_grid_list_item_module_gridList--0554b","gridListItem":"bp_base_grid_list_item_module_gridListItem--0554b","statusPin":"bp_base_grid_list_item_module_statusPin--0554b","isItemInteracted":"bp_base_grid_list_item_module_isItemInteracted--0554b","tooltipContent":"bp_base_grid_list_item_module_tooltipContent--0554b","tooltipArrow":"bp_base_grid_list_item_module_tooltipArrow--0554b","gridListV2":"bp_base_grid_list_item_module_gridListV2--0554b","gridListV2Item":"bp_base_grid_list_item_module_gridListV2Item--0554b","droppableTarget":"bp_base_grid_list_item_module_droppableTarget--0554b","actionable":"bp_base_grid_list_item_module_actionable--0554b","noActions":"bp_base_grid_list_item_module_noActions--0554b","thumbnailBadges":"bp_base_grid_list_item_module_thumbnailBadges--0554b","thumbnailBadgesLeft":"bp_base_grid_list_item_module_thumbnailBadgesLeft--0554b","statusBadge":"bp_base_grid_list_item_module_statusBadge--0554b","fileTypePill":"bp_base_grid_list_item_module_fileTypePill--0554b","alwaysShowSelection":"bp_base_grid_list_item_module_alwaysShowSelection--0554b","headerWithBadge":"bp_base_grid_list_item_module_headerWithBadge--0554b","headerTitle":"bp_base_grid_list_item_module_headerTitle--0554b","headerBadge":"bp_base_grid_list_item_module_headerBadge--0554b","textCentered":"bp_base_grid_list_item_module_textCentered--0554b","innerCentered":"bp_base_grid_list_item_module_innerCentered--0554b","highlighted":"bp_base_grid_list_item_module_highlighted--0554b","gridListV2Small":"bp_base_grid_list_item_module_gridListV2Small--0554b","gridListV2XSmall":"bp_base_grid_list_item_module_gridListV2XSmall--0554b","gridListV2XSmallBordered":"bp_base_grid_list_item_module_gridListV2XSmallBordered--0554b","gridV2ClickShield":"bp_base_grid_list_item_module_gridV2ClickShield--0554b","listV2ClickShield":"bp_base_grid_list_item_module_listV2ClickShield--0554b","listV2":"bp_base_grid_list_item_module_listV2--0554b","listV2Item":"bp_base_grid_list_item_module_listV2Item--0554b","listV2Divider":"bp_base_grid_list_item_module_listV2Divider--0554b","content":"bp_base_grid_list_item_module_content--0554b","listV2Description":"bp_base_grid_list_item_module_listV2Description--0554b","staticList":"bp_base_grid_list_item_module_staticList--0554b","staticListItem":"bp_base_grid_list_item_module_staticListItem--0554b"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -11,11 +11,11 @@ export declare const BaseGridList: import("react").ForwardRefExoticComponent<imp
|
|
|
11
11
|
/**
|
|
12
12
|
* Styled wrapper over and image or icon.
|
|
13
13
|
*/
|
|
14
|
-
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("./types").
|
|
14
|
+
Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("./types").BaseGridListV2ThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
15
|
/**
|
|
16
16
|
* Styled wrapper over the title of an item and potential Status components.
|
|
17
17
|
*/
|
|
18
|
-
Header: import("react").ForwardRefExoticComponent<Omit<import("./types").
|
|
18
|
+
Header: import("react").ForwardRefExoticComponent<Omit<import("./types").BaseGridListV2HeaderProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
19
19
|
/**
|
|
20
20
|
* Styled wrapper over the subtitle of an item.
|
|
21
21
|
*/
|
|
@@ -33,4 +33,4 @@ export declare const BaseGridList: import("react").ForwardRefExoticComponent<imp
|
|
|
33
33
|
*/
|
|
34
34
|
ActionIconButton: import("react").ForwardRefExoticComponent<(Omit<import("../../primitives/icon-button/types").IconButtonVariantsProps, "ref"> | Omit<import("../../primitives/icon-button/types").IconButtonSmallUtilityVariantProps, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
35
35
|
};
|
|
36
|
-
export type { BaseGridListActionIconButtonProps, BaseGridListActionsProps, BaseGridListDescriptionProps, BaseGridListV2DescriptionProps, BaseGridListHeaderProps, BaseGridListItemProps, BaseGridListProps, BaseGridListSubtitleProps, BaseGridListThumbnailProps, GridV2Variant, } from './types';
|
|
36
|
+
export type { BaseGridListActionIconButtonProps, BaseGridListActionsProps, BaseGridListDescriptionProps, BaseGridListV2DescriptionProps, BaseGridListHeaderProps, BaseGridListItemProps, BaseGridListProps, BaseGridListSubtitleProps, BaseGridListThumbnailProps, BaseGridListV2HeaderProps, BaseGridListV2ThumbnailProps, GridV2Variant, } from './types';
|
|
@@ -63,6 +63,13 @@ export declare enum ListLayout {
|
|
|
63
63
|
export type BaseGridListHeaderProps = ComponentPropsWithRef<'span'> & {
|
|
64
64
|
textValue?: string;
|
|
65
65
|
};
|
|
66
|
+
export type BaseGridListV2HeaderProps = BaseGridListHeaderProps & {
|
|
67
|
+
/**
|
|
68
|
+
* Optional badge rendered after the title with an 8px gap, e.g. a 20x20 classification chip.
|
|
69
|
+
* The title still truncates; the badge never shrinks.
|
|
70
|
+
*/
|
|
71
|
+
statusBadge?: ReactNode;
|
|
72
|
+
};
|
|
66
73
|
/**
|
|
67
74
|
* Props for the GridListV2 Thumbnail component.
|
|
68
75
|
*
|
|
@@ -126,6 +133,15 @@ export type BaseGridListThumbnailProps = ComponentPropsWithRef<'div'> & {
|
|
|
126
133
|
*/
|
|
127
134
|
statusBadge?: ReactNode;
|
|
128
135
|
};
|
|
136
|
+
export type BaseGridListV2ThumbnailProps = BaseGridListThumbnailProps & {
|
|
137
|
+
/**
|
|
138
|
+
* Which side of the thumbnail the badges sit on.
|
|
139
|
+
* Only changes the position of what is rendered: to show the classification badge in the header
|
|
140
|
+
* instead, omit `statusBadge` and pass it to the header's `statusBadge` prop.
|
|
141
|
+
* @default 'right'
|
|
142
|
+
*/
|
|
143
|
+
badgeAlignment?: 'left' | 'right';
|
|
144
|
+
};
|
|
129
145
|
export type BaseGridListSubtitleProps = ComponentPropsWithRef<'span'>;
|
|
130
146
|
export type BaseGridListDescriptionProps = ComponentPropsWithRef<'p'>;
|
|
131
147
|
/** LargeListV2 description. A div so it can wrap non-phrasing content (v1 uses `p`). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type MutableRefObject, type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentType, type DependencyList, type MutableRefObject, type ReactNode } from 'react';
|
|
2
2
|
import { type TooltipProps } from '../tooltip';
|
|
3
3
|
interface UseFullTextTooltip {
|
|
4
4
|
(args: {
|
|
@@ -6,6 +6,8 @@ interface UseFullTextTooltip {
|
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
textValue?: string;
|
|
8
8
|
skipOverflowCheck?: boolean;
|
|
9
|
+
/** Re-observes `ref.current` when these change, for when the measured element is swapped. */
|
|
10
|
+
observeDeps?: DependencyList;
|
|
9
11
|
}): {
|
|
10
12
|
Wrapper: ComponentType<TooltipProps>;
|
|
11
13
|
wrapperProps: Record<symbol, never>;
|
|
@@ -10,9 +10,10 @@ const useFullTextTooltip = ({
|
|
|
10
10
|
ref,
|
|
11
11
|
children,
|
|
12
12
|
textValue,
|
|
13
|
-
skipOverflowCheck = false
|
|
13
|
+
skipOverflowCheck = false,
|
|
14
|
+
observeDeps
|
|
14
15
|
}) => {
|
|
15
|
-
const isEllipsized = useIsEllipsized(ref);
|
|
16
|
+
const isEllipsized = useIsEllipsized(ref, observeDeps);
|
|
16
17
|
const shouldWrapInTooltip = isEllipsized && !skipOverflowCheck;
|
|
17
18
|
const Wrapper = shouldWrapInTooltip ? props => {
|
|
18
19
|
const finalContent = props.content ?? textValue ?? children;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type DependencyList } from 'react';
|
|
2
|
+
export declare const useIsEllipsized: (ref: React.RefObject<HTMLElement>, observeDeps?: DependencyList) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import { noop } from './noop.js';
|
|
3
3
|
|
|
4
|
-
const useIsEllipsized = ref => {
|
|
4
|
+
const useIsEllipsized = (ref, observeDeps = []) => {
|
|
5
5
|
const [isEllipsized, setIsEllipsized] = useState(false);
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
const element = ref.current;
|
|
@@ -25,7 +25,8 @@ const useIsEllipsized = ref => {
|
|
|
25
25
|
observer.disconnect();
|
|
26
26
|
cancelAnimationFrame(rafID);
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
}, [ref, isEllipsized, ...observeDeps]);
|
|
29
30
|
return isEllipsized;
|
|
30
31
|
};
|
|
31
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@ariakit/react": "0.4.21",
|
|
56
56
|
"@ariakit/react-core": "0.4.21",
|
|
57
|
-
"@box/blueprint-web-assets": "^5.15.
|
|
57
|
+
"@box/blueprint-web-assets": "^5.15.6",
|
|
58
58
|
"@internationalized/date": "^3.12.4",
|
|
59
59
|
"@radix-ui/react-accordion": "1.1.2",
|
|
60
60
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@box/box-test-client": "^3.2.7",
|
|
83
83
|
"@box/playwright-utils": "^3.10.0",
|
|
84
|
-
"@box/storybook-utils": "^1.4.
|
|
84
|
+
"@box/storybook-utils": "^1.4.40",
|
|
85
85
|
"@figma/code-connect": "1.4.4",
|
|
86
86
|
"@playwright/test": "1.46.1",
|
|
87
87
|
"@types/js-yaml": "^4.0.9",
|