@homebound/beam 2.223.1 → 2.223.2
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/components/ButtonGroup.js +14 -16
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const defaultTestId_1 = require("../utils/defaultTestId");
|
|
|
12
12
|
function ButtonGroup(props) {
|
|
13
13
|
const { buttons, disabled = false, size = "sm" } = props;
|
|
14
14
|
const tid = (0, utils_1.useTestIds)(props, "buttonGroup");
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, tid, { css: sizeStyles[size] }, { children: buttons.map(({ disabled: buttonDisabled, ...buttonProps }, i) => (
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, tid, { css: Css_1.Css.df.add(sizeStyles[size]).$ }, { children: buttons.map(({ disabled: buttonDisabled, ...buttonProps }, i) => (
|
|
16
16
|
// Disable the button if the ButtonGroup is disabled or if the current button is disabled.
|
|
17
17
|
(0, jsx_runtime_1.jsx)(GroupButton, Object.assign({}, buttonProps, { disabled: disabled || buttonDisabled, size: size }, tid), i))) }), void 0));
|
|
18
18
|
}
|
|
@@ -26,19 +26,18 @@ function GroupButton(props) {
|
|
|
26
26
|
const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)();
|
|
27
27
|
const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
|
|
28
28
|
const tid = (0, utils_1.useTestIds)(props);
|
|
29
|
-
return (0, Tooltip_1.maybeTooltip)({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: getButtonStyles() }, { children: (0, Tooltip_1.maybeTooltip)({
|
|
30
|
+
title: (0, Tooltip_1.resolveTooltip)(disabled, tooltip),
|
|
31
|
+
placement: "top",
|
|
32
|
+
children: ((0, jsx_runtime_1.jsxs)("button", Object.assign({ ref: ref }, buttonProps, focusProps, hoverProps, { css: {
|
|
33
|
+
...Css_1.Css.buttonBase.px2.br0.h100.$,
|
|
34
|
+
"&:disabled": Css_1.Css.gray400.cursorNotAllowed.bGray300.$,
|
|
35
|
+
...(isFocusVisible ? defaultFocusRingStyles : {}),
|
|
36
|
+
...(active ? activeStyles : {}),
|
|
37
|
+
...(isPressed ? pressedStyles : isHovered ? hoverStyles : {}),
|
|
38
|
+
...(icon ? iconStyles[size] : {}),
|
|
39
|
+
} }, tid[(0, defaultTestId_1.defaultTestId)((_a = text !== null && text !== void 0 ? text : icon) !== null && _a !== void 0 ? _a : "button")], { children: [icon && (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: icon }, void 0), text] }), void 0)),
|
|
40
|
+
}) }), void 0));
|
|
42
41
|
}
|
|
43
42
|
const pressedStyles = Css_1.Css.bgGray200.$;
|
|
44
43
|
const activeStyles = Css_1.Css.bgGray300.$;
|
|
@@ -46,8 +45,7 @@ const hoverStyles = Css_1.Css.bgGray100.$;
|
|
|
46
45
|
const defaultFocusRingStyles = Css_1.Css.relative.z2.bshFocus.$;
|
|
47
46
|
function getButtonStyles() {
|
|
48
47
|
return {
|
|
49
|
-
...Css_1.Css.z1.
|
|
50
|
-
"&:disabled": Css_1.Css.gray400.cursorNotAllowed.bGray300.$,
|
|
48
|
+
...Css_1.Css.z1.bgWhite.bGray300.bw1.ba.gray900.br0.overflowHidden.$,
|
|
51
49
|
// Our first button should have a rounded left border
|
|
52
50
|
"&:first-of-type": Css_1.Css.add("borderRadius", "4px 0 0 4px").$,
|
|
53
51
|
// Our last button should have a rounded right border
|