@box/blueprint-web 16.6.2 → 16.6.3
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
CHANGED
|
@@ -12912,7 +12912,7 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
12912
12912
|
width:fit-content;
|
|
12913
12913
|
}
|
|
12914
12914
|
|
|
12915
|
-
.bp_trigger_button_module_triggerButton--
|
|
12915
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=false].bp_trigger_button_module_secondary--8da2b{
|
|
12916
12916
|
--trigger-button-background:var(--surface-dropdown-secondary-surface);
|
|
12917
12917
|
--trigger-button-border:var(--border-1) solid var(--border-cta-border-secondary);
|
|
12918
12918
|
--trigger-button-focus-or-hover-background:var(--surface-dropdown-secondary-surface-hover);
|
|
@@ -12921,11 +12921,11 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
12921
12921
|
--trigger-button-active-background:var(--surface-dropdown-secondary-surface-pressed);
|
|
12922
12922
|
--trigger-button-active-border:var(--border-1) solid var(--border-cta-border-secondary);
|
|
12923
12923
|
}
|
|
12924
|
-
.bp_trigger_button_module_triggerButton--
|
|
12924
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=false].bp_trigger_button_module_tertiary--8da2b{
|
|
12925
12925
|
--trigger-button-focus-or-hover-background:var(--surface-dropdown-primary-surface-hover);
|
|
12926
12926
|
--trigger-button-active-background:var(--surface-dropdown-primary-surface-pressed);
|
|
12927
12927
|
}
|
|
12928
|
-
.bp_trigger_button_module_triggerButton--
|
|
12928
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=false].bp_trigger_button_module_extraSmall--8da2b{
|
|
12929
12929
|
--button-xsmall-gap:var(--space-1);
|
|
12930
12930
|
--button-xsmall-height:var(--size-6);
|
|
12931
12931
|
--button-xsmall-padding:0.375rem var(--space-1);
|
|
@@ -12937,14 +12937,14 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
12937
12937
|
text-decoration:var(--body-default-text-decoration);
|
|
12938
12938
|
text-transform:var(--body-default-text-case);
|
|
12939
12939
|
}
|
|
12940
|
-
.bp_trigger_button_module_triggerButton--
|
|
12940
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=false].bp_trigger_button_module_small--8da2b{
|
|
12941
12941
|
--button-small-padding:0.375rem var(--space-2);
|
|
12942
12942
|
}
|
|
12943
|
-
.bp_trigger_button_module_triggerButton--
|
|
12943
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=false].bp_trigger_button_module_large--8da2b{
|
|
12944
12944
|
--button-large-padding:0.375rem var(--space-3) 0.375rem var(--space-2);
|
|
12945
12945
|
}
|
|
12946
12946
|
|
|
12947
|
-
.bp_trigger_button_module_triggerButton--
|
|
12947
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=true].bp_trigger_button_module_secondary--8da2b{
|
|
12948
12948
|
--trigger-button-background:var(--bp-surface-dropdown-secondary-surface);
|
|
12949
12949
|
--trigger-button-border:var(--bp-border-01) solid var(--bp-border-dropdown-secondary-border);
|
|
12950
12950
|
--trigger-button-focus-or-hover-background:var(--bp-surface-dropdown-secondary-surface-hover);
|
|
@@ -12953,11 +12953,11 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
12953
12953
|
--trigger-button-active-background:var(--bp-surface-dropdown-secondary-surface-pressed);
|
|
12954
12954
|
--trigger-button-active-border:var(--bp-border-01) solid var(--bp-border-dropdown-secondary-border);
|
|
12955
12955
|
}
|
|
12956
|
-
.bp_trigger_button_module_triggerButton--
|
|
12956
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=true].bp_trigger_button_module_tertiary--8da2b{
|
|
12957
12957
|
--trigger-button-focus-or-hover-background:var(--bp-surface-dropdown-tertiary-surface-hover);
|
|
12958
12958
|
--trigger-button-active-background:var(--bp-surface-dropdown-secondary-surface-pressed);
|
|
12959
12959
|
}
|
|
12960
|
-
.bp_trigger_button_module_triggerButton--
|
|
12960
|
+
.bp_trigger_button_module_triggerButton--8da2b[data-modern=true].bp_trigger_button_module_extraSmall--8da2b{
|
|
12961
12961
|
--button-xsmall-gap:var(--bp-space-010);
|
|
12962
12962
|
--button-xsmall-height:var(--bp-size-060);
|
|
12963
12963
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
@@ -12968,51 +12968,66 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
|
|
|
12968
12968
|
line-height:var(--bp-font-line-height-04);
|
|
12969
12969
|
}
|
|
12970
12970
|
|
|
12971
|
-
.bp_trigger_button_module_triggerButton--
|
|
12971
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_secondary--8da2b{
|
|
12972
12972
|
background:var(--trigger-button-background);
|
|
12973
12973
|
border:var(--trigger-button-border);
|
|
12974
12974
|
}
|
|
12975
|
-
.bp_trigger_button_module_triggerButton--
|
|
12975
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_secondary--8da2b:not(:disabled):hover,.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_secondary--8da2b:not(:disabled)[data-focus-visible]{
|
|
12976
12976
|
background:var(--trigger-button-focus-or-hover-background);
|
|
12977
12977
|
border:var(--trigger-button-focus-or-hover-border);
|
|
12978
12978
|
}
|
|
12979
|
-
.bp_trigger_button_module_triggerButton--
|
|
12979
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_secondary--8da2b:not(:disabled):active{
|
|
12980
12980
|
background:var(--trigger-button-active-background);
|
|
12981
12981
|
border:var(--trigger-button-active-border);
|
|
12982
12982
|
}
|
|
12983
|
-
.bp_trigger_button_module_triggerButton--
|
|
12983
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_tertiary--8da2b{
|
|
12984
12984
|
background:var(--trigger-button-background);
|
|
12985
12985
|
border:var(--trigger-button-border);
|
|
12986
12986
|
}
|
|
12987
|
-
.bp_trigger_button_module_triggerButton--
|
|
12987
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_tertiary--8da2b:not(:disabled):hover,.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_tertiary--8da2b:not(:disabled)[data-focus-visible]{
|
|
12988
12988
|
background:var(--trigger-button-focus-or-hover-background);
|
|
12989
12989
|
}
|
|
12990
|
-
.bp_trigger_button_module_triggerButton--
|
|
12990
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_tertiary--8da2b:not(:disabled):active{
|
|
12991
12991
|
background:var(--trigger-button-active-background);
|
|
12992
12992
|
}
|
|
12993
|
-
.bp_trigger_button_module_triggerButton--
|
|
12993
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_extraSmall--8da2b{
|
|
12994
12994
|
border:var(--trigger-button-focus-or-hover-border-xsmall);
|
|
12995
12995
|
gap:var(--button-xsmall-gap);
|
|
12996
12996
|
min-height:var(--button-xsmall-height);
|
|
12997
12997
|
}
|
|
12998
|
-
.bp_trigger_button_module_triggerButton--
|
|
12998
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_extraSmall--8da2b:not(:disabled):active,.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_extraSmall--8da2b:not(:disabled):hover,.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_extraSmall--8da2b:not(:disabled)[data-focus-visible]{
|
|
12999
12999
|
border:var(--trigger-button-focus-or-hover-border-xsmall);
|
|
13000
13000
|
}
|
|
13001
|
-
.bp_trigger_button_module_triggerButton--
|
|
13001
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_extraSmall--8da2b.bp_trigger_button_module_startIcon--8da2b{
|
|
13002
13002
|
padding-left:.625rem;
|
|
13003
13003
|
}
|
|
13004
|
-
.bp_trigger_button_module_triggerButton--
|
|
13004
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_small--8da2b{
|
|
13005
13005
|
padding:var(--button-small-padding);
|
|
13006
13006
|
}
|
|
13007
|
-
.bp_trigger_button_module_triggerButton--
|
|
13007
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_small--8da2b.bp_trigger_button_module_startIcon--8da2b{
|
|
13008
13008
|
padding-left:.625rem;
|
|
13009
13009
|
}
|
|
13010
|
-
.bp_trigger_button_module_triggerButton--
|
|
13010
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_large--8da2b{
|
|
13011
13011
|
padding:var(--button-large-padding);
|
|
13012
13012
|
}
|
|
13013
|
-
.bp_trigger_button_module_triggerButton--
|
|
13013
|
+
.bp_trigger_button_module_triggerButton--8da2b.bp_trigger_button_module_large--8da2b.bp_trigger_button_module_startIcon--8da2b{
|
|
13014
13014
|
padding-left:.625rem;
|
|
13015
13015
|
}
|
|
13016
|
+
.bp_trigger_button_module_triggerButton--8da2b .bp_trigger_button_module_labelEllipsis--8da2b{
|
|
13017
|
+
flex:1 1 0;
|
|
13018
|
+
min-width:0;
|
|
13019
|
+
overflow:hidden;
|
|
13020
|
+
text-overflow:ellipsis;
|
|
13021
|
+
white-space:nowrap;
|
|
13022
|
+
}
|
|
13023
|
+
.bp_trigger_button_module_triggerButton--8da2b .bp_trigger_button_module_labelWrap--8da2b{
|
|
13024
|
+
word-wrap:break-word;
|
|
13025
|
+
flex:1 1 0;
|
|
13026
|
+
min-width:0;
|
|
13027
|
+
overflow-wrap:break-word;
|
|
13028
|
+
text-align:left;
|
|
13029
|
+
white-space:normal;
|
|
13030
|
+
}
|
|
13016
13031
|
.bp_styles_module_splitButton--a3588[data-modern=false]{
|
|
13017
13032
|
--split-button-left-width:100%;
|
|
13018
13033
|
--split-button-left-gap-margin-inline-end:calc(var(--space-05)/2);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BaseButtonIconProps, type BaseButtonProps } from '../primitives/base-button';
|
|
2
2
|
export type TriggerButtonSize = 'extraSmall' | Exclude<NonNullable<BaseButtonProps['size']>, 'x-small'>;
|
|
3
|
+
export type TriggerButtonOverflow = 'default' | 'ellipsis' | 'wrap';
|
|
3
4
|
export type TriggerButtonProps = Omit<BaseButtonProps, 'size'> & {
|
|
4
5
|
/** Trigger button label */
|
|
5
6
|
label?: string;
|
|
@@ -9,6 +10,8 @@ export type TriggerButtonProps = Omit<BaseButtonProps, 'size'> & {
|
|
|
9
10
|
caretDirection: 'up' | 'down';
|
|
10
11
|
/** The size of the trigger button */
|
|
11
12
|
size?: TriggerButtonSize;
|
|
13
|
+
/** Controls how the label handles overflow. 'ellipsis' ellipsizes to one line with a tooltip; 'wrap' allows wrapping. */
|
|
14
|
+
overflow?: TriggerButtonOverflow;
|
|
12
15
|
};
|
|
13
16
|
/**
|
|
14
17
|
* The TriggerButton is a stylized button that has an optional start icon, optional label, and a caret as the end icon.
|
|
@@ -2,9 +2,11 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { CaretUp, CaretDown } from '@box/blueprint-web-assets/icons/Fill';
|
|
3
3
|
import { ChevronUp, ChevronDown } from '@box/blueprint-web-assets/icons/Medium';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useRef } from 'react';
|
|
6
6
|
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
7
7
|
import { BaseButton } from '../primitives/base-button/index.js';
|
|
8
|
+
import { TooltipWrapper } from '../utils/TooltipWrapper.js';
|
|
9
|
+
import { useIsEllipsized } from '../utils/useIsEllipsized.js';
|
|
8
10
|
import styles from './trigger-button.module.js';
|
|
9
11
|
|
|
10
12
|
const buttonSizeToStartIconSizeMap = {
|
|
@@ -20,19 +22,26 @@ const TriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
20
22
|
const {
|
|
21
23
|
caretDirection,
|
|
22
24
|
label,
|
|
25
|
+
overflow = 'default',
|
|
23
26
|
startIcon,
|
|
24
27
|
size = 'small',
|
|
25
28
|
className,
|
|
26
29
|
variant = 'secondary',
|
|
27
30
|
...rest
|
|
28
31
|
} = props;
|
|
32
|
+
const {
|
|
33
|
+
disabled,
|
|
34
|
+
loading
|
|
35
|
+
} = rest;
|
|
29
36
|
const startIconSize = buttonSizeToStartIconSizeMap[size];
|
|
30
37
|
const {
|
|
31
38
|
enableModernizedComponents
|
|
32
39
|
} = useBlueprintModernization();
|
|
40
|
+
const labelRef = useRef(null);
|
|
41
|
+
const isEllipsized = useIsEllipsized(labelRef);
|
|
33
42
|
// Map extraSmall to small for BaseButton to accept the extraSmall size, but apply our custom styling. BaseButton does not support extraSmall size.
|
|
34
43
|
const baseButtonSize = size === 'extraSmall' ? 'small' : size;
|
|
35
|
-
|
|
44
|
+
const button = jsxs(BaseButton, {
|
|
36
45
|
ref: forwardedRef,
|
|
37
46
|
className: clsx(styles.triggerButton, styles[size], styles[variant], {
|
|
38
47
|
[styles.startIcon]: !!startIcon
|
|
@@ -48,7 +57,14 @@ const TriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
48
57
|
height: startIconSize,
|
|
49
58
|
width: startIconSize
|
|
50
59
|
}
|
|
51
|
-
}), label && jsx(BaseButton.Label, {
|
|
60
|
+
}), label && overflow === 'ellipsis' && jsx(BaseButton.Label, {
|
|
61
|
+
ref: labelRef,
|
|
62
|
+
className: styles.labelEllipsis,
|
|
63
|
+
children: label
|
|
64
|
+
}), label && overflow !== 'ellipsis' && jsx(BaseButton.Label, {
|
|
65
|
+
className: clsx({
|
|
66
|
+
[styles.labelWrap]: overflow === 'wrap'
|
|
67
|
+
}),
|
|
52
68
|
children: label
|
|
53
69
|
}), enableModernizedComponents ? jsx(BaseButton.Icon, {
|
|
54
70
|
icon: caretDirection === 'up' ? ChevronUp : ChevronDown
|
|
@@ -56,6 +72,11 @@ const TriggerButton = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
56
72
|
icon: caretDirection === 'up' ? CaretUp : CaretDown
|
|
57
73
|
})]
|
|
58
74
|
});
|
|
75
|
+
return overflow === 'ellipsis' && !disabled && !loading ? jsx(TooltipWrapper, {
|
|
76
|
+
tooltipContent: label,
|
|
77
|
+
withTooltip: isEllipsized,
|
|
78
|
+
children: button
|
|
79
|
+
}) : button;
|
|
59
80
|
});
|
|
60
81
|
|
|
61
82
|
export { TriggerButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"triggerButton":"bp_trigger_button_module_triggerButton--
|
|
2
|
+
var styles = {"triggerButton":"bp_trigger_button_module_triggerButton--8da2b","secondary":"bp_trigger_button_module_secondary--8da2b","tertiary":"bp_trigger_button_module_tertiary--8da2b","extraSmall":"bp_trigger_button_module_extraSmall--8da2b","small":"bp_trigger_button_module_small--8da2b","large":"bp_trigger_button_module_large--8da2b","startIcon":"bp_trigger_button_module_startIcon--8da2b","labelEllipsis":"bp_trigger_button_module_labelEllipsis--8da2b","labelWrap":"bp_trigger_button_module_labelWrap--8da2b"};
|
|
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": "16.6.
|
|
3
|
+
"version": "16.6.3",
|
|
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": "^5.3.
|
|
50
|
+
"@box/blueprint-web-assets": "^5.3.1",
|
|
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": "^1.1.
|
|
80
|
+
"@box/storybook-utils": "^1.1.17",
|
|
81
81
|
"@figma/code-connect": "1.4.4",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|