@box/blueprint-web 6.36.5 → 6.37.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.
package/README.md CHANGED
@@ -8,7 +8,6 @@
8
8
  - [Step 2: Push your feature branch](#step-2-push-your-feature-branch)
9
9
  - [Step 3: Open Pull request](#step-3-open-pull-request)
10
10
  - [Commit Types](#commit-types)
11
- - [See more in Contribution docs.](#see-more-in-contribution-docs)
12
11
  - [Package Installation](#package-installation)
13
12
  - [Component Development](#component-development)
14
13
  - [Prerequisites](#prerequisites)
@@ -99,7 +98,7 @@ The rules for commit types are:
99
98
  In most cases, commits will be a `feat` or `fix`. Make sure to include the `BREAKING CHANGE` string in the summary if
100
99
  there are non-backwards-compatible changes in the commit.
101
100
 
102
- ### See more in [Contribution docs](./docs/contribution/01-contribution-overview.stories.mdx).
101
+ See more in [Contribution docs](./docs/contribution/01-contribution-overview.stories.mdx).
103
102
 
104
103
  ## Package Installation
105
104
 
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { type ContentFieldProps } from './types';
3
3
  export declare const contentFieldButtonTestId = "ContentField-button";
4
- export declare const ContentField: ({ hintText, onClick, onClickClearButton, isSharedFolder, title, error, }: ContentFieldProps) => JSX.Element;
4
+ export declare const ContentField: ({ clearButtonAriaLabel, itemIcon, hintText, isSharedFolder, onClick, onClickClearButton, title, error, }: ContentFieldProps) => JSX.Element;
@@ -5,10 +5,10 @@ import { XMark, Folder } from '@box/blueprint-web-assets/icons/Fill';
5
5
  import { Space6, Space4 } from '@box/blueprint-web-assets/tokens/tokens';
6
6
  import clsx from 'clsx';
7
7
  import { createRef } from 'react';
8
+ import { InlineError } from '../primitives/inline-error/inline-error.js';
8
9
  import { useFullTextTooltip } from '../utils/useFullTextTooltip.js';
9
10
  import styles from './content-field.module.js';
10
11
  import { messages } from './messages.js';
11
- import { InlineError } from '../primitives/inline-error/inline-error.js';
12
12
 
13
13
  const ContentIconContainer = ({
14
14
  children
@@ -17,19 +17,28 @@ const ContentIconContainer = ({
17
17
  children: children
18
18
  });
19
19
  const ContentIcon = ({
20
- isSharedFolder
21
- }) => isSharedFolder ? jsx(FolderShared, {
22
- "aria-label": messages.sharedFolderIconLabel,
23
- className: styles.contentIconShared,
24
- height: Space6,
25
- width: Space6
26
- }) : jsx(ContentIconContainer, {
27
- children: jsx(Folder, {
28
- "aria-label": messages.folderIconLabel,
29
- height: Space4,
30
- width: Space4
31
- })
32
- });
20
+ isSharedFolder,
21
+ itemIcon
22
+ }) => {
23
+ if (itemIcon) {
24
+ return itemIcon;
25
+ }
26
+ if (isSharedFolder) {
27
+ return jsx(FolderShared, {
28
+ "aria-label": messages.sharedFolderIconLabel,
29
+ className: styles.contentIconShared,
30
+ height: Space6,
31
+ width: Space6
32
+ });
33
+ }
34
+ return jsx(ContentIconContainer, {
35
+ children: jsx(Folder, {
36
+ "aria-label": messages.folderIconLabel,
37
+ height: Space4,
38
+ width: Space4
39
+ })
40
+ });
41
+ };
33
42
  const handleOnClickClearButton = ({
34
43
  ref,
35
44
  onClickClearButton
@@ -39,10 +48,12 @@ const handleOnClickClearButton = ({
39
48
  };
40
49
  const contentFieldButtonTestId = 'ContentField-button';
41
50
  const ContentField = ({
51
+ clearButtonAriaLabel,
52
+ itemIcon,
42
53
  hintText,
54
+ isSharedFolder,
43
55
  onClick,
44
56
  onClickClearButton,
45
- isSharedFolder,
46
57
  title,
47
58
  error
48
59
  }) => {
@@ -69,7 +80,8 @@ const ContentField = ({
69
80
  onClick: onClick,
70
81
  type: "button",
71
82
  children: [jsx(ContentIcon, {
72
- isSharedFolder: isSharedFolder
83
+ isSharedFolder: isSharedFolder,
84
+ itemIcon: itemIcon
73
85
  }), jsx("div", {
74
86
  className: styles.contentLabelWrapper,
75
87
  children: jsx("div", {
@@ -80,7 +92,7 @@ const ContentField = ({
80
92
  })]
81
93
  })
82
94
  }), title && jsx(Button, {
83
- "aria-label": messages.clearContentFieldButtonLabel,
95
+ "aria-label": clearButtonAriaLabel ?? messages.clearContentFieldButtonLabel,
84
96
  className: clsx(styles.clearButton, {
85
97
  [styles.hasSelection]: title,
86
98
  [styles.error]: !!error
@@ -1,4 +1,4 @@
1
1
  import '../index.css';
2
- var styles = {"contentFieldWrapper":"bp_content_field_module_contentFieldWrapper--557cc","contentField":"bp_content_field_module_contentField--557cc","inlineError":"bp_content_field_module_inlineError--557cc","contentButton":"bp_content_field_module_contentButton--557cc","error":"bp_content_field_module_error--557cc","hasSelection":"bp_content_field_module_hasSelection--557cc","contentIconContainer":"bp_content_field_module_contentIconContainer--557cc","contentIconShared":"bp_content_field_module_contentIconShared--557cc","contentLabelWrapper":"bp_content_field_module_contentLabelWrapper--557cc","contentLabel":"bp_content_field_module_contentLabel--557cc","clearButton":"bp_content_field_module_clearButton--557cc"};
2
+ var styles = {"contentFieldWrapper":"bp_content_field_module_contentFieldWrapper--7aebd","contentField":"bp_content_field_module_contentField--7aebd","inlineError":"bp_content_field_module_inlineError--7aebd","contentButton":"bp_content_field_module_contentButton--7aebd","error":"bp_content_field_module_error--7aebd","hasSelection":"bp_content_field_module_hasSelection--7aebd","contentIconContainer":"bp_content_field_module_contentIconContainer--7aebd","contentIconShared":"bp_content_field_module_contentIconShared--7aebd","contentLabelWrapper":"bp_content_field_module_contentLabelWrapper--7aebd","contentLabel":"bp_content_field_module_contentLabel--7aebd","clearButton":"bp_content_field_module_clearButton--7aebd"};
3
3
 
4
4
  export { styles as default };
@@ -1,6 +1,7 @@
1
1
  export declare const messages: {
2
2
  sharedFolderIconLabel: string;
3
3
  folderIconLabel: string;
4
+ fileIconLabel: string;
4
5
  clearContentFieldButtonLabel: string;
5
6
  clearContentFieldIconLabel: string;
6
7
  };
@@ -1,6 +1,7 @@
1
1
  const messages = {
2
2
  sharedFolderIconLabel: 'Shared Folder Icon',
3
3
  folderIconLabel: 'Folder Icon',
4
+ fileIconLabel: 'File Icon',
4
5
  clearContentFieldButtonLabel: 'Clear Content Field',
5
6
  clearContentFieldIconLabel: 'Clear Content Field icon'
6
7
  };
@@ -1,9 +1,17 @@
1
- /// <reference types="react" />
1
+ import type React from 'react';
2
2
  export interface ContentFieldProps {
3
+ /**
4
+ * custom aria label for the content field clear button.
5
+ */
6
+ clearButtonAriaLabel?: string;
3
7
  /**
4
8
  * placeholder text for the content field.
5
9
  */
6
10
  hintText: string;
11
+ /**
12
+ * type of the selected content(document, folder, etc.)
13
+ */
14
+ itemIcon?: React.JSX.Element;
7
15
  /**
8
16
  * whether or not the selected content is a shared folder.
9
17
  */
package/lib-esm/index.css CHANGED
@@ -2886,11 +2886,11 @@
2886
2886
  .bp_content_card_module_pillGhost--6db10{
2887
2887
  margin-inline-end:var(--size-2);
2888
2888
  }
2889
- .bp_content_field_module_contentFieldWrapper--557cc{
2889
+ .bp_content_field_module_contentFieldWrapper--7aebd{
2890
2890
  width:100%;
2891
2891
  }
2892
2892
 
2893
- .bp_content_field_module_contentField--557cc{
2893
+ .bp_content_field_module_contentField--7aebd{
2894
2894
  border-radius:var(--radius-2);
2895
2895
  box-shadow:var(--dropshadow-2);
2896
2896
  display:flex;
@@ -2898,11 +2898,11 @@
2898
2898
  justify-content:space-between;
2899
2899
  }
2900
2900
 
2901
- .bp_content_field_module_inlineError--557cc{
2901
+ .bp_content_field_module_inlineError--7aebd{
2902
2902
  margin-block-start:var(--space-2);
2903
2903
  }
2904
2904
 
2905
- .bp_content_field_module_contentButton--557cc{
2905
+ .bp_content_field_module_contentButton--7aebd{
2906
2906
  all:unset;
2907
2907
  align-items:center;
2908
2908
  background:var(--surface-cta-surface-secondary);
@@ -2916,11 +2916,11 @@
2916
2916
  min-width:0;
2917
2917
  padding:var(--border-1) var(--space-3);
2918
2918
  }
2919
- .bp_content_field_module_contentButton--557cc.bp_content_field_module_error--557cc{
2919
+ .bp_content_field_module_contentButton--7aebd.bp_content_field_module_error--7aebd{
2920
2920
  border:var(--border-2) solid var(--border-dropdown-border-error);
2921
2921
  position:relative;
2922
2922
  }
2923
- .bp_content_field_module_contentButton--557cc.bp_content_field_module_error--557cc.bp_content_field_module_hasSelection--557cc:hover::after{
2923
+ .bp_content_field_module_contentButton--7aebd.bp_content_field_module_error--7aebd.bp_content_field_module_hasSelection--7aebd:hover::after{
2924
2924
  background-color:var(--border-cta-border-secondary);
2925
2925
  content:"";
2926
2926
  height:100%;
@@ -2929,53 +2929,54 @@
2929
2929
  top:0;
2930
2930
  width:1px;
2931
2931
  }
2932
- .bp_content_field_module_contentButton--557cc.bp_content_field_module_hasSelection--557cc{
2932
+ .bp_content_field_module_contentButton--7aebd.bp_content_field_module_hasSelection--7aebd{
2933
2933
  border-radius:var(--radius-2) 0 0 var(--radius-2);
2934
2934
  border-right:none;
2935
2935
  }
2936
- .bp_content_field_module_contentButton--557cc:hover{
2936
+ .bp_content_field_module_contentButton--7aebd:hover{
2937
2937
  background:var(--surface-cta-surface-secondary-hover);
2938
2938
  }
2939
- .bp_content_field_module_contentButton--557cc:not(.bp_content_field_module_error--557cc):hover{
2939
+ .bp_content_field_module_contentButton--7aebd:not(.bp_content_field_module_error--7aebd):hover{
2940
2940
  border:var(--border-1) solid var(--border-cta-border-secondary-hover);
2941
2941
  }
2942
- .bp_content_field_module_contentButton--557cc:focus-visible{
2942
+ .bp_content_field_module_contentButton--7aebd:focus-visible{
2943
2943
  background:var(--surface-cta-surface-secondary-hover);
2944
2944
  border:var(--border-2) solid var(--outline-focus-on-light);
2945
2945
  }
2946
- .bp_content_field_module_contentButton--557cc:focus-visible:not(.bp_content_field_module_error--557cc){
2946
+ .bp_content_field_module_contentButton--7aebd:focus-visible:not(.bp_content_field_module_error--7aebd){
2947
2947
  padding:calc(var(--border-1) - var(--border-1)) calc(var(--space-3) - var(--border-1));
2948
2948
  }
2949
2949
 
2950
- .bp_content_field_module_contentIconContainer--557cc{
2950
+ .bp_content_field_module_contentIconContainer--7aebd{
2951
2951
  align-items:center;
2952
2952
  background:var(--surface-cta-surface-icon-utility);
2953
2953
  border-radius:50%;
2954
2954
  display:flex;
2955
2955
  height:var(--space-6);
2956
2956
  justify-content:center;
2957
+ min-width:var(--space-6);
2957
2958
  width:var(--space-6);
2958
2959
  }
2959
2960
 
2960
- .bp_content_field_module_contentIconShared--557cc{
2961
+ .bp_content_field_module_contentIconShared--7aebd{
2961
2962
  min-height:var(--space-6);
2962
2963
  min-width:var(--space-6);
2963
2964
  }
2964
2965
 
2965
- .bp_content_field_module_contentLabelWrapper--557cc{
2966
+ .bp_content_field_module_contentLabelWrapper--7aebd{
2966
2967
  align-items:center;
2967
2968
  display:flex;
2968
2969
  flex-grow:1;
2969
2970
  min-width:0;
2970
2971
  }
2971
2972
 
2972
- .bp_content_field_module_contentLabel--557cc{
2973
+ .bp_content_field_module_contentLabel--7aebd{
2973
2974
  overflow:hidden;
2974
2975
  text-overflow:ellipsis;
2975
2976
  white-space:nowrap;
2976
2977
  }
2977
2978
 
2978
- .bp_content_field_module_clearButton--557cc{
2979
+ .bp_content_field_module_clearButton--7aebd{
2979
2980
  all:unset;
2980
2981
  align-items:center;
2981
2982
  background:var(--surface-cta-surface-secondary);
@@ -2986,18 +2987,18 @@
2986
2987
  display:flex;
2987
2988
  padding:var(--border-1) var(--space-2);
2988
2989
  }
2989
- .bp_content_field_module_clearButton--557cc:hover{
2990
+ .bp_content_field_module_clearButton--7aebd:hover{
2990
2991
  background:var(--surface-cta-surface-secondary-hover);
2991
2992
  }
2992
- .bp_content_field_module_clearButton--557cc:not(.bp_content_field_module_error--557cc):hover{
2993
+ .bp_content_field_module_clearButton--7aebd:not(.bp_content_field_module_error--7aebd):hover{
2993
2994
  border:var(--border-1) solid var(--border-cta-border-secondary-hover);
2994
2995
  }
2995
- .bp_content_field_module_clearButton--557cc.bp_content_field_module_error--557cc{
2996
+ .bp_content_field_module_clearButton--7aebd.bp_content_field_module_error--7aebd{
2996
2997
  border:var(--border-2) solid var(--border-dropdown-border-error);
2997
2998
  border-left:none;
2998
2999
  position:relative;
2999
3000
  }
3000
- .bp_content_field_module_clearButton--557cc.bp_content_field_module_error--557cc.bp_content_field_module_hasSelection--557cc:hover::after{
3001
+ .bp_content_field_module_clearButton--7aebd.bp_content_field_module_error--7aebd.bp_content_field_module_hasSelection--7aebd:hover::after{
3001
3002
  background-color:var(--border-cta-border-secondary);
3002
3003
  content:"";
3003
3004
  height:100%;
@@ -3006,11 +3007,11 @@
3006
3007
  top:0;
3007
3008
  width:1px;
3008
3009
  }
3009
- .bp_content_field_module_clearButton--557cc:focus-visible{
3010
+ .bp_content_field_module_clearButton--7aebd:focus-visible{
3010
3011
  background:var(--surface-cta-surface-secondary-hover);
3011
3012
  border:var(--border-2) solid var(--outline-focus-on-light);
3012
3013
  }
3013
- .bp_content_field_module_clearButton--557cc:focus-visible:not(.bp_content_field_module_error--557cc){
3014
+ .bp_content_field_module_clearButton--7aebd:focus-visible:not(.bp_content_field_module_error--7aebd){
3014
3015
  padding:calc(var(--border-1) - var(--border-1)) calc(var(--space-2) - var(--border-1));
3015
3016
  }
3016
3017
  .bp_scrollable_container_module_scrollableContainer--074ff{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "6.36.5",
3
+ "version": "6.37.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -57,7 +57,7 @@
57
57
  "devDependencies": {
58
58
  "@box/storybook-utils": "^0.0.7"
59
59
  },
60
- "gitHead": "d49b33cb093048a4b79735034f8e18aa4f6ee49f",
60
+ "gitHead": "52ded26055e4ace8f1f535193b75fce44d34a21b",
61
61
  "module": "lib-esm/index.js",
62
62
  "main": "lib-esm/index.js",
63
63
  "exports": {