@box/blueprint-web 11.3.0 → 11.4.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 +27 -15
- package/dist/lib-esm/primitives/popover/popover-content-container.js +21 -4
- package/dist/lib-esm/primitives/popover/popover-footer.js +1 -1
- package/dist/lib-esm/primitives/popover/popover-main-content.js +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.js +12 -4
- package/dist/lib-esm/primitives/popover/popover.module.js +1 -1
- package/dist/lib-esm/primitives/popover/utils/popover-modality-context.d.ts +4 -0
- package/dist/lib-esm/primitives/popover/utils/popover-modality-context.js +9 -0
- package/package.json +1 -1
- /package/dist/lib-esm/primitives/popover/{popover-overflow-context.d.ts → utils/popover-overflow-context.d.ts} +0 -0
- /package/dist/lib-esm/primitives/popover/{popover-overflow-context.js → utils/popover-overflow-context.js} +0 -0
package/dist/lib-esm/index.css
CHANGED
|
@@ -5186,41 +5186,53 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
5186
5186
|
fill:currentColor;
|
|
5187
5187
|
}
|
|
5188
5188
|
|
|
5189
|
-
.bp_popover_module_popoverMainContent--
|
|
5189
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverMainContent--6c3e0,.bp_popover_module_popoverContentContainer--6c3e0.bp_popover_module_accessibilitySmallBreakpoint--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverScrollContainer--6c3e0{
|
|
5190
|
+
margin-inline-end:calc(var(--space-4)*-1);
|
|
5190
5191
|
mask-image:linear-gradient(to top, #0000, var(--gray-black)), linear-gradient(to left, #0000 var(--space-4), var(--gray-black) var(--space-4));
|
|
5192
|
+
mask-position:left bottom;
|
|
5193
|
+
mask-size:100% 20000px;
|
|
5191
5194
|
overflow-y:auto;
|
|
5195
|
+
padding-right:var(--space-4);
|
|
5196
|
+
transition:mask-position var(--animation-duration-3);
|
|
5192
5197
|
}
|
|
5193
5198
|
|
|
5194
|
-
.bp_popover_module_popoverContentContainer--
|
|
5199
|
+
.bp_popover_module_popoverContentContainer--6c3e0{
|
|
5195
5200
|
max-width:320px;
|
|
5196
5201
|
z-index:380;
|
|
5197
5202
|
}
|
|
5198
|
-
.bp_popover_module_popoverContentContainer--
|
|
5203
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverCard--6c3e0{
|
|
5199
5204
|
box-shadow:var(--dropshadow-3);
|
|
5200
5205
|
margin-block:var(--space-1);
|
|
5201
5206
|
}
|
|
5202
|
-
.bp_popover_module_popoverContentContainer--
|
|
5203
|
-
margin-inline-end:calc(var(--space-4)*-1);
|
|
5204
|
-
mask-position:left bottom;
|
|
5205
|
-
mask-size:100% 20000px;
|
|
5206
|
-
padding-right:var(--space-4);
|
|
5207
|
-
transition:mask-position var(--animation-duration-3);
|
|
5208
|
-
}
|
|
5209
|
-
.bp_popover_module_popoverContentContainer--c0ba4 .bp_popover_module_popoverCard--c0ba4 .bp_popover_module_popoverMainContent--c0ba4:hover{
|
|
5207
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverMainContent--6c3e0:hover{
|
|
5210
5208
|
mask-position:left top;
|
|
5211
5209
|
}
|
|
5212
|
-
.bp_popover_module_popoverContentContainer--
|
|
5210
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverMainContent--6c3e0 .bp_popover_module_popoverMainContentOuterContainer--6c3e0{
|
|
5213
5211
|
max-height:inherit;
|
|
5214
5212
|
}
|
|
5215
|
-
.bp_popover_module_popoverContentContainer--
|
|
5213
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverMainContent--6c3e0 .bp_popover_module_popoverMainContentOuterContainer--6c3e0 .bp_popover_module_popoverMainContentInnerContainerPadding--6c3e0{
|
|
5216
5214
|
padding-block-end:var(--space-3);
|
|
5217
5215
|
}
|
|
5218
|
-
.bp_popover_module_popoverContentContainer--
|
|
5216
|
+
.bp_popover_module_popoverContentContainer--6c3e0.bp_popover_module_accessibilitySmallBreakpoint--6c3e0{
|
|
5217
|
+
max-height:var(--radix-popover-content-available-height);
|
|
5218
|
+
}
|
|
5219
|
+
.bp_popover_module_popoverContentContainer--6c3e0.bp_popover_module_accessibilitySmallBreakpoint--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverScrollContainer--6c3e0{
|
|
5220
|
+
max-height:min(var(--blueprint-web-popover-content-max-height, calc(var(--radix-popover-content-available-height) - var(--space-12))), var(--radix-popover-content-available-height) - var(--space-12));
|
|
5221
|
+
padding-block:var(--space-1);
|
|
5222
|
+
}
|
|
5223
|
+
.bp_popover_module_popoverContentContainer--6c3e0.bp_popover_module_accessibilitySmallBreakpoint--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverScrollContainer--6c3e0:hover{
|
|
5224
|
+
mask-position:left top;
|
|
5225
|
+
}
|
|
5226
|
+
.bp_popover_module_popoverContentContainer--6c3e0.bp_popover_module_accessibilitySmallBreakpoint--6c3e0 .bp_popover_module_popoverCard--6c3e0 .bp_popover_module_popoverScrollContainer--6c3e0 .bp_popover_module_popoverMainContent--6c3e0{
|
|
5227
|
+
max-height:-moz-fit-content;
|
|
5228
|
+
max-height:fit-content;
|
|
5229
|
+
}
|
|
5230
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverFooter--6c3e0{
|
|
5219
5231
|
margin-inline:calc(var(--space-4)*-1);
|
|
5220
5232
|
padding-block-start:var(--space-4);
|
|
5221
5233
|
padding-inline:var(--space-4);
|
|
5222
5234
|
}
|
|
5223
|
-
.bp_popover_module_popoverContentContainer--
|
|
5235
|
+
.bp_popover_module_popoverContentContainer--6c3e0 .bp_popover_module_popoverFooter--6c3e0.bp_popover_module_popoverFooterTopBorder--6c3e0{
|
|
5224
5236
|
border-top:var(--border-1) solid var(--border-card-border);
|
|
5225
5237
|
}
|
|
5226
5238
|
.bp_select_menu_grid_module_grid--6e766{
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Space4 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
3
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
|
-
import { forwardRef, useState, useMemo, useCallback } from 'react';
|
|
5
|
+
import { forwardRef, useContext, useState, useMemo, useCallback } from 'react';
|
|
5
6
|
import { Card } from '../../card/card.js';
|
|
7
|
+
import { useBreakpoint, Breakpoint } from '../../utils/useBreakpoint.js';
|
|
6
8
|
import { focusRadioGroupFirstIfExists } from './popover-focus-utils.js';
|
|
7
|
-
import { PopoverOverflowContext } from './popover-overflow-context.js';
|
|
8
9
|
import styles from './popover.module.js';
|
|
10
|
+
import { PopoverModalityContext } from './utils/popover-modality-context.js';
|
|
11
|
+
import { PopoverOverflowContext } from './utils/popover-overflow-context.js';
|
|
9
12
|
|
|
13
|
+
const DEFAULT_COLLISION_PADDING = parseInt(Space4, 10);
|
|
10
14
|
/**
|
|
11
15
|
* Based on Radix-UI Popover Content
|
|
12
16
|
* @see https://www.radix-ui.com/primitives/docs/components/popover#content
|
|
@@ -15,10 +19,17 @@ const PopoverContentContainer = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
15
19
|
const {
|
|
16
20
|
children,
|
|
17
21
|
container,
|
|
22
|
+
collisionPadding = DEFAULT_COLLISION_PADDING,
|
|
18
23
|
className,
|
|
19
24
|
onOpenAutoFocus,
|
|
20
25
|
...rest
|
|
21
26
|
} = props;
|
|
27
|
+
const breakpoint = useBreakpoint();
|
|
28
|
+
const smallBreakpoint = breakpoint <= Breakpoint.Small;
|
|
29
|
+
const {
|
|
30
|
+
isInteractionDisabled
|
|
31
|
+
} = useContext(PopoverModalityContext);
|
|
32
|
+
const accessibilitySmallBreakpoint = smallBreakpoint && isInteractionDisabled;
|
|
22
33
|
const [isContentOverflowing, setIsContentOverflowing] = useState(false);
|
|
23
34
|
const providerValue = useMemo(() => ({
|
|
24
35
|
isContentOverflowing,
|
|
@@ -41,11 +52,17 @@ const PopoverContentContainer = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
41
52
|
children: jsx(RadixPopover.Content, {
|
|
42
53
|
...rest,
|
|
43
54
|
ref: forwardedRef,
|
|
44
|
-
className: clsx(styles.popoverContentContainer,
|
|
55
|
+
className: clsx(styles.popoverContentContainer, {
|
|
56
|
+
[styles.accessibilitySmallBreakpoint]: accessibilitySmallBreakpoint
|
|
57
|
+
}, className),
|
|
58
|
+
collisionPadding: collisionPadding,
|
|
45
59
|
onOpenAutoFocus: handleOpenAutoFocus,
|
|
46
60
|
children: jsx(Card, {
|
|
47
61
|
className: styles.popoverCard,
|
|
48
|
-
children:
|
|
62
|
+
children: jsx("div", {
|
|
63
|
+
className: styles.popoverScrollContainer,
|
|
64
|
+
children: children
|
|
65
|
+
})
|
|
49
66
|
})
|
|
50
67
|
})
|
|
51
68
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { forwardRef, useContext } from 'react';
|
|
4
|
-
import { PopoverOverflowContext } from './popover-overflow-context.js';
|
|
4
|
+
import { PopoverOverflowContext } from './utils/popover-overflow-context.js';
|
|
5
5
|
import styles from './popover.module.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { forwardRef, useContext, useRef, useEffect } from 'react';
|
|
4
|
-
import { PopoverOverflowContext } from './popover-overflow-context.js';
|
|
4
|
+
import { PopoverOverflowContext } from './utils/popover-overflow-context.js';
|
|
5
5
|
import styles from './popover.module.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
|
+
import { PopoverModalityContext } from './utils/popover-modality-context.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* The Popover component has a trigger which displays a Card to the user with customizable content.
|
|
@@ -7,12 +8,19 @@ import * as RadixPopover from '@radix-ui/react-popover';
|
|
|
7
8
|
const PopoverRoot = props => {
|
|
8
9
|
const {
|
|
9
10
|
children,
|
|
11
|
+
modal = true,
|
|
10
12
|
...rest
|
|
11
13
|
} = props;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const isInteractionDisabled = Boolean(modal);
|
|
15
|
+
return jsx(PopoverModalityContext.Provider, {
|
|
16
|
+
value: {
|
|
17
|
+
isInteractionDisabled
|
|
18
|
+
},
|
|
19
|
+
children: jsx(RadixPopover.Root, {
|
|
20
|
+
modal: modal,
|
|
21
|
+
...rest,
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
16
24
|
});
|
|
17
25
|
};
|
|
18
26
|
PopoverRoot.displayName = 'PopoverRoot';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"
|
|
2
|
+
var styles = {"popoverContentContainer":"bp_popover_module_popoverContentContainer--6c3e0","accessibilitySmallBreakpoint":"bp_popover_module_accessibilitySmallBreakpoint--6c3e0","popoverCard":"bp_popover_module_popoverCard--6c3e0","popoverScrollContainer":"bp_popover_module_popoverScrollContainer--6c3e0","popoverMainContent":"bp_popover_module_popoverMainContent--6c3e0","popoverMainContentOuterContainer":"bp_popover_module_popoverMainContentOuterContainer--6c3e0","popoverMainContentInnerContainerPadding":"bp_popover_module_popoverMainContentInnerContainerPadding--6c3e0","popoverFooter":"bp_popover_module_popoverFooter--6c3e0","popoverFooterTopBorder":"bp_popover_module_popoverFooterTopBorder--6c3e0"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
// Provides modality context for the popover.
|
|
4
|
+
// When `isInteractionDisabled` is true, interactions outside the popover are blocked.
|
|
5
|
+
const PopoverModalityContext = /*#__PURE__*/createContext({
|
|
6
|
+
isInteractionDisabled: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { PopoverModalityContext };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|