@box/blueprint-web 6.33.1 → 6.34.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,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 }: ContentFieldProps) => JSX.Element;
4
+ export declare const ContentField: ({ hintText, onClick, onClickClearButton, isSharedFolder, title, error, }: ContentFieldProps) => JSX.Element;
@@ -8,6 +8,7 @@ import { createRef } from 'react';
8
8
  import { useFullTextTooltip } from '../utils/useFullTextTooltip.js';
9
9
  import styles from './content-field.module.js';
10
10
  import { messages } from './messages.js';
11
+ import { InlineError } from '../primitives/inline-error/inline-error.js';
11
12
 
12
13
  const ContentIconContainer = ({
13
14
  children
@@ -42,7 +43,8 @@ const ContentField = ({
42
43
  onClick,
43
44
  onClickClearButton,
44
45
  isSharedFolder,
45
- title
46
+ title,
47
+ error
46
48
  }) => {
47
49
  const ref = /*#__PURE__*/createRef();
48
50
  const {
@@ -54,39 +56,49 @@ const ContentField = ({
54
56
  });
55
57
  return jsxs("div", {
56
58
  className: styles.contentFieldWrapper,
57
- children: [jsx(Tooltip, {
58
- ...wrapperProps,
59
- children: jsxs(Button, {
60
- className: clsx(styles.contentButton, {
61
- [styles.hasSelection]: title
59
+ children: [jsxs("div", {
60
+ className: styles.contentField,
61
+ children: [jsx(Tooltip, {
62
+ ...wrapperProps,
63
+ children: jsxs(Button, {
64
+ className: clsx(styles.contentButton, {
65
+ [styles.hasSelection]: title,
66
+ [styles.error]: !!error
67
+ }),
68
+ "data-testid": contentFieldButtonTestId,
69
+ onClick: onClick,
70
+ type: "button",
71
+ children: [jsx(ContentIcon, {
72
+ isSharedFolder: isSharedFolder
73
+ }), jsx("div", {
74
+ className: styles.contentLabelWrapper,
75
+ children: jsx("div", {
76
+ ref: ref,
77
+ className: styles.contentLabel,
78
+ children: title ?? hintText
79
+ })
80
+ })]
81
+ })
82
+ }), title && jsx(Button, {
83
+ "aria-label": messages.clearContentFieldButtonLabel,
84
+ className: clsx(styles.clearButton, {
85
+ [styles.hasSelection]: title,
86
+ [styles.error]: !!error
87
+ }),
88
+ onClick: handleOnClickClearButton({
89
+ ref,
90
+ onClickClearButton
62
91
  }),
63
- "data-testid": contentFieldButtonTestId,
64
- onClick: onClick,
65
92
  type: "button",
66
- children: [jsx(ContentIcon, {
67
- isSharedFolder: isSharedFolder
68
- }), jsx("div", {
69
- className: styles.contentLabelWrapper,
70
- children: jsx("div", {
71
- ref: ref,
72
- className: styles.contentLabel,
73
- children: title ?? hintText
74
- })
75
- })]
76
- })
77
- }), title && jsx(Button, {
78
- "aria-label": messages.clearContentFieldButtonLabel,
79
- className: styles.clearButton,
80
- onClick: handleOnClickClearButton({
81
- ref,
82
- onClickClearButton
83
- }),
84
- type: "button",
85
- children: jsx(XMark, {
86
- "aria-label": messages.clearContentFieldIconLabel,
87
- height: Space6,
88
- width: Space6
89
- })
93
+ children: jsx(XMark, {
94
+ "aria-label": messages.clearContentFieldIconLabel,
95
+ height: Space6,
96
+ width: Space6
97
+ })
98
+ })]
99
+ }), jsx(InlineError, {
100
+ className: styles.inlineError,
101
+ children: error
90
102
  })]
91
103
  });
92
104
  };
@@ -1,4 +1,4 @@
1
1
  import '../index.css';
2
- var styles = {"contentFieldWrapper":"bp_content_field_module_contentFieldWrapper--d616b","contentButton":"bp_content_field_module_contentButton--d616b","hasSelection":"bp_content_field_module_hasSelection--d616b","contentIconContainer":"bp_content_field_module_contentIconContainer--d616b","contentIconShared":"bp_content_field_module_contentIconShared--d616b","contentLabelWrapper":"bp_content_field_module_contentLabelWrapper--d616b","contentLabel":"bp_content_field_module_contentLabel--d616b","clearButton":"bp_content_field_module_clearButton--d616b"};
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"};
3
3
 
4
4
  export { styles as default };
@@ -20,4 +20,8 @@ export interface ContentFieldProps {
20
20
  * title of the selected content selected content
21
21
  */
22
22
  title?: string;
23
+ /**
24
+ * The content of the error message
25
+ */
26
+ error?: React.ReactNode;
23
27
  }
package/lib-esm/index.css CHANGED
@@ -2886,15 +2886,23 @@
2886
2886
  .bp_content_card_module_pillGhost--7794a{
2887
2887
  margin-inline-end:var(--size-2);
2888
2888
  }
2889
- .bp_content_field_module_contentFieldWrapper--d616b{
2889
+ .bp_content_field_module_contentFieldWrapper--557cc{
2890
+ width:100%;
2891
+ }
2892
+
2893
+ .bp_content_field_module_contentField--557cc{
2890
2894
  border-radius:var(--radius-2);
2891
2895
  box-shadow:var(--dropshadow-2);
2892
2896
  display:flex;
2897
+ flex-direction:row;
2893
2898
  justify-content:space-between;
2894
- width:100%;
2895
2899
  }
2896
2900
 
2897
- .bp_content_field_module_contentButton--d616b{
2901
+ .bp_content_field_module_inlineError--557cc{
2902
+ margin-block-start:var(--space-2);
2903
+ }
2904
+
2905
+ .bp_content_field_module_contentButton--557cc{
2898
2906
  all:unset;
2899
2907
  align-items:center;
2900
2908
  background:var(--surface-cta-surface-secondary);
@@ -2908,21 +2916,38 @@
2908
2916
  min-width:0;
2909
2917
  padding:var(--border-1) var(--space-3);
2910
2918
  }
2911
- .bp_content_field_module_contentButton--d616b.bp_content_field_module_hasSelection--d616b{
2919
+ .bp_content_field_module_contentButton--557cc.bp_content_field_module_error--557cc{
2920
+ border:var(--border-2) solid var(--border-dropdown-border-error);
2921
+ position:relative;
2922
+ }
2923
+ .bp_content_field_module_contentButton--557cc.bp_content_field_module_error--557cc.bp_content_field_module_hasSelection--557cc:hover::after{
2924
+ background-color:var(--border-cta-border-secondary);
2925
+ content:"";
2926
+ height:100%;
2927
+ position:absolute;
2928
+ right:0;
2929
+ top:0;
2930
+ width:1px;
2931
+ }
2932
+ .bp_content_field_module_contentButton--557cc.bp_content_field_module_hasSelection--557cc{
2912
2933
  border-radius:var(--radius-2) 0 0 var(--radius-2);
2913
2934
  border-right:none;
2914
2935
  }
2915
- .bp_content_field_module_contentButton--d616b:hover{
2936
+ .bp_content_field_module_contentButton--557cc:hover{
2916
2937
  background:var(--surface-cta-surface-secondary-hover);
2938
+ }
2939
+ .bp_content_field_module_contentButton--557cc:not(.bp_content_field_module_error--557cc):hover{
2917
2940
  border:var(--border-1) solid var(--border-cta-border-secondary-hover);
2918
2941
  }
2919
- .bp_content_field_module_contentButton--d616b:focus-visible{
2942
+ .bp_content_field_module_contentButton--557cc:focus-visible{
2920
2943
  background:var(--surface-cta-surface-secondary-hover);
2921
2944
  border:var(--border-2) solid var(--outline-focus-on-light);
2945
+ }
2946
+ .bp_content_field_module_contentButton--557cc:focus-visible:not(.bp_content_field_module_error--557cc){
2922
2947
  padding:calc(var(--border-1) - var(--border-1)) calc(var(--space-3) - var(--border-1));
2923
2948
  }
2924
2949
 
2925
- .bp_content_field_module_contentIconContainer--d616b{
2950
+ .bp_content_field_module_contentIconContainer--557cc{
2926
2951
  align-items:center;
2927
2952
  background:var(--surface-cta-surface-icon-utility);
2928
2953
  border-radius:50%;
@@ -2932,25 +2957,25 @@
2932
2957
  width:var(--space-6);
2933
2958
  }
2934
2959
 
2935
- .bp_content_field_module_contentIconShared--d616b{
2960
+ .bp_content_field_module_contentIconShared--557cc{
2936
2961
  min-height:var(--space-6);
2937
2962
  min-width:var(--space-6);
2938
2963
  }
2939
2964
 
2940
- .bp_content_field_module_contentLabelWrapper--d616b{
2965
+ .bp_content_field_module_contentLabelWrapper--557cc{
2941
2966
  align-items:center;
2942
2967
  display:flex;
2943
2968
  flex-grow:1;
2944
2969
  min-width:0;
2945
2970
  }
2946
2971
 
2947
- .bp_content_field_module_contentLabel--d616b{
2972
+ .bp_content_field_module_contentLabel--557cc{
2948
2973
  overflow:hidden;
2949
2974
  text-overflow:ellipsis;
2950
2975
  white-space:nowrap;
2951
2976
  }
2952
2977
 
2953
- .bp_content_field_module_clearButton--d616b{
2978
+ .bp_content_field_module_clearButton--557cc{
2954
2979
  all:unset;
2955
2980
  align-items:center;
2956
2981
  background:var(--surface-cta-surface-secondary);
@@ -2961,13 +2986,31 @@
2961
2986
  display:flex;
2962
2987
  padding:var(--border-1) var(--space-2);
2963
2988
  }
2964
- .bp_content_field_module_clearButton--d616b:hover{
2989
+ .bp_content_field_module_clearButton--557cc:hover{
2965
2990
  background:var(--surface-cta-surface-secondary-hover);
2991
+ }
2992
+ .bp_content_field_module_clearButton--557cc:not(.bp_content_field_module_error--557cc):hover{
2966
2993
  border:var(--border-1) solid var(--border-cta-border-secondary-hover);
2967
2994
  }
2968
- .bp_content_field_module_clearButton--d616b:focus-visible{
2995
+ .bp_content_field_module_clearButton--557cc.bp_content_field_module_error--557cc{
2996
+ border:var(--border-2) solid var(--border-dropdown-border-error);
2997
+ border-left:none;
2998
+ position:relative;
2999
+ }
3000
+ .bp_content_field_module_clearButton--557cc.bp_content_field_module_error--557cc.bp_content_field_module_hasSelection--557cc:hover::after{
3001
+ background-color:var(--border-cta-border-secondary);
3002
+ content:"";
3003
+ height:100%;
3004
+ left:-1px;
3005
+ position:absolute;
3006
+ top:0;
3007
+ width:1px;
3008
+ }
3009
+ .bp_content_field_module_clearButton--557cc:focus-visible{
2969
3010
  background:var(--surface-cta-surface-secondary-hover);
2970
3011
  border:var(--border-2) solid var(--outline-focus-on-light);
3012
+ }
3013
+ .bp_content_field_module_clearButton--557cc:focus-visible:not(.bp_content_field_module_error--557cc){
2971
3014
  padding:calc(var(--border-1) - var(--border-1)) calc(var(--space-2) - var(--border-1));
2972
3015
  }
2973
3016
  .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.33.1",
3
+ "version": "6.34.0",
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": "e6204fec0c0aa02d916e994e704b330b7629a13b",
60
+ "gitHead": "da9fd4c4deb54df54f51c390869ac86c721cd94f",
61
61
  "module": "lib-esm/index.js",
62
62
  "main": "lib-esm/index.js",
63
63
  "exports": {