@box/blueprint-web 19.6.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 +6 -6
- package/dist/lib-esm/accordion/types.d.ts +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/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/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/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/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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
import { useCallbackRef } from '../useCallbackRef.js';
|
|
3
|
+
import { wrapArray } from './roving-focus.js';
|
|
4
|
+
|
|
5
|
+
const TYPEAHEAD_TIMEOUT = 1000;
|
|
6
|
+
/**
|
|
7
|
+
* Finds the next value matching the search, starting after the current match.
|
|
8
|
+
* Repeating one character cycles through the values starting with it, like in Radix menus and selects.
|
|
9
|
+
*/
|
|
10
|
+
function getNextMatch(values, search, currentMatch) {
|
|
11
|
+
const isRepeated = search.length > 1 && Array.from(search).every(char => char === search[0]);
|
|
12
|
+
const normalizedSearch = isRepeated ? search[0] : search;
|
|
13
|
+
const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
|
|
14
|
+
let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));
|
|
15
|
+
const excludeCurrentMatch = normalizedSearch.length === 1;
|
|
16
|
+
if (excludeCurrentMatch) {
|
|
17
|
+
wrappedValues = wrappedValues.filter(value => value !== currentMatch);
|
|
18
|
+
}
|
|
19
|
+
const nextMatch = wrappedValues.find(value => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()));
|
|
20
|
+
return nextMatch !== currentMatch ? nextMatch : undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Item based variant of `getNextMatch`, used by the select where several items can share a text.
|
|
24
|
+
*/
|
|
25
|
+
function findNextItem(items, search, currentItem) {
|
|
26
|
+
const isRepeated = search.length > 1 && Array.from(search).every(char => char === search[0]);
|
|
27
|
+
const normalizedSearch = isRepeated ? search[0] : search;
|
|
28
|
+
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
29
|
+
let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));
|
|
30
|
+
const excludeCurrentItem = normalizedSearch.length === 1;
|
|
31
|
+
if (excludeCurrentItem) {
|
|
32
|
+
wrappedItems = wrappedItems.filter(item => item !== currentItem);
|
|
33
|
+
}
|
|
34
|
+
const nextItem = wrappedItems.find(item => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase()));
|
|
35
|
+
return nextItem !== currentItem ? nextItem : undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Keeps the typeahead search string, reset one second after the last key press.
|
|
39
|
+
*/
|
|
40
|
+
function useTypeaheadSearch(onSearchChange) {
|
|
41
|
+
const handleSearchChange = useCallbackRef(onSearchChange);
|
|
42
|
+
const searchRef = useRef('');
|
|
43
|
+
const timerRef = useRef(0);
|
|
44
|
+
const handleTypeaheadSearch = useCallback(key => {
|
|
45
|
+
const search = searchRef.current + key;
|
|
46
|
+
handleSearchChange(search);
|
|
47
|
+
const updateSearch = value => {
|
|
48
|
+
searchRef.current = value;
|
|
49
|
+
window.clearTimeout(timerRef.current);
|
|
50
|
+
if (value !== '') {
|
|
51
|
+
timerRef.current = window.setTimeout(() => updateSearch(''), TYPEAHEAD_TIMEOUT);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
updateSearch(search);
|
|
55
|
+
}, [handleSearchChange]);
|
|
56
|
+
const resetTypeahead = useCallback(() => {
|
|
57
|
+
searchRef.current = '';
|
|
58
|
+
window.clearTimeout(timerRef.current);
|
|
59
|
+
}, []);
|
|
60
|
+
useEffect(() => () => window.clearTimeout(timerRef.current), []);
|
|
61
|
+
return [searchRef, handleTypeaheadSearch, resetTypeahead];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { findNextItem, getNextMatch, useTypeaheadSearch };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ElementType } from 'react';
|
|
2
|
+
/** Props of an element that can render its only child instead, merging its props into it. */
|
|
3
|
+
export type PrimitiveProps<E extends ElementType> = ComponentPropsWithoutRef<E> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type PointerDownOutsideEvent = CustomEvent<{
|
|
7
|
+
originalEvent: PointerEvent;
|
|
8
|
+
}>;
|
|
9
|
+
export type FocusOutsideEvent = CustomEvent<{
|
|
10
|
+
originalEvent: FocusEvent;
|
|
11
|
+
}>;
|
|
12
|
+
export interface DismissableLayerProps {
|
|
13
|
+
/** Called when the escape key is pressed. Can be prevented. */
|
|
14
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
15
|
+
/** Called when a `pointerdown` event happens outside of the layer. Can be prevented. */
|
|
16
|
+
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
|
17
|
+
/** Called when the focus moves outside of the layer. Can be prevented. */
|
|
18
|
+
onFocusOutside?: (event: FocusOutsideEvent) => void;
|
|
19
|
+
/** Called when an interaction happens outside the layer: either a pointer down or a focus move. Can be prevented. */
|
|
20
|
+
onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface FocusScopeProps {
|
|
23
|
+
/** Called when focus moves into the content after opening. Can be prevented. */
|
|
24
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
25
|
+
/** Called when focus moves to the trigger after closing. Can be prevented. */
|
|
26
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
27
|
+
}
|
|
28
|
+
export type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
29
|
+
export type Align = 'start' | 'center' | 'end';
|
|
30
|
+
type Boundary = Element | null;
|
|
31
|
+
export interface PopperContentProps {
|
|
32
|
+
side?: Side;
|
|
33
|
+
sideOffset?: number;
|
|
34
|
+
align?: Align;
|
|
35
|
+
alignOffset?: number;
|
|
36
|
+
arrowPadding?: number;
|
|
37
|
+
avoidCollisions?: boolean;
|
|
38
|
+
collisionBoundary?: Boundary | Boundary[];
|
|
39
|
+
collisionPadding?: number | Partial<Record<Side, number>>;
|
|
40
|
+
sticky?: 'partial' | 'always';
|
|
41
|
+
hideWhenDetached?: boolean;
|
|
42
|
+
updatePositionStrategy?: 'optimized' | 'always';
|
|
43
|
+
onPlaced?: () => void;
|
|
44
|
+
}
|
|
45
|
+
export interface PortalProps {
|
|
46
|
+
/** Element to portal the content into. Defaults to `document.body`; `null` renders nothing. */
|
|
47
|
+
container?: HTMLElement | null;
|
|
48
|
+
/** Keeps the content mounted when closed, for animations controlled from the outside. */
|
|
49
|
+
forceMount?: true;
|
|
50
|
+
}
|
|
51
|
+
export type Direction = 'ltr' | 'rtl';
|
|
52
|
+
export type Orientation = 'horizontal' | 'vertical';
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the viewport height variable Ariakit dialogs set on their element when they mount and when the viewport
|
|
3
|
+
* resizes, so the inline style of the content is the one Radix rendered.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useStripViewportHeight(element: HTMLElement | null): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const VIEWPORT_HEIGHT_PROPERTY = '--dialog-viewport-height';
|
|
4
|
+
/**
|
|
5
|
+
* Removes the viewport height variable Ariakit dialogs set on their element when they mount and when the viewport
|
|
6
|
+
* resizes, so the inline style of the content is the one Radix rendered.
|
|
7
|
+
*/
|
|
8
|
+
function useStripViewportHeight(element) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!element) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const removeViewportHeight = () => {
|
|
14
|
+
if (element.style.getPropertyValue(VIEWPORT_HEIGHT_PROPERTY)) {
|
|
15
|
+
element.style.removeProperty(VIEWPORT_HEIGHT_PROPERTY);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
removeViewportHeight();
|
|
19
|
+
const observer = new MutationObserver(removeViewportHeight);
|
|
20
|
+
observer.observe(element, {
|
|
21
|
+
attributes: true,
|
|
22
|
+
attributeFilter: ['style']
|
|
23
|
+
});
|
|
24
|
+
return () => observer.disconnect();
|
|
25
|
+
}, [element]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { useStripViewportHeight };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Hides content visually while keeping it available to assistive technology, like the Radix `VisuallyHidden`. */
|
|
2
|
+
export declare const VisuallyHidden: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Hides content visually while keeping it available to assistive technology, like the Radix `VisuallyHidden`. */
|
|
5
|
+
const VisuallyHidden = /*#__PURE__*/forwardRef((props, forwardedRef) => jsx("span", {
|
|
6
|
+
...props,
|
|
7
|
+
ref: forwardedRef,
|
|
8
|
+
style: {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
border: 0,
|
|
11
|
+
width: 1,
|
|
12
|
+
height: 1,
|
|
13
|
+
padding: 0,
|
|
14
|
+
margin: -1,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
wordWrap: 'normal',
|
|
19
|
+
...props.style
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
VisuallyHidden.displayName = 'VisuallyHidden';
|
|
23
|
+
|
|
24
|
+
export { VisuallyHidden };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -54,34 +54,23 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@ariakit/react": "0.4.21",
|
|
56
56
|
"@ariakit/react-core": "0.4.21",
|
|
57
|
-
"@box/blueprint-web-assets": "^5.18.
|
|
57
|
+
"@box/blueprint-web-assets": "^5.18.4",
|
|
58
|
+
"@floating-ui/dom": "^1.6.0",
|
|
58
59
|
"@internationalized/date": "^3.12.4",
|
|
59
|
-
"@radix-ui/react-
|
|
60
|
-
"@radix-ui/react-
|
|
61
|
-
"
|
|
62
|
-
"@radix-ui/react-context-menu": "2.1.5",
|
|
63
|
-
"@radix-ui/react-dialog": "1.0.5",
|
|
64
|
-
"@radix-ui/react-dropdown-menu": "2.0.6",
|
|
65
|
-
"@radix-ui/react-focus-scope": "1.0.4",
|
|
66
|
-
"@radix-ui/react-popover": "1.0.7",
|
|
67
|
-
"@radix-ui/react-radio-group": "1.1.3",
|
|
68
|
-
"@radix-ui/react-select": "2.0.0",
|
|
69
|
-
"@radix-ui/react-slider": "1.1.2",
|
|
70
|
-
"@radix-ui/react-switch": "1.0.3",
|
|
71
|
-
"@radix-ui/react-toast": "1.1.5",
|
|
72
|
-
"@radix-ui/react-toggle-group": "1.0.4",
|
|
73
|
-
"@radix-ui/react-toolbar": "1.0.4",
|
|
74
|
-
"@radix-ui/react-tooltip": "1.0.7",
|
|
60
|
+
"@radix-ui/react-slider": "1.6.1",
|
|
61
|
+
"@radix-ui/react-toast": "1.3.1",
|
|
62
|
+
"aria-hidden": "^1.2.6",
|
|
75
63
|
"clsx": "^1.2.1",
|
|
76
64
|
"color": "2.0.1",
|
|
77
65
|
"react-aria": "3.53.1",
|
|
78
66
|
"react-aria-components": "1.22.1",
|
|
67
|
+
"react-remove-scroll": "^2.7.2",
|
|
79
68
|
"type-fest": "^3.2.0"
|
|
80
69
|
},
|
|
81
70
|
"devDependencies": {
|
|
82
71
|
"@box/box-test-client": "^3.2.7",
|
|
83
72
|
"@box/playwright-utils": "^3.10.0",
|
|
84
|
-
"@box/storybook-utils": "^1.4.
|
|
73
|
+
"@box/storybook-utils": "^1.4.53",
|
|
85
74
|
"@figma/code-connect": "1.4.4",
|
|
86
75
|
"@playwright/test": "1.46.1",
|
|
87
76
|
"@types/js-yaml": "^4.0.9",
|