@box/blueprint-web 19.5.0 → 20.0.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/THIRD_PARTY_LICENSES +119 -0
- package/dist/lib-esm/accordion/accordion.js +14 -6
- package/dist/lib-esm/accordion/accordion.module.js +1 -1
- package/dist/lib-esm/accordion/types.d.ts +1 -1
- package/dist/lib-esm/blueprint-configuration-context/consts.d.ts +1 -1
- package/dist/lib-esm/blueprint-configuration-context/consts.js +1 -1
- package/dist/lib-esm/checkbox/checkbox-item.js +3 -3
- package/dist/lib-esm/checkbox/types.d.ts +1 -1
- package/dist/lib-esm/collapsible/collapsible-section.js +5 -5
- package/dist/lib-esm/collapsible/types.d.ts +1 -1
- package/dist/lib-esm/combobox-group/combobox-group-combobox.js +1 -1
- package/dist/lib-esm/components.css +400 -280
- package/dist/lib-esm/date-picker/date-picker.js +8 -7
- package/dist/lib-esm/guided-tooltip/guided-tooltip.js +7 -7
- package/dist/lib-esm/guided-tooltip/types.d.ts +1 -1
- package/dist/lib-esm/index.css +400 -280
- package/dist/lib-esm/modal/alert-modal.types.d.ts +1 -1
- package/dist/lib-esm/modal/modal-close.js +2 -2
- package/dist/lib-esm/modal/modal-content.d.ts +1 -1
- package/dist/lib-esm/modal/modal-content.js +4 -4
- package/dist/lib-esm/modal/modal-description.js +2 -2
- package/dist/lib-esm/modal/modal-title.js +2 -2
- package/dist/lib-esm/modal/modal-trigger.js +2 -2
- package/dist/lib-esm/modal/modal.d.ts +1 -1
- package/dist/lib-esm/modal/modal.js +1 -1
- package/dist/lib-esm/modal/types.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/index.d.ts +4 -2
- package/dist/lib-esm/navigation-menu/navigation-menu-item.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/navigation-menu-trigger.d.ts +3 -1
- package/dist/lib-esm/primitives/chips/chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/chip.js +2 -2
- package/dist/lib-esm/primitives/chips/chips-group.js +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip-button.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-combo-chip.d.ts +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/index.d.ts +5 -5
- package/dist/lib-esm/primitives/chips/types.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-item.js +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-header.js +3 -10
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/index.d.ts +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/index.d.ts +14 -8
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.d.ts +15 -0
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.js +49 -0
- package/dist/lib-esm/primitives/notification/notification-provider.js +2 -2
- package/dist/lib-esm/primitives/notification/notification.viewport-animated.js +12 -8
- package/dist/lib-esm/primitives/notification/notification.viewport.js +5 -1
- package/dist/lib-esm/primitives/notification/private-notification-element-animated.js +44 -6
- package/dist/lib-esm/primitives/notification/private-notification-element.js +34 -4
- package/dist/lib-esm/primitives/popover/index.d.ts +11 -5
- package/dist/lib-esm/primitives/popover/popover-anchor.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-anchor.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-close.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-close.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-content-container.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-content-container.js +3 -3
- package/dist/lib-esm/primitives/popover/popover-footer.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-main-content.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.js +2 -2
- package/dist/lib-esm/radio-group/index.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.js +2 -2
- package/dist/lib-esm/radio-group/radio-item.js +3 -3
- package/dist/lib-esm/radio-group/types.d.ts +1 -1
- package/dist/lib-esm/select/select.js +12 -12
- package/dist/lib-esm/select/types.d.ts +1 -1
- package/dist/lib-esm/select/utils/use-select-exit-animation.d.ts +3 -3
- package/dist/lib-esm/select/utils/use-select-exit-animation.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-close.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-content.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-header.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-overlay.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-trigger.js +2 -2
- package/dist/lib-esm/side-panel/side-panel.js +1 -1
- package/dist/lib-esm/side-panel/types.d.ts +1 -1
- package/dist/lib-esm/small-list-item/small-list.js +8 -0
- package/dist/lib-esm/switch/switch-item.js +3 -3
- package/dist/lib-esm/switch/types.d.ts +1 -1
- package/dist/lib-esm/toolbar/index.d.ts +2 -2
- package/dist/lib-esm/toolbar/toolbar-button.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-input.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-link.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-root.js +3 -3
- package/dist/lib-esm/toolbar/toolbar-separator.d.ts +1 -1
- package/dist/lib-esm/toolbar/toolbar-separator.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-text-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.d.ts +1 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/types.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.js +6 -6
- package/dist/lib-esm/tooltip/types.d.ts +1 -1
- package/dist/lib-esm/util-components/base-grid-list-item/base-grid-list-item.module.js +1 -1
- package/dist/lib-esm/utils/TooltipWrapper.d.ts +1 -1
- package/dist/lib-esm/utils/radix-compat/accordion.d.ts +45 -0
- package/dist/lib-esm/utils/radix-compat/accordion.js +299 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.js +16 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.js +70 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.js +6 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.d.ts +18 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.js +131 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.d.ts +33 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.js +133 -0
- package/dist/lib-esm/utils/radix-compat/collection.d.ts +21 -0
- package/dist/lib-esm/utils/radix-compat/collection.js +82 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.js +44 -0
- package/dist/lib-esm/utils/radix-compat/content-size.d.ts +15 -0
- package/dist/lib-esm/utils/radix-compat/content-size.js +61 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.d.ts +56 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.js +191 -0
- package/dist/lib-esm/utils/radix-compat/dialog.d.ts +50 -0
- package/dist/lib-esm/utils/radix-compat/dialog.js +367 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.js +12 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.d.ts +34 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.js +205 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.d.ts +57 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.js +187 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.js +41 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.d.ts +37 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.js +288 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.d.ts +6 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.js +18 -0
- package/dist/lib-esm/utils/radix-compat/index.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/layers.d.ts +25 -0
- package/dist/lib-esm/utils/radix-compat/layers.js +61 -0
- package/dist/lib-esm/utils/radix-compat/menu.d.ts +98 -0
- package/dist/lib-esm/utils/radix-compat/menu.js +1041 -0
- package/dist/lib-esm/utils/radix-compat/popover.d.ts +44 -0
- package/dist/lib-esm/utils/radix-compat/popover.js +386 -0
- package/dist/lib-esm/utils/radix-compat/popper.d.ts +60 -0
- package/dist/lib-esm/utils/radix-compat/popper.js +416 -0
- package/dist/lib-esm/utils/radix-compat/portal.d.ts +11 -0
- package/dist/lib-esm/utils/radix-compat/portal.js +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.d.ts +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.js +110 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.d.ts +27 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.js +189 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.d.ts +35 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.js +237 -0
- package/dist/lib-esm/utils/radix-compat/select.d.ts +82 -0
- package/dist/lib-esm/utils/radix-compat/select.js +901 -0
- package/dist/lib-esm/utils/radix-compat/slot.d.ts +31 -0
- package/dist/lib-esm/utils/radix-compat/slot.js +119 -0
- package/dist/lib-esm/utils/radix-compat/store-options.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/store-options.js +10 -0
- package/dist/lib-esm/utils/radix-compat/switch.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/switch.js +97 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.d.ts +41 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.js +195 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.d.ts +32 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.js +136 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.d.ts +59 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.js +636 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.d.ts +22 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.js +64 -0
- package/dist/lib-esm/utils/radix-compat/types.d.ts +53 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.js +28 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.d.ts +2 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.js +24 -0
- package/package.json +8 -19
|
@@ -3,16 +3,38 @@ import { XMark } from '@box/blueprint-web-assets/icons/Medium';
|
|
|
3
3
|
import { bpDurationLong } from '@box/blueprint-web-assets/tokens/tokens';
|
|
4
4
|
import * as Toast from '@radix-ui/react-toast';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { useMemo, useCallback, useRef, useEffect, useState } from 'react';
|
|
6
|
+
import { useMemo, useCallback, useRef, useEffect, useState, useLayoutEffect } from 'react';
|
|
7
7
|
import { composeEventHandlers } from '../../utils/composeEventHandlers.js';
|
|
8
8
|
import { IconButton } from '../icon-button/icon-button.js';
|
|
9
9
|
import { useNotificationExitAnimation, handleNotificationExitTransitionEnd } from './hooks/use-notification-exit-animation.js';
|
|
10
|
+
import { useNotificationLayer } from './hooks/use-notification-layer.js';
|
|
10
11
|
import { isOpenNotification } from './notification-stack-utils.js';
|
|
11
12
|
import stackStyles from './notification-stack.module.js';
|
|
12
13
|
import styles from './notification.module.js';
|
|
13
14
|
import { getIcon } from './private-notification-element.js';
|
|
14
15
|
import { truncateNotificationCopy } from './truncate-notification-copy.js';
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Radix Toast only calls the ref the toast element mounted with, while `layerRef` changes with the depth of the
|
|
19
|
+
* toast. The returned ref passes the element to the current `layerRef`, and moves it over when `layerRef` changes.
|
|
20
|
+
*/
|
|
21
|
+
function useCurrentLayerRef(layerRef) {
|
|
22
|
+
const nodeRef = useRef(null);
|
|
23
|
+
const layerRefRef = useRef(layerRef);
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
const previousLayerRef = layerRefRef.current;
|
|
26
|
+
layerRefRef.current = layerRef;
|
|
27
|
+
if (previousLayerRef === layerRef || !nodeRef.current) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
previousLayerRef?.(null);
|
|
31
|
+
layerRef?.(nodeRef.current);
|
|
32
|
+
}, [layerRef]);
|
|
33
|
+
return useCallback(node => {
|
|
34
|
+
nodeRef.current = node;
|
|
35
|
+
layerRefRef.current?.(node);
|
|
36
|
+
}, []);
|
|
37
|
+
}
|
|
16
38
|
/**
|
|
17
39
|
* Stacked-deck toast. Loaded only from the animated viewport chunk so the flat
|
|
18
40
|
* Notification path stays off the first-paint graph.
|
|
@@ -41,6 +63,7 @@ function AnimatedPrivateNotificationElement(props) {
|
|
|
41
63
|
...rest
|
|
42
64
|
} = props;
|
|
43
65
|
const iconComponent = useMemo(() => getIcon(typeIconAriaLabel, variant), [typeIconAriaLabel, variant]);
|
|
66
|
+
const currentLayerRef = useCurrentLayerRef(layerRef);
|
|
44
67
|
// Radix's own viewport-wide pause-on-hover/focus (`Toast.Provider`'s `toast.viewportPause`/
|
|
45
68
|
// `viewportResume` events) already covers pausing auto-dismiss while the user is interacting
|
|
46
69
|
// with the stack — no bespoke pause context is ported from EndUserApp here.
|
|
@@ -88,12 +111,22 @@ function AnimatedPrivateNotificationElement(props) {
|
|
|
88
111
|
// onEscapeKeyDown (pulled out of `rest` so it isn't clobbered by this one) — it runs
|
|
89
112
|
// first and can call preventDefault() to suppress both Radix's close and this attribution.
|
|
90
113
|
const exitReasonRef = useRef(null);
|
|
114
|
+
const {
|
|
115
|
+
leaveEscapeToOverlay,
|
|
116
|
+
isCloseLeftToOverlay
|
|
117
|
+
} = useNotificationLayer(open !== false);
|
|
91
118
|
const handleEscapeKeyDown = useCallback(event => {
|
|
92
119
|
onEscapeKeyDown?.(event);
|
|
93
|
-
if (!event.defaultPrevented) {
|
|
120
|
+
if (!event.defaultPrevented && !leaveEscapeToOverlay(event)) {
|
|
94
121
|
exitReasonRef.current = 'escape';
|
|
95
122
|
}
|
|
96
|
-
}, [onEscapeKeyDown]);
|
|
123
|
+
}, [leaveEscapeToOverlay, onEscapeKeyDown]);
|
|
124
|
+
const handleToastOpenChange = useCallback(nextOpen => {
|
|
125
|
+
if (!nextOpen && isCloseLeftToOverlay()) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
handleOpenChange(nextOpen);
|
|
129
|
+
}, [handleOpenChange, isCloseLeftToOverlay]);
|
|
97
130
|
useEffect(() => {
|
|
98
131
|
if (!hasExitStyles) {
|
|
99
132
|
exitReasonRef.current = null;
|
|
@@ -130,9 +163,14 @@ function AnimatedPrivateNotificationElement(props) {
|
|
|
130
163
|
'--notification-stack-depth': layoutDepth,
|
|
131
164
|
'--notification-stack-expand-offset': `${layoutExpandOffset}px`
|
|
132
165
|
} : undefined;
|
|
133
|
-
return jsx(Toast.Root
|
|
166
|
+
return jsx(Toast.Root
|
|
167
|
+
// A focused toast is read as a status without being announced again.
|
|
168
|
+
, {
|
|
169
|
+
"aria-atomic": true,
|
|
170
|
+
"aria-live": "off",
|
|
171
|
+
role: "status",
|
|
134
172
|
...rest,
|
|
135
|
-
ref:
|
|
173
|
+
ref: currentLayerRef,
|
|
136
174
|
className: clsx(styles.root, styles[variant], {
|
|
137
175
|
[stackStyles.stackLayer]: isAnimationEnabled
|
|
138
176
|
}),
|
|
@@ -149,7 +187,7 @@ function AnimatedPrivateNotificationElement(props) {
|
|
|
149
187
|
"data-entering": isAnimationEnabled && !hasEntered ? 'true' : undefined,
|
|
150
188
|
onEscapeKeyDown: handleEscapeKeyDown,
|
|
151
189
|
onTransitionEnd: handleTransitionEnd,
|
|
152
|
-
onOpenChange:
|
|
190
|
+
onOpenChange: handleToastOpenChange,
|
|
153
191
|
open: radixOpen,
|
|
154
192
|
style: {
|
|
155
193
|
...style,
|
|
@@ -3,8 +3,10 @@ import { XMark, AlertTriangle, InformationCircle, CheckmarkCircle, AlertCircle }
|
|
|
3
3
|
import { bpIconIconOnLight, bpSize050 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
4
4
|
import * as Toast from '@radix-ui/react-toast';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { useMemo } from 'react';
|
|
6
|
+
import { useMemo, useCallback } from 'react';
|
|
7
|
+
import { useControllableState } from '../../utils/useControllableState.js';
|
|
7
8
|
import { IconButton } from '../icon-button/icon-button.js';
|
|
9
|
+
import { useNotificationLayer } from './hooks/use-notification-layer.js';
|
|
8
10
|
import styles from './notification.module.js';
|
|
9
11
|
import { truncateNotificationCopy } from './truncate-notification-copy.js';
|
|
10
12
|
|
|
@@ -58,14 +60,42 @@ function PrivateNotificationElement(props) {
|
|
|
58
60
|
closeButtonAriaLabel,
|
|
59
61
|
typeIconAriaLabel,
|
|
60
62
|
children,
|
|
63
|
+
defaultOpen = true,
|
|
64
|
+
onEscapeKeyDown,
|
|
61
65
|
...rest
|
|
62
66
|
} = props;
|
|
63
67
|
const iconComponent = useMemo(() => getIcon(typeIconAriaLabel, variant), [typeIconAriaLabel, variant]);
|
|
64
|
-
|
|
68
|
+
// The toast is controlled, so a close request can be ignored.
|
|
69
|
+
const [isOpen = defaultOpen, setIsOpen] = useControllableState({
|
|
70
|
+
prop: open,
|
|
71
|
+
defaultProp: defaultOpen,
|
|
72
|
+
onChange: onClose
|
|
73
|
+
});
|
|
74
|
+
const {
|
|
75
|
+
leaveEscapeToOverlay,
|
|
76
|
+
isCloseLeftToOverlay
|
|
77
|
+
} = useNotificationLayer(isOpen);
|
|
78
|
+
const handleEscapeKeyDown = useCallback(event => {
|
|
79
|
+
onEscapeKeyDown?.(event);
|
|
80
|
+
leaveEscapeToOverlay(event);
|
|
81
|
+
}, [leaveEscapeToOverlay, onEscapeKeyDown]);
|
|
82
|
+
const handleOpenChange = useCallback(nextOpen => {
|
|
83
|
+
if (!nextOpen && isCloseLeftToOverlay()) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setIsOpen(nextOpen);
|
|
87
|
+
}, [isCloseLeftToOverlay, setIsOpen]);
|
|
88
|
+
return jsx(Toast.Root
|
|
89
|
+
// A focused toast is read as a status without being announced again.
|
|
90
|
+
, {
|
|
91
|
+
"aria-atomic": true,
|
|
92
|
+
"aria-live": "off",
|
|
93
|
+
role: "status",
|
|
65
94
|
...rest,
|
|
66
95
|
className: clsx(styles.root, styles[variant]),
|
|
67
|
-
|
|
68
|
-
|
|
96
|
+
onEscapeKeyDown: handleEscapeKeyDown,
|
|
97
|
+
onOpenChange: handleOpenChange,
|
|
98
|
+
open: isOpen,
|
|
69
99
|
type: sensitivity,
|
|
70
100
|
children: jsxs("div", {
|
|
71
101
|
className: styles.container,
|
|
@@ -3,12 +3,18 @@ export declare const Popover: {
|
|
|
3
3
|
(props: import("./popover-root").PopoverRootProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
|
-
Trigger: import("react").ForwardRefExoticComponent<import("
|
|
7
|
-
|
|
6
|
+
Trigger: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
Anchor: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
12
|
ContentContainer: import("react").ForwardRefExoticComponent<import("./popover-content-container").PopoverContentContainerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
-
MainContent: import("react").ForwardRefExoticComponent<import("
|
|
10
|
-
Footer: import("react").ForwardRefExoticComponent<import("
|
|
11
|
-
Close: import("react").ForwardRefExoticComponent<import("
|
|
13
|
+
MainContent: import("react").ForwardRefExoticComponent<import("../../utils/radix-compat/popover").PopoverContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Footer: import("react").ForwardRefExoticComponent<import("../../utils/radix-compat/popover").PopoverContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
Close: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
16
|
+
asChild?: boolean;
|
|
17
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
18
|
};
|
|
13
19
|
export { type PopoverCloseProps } from './popover-close';
|
|
14
20
|
export { type PopoverContentContainerProps } from './popover-content-container';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '
|
|
1
|
+
import * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverAnchorProps = PopoverPrimitive.PopoverAnchorProps;
|
|
3
3
|
/**
|
|
4
4
|
* An optional element to position the `Popover.Content` against.
|
|
5
5
|
* @see https://www.radix-ui.com/docs/primitives/components/popover#anchor
|
|
6
6
|
*/
|
|
7
|
-
export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<
|
|
7
|
+
export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
3
|
+
import { Anchor } from '../../utils/radix-compat/popover.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* An optional element to position the `Popover.Content` against.
|
|
@@ -11,7 +11,7 @@ const PopoverAnchor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
11
11
|
children,
|
|
12
12
|
...rest
|
|
13
13
|
} = props;
|
|
14
|
-
return jsx(
|
|
14
|
+
return jsx(Anchor, {
|
|
15
15
|
...rest,
|
|
16
16
|
ref: forwardedRef,
|
|
17
17
|
asChild: true,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '
|
|
1
|
+
import * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverCloseProps = PopoverPrimitive.PopoverCloseProps;
|
|
3
3
|
/**
|
|
4
4
|
* Wrapper for buttons that should close the popover on click
|
|
5
5
|
* @see https://www.radix-ui.com/docs/primitives/components/popover#close
|
|
6
6
|
*/
|
|
7
|
-
export declare const PopoverClose: import("react").ForwardRefExoticComponent<
|
|
7
|
+
export declare const PopoverClose: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
3
|
+
import { Close } from '../../utils/radix-compat/popover.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Wrapper for buttons that should close the popover on click
|
|
@@ -11,7 +11,7 @@ const PopoverClose = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
11
11
|
children,
|
|
12
12
|
...rest
|
|
13
13
|
} = props;
|
|
14
|
-
return jsx(
|
|
14
|
+
return jsx(Close, {
|
|
15
15
|
...rest,
|
|
16
16
|
ref: forwardedRef,
|
|
17
17
|
asChild: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '
|
|
1
|
+
import * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export interface PopoverContentContainerProps extends PopoverPrimitive.PopoverContentProps {
|
|
3
3
|
/** Specify a container element to portal the content into. */
|
|
4
4
|
/** @default document.body */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Space4 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
3
|
-
import * as RadixPopover from '@radix-ui/react-popover';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import { forwardRef, useContext, useState, useMemo, useCallback } from 'react';
|
|
6
5
|
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
7
6
|
import { Card } from '../../card/card.js';
|
|
8
7
|
import { useBreakpoint, Breakpoint } from '../../utils/useBreakpoint.js';
|
|
9
8
|
import { useContentSizeObserver } from '../../utils/useContentSizeObserver.js';
|
|
9
|
+
import { Portal, Content } from '../../utils/radix-compat/popover.js';
|
|
10
10
|
import { useForkRef } from '../../utils/useForkRef.js';
|
|
11
11
|
import { focusRadioGroupFirstIfExists } from './popover-focus-utils.js';
|
|
12
12
|
import styles from './popover.module.js';
|
|
@@ -55,9 +55,9 @@ const PopoverContentContainer = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
55
55
|
}, [onOpenAutoFocus]);
|
|
56
56
|
return (
|
|
57
57
|
// TODO(DSYS-440): Unify all Portals (Tooltip, Select, Popover, etc...), Expose a Provider which would tell where to mount (body? other elem?)
|
|
58
|
-
jsx(
|
|
58
|
+
jsx(Portal, {
|
|
59
59
|
container: container,
|
|
60
|
-
children: jsx(
|
|
60
|
+
children: jsx(Content, {
|
|
61
61
|
...rest,
|
|
62
62
|
ref: useForkRef(forwardedRef, sizeObserverRef),
|
|
63
63
|
className: clsx(styles.popoverContentContainer, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as PopoverPrimitive from '
|
|
1
|
+
import type * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverFooterProps = PopoverPrimitive.PopoverContentProps;
|
|
3
3
|
/**
|
|
4
4
|
* Container to hold the footer content for the popover
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as PopoverPrimitive from '
|
|
1
|
+
import type * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverMainContentProps = PopoverPrimitive.PopoverContentProps;
|
|
3
3
|
/**
|
|
4
4
|
* Container to hold the main content for the popover
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '
|
|
1
|
+
import * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverRootProps = PopoverPrimitive.PopoverProps;
|
|
3
3
|
/**
|
|
4
4
|
* The Popover component has a trigger which displays a Card to the user with customizable content.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import { Root } from '../../utils/radix-compat/popover.js';
|
|
3
3
|
import { PopoverModalityContext } from './utils/popover-modality-context.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -16,7 +16,7 @@ const PopoverRoot = props => {
|
|
|
16
16
|
value: {
|
|
17
17
|
isInteractionDisabled
|
|
18
18
|
},
|
|
19
|
-
children: jsx(
|
|
19
|
+
children: jsx(Root, {
|
|
20
20
|
modal: modal,
|
|
21
21
|
...rest,
|
|
22
22
|
children: children
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '
|
|
1
|
+
import * as PopoverPrimitive from '../../utils/radix-compat/popover';
|
|
2
2
|
export type PopoverTriggerProps = PopoverPrimitive.PopoverTriggerProps;
|
|
3
3
|
/**
|
|
4
4
|
* PopoverTrigger connects your button or chip to open a popover.
|
|
5
5
|
* The button or chip should have a label that clearly describes the popover's content/purpose.
|
|
6
6
|
* @see https://www.radix-ui.com/docs/primitives/components/popover#trigger
|
|
7
7
|
*/
|
|
8
|
-
export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<
|
|
8
|
+
export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
3
|
+
import { Trigger } from '../../utils/radix-compat/popover.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* PopoverTrigger connects your button or chip to open a popover.
|
|
@@ -12,7 +12,7 @@ const PopoverTrigger = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
12
12
|
children,
|
|
13
13
|
...rest
|
|
14
14
|
} = props;
|
|
15
|
-
return jsx(
|
|
15
|
+
return jsx(Trigger, {
|
|
16
16
|
...rest,
|
|
17
17
|
ref: forwardedRef,
|
|
18
18
|
asChild: true,
|
|
@@ -2,6 +2,6 @@ import { Legend } from '../util-components/legend';
|
|
|
2
2
|
export { type RadioGroupProps, type RadioItemProps } from './types';
|
|
3
3
|
export declare const Radio: {
|
|
4
4
|
Item: import("react").ForwardRefExoticComponent<import("./types").RadioItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
Group: import("react").ForwardRefExoticComponent<import("
|
|
5
|
+
Group: import("react").ForwardRefExoticComponent<import("../utils/radix-compat/radio-group").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Legend: typeof Legend;
|
|
7
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as RadixRadioGroup from '
|
|
1
|
+
import * as RadixRadioGroup from '../utils/radix-compat/radio-group';
|
|
2
2
|
export declare const RadioGroup: import("react").ForwardRefExoticComponent<RadixRadioGroup.RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
3
2
|
import clsx from 'clsx';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { Root } from '../utils/radix-compat/radio-group.js';
|
|
5
5
|
import styles from './radio-group.module.js';
|
|
6
6
|
|
|
7
7
|
const RadioGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -16,7 +16,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
16
16
|
orientation,
|
|
17
17
|
...rest
|
|
18
18
|
} = props;
|
|
19
|
-
return jsx(
|
|
19
|
+
return jsx(Root, {
|
|
20
20
|
...rest,
|
|
21
21
|
ref: ref,
|
|
22
22
|
className: clsx([styles.root], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { Item, Indicator } from '../utils/radix-compat/radio-group.js';
|
|
5
5
|
import { TextWithInfoBadge } from '../util-components/text-with-info-badge/text-with-info-badge.js';
|
|
6
6
|
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
7
7
|
import styles from './radio-group.module.js';
|
|
@@ -24,14 +24,14 @@ const RadioItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24
24
|
children: [jsxs("label", {
|
|
25
25
|
className: styles.label,
|
|
26
26
|
"data-target-id": dataTargetId,
|
|
27
|
-
children: [jsx(
|
|
27
|
+
children: [jsx(Item, {
|
|
28
28
|
...rest,
|
|
29
29
|
ref: ref,
|
|
30
30
|
"aria-describedby": descriptionId,
|
|
31
31
|
className: styles.radioButton,
|
|
32
32
|
disabled: disabled,
|
|
33
33
|
value: value,
|
|
34
|
-
children: jsx(
|
|
34
|
+
children: jsx(Indicator, {
|
|
35
35
|
className: styles.indicator,
|
|
36
36
|
forceMount: true
|
|
37
37
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type RadioGroupItemProps, type RadioGroupProps as RadixRadioGroupProps } from '@radix-ui/react-radio-group';
|
|
2
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type RadioGroupItemProps, type RadioGroupProps as RadixRadioGroupProps } from '../utils/radix-compat/radio-group';
|
|
3
3
|
import { type StyledText } from '../utils/commonTypes';
|
|
4
4
|
export type RadioGroupProps = RadixRadioGroupProps;
|
|
5
5
|
export interface RadioItemProps extends RadioGroupItemProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { PencilCrossed, ChevronDown, Checkmark } from '@box/blueprint-web-assets/icons/Medium';
|
|
3
3
|
import { bpSize030, bpIconIconOnLight } from '@box/blueprint-web-assets/tokens/tokens';
|
|
4
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
import { forwardRef, useEffect, useCallback, useLayoutEffect, useSyncExternalStore } from 'react';
|
|
6
|
+
import { Root as Root$1, Portal, Content as Content$1, Viewport, Item, ItemText, ItemIndicator, Separator as Separator$1, Trigger as Trigger$1, Value, Icon } from '../utils/radix-compat/select.js';
|
|
7
7
|
import '../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
8
8
|
import '../blueprint-configuration-context/consts.js';
|
|
9
9
|
import { useBlueprintConfiguration } from '../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
@@ -135,7 +135,7 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
135
135
|
isExiting: isExiting,
|
|
136
136
|
selectedValue: value,
|
|
137
137
|
truncateText: truncateText,
|
|
138
|
-
children: jsxs(
|
|
138
|
+
children: jsxs(Root$1, {
|
|
139
139
|
...selectProps,
|
|
140
140
|
children: [jsx(Trigger, {
|
|
141
141
|
...triggerProps,
|
|
@@ -183,7 +183,7 @@ const Trigger = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
183
183
|
const getSelectedLeftElement = useCallback(() => value ? getLeftElement(value) : null, [getLeftElement, value]);
|
|
184
184
|
const selectedLeftElement = useSyncExternalStore(subscribeToLeftElements, getSelectedLeftElement, getSelectedLeftElement);
|
|
185
185
|
const shouldShowPlaceholderLeftElement = !value && placeholderLeftElement;
|
|
186
|
-
return jsxs(
|
|
186
|
+
return jsxs(Trigger$1, {
|
|
187
187
|
...triggerProps,
|
|
188
188
|
ref: forwardedRef,
|
|
189
189
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -207,10 +207,10 @@ const Trigger = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
207
207
|
}), shouldShowPlaceholderLeftElement && jsx("span", {
|
|
208
208
|
className: styles.triggerLeftElement,
|
|
209
209
|
children: placeholderLeftElement
|
|
210
|
-
}), jsx(
|
|
210
|
+
}), jsx(Value, {
|
|
211
211
|
placeholder: placeholder
|
|
212
212
|
})]
|
|
213
|
-
}), jsx(
|
|
213
|
+
}), jsx(Icon, {
|
|
214
214
|
className: styles.iconWrapper,
|
|
215
215
|
children: icon
|
|
216
216
|
})]
|
|
@@ -234,9 +234,9 @@ const Content = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
234
234
|
const handleExitAnimationEvent = useCallback(event => {
|
|
235
235
|
handleSelectContentExitAnimationEnd(event, isExiting, completeExit);
|
|
236
236
|
}, [completeExit, isExiting]);
|
|
237
|
-
return jsx(
|
|
237
|
+
return jsx(Portal, {
|
|
238
238
|
container: container,
|
|
239
|
-
children: jsx(
|
|
239
|
+
children: jsx(Content$1, {
|
|
240
240
|
...contentProps,
|
|
241
241
|
ref: forwardedRef,
|
|
242
242
|
className: clsx(styles.content, className),
|
|
@@ -247,7 +247,7 @@ const Content = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
247
247
|
}),
|
|
248
248
|
position: "popper",
|
|
249
249
|
sideOffset: 8,
|
|
250
|
-
children: jsx(
|
|
250
|
+
children: jsx(Viewport, {
|
|
251
251
|
className: clsx(styles.viewport, {
|
|
252
252
|
[styles.withTruncatedText]: truncateText
|
|
253
253
|
}),
|
|
@@ -293,7 +293,7 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
293
293
|
if (!canOpen && itemProps.value !== selectedValue) {
|
|
294
294
|
return null;
|
|
295
295
|
}
|
|
296
|
-
return jsxs(
|
|
296
|
+
return jsxs(Item, {
|
|
297
297
|
...itemProps,
|
|
298
298
|
ref: forwardedRef,
|
|
299
299
|
className: clsx(styles.option, {
|
|
@@ -309,13 +309,13 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
309
309
|
className: clsx(styles.textWrapper, {
|
|
310
310
|
[styles.ellipsis]: truncateText
|
|
311
311
|
}),
|
|
312
|
-
children: [jsx(
|
|
312
|
+
children: [jsx(ItemText, {
|
|
313
313
|
children: text
|
|
314
314
|
}), !!secondaryText && jsx("span", {
|
|
315
315
|
className: styles.secondaryText,
|
|
316
316
|
children: secondaryText
|
|
317
317
|
})]
|
|
318
|
-
}), !itemProps.disabled && jsx(
|
|
318
|
+
}), !itemProps.disabled && jsx(ItemIndicator, {
|
|
319
319
|
className: styles.indicator,
|
|
320
320
|
children: jsx(Checkmark, {})
|
|
321
321
|
})]
|
|
@@ -323,7 +323,7 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
323
323
|
});
|
|
324
324
|
Option.displayName = 'Select.Option';
|
|
325
325
|
const Separator = /*#__PURE__*/forwardRef((_, forwardedRef) => {
|
|
326
|
-
return jsx(
|
|
326
|
+
return jsx(Separator$1, {
|
|
327
327
|
ref: forwardedRef,
|
|
328
328
|
className: styles.separator
|
|
329
329
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type SelectItemProps as RadixItemProps, type SelectContentProps as RadixSelectContentProps, type SelectProps as RadixSelectProps, type SelectTriggerProps as RadixSelectTriggerProps } from '@radix-ui/react-select';
|
|
2
1
|
import { type ReactElement } from 'react';
|
|
3
2
|
import { type RequireAllOrNone } from 'type-fest';
|
|
3
|
+
import { type SelectItemProps as RadixItemProps, type SelectContentProps as RadixSelectContentProps, type SelectProps as RadixSelectProps, type SelectTriggerProps as RadixSelectTriggerProps } from '../utils/radix-compat/select';
|
|
4
4
|
import { type Modify } from '../types/modify';
|
|
5
5
|
import { type Labelable } from '../util-components/labelable/types';
|
|
6
6
|
import { type StyledText } from '../utils/commonTypes';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type AnimationEvent, type Dispatch, type SetStateAction } from 'react';
|
|
2
2
|
type SetOpen = Dispatch<SetStateAction<boolean | undefined>>;
|
|
3
3
|
/**
|
|
4
|
-
* Deferred close for Select menu exit animations
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Deferred close for Select menu exit animations. Like Radix Select 2.0.x, the Select content
|
|
5
|
+
* unmounts as soon as it closes, so `open` stays true while the exit CSS runs, and the close
|
|
6
|
+
* is committed on `animationend`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function useSelectExitAnimation({ open, setOpen, isAnimationEnabled, }: {
|
|
9
9
|
open: boolean;
|
|
@@ -6,9 +6,9 @@ const completeExitNoop = noop;
|
|
|
6
6
|
const EXIT_DURATION_MS = Number.parseFloat(bpDurationShort);
|
|
7
7
|
const SELECT_EXIT_ANIMATION_FALLBACK_MS = EXIT_DURATION_MS * 3;
|
|
8
8
|
/**
|
|
9
|
-
* Deferred close for Select menu exit animations
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Deferred close for Select menu exit animations. Like Radix Select 2.0.x, the Select content
|
|
10
|
+
* unmounts as soon as it closes, so `open` stays true while the exit CSS runs, and the close
|
|
11
|
+
* is committed on `animationend`.
|
|
12
12
|
*/
|
|
13
13
|
function useSelectExitAnimation({
|
|
14
14
|
open,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { XMark } from '@box/blueprint-web-assets/icons/Medium';
|
|
3
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { Close } from '../utils/radix-compat/dialog.js';
|
|
5
5
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
6
6
|
import { useBreakpoint, Breakpoint } from '../utils/useBreakpoint.js';
|
|
7
7
|
import styles from './side-panel.module.js';
|
|
@@ -20,7 +20,7 @@ const SidePanelClose = /*#__PURE__*/forwardRef(({
|
|
|
20
20
|
const breakpoint = useBreakpoint();
|
|
21
21
|
const smallBreakpointActive = breakpoint === Breakpoint.Small;
|
|
22
22
|
const finalProps = smallBreakpointActive ? smallViewportProps : {};
|
|
23
|
-
return jsx(
|
|
23
|
+
return jsx(Close, {
|
|
24
24
|
ref: forwardedRef,
|
|
25
25
|
asChild: true,
|
|
26
26
|
children: jsx(IconButton, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
|
-
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
4
2
|
import { clsx } from 'clsx';
|
|
5
3
|
import { forwardRef, useCallback, useId } from 'react';
|
|
4
|
+
import { Content } from '../utils/radix-compat/dialog.js';
|
|
5
|
+
import { FocusScope } from '../utils/radix-compat/focus-scope-component.js';
|
|
6
6
|
import { useForkRef } from '../utils/useForkRef.js';
|
|
7
7
|
import { ResizeProvider } from './resize-context.js';
|
|
8
8
|
import styles from './side-panel.module.js';
|
|
@@ -87,7 +87,7 @@ const SidePanelContent = /*#__PURE__*/forwardRef(({
|
|
|
87
87
|
value: resize,
|
|
88
88
|
children: jsx(FocusScope, {
|
|
89
89
|
trapped: !isInteractiveOverlayVariant,
|
|
90
|
-
children: jsx(
|
|
90
|
+
children: jsx(Content, {
|
|
91
91
|
...props,
|
|
92
92
|
ref: ref,
|
|
93
93
|
asChild: asChild,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { Title } from '../utils/radix-compat/dialog.js';
|
|
5
5
|
import { Text } from '../text/text.js';
|
|
6
6
|
import { useScrollContext } from '../utils/scroll-context.js';
|
|
7
7
|
import { useBreakpoint, Breakpoint } from '../utils/useBreakpoint.js';
|
|
@@ -41,7 +41,7 @@ const SidePanelHeader = /*#__PURE__*/forwardRef(({
|
|
|
41
41
|
[styles.headerShadow]: isScrolledUnderHeader
|
|
42
42
|
}, className);
|
|
43
43
|
if (variant === 'overlay' || variant === 'dropShadowOverlay' || variant === 'interactiveOverlay') {
|
|
44
|
-
return jsx(
|
|
44
|
+
return jsx(Title, {
|
|
45
45
|
...rest,
|
|
46
46
|
ref: forwardedRef,
|
|
47
47
|
asChild: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { Portal, Overlay } from '../utils/radix-compat/dialog.js';
|
|
5
5
|
import styles from './side-panel.module.js';
|
|
6
6
|
import { useVariant } from './variant-context.js';
|
|
7
7
|
|
|
@@ -16,9 +16,9 @@ const SidePanelOverlay = /*#__PURE__*/forwardRef(({
|
|
|
16
16
|
...props
|
|
17
17
|
}, forwardedRef) => {
|
|
18
18
|
const variant = useVariant();
|
|
19
|
-
return jsx(
|
|
19
|
+
return jsx(Portal, {
|
|
20
20
|
container: container,
|
|
21
|
-
children: variant === 'interactiveOverlay' ? children : jsx(
|
|
21
|
+
children: variant === 'interactiveOverlay' ? children : jsx(Overlay, {
|
|
22
22
|
ref: forwardedRef,
|
|
23
23
|
className: clsx(styles.overlay, {
|
|
24
24
|
[styles.dropShadowOverlay]: variant === 'dropShadowOverlay'
|