@box/blueprint-web 11.1.0 → 11.2.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/dist/lib-esm/ellipsizable-text/ellipsizable-text.d.ts +3 -0
- package/dist/lib-esm/ellipsizable-text/ellipsizable-text.js +50 -0
- package/dist/lib-esm/ellipsizable-text/index.d.ts +2 -0
- package/dist/lib-esm/ellipsizable-text/types.d.ts +5 -0
- package/dist/lib-esm/index.css +19 -19
- package/dist/lib-esm/index.d.ts +1 -0
- package/dist/lib-esm/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-menu-content.js +6 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, createRef } from 'react';
|
|
3
|
+
import { Focusable } from '../focusable/focusable.js';
|
|
4
|
+
import { Text } from '../text/text.js';
|
|
5
|
+
import { Tooltip } from '../tooltip/tooltip.js';
|
|
6
|
+
import { useForkRef } from '../utils/useForkRef.js';
|
|
7
|
+
import { useIsEllipsized } from '../utils/useIsEllipsized.js';
|
|
8
|
+
|
|
9
|
+
const Wrapper = ({
|
|
10
|
+
children,
|
|
11
|
+
withTooltip,
|
|
12
|
+
tooltipContent
|
|
13
|
+
}) => {
|
|
14
|
+
if (withTooltip) {
|
|
15
|
+
return jsx(Tooltip, {
|
|
16
|
+
content: tooltipContent,
|
|
17
|
+
children: jsx(Focusable, {
|
|
18
|
+
children: children
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return children;
|
|
23
|
+
};
|
|
24
|
+
const EllipsizableText = /*#__PURE__*/forwardRef(({
|
|
25
|
+
children,
|
|
26
|
+
lineClamp,
|
|
27
|
+
style,
|
|
28
|
+
...rest
|
|
29
|
+
}, forwardedRef) => {
|
|
30
|
+
const textRef = /*#__PURE__*/createRef();
|
|
31
|
+
const isEllipsized = useIsEllipsized(textRef);
|
|
32
|
+
return jsx(Wrapper, {
|
|
33
|
+
tooltipContent: children,
|
|
34
|
+
withTooltip: isEllipsized,
|
|
35
|
+
children: jsx(Text, {
|
|
36
|
+
ref: useForkRef(textRef, forwardedRef),
|
|
37
|
+
...rest,
|
|
38
|
+
style: {
|
|
39
|
+
...style,
|
|
40
|
+
display: '-webkit-box',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
WebkitBoxOrient: 'vertical',
|
|
43
|
+
WebkitLineClamp: lineClamp.toString()
|
|
44
|
+
},
|
|
45
|
+
children: children
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export { EllipsizableText };
|
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,24 +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--
|
|
2778
|
+
.bp_dropdown_menu_module_content--8752a .bp_dropdown_menu_module_subheader--8752a{
|
|
2779
2779
|
padding:var(--space-2);
|
|
2780
2780
|
}
|
|
2781
|
-
.bp_dropdown_menu_module_content--
|
|
2781
|
+
.bp_dropdown_menu_module_content--8752a .bp_dropdown_menu_module_subheader--8752a.bp_dropdown_menu_module_uppercased--8752a{
|
|
2782
2782
|
text-transform:uppercase;
|
|
2783
2783
|
}
|
|
2784
2784
|
|
|
2785
|
-
.bp_dropdown_menu_module_ellipsis--
|
|
2785
|
+
.bp_dropdown_menu_module_ellipsis--8752a{
|
|
2786
2786
|
overflow:hidden;
|
|
2787
2787
|
text-overflow:ellipsis;
|
|
2788
2788
|
white-space:nowrap;
|
|
2789
2789
|
}
|
|
2790
2790
|
|
|
2791
|
-
.bp_dropdown_menu_module_checkmark--
|
|
2791
|
+
.bp_dropdown_menu_module_checkmark--8752a{
|
|
2792
2792
|
align-items:center;
|
|
2793
2793
|
display:inline-flex;
|
|
2794
2794
|
justify-content:center;
|
|
@@ -2796,7 +2796,7 @@
|
|
|
2796
2796
|
position:absolute;
|
|
2797
2797
|
}
|
|
2798
2798
|
|
|
2799
|
-
.bp_dropdown_menu_module_item--
|
|
2799
|
+
.bp_dropdown_menu_module_item--8752a,.bp_dropdown_menu_module_subMenuTrigger--8752a{
|
|
2800
2800
|
align-items:center;
|
|
2801
2801
|
border:var(--border-2) solid #0000;
|
|
2802
2802
|
border-radius:var(--radius-3);
|
|
@@ -2808,30 +2808,30 @@
|
|
|
2808
2808
|
-webkit-user-select:none;
|
|
2809
2809
|
user-select:none;
|
|
2810
2810
|
}
|
|
2811
|
-
.bp_dropdown_menu_module_item--
|
|
2811
|
+
.bp_dropdown_menu_module_item--8752a[data-disabled],.bp_dropdown_menu_module_subMenuTrigger--8752a[data-disabled]{
|
|
2812
2812
|
opacity:60%;
|
|
2813
2813
|
pointer-events:none;
|
|
2814
2814
|
}
|
|
2815
|
-
.bp_dropdown_menu_module_item--
|
|
2815
|
+
.bp_dropdown_menu_module_item--8752a[data-highlighted],.bp_dropdown_menu_module_subMenuTrigger--8752a[data-highlighted]{
|
|
2816
2816
|
background-color:var(--surface-menu-surface-hover);
|
|
2817
2817
|
border:var(--border-2) solid var(--outline-focus-on-light);
|
|
2818
2818
|
}
|
|
2819
|
-
.bp_dropdown_menu_module_item--
|
|
2819
|
+
.bp_dropdown_menu_module_item--8752a:active,.bp_dropdown_menu_module_subMenuTrigger--8752a:active{
|
|
2820
2820
|
background-color:var(--surface-menu-surface-hover);
|
|
2821
2821
|
border:var(--border-2) solid #0000;
|
|
2822
2822
|
}
|
|
2823
|
-
.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]{
|
|
2824
2824
|
background-color:var(--surface-menu-surface-hover);
|
|
2825
2825
|
}
|
|
2826
|
-
.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{
|
|
2827
2827
|
padding:.4375rem .5rem .4375rem calc(var(--space-2) + var(--space-4) + var(--space-4));
|
|
2828
2828
|
}
|
|
2829
2829
|
|
|
2830
|
-
.bp_dropdown_menu_module_dropdownMenuItemSeparator--
|
|
2830
|
+
.bp_dropdown_menu_module_dropdownMenuItemSeparator--8752a{
|
|
2831
2831
|
margin-block:var(--space-2);
|
|
2832
2832
|
}
|
|
2833
2833
|
|
|
2834
|
-
.bp_dropdown_menu_module_menuHeader--
|
|
2834
|
+
.bp_dropdown_menu_module_menuHeader--8752a{
|
|
2835
2835
|
align-items:center;
|
|
2836
2836
|
box-shadow:var(--dropshadow-1);
|
|
2837
2837
|
display:grid;
|
|
@@ -2841,15 +2841,15 @@
|
|
|
2841
2841
|
padding:var(--space-3);
|
|
2842
2842
|
}
|
|
2843
2843
|
|
|
2844
|
-
.bp_dropdown_menu_module_headerTextContent--
|
|
2844
|
+
.bp_dropdown_menu_module_headerTextContent--8752a{
|
|
2845
2845
|
display:grid;
|
|
2846
2846
|
}
|
|
2847
2847
|
|
|
2848
|
-
.bp_dropdown_menu_module_submenuCloseButton--
|
|
2848
|
+
.bp_dropdown_menu_module_submenuCloseButton--8752a{
|
|
2849
2849
|
grid-area:submenu-close;
|
|
2850
2850
|
}
|
|
2851
2851
|
|
|
2852
|
-
.bp_dropdown_menu_module_menuCloseButton--
|
|
2852
|
+
.bp_dropdown_menu_module_menuCloseButton--8752a{
|
|
2853
2853
|
grid-area:close;
|
|
2854
2854
|
}
|
|
2855
2855
|
|
package/dist/lib-esm/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './content-field';
|
|
|
17
17
|
export * from './data-table/data-table';
|
|
18
18
|
export * from './date-picker';
|
|
19
19
|
export * from './divider';
|
|
20
|
+
export * from './ellipsizable-text';
|
|
20
21
|
export * from './empty-state';
|
|
21
22
|
export * from './focusable';
|
|
22
23
|
export * from './ghost';
|
package/dist/lib-esm/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { ContentField } from './content-field/content-field.js';
|
|
|
21
21
|
export { DataTableWrapper, StickyCell } from './data-table/data-table.js';
|
|
22
22
|
export { DatePicker } from './date-picker/date-picker.js';
|
|
23
23
|
export { Divider } from './divider/divider.js';
|
|
24
|
+
export { EllipsizableText } from './ellipsizable-text/ellipsizable-text.js';
|
|
24
25
|
export { EmptyState } from './empty-state/empty-state.js';
|
|
25
26
|
export { Focusable } from './focusable/focusable.js';
|
|
26
27
|
export { Ghost } from './ghost/ghost.js';
|
|
@@ -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
|
})
|
|
@@ -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 };
|