@homebound/beam 2.411.0-alpha.1 → 2.412.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/index.cjs +223 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +221 -215
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6727,10 +6727,14 @@ var import_react26 = require("react");
|
|
|
6727
6727
|
var import_react_aria10 = require("react-aria");
|
|
6728
6728
|
var import_react_stately2 = require("react-stately");
|
|
6729
6729
|
|
|
6730
|
-
// src/components/
|
|
6730
|
+
// src/components/Button.tsx
|
|
6731
6731
|
var import_react25 = require("react");
|
|
6732
6732
|
var import_react_aria9 = require("react-aria");
|
|
6733
6733
|
|
|
6734
|
+
// src/components/internal/OverlayTrigger.tsx
|
|
6735
|
+
var import_react24 = require("react");
|
|
6736
|
+
var import_react_aria8 = require("react-aria");
|
|
6737
|
+
|
|
6734
6738
|
// src/components/Avatar/AvatarButton.tsx
|
|
6735
6739
|
var import_react22 = require("react");
|
|
6736
6740
|
var import_react_aria6 = require("react-aria");
|
|
@@ -6851,185 +6855,10 @@ var pressedStyles = Css.addIn(
|
|
|
6851
6855
|
Css.br100.bgGray900.contentEmpty.w100.h100.absolute.top0.left0.add("opacity", "0.2").$
|
|
6852
6856
|
).$;
|
|
6853
6857
|
|
|
6854
|
-
// src/components/
|
|
6858
|
+
// src/components/NavLink.tsx
|
|
6855
6859
|
var import_react23 = require("react");
|
|
6856
6860
|
var import_react_aria7 = require("react-aria");
|
|
6857
6861
|
var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
|
|
6858
|
-
function Button(props) {
|
|
6859
|
-
const {
|
|
6860
|
-
onClick: onPress,
|
|
6861
|
-
disabled,
|
|
6862
|
-
endAdornment,
|
|
6863
|
-
menuTriggerProps,
|
|
6864
|
-
tooltip,
|
|
6865
|
-
openInNew,
|
|
6866
|
-
download,
|
|
6867
|
-
contrast = false,
|
|
6868
|
-
forceFocusStyles = false,
|
|
6869
|
-
labelInFlight,
|
|
6870
|
-
...otherProps
|
|
6871
|
-
} = props;
|
|
6872
|
-
const asLink = typeof onPress === "string";
|
|
6873
|
-
const showExternalLinkIcon = asLink && isAbsoluteUrl(onPress) || openInNew;
|
|
6874
|
-
const [asyncInProgress, setAsyncInProgress] = (0, import_react23.useState)(false);
|
|
6875
|
-
const isDisabled = !!disabled;
|
|
6876
|
-
const ariaProps = { onPress, isDisabled: isDisabled || asyncInProgress, ...otherProps, ...menuTriggerProps };
|
|
6877
|
-
const {
|
|
6878
|
-
label,
|
|
6879
|
-
// Default the icon based on other properties.
|
|
6880
|
-
icon = download ? "download" : showExternalLinkIcon ? "linkExternal" : void 0,
|
|
6881
|
-
variant = "primary",
|
|
6882
|
-
size = "sm",
|
|
6883
|
-
buttonRef
|
|
6884
|
-
} = ariaProps;
|
|
6885
|
-
const ref = useGetRef(buttonRef);
|
|
6886
|
-
const tid = useTestIds(props, labelOr(ariaProps, "button"));
|
|
6887
|
-
const { buttonProps, isPressed } = (0, import_react_aria7.useButton)(
|
|
6888
|
-
{
|
|
6889
|
-
...ariaProps,
|
|
6890
|
-
onPress: asLink ? noop : (e) => {
|
|
6891
|
-
const result = onPress(e);
|
|
6892
|
-
if (isPromise(result)) {
|
|
6893
|
-
setAsyncInProgress(true);
|
|
6894
|
-
result.finally(() => setAsyncInProgress(false));
|
|
6895
|
-
}
|
|
6896
|
-
return result;
|
|
6897
|
-
},
|
|
6898
|
-
elementType: asLink ? "a" : "button"
|
|
6899
|
-
},
|
|
6900
|
-
ref
|
|
6901
|
-
);
|
|
6902
|
-
const { isFocusVisible, focusProps } = (0, import_react_aria7.useFocusRing)(ariaProps);
|
|
6903
|
-
const { hoverProps, isHovered } = (0, import_react_aria7.useHover)(ariaProps);
|
|
6904
|
-
const { baseStyles: baseStyles5, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3, focusStyles: focusStyles2 } = (0, import_react23.useMemo)(
|
|
6905
|
-
() => getButtonStyles(variant, size, contrast),
|
|
6906
|
-
[variant, size, contrast]
|
|
6907
|
-
);
|
|
6908
|
-
const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
6909
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { xss: iconStyles[size], icon }),
|
|
6910
|
-
labelInFlight && asyncInProgress ? labelInFlight : label,
|
|
6911
|
-
(endAdornment || asyncInProgress) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { css: Css.ml1.$, children: asyncInProgress ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Loader, { size: "xs", contrast }) : endAdornment })
|
|
6912
|
-
] });
|
|
6913
|
-
const buttonAttrs = {
|
|
6914
|
-
ref,
|
|
6915
|
-
...buttonProps,
|
|
6916
|
-
...focusProps,
|
|
6917
|
-
...hoverProps,
|
|
6918
|
-
className: asLink ? navLink : void 0,
|
|
6919
|
-
css: {
|
|
6920
|
-
...Css.buttonBase.tt("inherit").$,
|
|
6921
|
-
...baseStyles5,
|
|
6922
|
-
...isHovered && !isPressed ? hoverStyles4 : {},
|
|
6923
|
-
...isPressed ? pressedStyles3 : {},
|
|
6924
|
-
...isDisabled || asyncInProgress ? { ...disabledStyles4, ...Css.cursorNotAllowed.$ } : {},
|
|
6925
|
-
...isFocusVisible || forceFocusStyles ? focusStyles2 : {}
|
|
6926
|
-
},
|
|
6927
|
-
...tid
|
|
6928
|
-
};
|
|
6929
|
-
return maybeTooltip({
|
|
6930
|
-
title: resolveTooltip(disabled, tooltip),
|
|
6931
|
-
placement: "top",
|
|
6932
|
-
children: getButtonOrLink(buttonContent, onPress, buttonAttrs, openInNew, download)
|
|
6933
|
-
});
|
|
6934
|
-
}
|
|
6935
|
-
function getButtonStyles(variant, size, contrast) {
|
|
6936
|
-
const styles = variantStyles(contrast)[variant];
|
|
6937
|
-
if (variant === "text") {
|
|
6938
|
-
return styles;
|
|
6939
|
-
}
|
|
6940
|
-
return {
|
|
6941
|
-
...styles,
|
|
6942
|
-
baseStyles: { ...styles.baseStyles, ...sizeStyles[size] }
|
|
6943
|
-
};
|
|
6944
|
-
}
|
|
6945
|
-
var variantStyles = (contrast) => ({
|
|
6946
|
-
primary: {
|
|
6947
|
-
baseStyles: Css.bgBlue600.white.$,
|
|
6948
|
-
hoverStyles: Css.bgBlue700.$,
|
|
6949
|
-
pressedStyles: Css.bgBlue800.$,
|
|
6950
|
-
disabledStyles: Css.bgBlue200.if(contrast).gray600.bgBlue900.$,
|
|
6951
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6952
|
-
},
|
|
6953
|
-
secondary: {
|
|
6954
|
-
baseStyles: Css.bgWhite.bcGray300.bw1.ba.blue600.$,
|
|
6955
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray300.$,
|
|
6956
|
-
pressedStyles: Css.bgGray200.if(contrast).bgGray100.$,
|
|
6957
|
-
disabledStyles: Css.bgWhite.blue300.$,
|
|
6958
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6959
|
-
},
|
|
6960
|
-
secondaryBlack: {
|
|
6961
|
-
baseStyles: Css.bgWhite.bcGray300.bw1.ba.gray900.$,
|
|
6962
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6963
|
-
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6964
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6965
|
-
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(36, 36, 36, 1)" /* Gray900 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(175, 175, 175, 1)" /* Gray500 */}`).$
|
|
6966
|
-
},
|
|
6967
|
-
tertiary: {
|
|
6968
|
-
baseStyles: Css.bgTransparent.blue600.if(contrast).white.$,
|
|
6969
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6970
|
-
pressedStyles: Css.blue800.if(contrast).bgWhite.gray900.$,
|
|
6971
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6972
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(96, 165, 250, 1)" /* Blue400 */}`).bgGray700.white.$
|
|
6973
|
-
},
|
|
6974
|
-
tertiaryDanger: {
|
|
6975
|
-
baseStyles: Css.bgTransparent.red600.if(contrast).red400.$,
|
|
6976
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6977
|
-
pressedStyles: Css.red800.if(contrast).bgWhite.gray900.$,
|
|
6978
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6979
|
-
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(239, 68, 68, 1)" /* Red500 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(239, 68, 68, 1)" /* Red500 */}`).$
|
|
6980
|
-
},
|
|
6981
|
-
danger: {
|
|
6982
|
-
baseStyles: Css.bgRed600.white.$,
|
|
6983
|
-
hoverStyles: Css.bgRed700.$,
|
|
6984
|
-
pressedStyles: Css.bgRed800.$,
|
|
6985
|
-
disabledStyles: Css.bgRed200.if(contrast).bgRed900.gray600.$,
|
|
6986
|
-
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6987
|
-
},
|
|
6988
|
-
quaternary: {
|
|
6989
|
-
baseStyles: Css.bgTransparent.gray900.if(contrast).gray400.$,
|
|
6990
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6991
|
-
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6992
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6993
|
-
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(36, 36, 36, 1)" /* Gray900 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(175, 175, 175, 1)" /* Gray500 */}`).$
|
|
6994
|
-
},
|
|
6995
|
-
caution: {
|
|
6996
|
-
baseStyles: Css.bgYellow200.gray900.$,
|
|
6997
|
-
hoverStyles: Css.bgYellow300.$,
|
|
6998
|
-
pressedStyles: Css.bgYellow400.$,
|
|
6999
|
-
disabledStyles: Css.bgYellow200.if(contrast).bgYellow900.white.$,
|
|
7000
|
-
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7001
|
-
},
|
|
7002
|
-
text: {
|
|
7003
|
-
baseStyles: Css.blue700.add("fontSize", "inherit").if(contrast).blue400.$,
|
|
7004
|
-
hoverStyles: Css.blue600.if(contrast).blue300.$,
|
|
7005
|
-
pressedStyles: Css.blue700.if(contrast).blue200.$,
|
|
7006
|
-
disabledStyles: Css.blue300.if(contrast).blue700.$,
|
|
7007
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7008
|
-
},
|
|
7009
|
-
// Todo: handle contrast variant
|
|
7010
|
-
textSecondary: {
|
|
7011
|
-
baseStyles: Css.blue600.add("fontSize", "inherit").$,
|
|
7012
|
-
hoverStyles: Css.bgGray100.$,
|
|
7013
|
-
pressedStyles: Css.blue600.$,
|
|
7014
|
-
disabledStyles: Css.bgWhite.blue300.$,
|
|
7015
|
-
focusStyles: Css.blue600.$
|
|
7016
|
-
}
|
|
7017
|
-
});
|
|
7018
|
-
var sizeStyles = {
|
|
7019
|
-
sm: Css.hPx(32).pxPx(12).$,
|
|
7020
|
-
md: Css.hPx(40).px1.$,
|
|
7021
|
-
lg: Css.hPx(48).px3.$
|
|
7022
|
-
};
|
|
7023
|
-
var iconStyles = {
|
|
7024
|
-
sm: Css.mrPx(4).$,
|
|
7025
|
-
md: Css.mr1.$,
|
|
7026
|
-
lg: Css.mrPx(10).$
|
|
7027
|
-
};
|
|
7028
|
-
|
|
7029
|
-
// src/components/NavLink.tsx
|
|
7030
|
-
var import_react24 = require("react");
|
|
7031
|
-
var import_react_aria8 = require("react-aria");
|
|
7032
|
-
var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
|
|
7033
6862
|
function NavLink(props) {
|
|
7034
6863
|
const {
|
|
7035
6864
|
disabled: isDisabled,
|
|
@@ -7043,10 +6872,10 @@ function NavLink(props) {
|
|
|
7043
6872
|
const ariaProps = { children: label, isDisabled, ...menuTriggerProps, ...otherProps };
|
|
7044
6873
|
const { href, active = false, icon = false, variant } = ariaProps;
|
|
7045
6874
|
const ref = useGetRef(buttonRef);
|
|
7046
|
-
const { buttonProps, isPressed } = (0,
|
|
7047
|
-
const { hoverProps, isHovered } = (0,
|
|
7048
|
-
const { isFocusVisible, focusProps } = (0,
|
|
7049
|
-
const { baseStyles: baseStyles5, activeStyles: activeStyles4, focusRingStyles: focusRingStyles2, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3 } = (0,
|
|
6875
|
+
const { buttonProps, isPressed } = (0, import_react_aria7.useButton)({ ...ariaProps, elementType: href ? "a" : "button" }, ref);
|
|
6876
|
+
const { hoverProps, isHovered } = (0, import_react_aria7.useHover)({ isDisabled });
|
|
6877
|
+
const { isFocusVisible, focusProps } = (0, import_react_aria7.useFocusRing)(ariaProps);
|
|
6878
|
+
const { baseStyles: baseStyles5, activeStyles: activeStyles4, focusRingStyles: focusRingStyles2, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3 } = (0, import_react23.useMemo)(
|
|
7050
6879
|
() => getNavLinkStyles(variant, contrast),
|
|
7051
6880
|
[variant, contrast]
|
|
7052
6881
|
);
|
|
@@ -7066,11 +6895,11 @@ function NavLink(props) {
|
|
|
7066
6895
|
...isPressed && pressedStyles3
|
|
7067
6896
|
}
|
|
7068
6897
|
};
|
|
7069
|
-
const linkContent = /* @__PURE__ */ (0,
|
|
6898
|
+
const linkContent = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
7070
6899
|
label,
|
|
7071
|
-
icon && /* @__PURE__ */ (0,
|
|
6900
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { css: Css.ml1.$, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { icon }) })
|
|
7072
6901
|
] });
|
|
7073
|
-
return getButtonOrLink(linkContent, href, { ...(0,
|
|
6902
|
+
return getButtonOrLink(linkContent, href, { ...(0, import_react_aria7.mergeProps)(buttonProps, focusProps, hoverProps), ...linkAttributes });
|
|
7074
6903
|
}
|
|
7075
6904
|
function getNavLinkStyles(variant, contrast) {
|
|
7076
6905
|
return navLinkVariantStyles(contrast)[variant];
|
|
@@ -7099,7 +6928,7 @@ var navLinkVariantStyles = (contrast) => ({
|
|
|
7099
6928
|
});
|
|
7100
6929
|
|
|
7101
6930
|
// src/components/internal/OverlayTrigger.tsx
|
|
7102
|
-
var
|
|
6931
|
+
var import_jsx_runtime25 = (
|
|
7103
6932
|
// Add `line-height: 0` to prevent the Icon button and Avatar buttons from inheriting the line-height, causing them to be taller than they should.
|
|
7104
6933
|
require("@emotion/react/jsx-runtime")
|
|
7105
6934
|
);
|
|
@@ -7118,8 +6947,8 @@ function OverlayTrigger(props) {
|
|
|
7118
6947
|
showActiveBorder = false,
|
|
7119
6948
|
contrast = false
|
|
7120
6949
|
} = props;
|
|
7121
|
-
const popoverRef = (0,
|
|
7122
|
-
const { overlayProps: positionProps } = (0,
|
|
6950
|
+
const popoverRef = (0, import_react24.useRef)(null);
|
|
6951
|
+
const { overlayProps: positionProps } = (0, import_react_aria8.useOverlayPosition)({
|
|
7123
6952
|
targetRef: buttonRef,
|
|
7124
6953
|
overlayRef: popoverRef,
|
|
7125
6954
|
shouldFlip: true,
|
|
@@ -7132,8 +6961,8 @@ function OverlayTrigger(props) {
|
|
|
7132
6961
|
props,
|
|
7133
6962
|
isTextButton(trigger) ? defaultTestId(labelOr(trigger, "overlayTrigger")) : isNavLinkButton(trigger) ? defaultTestId(trigger.navLabel) : isIconButton(trigger) ? trigger.icon : trigger.name
|
|
7134
6963
|
);
|
|
7135
|
-
return /* @__PURE__ */ (0,
|
|
7136
|
-
isTextButton(trigger) ? /* @__PURE__ */ (0,
|
|
6964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: Css.dib.add("lineHeight", 0).$, children: [
|
|
6965
|
+
isTextButton(trigger) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7137
6966
|
Button,
|
|
7138
6967
|
{
|
|
7139
6968
|
variant: variant ? variant : "secondary",
|
|
@@ -7141,14 +6970,14 @@ function OverlayTrigger(props) {
|
|
|
7141
6970
|
...trigger,
|
|
7142
6971
|
menuTriggerProps,
|
|
7143
6972
|
buttonRef,
|
|
7144
|
-
endAdornment: !hideEndAdornment ? /* @__PURE__ */ (0,
|
|
6973
|
+
endAdornment: !hideEndAdornment ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { icon: state.isOpen ? "chevronUp" : "chevronDown" }) : null,
|
|
7145
6974
|
disabled,
|
|
7146
6975
|
tooltip,
|
|
7147
6976
|
onClick: menuTriggerProps.onPress ?? noop,
|
|
7148
6977
|
forceFocusStyles: showActiveBorder && state.isOpen,
|
|
7149
6978
|
...tid
|
|
7150
6979
|
}
|
|
7151
|
-
) : isNavLinkButton(trigger) ? /* @__PURE__ */ (0,
|
|
6980
|
+
) : isNavLinkButton(trigger) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7152
6981
|
NavLink,
|
|
7153
6982
|
{
|
|
7154
6983
|
...trigger,
|
|
@@ -7159,7 +6988,7 @@ function OverlayTrigger(props) {
|
|
|
7159
6988
|
buttonRef,
|
|
7160
6989
|
...tid
|
|
7161
6990
|
}
|
|
7162
|
-
) : isIconButton(trigger) ? /* @__PURE__ */ (0,
|
|
6991
|
+
) : isIconButton(trigger) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7163
6992
|
IconButton,
|
|
7164
6993
|
{
|
|
7165
6994
|
...trigger,
|
|
@@ -7171,7 +7000,7 @@ function OverlayTrigger(props) {
|
|
|
7171
7000
|
onClick: menuTriggerProps.onPress ?? noop,
|
|
7172
7001
|
forceFocusStyles: showActiveBorder && state.isOpen
|
|
7173
7002
|
}
|
|
7174
|
-
) : /* @__PURE__ */ (0,
|
|
7003
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7175
7004
|
AvatarButton,
|
|
7176
7005
|
{
|
|
7177
7006
|
...trigger,
|
|
@@ -7184,7 +7013,7 @@ function OverlayTrigger(props) {
|
|
|
7184
7013
|
forceFocusStyles: showActiveBorder && state.isOpen
|
|
7185
7014
|
}
|
|
7186
7015
|
),
|
|
7187
|
-
state.isOpen && /* @__PURE__ */ (0,
|
|
7016
|
+
state.isOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7188
7017
|
Popover,
|
|
7189
7018
|
{
|
|
7190
7019
|
triggerRef: buttonRef,
|
|
@@ -7210,6 +7039,179 @@ function labelOr(trigger, fallback) {
|
|
|
7210
7039
|
return typeof trigger.label === "string" ? trigger.label : fallback;
|
|
7211
7040
|
}
|
|
7212
7041
|
|
|
7042
|
+
// src/components/Button.tsx
|
|
7043
|
+
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
7044
|
+
function Button(props) {
|
|
7045
|
+
const {
|
|
7046
|
+
onClick: onPress,
|
|
7047
|
+
disabled,
|
|
7048
|
+
endAdornment,
|
|
7049
|
+
menuTriggerProps,
|
|
7050
|
+
tooltip,
|
|
7051
|
+
openInNew,
|
|
7052
|
+
download,
|
|
7053
|
+
contrast = false,
|
|
7054
|
+
forceFocusStyles = false,
|
|
7055
|
+
labelInFlight,
|
|
7056
|
+
...otherProps
|
|
7057
|
+
} = props;
|
|
7058
|
+
const asLink = typeof onPress === "string";
|
|
7059
|
+
const showExternalLinkIcon = asLink && isAbsoluteUrl(onPress) || openInNew;
|
|
7060
|
+
const [asyncInProgress, setAsyncInProgress] = (0, import_react25.useState)(false);
|
|
7061
|
+
const isDisabled = !!disabled;
|
|
7062
|
+
const ariaProps = { onPress, isDisabled: isDisabled || asyncInProgress, ...otherProps, ...menuTriggerProps };
|
|
7063
|
+
const {
|
|
7064
|
+
label,
|
|
7065
|
+
// Default the icon based on other properties.
|
|
7066
|
+
icon = download ? "download" : showExternalLinkIcon ? "linkExternal" : void 0,
|
|
7067
|
+
variant = "primary",
|
|
7068
|
+
size = "sm",
|
|
7069
|
+
buttonRef
|
|
7070
|
+
} = ariaProps;
|
|
7071
|
+
const ref = useGetRef(buttonRef);
|
|
7072
|
+
const tid = useTestIds(props, labelOr(ariaProps, "button"));
|
|
7073
|
+
const { buttonProps, isPressed } = (0, import_react_aria9.useButton)(
|
|
7074
|
+
{
|
|
7075
|
+
...ariaProps,
|
|
7076
|
+
onPress: asLink ? noop : (e) => {
|
|
7077
|
+
const result = onPress(e);
|
|
7078
|
+
if (isPromise(result)) {
|
|
7079
|
+
setAsyncInProgress(true);
|
|
7080
|
+
result.finally(() => setAsyncInProgress(false));
|
|
7081
|
+
}
|
|
7082
|
+
return result;
|
|
7083
|
+
},
|
|
7084
|
+
elementType: asLink ? "a" : "button"
|
|
7085
|
+
},
|
|
7086
|
+
ref
|
|
7087
|
+
);
|
|
7088
|
+
const { isFocusVisible, focusProps } = (0, import_react_aria9.useFocusRing)(ariaProps);
|
|
7089
|
+
const { hoverProps, isHovered } = (0, import_react_aria9.useHover)(ariaProps);
|
|
7090
|
+
const { baseStyles: baseStyles5, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3, focusStyles: focusStyles2 } = (0, import_react25.useMemo)(
|
|
7091
|
+
() => getButtonStyles(variant, size, contrast),
|
|
7092
|
+
[variant, size, contrast]
|
|
7093
|
+
);
|
|
7094
|
+
const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
7095
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon, { xss: iconStyles[size], icon }),
|
|
7096
|
+
labelInFlight && asyncInProgress ? labelInFlight : label,
|
|
7097
|
+
(endAdornment || asyncInProgress) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { css: Css.ml1.$, children: asyncInProgress ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: "xs", contrast }) : endAdornment })
|
|
7098
|
+
] });
|
|
7099
|
+
const buttonAttrs = {
|
|
7100
|
+
ref,
|
|
7101
|
+
...buttonProps,
|
|
7102
|
+
...focusProps,
|
|
7103
|
+
...hoverProps,
|
|
7104
|
+
className: asLink ? navLink : void 0,
|
|
7105
|
+
css: {
|
|
7106
|
+
...Css.buttonBase.tt("inherit").$,
|
|
7107
|
+
...baseStyles5,
|
|
7108
|
+
...isHovered && !isPressed ? hoverStyles4 : {},
|
|
7109
|
+
...isPressed ? pressedStyles3 : {},
|
|
7110
|
+
...isDisabled || asyncInProgress ? { ...disabledStyles4, ...Css.cursorNotAllowed.$ } : {},
|
|
7111
|
+
...isFocusVisible || forceFocusStyles ? focusStyles2 : {}
|
|
7112
|
+
},
|
|
7113
|
+
...tid
|
|
7114
|
+
};
|
|
7115
|
+
return maybeTooltip({
|
|
7116
|
+
title: resolveTooltip(disabled, tooltip),
|
|
7117
|
+
placement: "top",
|
|
7118
|
+
children: getButtonOrLink(buttonContent, onPress, buttonAttrs, openInNew, download)
|
|
7119
|
+
});
|
|
7120
|
+
}
|
|
7121
|
+
function getButtonStyles(variant, size, contrast) {
|
|
7122
|
+
const styles = variantStyles(contrast)[variant];
|
|
7123
|
+
if (variant === "text") {
|
|
7124
|
+
return styles;
|
|
7125
|
+
}
|
|
7126
|
+
return {
|
|
7127
|
+
...styles,
|
|
7128
|
+
baseStyles: { ...styles.baseStyles, ...sizeStyles[size] }
|
|
7129
|
+
};
|
|
7130
|
+
}
|
|
7131
|
+
var variantStyles = (contrast) => ({
|
|
7132
|
+
primary: {
|
|
7133
|
+
baseStyles: Css.bgBlue600.white.$,
|
|
7134
|
+
hoverStyles: Css.bgBlue700.$,
|
|
7135
|
+
pressedStyles: Css.bgBlue800.$,
|
|
7136
|
+
disabledStyles: Css.bgBlue200.if(contrast).gray600.bgBlue900.$,
|
|
7137
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7138
|
+
},
|
|
7139
|
+
secondary: {
|
|
7140
|
+
baseStyles: Css.bgWhite.bcGray300.bw1.ba.blue600.$,
|
|
7141
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray300.$,
|
|
7142
|
+
pressedStyles: Css.bgGray200.if(contrast).bgGray100.$,
|
|
7143
|
+
disabledStyles: Css.bgWhite.blue300.$,
|
|
7144
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7145
|
+
},
|
|
7146
|
+
secondaryBlack: {
|
|
7147
|
+
baseStyles: Css.bgWhite.bcGray300.bw1.ba.gray900.$,
|
|
7148
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
7149
|
+
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
7150
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
7151
|
+
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(36, 36, 36, 1)" /* Gray900 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(175, 175, 175, 1)" /* Gray500 */}`).$
|
|
7152
|
+
},
|
|
7153
|
+
tertiary: {
|
|
7154
|
+
baseStyles: Css.bgTransparent.blue600.if(contrast).white.$,
|
|
7155
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
7156
|
+
pressedStyles: Css.blue800.if(contrast).bgWhite.gray900.$,
|
|
7157
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
7158
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(96, 165, 250, 1)" /* Blue400 */}`).bgGray700.white.$
|
|
7159
|
+
},
|
|
7160
|
+
tertiaryDanger: {
|
|
7161
|
+
baseStyles: Css.bgTransparent.red600.if(contrast).red400.$,
|
|
7162
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
7163
|
+
pressedStyles: Css.red800.if(contrast).bgWhite.gray900.$,
|
|
7164
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
7165
|
+
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(239, 68, 68, 1)" /* Red500 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(239, 68, 68, 1)" /* Red500 */}`).$
|
|
7166
|
+
},
|
|
7167
|
+
danger: {
|
|
7168
|
+
baseStyles: Css.bgRed600.white.$,
|
|
7169
|
+
hoverStyles: Css.bgRed700.$,
|
|
7170
|
+
pressedStyles: Css.bgRed800.$,
|
|
7171
|
+
disabledStyles: Css.bgRed200.if(contrast).bgRed900.gray600.$,
|
|
7172
|
+
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7173
|
+
},
|
|
7174
|
+
quaternary: {
|
|
7175
|
+
baseStyles: Css.bgTransparent.gray900.if(contrast).gray400.$,
|
|
7176
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
7177
|
+
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
7178
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
7179
|
+
focusStyles: Css.boxShadow(`0px 0px 0px 2px ${"rgba(255,255,255,1)" /* White */}, 0px 0px 0px 4px ${"rgba(36, 36, 36, 1)" /* Gray900 */}`).if(contrast).boxShadow(`0px 0px 0px 2px ${"rgba(175, 175, 175, 1)" /* Gray500 */}`).$
|
|
7180
|
+
},
|
|
7181
|
+
caution: {
|
|
7182
|
+
baseStyles: Css.bgYellow200.gray900.$,
|
|
7183
|
+
hoverStyles: Css.bgYellow300.$,
|
|
7184
|
+
pressedStyles: Css.bgYellow400.$,
|
|
7185
|
+
disabledStyles: Css.bgYellow200.if(contrast).bgYellow900.white.$,
|
|
7186
|
+
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7187
|
+
},
|
|
7188
|
+
text: {
|
|
7189
|
+
baseStyles: Css.blue700.add("fontSize", "inherit").if(contrast).blue400.$,
|
|
7190
|
+
hoverStyles: Css.blue600.if(contrast).blue300.$,
|
|
7191
|
+
pressedStyles: Css.blue700.if(contrast).blue200.$,
|
|
7192
|
+
disabledStyles: Css.blue300.if(contrast).blue700.$,
|
|
7193
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
7194
|
+
},
|
|
7195
|
+
// Todo: handle contrast variant
|
|
7196
|
+
textSecondary: {
|
|
7197
|
+
baseStyles: Css.blue600.add("fontSize", "inherit").$,
|
|
7198
|
+
hoverStyles: Css.bgGray100.$,
|
|
7199
|
+
pressedStyles: Css.blue600.$,
|
|
7200
|
+
disabledStyles: Css.bgWhite.blue300.$,
|
|
7201
|
+
focusStyles: Css.blue600.$
|
|
7202
|
+
}
|
|
7203
|
+
});
|
|
7204
|
+
var sizeStyles = {
|
|
7205
|
+
sm: Css.hPx(32).pxPx(12).$,
|
|
7206
|
+
md: Css.hPx(40).px1.$,
|
|
7207
|
+
lg: Css.hPx(48).px3.$
|
|
7208
|
+
};
|
|
7209
|
+
var iconStyles = {
|
|
7210
|
+
sm: Css.mrPx(4).$,
|
|
7211
|
+
md: Css.mr1.$,
|
|
7212
|
+
lg: Css.mrPx(10).$
|
|
7213
|
+
};
|
|
7214
|
+
|
|
7213
7215
|
// src/components/Table/components/EditColumnsButton.tsx
|
|
7214
7216
|
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
7215
7217
|
function EditColumnsButton(props) {
|
|
@@ -7241,29 +7243,32 @@ function EditColumnsButton(props) {
|
|
|
7241
7243
|
},
|
|
7242
7244
|
[columns, api]
|
|
7243
7245
|
);
|
|
7244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OverlayTrigger, { ...props, menuTriggerProps, state, buttonRef, ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime27.
|
|
7246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(OverlayTrigger, { ...props, menuTriggerProps, state, buttonRef, ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
7245
7247
|
"div",
|
|
7246
7248
|
{
|
|
7247
7249
|
css: {
|
|
7248
7250
|
...Css.dg.gtc("1fr auto").gap2.bgWhite.p2.maxwPx(326).$,
|
|
7249
7251
|
"&:hover": Css.bshHover.$
|
|
7250
7252
|
},
|
|
7251
|
-
children:
|
|
7252
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7253
|
+
children: [
|
|
7254
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react26.Fragment, { children: [
|
|
7255
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { css: Css.sm.truncate.pr1.$, children: option.label }),
|
|
7256
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7257
|
+
Switch,
|
|
7258
|
+
{
|
|
7259
|
+
compact: true,
|
|
7260
|
+
selected: selectedValues.includes(option.value),
|
|
7261
|
+
onChange: (value) => setSelectedValues(
|
|
7262
|
+
value ? [...selectedValues, option.value] : selectedValues.filter((v) => v !== option.value)
|
|
7263
|
+
),
|
|
7264
|
+
labelStyle: "hidden",
|
|
7265
|
+
label: option.label,
|
|
7266
|
+
...tid[`option${option.value}`]
|
|
7267
|
+
}
|
|
7268
|
+
)
|
|
7269
|
+
] }, option.value)),
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { css: Css.gc("1 / -1").df.jcc.$, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "tertiary", label: "Reset Column Widths", onClick: () => api.resetColumnWidths() }) })
|
|
7271
|
+
]
|
|
7267
7272
|
}
|
|
7268
7273
|
) });
|
|
7269
7274
|
}
|
|
@@ -8030,8 +8035,9 @@ function ColumnResizeHandle({
|
|
|
8030
8035
|
startWidthRef.current = currentWidth;
|
|
8031
8036
|
const rect = handleRef.current?.getBoundingClientRect();
|
|
8032
8037
|
if (rect) {
|
|
8033
|
-
|
|
8034
|
-
|
|
8038
|
+
const handleCenter = rect.right - rect.width / 2;
|
|
8039
|
+
startHandleRightRef.current = handleCenter;
|
|
8040
|
+
setGuideLineX(handleCenter);
|
|
8035
8041
|
}
|
|
8036
8042
|
if (scrollableEl?.parentElement) {
|
|
8037
8043
|
scrollableParentRef.current = scrollableEl.parentElement;
|
|
@@ -8050,9 +8056,9 @@ function ColumnResizeHandle({
|
|
|
8050
8056
|
setGuideLineTop(tableRect.top);
|
|
8051
8057
|
setGuideLineHeight(tableRect.height);
|
|
8052
8058
|
}
|
|
8053
|
-
} else {
|
|
8054
|
-
setGuideLineTop(
|
|
8055
|
-
setGuideLineHeight(
|
|
8059
|
+
} else if (rect) {
|
|
8060
|
+
setGuideLineTop(rect.top);
|
|
8061
|
+
setGuideLineHeight(rect.height);
|
|
8056
8062
|
}
|
|
8057
8063
|
document.body.style.cursor = "col-resize";
|
|
8058
8064
|
document.body.style.userSelect = "none";
|
|
@@ -17446,7 +17452,7 @@ function GridTableLayoutComponent(props) {
|
|
|
17446
17452
|
columns,
|
|
17447
17453
|
api,
|
|
17448
17454
|
tooltip: "Display columns",
|
|
17449
|
-
trigger: { icon: "kanban", label: "", variant: "secondaryBlack" },
|
|
17455
|
+
trigger: { icon: "kanban", size: "md", label: "", variant: "secondaryBlack" },
|
|
17450
17456
|
...tid.editColumnsButton
|
|
17451
17457
|
}
|
|
17452
17458
|
),
|