@box/blueprint-web 16.20.6 → 16.20.7
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/branding-styles/utils/createTheme.d.ts +5 -0
- package/dist/lib-esm/branding-styles/utils/createTheme.js +7 -6
- package/dist/lib-esm/branding-styles/utils/theme.d.ts +5 -0
- package/dist/lib-esm/branding-styles/utils/theme.js +5 -1
- package/dist/lib-esm/branding-styles/utils/variables.d.ts +5 -39
- package/dist/lib-esm/branding-styles/utils/variables.js +5 -3
- package/dist/lib-esm/components.css +242 -221
- package/dist/lib-esm/data-table/cell/sticky-cell.module.js +1 -1
- package/dist/lib-esm/data-table/data-table.module.js +1 -1
- package/dist/lib-esm/index.css +242 -221
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-actions.js +6 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.js +36 -14
- 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/base-grid-list.js +34 -3
- package/dist/lib-esm/util-components/base-grid-list-item/grid-list-interaction-utils.d.ts +32 -0
- package/dist/lib-esm/util-components/base-grid-list-item/grid-list-interaction-utils.js +55 -0
- package/dist/lib-esm/util-components/base-grid-list-item/types.d.ts +11 -3
- package/package.json +3 -3
|
@@ -59,10 +59,15 @@ const GridListActions = ({
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
const BaseGridListActionIconButton = /*#__PURE__*/forwardRef(function BaseGridListActionIconButton(props, forwardedRef) {
|
|
62
|
+
const {
|
|
63
|
+
layoutStyle,
|
|
64
|
+
variant
|
|
65
|
+
} = useBaseGridListContext();
|
|
66
|
+
const defaultSize = layoutStyle === 'grid-v2' && variant === 'x-small' ? 'x-small' : 'small';
|
|
62
67
|
// DOM props are e.g handlers passed from DropdownTrigger
|
|
63
68
|
const {
|
|
64
69
|
onClick,
|
|
65
|
-
size =
|
|
70
|
+
size = defaultSize,
|
|
66
71
|
...domProps
|
|
67
72
|
} = props;
|
|
68
73
|
const render = useCallback(ariakitProps => {
|
|
@@ -6,6 +6,7 @@ import { noop } from '../../utils/noop.js';
|
|
|
6
6
|
import { useDebounce } from '../../utils/use-debounce.js';
|
|
7
7
|
import { useBaseGridListContext } from './base-grid-list.js';
|
|
8
8
|
import styles from './base-grid-list-item.module.js';
|
|
9
|
+
import { isGridV2SingleSelect, GRID_LIST_ITEM_NUMERIC_KEY_ATTR, isGridListContentTarget, getGridListItemKeyFromTarget } from './grid-list-interaction-utils.js';
|
|
9
10
|
import { StaticGridListItem } from './static-grid-list-item.js';
|
|
10
11
|
|
|
11
12
|
const BaseGridListItemContext = /*#__PURE__*/createContext({
|
|
@@ -20,12 +21,6 @@ const BaseGridListItemContext = /*#__PURE__*/createContext({
|
|
|
20
21
|
const useBaseGridListItemContext = () => {
|
|
21
22
|
return useContext(BaseGridListItemContext);
|
|
22
23
|
};
|
|
23
|
-
/**
|
|
24
|
-
* CSS selectors for grid-v2 click handling (defined outside component to save bundle size).
|
|
25
|
-
* Combined into single strings to reduce .closest() calls.
|
|
26
|
-
*/
|
|
27
|
-
const CHECKBOX_SELECTOR = '[class*="selection"], input[type="checkbox"]';
|
|
28
|
-
const INTERACTIVE_SELECTOR = 'button, a, input, [role="button"], [class*="actions"]';
|
|
29
24
|
const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props, forwardedRef) {
|
|
30
25
|
const {
|
|
31
26
|
children,
|
|
@@ -38,7 +33,8 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
38
33
|
const {
|
|
39
34
|
layoutStyle,
|
|
40
35
|
isInteractive,
|
|
41
|
-
onAction
|
|
36
|
+
onAction,
|
|
37
|
+
selectionMode
|
|
42
38
|
} = useBaseGridListContext();
|
|
43
39
|
const textValue = typeof rest.textValue === 'string' ? rest.textValue : undefined;
|
|
44
40
|
const [isItemInteracted, setIsItemInteracted] = useState(false);
|
|
@@ -75,6 +71,15 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
75
71
|
const isGridV2 = layoutStyle === 'grid-v2';
|
|
76
72
|
const isListV2 = layoutStyle === 'list-v2';
|
|
77
73
|
const isV2Layout = isGridV2 || isListV2;
|
|
74
|
+
const ownsAction = isGridV2SingleSelect(selectionMode, layoutStyle);
|
|
75
|
+
const fireAction = itemKey => {
|
|
76
|
+
// 0 is a valid React Aria key, so this cannot be a truthiness check. An empty string is
|
|
77
|
+
// still rejected: it only ever comes from a blank textValue fallback, never a real key.
|
|
78
|
+
if (!onAction || itemKey == null || itemKey === '') {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
onAction(itemKey);
|
|
82
|
+
};
|
|
78
83
|
/**
|
|
79
84
|
* V2 click behavior fix (applies to both grid-v2 and list-v2):
|
|
80
85
|
*
|
|
@@ -87,24 +92,36 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
87
92
|
* - Checkbox clicks: propagate → toggle selection
|
|
88
93
|
* - Action buttons: propagate → button handlers fire
|
|
89
94
|
* - Content/empty space: stop propagation, trigger onAction
|
|
95
|
+
*
|
|
96
|
+
* Grid-v2 single-select is the exception: content clicks propagate so React Aria selects the
|
|
97
|
+
* item, and onAction fires afterwards from handleContentClick.
|
|
90
98
|
*/
|
|
91
99
|
const handleContentPointerDown = e => {
|
|
92
|
-
|
|
93
|
-
// Allow checkbox and interactive element clicks to propagate normally
|
|
94
|
-
if (target.closest(CHECKBOX_SELECTOR) || target.closest(INTERACTIVE_SELECTOR)) {
|
|
100
|
+
if (!isGridListContentTarget(e.target) || ownsAction) {
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
// Stop propagation for content clicks, then trigger onAction
|
|
98
104
|
e.stopPropagation();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
fireAction(rest.id ?? textValue);
|
|
106
|
+
};
|
|
107
|
+
// Only single-select resolves keys through the DOM, so the marker is scoped to that path.
|
|
108
|
+
const numericKeyProps = ownsAction && typeof rest.id === 'number' ? {
|
|
109
|
+
[GRID_LIST_ITEM_NUMERIC_KEY_ATTR]: ''
|
|
110
|
+
} : {};
|
|
111
|
+
// Click runs after React Aria's press handling, so selection is already committed by now.
|
|
112
|
+
// The key comes from the DOM so that onAction and onSelectionChange always report the same
|
|
113
|
+
// React Aria collection key, including when the consumer relies on an auto-generated one.
|
|
114
|
+
const handleContentClick = e => {
|
|
115
|
+
if (!ownsAction || !isGridListContentTarget(e.target)) {
|
|
116
|
+
return;
|
|
102
117
|
}
|
|
118
|
+
fireAction(getGridListItemKeyFromTarget(e.target) ?? rest.id ?? textValue);
|
|
103
119
|
};
|
|
104
120
|
// Only apply pointer handler for V2 layouts in interactive mode
|
|
105
121
|
const pointerDownHandler = isV2Layout && isInteractive ? handleContentPointerDown : undefined;
|
|
106
122
|
return jsx(GridListItem$1, {
|
|
107
123
|
...rest,
|
|
124
|
+
...numericKeyProps,
|
|
108
125
|
ref: forwardedRef,
|
|
109
126
|
className: clsx(layoutStyleClass, {
|
|
110
127
|
[styles.loading]: loading
|
|
@@ -121,8 +138,13 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
121
138
|
children: [isListV2 && jsx("div", {
|
|
122
139
|
"aria-hidden": "true",
|
|
123
140
|
className: styles.listV2Divider
|
|
124
|
-
}), pointerDownHandler ?
|
|
141
|
+
}), pointerDownHandler ?
|
|
142
|
+
// Not an independent control: keyboard activation is handled on BaseGridList,
|
|
143
|
+
// and a role/tabIndex here would add a competing tab stop inside the row.
|
|
144
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
145
|
+
jsx("div", {
|
|
125
146
|
className: isGridV2 ? styles.gridV2ClickShield : styles.listV2ClickShield,
|
|
147
|
+
onClick: handleContentClick,
|
|
126
148
|
onPointerDownCapture: pointerDownHandler,
|
|
127
149
|
children: children
|
|
128
150
|
}) : children]
|
|
@@ -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--84f7a","smallListItem":"bp_base_grid_list_item_module_smallListItem--84f7a","header":"bp_base_grid_list_item_module_header--84f7a","subtitle":"bp_base_grid_list_item_module_subtitle--84f7a","loading":"bp_base_grid_list_item_module_loading--84f7a","thumbnail":"bp_base_grid_list_item_module_thumbnail--84f7a","thumbnailContent":"bp_base_grid_list_item_module_thumbnailContent--84f7a","actions":"bp_base_grid_list_item_module_actions--84f7a","selection":"bp_base_grid_list_item_module_selection--84f7a","inner":"bp_base_grid_list_item_module_inner--84f7a","actionsCheckboxWrapper":"bp_base_grid_list_item_module_actionsCheckboxWrapper--84f7a","largeList":"bp_base_grid_list_item_module_largeList--84f7a","largeListItem":"bp_base_grid_list_item_module_largeListItem--84f7a","fade":"bp_base_grid_list_item_module_fade--84f7a","description":"bp_base_grid_list_item_module_description--84f7a","snippet":"bp_base_grid_list_item_module_snippet--84f7a","snippetContent":"bp_base_grid_list_item_module_snippetContent--84f7a","gridList":"bp_base_grid_list_item_module_gridList--84f7a","gridListItem":"bp_base_grid_list_item_module_gridListItem--84f7a","statusPin":"bp_base_grid_list_item_module_statusPin--84f7a","isItemInteracted":"bp_base_grid_list_item_module_isItemInteracted--84f7a","tooltipContent":"bp_base_grid_list_item_module_tooltipContent--84f7a","tooltipArrow":"bp_base_grid_list_item_module_tooltipArrow--84f7a","gridListV2":"bp_base_grid_list_item_module_gridListV2--84f7a","gridListV2Item":"bp_base_grid_list_item_module_gridListV2Item--84f7a","noActions":"bp_base_grid_list_item_module_noActions--84f7a","thumbnailBadges":"bp_base_grid_list_item_module_thumbnailBadges--84f7a","statusBadge":"bp_base_grid_list_item_module_statusBadge--84f7a","fileTypePill":"bp_base_grid_list_item_module_fileTypePill--84f7a","textCentered":"bp_base_grid_list_item_module_textCentered--84f7a","innerCentered":"bp_base_grid_list_item_module_innerCentered--84f7a","gridListV2Small":"bp_base_grid_list_item_module_gridListV2Small--84f7a","gridListV2XSmall":"bp_base_grid_list_item_module_gridListV2XSmall--84f7a","gridV2ClickShield":"bp_base_grid_list_item_module_gridV2ClickShield--84f7a","listV2ClickShield":"bp_base_grid_list_item_module_listV2ClickShield--84f7a","listV2":"bp_base_grid_list_item_module_listV2--84f7a","listV2Item":"bp_base_grid_list_item_module_listV2Item--84f7a","listV2Divider":"bp_base_grid_list_item_module_listV2Divider--84f7a","content":"bp_base_grid_list_item_module_content--84f7a","staticList":"bp_base_grid_list_item_module_staticList--84f7a","staticListItem":"bp_base_grid_list_item_module_staticListItem--84f7a"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -6,6 +6,7 @@ import { noop } from '../../utils/noop.js';
|
|
|
6
6
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
7
7
|
import { isCtrlKeyPressed } from '../../utils/keyboardUtils.js';
|
|
8
8
|
import styles from './base-grid-list-item.module.js';
|
|
9
|
+
import { isGridV2SingleSelect, isGridListContentTarget, getGridListItemKeyFromTarget } from './grid-list-interaction-utils.js';
|
|
9
10
|
import { StaticGridList } from './static-grid-list.js';
|
|
10
11
|
|
|
11
12
|
const BaseGridListContext = /*#__PURE__*/createContext({
|
|
@@ -37,6 +38,10 @@ const BaseGridList = /*#__PURE__*/forwardRef(function BaseGridList(props, forwar
|
|
|
37
38
|
enableModernizedComponents
|
|
38
39
|
} = useBlueprintModernization();
|
|
39
40
|
const handleOnAction = onAction || noop;
|
|
41
|
+
// In grid-v2 single-select, React Aria must only ever select on press: passing it onAction would
|
|
42
|
+
// make it treat rows as actionable and swallow the selection. Blueprint fires onAction itself,
|
|
43
|
+
// from the item's click shield and from the Enter handler below.
|
|
44
|
+
const ownsAction = isGridV2SingleSelect(rest.selectionMode, layoutStyle);
|
|
40
45
|
const context = useMemo(() => ({
|
|
41
46
|
selectionMode: rest.selectionMode,
|
|
42
47
|
selectionBehavior: rest.selectionBehavior,
|
|
@@ -72,9 +77,33 @@ const BaseGridList = /*#__PURE__*/forwardRef(function BaseGridList(props, forwar
|
|
|
72
77
|
}
|
|
73
78
|
const GridList$1 = isInteractive ? GridList : StaticGridList;
|
|
74
79
|
const isGridV2 = layoutStyle === 'grid-v2';
|
|
75
|
-
|
|
80
|
+
let variantClass;
|
|
81
|
+
if (isGridV2) {
|
|
82
|
+
if (variant === 'small') {
|
|
83
|
+
variantClass = styles.gridListV2Small;
|
|
84
|
+
} else if (variant === 'x-small') {
|
|
85
|
+
variantClass = styles.gridListV2XSmall;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// React Aria's GridListItem filters onKeyDown out of its DOM props, so Enter -> onAction for
|
|
89
|
+
// grid-v2 single-select is handled here. It has to run on capture because React Aria's own
|
|
90
|
+
// press handling stops propagation, which would keep the event from bubbling back up. Selection
|
|
91
|
+
// is committed during that bubble phase, so onAction is deferred to a microtask to stay ordered
|
|
92
|
+
// after it.
|
|
93
|
+
const handleKeyDownCapture = e => {
|
|
94
|
+
stopPropagationForNonSpecialKeys(e);
|
|
95
|
+
if (!ownsAction || e.key !== 'Enter' || !isGridListContentTarget(e.target)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const key = getGridListItemKeyFromTarget(e.target);
|
|
99
|
+
if (key != null) {
|
|
100
|
+
queueMicrotask(() => {
|
|
101
|
+
handleOnAction(key);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
76
105
|
return jsx("div", {
|
|
77
|
-
onKeyDownCapture:
|
|
106
|
+
onKeyDownCapture: handleKeyDownCapture,
|
|
78
107
|
children: jsx(BaseGridListContext.Provider, {
|
|
79
108
|
value: context,
|
|
80
109
|
children: jsx(GridList$1, {
|
|
@@ -83,7 +112,9 @@ const BaseGridList = /*#__PURE__*/forwardRef(function BaseGridList(props, forwar
|
|
|
83
112
|
className: clsx(layoutStyleClass, variantClass, className),
|
|
84
113
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
85
114
|
layout: layoutFinal,
|
|
86
|
-
|
|
115
|
+
...(ownsAction ? {} : {
|
|
116
|
+
onAction: handleOnAction
|
|
117
|
+
}),
|
|
87
118
|
children: children
|
|
88
119
|
})
|
|
89
120
|
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type BaseGridListLayoutProp, type BaseGridListProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Shared click/keyboard target helpers for BaseGridList and BaseGridListItem.
|
|
4
|
+
* Kept in a separate module because BaseGridListItem already imports from BaseGridList,
|
|
5
|
+
* so putting them in either file would create a circular import.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* React Aria's useSelectableItem stamps the collection key on every selectable row as `data-key`.
|
|
9
|
+
* The list-level Enter handler reads it back to resolve which row was activated.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GRID_LIST_ITEM_DATA_KEY_ATTR = "data-key";
|
|
12
|
+
/**
|
|
13
|
+
* `data-key` can only ever be read back as a string, but React Aria keeps numeric keys numeric in
|
|
14
|
+
* onSelectionChange. BaseGridListItem stamps this marker on rows whose key is a number so the
|
|
15
|
+
* activation handlers can restore the original type and report keys consistently across both props.
|
|
16
|
+
*/
|
|
17
|
+
export declare const GRID_LIST_ITEM_NUMERIC_KEY_ATTR = "data-grid-list-numeric-key";
|
|
18
|
+
/**
|
|
19
|
+
* React Aria treats an item with an onAction as "actionable", which makes a press run the action
|
|
20
|
+
* instead of selecting. GridListV2 single-select needs the press to select, so Blueprint withholds
|
|
21
|
+
* onAction from React Aria there and fires it itself. Every other layout and selection mode keeps
|
|
22
|
+
* React Aria's own onAction forwarding.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isGridV2SingleSelect: (selectionMode: BaseGridListProps["selectionMode"], layoutStyle: BaseGridListLayoutProp["layoutStyle"] | undefined) => boolean;
|
|
25
|
+
/** Whether a click/keyboard target is item content rather than the checkbox or an action control. */
|
|
26
|
+
export declare const isGridListContentTarget: (target: EventTarget | null) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the React Aria collection key of the row containing `target`, restoring a numeric key's
|
|
29
|
+
* original type when the row is marked as numeric. Auto-generated keys have no representation other
|
|
30
|
+
* than the `data-key` string, so those stay strings.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getGridListItemKeyFromTarget: (target: EventTarget | null) => string | number | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared click/keyboard target helpers for BaseGridList and BaseGridListItem.
|
|
3
|
+
* Kept in a separate module because BaseGridListItem already imports from BaseGridList,
|
|
4
|
+
* so putting them in either file would create a circular import.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* React Aria's useSelectableItem stamps the collection key on every selectable row as `data-key`.
|
|
8
|
+
* The list-level Enter handler reads it back to resolve which row was activated.
|
|
9
|
+
*/
|
|
10
|
+
const GRID_LIST_ITEM_DATA_KEY_ATTR = 'data-key';
|
|
11
|
+
/**
|
|
12
|
+
* `data-key` can only ever be read back as a string, but React Aria keeps numeric keys numeric in
|
|
13
|
+
* onSelectionChange. BaseGridListItem stamps this marker on rows whose key is a number so the
|
|
14
|
+
* activation handlers can restore the original type and report keys consistently across both props.
|
|
15
|
+
*/
|
|
16
|
+
const GRID_LIST_ITEM_NUMERIC_KEY_ATTR = 'data-grid-list-numeric-key';
|
|
17
|
+
/**
|
|
18
|
+
* CSS selectors for grid-v2 click handling (defined outside the components to save bundle size).
|
|
19
|
+
* Combined into single strings to reduce .closest() calls.
|
|
20
|
+
*/
|
|
21
|
+
const CHECKBOX_SELECTOR = '[class*="selection"], input[type="checkbox"]';
|
|
22
|
+
const INTERACTIVE_SELECTOR = 'button, a, input, [role="button"], [class*="actions"]';
|
|
23
|
+
/**
|
|
24
|
+
* React Aria treats an item with an onAction as "actionable", which makes a press run the action
|
|
25
|
+
* instead of selecting. GridListV2 single-select needs the press to select, so Blueprint withholds
|
|
26
|
+
* onAction from React Aria there and fires it itself. Every other layout and selection mode keeps
|
|
27
|
+
* React Aria's own onAction forwarding.
|
|
28
|
+
*/
|
|
29
|
+
const isGridV2SingleSelect = (selectionMode, layoutStyle) => selectionMode === 'single' && layoutStyle === 'grid-v2';
|
|
30
|
+
/** Whether a click/keyboard target is item content rather than the checkbox or an action control. */
|
|
31
|
+
const isGridListContentTarget = target => {
|
|
32
|
+
// SVG thumbnails are SVGElement rather than HTMLElement; Element covers both.
|
|
33
|
+
if (!(target instanceof Element)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return !target.closest(CHECKBOX_SELECTOR) && !target.closest(INTERACTIVE_SELECTOR);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the React Aria collection key of the row containing `target`, restoring a numeric key's
|
|
40
|
+
* original type when the row is marked as numeric. Auto-generated keys have no representation other
|
|
41
|
+
* than the `data-key` string, so those stay strings.
|
|
42
|
+
*/
|
|
43
|
+
const getGridListItemKeyFromTarget = target => {
|
|
44
|
+
if (!(target instanceof Element)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const row = target.closest(`[${GRID_LIST_ITEM_DATA_KEY_ATTR}]`);
|
|
48
|
+
const key = row?.getAttribute(GRID_LIST_ITEM_DATA_KEY_ATTR);
|
|
49
|
+
if (key == null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return row?.hasAttribute(GRID_LIST_ITEM_NUMERIC_KEY_ATTR) ? Number(key) : key;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { GRID_LIST_ITEM_DATA_KEY_ATTR, GRID_LIST_ITEM_NUMERIC_KEY_ATTR, getGridListItemKeyFromTarget, isGridListContentTarget, isGridV2SingleSelect };
|
|
@@ -9,8 +9,12 @@ export interface BaseGridListLayoutProp {
|
|
|
9
9
|
* Size variant for grid-v2 layout.
|
|
10
10
|
* - 'large': Min width 375px, good for detailed thumbnails (default)
|
|
11
11
|
* - 'small': Min width 250px, good for compact grids with more items
|
|
12
|
+
* - 'x-small': Min width 140px narrow packing; same typography as large/small, with 24px action
|
|
13
|
+
* buttons and selection checkbox. Tiles are too narrow for a row of action buttons, so `Actions`
|
|
14
|
+
* should render a single overflow-menu trigger (`ActionIconButton` + `DropdownMenu`) whose
|
|
15
|
+
* items are the actions, rather than several inline `ActionIconButton`s.
|
|
12
16
|
*/
|
|
13
|
-
export type GridV2Variant = 'large' | 'small';
|
|
17
|
+
export type GridV2Variant = 'large' | 'small' | 'x-small';
|
|
14
18
|
interface CustomGridListProps extends BaseGridListLayoutProp {
|
|
15
19
|
/**
|
|
16
20
|
* This flag allows the consumer to opt-out of the default
|
|
@@ -27,9 +31,13 @@ interface CustomGridListProps extends BaseGridListLayoutProp {
|
|
|
27
31
|
*/
|
|
28
32
|
centerText?: boolean;
|
|
29
33
|
/**
|
|
30
|
-
* Size variant for grid-v2 layout.
|
|
34
|
+
* Size variant for grid-v2 layout.
|
|
31
35
|
* - 'large': Min width 375px (~23.4rem), max 1fr - good for detailed thumbnails
|
|
32
|
-
* - 'small': Min width 250px (~15.6rem), max 1fr - good for compact grids
|
|
36
|
+
* - 'small': Min width 250px (~15.6rem), max 1fr - good for compact grids (column packing only)
|
|
37
|
+
* - 'x-small': Min width 140px (~8.75rem), max 1fr - narrow packing for rails. Typography
|
|
38
|
+
* matches large/small; only the action buttons and selection checkbox shrink to 24px.
|
|
39
|
+
* `Actions` should render a single overflow-menu trigger whose items are the actions,
|
|
40
|
+
* rather than several inline `ActionIconButton`s.
|
|
33
41
|
*
|
|
34
42
|
* Items will expand to fill available space (like grid-v1).
|
|
35
43
|
* Only applies to grid-v2 layout. Has no effect on other layouts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "16.20.
|
|
3
|
+
"version": "16.20.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@ariakit/react": "0.4.21",
|
|
57
57
|
"@ariakit/react-core": "0.4.21",
|
|
58
|
-
"@box/blueprint-web-assets": "^5.7.
|
|
58
|
+
"@box/blueprint-web-assets": "^5.7.14",
|
|
59
59
|
"@internationalized/date": "^3.12.0",
|
|
60
60
|
"@radix-ui/react-accordion": "1.1.2",
|
|
61
61
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@box/box-test-client": "^3.2.7",
|
|
88
88
|
"@box/playwright-utils": "^2.8.5",
|
|
89
|
-
"@box/storybook-utils": "^1.2.
|
|
89
|
+
"@box/storybook-utils": "^1.2.23",
|
|
90
90
|
"@figma/code-connect": "1.4.4",
|
|
91
91
|
"@playwright/test": "1.46.1",
|
|
92
92
|
"@types/js-yaml": "^4.0.9",
|