@box/blueprint-web 11.0.3 → 11.1.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 +23 -17
- package/dist/lib-esm/list-item/index.js +1 -0
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +6 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.d.ts +3 -0
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.js +28 -0
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +6 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/index.d.ts +1 -0
- package/dist/lib-esm/primitives/dropdown-menu/index.js +3 -1
- package/dist/lib-esm/text/types.d.ts +5 -2
- package/package.json +1 -1
package/dist/lib-esm/index.css
CHANGED
|
@@ -2737,7 +2737,7 @@
|
|
|
2737
2737
|
transform:translateZ(0);
|
|
2738
2738
|
}
|
|
2739
2739
|
|
|
2740
|
-
.bp_dropdown_menu_module_content--
|
|
2740
|
+
.bp_dropdown_menu_module_content--8752a{
|
|
2741
2741
|
background-color:var(--surface-menu-surface);
|
|
2742
2742
|
border:var(--border-1) solid var(--border-card-border);
|
|
2743
2743
|
border-radius:var(--radius-3);
|
|
@@ -2749,7 +2749,7 @@
|
|
|
2749
2749
|
font-weight:400;
|
|
2750
2750
|
letter-spacing:.01875rem;
|
|
2751
2751
|
line-height:1.25rem;
|
|
2752
|
-
max-height:var(--blueprint-web-dropdown-menu-max-height, var(--radix-dropdown-menu-content-available-height));
|
|
2752
|
+
max-height:min(var(--blueprint-web-dropdown-menu-max-height, var(--radix-dropdown-menu-content-available-height)), var(--radix-dropdown-menu-content-available-height));
|
|
2753
2753
|
max-width:min(var(--blueprint-web-dropdown-content-max-width, 50vw), var(--radix-dropdown-menu-content-available-width));
|
|
2754
2754
|
min-width:var(--blueprint-web-dropdown-content-min-width);
|
|
2755
2755
|
overflow-y:auto;
|
|
@@ -2758,7 +2758,7 @@
|
|
|
2758
2758
|
text-transform:none;
|
|
2759
2759
|
z-index:2147483647;
|
|
2760
2760
|
}
|
|
2761
|
-
.bp_dropdown_menu_module_content--
|
|
2761
|
+
.bp_dropdown_menu_module_content--8752a[data-menu-fullscreen=true]{
|
|
2762
2762
|
border:unset;
|
|
2763
2763
|
border-radius:unset;
|
|
2764
2764
|
display:flex;
|
|
@@ -2771,18 +2771,24 @@
|
|
|
2771
2771
|
position:relative;
|
|
2772
2772
|
width:100vw;
|
|
2773
2773
|
}
|
|
2774
|
-
.bp_dropdown_menu_module_content--
|
|
2774
|
+
.bp_dropdown_menu_module_content--8752a[data-menu-fullscreen=true] .bp_dropdown_menu_module_fullScreenContent--8752a{
|
|
2775
2775
|
overflow-y:auto;
|
|
2776
2776
|
padding:var(--space-3);
|
|
2777
2777
|
}
|
|
2778
|
+
.bp_dropdown_menu_module_content--8752a .bp_dropdown_menu_module_subheader--8752a{
|
|
2779
|
+
padding:var(--space-2);
|
|
2780
|
+
}
|
|
2781
|
+
.bp_dropdown_menu_module_content--8752a .bp_dropdown_menu_module_subheader--8752a.bp_dropdown_menu_module_uppercased--8752a{
|
|
2782
|
+
text-transform:uppercase;
|
|
2783
|
+
}
|
|
2778
2784
|
|
|
2779
|
-
.bp_dropdown_menu_module_ellipsis--
|
|
2785
|
+
.bp_dropdown_menu_module_ellipsis--8752a{
|
|
2780
2786
|
overflow:hidden;
|
|
2781
2787
|
text-overflow:ellipsis;
|
|
2782
2788
|
white-space:nowrap;
|
|
2783
2789
|
}
|
|
2784
2790
|
|
|
2785
|
-
.bp_dropdown_menu_module_checkmark--
|
|
2791
|
+
.bp_dropdown_menu_module_checkmark--8752a{
|
|
2786
2792
|
align-items:center;
|
|
2787
2793
|
display:inline-flex;
|
|
2788
2794
|
justify-content:center;
|
|
@@ -2790,7 +2796,7 @@
|
|
|
2790
2796
|
position:absolute;
|
|
2791
2797
|
}
|
|
2792
2798
|
|
|
2793
|
-
.bp_dropdown_menu_module_item--
|
|
2799
|
+
.bp_dropdown_menu_module_item--8752a,.bp_dropdown_menu_module_subMenuTrigger--8752a{
|
|
2794
2800
|
align-items:center;
|
|
2795
2801
|
border:var(--border-2) solid #0000;
|
|
2796
2802
|
border-radius:var(--radius-3);
|
|
@@ -2802,30 +2808,30 @@
|
|
|
2802
2808
|
-webkit-user-select:none;
|
|
2803
2809
|
user-select:none;
|
|
2804
2810
|
}
|
|
2805
|
-
.bp_dropdown_menu_module_item--
|
|
2811
|
+
.bp_dropdown_menu_module_item--8752a[data-disabled],.bp_dropdown_menu_module_subMenuTrigger--8752a[data-disabled]{
|
|
2806
2812
|
opacity:60%;
|
|
2807
2813
|
pointer-events:none;
|
|
2808
2814
|
}
|
|
2809
|
-
.bp_dropdown_menu_module_item--
|
|
2815
|
+
.bp_dropdown_menu_module_item--8752a[data-highlighted],.bp_dropdown_menu_module_subMenuTrigger--8752a[data-highlighted]{
|
|
2810
2816
|
background-color:var(--surface-menu-surface-hover);
|
|
2811
2817
|
border:var(--border-2) solid var(--outline-focus-on-light);
|
|
2812
2818
|
}
|
|
2813
|
-
.bp_dropdown_menu_module_item--
|
|
2819
|
+
.bp_dropdown_menu_module_item--8752a:active,.bp_dropdown_menu_module_subMenuTrigger--8752a:active{
|
|
2814
2820
|
background-color:var(--surface-menu-surface-hover);
|
|
2815
2821
|
border:var(--border-2) solid #0000;
|
|
2816
2822
|
}
|
|
2817
|
-
.bp_dropdown_menu_module_item--
|
|
2823
|
+
.bp_dropdown_menu_module_item--8752a:hover,.bp_dropdown_menu_module_item--8752a[data-state=open],.bp_dropdown_menu_module_subMenuTrigger--8752a:hover,.bp_dropdown_menu_module_subMenuTrigger--8752a[data-state=open]{
|
|
2818
2824
|
background-color:var(--surface-menu-surface-hover);
|
|
2819
2825
|
}
|
|
2820
|
-
.bp_dropdown_menu_module_item--
|
|
2826
|
+
.bp_dropdown_menu_module_item--8752a.bp_dropdown_menu_module_checkboxItem--8752a,.bp_dropdown_menu_module_item--8752a.bp_dropdown_menu_module_radioItem--8752a,.bp_dropdown_menu_module_subMenuTrigger--8752a.bp_dropdown_menu_module_checkboxItem--8752a,.bp_dropdown_menu_module_subMenuTrigger--8752a.bp_dropdown_menu_module_radioItem--8752a{
|
|
2821
2827
|
padding:.4375rem .5rem .4375rem calc(var(--space-2) + var(--space-4) + var(--space-4));
|
|
2822
2828
|
}
|
|
2823
2829
|
|
|
2824
|
-
.bp_dropdown_menu_module_dropdownMenuItemSeparator--
|
|
2830
|
+
.bp_dropdown_menu_module_dropdownMenuItemSeparator--8752a{
|
|
2825
2831
|
margin-block:var(--space-2);
|
|
2826
2832
|
}
|
|
2827
2833
|
|
|
2828
|
-
.bp_dropdown_menu_module_menuHeader--
|
|
2834
|
+
.bp_dropdown_menu_module_menuHeader--8752a{
|
|
2829
2835
|
align-items:center;
|
|
2830
2836
|
box-shadow:var(--dropshadow-1);
|
|
2831
2837
|
display:grid;
|
|
@@ -2835,15 +2841,15 @@
|
|
|
2835
2841
|
padding:var(--space-3);
|
|
2836
2842
|
}
|
|
2837
2843
|
|
|
2838
|
-
.bp_dropdown_menu_module_headerTextContent--
|
|
2844
|
+
.bp_dropdown_menu_module_headerTextContent--8752a{
|
|
2839
2845
|
display:grid;
|
|
2840
2846
|
}
|
|
2841
2847
|
|
|
2842
|
-
.bp_dropdown_menu_module_submenuCloseButton--
|
|
2848
|
+
.bp_dropdown_menu_module_submenuCloseButton--8752a{
|
|
2843
2849
|
grid-area:submenu-close;
|
|
2844
2850
|
}
|
|
2845
2851
|
|
|
2846
|
-
.bp_dropdown_menu_module_menuCloseButton--
|
|
2852
|
+
.bp_dropdown_menu_module_menuCloseButton--8752a{
|
|
2847
2853
|
grid-area:close;
|
|
2848
2854
|
}
|
|
2849
2855
|
|
|
@@ -24,6 +24,7 @@ import '../primitives/dropdown-menu/dropdown-menu-sub-menu-content.js';
|
|
|
24
24
|
import '../primitives/dropdown-menu/dropdown-menu-sub-menu-root.js';
|
|
25
25
|
import '../primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.js';
|
|
26
26
|
import '../primitives/dropdown-menu/dropdown-menu-trigger.js';
|
|
27
|
+
import '../primitives/dropdown-menu/dropdown-menu-sub-header.js';
|
|
27
28
|
|
|
28
29
|
const Cell = Cell$1;
|
|
29
30
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Space2, Space4 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
2
3
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import { forwardRef, Children, isValidElement } from 'react';
|
|
@@ -22,6 +23,8 @@ const sortMenuChildren = children => {
|
|
|
22
23
|
OtherChildren: []
|
|
23
24
|
});
|
|
24
25
|
};
|
|
26
|
+
const DEFAULT_COLLISION_PADDING = parseInt(Space4, 10);
|
|
27
|
+
const SIDE_OFFSET = parseInt(Space2, 10);
|
|
25
28
|
/**
|
|
26
29
|
* Based on Radix-UI Content
|
|
27
30
|
* @see https://www.radix-ui.com/docs/primitives/components/dropdown-menu#content
|
|
@@ -30,6 +33,7 @@ const DropdownMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
30
33
|
const {
|
|
31
34
|
children,
|
|
32
35
|
container,
|
|
36
|
+
collisionPadding = DEFAULT_COLLISION_PADDING,
|
|
33
37
|
className,
|
|
34
38
|
...rest
|
|
35
39
|
} = props;
|
|
@@ -63,8 +67,8 @@ const DropdownMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
63
67
|
...rest,
|
|
64
68
|
ref: forwardedRef,
|
|
65
69
|
className: clsx(styles.content, className),
|
|
66
|
-
|
|
67
|
-
sideOffset:
|
|
70
|
+
collisionPadding: collisionPadding,
|
|
71
|
+
sideOffset: SIDE_OFFSET,
|
|
68
72
|
children: children
|
|
69
73
|
})
|
|
70
74
|
})
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
export type DropdownMenuSubheaderProps = DropdownMenuPrimitive.DropdownMenuLabelProps;
|
|
3
|
+
export declare const DropdownMenuSubHeader: import("react").ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { Text } from '../../text/text.js';
|
|
6
|
+
import styles from './dropdown-menu.module.js';
|
|
7
|
+
|
|
8
|
+
const DropdownMenuSubHeader = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
...rest
|
|
13
|
+
} = props;
|
|
14
|
+
return jsx(DropdownMenuPrimitive.Label, {
|
|
15
|
+
...rest,
|
|
16
|
+
ref: forwardedRef,
|
|
17
|
+
children: jsx(Text, {
|
|
18
|
+
as: "div",
|
|
19
|
+
className: clsx(styles.ellipsis, styles.subheader, styles.uppercased, className),
|
|
20
|
+
color: "textOnLightSecondary",
|
|
21
|
+
variant: "label",
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
DropdownMenuSubHeader.displayName = 'DropdownMenuSubHeader';
|
|
27
|
+
|
|
28
|
+
export { DropdownMenuSubHeader };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Space3, Space4 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
2
3
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import { forwardRef, useCallback } from 'react';
|
|
@@ -6,6 +7,8 @@ import { useFullScreenDropdownMenu } from '../menu-utils/responsiveness/FullScre
|
|
|
6
7
|
import { sortMenuChildren } from './dropdown-menu-content.js';
|
|
7
8
|
import styles from './dropdown-menu.module.js';
|
|
8
9
|
|
|
10
|
+
const DEFAULT_COLLISION_PADDING = parseInt(Space4, 10);
|
|
11
|
+
const SIDE_OFFSET = parseInt(Space3, 10);
|
|
9
12
|
/**
|
|
10
13
|
* Based on Radix-UI Sub Content
|
|
11
14
|
* @see https://www.radix-ui.com/docs/primitives/components/dropdown-menu#subcontent
|
|
@@ -14,6 +17,7 @@ const DropdownMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
14
17
|
const {
|
|
15
18
|
children,
|
|
16
19
|
container,
|
|
20
|
+
collisionPadding = DEFAULT_COLLISION_PADDING,
|
|
17
21
|
className,
|
|
18
22
|
...rest
|
|
19
23
|
} = props;
|
|
@@ -51,7 +55,8 @@ const DropdownMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
51
55
|
...rest,
|
|
52
56
|
ref: forwardedRef,
|
|
53
57
|
className: clsx(styles.content, className),
|
|
54
|
-
|
|
58
|
+
collisionPadding: collisionPadding,
|
|
59
|
+
sideOffset: SIDE_OFFSET,
|
|
55
60
|
children: children
|
|
56
61
|
})
|
|
57
62
|
})
|
|
@@ -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--8752a","fullScreenContent":"bp_dropdown_menu_module_fullScreenContent--8752a","subheader":"bp_dropdown_menu_module_subheader--8752a","uppercased":"bp_dropdown_menu_module_uppercased--8752a","ellipsis":"bp_dropdown_menu_module_ellipsis--8752a","checkmark":"bp_dropdown_menu_module_checkmark--8752a","item":"bp_dropdown_menu_module_item--8752a","subMenuTrigger":"bp_dropdown_menu_module_subMenuTrigger--8752a","radioItem":"bp_dropdown_menu_module_radioItem--8752a","checkboxItem":"bp_dropdown_menu_module_checkboxItem--8752a","dropdownMenuItemSeparator":"bp_dropdown_menu_module_dropdownMenuItemSeparator--8752a","menuHeader":"bp_dropdown_menu_module_menuHeader--8752a","headerTextContent":"bp_dropdown_menu_module_headerTextContent--8752a","submenuCloseButton":"bp_dropdown_menu_module_submenuCloseButton--8752a","menuCloseButton":"bp_dropdown_menu_module_menuCloseButton--8752a"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -28,6 +28,7 @@ export declare const DropdownMenu: {
|
|
|
28
28
|
subtitle?: string;
|
|
29
29
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
30
|
};
|
|
31
|
+
SubHeader: import("react").ForwardRefExoticComponent<import("@radix-ui/react-dropdown-menu").DropdownMenuLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
32
|
};
|
|
32
33
|
export { type DropdownMenuContentProps } from './dropdown-menu-content';
|
|
33
34
|
export { type DropdownMenuItemProps } from './dropdown-menu-item';
|
|
@@ -11,6 +11,7 @@ import { DropdownMenuSubMenuContent } from './dropdown-menu-sub-menu-content.js'
|
|
|
11
11
|
import { DropdownMenuSubMenuRoot } from './dropdown-menu-sub-menu-root.js';
|
|
12
12
|
import { DropdownMenuSubMenuTrigger } from './dropdown-menu-sub-menu-trigger.js';
|
|
13
13
|
import { DropdownMenuTrigger } from './dropdown-menu-trigger.js';
|
|
14
|
+
import { DropdownMenuSubHeader } from './dropdown-menu-sub-header.js';
|
|
14
15
|
|
|
15
16
|
const DropdownMenu = {
|
|
16
17
|
Root: DropdownMenuRoot,
|
|
@@ -25,7 +26,8 @@ const DropdownMenu = {
|
|
|
25
26
|
SubMenuRoot: DropdownMenuSubMenuRoot,
|
|
26
27
|
SubMenuTrigger: DropdownMenuSubMenuTrigger,
|
|
27
28
|
SubMenuContent: DropdownMenuSubMenuContent,
|
|
28
|
-
Header: DropdownMenuHeader
|
|
29
|
+
Header: DropdownMenuHeader,
|
|
30
|
+
SubHeader: DropdownMenuSubHeader
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
export { DropdownMenu };
|
|
@@ -2,7 +2,7 @@ import { type HTMLAttributes, type LabelHTMLAttributes } from 'react';
|
|
|
2
2
|
import { type StyledText } from '../utils/commonTypes';
|
|
3
3
|
type TypographyVariant = 'titleMondo' | 'titleXLarge' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'subtitle' | 'bodyLargeBold' | 'bodyLarge' | 'bodyDefaultBold' | 'bodyDefaultSemibold' | 'bodyDefault' | 'caption' | 'labelBold' | 'label';
|
|
4
4
|
type TypographyColors = 'textOnLightDefault' | 'textOnLightSecondary' | 'textOnLightLink' | 'textOnDarkDefault';
|
|
5
|
-
type Element = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'legend' | 'label';
|
|
5
|
+
type Element = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'legend' | 'label' | 'div';
|
|
6
6
|
interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
7
7
|
as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
8
|
}
|
|
@@ -18,8 +18,11 @@ interface LegendProps extends HTMLAttributes<HTMLLegendElement> {
|
|
|
18
18
|
interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
19
19
|
as: 'label';
|
|
20
20
|
}
|
|
21
|
+
interface DivProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
as: 'div';
|
|
23
|
+
}
|
|
21
24
|
/** Supported HTML elements for text */
|
|
22
|
-
export type ElementTypes = HeadingProps | ParagraphProps | LegendProps | SpanProps | LabelProps;
|
|
25
|
+
export type ElementTypes = HeadingProps | ParagraphProps | LegendProps | SpanProps | LabelProps | DivProps;
|
|
23
26
|
export type TextProps = {
|
|
24
27
|
/** The HTML element type which will render */
|
|
25
28
|
as: Element;
|