@box/blueprint-web 12.119.0 → 12.121.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/index.css +387 -162
- package/dist/lib-esm/index.d.ts +1 -0
- package/dist/lib-esm/index.js +2 -0
- package/dist/lib-esm/large-list-v2/index.d.ts +42 -0
- package/dist/lib-esm/large-list-v2/index.js +47 -0
- package/dist/lib-esm/large-list-v2/large-list-v2-content.d.ts +7 -0
- package/dist/lib-esm/large-list-v2/large-list-v2-content.js +23 -0
- package/dist/lib-esm/large-list-v2/large-list-v2.d.ts +9 -0
- package/dist/lib-esm/large-list-v2/large-list-v2.js +25 -0
- package/dist/lib-esm/large-list-v2/types.d.ts +8 -0
- package/dist/lib-esm/page/index.d.ts +6 -0
- package/dist/lib-esm/page/index.js +5 -1
- package/dist/lib-esm/page/page-context.d.ts +19 -2
- package/dist/lib-esm/page/page-context.js +29 -3
- package/dist/lib-esm/page/page-portal.d.ts +52 -0
- package/dist/lib-esm/page/page-portal.js +83 -0
- package/dist/lib-esm/page/page-subnavigation.js +4 -1
- package/dist/lib-esm/primitives/page-header/page-header.js +8 -2
- package/dist/lib-esm/text-button/text-button.js +2 -0
- package/dist/lib-esm/text-button/types.d.ts +7 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-actions.js +1 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item-thumbnail.js +1 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.js +20 -12
- 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 +4 -0
- package/dist/lib-esm/util-components/base-grid-list-item/types.d.ts +2 -1
- package/dist/lib-esm/utils/fast-context.d.ts +2 -0
- package/dist/lib-esm/utils/fast-context.js +31 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import noop from 'lodash/noop';
|
|
4
4
|
import { forwardRef, useState, useMemo, createContext, useContext } from 'react';
|
|
@@ -53,12 +53,15 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
53
53
|
setIsItemInteracted,
|
|
54
54
|
hasActions,
|
|
55
55
|
setHasActions
|
|
56
|
-
}), [loading, pinned, pinAriaLabel, isItemInteracted, hasActions]);
|
|
56
|
+
}), [loading, pinned, pinAriaLabel, isItemInteracted, setIsItemInteracted, hasActions, setHasActions]);
|
|
57
57
|
let layoutStyleClass;
|
|
58
58
|
switch (layoutStyle) {
|
|
59
59
|
case 'list':
|
|
60
60
|
layoutStyleClass = styles.largeListItem;
|
|
61
61
|
break;
|
|
62
|
+
case 'list-v2':
|
|
63
|
+
layoutStyleClass = styles.listV2Item;
|
|
64
|
+
break;
|
|
62
65
|
case 'grid':
|
|
63
66
|
layoutStyleClass = styles.gridListItem;
|
|
64
67
|
break;
|
|
@@ -70,13 +73,15 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
70
73
|
}
|
|
71
74
|
const GridListItem$1 = isInteractive ? GridListItem : StaticGridListItem;
|
|
72
75
|
const isGridV2 = layoutStyle === 'grid-v2';
|
|
76
|
+
const isListV2 = layoutStyle === 'list-v2';
|
|
77
|
+
const isV2Layout = isGridV2 || isListV2;
|
|
73
78
|
/**
|
|
74
|
-
*
|
|
79
|
+
* V2 click behavior fix (applies to both grid-v2 and list-v2):
|
|
75
80
|
*
|
|
76
81
|
* WHY V2 NEEDS THIS BUT V1 DOESN'T:
|
|
77
82
|
* V1's CSS uses minmax() for grid rows, so content fills most of the clickable area.
|
|
78
83
|
* V2 has explicit padding creating empty space that triggers unwanted selection. This padding is needed to make space for
|
|
79
|
-
* the
|
|
84
|
+
* the selection and focus outline states which uses pseudo elements to create the outline.
|
|
80
85
|
*
|
|
81
86
|
* WHAT THIS DOES:
|
|
82
87
|
* - Checkbox clicks: propagate → toggle selection
|
|
@@ -96,8 +101,8 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
96
101
|
onAction(itemKey);
|
|
97
102
|
}
|
|
98
103
|
};
|
|
99
|
-
// Only apply pointer handler for
|
|
100
|
-
const pointerDownHandler =
|
|
104
|
+
// Only apply pointer handler for V2 layouts in interactive mode
|
|
105
|
+
const pointerDownHandler = isV2Layout && isInteractive ? handleContentPointerDown : undefined;
|
|
101
106
|
return jsx(GridListItem$1, {
|
|
102
107
|
...rest,
|
|
103
108
|
ref: forwardedRef,
|
|
@@ -106,18 +111,21 @@ const BaseGridListItem = /*#__PURE__*/forwardRef(function BaseGridListItem(props
|
|
|
106
111
|
}, {
|
|
107
112
|
[styles.isItemInteracted]: isItemInteracted || debouncedIsItemInteracted
|
|
108
113
|
},
|
|
109
|
-
// In
|
|
114
|
+
// In V2 layouts, keep subtitle visible on hover/focus when there are no action buttons
|
|
110
115
|
{
|
|
111
|
-
[styles.noActions]:
|
|
116
|
+
[styles.noActions]: isV2Layout && !hasActions
|
|
112
117
|
}, className),
|
|
113
118
|
textValue: textValue,
|
|
114
|
-
children:
|
|
119
|
+
children: jsxs(BaseGridListItemContext.Provider, {
|
|
115
120
|
value: context,
|
|
116
|
-
children:
|
|
117
|
-
|
|
121
|
+
children: [isListV2 && jsx("div", {
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
className: styles.listV2Divider
|
|
124
|
+
}), pointerDownHandler ? jsx("div", {
|
|
125
|
+
className: isGridV2 ? styles.gridV2ClickShield : styles.listV2ClickShield,
|
|
118
126
|
onPointerDownCapture: pointerDownHandler,
|
|
119
127
|
children: children
|
|
120
|
-
}) : children
|
|
128
|
+
}) : children]
|
|
121
129
|
})
|
|
122
130
|
});
|
|
123
131
|
});
|
|
@@ -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--98669","smallListItem":"bp_base_grid_list_item_module_smallListItem--98669","header":"bp_base_grid_list_item_module_header--98669","subtitle":"bp_base_grid_list_item_module_subtitle--98669","loading":"bp_base_grid_list_item_module_loading--98669","thumbnail":"bp_base_grid_list_item_module_thumbnail--98669","thumbnailContent":"bp_base_grid_list_item_module_thumbnailContent--98669","actions":"bp_base_grid_list_item_module_actions--98669","selection":"bp_base_grid_list_item_module_selection--98669","inner":"bp_base_grid_list_item_module_inner--98669","actionsCheckboxWrapper":"bp_base_grid_list_item_module_actionsCheckboxWrapper--98669","largeList":"bp_base_grid_list_item_module_largeList--98669","largeListItem":"bp_base_grid_list_item_module_largeListItem--98669","fade":"bp_base_grid_list_item_module_fade--98669","description":"bp_base_grid_list_item_module_description--98669","snippet":"bp_base_grid_list_item_module_snippet--98669","snippetContent":"bp_base_grid_list_item_module_snippetContent--98669","gridList":"bp_base_grid_list_item_module_gridList--98669","gridListItem":"bp_base_grid_list_item_module_gridListItem--98669","statusPin":"bp_base_grid_list_item_module_statusPin--98669","isItemInteracted":"bp_base_grid_list_item_module_isItemInteracted--98669","tooltipContent":"bp_base_grid_list_item_module_tooltipContent--98669","tooltipArrow":"bp_base_grid_list_item_module_tooltipArrow--98669","gridListV2":"bp_base_grid_list_item_module_gridListV2--98669","gridListV2Item":"bp_base_grid_list_item_module_gridListV2Item--98669","noActions":"bp_base_grid_list_item_module_noActions--98669","thumbnailBadges":"bp_base_grid_list_item_module_thumbnailBadges--98669","statusBadge":"bp_base_grid_list_item_module_statusBadge--98669","fileTypePill":"bp_base_grid_list_item_module_fileTypePill--98669","textCentered":"bp_base_grid_list_item_module_textCentered--98669","innerCentered":"bp_base_grid_list_item_module_innerCentered--98669","gridListV2Small":"bp_base_grid_list_item_module_gridListV2Small--98669","gridV2ClickShield":"bp_base_grid_list_item_module_gridV2ClickShield--98669","listV2ClickShield":"bp_base_grid_list_item_module_listV2ClickShield--98669","listV2":"bp_base_grid_list_item_module_listV2--98669","listV2Item":"bp_base_grid_list_item_module_listV2Item--98669","listV2Divider":"bp_base_grid_list_item_module_listV2Divider--98669","content":"bp_base_grid_list_item_module_content--98669","staticList":"bp_base_grid_list_item_module_staticList--98669","staticListItem":"bp_base_grid_list_item_module_staticListItem--98669"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -53,6 +53,10 @@ const BaseGridList = /*#__PURE__*/forwardRef(function BaseGridList(props, forwar
|
|
|
53
53
|
layoutStyleClass = styles.largeList;
|
|
54
54
|
layoutFinal = 'stack';
|
|
55
55
|
break;
|
|
56
|
+
case 'list-v2':
|
|
57
|
+
layoutStyleClass = styles.listV2;
|
|
58
|
+
layoutFinal = 'stack';
|
|
59
|
+
break;
|
|
56
60
|
case 'grid':
|
|
57
61
|
layoutStyleClass = styles.gridList;
|
|
58
62
|
layoutFinal = 'grid';
|
|
@@ -5,7 +5,7 @@ import { type FileCategory } from '../../types/file-category';
|
|
|
5
5
|
import { type Modify } from '../../types/modify';
|
|
6
6
|
export type { FileCategory };
|
|
7
7
|
export interface BaseGridListLayoutProp {
|
|
8
|
-
layoutStyle: 'grid' | 'grid-v2' | 'list' | 'small-list';
|
|
8
|
+
layoutStyle: 'grid' | 'grid-v2' | 'list' | 'list-v2' | 'small-list';
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Size variant for grid-v2 layout.
|
|
@@ -43,6 +43,7 @@ export declare enum ListLayout {
|
|
|
43
43
|
GRID = "Grid List",
|
|
44
44
|
GRID_V2 = "Grid List V2",
|
|
45
45
|
LARGE_LIST = "Large List",
|
|
46
|
+
LARGE_LIST_V2 = "Large List V2",
|
|
46
47
|
SMALL_LIST = "Small List"
|
|
47
48
|
}
|
|
48
49
|
export type BaseGridListHeaderProps = ComponentPropsWithRef<'span'> & {
|
|
@@ -4,5 +4,7 @@ export declare function createFastContext<Store>(initialState: Store): {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
useStore: <SelectorOutput>(selector: (store: Store) => SelectorOutput) => [SelectorOutput, (value: Partial<Store>) => void];
|
|
7
|
+
useStoreSafe: <SelectorOutput>(selector: (store: Store) => SelectorOutput) => [SelectorOutput, (value: Partial<Store>) => void] | null;
|
|
7
8
|
useStoreSetter: () => (value: Partial<Store>) => void;
|
|
9
|
+
useStoreSetterSafe: () => ((value: Partial<Store>) => void) | null;
|
|
8
10
|
};
|
|
@@ -58,10 +58,40 @@ function createFastContext(initialState) {
|
|
|
58
58
|
}
|
|
59
59
|
return store.set;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Same as useStoreSetter but returns null if no Provider is found.
|
|
63
|
+
* Use this when the component should work both with and without a Provider.
|
|
64
|
+
*/
|
|
65
|
+
function useStoreSetterSafe() {
|
|
66
|
+
const store = useContext(StoreContext);
|
|
67
|
+
return store?.set ?? null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Same as useStore but returns null if no Provider is found.
|
|
71
|
+
* Use this when the component should work both with and without a Provider.
|
|
72
|
+
*/
|
|
73
|
+
function useStoreSafe(selector) {
|
|
74
|
+
const store = useContext(StoreContext);
|
|
75
|
+
const [state, setState] = useState(() => store ? selector(store.get()) : selector(initialState));
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!store) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return store.subscribe(() => {
|
|
81
|
+
setState(selector(store.get()));
|
|
82
|
+
});
|
|
83
|
+
}, [selector, store]);
|
|
84
|
+
if (!store) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return [state, store.set];
|
|
88
|
+
}
|
|
61
89
|
return {
|
|
62
90
|
Provider,
|
|
63
91
|
useStore,
|
|
64
|
-
|
|
92
|
+
useStoreSafe,
|
|
93
|
+
useStoreSetter,
|
|
94
|
+
useStoreSetterSafe
|
|
65
95
|
};
|
|
66
96
|
}
|
|
67
97
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.121.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.15",
|
|
49
49
|
"@ariakit/react-core": "0.4.15",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.94.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.94.3",
|
|
51
51
|
"@internationalized/date": "^3.7.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.16.
|
|
80
|
+
"@box/storybook-utils": "^0.16.7",
|
|
81
81
|
"@types/react": "^18.0.0",
|
|
82
82
|
"@types/react-dom": "^18.0.0",
|
|
83
83
|
"react": "^18.3.0",
|