@box/blueprint-web 14.15.2 → 14.16.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/dist/lib-esm/index.css +256 -45
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +13 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +13 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
- package/dist/lib-esm/utils/useContentSizeObserver.d.ts +7 -0
- package/dist/lib-esm/utils/useContentSizeObserver.js +38 -0
- package/package.json +3 -3
package/dist/lib-esm/index.css
CHANGED
|
@@ -2679,7 +2679,7 @@
|
|
|
2679
2679
|
height:var(--icon-button-size-x-small);
|
|
2680
2680
|
width:var(--icon-button-size-x-small);
|
|
2681
2681
|
}
|
|
2682
|
-
.bp_dropdown_menu_module_content--
|
|
2682
|
+
.bp_dropdown_menu_module_content--ca3a5[data-modern=false]{
|
|
2683
2683
|
--dropdown-menu-radius:var(--radius-3);
|
|
2684
2684
|
--dropdown-menu-padding:var(--space-3);
|
|
2685
2685
|
--dropdown-menu-text-color:var(--text-text-on-light);
|
|
@@ -2723,7 +2723,7 @@
|
|
|
2723
2723
|
text-transform:var(--body-default-text-case);
|
|
2724
2724
|
}
|
|
2725
2725
|
|
|
2726
|
-
.bp_dropdown_menu_module_content--
|
|
2726
|
+
.bp_dropdown_menu_module_content--ca3a5[data-modern=true]{
|
|
2727
2727
|
--dropdown-menu-radius:var(--bp-radius-10);
|
|
2728
2728
|
--dropdown-menu-padding:var(--bp-space-030);
|
|
2729
2729
|
--dropdown-menu-text-color:var(--bp-text-text-on-light);
|
|
@@ -2766,7 +2766,7 @@
|
|
|
2766
2766
|
line-height:var(--bp-font-line-height-04);
|
|
2767
2767
|
}
|
|
2768
2768
|
|
|
2769
|
-
.bp_dropdown_menu_module_content--
|
|
2769
|
+
.bp_dropdown_menu_module_content--ca3a5{
|
|
2770
2770
|
backdrop-filter:var(--dropdown-menu-backdrop-filter);
|
|
2771
2771
|
background-color:var(--dropdown-menu-background);
|
|
2772
2772
|
border:var(--dropdown-menu-border);
|
|
@@ -2781,7 +2781,7 @@
|
|
|
2781
2781
|
padding:var(--dropdown-menu-padding);
|
|
2782
2782
|
z-index:380;
|
|
2783
2783
|
}
|
|
2784
|
-
.bp_dropdown_menu_module_content--
|
|
2784
|
+
.bp_dropdown_menu_module_content--ca3a5[data-menu-fullscreen=true]{
|
|
2785
2785
|
border:unset;
|
|
2786
2786
|
border-radius:unset;
|
|
2787
2787
|
display:flex;
|
|
@@ -2794,39 +2794,39 @@
|
|
|
2794
2794
|
position:relative;
|
|
2795
2795
|
width:100vw;
|
|
2796
2796
|
}
|
|
2797
|
-
.bp_dropdown_menu_module_content--
|
|
2797
|
+
.bp_dropdown_menu_module_content--ca3a5[data-menu-fullscreen=true] .bp_dropdown_menu_module_fullScreenContent--ca3a5{
|
|
2798
2798
|
overflow-y:auto;
|
|
2799
2799
|
padding:var(--dropdown-menu-full-screen-padding);
|
|
2800
2800
|
}
|
|
2801
|
-
.bp_dropdown_menu_module_content--
|
|
2801
|
+
.bp_dropdown_menu_module_content--ca3a5 .bp_dropdown_menu_module_subheader--ca3a5{
|
|
2802
2802
|
padding:var(--dropdown-menu-subheader-padding);
|
|
2803
2803
|
}
|
|
2804
|
-
.bp_dropdown_menu_module_content--
|
|
2804
|
+
.bp_dropdown_menu_module_content--ca3a5 .bp_dropdown_menu_module_subheader--ca3a5.bp_dropdown_menu_module_uppercased--ca3a5{
|
|
2805
2805
|
text-transform:uppercase;
|
|
2806
2806
|
}
|
|
2807
|
-
.bp_dropdown_menu_module_content--
|
|
2807
|
+
.bp_dropdown_menu_module_content--ca3a5 .bp_dropdown_menu_module_dropdownMenuItemSeparator--ca3a5{
|
|
2808
2808
|
margin-block:var(--dropdown-menu-separator-margin);
|
|
2809
2809
|
}
|
|
2810
2810
|
|
|
2811
|
-
.bp_dropdown_menu_module_ellipsis--
|
|
2811
|
+
.bp_dropdown_menu_module_ellipsis--ca3a5{
|
|
2812
2812
|
min-width:0;
|
|
2813
2813
|
overflow:hidden;
|
|
2814
2814
|
text-overflow:ellipsis;
|
|
2815
2815
|
white-space:nowrap;
|
|
2816
2816
|
}
|
|
2817
|
-
.bp_dropdown_menu_module_itemBody--
|
|
2817
|
+
.bp_dropdown_menu_module_itemBody--ca3a5{
|
|
2818
2818
|
flex:1;
|
|
2819
2819
|
min-width:0;
|
|
2820
2820
|
overflow:hidden;
|
|
2821
2821
|
}
|
|
2822
|
-
.bp_dropdown_menu_module_itemOverflow--
|
|
2822
|
+
.bp_dropdown_menu_module_itemOverflow--ca3a5{
|
|
2823
2823
|
min-width:0;
|
|
2824
2824
|
overflow:hidden;
|
|
2825
2825
|
text-overflow:ellipsis;
|
|
2826
2826
|
white-space:nowrap;
|
|
2827
2827
|
}
|
|
2828
2828
|
|
|
2829
|
-
.bp_dropdown_menu_module_menuItemCaption--
|
|
2829
|
+
.bp_dropdown_menu_module_menuItemCaption--ca3a5{
|
|
2830
2830
|
-webkit-box-orient:vertical;
|
|
2831
2831
|
-webkit-line-clamp:2;
|
|
2832
2832
|
color:var(--dropdown-menu-caption-text-color);
|
|
@@ -2837,7 +2837,7 @@
|
|
|
2837
2837
|
width:100%;
|
|
2838
2838
|
}
|
|
2839
2839
|
|
|
2840
|
-
.bp_dropdown_menu_module_checkmark--
|
|
2840
|
+
.bp_dropdown_menu_module_checkmark--ca3a5{
|
|
2841
2841
|
align-items:center;
|
|
2842
2842
|
display:inline-flex;
|
|
2843
2843
|
justify-content:center;
|
|
@@ -2845,11 +2845,11 @@
|
|
|
2845
2845
|
position:absolute;
|
|
2846
2846
|
}
|
|
2847
2847
|
|
|
2848
|
-
.bp_dropdown_menu_module_checkmark--
|
|
2848
|
+
.bp_dropdown_menu_module_checkmark--ca3a5.bp_dropdown_menu_module_mediumSpacing--ca3a5{
|
|
2849
2849
|
left:var(--dropdown-menu-medium-checkmark-left);
|
|
2850
2850
|
}
|
|
2851
2851
|
|
|
2852
|
-
.bp_dropdown_menu_module_item--
|
|
2852
|
+
.bp_dropdown_menu_module_item--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5{
|
|
2853
2853
|
align-items:center;
|
|
2854
2854
|
border:var(--dropdown-menu-item-border);
|
|
2855
2855
|
border-radius:var(--dropdown-menu-item-radius);
|
|
@@ -2862,107 +2862,107 @@
|
|
|
2862
2862
|
-webkit-user-select:none;
|
|
2863
2863
|
user-select:none;
|
|
2864
2864
|
}
|
|
2865
|
-
.bp_dropdown_menu_module_item--
|
|
2865
|
+
.bp_dropdown_menu_module_item--ca3a5[data-disabled],.bp_dropdown_menu_module_subMenuTrigger--ca3a5[data-disabled]{
|
|
2866
2866
|
opacity:60%;
|
|
2867
2867
|
pointer-events:none;
|
|
2868
2868
|
}
|
|
2869
|
-
.bp_dropdown_menu_module_item--
|
|
2869
|
+
.bp_dropdown_menu_module_item--ca3a5[data-highlighted],.bp_dropdown_menu_module_subMenuTrigger--ca3a5[data-highlighted]{
|
|
2870
2870
|
background-color:var(--dropdown-menu-item-background-focus);
|
|
2871
2871
|
border:var(--dropdown-menu-item-border-focus);
|
|
2872
2872
|
}
|
|
2873
|
-
.bp_dropdown_menu_module_item--
|
|
2873
|
+
.bp_dropdown_menu_module_item--ca3a5[data-state=open][data-highlighted],.bp_dropdown_menu_module_subMenuTrigger--ca3a5[data-state=open][data-highlighted]{
|
|
2874
2874
|
border:var(--dropdown-menu-item-border);
|
|
2875
2875
|
}
|
|
2876
|
-
.bp_dropdown_menu_module_item--
|
|
2876
|
+
.bp_dropdown_menu_module_item--ca3a5:active,.bp_dropdown_menu_module_subMenuTrigger--ca3a5:active{
|
|
2877
2877
|
background-color:var(--dropdown-menu-item-background-active);
|
|
2878
2878
|
border:var(--dropdown-menu-item-border-active);
|
|
2879
2879
|
}
|
|
2880
|
-
.bp_dropdown_menu_module_item--
|
|
2880
|
+
.bp_dropdown_menu_module_item--ca3a5[data-state=open],.bp_dropdown_menu_module_subMenuTrigger--ca3a5[data-state=open]{
|
|
2881
2881
|
background-color:var(--dropdown-menu-item-background-selected);
|
|
2882
2882
|
}
|
|
2883
|
-
.bp_dropdown_menu_module_item--
|
|
2883
|
+
.bp_dropdown_menu_module_item--ca3a5:hover,.bp_dropdown_menu_module_subMenuTrigger--ca3a5:hover{
|
|
2884
2884
|
background-color:var(--dropdown-menu-item-background-hover);
|
|
2885
2885
|
border:var(--dropdown-menu-item-border-hover);
|
|
2886
2886
|
}
|
|
2887
|
-
.bp_dropdown_menu_module_item--
|
|
2887
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5{
|
|
2888
2888
|
padding:.4375rem calc(var(--space-2) + var(--space-4) + var(--space-4)) .4375rem .5rem;
|
|
2889
2889
|
}
|
|
2890
|
-
.bp_dropdown_menu_module_item--
|
|
2890
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5{
|
|
2891
2891
|
inset-inline-end:var(--dropdown-menu-checkmark-left);
|
|
2892
2892
|
left:auto;
|
|
2893
2893
|
}
|
|
2894
|
-
.bp_dropdown_menu_module_item--
|
|
2894
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5.bp_dropdown_menu_module_mediumSpacing--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5.bp_dropdown_menu_module_mediumSpacing--ca3a5{
|
|
2895
2895
|
inset-inline-end:var(--dropdown-menu-medium-checkmark-left);
|
|
2896
2896
|
left:auto;
|
|
2897
2897
|
}
|
|
2898
|
-
.bp_dropdown_menu_module_item--
|
|
2898
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_radioItemMediumSpacing--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_radioItemMediumSpacing--ca3a5{
|
|
2899
2899
|
padding-inline-start:var(--dropdown-menu-radio-item-medium-padding-start);
|
|
2900
2900
|
}
|
|
2901
|
-
.bp_dropdown_menu_module_item--
|
|
2901
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_itemBody--ca3a5:not(:has(.bp_dropdown_menu_module_menuItemMainContent--ca3a5)),.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_radioItem--ca3a5 .bp_dropdown_menu_module_itemBody--ca3a5:not(:has(.bp_dropdown_menu_module_menuItemMainContent--ca3a5)){
|
|
2902
2902
|
text-overflow:ellipsis;
|
|
2903
2903
|
white-space:nowrap;
|
|
2904
2904
|
}
|
|
2905
|
-
.bp_dropdown_menu_module_item--
|
|
2905
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5{
|
|
2906
2906
|
padding:.4375rem calc(var(--space-2) + var(--space-4) + var(--space-4)) .4375rem .5rem;
|
|
2907
2907
|
}
|
|
2908
|
-
.bp_dropdown_menu_module_item--
|
|
2908
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5{
|
|
2909
2909
|
inset-inline-end:var(--dropdown-menu-checkmark-left);
|
|
2910
2910
|
left:auto;
|
|
2911
2911
|
}
|
|
2912
|
-
.bp_dropdown_menu_module_item--
|
|
2912
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5.bp_dropdown_menu_module_mediumSpacing--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkmark--ca3a5.bp_dropdown_menu_module_mediumSpacing--ca3a5{
|
|
2913
2913
|
inset-inline-end:var(--dropdown-menu-medium-checkmark-left);
|
|
2914
2914
|
left:auto;
|
|
2915
2915
|
}
|
|
2916
|
-
.bp_dropdown_menu_module_item--
|
|
2916
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkboxItemMediumSpacing--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_checkboxItemMediumSpacing--ca3a5{
|
|
2917
2917
|
padding-inline-start:var(--dropdown-menu-checkbox-item-medium-padding-start);
|
|
2918
2918
|
}
|
|
2919
|
-
.bp_dropdown_menu_module_item--
|
|
2919
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_itemBody--ca3a5:not(:has(.bp_dropdown_menu_module_menuItemMainContent--ca3a5)),.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_checkboxItem--ca3a5 .bp_dropdown_menu_module_itemBody--ca3a5:not(:has(.bp_dropdown_menu_module_menuItemMainContent--ca3a5)){
|
|
2920
2920
|
text-overflow:ellipsis;
|
|
2921
2921
|
white-space:nowrap;
|
|
2922
2922
|
}
|
|
2923
|
-
.bp_dropdown_menu_module_item--
|
|
2923
|
+
.bp_dropdown_menu_module_item--ca3a5 .bp_dropdown_menu_module_mediumItemLayout--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5 .bp_dropdown_menu_module_mediumItemLayout--ca3a5{
|
|
2924
2924
|
gap:var(--dropdown-menu-medium-item-layout-gap);
|
|
2925
2925
|
justify-content:space-between;
|
|
2926
2926
|
overflow:hidden;
|
|
2927
2927
|
}
|
|
2928
|
-
.bp_dropdown_menu_module_item--
|
|
2928
|
+
.bp_dropdown_menu_module_item--ca3a5 .bp_dropdown_menu_module_startElement--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5 .bp_dropdown_menu_module_startElement--ca3a5{
|
|
2929
2929
|
align-items:center;
|
|
2930
2930
|
display:flex;
|
|
2931
2931
|
}
|
|
2932
|
-
.bp_dropdown_menu_module_item--
|
|
2932
|
+
.bp_dropdown_menu_module_item--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5{
|
|
2933
2933
|
display:flex;
|
|
2934
2934
|
flex-direction:column;
|
|
2935
2935
|
flex-grow:1;
|
|
2936
2936
|
min-width:0;
|
|
2937
2937
|
}
|
|
2938
|
-
.bp_dropdown_menu_module_item--
|
|
2938
|
+
.bp_dropdown_menu_module_item--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5.bp_dropdown_menu_module_menuItemMainContent_directChild--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5.bp_dropdown_menu_module_menuItemMainContent_directChild--ca3a5{
|
|
2939
2939
|
display:block;
|
|
2940
2940
|
overflow:hidden;
|
|
2941
2941
|
text-overflow:ellipsis;
|
|
2942
2942
|
white-space:nowrap;
|
|
2943
2943
|
}
|
|
2944
|
-
.bp_dropdown_menu_module_item--
|
|
2944
|
+
.bp_dropdown_menu_module_item--ca3a5 .bp_dropdown_menu_module_endElement--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5 .bp_dropdown_menu_module_endElement--ca3a5{
|
|
2945
2945
|
align-items:center;
|
|
2946
2946
|
color:var(--dropdown-menu-end-element-color);
|
|
2947
2947
|
display:flex;
|
|
2948
2948
|
}
|
|
2949
|
-
.bp_dropdown_menu_module_item--
|
|
2949
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5{
|
|
2950
2950
|
color:var(--dropdown-menu-item-destructive-color);
|
|
2951
2951
|
}
|
|
2952
|
-
.bp_dropdown_menu_module_item--
|
|
2952
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5 span,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_menuItemMainContent--ca3a5 span{
|
|
2953
2953
|
color:inherit;
|
|
2954
2954
|
}
|
|
2955
|
-
.bp_dropdown_menu_module_item--
|
|
2955
|
+
.bp_dropdown_menu_module_item--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_endElement--ca3a5,.bp_dropdown_menu_module_subMenuTrigger--ca3a5.bp_dropdown_menu_module_destructive--ca3a5 .bp_dropdown_menu_module_endElement--ca3a5{
|
|
2956
2956
|
color:var(--dropdown-menu-item-destructive-color);
|
|
2957
2957
|
}
|
|
2958
|
-
.bp_dropdown_menu_module_item--
|
|
2958
|
+
.bp_dropdown_menu_module_item--ca3a5:has(.bp_dropdown_menu_module_ellipsis--ca3a5),.bp_dropdown_menu_module_item--ca3a5:has(.bp_dropdown_menu_module_itemBody--ca3a5),.bp_dropdown_menu_module_item--ca3a5:has(.bp_dropdown_menu_module_menuItemMainContent_directChild--ca3a5){
|
|
2959
2959
|
border-radius:var(--dropdown-menu-item-radius);
|
|
2960
2960
|
}
|
|
2961
|
-
.bp_dropdown_menu_module_item--
|
|
2961
|
+
.bp_dropdown_menu_module_item--ca3a5:has(.bp_dropdown_menu_module_mediumItemLayout--ca3a5){
|
|
2962
2962
|
border-radius:var(--dropdown-menu-medium-item-radius);
|
|
2963
2963
|
}
|
|
2964
2964
|
|
|
2965
|
-
.bp_dropdown_menu_module_menuHeader--
|
|
2965
|
+
.bp_dropdown_menu_module_menuHeader--ca3a5{
|
|
2966
2966
|
align-items:center;
|
|
2967
2967
|
box-shadow:var(--dropdown-menu-header-shadow);
|
|
2968
2968
|
display:grid;
|
|
@@ -2972,17 +2972,228 @@
|
|
|
2972
2972
|
padding:var(--dropdown-menu-header-padding);
|
|
2973
2973
|
}
|
|
2974
2974
|
|
|
2975
|
-
.bp_dropdown_menu_module_headerTextContent--
|
|
2975
|
+
.bp_dropdown_menu_module_headerTextContent--ca3a5{
|
|
2976
2976
|
display:grid;
|
|
2977
2977
|
}
|
|
2978
2978
|
|
|
2979
|
-
.bp_dropdown_menu_module_submenuCloseButton--
|
|
2979
|
+
.bp_dropdown_menu_module_submenuCloseButton--ca3a5{
|
|
2980
2980
|
grid-area:submenu-close;
|
|
2981
2981
|
}
|
|
2982
2982
|
|
|
2983
|
-
.bp_dropdown_menu_module_menuCloseButton--
|
|
2983
|
+
.bp_dropdown_menu_module_menuCloseButton--ca3a5{
|
|
2984
2984
|
grid-area:close;
|
|
2985
2985
|
}
|
|
2986
|
+
|
|
2987
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=open]{
|
|
2988
|
+
animation-duration:var(--bp-duration-medium);
|
|
2989
|
+
animation-timing-function:var(--bp-curve-medium-on);
|
|
2990
|
+
}
|
|
2991
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=open][data-side=top]{
|
|
2992
|
+
animation-name:bp_dropdown_menu_module_bpDropdownTopSlideEnter--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
2993
|
+
}
|
|
2994
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=open][data-side=right]{
|
|
2995
|
+
animation-name:bp_dropdown_menu_module_bpDropdownRightSlideEnter--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
2996
|
+
}
|
|
2997
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=open][data-side=bottom]{
|
|
2998
|
+
animation-name:bp_dropdown_menu_module_bpDropdownBottomSlideEnter--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
2999
|
+
}
|
|
3000
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=open][data-side=left]{
|
|
3001
|
+
animation-name:bp_dropdown_menu_module_bpDropdownLeftSlideEnter--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
3002
|
+
}
|
|
3003
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=closed]{
|
|
3004
|
+
animation-duration:var(--bp-duration-short);
|
|
3005
|
+
animation-timing-function:var(--bp-curve-medium-off);
|
|
3006
|
+
}
|
|
3007
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=closed][data-side=top]{
|
|
3008
|
+
animation-name:bp_dropdown_menu_module_bpDropdownTopSlideExit--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3009
|
+
}
|
|
3010
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=closed][data-side=right]{
|
|
3011
|
+
animation-name:bp_dropdown_menu_module_bpDropdownRightSlideExit--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3012
|
+
}
|
|
3013
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=closed][data-side=bottom]{
|
|
3014
|
+
animation-name:bp_dropdown_menu_module_bpDropdownBottomSlideExit--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3015
|
+
}
|
|
3016
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true]:not([data-large])[data-state=closed][data-side=left]{
|
|
3017
|
+
animation-name:bp_dropdown_menu_module_bpDropdownLeftSlideExit--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=open]{
|
|
3021
|
+
animation-duration:var(--bp-duration-long);
|
|
3022
|
+
animation-timing-function:var(--bp-curve-large-on);
|
|
3023
|
+
}
|
|
3024
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=open][data-side=top]{
|
|
3025
|
+
animation-name:bp_dropdown_menu_module_bpDropdownTopSlideEnterLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
3026
|
+
}
|
|
3027
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=open][data-side=right]{
|
|
3028
|
+
animation-name:bp_dropdown_menu_module_bpDropdownRightSlideEnterLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
3029
|
+
}
|
|
3030
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=open][data-side=bottom]{
|
|
3031
|
+
animation-name:bp_dropdown_menu_module_bpDropdownBottomSlideEnterLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
3032
|
+
}
|
|
3033
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=open][data-side=left]{
|
|
3034
|
+
animation-name:bp_dropdown_menu_module_bpDropdownLeftSlideEnterLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5;
|
|
3035
|
+
}
|
|
3036
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=closed]{
|
|
3037
|
+
animation-duration:var(--bp-duration-medium);
|
|
3038
|
+
animation-timing-function:var(--bp-curve-large-off);
|
|
3039
|
+
}
|
|
3040
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=closed][data-side=top]{
|
|
3041
|
+
animation-name:bp_dropdown_menu_module_bpDropdownTopSlideExitLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3042
|
+
}
|
|
3043
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=closed][data-side=right]{
|
|
3044
|
+
animation-name:bp_dropdown_menu_module_bpDropdownRightSlideExitLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3045
|
+
}
|
|
3046
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=closed][data-side=bottom]{
|
|
3047
|
+
animation-name:bp_dropdown_menu_module_bpDropdownBottomSlideExitLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3048
|
+
}
|
|
3049
|
+
.bp_dropdown_menu_module_content--ca3a5[data-bp-animated=true][data-large=true][data-state=closed][data-side=left]{
|
|
3050
|
+
animation-name:bp_dropdown_menu_module_bpDropdownLeftSlideExitLarge--ca3a5, bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
@keyframes bp_dropdown_menu_module_bpDropdownFadeIn--ca3a5{
|
|
3054
|
+
from{
|
|
3055
|
+
opacity:var(--bp-opacity-hidden);
|
|
3056
|
+
}
|
|
3057
|
+
to{
|
|
3058
|
+
opacity:var(--bp-opacity-visible);
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
@keyframes bp_dropdown_menu_module_bpDropdownFadeOut--ca3a5{
|
|
3062
|
+
from{
|
|
3063
|
+
opacity:var(--bp-opacity-visible);
|
|
3064
|
+
}
|
|
3065
|
+
to{
|
|
3066
|
+
opacity:var(--bp-opacity-hidden);
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
@keyframes bp_dropdown_menu_module_bpDropdownTopSlideEnter--ca3a5{
|
|
3070
|
+
from{
|
|
3071
|
+
transform:translateY(var(--bp-space-020));
|
|
3072
|
+
}
|
|
3073
|
+
to{
|
|
3074
|
+
transform:translateY(0);
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
@keyframes bp_dropdown_menu_module_bpDropdownTopSlideExit--ca3a5{
|
|
3078
|
+
from{
|
|
3079
|
+
transform:translateY(0);
|
|
3080
|
+
}
|
|
3081
|
+
to{
|
|
3082
|
+
transform:translateY(var(--bp-space-020));
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
@keyframes bp_dropdown_menu_module_bpDropdownBottomSlideEnter--ca3a5{
|
|
3086
|
+
from{
|
|
3087
|
+
transform:translateY(calc(var(--bp-space-020)*-1));
|
|
3088
|
+
}
|
|
3089
|
+
to{
|
|
3090
|
+
transform:translateY(0);
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
@keyframes bp_dropdown_menu_module_bpDropdownBottomSlideExit--ca3a5{
|
|
3094
|
+
from{
|
|
3095
|
+
transform:translateY(0);
|
|
3096
|
+
}
|
|
3097
|
+
to{
|
|
3098
|
+
transform:translateY(calc(var(--bp-space-020)*-1));
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
@keyframes bp_dropdown_menu_module_bpDropdownRightSlideEnter--ca3a5{
|
|
3102
|
+
from{
|
|
3103
|
+
transform:translateX(calc(var(--bp-space-020)*-1));
|
|
3104
|
+
}
|
|
3105
|
+
to{
|
|
3106
|
+
transform:translateX(0);
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
@keyframes bp_dropdown_menu_module_bpDropdownRightSlideExit--ca3a5{
|
|
3110
|
+
from{
|
|
3111
|
+
transform:translateX(0);
|
|
3112
|
+
}
|
|
3113
|
+
to{
|
|
3114
|
+
transform:translateX(calc(var(--bp-space-020)*-1));
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
@keyframes bp_dropdown_menu_module_bpDropdownLeftSlideEnter--ca3a5{
|
|
3118
|
+
from{
|
|
3119
|
+
transform:translateX(var(--bp-space-020));
|
|
3120
|
+
}
|
|
3121
|
+
to{
|
|
3122
|
+
transform:translateX(0);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
@keyframes bp_dropdown_menu_module_bpDropdownLeftSlideExit--ca3a5{
|
|
3126
|
+
from{
|
|
3127
|
+
transform:translateX(0);
|
|
3128
|
+
}
|
|
3129
|
+
to{
|
|
3130
|
+
transform:translateX(var(--bp-space-020));
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
@keyframes bp_dropdown_menu_module_bpDropdownTopSlideEnterLarge--ca3a5{
|
|
3134
|
+
from{
|
|
3135
|
+
transform:var(--bp-scale-small) var(--bp-space-040);
|
|
3136
|
+
}
|
|
3137
|
+
to{
|
|
3138
|
+
transform:var(--bp-scale-default) translateY(0);
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
@keyframes bp_dropdown_menu_module_bpDropdownTopSlideExitLarge--ca3a5{
|
|
3142
|
+
from{
|
|
3143
|
+
transform:var(--bp-scale-default) translateY(0);
|
|
3144
|
+
}
|
|
3145
|
+
to{
|
|
3146
|
+
transform:var(--bp-scale-small) translateY(var(--bp-space-040));
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
@keyframes bp_dropdown_menu_module_bpDropdownBottomSlideEnterLarge--ca3a5{
|
|
3150
|
+
from{
|
|
3151
|
+
transform:var(--bp-scale-small) translateY(calc(var(--bp-space-040)*-1));
|
|
3152
|
+
}
|
|
3153
|
+
to{
|
|
3154
|
+
transform:var(--bp-scale-default) translateY(0);
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
@keyframes bp_dropdown_menu_module_bpDropdownBottomSlideExitLarge--ca3a5{
|
|
3158
|
+
from{
|
|
3159
|
+
transform:var(--bp-scale-default) translateY(0);
|
|
3160
|
+
}
|
|
3161
|
+
to{
|
|
3162
|
+
transform:var(--bp-scale-small) translateY(calc(var(--bp-space-040)*-1));
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
@keyframes bp_dropdown_menu_module_bpDropdownRightSlideEnterLarge--ca3a5{
|
|
3166
|
+
from{
|
|
3167
|
+
transform:var(--bp-scale-small) translateX(calc(var(--bp-space-040)*-1));
|
|
3168
|
+
}
|
|
3169
|
+
to{
|
|
3170
|
+
transform:var(--bp-scale-default) translateX(0);
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
@keyframes bp_dropdown_menu_module_bpDropdownRightSlideExitLarge--ca3a5{
|
|
3174
|
+
from{
|
|
3175
|
+
transform:var(--bp-scale-default) translateX(0);
|
|
3176
|
+
}
|
|
3177
|
+
to{
|
|
3178
|
+
transform:var(--bp-scale-small) translateX(calc(var(--bp-space-040)*-1));
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
@keyframes bp_dropdown_menu_module_bpDropdownLeftSlideEnterLarge--ca3a5{
|
|
3182
|
+
from{
|
|
3183
|
+
transform:var(--bp-scale-small) translateX(var(--bp-space-040));
|
|
3184
|
+
}
|
|
3185
|
+
to{
|
|
3186
|
+
transform:var(--bp-scale-default) translateX(0);
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
@keyframes bp_dropdown_menu_module_bpDropdownLeftSlideExitLarge--ca3a5{
|
|
3190
|
+
from{
|
|
3191
|
+
transform:var(--bp-scale-default) translateX(0);
|
|
3192
|
+
}
|
|
3193
|
+
to{
|
|
3194
|
+
transform:var(--bp-scale-small) translateX(var(--bp-space-040));
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
2986
3197
|
.bp_divider_module_divider--2f437{
|
|
2987
3198
|
background-color:var(--border-divider-border);
|
|
2988
3199
|
border:none;
|
|
@@ -3,7 +3,11 @@ import { Space4, Space2 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
|
3
3
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { forwardRef, Children, isValidElement } from 'react';
|
|
6
|
+
import '../../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
7
|
+
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
6
8
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
9
|
+
import { useContentSizeObserver } from '../../utils/useContentSizeObserver.js';
|
|
10
|
+
import { useForkRef } from '../../utils/useForkRef.js';
|
|
7
11
|
import { useFullScreenDropdownMenu } from '../menu-utils/responsiveness/FullScreenDropdownMenuContext.js';
|
|
8
12
|
import { DropdownMenuHeader } from './dropdown-menu-header.js';
|
|
9
13
|
import styles from './dropdown-menu.module.js';
|
|
@@ -44,6 +48,12 @@ const DropdownMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
44
48
|
const {
|
|
45
49
|
enableModernizedComponents
|
|
46
50
|
} = useBlueprintModernization();
|
|
51
|
+
const {
|
|
52
|
+
componentsWithAnimationEnabled
|
|
53
|
+
} = useBlueprintConfiguration();
|
|
54
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('DropdownMenu');
|
|
55
|
+
const sizeObserverRef = useContentSizeObserver(360, 360);
|
|
56
|
+
const ref = useForkRef(forwardedRef, sizeObserverRef);
|
|
47
57
|
if (isMenuFullScreenEnabled) {
|
|
48
58
|
const {
|
|
49
59
|
Header,
|
|
@@ -53,7 +63,7 @@ const DropdownMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
53
63
|
container: container,
|
|
54
64
|
children: jsxs(DropdownMenuPrimitive.Content, {
|
|
55
65
|
...rest,
|
|
56
|
-
ref:
|
|
66
|
+
ref: ref,
|
|
57
67
|
className: clsx(styles.content, className),
|
|
58
68
|
"data-menu-fullscreen": true,
|
|
59
69
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
@@ -70,10 +80,11 @@ const DropdownMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
70
80
|
container: container,
|
|
71
81
|
children: jsx(DropdownMenuPrimitive.Content, {
|
|
72
82
|
...rest,
|
|
73
|
-
ref:
|
|
83
|
+
ref: ref,
|
|
74
84
|
className: clsx(styles.content, className),
|
|
75
85
|
collisionPadding: collisionPadding,
|
|
76
86
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
87
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
77
88
|
sideOffset: SIDE_OFFSET,
|
|
78
89
|
children: children
|
|
79
90
|
})
|
|
@@ -3,7 +3,11 @@ import { Space4, Space3 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
|
3
3
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { forwardRef, useCallback } from 'react';
|
|
6
|
+
import '../../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
7
|
+
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
6
8
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
9
|
+
import { useContentSizeObserver } from '../../utils/useContentSizeObserver.js';
|
|
10
|
+
import { useForkRef } from '../../utils/useForkRef.js';
|
|
7
11
|
import { useFullScreenDropdownMenu } from '../menu-utils/responsiveness/FullScreenDropdownMenuContext.js';
|
|
8
12
|
import { sortMenuChildren } from './dropdown-menu-content.js';
|
|
9
13
|
import styles from './dropdown-menu.module.js';
|
|
@@ -28,7 +32,13 @@ const DropdownMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
28
32
|
const {
|
|
29
33
|
enableModernizedComponents
|
|
30
34
|
} = useBlueprintModernization();
|
|
35
|
+
const {
|
|
36
|
+
componentsWithAnimationEnabled
|
|
37
|
+
} = useBlueprintConfiguration();
|
|
38
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('DropdownMenu');
|
|
31
39
|
const preventDefault = useCallback(event => event.preventDefault(), []);
|
|
40
|
+
const sizeObserverRef = useContentSizeObserver(360, 360);
|
|
41
|
+
const ref = useForkRef(forwardedRef, sizeObserverRef);
|
|
32
42
|
if (isMenuFullScreenEnabled) {
|
|
33
43
|
const {
|
|
34
44
|
Header,
|
|
@@ -38,7 +48,7 @@ const DropdownMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
38
48
|
container: container,
|
|
39
49
|
children: jsxs(DropdownMenuPrimitive.SubContent, {
|
|
40
50
|
...rest,
|
|
41
|
-
ref:
|
|
51
|
+
ref: ref,
|
|
42
52
|
className: clsx(styles.content, className),
|
|
43
53
|
"data-menu-fullscreen": true,
|
|
44
54
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
@@ -58,10 +68,11 @@ const DropdownMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
58
68
|
container: container,
|
|
59
69
|
children: jsx(DropdownMenuPrimitive.SubContent, {
|
|
60
70
|
...rest,
|
|
61
|
-
ref:
|
|
71
|
+
ref: ref,
|
|
62
72
|
className: clsx(styles.content, className),
|
|
63
73
|
collisionPadding: collisionPadding,
|
|
64
74
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
75
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
65
76
|
sideOffset: SIDE_OFFSET,
|
|
66
77
|
children: children
|
|
67
78
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"content":"bp_dropdown_menu_module_content--
|
|
2
|
+
var styles = {"content":"bp_dropdown_menu_module_content--ca3a5","fullScreenContent":"bp_dropdown_menu_module_fullScreenContent--ca3a5","subheader":"bp_dropdown_menu_module_subheader--ca3a5","uppercased":"bp_dropdown_menu_module_uppercased--ca3a5","dropdownMenuItemSeparator":"bp_dropdown_menu_module_dropdownMenuItemSeparator--ca3a5","ellipsis":"bp_dropdown_menu_module_ellipsis--ca3a5","itemBody":"bp_dropdown_menu_module_itemBody--ca3a5","itemOverflow":"bp_dropdown_menu_module_itemOverflow--ca3a5","menuItemCaption":"bp_dropdown_menu_module_menuItemCaption--ca3a5","checkmark":"bp_dropdown_menu_module_checkmark--ca3a5","mediumSpacing":"bp_dropdown_menu_module_mediumSpacing--ca3a5","item":"bp_dropdown_menu_module_item--ca3a5","radioItem":"bp_dropdown_menu_module_radioItem--ca3a5","radioItemMediumSpacing":"bp_dropdown_menu_module_radioItemMediumSpacing--ca3a5","menuItemMainContent":"bp_dropdown_menu_module_menuItemMainContent--ca3a5","checkboxItem":"bp_dropdown_menu_module_checkboxItem--ca3a5","checkboxItemMediumSpacing":"bp_dropdown_menu_module_checkboxItemMediumSpacing--ca3a5","mediumItemLayout":"bp_dropdown_menu_module_mediumItemLayout--ca3a5","startElement":"bp_dropdown_menu_module_startElement--ca3a5","menuItemMainContent_directChild":"bp_dropdown_menu_module_menuItemMainContent_directChild--ca3a5","endElement":"bp_dropdown_menu_module_endElement--ca3a5","destructive":"bp_dropdown_menu_module_destructive--ca3a5","menuHeader":"bp_dropdown_menu_module_menuHeader--ca3a5","headerTextContent":"bp_dropdown_menu_module_headerTextContent--ca3a5","submenuCloseButton":"bp_dropdown_menu_module_submenuCloseButton--ca3a5","menuCloseButton":"bp_dropdown_menu_module_menuCloseButton--ca3a5"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observes the content element's inline size via ResizeObserver and toggles
|
|
3
|
+
* a `data-large` attribute when the width or height is greater than or equal to the threshold. This sidesteps
|
|
4
|
+
* the CSS `@container` size-query limitation where `container-type: inline-size`
|
|
5
|
+
* breaks intrinsic sizing on the Radix popper wrapper.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useContentSizeObserver<T extends HTMLElement>(widthThresholdPx: number, heightThresholdPx: number): (node: T | null) => void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Observes the content element's inline size via ResizeObserver and toggles
|
|
5
|
+
* a `data-large` attribute when the width or height is greater than or equal to the threshold. This sidesteps
|
|
6
|
+
* the CSS `@container` size-query limitation where `container-type: inline-size`
|
|
7
|
+
* breaks intrinsic sizing on the Radix popper wrapper.
|
|
8
|
+
*/
|
|
9
|
+
function useContentSizeObserver(widthThresholdPx, heightThresholdPx) {
|
|
10
|
+
const observerRef = useRef(null);
|
|
11
|
+
const refCallback = useCallback(node => {
|
|
12
|
+
if (observerRef.current) {
|
|
13
|
+
observerRef.current.disconnect();
|
|
14
|
+
observerRef.current = null;
|
|
15
|
+
}
|
|
16
|
+
if (node && typeof ResizeObserver !== 'undefined') {
|
|
17
|
+
observerRef.current = new ResizeObserver(entries => {
|
|
18
|
+
const entry = entries[0];
|
|
19
|
+
if (!entry) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const width = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;
|
|
23
|
+
const height = entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height;
|
|
24
|
+
const isWide = width >= widthThresholdPx;
|
|
25
|
+
const isTall = height >= heightThresholdPx;
|
|
26
|
+
if (isWide || isTall) {
|
|
27
|
+
node.setAttribute('data-large', 'true');
|
|
28
|
+
} else {
|
|
29
|
+
node.removeAttribute('data-large');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
observerRef.current.observe(node);
|
|
33
|
+
}
|
|
34
|
+
}, [widthThresholdPx, heightThresholdPx]);
|
|
35
|
+
return refCallback;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { useContentSizeObserver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.16.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.21",
|
|
49
49
|
"@ariakit/react-core": "0.4.21",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.115.1",
|
|
51
51
|
"@internationalized/date": "^3.12.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.
|
|
80
|
+
"@box/storybook-utils": "^0.18.1",
|
|
81
81
|
"@figma/code-connect": "1.4.4",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|