@box/blueprint-web 12.133.0 → 12.133.1

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
- export type { FileCategory, GridListV2ActionIconButtonProps, GridListV2ActionsProps, GridListV2HeaderProps, GridListV2ItemProps, GridListV2Props, GridListV2SubtitleProps, GridListV2ThumbnailProps, GridV2Variant, } from './types';
1
+ export type { GridListV2ActionIconButtonProps, GridListV2ActionsProps, GridListV2HeaderProps, GridListV2ItemProps, GridListV2Props, GridListV2SubtitleProps, GridListV2ThumbnailProps, GridV2Variant, } from './types';
2
2
  export declare const GridListV2: import("react").ForwardRefExoticComponent<import("./types").GridListV2Props & import("react").RefAttributes<HTMLDivElement>> & {
3
3
  Item: import("react").ForwardRefExoticComponent<import("../util-components/base-grid-list-item").BaseGridListItemProps & import("react").RefAttributes<HTMLDivElement>>;
4
4
  Thumbnail: import("react").ForwardRefExoticComponent<Omit<import("../util-components/base-grid-list-item").BaseGridListThumbnailProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,6 +1,5 @@
1
1
  import { type RequireAllOrNone } from 'type-fest';
2
2
  import { type BaseGridListActionIconButtonProps, type BaseGridListActionsProps, type BaseGridListDescriptionProps, type BaseGridListHeaderProps, type BaseGridListItemProps, type BaseGridListProps, type BaseGridListSubtitleProps, type BaseGridListThumbnailProps } from '../util-components/base-grid-list-item';
3
- export { type FileCategory } from '../types/file-category';
4
3
  export type { GridV2Variant } from '../util-components/base-grid-list-item';
5
4
  export type GridListV2HeaderProps = BaseGridListHeaderProps;
6
5
  export type GridListV2ThumbnailProps = BaseGridListThumbnailProps;
@@ -6,92 +6,13 @@ import { Text } from '../../text/text.js';
6
6
  import { useBaseGridListItemContext } from './base-grid-list-item.js';
7
7
  import styles from './base-grid-list-item.module.js';
8
8
 
9
- // Color tokens grouped by visual color to minimize bundle size
10
- // Each token uses Blueprint variable with legacy fallback
11
- const C = {
12
- // Watermelon Red 120 (#BE2C46) - pdf, powerpoint-presentation, code
13
- red: 'var(--bp-watermelon-red-120, var(--watermelon-red-120))',
14
- // Orange 130 (#A95A12) - boxcanvas, threed, vector, pages, google-slides, illustrator, presentation
15
- orange: 'var(--bp-orange-130, var(--orange-120))',
16
- // Green Light 135 (#197E54) - image, excel-spreadsheet, numbers, google-sheets, spreadsheet
17
- green: 'var(--bp-green-light-135, var(--green-light-120))',
18
- // Light Blue 115 (#1F72D6) - photoshop, dwg, keynote, video
19
- lightBlue: 'var(--bp-light-blue-115, var(--light-blue-110))',
20
- // Light Blue 135 (#1757A4) - word-document, google-docs, text
21
- darkBlue: 'var(--bp-light-blue-135, var(--light-blue-120))',
22
- // Purple Rain 100 (#9F3FED) - audio
23
- purple: 'var(--bp-purple-rain-100, var(--purple-rain-100))',
24
- // Text on Light (#222222) - default for unspecified categories
25
- gray: 'var(--bp-gray-100, var(--gray-100))'
26
- };
27
- /** Color mapping for file categories, optimized for bundle size */
28
- const FILE_CATEGORY_COLORS = {
29
- // Purple Rain 100
30
- audio: C.purple,
31
- // Orange 130
32
- boxcanvas: C.orange,
33
- // Default (text-on-light)
34
- boxnote: C.gray,
35
- // Watermelon Red 120
36
- code: C.red,
37
- // Default (text-on-light)
38
- document: C.gray,
39
- // Default (text-on-light)
40
- 'docuworks-binder': C.gray,
41
- // Green Light 135
42
- 'docuworks-file': C.green,
43
- // Light Blue 115
44
- dwg: C.lightBlue,
45
- // Green Light 135
46
- 'excel-spreadsheet': C.green,
47
- // Light Blue 135
48
- 'google-docs': C.darkBlue,
49
- // Green Light 135
50
- 'google-sheets': C.green,
51
- // Orange 130
52
- 'google-slides': C.orange,
53
- // Orange 130
54
- illustrator: C.orange,
55
- // Green Light 135
56
- image: C.green,
57
- // Default (text-on-light)
58
- indesign: C.gray,
59
- // Light Blue 115
60
- keynote: C.lightBlue,
61
- // Green Light 135
62
- numbers: C.green,
63
- // Orange 130
64
- pages: C.orange,
65
- // Watermelon Red 120
66
- pdf: C.red,
67
- // Light Blue 115
68
- photoshop: C.lightBlue,
69
- // Watermelon Red 120
70
- 'powerpoint-presentation': C.red,
71
- // Orange 130
72
- presentation: C.orange,
73
- // Green Light 135
74
- spreadsheet: C.green,
75
- // Light Blue 135
76
- text: C.darkBlue,
77
- // Orange 130
78
- threed: C.orange,
79
- // Orange 130
80
- vector: C.orange,
81
- // Light Blue 115
82
- video: C.lightBlue,
83
- // Light Blue 135
84
- 'word-document': C.darkBlue,
85
- // Default (text-on-light)
86
- zip: C.gray
87
- };
88
9
  const BaseGridListThumbnail = /*#__PURE__*/forwardRef(function BaseGridListThumbnail(props, forwardedRef) {
89
10
  const {
90
11
  children,
91
12
  className,
13
+ extensionColor,
92
14
  hasCustomSize,
93
15
  fileExtension,
94
- fileCategory,
95
16
  statusBadge,
96
17
  ...rest
97
18
  } = props;
@@ -100,7 +21,6 @@ const BaseGridListThumbnail = /*#__PURE__*/forwardRef(function BaseGridListThumb
100
21
  } = useBaseGridListItemContext();
101
22
  // Normalize file extension to uppercase for display (e.g., "pdf" → "PDF")
102
23
  const normalizedExtension = fileExtension?.toUpperCase();
103
- const extensionColor = fileCategory ? FILE_CATEGORY_COLORS[fileCategory] : undefined;
104
24
  const hasBadges = !loading && (statusBadge || normalizedExtension);
105
25
  return jsxs("div", {
106
26
  ...rest,
@@ -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, BaseGridListHeaderProps, BaseGridListItemProps, BaseGridListProps, BaseGridListSubtitleProps, BaseGridListThumbnailProps, FileCategory, GridV2Variant, } from './types';
36
+ export type { BaseGridListActionIconButtonProps, BaseGridListActionsProps, BaseGridListDescriptionProps, BaseGridListHeaderProps, BaseGridListItemProps, BaseGridListProps, BaseGridListSubtitleProps, BaseGridListThumbnailProps, GridV2Variant, } from './types';
@@ -1,9 +1,7 @@
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';
5
4
  import { type Modify } from '../../types/modify';
6
- export type { FileCategory };
7
5
  export interface BaseGridListLayoutProp {
8
6
  layoutStyle: 'grid' | 'grid-v2' | 'list' | 'list-v2' | 'small-list';
9
7
  }
@@ -79,19 +77,18 @@ export type BaseGridListThumbnailProps = ComponentPropsWithRef<'div'> & {
79
77
  */
80
78
  fileExtension?: string;
81
79
  /**
82
- * File category that determines the pill's text color.
83
- * Use `getFileCategoryByExtension(extension)` from `@box/item-icon` to get this value.
80
+ * Extension color of the file type pill
81
+ * Use `getColorByExtension(extension)` from `@box/item-icon` to get this value.
84
82
  * If not provided, the pill will use the default black text color.
85
83
  *
86
84
  * @example
87
85
  * ```tsx
88
- * import { getFileCategoryByExtension } from '@box/item-icon';
86
+ * import { getColorByExtension } from '@box/item-icon';
89
87
  *
90
- * const fileCategory = getFileCategoryByExtension('docx'); // returns 'word-document'
91
- * // The pill will display "DOCX" with blue text (word-document color)
92
- * ```
88
+ * const extensionColor = getColorByExtension('docx'); // returns 'var(--bp-light-blue-135, var(--light-blue-120))'
89
+ * The pill will display "DOCX" with dark blue text (word-document color)
93
90
  */
94
- fileCategory?: FileCategory;
91
+ extensionColor?: string;
95
92
  /**
96
93
  * Optional status badge element to render on the thumbnail (left of the file type pill).
97
94
  * Typically used for classification badges with tooltips.
@@ -135,3 +132,4 @@ export interface BaseGridListItemContextType {
135
132
  export interface BaseGridListItemProps extends GridListItemProps, Omit<BaseGridListItemContextType, 'isItemInteracted' | 'setIsItemInteracted' | 'hasActions' | 'setHasActions'> {
136
133
  children?: ReactNode;
137
134
  }
135
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "12.133.0",
3
+ "version": "12.133.1",
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.99.7",
50
+ "@box/blueprint-web-assets": "^4.99.8",
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.33",
80
+ "@box/storybook-utils": "^0.16.34",
81
81
  "@figma/code-connect": "1.3.12",
82
82
  "@types/react": "^18.0.0",
83
83
  "@types/react-dom": "^18.0.0",
@@ -1,11 +0,0 @@
1
- /**
2
- * File category type for categorizing files by their type/format.
3
- *
4
- * These categories match those returned by `getFileCategoryByExtension` from `@box/item-icon`.
5
- * Due to circular dependency constraints, `@box/blueprint-web` cannot directly import
6
- * `@box/item-icon`, so consumers should use `getFileCategoryByExtension` in their own code to
7
- * map file extensions to categories.
8
- *
9
- * @see {@link https://git.dev.box.net/Box/frontend-mono/tree/master/packages/group-shared-features/item-icon | @box/item-icon}
10
- */
11
- export type FileCategory = 'audio' | 'boxcanvas' | 'boxnote' | 'code' | 'document' | 'docuworks-binder' | 'docuworks-file' | 'dwg' | 'excel-spreadsheet' | 'google-docs' | 'google-sheets' | 'google-slides' | 'illustrator' | 'image' | 'indesign' | 'keynote' | 'numbers' | 'pages' | 'pdf' | 'photoshop' | 'powerpoint-presentation' | 'presentation' | 'spreadsheet' | 'text' | 'threed' | 'vector' | 'video' | 'word-document' | 'zip';