@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.js
CHANGED
|
@@ -6359,6 +6359,10 @@ import { Fragment as Fragment7, useCallback as useCallback4, useMemo as useMemo1
|
|
|
6359
6359
|
import { useMenuTrigger } from "react-aria";
|
|
6360
6360
|
import { useMenuTriggerState } from "react-stately";
|
|
6361
6361
|
|
|
6362
|
+
// src/components/Button.tsx
|
|
6363
|
+
import { useMemo as useMemo11, useState as useState9 } from "react";
|
|
6364
|
+
import { useButton as useButton4, useFocusRing as useFocusRing4, useHover as useHover5 } from "react-aria";
|
|
6365
|
+
|
|
6362
6366
|
// src/components/internal/OverlayTrigger.tsx
|
|
6363
6367
|
import { useRef as useRef7 } from "react";
|
|
6364
6368
|
import { useOverlayPosition } from "react-aria";
|
|
@@ -6483,185 +6487,10 @@ var pressedStyles = Css.addIn(
|
|
|
6483
6487
|
Css.br100.bgGray900.contentEmpty.w100.h100.absolute.top0.left0.add("opacity", "0.2").$
|
|
6484
6488
|
).$;
|
|
6485
6489
|
|
|
6486
|
-
// src/components/Button.tsx
|
|
6487
|
-
import { useMemo as useMemo10, useState as useState9 } from "react";
|
|
6488
|
-
import { useButton as useButton3, useFocusRing as useFocusRing3, useHover as useHover4 } from "react-aria";
|
|
6489
|
-
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
|
|
6490
|
-
function Button(props) {
|
|
6491
|
-
const {
|
|
6492
|
-
onClick: onPress,
|
|
6493
|
-
disabled,
|
|
6494
|
-
endAdornment,
|
|
6495
|
-
menuTriggerProps,
|
|
6496
|
-
tooltip,
|
|
6497
|
-
openInNew,
|
|
6498
|
-
download,
|
|
6499
|
-
contrast = false,
|
|
6500
|
-
forceFocusStyles = false,
|
|
6501
|
-
labelInFlight,
|
|
6502
|
-
...otherProps
|
|
6503
|
-
} = props;
|
|
6504
|
-
const asLink = typeof onPress === "string";
|
|
6505
|
-
const showExternalLinkIcon = asLink && isAbsoluteUrl(onPress) || openInNew;
|
|
6506
|
-
const [asyncInProgress, setAsyncInProgress] = useState9(false);
|
|
6507
|
-
const isDisabled = !!disabled;
|
|
6508
|
-
const ariaProps = { onPress, isDisabled: isDisabled || asyncInProgress, ...otherProps, ...menuTriggerProps };
|
|
6509
|
-
const {
|
|
6510
|
-
label,
|
|
6511
|
-
// Default the icon based on other properties.
|
|
6512
|
-
icon = download ? "download" : showExternalLinkIcon ? "linkExternal" : void 0,
|
|
6513
|
-
variant = "primary",
|
|
6514
|
-
size = "sm",
|
|
6515
|
-
buttonRef
|
|
6516
|
-
} = ariaProps;
|
|
6517
|
-
const ref = useGetRef(buttonRef);
|
|
6518
|
-
const tid = useTestIds(props, labelOr(ariaProps, "button"));
|
|
6519
|
-
const { buttonProps, isPressed } = useButton3(
|
|
6520
|
-
{
|
|
6521
|
-
...ariaProps,
|
|
6522
|
-
onPress: asLink ? noop : (e) => {
|
|
6523
|
-
const result = onPress(e);
|
|
6524
|
-
if (isPromise(result)) {
|
|
6525
|
-
setAsyncInProgress(true);
|
|
6526
|
-
result.finally(() => setAsyncInProgress(false));
|
|
6527
|
-
}
|
|
6528
|
-
return result;
|
|
6529
|
-
},
|
|
6530
|
-
elementType: asLink ? "a" : "button"
|
|
6531
|
-
},
|
|
6532
|
-
ref
|
|
6533
|
-
);
|
|
6534
|
-
const { isFocusVisible, focusProps } = useFocusRing3(ariaProps);
|
|
6535
|
-
const { hoverProps, isHovered } = useHover4(ariaProps);
|
|
6536
|
-
const { baseStyles: baseStyles5, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3, focusStyles: focusStyles2 } = useMemo10(
|
|
6537
|
-
() => getButtonStyles(variant, size, contrast),
|
|
6538
|
-
[variant, size, contrast]
|
|
6539
|
-
);
|
|
6540
|
-
const buttonContent = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
6541
|
-
icon && /* @__PURE__ */ jsx24(Icon, { xss: iconStyles[size], icon }),
|
|
6542
|
-
labelInFlight && asyncInProgress ? labelInFlight : label,
|
|
6543
|
-
(endAdornment || asyncInProgress) && /* @__PURE__ */ jsx24("span", { css: Css.ml1.$, children: asyncInProgress ? /* @__PURE__ */ jsx24(Loader, { size: "xs", contrast }) : endAdornment })
|
|
6544
|
-
] });
|
|
6545
|
-
const buttonAttrs = {
|
|
6546
|
-
ref,
|
|
6547
|
-
...buttonProps,
|
|
6548
|
-
...focusProps,
|
|
6549
|
-
...hoverProps,
|
|
6550
|
-
className: asLink ? navLink : void 0,
|
|
6551
|
-
css: {
|
|
6552
|
-
...Css.buttonBase.tt("inherit").$,
|
|
6553
|
-
...baseStyles5,
|
|
6554
|
-
...isHovered && !isPressed ? hoverStyles4 : {},
|
|
6555
|
-
...isPressed ? pressedStyles3 : {},
|
|
6556
|
-
...isDisabled || asyncInProgress ? { ...disabledStyles4, ...Css.cursorNotAllowed.$ } : {},
|
|
6557
|
-
...isFocusVisible || forceFocusStyles ? focusStyles2 : {}
|
|
6558
|
-
},
|
|
6559
|
-
...tid
|
|
6560
|
-
};
|
|
6561
|
-
return maybeTooltip({
|
|
6562
|
-
title: resolveTooltip(disabled, tooltip),
|
|
6563
|
-
placement: "top",
|
|
6564
|
-
children: getButtonOrLink(buttonContent, onPress, buttonAttrs, openInNew, download)
|
|
6565
|
-
});
|
|
6566
|
-
}
|
|
6567
|
-
function getButtonStyles(variant, size, contrast) {
|
|
6568
|
-
const styles = variantStyles(contrast)[variant];
|
|
6569
|
-
if (variant === "text") {
|
|
6570
|
-
return styles;
|
|
6571
|
-
}
|
|
6572
|
-
return {
|
|
6573
|
-
...styles,
|
|
6574
|
-
baseStyles: { ...styles.baseStyles, ...sizeStyles[size] }
|
|
6575
|
-
};
|
|
6576
|
-
}
|
|
6577
|
-
var variantStyles = (contrast) => ({
|
|
6578
|
-
primary: {
|
|
6579
|
-
baseStyles: Css.bgBlue600.white.$,
|
|
6580
|
-
hoverStyles: Css.bgBlue700.$,
|
|
6581
|
-
pressedStyles: Css.bgBlue800.$,
|
|
6582
|
-
disabledStyles: Css.bgBlue200.if(contrast).gray600.bgBlue900.$,
|
|
6583
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6584
|
-
},
|
|
6585
|
-
secondary: {
|
|
6586
|
-
baseStyles: Css.bgWhite.bcGray300.bw1.ba.blue600.$,
|
|
6587
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray300.$,
|
|
6588
|
-
pressedStyles: Css.bgGray200.if(contrast).bgGray100.$,
|
|
6589
|
-
disabledStyles: Css.bgWhite.blue300.$,
|
|
6590
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6591
|
-
},
|
|
6592
|
-
secondaryBlack: {
|
|
6593
|
-
baseStyles: Css.bgWhite.bcGray300.bw1.ba.gray900.$,
|
|
6594
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6595
|
-
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6596
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6597
|
-
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 */}`).$
|
|
6598
|
-
},
|
|
6599
|
-
tertiary: {
|
|
6600
|
-
baseStyles: Css.bgTransparent.blue600.if(contrast).white.$,
|
|
6601
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6602
|
-
pressedStyles: Css.blue800.if(contrast).bgWhite.gray900.$,
|
|
6603
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6604
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(96, 165, 250, 1)" /* Blue400 */}`).bgGray700.white.$
|
|
6605
|
-
},
|
|
6606
|
-
tertiaryDanger: {
|
|
6607
|
-
baseStyles: Css.bgTransparent.red600.if(contrast).red400.$,
|
|
6608
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6609
|
-
pressedStyles: Css.red800.if(contrast).bgWhite.gray900.$,
|
|
6610
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6611
|
-
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 */}`).$
|
|
6612
|
-
},
|
|
6613
|
-
danger: {
|
|
6614
|
-
baseStyles: Css.bgRed600.white.$,
|
|
6615
|
-
hoverStyles: Css.bgRed700.$,
|
|
6616
|
-
pressedStyles: Css.bgRed800.$,
|
|
6617
|
-
disabledStyles: Css.bgRed200.if(contrast).bgRed900.gray600.$,
|
|
6618
|
-
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6619
|
-
},
|
|
6620
|
-
quaternary: {
|
|
6621
|
-
baseStyles: Css.bgTransparent.gray900.if(contrast).gray400.$,
|
|
6622
|
-
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6623
|
-
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6624
|
-
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6625
|
-
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 */}`).$
|
|
6626
|
-
},
|
|
6627
|
-
caution: {
|
|
6628
|
-
baseStyles: Css.bgYellow200.gray900.$,
|
|
6629
|
-
hoverStyles: Css.bgYellow300.$,
|
|
6630
|
-
pressedStyles: Css.bgYellow400.$,
|
|
6631
|
-
disabledStyles: Css.bgYellow200.if(contrast).bgYellow900.white.$,
|
|
6632
|
-
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6633
|
-
},
|
|
6634
|
-
text: {
|
|
6635
|
-
baseStyles: Css.blue700.add("fontSize", "inherit").if(contrast).blue400.$,
|
|
6636
|
-
hoverStyles: Css.blue600.if(contrast).blue300.$,
|
|
6637
|
-
pressedStyles: Css.blue700.if(contrast).blue200.$,
|
|
6638
|
-
disabledStyles: Css.blue300.if(contrast).blue700.$,
|
|
6639
|
-
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6640
|
-
},
|
|
6641
|
-
// Todo: handle contrast variant
|
|
6642
|
-
textSecondary: {
|
|
6643
|
-
baseStyles: Css.blue600.add("fontSize", "inherit").$,
|
|
6644
|
-
hoverStyles: Css.bgGray100.$,
|
|
6645
|
-
pressedStyles: Css.blue600.$,
|
|
6646
|
-
disabledStyles: Css.bgWhite.blue300.$,
|
|
6647
|
-
focusStyles: Css.blue600.$
|
|
6648
|
-
}
|
|
6649
|
-
});
|
|
6650
|
-
var sizeStyles = {
|
|
6651
|
-
sm: Css.hPx(32).pxPx(12).$,
|
|
6652
|
-
md: Css.hPx(40).px1.$,
|
|
6653
|
-
lg: Css.hPx(48).px3.$
|
|
6654
|
-
};
|
|
6655
|
-
var iconStyles = {
|
|
6656
|
-
sm: Css.mrPx(4).$,
|
|
6657
|
-
md: Css.mr1.$,
|
|
6658
|
-
lg: Css.mrPx(10).$
|
|
6659
|
-
};
|
|
6660
|
-
|
|
6661
6490
|
// src/components/NavLink.tsx
|
|
6662
|
-
import { useMemo as
|
|
6663
|
-
import { mergeProps as mergeProps2, useButton as
|
|
6664
|
-
import { Fragment as
|
|
6491
|
+
import { useMemo as useMemo10 } from "react";
|
|
6492
|
+
import { mergeProps as mergeProps2, useButton as useButton3, useFocusRing as useFocusRing3, useHover as useHover4 } from "react-aria";
|
|
6493
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
|
|
6665
6494
|
function NavLink(props) {
|
|
6666
6495
|
const {
|
|
6667
6496
|
disabled: isDisabled,
|
|
@@ -6675,10 +6504,10 @@ function NavLink(props) {
|
|
|
6675
6504
|
const ariaProps = { children: label, isDisabled, ...menuTriggerProps, ...otherProps };
|
|
6676
6505
|
const { href, active = false, icon = false, variant } = ariaProps;
|
|
6677
6506
|
const ref = useGetRef(buttonRef);
|
|
6678
|
-
const { buttonProps, isPressed } =
|
|
6679
|
-
const { hoverProps, isHovered } =
|
|
6680
|
-
const { isFocusVisible, focusProps } =
|
|
6681
|
-
const { baseStyles: baseStyles5, activeStyles: activeStyles4, focusRingStyles: focusRingStyles2, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3 } =
|
|
6507
|
+
const { buttonProps, isPressed } = useButton3({ ...ariaProps, elementType: href ? "a" : "button" }, ref);
|
|
6508
|
+
const { hoverProps, isHovered } = useHover4({ isDisabled });
|
|
6509
|
+
const { isFocusVisible, focusProps } = useFocusRing3(ariaProps);
|
|
6510
|
+
const { baseStyles: baseStyles5, activeStyles: activeStyles4, focusRingStyles: focusRingStyles2, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3 } = useMemo10(
|
|
6682
6511
|
() => getNavLinkStyles(variant, contrast),
|
|
6683
6512
|
[variant, contrast]
|
|
6684
6513
|
);
|
|
@@ -6698,9 +6527,9 @@ function NavLink(props) {
|
|
|
6698
6527
|
...isPressed && pressedStyles3
|
|
6699
6528
|
}
|
|
6700
6529
|
};
|
|
6701
|
-
const linkContent = /* @__PURE__ */
|
|
6530
|
+
const linkContent = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
6702
6531
|
label,
|
|
6703
|
-
icon && /* @__PURE__ */
|
|
6532
|
+
icon && /* @__PURE__ */ jsx24("span", { css: Css.ml1.$, children: /* @__PURE__ */ jsx24(Icon, { icon }) })
|
|
6704
6533
|
] });
|
|
6705
6534
|
return getButtonOrLink(linkContent, href, { ...mergeProps2(buttonProps, focusProps, hoverProps), ...linkAttributes });
|
|
6706
6535
|
}
|
|
@@ -6731,7 +6560,7 @@ var navLinkVariantStyles = (contrast) => ({
|
|
|
6731
6560
|
});
|
|
6732
6561
|
|
|
6733
6562
|
// src/components/internal/OverlayTrigger.tsx
|
|
6734
|
-
import { jsx as
|
|
6563
|
+
import { jsx as jsx25, jsxs as jsxs12 } from "@emotion/react/jsx-runtime";
|
|
6735
6564
|
function OverlayTrigger(props) {
|
|
6736
6565
|
const {
|
|
6737
6566
|
trigger,
|
|
@@ -6763,8 +6592,8 @@ function OverlayTrigger(props) {
|
|
|
6763
6592
|
);
|
|
6764
6593
|
return (
|
|
6765
6594
|
// 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.
|
|
6766
|
-
/* @__PURE__ */
|
|
6767
|
-
isTextButton(trigger) ? /* @__PURE__ */
|
|
6595
|
+
/* @__PURE__ */ jsxs12("div", { css: Css.dib.add("lineHeight", 0).$, children: [
|
|
6596
|
+
isTextButton(trigger) ? /* @__PURE__ */ jsx25(
|
|
6768
6597
|
Button,
|
|
6769
6598
|
{
|
|
6770
6599
|
variant: variant ? variant : "secondary",
|
|
@@ -6772,14 +6601,14 @@ function OverlayTrigger(props) {
|
|
|
6772
6601
|
...trigger,
|
|
6773
6602
|
menuTriggerProps,
|
|
6774
6603
|
buttonRef,
|
|
6775
|
-
endAdornment: !hideEndAdornment ? /* @__PURE__ */
|
|
6604
|
+
endAdornment: !hideEndAdornment ? /* @__PURE__ */ jsx25(Icon, { icon: state.isOpen ? "chevronUp" : "chevronDown" }) : null,
|
|
6776
6605
|
disabled,
|
|
6777
6606
|
tooltip,
|
|
6778
6607
|
onClick: menuTriggerProps.onPress ?? noop,
|
|
6779
6608
|
forceFocusStyles: showActiveBorder && state.isOpen,
|
|
6780
6609
|
...tid
|
|
6781
6610
|
}
|
|
6782
|
-
) : isNavLinkButton(trigger) ? /* @__PURE__ */
|
|
6611
|
+
) : isNavLinkButton(trigger) ? /* @__PURE__ */ jsx25(
|
|
6783
6612
|
NavLink,
|
|
6784
6613
|
{
|
|
6785
6614
|
...trigger,
|
|
@@ -6790,7 +6619,7 @@ function OverlayTrigger(props) {
|
|
|
6790
6619
|
buttonRef,
|
|
6791
6620
|
...tid
|
|
6792
6621
|
}
|
|
6793
|
-
) : isIconButton(trigger) ? /* @__PURE__ */
|
|
6622
|
+
) : isIconButton(trigger) ? /* @__PURE__ */ jsx25(
|
|
6794
6623
|
IconButton,
|
|
6795
6624
|
{
|
|
6796
6625
|
...trigger,
|
|
@@ -6802,7 +6631,7 @@ function OverlayTrigger(props) {
|
|
|
6802
6631
|
onClick: menuTriggerProps.onPress ?? noop,
|
|
6803
6632
|
forceFocusStyles: showActiveBorder && state.isOpen
|
|
6804
6633
|
}
|
|
6805
|
-
) : /* @__PURE__ */
|
|
6634
|
+
) : /* @__PURE__ */ jsx25(
|
|
6806
6635
|
AvatarButton,
|
|
6807
6636
|
{
|
|
6808
6637
|
...trigger,
|
|
@@ -6815,7 +6644,7 @@ function OverlayTrigger(props) {
|
|
|
6815
6644
|
forceFocusStyles: showActiveBorder && state.isOpen
|
|
6816
6645
|
}
|
|
6817
6646
|
),
|
|
6818
|
-
state.isOpen && /* @__PURE__ */
|
|
6647
|
+
state.isOpen && /* @__PURE__ */ jsx25(
|
|
6819
6648
|
Popover,
|
|
6820
6649
|
{
|
|
6821
6650
|
triggerRef: buttonRef,
|
|
@@ -6842,6 +6671,179 @@ function labelOr(trigger, fallback) {
|
|
|
6842
6671
|
return typeof trigger.label === "string" ? trigger.label : fallback;
|
|
6843
6672
|
}
|
|
6844
6673
|
|
|
6674
|
+
// src/components/Button.tsx
|
|
6675
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
|
|
6676
|
+
function Button(props) {
|
|
6677
|
+
const {
|
|
6678
|
+
onClick: onPress,
|
|
6679
|
+
disabled,
|
|
6680
|
+
endAdornment,
|
|
6681
|
+
menuTriggerProps,
|
|
6682
|
+
tooltip,
|
|
6683
|
+
openInNew,
|
|
6684
|
+
download,
|
|
6685
|
+
contrast = false,
|
|
6686
|
+
forceFocusStyles = false,
|
|
6687
|
+
labelInFlight,
|
|
6688
|
+
...otherProps
|
|
6689
|
+
} = props;
|
|
6690
|
+
const asLink = typeof onPress === "string";
|
|
6691
|
+
const showExternalLinkIcon = asLink && isAbsoluteUrl(onPress) || openInNew;
|
|
6692
|
+
const [asyncInProgress, setAsyncInProgress] = useState9(false);
|
|
6693
|
+
const isDisabled = !!disabled;
|
|
6694
|
+
const ariaProps = { onPress, isDisabled: isDisabled || asyncInProgress, ...otherProps, ...menuTriggerProps };
|
|
6695
|
+
const {
|
|
6696
|
+
label,
|
|
6697
|
+
// Default the icon based on other properties.
|
|
6698
|
+
icon = download ? "download" : showExternalLinkIcon ? "linkExternal" : void 0,
|
|
6699
|
+
variant = "primary",
|
|
6700
|
+
size = "sm",
|
|
6701
|
+
buttonRef
|
|
6702
|
+
} = ariaProps;
|
|
6703
|
+
const ref = useGetRef(buttonRef);
|
|
6704
|
+
const tid = useTestIds(props, labelOr(ariaProps, "button"));
|
|
6705
|
+
const { buttonProps, isPressed } = useButton4(
|
|
6706
|
+
{
|
|
6707
|
+
...ariaProps,
|
|
6708
|
+
onPress: asLink ? noop : (e) => {
|
|
6709
|
+
const result = onPress(e);
|
|
6710
|
+
if (isPromise(result)) {
|
|
6711
|
+
setAsyncInProgress(true);
|
|
6712
|
+
result.finally(() => setAsyncInProgress(false));
|
|
6713
|
+
}
|
|
6714
|
+
return result;
|
|
6715
|
+
},
|
|
6716
|
+
elementType: asLink ? "a" : "button"
|
|
6717
|
+
},
|
|
6718
|
+
ref
|
|
6719
|
+
);
|
|
6720
|
+
const { isFocusVisible, focusProps } = useFocusRing4(ariaProps);
|
|
6721
|
+
const { hoverProps, isHovered } = useHover5(ariaProps);
|
|
6722
|
+
const { baseStyles: baseStyles5, hoverStyles: hoverStyles4, disabledStyles: disabledStyles4, pressedStyles: pressedStyles3, focusStyles: focusStyles2 } = useMemo11(
|
|
6723
|
+
() => getButtonStyles(variant, size, contrast),
|
|
6724
|
+
[variant, size, contrast]
|
|
6725
|
+
);
|
|
6726
|
+
const buttonContent = /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
6727
|
+
icon && /* @__PURE__ */ jsx26(Icon, { xss: iconStyles[size], icon }),
|
|
6728
|
+
labelInFlight && asyncInProgress ? labelInFlight : label,
|
|
6729
|
+
(endAdornment || asyncInProgress) && /* @__PURE__ */ jsx26("span", { css: Css.ml1.$, children: asyncInProgress ? /* @__PURE__ */ jsx26(Loader, { size: "xs", contrast }) : endAdornment })
|
|
6730
|
+
] });
|
|
6731
|
+
const buttonAttrs = {
|
|
6732
|
+
ref,
|
|
6733
|
+
...buttonProps,
|
|
6734
|
+
...focusProps,
|
|
6735
|
+
...hoverProps,
|
|
6736
|
+
className: asLink ? navLink : void 0,
|
|
6737
|
+
css: {
|
|
6738
|
+
...Css.buttonBase.tt("inherit").$,
|
|
6739
|
+
...baseStyles5,
|
|
6740
|
+
...isHovered && !isPressed ? hoverStyles4 : {},
|
|
6741
|
+
...isPressed ? pressedStyles3 : {},
|
|
6742
|
+
...isDisabled || asyncInProgress ? { ...disabledStyles4, ...Css.cursorNotAllowed.$ } : {},
|
|
6743
|
+
...isFocusVisible || forceFocusStyles ? focusStyles2 : {}
|
|
6744
|
+
},
|
|
6745
|
+
...tid
|
|
6746
|
+
};
|
|
6747
|
+
return maybeTooltip({
|
|
6748
|
+
title: resolveTooltip(disabled, tooltip),
|
|
6749
|
+
placement: "top",
|
|
6750
|
+
children: getButtonOrLink(buttonContent, onPress, buttonAttrs, openInNew, download)
|
|
6751
|
+
});
|
|
6752
|
+
}
|
|
6753
|
+
function getButtonStyles(variant, size, contrast) {
|
|
6754
|
+
const styles = variantStyles(contrast)[variant];
|
|
6755
|
+
if (variant === "text") {
|
|
6756
|
+
return styles;
|
|
6757
|
+
}
|
|
6758
|
+
return {
|
|
6759
|
+
...styles,
|
|
6760
|
+
baseStyles: { ...styles.baseStyles, ...sizeStyles[size] }
|
|
6761
|
+
};
|
|
6762
|
+
}
|
|
6763
|
+
var variantStyles = (contrast) => ({
|
|
6764
|
+
primary: {
|
|
6765
|
+
baseStyles: Css.bgBlue600.white.$,
|
|
6766
|
+
hoverStyles: Css.bgBlue700.$,
|
|
6767
|
+
pressedStyles: Css.bgBlue800.$,
|
|
6768
|
+
disabledStyles: Css.bgBlue200.if(contrast).gray600.bgBlue900.$,
|
|
6769
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6770
|
+
},
|
|
6771
|
+
secondary: {
|
|
6772
|
+
baseStyles: Css.bgWhite.bcGray300.bw1.ba.blue600.$,
|
|
6773
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray300.$,
|
|
6774
|
+
pressedStyles: Css.bgGray200.if(contrast).bgGray100.$,
|
|
6775
|
+
disabledStyles: Css.bgWhite.blue300.$,
|
|
6776
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6777
|
+
},
|
|
6778
|
+
secondaryBlack: {
|
|
6779
|
+
baseStyles: Css.bgWhite.bcGray300.bw1.ba.gray900.$,
|
|
6780
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6781
|
+
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6782
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6783
|
+
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 */}`).$
|
|
6784
|
+
},
|
|
6785
|
+
tertiary: {
|
|
6786
|
+
baseStyles: Css.bgTransparent.blue600.if(contrast).white.$,
|
|
6787
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6788
|
+
pressedStyles: Css.blue800.if(contrast).bgWhite.gray900.$,
|
|
6789
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6790
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(96, 165, 250, 1)" /* Blue400 */}`).bgGray700.white.$
|
|
6791
|
+
},
|
|
6792
|
+
tertiaryDanger: {
|
|
6793
|
+
baseStyles: Css.bgTransparent.red600.if(contrast).red400.$,
|
|
6794
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6795
|
+
pressedStyles: Css.red800.if(contrast).bgWhite.gray900.$,
|
|
6796
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6797
|
+
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 */}`).$
|
|
6798
|
+
},
|
|
6799
|
+
danger: {
|
|
6800
|
+
baseStyles: Css.bgRed600.white.$,
|
|
6801
|
+
hoverStyles: Css.bgRed700.$,
|
|
6802
|
+
pressedStyles: Css.bgRed800.$,
|
|
6803
|
+
disabledStyles: Css.bgRed200.if(contrast).bgRed900.gray600.$,
|
|
6804
|
+
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6805
|
+
},
|
|
6806
|
+
quaternary: {
|
|
6807
|
+
baseStyles: Css.bgTransparent.gray900.if(contrast).gray400.$,
|
|
6808
|
+
hoverStyles: Css.bgGray100.if(contrast).bgGray700.white.$,
|
|
6809
|
+
pressedStyles: Css.gray900.if(contrast).bgWhite.gray900.$,
|
|
6810
|
+
disabledStyles: Css.gray400.if(contrast).gray700.$,
|
|
6811
|
+
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 */}`).$
|
|
6812
|
+
},
|
|
6813
|
+
caution: {
|
|
6814
|
+
baseStyles: Css.bgYellow200.gray900.$,
|
|
6815
|
+
hoverStyles: Css.bgYellow300.$,
|
|
6816
|
+
pressedStyles: Css.bgYellow400.$,
|
|
6817
|
+
disabledStyles: Css.bgYellow200.if(contrast).bgYellow900.white.$,
|
|
6818
|
+
focusStyles: Css.bshDanger.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6819
|
+
},
|
|
6820
|
+
text: {
|
|
6821
|
+
baseStyles: Css.blue700.add("fontSize", "inherit").if(contrast).blue400.$,
|
|
6822
|
+
hoverStyles: Css.blue600.if(contrast).blue300.$,
|
|
6823
|
+
pressedStyles: Css.blue700.if(contrast).blue200.$,
|
|
6824
|
+
disabledStyles: Css.blue300.if(contrast).blue700.$,
|
|
6825
|
+
focusStyles: Css.bshFocus.if(contrast).boxShadow(`0 0 0 2px ${"rgba(255,255,255,1)" /* White */}`).$
|
|
6826
|
+
},
|
|
6827
|
+
// Todo: handle contrast variant
|
|
6828
|
+
textSecondary: {
|
|
6829
|
+
baseStyles: Css.blue600.add("fontSize", "inherit").$,
|
|
6830
|
+
hoverStyles: Css.bgGray100.$,
|
|
6831
|
+
pressedStyles: Css.blue600.$,
|
|
6832
|
+
disabledStyles: Css.bgWhite.blue300.$,
|
|
6833
|
+
focusStyles: Css.blue600.$
|
|
6834
|
+
}
|
|
6835
|
+
});
|
|
6836
|
+
var sizeStyles = {
|
|
6837
|
+
sm: Css.hPx(32).pxPx(12).$,
|
|
6838
|
+
md: Css.hPx(40).px1.$,
|
|
6839
|
+
lg: Css.hPx(48).px3.$
|
|
6840
|
+
};
|
|
6841
|
+
var iconStyles = {
|
|
6842
|
+
sm: Css.mrPx(4).$,
|
|
6843
|
+
md: Css.mr1.$,
|
|
6844
|
+
lg: Css.mrPx(10).$
|
|
6845
|
+
};
|
|
6846
|
+
|
|
6845
6847
|
// src/components/Table/components/EditColumnsButton.tsx
|
|
6846
6848
|
import { jsx as jsx27, jsxs as jsxs14 } from "@emotion/react/jsx-runtime";
|
|
6847
6849
|
function EditColumnsButton(props) {
|
|
@@ -6873,29 +6875,32 @@ function EditColumnsButton(props) {
|
|
|
6873
6875
|
},
|
|
6874
6876
|
[columns, api]
|
|
6875
6877
|
);
|
|
6876
|
-
return /* @__PURE__ */ jsx27(OverlayTrigger, { ...props, menuTriggerProps, state, buttonRef, ...tid, children: /* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsx27(OverlayTrigger, { ...props, menuTriggerProps, state, buttonRef, ...tid, children: /* @__PURE__ */ jsxs14(
|
|
6877
6879
|
"div",
|
|
6878
6880
|
{
|
|
6879
6881
|
css: {
|
|
6880
6882
|
...Css.dg.gtc("1fr auto").gap2.bgWhite.p2.maxwPx(326).$,
|
|
6881
6883
|
"&:hover": Css.bshHover.$
|
|
6882
6884
|
},
|
|
6883
|
-
children:
|
|
6884
|
-
/* @__PURE__ */
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6885
|
+
children: [
|
|
6886
|
+
options.map((option) => /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
6887
|
+
/* @__PURE__ */ jsx27("div", { css: Css.sm.truncate.pr1.$, children: option.label }),
|
|
6888
|
+
/* @__PURE__ */ jsx27(
|
|
6889
|
+
Switch,
|
|
6890
|
+
{
|
|
6891
|
+
compact: true,
|
|
6892
|
+
selected: selectedValues.includes(option.value),
|
|
6893
|
+
onChange: (value) => setSelectedValues(
|
|
6894
|
+
value ? [...selectedValues, option.value] : selectedValues.filter((v) => v !== option.value)
|
|
6895
|
+
),
|
|
6896
|
+
labelStyle: "hidden",
|
|
6897
|
+
label: option.label,
|
|
6898
|
+
...tid[`option${option.value}`]
|
|
6899
|
+
}
|
|
6900
|
+
)
|
|
6901
|
+
] }, option.value)),
|
|
6902
|
+
/* @__PURE__ */ jsx27("div", { css: Css.gc("1 / -1").df.jcc.$, children: /* @__PURE__ */ jsx27(Button, { variant: "tertiary", label: "Reset Column Widths", onClick: () => api.resetColumnWidths() }) })
|
|
6903
|
+
]
|
|
6899
6904
|
}
|
|
6900
6905
|
) });
|
|
6901
6906
|
}
|
|
@@ -7662,8 +7667,9 @@ function ColumnResizeHandle({
|
|
|
7662
7667
|
startWidthRef.current = currentWidth;
|
|
7663
7668
|
const rect = handleRef.current?.getBoundingClientRect();
|
|
7664
7669
|
if (rect) {
|
|
7665
|
-
|
|
7666
|
-
|
|
7670
|
+
const handleCenter = rect.right - rect.width / 2;
|
|
7671
|
+
startHandleRightRef.current = handleCenter;
|
|
7672
|
+
setGuideLineX(handleCenter);
|
|
7667
7673
|
}
|
|
7668
7674
|
if (scrollableEl?.parentElement) {
|
|
7669
7675
|
scrollableParentRef.current = scrollableEl.parentElement;
|
|
@@ -7682,9 +7688,9 @@ function ColumnResizeHandle({
|
|
|
7682
7688
|
setGuideLineTop(tableRect.top);
|
|
7683
7689
|
setGuideLineHeight(tableRect.height);
|
|
7684
7690
|
}
|
|
7685
|
-
} else {
|
|
7686
|
-
setGuideLineTop(
|
|
7687
|
-
setGuideLineHeight(
|
|
7691
|
+
} else if (rect) {
|
|
7692
|
+
setGuideLineTop(rect.top);
|
|
7693
|
+
setGuideLineHeight(rect.height);
|
|
7688
7694
|
}
|
|
7689
7695
|
document.body.style.cursor = "col-resize";
|
|
7690
7696
|
document.body.style.userSelect = "none";
|
|
@@ -17087,7 +17093,7 @@ function GridTableLayoutComponent(props) {
|
|
|
17087
17093
|
columns,
|
|
17088
17094
|
api,
|
|
17089
17095
|
tooltip: "Display columns",
|
|
17090
|
-
trigger: { icon: "kanban", label: "", variant: "secondaryBlack" },
|
|
17096
|
+
trigger: { icon: "kanban", size: "md", label: "", variant: "secondaryBlack" },
|
|
17091
17097
|
...tid.editColumnsButton
|
|
17092
17098
|
}
|
|
17093
17099
|
),
|