@box/blueprint-web 14.26.1 → 14.30.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/breadcrumb/breadcrumb.js +28 -8
- package/dist/lib-esm/breadcrumb/folder-tree-truncation-view.d.ts +1 -1
- package/dist/lib-esm/breadcrumb/folder-tree-truncation-view.js +10 -1
- package/dist/lib-esm/breadcrumb/types.d.ts +2 -1
- package/dist/lib-esm/index.css +398 -182
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button-types.d.ts +3 -10
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button.d.ts +5 -3
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button.js +28 -25
- package/dist/lib-esm/modal/modal-content.js +1 -0
- package/dist/lib-esm/modal/modal.module.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.js +13 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +13 -2
- package/dist/lib-esm/primitives/context-menu/context-menu.module.js +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
- package/package.json +3 -3
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type BaseButtonIconProps, type BaseButtonProps } from '../primitives/base-button';
|
|
3
|
-
/** Same
|
|
3
|
+
/** Same loading contract as {@link BaseButton} (`loading` + `loadingAriaLabel`). */
|
|
4
4
|
export type InlineTriggerButtonProps = Omit<BaseButtonProps, 'size' | 'variant' | 'children'> & {
|
|
5
|
-
/** Visual style; only secondary and tertiary are supported. */
|
|
6
5
|
variant?: 'secondary' | 'tertiary';
|
|
7
6
|
caretDirection: 'up' | 'down';
|
|
8
7
|
startIcon?: BaseButtonIconProps['icon'];
|
|
9
|
-
/**
|
|
10
|
-
* Extra props for `startIcon` (merged after default size/color on the SVG). Use for stroke icons (`strokeWidth`),
|
|
11
|
-
* filters, opacity, or `className`. For fill/path icons, visual weight is usually a different asset (e.g. Fill vs Medium).
|
|
12
|
-
*/
|
|
8
|
+
/** Merged after default icon size/color (stroke width, className, etc.). */
|
|
13
9
|
startIconProps?: BaseButtonIconProps['iconProps'];
|
|
14
|
-
/** Optional custom right icon; when omitted, caret direction icon is used. */
|
|
15
10
|
endIcon?: BaseButtonIconProps['icon'];
|
|
16
|
-
/** Same as `startIconProps` for the end/caret slot (default chevrons or `endIcon`). */
|
|
17
11
|
endIconProps?: BaseButtonIconProps['iconProps'];
|
|
18
|
-
/**
|
|
12
|
+
/** Keeps end icon visible when idle or disabled; hidden while `loading`. */
|
|
19
13
|
alwaysShowEndIcon?: boolean;
|
|
20
|
-
/** Custom row UI (chips, styled text, etc.). There is no separate string `label` API. */
|
|
21
14
|
children: ReactNode;
|
|
22
15
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type InlineTriggerButtonProps } from './inline-trigger-button-types';
|
|
2
2
|
/**
|
|
3
|
-
* Extra-small trigger for
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Extra-small trigger for arbitrary row content (`children`). Only `secondary` and `tertiary`.
|
|
4
|
+
* Optional `startIcon` / `endIcon`; otherwise shows chevrons from `caretDirection`.
|
|
5
|
+
* Prefer {@link TriggerButton} for a simple label + caret.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link BaseButton} for `loading` / `loadingAriaLabel` and focus behavior.
|
|
6
8
|
*/
|
|
7
9
|
export declare const InlineTriggerButton: import("react").ForwardRefExoticComponent<Omit<InlineTriggerButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ChevronUp, ChevronDown } from '@box/blueprint-web-assets/icons/Medium';
|
|
3
|
+
import { bpSize040, bpSize030 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useMemo } from 'react';
|
|
5
6
|
import { BaseButton } from '../primitives/base-button/index.js';
|
|
6
7
|
import styles from './inline-trigger-button.module.js';
|
|
7
8
|
|
|
8
9
|
const SECONDARY_ICON_COLOR = 'var(--bp-icon-icon-on-light-secondary)';
|
|
10
|
+
const TERTIARY_ICON_COLOR = 'var(--bp-text-cta-link)';
|
|
9
11
|
function caretIconForDirection(caretDirection) {
|
|
10
12
|
return caretDirection === 'up' ? ChevronUp : ChevronDown;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* Extra-small trigger for
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* Extra-small trigger for arbitrary row content (`children`). Only `secondary` and `tertiary`.
|
|
16
|
+
* Optional `startIcon` / `endIcon`; otherwise shows chevrons from `caretDirection`.
|
|
17
|
+
* Prefer {@link TriggerButton} for a simple label + caret.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link BaseButton} for `loading` / `loadingAriaLabel` and focus behavior.
|
|
16
20
|
*/
|
|
17
21
|
const InlineTriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
18
22
|
const {
|
|
@@ -30,33 +34,39 @@ const InlineTriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
30
34
|
...rest
|
|
31
35
|
} = props;
|
|
32
36
|
const RightIcon = endIcon ?? caretIconForDirection(caretDirection);
|
|
33
|
-
const iconColor = variant === 'secondary' ? SECONDARY_ICON_COLOR :
|
|
37
|
+
const iconColor = variant === 'secondary' ? SECONDARY_ICON_COLOR : TERTIARY_ICON_COLOR;
|
|
38
|
+
const resolvedClassName = clsx(styles.inlineTriggerButton, styles.extraSmall, styles[variant], styles.row, {
|
|
39
|
+
[styles.startIcon]: !!startIcon,
|
|
40
|
+
[styles.endIconAlwaysVisible]: alwaysShowEndIcon && !loading
|
|
41
|
+
}, className);
|
|
34
42
|
const baseButtonProps = {
|
|
35
43
|
...rest,
|
|
36
|
-
className:
|
|
37
|
-
[styles.startIcon]: !!startIcon,
|
|
38
|
-
[styles.endIconAlwaysVisible]: alwaysShowEndIcon && !loading
|
|
39
|
-
}, className),
|
|
44
|
+
className: resolvedClassName,
|
|
40
45
|
'data-inline-trigger-loading': loading ? 'true' : undefined,
|
|
41
46
|
loading,
|
|
42
47
|
size: 'small',
|
|
43
48
|
style,
|
|
44
49
|
variant
|
|
45
50
|
};
|
|
51
|
+
const resolvedStartIconProps = useMemo(() => ({
|
|
52
|
+
color: iconColor,
|
|
53
|
+
height: bpSize040,
|
|
54
|
+
width: bpSize040,
|
|
55
|
+
...startIconProps
|
|
56
|
+
}), [iconColor, startIconProps]);
|
|
57
|
+
const resolvedEndIconProps = useMemo(() => ({
|
|
58
|
+
color: iconColor,
|
|
59
|
+
height: bpSize030,
|
|
60
|
+
width: bpSize030,
|
|
61
|
+
...endIconProps
|
|
62
|
+
}), [endIconProps, iconColor]);
|
|
46
63
|
return jsxs(BaseButton, {
|
|
47
64
|
ref: forwardedRef,
|
|
48
65
|
...baseButtonProps,
|
|
49
66
|
children: [startIcon ? jsx(BaseButton.Icon, {
|
|
50
67
|
className: styles.startIcon,
|
|
51
68
|
icon: startIcon,
|
|
52
|
-
iconProps:
|
|
53
|
-
...(iconColor ? {
|
|
54
|
-
color: iconColor
|
|
55
|
-
} : {}),
|
|
56
|
-
height: 'var(--bp-size-040, 1rem)',
|
|
57
|
-
width: 'var(--bp-size-040, 1rem)',
|
|
58
|
-
...startIconProps
|
|
59
|
-
}
|
|
69
|
+
iconProps: resolvedStartIconProps
|
|
60
70
|
}) : null, jsx(BaseButton.Label, {
|
|
61
71
|
className: styles.contentSlot,
|
|
62
72
|
children: jsx("span", {
|
|
@@ -66,14 +76,7 @@ const InlineTriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
66
76
|
}), jsx(BaseButton.Icon, {
|
|
67
77
|
className: styles.caretCorner,
|
|
68
78
|
icon: RightIcon,
|
|
69
|
-
iconProps:
|
|
70
|
-
...(iconColor ? {
|
|
71
|
-
color: iconColor
|
|
72
|
-
} : {}),
|
|
73
|
-
height: 'var(--bp-size-030, 0.75rem)',
|
|
74
|
-
width: 'var(--bp-size-030, 0.75rem)',
|
|
75
|
-
...endIconProps
|
|
76
|
-
}
|
|
79
|
+
iconProps: resolvedEndIconProps
|
|
77
80
|
})]
|
|
78
81
|
});
|
|
79
82
|
});
|
|
@@ -30,6 +30,7 @@ const ModalContent = /*#__PURE__*/forwardRef(({
|
|
|
30
30
|
container: container,
|
|
31
31
|
children: jsx(RadixDialog.Overlay, {
|
|
32
32
|
className: styles.overlay,
|
|
33
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
33
34
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
34
35
|
children: jsx(RadixDialog.Content, {
|
|
35
36
|
...props,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"overlay":"bp_modal_module_overlay--
|
|
2
|
+
var styles = {"overlay":"bp_modal_module_overlay--178e7","headerDividerLine":"bp_modal_module_headerDividerLine--178e7","footerDividerLine":"bp_modal_module_footerDividerLine--178e7","content":"bp_modal_module_content--178e7","smallSizeModal":"bp_modal_module_smallSizeModal--178e7","mediumSizeModal":"bp_modal_module_mediumSizeModal--178e7","largeSizeModal":"bp_modal_module_largeSizeModal--178e7","xlargeSizeModal":"bp_modal_module_xlargeSizeModal--178e7","loadingContainerActive":"bp_modal_module_loadingContainerActive--178e7","popup_bounce_in":"bp_modal_module_popup_bounce_in--178e7","bpModalEnter":"bp_modal_module_bpModalEnter--178e7","bpModalExit":"bp_modal_module_bpModalExit--178e7","scrollableContainer":"bp_modal_module_scrollableContainer--178e7","close":"bp_modal_module_close--178e7","onColor":"bp_modal_module_onColor--178e7","backButton":"bp_modal_module_backButton--178e7","modalHeader":"bp_modal_module_modalHeader--178e7","modalTitle":"bp_modal_module_modalTitle--178e7","body":"bp_modal_module_body--178e7","footer":"bp_modal_module_footer--178e7","footerButton":"bp_modal_module_footerButton--178e7","loadingContainer":"bp_modal_module_loadingContainer--178e7","loading":"bp_modal_module_loading--178e7","loadingOverlay":"bp_modal_module_loadingOverlay--178e7","loadingContent":"bp_modal_module_loadingContent--178e7","loadingContentVisible":"bp_modal_module_loadingContentVisible--178e7"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -2,7 +2,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as ContextMenuPrimitve from '@radix-ui/react-context-menu';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { forwardRef, Children, isValidElement } from 'react';
|
|
5
|
+
import '../../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
6
|
+
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
5
7
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
8
|
+
import { useContentSizeObserver } from '../../utils/useContentSizeObserver.js';
|
|
9
|
+
import { useForkRef } from '../../utils/useForkRef.js';
|
|
6
10
|
import { useFullScreenContextMenu } from '../menu-utils/responsiveness/FullScreenContextMenuContext.js';
|
|
7
11
|
import { ContextMenuHeader } from './context-menu-menu-header.js';
|
|
8
12
|
import styles from './context-menu.module.js';
|
|
@@ -36,6 +40,12 @@ const ContextMenuMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
36
40
|
const {
|
|
37
41
|
enableModernizedComponents
|
|
38
42
|
} = useBlueprintModernization();
|
|
43
|
+
const {
|
|
44
|
+
componentsWithAnimationEnabled
|
|
45
|
+
} = useBlueprintConfiguration();
|
|
46
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('ContextMenu');
|
|
47
|
+
const sizeObserverRef = useContentSizeObserver(360, 360);
|
|
48
|
+
const ref = useForkRef(forwardedRef, sizeObserverRef);
|
|
39
49
|
const {
|
|
40
50
|
isMenuFullScreenEnabled
|
|
41
51
|
} = useFullScreenContextMenu();
|
|
@@ -48,7 +58,7 @@ const ContextMenuMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
48
58
|
container: container,
|
|
49
59
|
children: jsxs(ContextMenuPrimitve.Content, {
|
|
50
60
|
...rest,
|
|
51
|
-
ref:
|
|
61
|
+
ref: ref,
|
|
52
62
|
className: clsx(styles.menuBlock, className),
|
|
53
63
|
"data-menu-fullscreen": true,
|
|
54
64
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
@@ -63,9 +73,10 @@ const ContextMenuMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
63
73
|
container: container,
|
|
64
74
|
children: jsx(ContextMenuPrimitve.Content, {
|
|
65
75
|
...rest,
|
|
66
|
-
ref:
|
|
76
|
+
ref: ref,
|
|
67
77
|
className: clsx(styles.menuBlock, className),
|
|
68
78
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
79
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
69
80
|
children: children
|
|
70
81
|
})
|
|
71
82
|
});
|
|
@@ -2,7 +2,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as ContextMenuPrimitve from '@radix-ui/react-context-menu';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { forwardRef, useCallback } from 'react';
|
|
5
|
+
import '../../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
6
|
+
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
5
7
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
8
|
+
import { useContentSizeObserver } from '../../utils/useContentSizeObserver.js';
|
|
9
|
+
import { useForkRef } from '../../utils/useForkRef.js';
|
|
6
10
|
import { useFullScreenContextMenu } from '../menu-utils/responsiveness/FullScreenContextMenuContext.js';
|
|
7
11
|
import { sortMenuChildren } from './context-menu-menu-content.js';
|
|
8
12
|
import styles from './context-menu.module.js';
|
|
@@ -23,6 +27,12 @@ const ContextMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
23
27
|
const {
|
|
24
28
|
enableModernizedComponents
|
|
25
29
|
} = useBlueprintModernization();
|
|
30
|
+
const {
|
|
31
|
+
componentsWithAnimationEnabled
|
|
32
|
+
} = useBlueprintConfiguration();
|
|
33
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('ContextMenu');
|
|
34
|
+
const sizeObserverRef = useContentSizeObserver(360, 360);
|
|
35
|
+
const ref = useForkRef(forwardedRef, sizeObserverRef);
|
|
26
36
|
const {
|
|
27
37
|
isMenuFullScreenEnabled
|
|
28
38
|
} = useFullScreenContextMenu();
|
|
@@ -36,7 +46,7 @@ const ContextMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
36
46
|
container: container,
|
|
37
47
|
children: jsxs(ContextMenuPrimitve.SubContent, {
|
|
38
48
|
...rest,
|
|
39
|
-
ref:
|
|
49
|
+
ref: ref,
|
|
40
50
|
alignOffset: alignOffsetPx,
|
|
41
51
|
className: clsx(styles.menuBlock, className),
|
|
42
52
|
"data-menu-fullscreen": true,
|
|
@@ -56,10 +66,11 @@ const ContextMenuSubMenuContent = /*#__PURE__*/forwardRef((props, forwardedRef)
|
|
|
56
66
|
container: container,
|
|
57
67
|
children: jsx(ContextMenuPrimitve.SubContent, {
|
|
58
68
|
...rest,
|
|
59
|
-
ref:
|
|
69
|
+
ref: ref,
|
|
60
70
|
alignOffset: alignOffsetPx,
|
|
61
71
|
className: clsx(styles.menuBlock, className),
|
|
62
72
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
73
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
63
74
|
sideOffset: sideOffsetPx,
|
|
64
75
|
children: children
|
|
65
76
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"menuBlock":"bp_context_menu_module_menuBlock--
|
|
2
|
+
var styles = {"menuBlock":"bp_context_menu_module_menuBlock--32816","menuHeader":"bp_context_menu_module_menuHeader--32816","fullScreenContent":"bp_context_menu_module_fullScreenContent--32816","menuItemsSeparator":"bp_context_menu_module_menuItemsSeparator--32816","menuItem":"bp_context_menu_module_menuItem--32816","startElement":"bp_context_menu_module_startElement--32816","endElement":"bp_context_menu_module_endElement--32816","headerTextContent":"bp_context_menu_module_headerTextContent--32816","submenuCloseButton":"bp_context_menu_module_submenuCloseButton--32816","menuCloseButton":"bp_context_menu_module_menuCloseButton--32816","ellipsis":"bp_context_menu_module_ellipsis--32816"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -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--6e932","fullScreenContent":"bp_dropdown_menu_module_fullScreenContent--6e932","subheader":"bp_dropdown_menu_module_subheader--6e932","uppercased":"bp_dropdown_menu_module_uppercased--6e932","dropdownMenuItemSeparator":"bp_dropdown_menu_module_dropdownMenuItemSeparator--6e932","ellipsis":"bp_dropdown_menu_module_ellipsis--6e932","itemBody":"bp_dropdown_menu_module_itemBody--6e932","itemOverflow":"bp_dropdown_menu_module_itemOverflow--6e932","menuItemCaption":"bp_dropdown_menu_module_menuItemCaption--6e932","checkmark":"bp_dropdown_menu_module_checkmark--6e932","mediumSpacing":"bp_dropdown_menu_module_mediumSpacing--6e932","item":"bp_dropdown_menu_module_item--6e932","radioItem":"bp_dropdown_menu_module_radioItem--6e932","radioItemMediumSpacing":"bp_dropdown_menu_module_radioItemMediumSpacing--6e932","menuItemMainContent":"bp_dropdown_menu_module_menuItemMainContent--6e932","checkboxItem":"bp_dropdown_menu_module_checkboxItem--6e932","checkboxItemMediumSpacing":"bp_dropdown_menu_module_checkboxItemMediumSpacing--6e932","mediumItemLayout":"bp_dropdown_menu_module_mediumItemLayout--6e932","startElement":"bp_dropdown_menu_module_startElement--6e932","menuItemMainContent_directChild":"bp_dropdown_menu_module_menuItemMainContent_directChild--6e932","endElement":"bp_dropdown_menu_module_endElement--6e932","destructive":"bp_dropdown_menu_module_destructive--6e932","menuHeader":"bp_dropdown_menu_module_menuHeader--6e932","headerTextContent":"bp_dropdown_menu_module_headerTextContent--6e932","submenuCloseButton":"bp_dropdown_menu_module_submenuCloseButton--6e932","menuCloseButton":"bp_dropdown_menu_module_menuCloseButton--6e932"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.21",
|
|
49
49
|
"@ariakit/react-core": "0.4.21",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.117.2",
|
|
51
51
|
"@internationalized/date": "^3.12.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.
|
|
80
|
+
"@box/storybook-utils": "^0.19.2",
|
|
81
81
|
"@figma/code-connect": "1.4.4",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|