@box/blueprint-web 8.7.1 → 8.8.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/lib-esm/index.css +134 -21
- package/lib-esm/primitives/select-menu-grid/index.d.ts +2 -1
- package/lib-esm/primitives/select-menu-grid/index.js +2 -1
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.d.ts +27 -0
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.js +63 -12
- package/lib-esm/primitives/select-menu-grid/select-menu-grid-option.module.js +1 -1
- package/lib-esm/primitives/select-menu-grid/types.d.ts +15 -1
- package/package.json +2 -2
package/lib-esm/index.css
CHANGED
|
@@ -4789,22 +4789,42 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
4789
4789
|
flex-direction:row;
|
|
4790
4790
|
}
|
|
4791
4791
|
|
|
4792
|
-
.
|
|
4792
|
+
.bp_select_menu_grid_option_module_buttonWrapper--3bd72.bp_select_menu_grid_option_module_withLabel--3bd72{
|
|
4793
|
+
flex:1 1 0;
|
|
4794
|
+
margin:var(--space-05) 0;
|
|
4795
|
+
}
|
|
4796
|
+
.bp_select_menu_grid_option_module_buttonWrapper--3bd72.bp_select_menu_grid_option_module_withLabel--default--3bd72{
|
|
4797
|
+
max-width:100%;
|
|
4798
|
+
}
|
|
4799
|
+
@media only screen and (width > 374px){
|
|
4800
|
+
.bp_select_menu_grid_option_module_buttonWrapper--3bd72.bp_select_menu_grid_option_module_withLabel--default--3bd72{
|
|
4801
|
+
margin:var(--space-05);
|
|
4802
|
+
max-width:calc(50% - var(--space-1));
|
|
4803
|
+
}
|
|
4804
|
+
.bp_select_menu_grid_option_module_buttonWrapper--3bd72.bp_select_menu_grid_option_module_withLabel--default--3bd72:first-child{
|
|
4805
|
+
margin-left:0;
|
|
4806
|
+
}
|
|
4807
|
+
.bp_select_menu_grid_option_module_buttonWrapper--3bd72.bp_select_menu_grid_option_module_withLabel--default--3bd72:last-child{
|
|
4808
|
+
margin-right:0;
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
|
|
4812
|
+
.bp_select_menu_grid_option_module_square--3bd72{
|
|
4793
4813
|
height:var(--size-8);
|
|
4794
4814
|
width:var(--size-8);
|
|
4795
4815
|
}
|
|
4796
|
-
.bp_select_menu_grid_option_module_square--
|
|
4816
|
+
.bp_select_menu_grid_option_module_square--3bd72,.bp_select_menu_grid_option_module_square--3bd72 .bp_select_menu_grid_option_module_outlineHost--3bd72{
|
|
4797
4817
|
align-items:center;
|
|
4798
4818
|
border-radius:var(--radius-3);
|
|
4799
4819
|
display:flex;
|
|
4800
4820
|
justify-content:center;
|
|
4801
4821
|
}
|
|
4802
|
-
.bp_select_menu_grid_option_module_square--
|
|
4822
|
+
.bp_select_menu_grid_option_module_square--3bd72 .bp_select_menu_grid_option_module_outlineHost--3bd72{
|
|
4803
4823
|
height:var(--size-7);
|
|
4804
4824
|
width:var(--size-7);
|
|
4805
4825
|
}
|
|
4806
4826
|
|
|
4807
|
-
.bp_select_menu_grid_option_module_circle--
|
|
4827
|
+
.bp_select_menu_grid_option_module_circle--3bd72{
|
|
4808
4828
|
align-items:center;
|
|
4809
4829
|
background-clip:content-box;
|
|
4810
4830
|
background-color:var(--gray-white);
|
|
@@ -4816,10 +4836,10 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
4816
4836
|
justify-content:center;
|
|
4817
4837
|
width:var(--size-8);
|
|
4818
4838
|
}
|
|
4819
|
-
.bp_select_menu_grid_option_module_circle--
|
|
4839
|
+
.bp_select_menu_grid_option_module_circle--3bd72.bp_select_menu_grid_option_module_loading--3bd72{
|
|
4820
4840
|
border-color:var(--gray-white);
|
|
4821
4841
|
}
|
|
4822
|
-
.bp_select_menu_grid_option_module_circle--
|
|
4842
|
+
.bp_select_menu_grid_option_module_circle--3bd72 .bp_select_menu_grid_option_module_color--3bd72{
|
|
4823
4843
|
background-color:var(--circleColor);
|
|
4824
4844
|
border:var(--border-1) solid var(--circleBorderColor);
|
|
4825
4845
|
border-radius:50%;
|
|
@@ -4827,10 +4847,10 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
4827
4847
|
height:var(--size-6);
|
|
4828
4848
|
width:var(--size-6);
|
|
4829
4849
|
}
|
|
4830
|
-
.bp_select_menu_grid_option_module_circle--
|
|
4850
|
+
.bp_select_menu_grid_option_module_circle--3bd72 .bp_select_menu_grid_option_module_strikeThrough--3bd72{
|
|
4831
4851
|
position:relative;
|
|
4832
4852
|
}
|
|
4833
|
-
.bp_select_menu_grid_option_module_circle--
|
|
4853
|
+
.bp_select_menu_grid_option_module_circle--3bd72 .bp_select_menu_grid_option_module_strikeThrough--3bd72::after{
|
|
4834
4854
|
background-color:var(--watermelon-red-100);
|
|
4835
4855
|
border-radius:var(--radius-1);
|
|
4836
4856
|
content:"";
|
|
@@ -4842,46 +4862,139 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
|
|
|
4842
4862
|
width:90%;
|
|
4843
4863
|
}
|
|
4844
4864
|
|
|
4845
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4865
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72{
|
|
4846
4866
|
align-items:center;
|
|
4847
4867
|
background-color:initial;
|
|
4848
4868
|
border:none;
|
|
4849
4869
|
cursor:pointer;
|
|
4850
4870
|
display:flex;
|
|
4851
|
-
height:var(--size-8);
|
|
4852
|
-
justify-content:center;
|
|
4853
4871
|
outline:0;
|
|
4854
|
-
padding:0;
|
|
4855
4872
|
-webkit-user-select:none;
|
|
4856
4873
|
user-select:none;
|
|
4874
|
+
}
|
|
4875
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72:not(.bp_select_menu_grid_option_module_labeled--3bd72){
|
|
4876
|
+
height:var(--size-8);
|
|
4877
|
+
justify-content:center;
|
|
4878
|
+
padding:0;
|
|
4857
4879
|
width:var(--size-8);
|
|
4858
4880
|
}
|
|
4859
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4881
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72{
|
|
4882
|
+
border-radius:var(--radius-3);
|
|
4883
|
+
gap:var(--space-3);
|
|
4884
|
+
min-width:10rem;
|
|
4885
|
+
padding:var(--space-1);
|
|
4886
|
+
transition:background-color var(--animation-duration-2);
|
|
4887
|
+
width:100%;
|
|
4888
|
+
}
|
|
4889
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_text--3bd72{
|
|
4890
|
+
max-height:var(--size-8);
|
|
4891
|
+
text-align:left;
|
|
4892
|
+
}
|
|
4893
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_text--large--3bd72{
|
|
4894
|
+
-webkit-box-orient:vertical;
|
|
4895
|
+
-webkit-line-clamp:1;
|
|
4896
|
+
display:-webkit-box;
|
|
4897
|
+
overflow:hidden;
|
|
4898
|
+
}
|
|
4899
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_text--default--3bd72{
|
|
4900
|
+
-webkit-box-orient:vertical;
|
|
4901
|
+
-webkit-line-clamp:2;
|
|
4902
|
+
display:-webkit-box;
|
|
4903
|
+
overflow:hidden;
|
|
4904
|
+
}
|
|
4905
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--3bd72{
|
|
4906
|
+
align-items:center;
|
|
4907
|
+
background:var(--icon-background);
|
|
4908
|
+
border-radius:var(--radius-3);
|
|
4909
|
+
display:flex;
|
|
4910
|
+
flex-shrink:0;
|
|
4911
|
+
justify-content:center;
|
|
4912
|
+
}
|
|
4913
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--size-default--3bd72{
|
|
4914
|
+
height:var(--size-8);
|
|
4915
|
+
width:var(--size-8);
|
|
4916
|
+
}
|
|
4917
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--size-large--3bd72{
|
|
4918
|
+
height:var(--size-10);
|
|
4919
|
+
width:var(--size-10);
|
|
4920
|
+
}
|
|
4921
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--default--3bd72{
|
|
4922
|
+
--icon-background:var(--surface-surface-tertiary);
|
|
4923
|
+
--icon-background-dark:var(--surface-surface-quaternary);
|
|
4924
|
+
}
|
|
4925
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--box--3bd72{
|
|
4926
|
+
--icon-background:var(--brand-box-tertiary);
|
|
4927
|
+
--icon-background-dark:var(--brand-box-secondary);
|
|
4928
|
+
}
|
|
4929
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--docgen--3bd72{
|
|
4930
|
+
--icon-background:var(--brand-docgen-tertiary);
|
|
4931
|
+
--icon-background-dark:var(--brand-docgen-secondary);
|
|
4932
|
+
}
|
|
4933
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--forms--3bd72{
|
|
4934
|
+
--icon-background:var(--brand-forms-tertiary);
|
|
4935
|
+
--icon-background-dark:var(--brand-forms-secondary);
|
|
4936
|
+
}
|
|
4937
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72 .bp_select_menu_grid_option_module_iconContainer--sign--3bd72{
|
|
4938
|
+
--icon-background:var(--brand-sign-tertiary);
|
|
4939
|
+
--icon-background-dark:var(--brand-sign-secondary);
|
|
4940
|
+
}
|
|
4941
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72:hover{
|
|
4942
|
+
background:var(--surface-surface-secondary);
|
|
4943
|
+
box-shadow:var(--dropshadow-2);
|
|
4944
|
+
cursor:grab;
|
|
4945
|
+
}
|
|
4946
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_active--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_dragging--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72:active{
|
|
4947
|
+
background:var(--surface-surface-secondary);
|
|
4948
|
+
box-shadow:var(--dropshadow-2);
|
|
4949
|
+
}
|
|
4950
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_active--3bd72 .bp_select_menu_grid_option_module_iconContainer--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72:active .bp_select_menu_grid_option_module_iconContainer--3bd72{
|
|
4951
|
+
background-color:var(--icon-background);
|
|
4952
|
+
}
|
|
4953
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_dragging--3bd72{
|
|
4954
|
+
box-shadow:0 0 0 var(--border-1) var(--border-divider-border), var(--dropshadow-2);
|
|
4955
|
+
}
|
|
4956
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_dragging--3bd72 .bp_select_menu_grid_option_module_iconContainer--3bd72{
|
|
4957
|
+
background-color:var(--icon-background-dark);
|
|
4958
|
+
}
|
|
4959
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72.bp_select_menu_grid_option_module_dragging--3bd72:hover{
|
|
4960
|
+
cursor:grabbing;
|
|
4961
|
+
}
|
|
4962
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72:hover:not(.bp_select_menu_grid_option_module_disabled--3bd72) .bp_select_menu_grid_option_module_iconContainer--3bd72{
|
|
4963
|
+
background-color:var(--icon-background-dark);
|
|
4964
|
+
transition:background-color var(--animation-duration-2);
|
|
4965
|
+
}
|
|
4966
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72[data-focus-visible]{
|
|
4967
|
+
box-shadow:0 0 0 var(--border-2) var(--outline-focus-on-light);
|
|
4968
|
+
}
|
|
4969
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_labeled--3bd72[data-focus-visible]:active{
|
|
4970
|
+
background:var(--surface-surface-secondary);
|
|
4971
|
+
}
|
|
4972
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72:hover .bp_select_menu_grid_option_module_square--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible] .bp_select_menu_grid_option_module_square--3bd72{
|
|
4860
4973
|
background-color:var(--surface-cta-surface-outline-hover);
|
|
4861
4974
|
}
|
|
4862
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4975
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72:hover .bp_select_menu_grid_option_module_circle--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible] .bp_select_menu_grid_option_module_circle--3bd72{
|
|
4863
4976
|
background-color:var(--surface-option-grid-surface-hover);
|
|
4864
4977
|
}
|
|
4865
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4978
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_active--3bd72 .bp_select_menu_grid_option_module_square--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72:active .bp_select_menu_grid_option_module_square--3bd72{
|
|
4866
4979
|
background-color:var(--surface-cta-surface-outline-pressed);
|
|
4867
4980
|
}
|
|
4868
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4981
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_active--3bd72 .bp_select_menu_grid_option_module_circle--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72:active .bp_select_menu_grid_option_module_circle--3bd72{
|
|
4869
4982
|
border:var(--border-2) solid var(--circleColor);
|
|
4870
4983
|
}
|
|
4871
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4984
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72.bp_select_menu_grid_option_module_loading--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72:disabled{
|
|
4872
4985
|
cursor:default;
|
|
4873
4986
|
}
|
|
4874
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4987
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible] .bp_select_menu_grid_option_module_outlineHost--3bd72{
|
|
4875
4988
|
box-shadow:0 0 0 var(--border-2) var(--outline-focus-on-light);
|
|
4876
4989
|
}
|
|
4877
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4990
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible] .bp_select_menu_grid_option_module_circle--3bd72{
|
|
4878
4991
|
border-color:var(--surface-option-grid-surface-hover);
|
|
4879
4992
|
}
|
|
4880
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4993
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible].bp_select_menu_grid_option_module_active--3bd72 .bp_select_menu_grid_option_module_circle--3bd72,.bp_select_menu_grid_option_module_optionButton--3bd72[data-focus-visible]:active .bp_select_menu_grid_option_module_circle--3bd72{
|
|
4881
4994
|
border:var(--border-2) solid var(--circleColor);
|
|
4882
4995
|
box-shadow:0 0 0 var(--border-1) var(--gray-white), 0 0 0 var(--border-3) var(--outline-focus-on-light);
|
|
4883
4996
|
}
|
|
4884
|
-
.bp_select_menu_grid_option_module_optionButton--
|
|
4997
|
+
.bp_select_menu_grid_option_module_optionButton--3bd72:disabled:not(.bp_select_menu_grid_option_module_loading--3bd72){
|
|
4885
4998
|
opacity:.3;
|
|
4886
4999
|
}
|
|
4887
5000
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SelectMenuGrid } from './select-menu-grid';
|
|
2
|
-
import { SelectMenuGridColorCircle, SelectMenuGridOption, SelectMenuGridSquare } from './select-menu-grid-option';
|
|
2
|
+
import { SelectMenuGridColorCircle, SelectMenuGridOption, SelectMenuGridSquare, SelectMenuGridWithLabel } from './select-menu-grid-option';
|
|
3
3
|
export { type SelectMenuGridProps, type SelectMenuOptionProps } from './types';
|
|
4
4
|
type SelectMenuOption = typeof SelectMenuGridOption & {
|
|
5
5
|
Square: typeof SelectMenuGridSquare;
|
|
6
6
|
ColorCircle: typeof SelectMenuGridColorCircle;
|
|
7
|
+
WithLabel: typeof SelectMenuGridWithLabel;
|
|
7
8
|
};
|
|
8
9
|
interface SelectMenuType {
|
|
9
10
|
Option: SelectMenuOption;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectMenuGrid } from './select-menu-grid.js';
|
|
2
|
-
import { SelectMenuGridSquare, SelectMenuGridColorCircle, SelectMenuGridOption } from './select-menu-grid-option.js';
|
|
2
|
+
import { SelectMenuGridSquare, SelectMenuGridColorCircle, SelectMenuGridWithLabel, SelectMenuGridOption } from './select-menu-grid-option.js';
|
|
3
3
|
|
|
4
4
|
const SelectMenu = {
|
|
5
5
|
Option: SelectMenuGridOption,
|
|
@@ -7,5 +7,6 @@ const SelectMenu = {
|
|
|
7
7
|
};
|
|
8
8
|
SelectMenu.Option.Square = SelectMenuGridSquare;
|
|
9
9
|
SelectMenu.Option.ColorCircle = SelectMenuGridColorCircle;
|
|
10
|
+
SelectMenu.Option.WithLabel = SelectMenuGridWithLabel;
|
|
10
11
|
|
|
11
12
|
export { SelectMenu };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SelectMenuGridWithLabelProps } from './types';
|
|
1
2
|
export declare const SelectMenuGridSquare: import("react").ForwardRefExoticComponent<(Omit<{
|
|
2
3
|
'aria-label': string;
|
|
3
4
|
tooltipSide?: "top" | "bottom" | "left" | "right";
|
|
@@ -40,6 +41,17 @@ export declare const SelectMenuGridColorCircle: import("react").ForwardRefExotic
|
|
|
40
41
|
} & {
|
|
41
42
|
color: string;
|
|
42
43
|
}, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
export declare const SelectMenuGridWithLabel: import("react").ForwardRefExoticComponent<(Omit<Omit<import("./types").CommonOptionProps, "draggable" | "aria-label" | "tooltipSide"> & {
|
|
45
|
+
size: "default" | "large";
|
|
46
|
+
colorVariant: "default" | "box" | "forms" | "docgen" | "sign";
|
|
47
|
+
icon: import("react").FunctionComponent<import("react").PropsWithChildren<import("react").SVGProps<SVGSVGElement>>>;
|
|
48
|
+
label: string;
|
|
49
|
+
} & Required<Pick<import("./types").Dragging, keyof import("./types").Dragging>> & Omit<import("./types").Dragging, keyof import("./types").Dragging>, "ref"> | Omit<Omit<import("./types").CommonOptionProps, "draggable" | "aria-label" | "tooltipSide"> & {
|
|
50
|
+
size: "default" | "large";
|
|
51
|
+
colorVariant: "default" | "box" | "forms" | "docgen" | "sign";
|
|
52
|
+
icon: import("react").FunctionComponent<import("react").PropsWithChildren<import("react").SVGProps<SVGSVGElement>>>;
|
|
53
|
+
label: string;
|
|
54
|
+
} & Partial<Record<keyof import("./types").Dragging, never>> & Omit<import("./types").Dragging, keyof import("./types").Dragging>, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
43
55
|
export declare const SelectMenuGridOption: import("react").ForwardRefExoticComponent<(Omit<Partial<{
|
|
44
56
|
'aria-label': string;
|
|
45
57
|
tooltipSide?: "top" | "bottom" | "left" | "right";
|
|
@@ -128,4 +140,19 @@ export declare const SelectMenuGridOption: import("react").ForwardRefExoticCompo
|
|
|
128
140
|
color: string;
|
|
129
141
|
}> & {
|
|
130
142
|
variant: "square" | "colorCircle";
|
|
143
|
+
}, "ref"> | Omit<Omit<import("./types").CommonOptionProps, "draggable" | "aria-label" | "tooltipSide"> & {
|
|
144
|
+
size: "default" | "large";
|
|
145
|
+
colorVariant: "default" | "box" | "forms" | "docgen" | "sign";
|
|
146
|
+
icon: import("react").FunctionComponent<import("react").PropsWithChildren<import("react").SVGProps<SVGSVGElement>>>;
|
|
147
|
+
label: string;
|
|
148
|
+
} & Required<Pick<import("./types").Dragging, keyof import("./types").Dragging>> & Omit<import("./types").Dragging, keyof import("./types").Dragging> & {
|
|
149
|
+
variant: "labeled";
|
|
150
|
+
}, "ref"> | Omit<Omit<import("./types").CommonOptionProps, "draggable" | "aria-label" | "tooltipSide"> & {
|
|
151
|
+
size: "default" | "large";
|
|
152
|
+
colorVariant: "default" | "box" | "forms" | "docgen" | "sign";
|
|
153
|
+
icon: import("react").FunctionComponent<import("react").PropsWithChildren<import("react").SVGProps<SVGSVGElement>>>;
|
|
154
|
+
label: string;
|
|
155
|
+
} & Partial<Record<keyof import("./types").Dragging, never>> & Omit<import("./types").Dragging, keyof import("./types").Dragging> & {
|
|
156
|
+
variant: "labeled";
|
|
131
157
|
}, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
158
|
+
export declare const ItemWithLabel: ({ size, colorVariant, label, icon, }: Pick<SelectMenuGridWithLabelProps, "label" | "size" | "colorVariant" | "icon">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { CompositeItem, Button } from '@ariakit/react';
|
|
3
|
-
import { Gray05 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
3
|
+
import { Gray05, Gray100, BoxBlue100, DarkBlue100, GreenLight100, Grimace100, Size4, Size6 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import Color from 'color';
|
|
6
|
-
import { forwardRef } from 'react';
|
|
6
|
+
import { forwardRef, createElement } from 'react';
|
|
7
|
+
import { Text } from '../../text/text.js';
|
|
7
8
|
import { Ghost } from '../../ghost/ghost.js';
|
|
8
9
|
import { Tooltip } from '../../tooltip/tooltip.js';
|
|
9
10
|
import styles from './select-menu-grid-option.module.js';
|
|
10
11
|
|
|
11
|
-
const SelectMenuGridSquare = /*#__PURE__*/forwardRef((props,
|
|
12
|
+
const SelectMenuGridSquare = /*#__PURE__*/forwardRef((props, forwardedRef) => jsx(SelectMenuGridOption, {
|
|
12
13
|
...props,
|
|
14
|
+
ref: forwardedRef,
|
|
13
15
|
variant: "square"
|
|
14
16
|
}));
|
|
15
|
-
const SelectMenuGridColorCircle = /*#__PURE__*/forwardRef((props,
|
|
17
|
+
const SelectMenuGridColorCircle = /*#__PURE__*/forwardRef((props, forwardedRef) => jsx(SelectMenuGridOption, {
|
|
16
18
|
...props,
|
|
19
|
+
ref: forwardedRef,
|
|
17
20
|
variant: "colorCircle"
|
|
18
21
|
}));
|
|
22
|
+
const SelectMenuGridWithLabel = /*#__PURE__*/forwardRef((props, forwardedRef) => jsx(SelectMenuGridOption, {
|
|
23
|
+
...props,
|
|
24
|
+
ref: forwardedRef,
|
|
25
|
+
variant: "labeled"
|
|
26
|
+
}));
|
|
19
27
|
const SelectMenuGridOption = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
20
28
|
const {
|
|
21
29
|
active,
|
|
22
|
-
'aria-label': ariaLabel,
|
|
23
30
|
children,
|
|
24
31
|
className,
|
|
25
32
|
color,
|
|
@@ -27,12 +34,14 @@ const SelectMenuGridOption = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
27
34
|
loading,
|
|
28
35
|
loadingAriaLabel,
|
|
29
36
|
disabled,
|
|
30
|
-
tooltipSide = 'bottom',
|
|
31
37
|
...restProps
|
|
32
38
|
} = props;
|
|
39
|
+
const isWithLabel = variant === 'labeled';
|
|
33
40
|
const isButtonDisabled = disabled || loading;
|
|
34
41
|
const isButtonActive = !disabled && !loading && active;
|
|
35
|
-
const
|
|
42
|
+
const isButtonDragged = isWithLabel && !isButtonDisabled && props.draggable && props.dragging;
|
|
43
|
+
const shouldShowTooltip = !isButtonDisabled && !isWithLabel;
|
|
44
|
+
const ariaLabel = !isWithLabel ? props['aria-label'] : props.label;
|
|
36
45
|
// TODO: [DSYS-764] use IconButton instead of AriakitButton
|
|
37
46
|
const button = jsx(CompositeItem, {
|
|
38
47
|
render: jsxs(Button, {
|
|
@@ -40,8 +49,10 @@ const SelectMenuGridOption = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
40
49
|
ref: forwardedRef,
|
|
41
50
|
"aria-label": loading ? loadingAriaLabel : ariaLabel,
|
|
42
51
|
className: clsx(styles.optionButton, className, {
|
|
52
|
+
[styles.labeled]: isWithLabel,
|
|
43
53
|
[styles.loading]: loading,
|
|
44
|
-
[styles.active]: isButtonActive
|
|
54
|
+
[styles.active]: isButtonActive,
|
|
55
|
+
[styles.dragging]: isButtonDragged
|
|
45
56
|
}),
|
|
46
57
|
disabled: isButtonDisabled,
|
|
47
58
|
children: [variant === 'colorCircle' && jsx(ColorSwatch, {
|
|
@@ -50,16 +61,21 @@ const SelectMenuGridOption = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
50
61
|
}), variant === 'square' && jsx(Icon, {
|
|
51
62
|
loading: !!loading,
|
|
52
63
|
children: children
|
|
64
|
+
}), variant === 'labeled' && jsx(ItemWithLabel, {
|
|
65
|
+
...props
|
|
53
66
|
})]
|
|
54
67
|
})
|
|
55
68
|
});
|
|
56
69
|
return jsxs("div", {
|
|
57
|
-
className: styles.buttonWrapper,
|
|
70
|
+
className: clsx(styles.buttonWrapper, {
|
|
71
|
+
[styles.withLabel]: isWithLabel,
|
|
72
|
+
[styles['withLabel--default']]: isWithLabel && props.size === 'default'
|
|
73
|
+
}),
|
|
58
74
|
role: "gridcell",
|
|
59
75
|
children: [shouldShowTooltip && jsx(Tooltip, {
|
|
60
76
|
"aria-hidden": true,
|
|
61
77
|
content: ariaLabel,
|
|
62
|
-
side: tooltipSide,
|
|
78
|
+
side: props.tooltipSide,
|
|
63
79
|
children: button
|
|
64
80
|
}), !shouldShowTooltip && button]
|
|
65
81
|
});
|
|
@@ -103,5 +119,40 @@ const Icon = ({
|
|
|
103
119
|
})
|
|
104
120
|
});
|
|
105
121
|
};
|
|
122
|
+
const iconColor = {
|
|
123
|
+
default: Gray100,
|
|
124
|
+
box: BoxBlue100,
|
|
125
|
+
sign: DarkBlue100,
|
|
126
|
+
forms: GreenLight100,
|
|
127
|
+
docgen: Grimace100
|
|
128
|
+
};
|
|
129
|
+
const iconSize = {
|
|
130
|
+
default: Size4,
|
|
131
|
+
large: Size6
|
|
132
|
+
};
|
|
133
|
+
const ItemWithLabel = ({
|
|
134
|
+
size,
|
|
135
|
+
colorVariant,
|
|
136
|
+
label,
|
|
137
|
+
icon
|
|
138
|
+
}) => {
|
|
139
|
+
const iconElement = /*#__PURE__*/createElement(icon, {
|
|
140
|
+
color: iconColor[colorVariant],
|
|
141
|
+
width: iconSize[size],
|
|
142
|
+
height: iconSize[size],
|
|
143
|
+
role: 'presentation'
|
|
144
|
+
});
|
|
145
|
+
return jsxs(Fragment, {
|
|
146
|
+
children: [jsx("div", {
|
|
147
|
+
className: clsx(styles.iconContainer, styles[`iconContainer--${colorVariant}`], styles[`iconContainer--size-${size}`]),
|
|
148
|
+
children: iconElement
|
|
149
|
+
}), jsx(Text, {
|
|
150
|
+
as: "span",
|
|
151
|
+
className: clsx(styles.text, styles[`text--${size}`]),
|
|
152
|
+
variant: size === 'default' ? 'caption' : 'bodyDefaultBold',
|
|
153
|
+
children: label
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
};
|
|
106
157
|
|
|
107
|
-
export { SelectMenuGridColorCircle, SelectMenuGridOption, SelectMenuGridSquare };
|
|
158
|
+
export { ItemWithLabel, SelectMenuGridColorCircle, SelectMenuGridOption, SelectMenuGridSquare, SelectMenuGridWithLabel };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"square":"bp_select_menu_grid_option_module_square--
|
|
2
|
+
var styles = {"buttonWrapper":"bp_select_menu_grid_option_module_buttonWrapper--3bd72","withLabel":"bp_select_menu_grid_option_module_withLabel--3bd72","withLabel--default":"bp_select_menu_grid_option_module_withLabel--default--3bd72","square":"bp_select_menu_grid_option_module_square--3bd72","outlineHost":"bp_select_menu_grid_option_module_outlineHost--3bd72","circle":"bp_select_menu_grid_option_module_circle--3bd72","loading":"bp_select_menu_grid_option_module_loading--3bd72","color":"bp_select_menu_grid_option_module_color--3bd72","strikeThrough":"bp_select_menu_grid_option_module_strikeThrough--3bd72","optionButton":"bp_select_menu_grid_option_module_optionButton--3bd72","labeled":"bp_select_menu_grid_option_module_labeled--3bd72","text":"bp_select_menu_grid_option_module_text--3bd72","text--large":"bp_select_menu_grid_option_module_text--large--3bd72","text--default":"bp_select_menu_grid_option_module_text--default--3bd72","iconContainer":"bp_select_menu_grid_option_module_iconContainer--3bd72","iconContainer--size-default":"bp_select_menu_grid_option_module_iconContainer--size-default--3bd72","iconContainer--size-large":"bp_select_menu_grid_option_module_iconContainer--size-large--3bd72","iconContainer--default":"bp_select_menu_grid_option_module_iconContainer--default--3bd72","iconContainer--box":"bp_select_menu_grid_option_module_iconContainer--box--3bd72","iconContainer--docgen":"bp_select_menu_grid_option_module_iconContainer--docgen--3bd72","iconContainer--forms":"bp_select_menu_grid_option_module_iconContainer--forms--3bd72","iconContainer--sign":"bp_select_menu_grid_option_module_iconContainer--sign--3bd72","active":"bp_select_menu_grid_option_module_active--3bd72","dragging":"bp_select_menu_grid_option_module_dragging--3bd72","disabled":"bp_select_menu_grid_option_module_disabled--3bd72"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { type ButtonProps as AriakitButtonProps, type CompositeProps, type CompositeRowProps } from '@ariakit/react';
|
|
2
2
|
import { type RequireAllOrNone } from 'type-fest';
|
|
3
|
+
import { type FunctionComponent, type PropsWithChildren, type SVGProps } from 'react';
|
|
3
4
|
export interface Loading {
|
|
4
5
|
/** Loading state of the grid option. Ghost section is displaying as a placeholder. When this is true `loadingAriaLabel` must also be provided. */
|
|
5
6
|
loading: boolean;
|
|
6
7
|
/** The aria-label for the ghost state. */
|
|
7
8
|
loadingAriaLabel: string;
|
|
8
9
|
}
|
|
10
|
+
export interface Dragging {
|
|
11
|
+
dragging: boolean;
|
|
12
|
+
draggable: boolean;
|
|
13
|
+
}
|
|
9
14
|
export type CommonOptionProps = {
|
|
10
15
|
/** The aria-label for the grid option */
|
|
11
16
|
'aria-label': string;
|
|
@@ -22,9 +27,18 @@ export type SelectMenuGridColorCircleProps = CommonOptionProps & {
|
|
|
22
27
|
/** The color of the swatch */
|
|
23
28
|
color: string;
|
|
24
29
|
};
|
|
25
|
-
export type
|
|
30
|
+
export type SelectMenuGridWithLabelProps = Omit<CommonOptionProps, 'aria-label' | 'tooltipSide' | 'draggable'> & {
|
|
31
|
+
size: 'default' | 'large';
|
|
32
|
+
colorVariant: 'default' | 'box' | 'forms' | 'docgen' | 'sign';
|
|
33
|
+
icon: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>;
|
|
34
|
+
label: string;
|
|
35
|
+
} & RequireAllOrNone<Dragging, keyof Dragging>;
|
|
36
|
+
export type SelectMenuOptionIconsProps = Partial<SelectMenuGridSquareProps> & Partial<SelectMenuGridColorCircleProps> & {
|
|
26
37
|
variant: 'square' | 'colorCircle';
|
|
27
38
|
};
|
|
39
|
+
export type SelectMenuOptionProps = SelectMenuOptionIconsProps | (SelectMenuGridWithLabelProps & {
|
|
40
|
+
variant: 'labeled';
|
|
41
|
+
});
|
|
28
42
|
export type SelectMenuGridRowProps = CompositeRowProps;
|
|
29
43
|
export type SelectMenuGridProps = {
|
|
30
44
|
/** The grid options to render */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-stately": "^3.31.1",
|
|
64
64
|
"tsx": "^4.16.5"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "5c7f39250a18eacf7e99ee41713ea791495acb63",
|
|
67
67
|
"module": "lib-esm/index.js",
|
|
68
68
|
"main": "lib-esm/index.js",
|
|
69
69
|
"exports": {
|