@box/blueprint-web 12.113.0 → 12.115.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,10 +1,18 @@
1
1
  import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
2
  import { type GridListItemProps, type GridListProps as RAGridListProps } from 'react-aria-components';
3
3
  import { type IconButtonProps } from '../../primitives/icon-button';
4
+ import { type FileCategory } from '../../types/file-category';
4
5
  import { type Modify } from '../../types/modify';
6
+ export type { FileCategory };
5
7
  export interface BaseGridListLayoutProp {
6
- layoutStyle: 'grid' | 'list' | 'small-list';
8
+ layoutStyle: 'grid' | 'grid-v2' | 'list' | 'small-list';
7
9
  }
10
+ /**
11
+ * Size variant for grid-v2 layout.
12
+ * - 'large': Min width 375px, good for detailed thumbnails (default)
13
+ * - 'small': Min width 250px, good for compact grids with more items
14
+ */
15
+ export type GridV2Variant = 'large' | 'small';
8
16
  interface CustomGridListProps extends BaseGridListLayoutProp {
9
17
  /**
10
18
  * This flag allows the consumer to opt-out of the default
@@ -14,17 +22,95 @@ interface CustomGridListProps extends BaseGridListLayoutProp {
14
22
  * @param {boolean} isInteractive
15
23
  */
16
24
  isInteractive?: boolean;
25
+ /**
26
+ * Centers the text in the Header and Subtitle components.
27
+ * Only applies to grid-v2 layout. Has no effect on other layouts.
28
+ * Useful for folder-like items or centered layouts.
29
+ */
30
+ centerText?: boolean;
31
+ /**
32
+ * Size variant for grid-v2 layout. Controls minimum item width.
33
+ * - 'large': Min width 375px (~23.4rem), max 1fr - good for detailed thumbnails
34
+ * - 'small': Min width 250px (~15.6rem), max 1fr - good for compact grids
35
+ *
36
+ * Items will expand to fill available space (like grid-v1).
37
+ * Only applies to grid-v2 layout. Has no effect on other layouts.
38
+ * @default 'large'
39
+ */
40
+ variant?: GridV2Variant;
17
41
  }
18
42
  export declare enum ListLayout {
19
43
  GRID = "Grid List",
44
+ GRID_V2 = "Grid List V2",
20
45
  LARGE_LIST = "Large List",
21
46
  SMALL_LIST = "Small List"
22
47
  }
23
48
  export type BaseGridListHeaderProps = ComponentPropsWithRef<'span'> & {
24
49
  textValue?: string;
25
50
  };
51
+ /**
52
+ * Props for the GridListV2 Thumbnail component.
53
+ *
54
+ * The thumbnail supports displaying a file type pill badge that shows the file extension
55
+ * with a color based on the file category. To use this feature:
56
+ *
57
+ * 1. Pass `fileExtension` - the file's extension (e.g., "pdf", "docx", "mp4")
58
+ * 2. Pass `fileCategory` - determines the pill's text color (use `getFileIconType` from `@box/item-icon`)
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * import { getFileIconType } from '@box/item-icon';
63
+ *
64
+ * // Get the category for color mapping
65
+ * const category = getFileIconType('docx'); // returns 'word-document'
66
+ *
67
+ * <GridListV2.Thumbnail fileExtension="docx" fileCategory={category}>
68
+ * <img src={thumbnailUrl} alt={fileName} />
69
+ * </GridListV2.Thumbnail>
70
+ * ```
71
+ */
26
72
  export type BaseGridListThumbnailProps = ComponentPropsWithRef<'div'> & {
73
+ /** When true, the thumbnail will not apply default sizing styles. */
27
74
  hasCustomSize?: boolean;
75
+ /**
76
+ * File extension to display in the file type pill (e.g., "pdf", "docx", "mp4").
77
+ * Will be normalized to uppercase for display (e.g., "pdf" → "PDF").
78
+ */
79
+ fileExtension?: string;
80
+ /**
81
+ * File category that determines the pill's text color.
82
+ * Use `getFileIconType(extension)` from `@box/item-icon` to get this value.
83
+ * If not provided, the pill will use the default black text color.
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * import { getFileIconType } from '@box/item-icon';
88
+ *
89
+ * const fileCategory = getFileIconType('docx'); // returns 'word-document'
90
+ * // The pill will display "DOCX" with blue text (word-document color)
91
+ * ```
92
+ */
93
+ fileCategory?: FileCategory;
94
+ /**
95
+ * Optional status badge element to render on the thumbnail (left of the file type pill).
96
+ * Typically used for classification badges with tooltips.
97
+ *
98
+ * @example
99
+ * ```tsx
100
+ * <GridListV2.Thumbnail
101
+ * fileExtension="xlsx"
102
+ * fileCategory="excel-spreadsheet"
103
+ * statusBadge={
104
+ * <CardTooltipV2 content="Classification: Confidential">
105
+ * <Status colorIndex={2} hideText icon={Shield} text="Confidential" />
106
+ * </CardTooltipV2>
107
+ * }
108
+ * >
109
+ * <img src={thumbnailUrl} alt={fileName} />
110
+ * </GridListV2.Thumbnail>
111
+ * ```
112
+ */
113
+ statusBadge?: ReactNode;
28
114
  };
29
115
  export type BaseGridListSubtitleProps = ComponentPropsWithRef<'span'>;
30
116
  export type BaseGridListDescriptionProps = ComponentPropsWithRef<'p'>;
@@ -41,8 +127,10 @@ export interface BaseGridListItemContextType {
41
127
  pinAriaLabel?: string;
42
128
  isItemInteracted: boolean;
43
129
  setIsItemInteracted: (isInteracted: boolean) => void;
130
+ /** Whether the item has action buttons. Used to keep subtitle visible when no actions exist. */
131
+ hasActions: boolean;
132
+ setHasActions: (hasActions: boolean) => void;
44
133
  }
45
- export interface BaseGridListItemProps extends GridListItemProps, Omit<BaseGridListItemContextType, 'isItemInteracted' | 'setIsItemInteracted'> {
134
+ export interface BaseGridListItemProps extends GridListItemProps, Omit<BaseGridListItemContextType, 'isItemInteracted' | 'setIsItemInteracted' | 'hasActions' | 'setHasActions'> {
46
135
  children?: ReactNode;
47
136
  }
48
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "12.113.0",
3
+ "version": "12.115.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.91.4",
50
+ "@box/blueprint-web-assets": "^4.91.6",
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.15.4",
80
+ "@box/storybook-utils": "^0.15.6",
81
81
  "@types/react": "^18.0.0",
82
82
  "@types/react-dom": "^18.0.0",
83
83
  "react": "^18.3.0",