@homebound/beam 2.223.0 → 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.
|
@@ -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
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("../utils");
|
|
|
8
8
|
const defaultLabel_1 = require("../utils/defaultLabel");
|
|
9
9
|
/** Wraps `Checkbox` and binds it to a form field. */
|
|
10
10
|
function BoundCheckboxField(props) {
|
|
11
|
-
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onFocus, onBlur, ...others } = props;
|
|
11
|
+
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onFocus, onBlur, disabled, ...others } = props;
|
|
12
12
|
const testId = (0, utils_1.useTestIds)(props, field.key);
|
|
13
13
|
return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
|
|
14
14
|
var _a;
|
|
@@ -22,7 +22,7 @@ function BoundCheckboxField(props) {
|
|
|
22
22
|
}, onBlur: () => {
|
|
23
23
|
field.blur();
|
|
24
24
|
(0, utils_1.maybeCall)(onBlur);
|
|
25
|
-
} }, testId, others), void 0));
|
|
25
|
+
}, disabled: disabled || field.readOnly }, testId, others), void 0));
|
|
26
26
|
} }, void 0));
|
|
27
27
|
}
|
|
28
28
|
exports.BoundCheckboxField = BoundCheckboxField;
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("../utils");
|
|
|
8
8
|
const defaultLabel_1 = require("../utils/defaultLabel");
|
|
9
9
|
/** Wraps `TextField` and binds it to a form field. */
|
|
10
10
|
function BoundDateRangeField(props) {
|
|
11
|
-
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, onEnter, ...others } = props;
|
|
11
|
+
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), onBlur, onFocus, onEnter, readOnly, ...others } = props;
|
|
12
12
|
const testId = (0, utils_1.useTestIds)(props, field.key);
|
|
13
13
|
return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => ((0, jsx_runtime_1.jsx)(inputs_1.DateRangeField, Object.assign({ label: label, value: field.value || undefined, onChange: (value) => {
|
|
14
14
|
onChange(value);
|
|
@@ -22,6 +22,6 @@ function BoundDateRangeField(props) {
|
|
|
22
22
|
}, onEnter: () => {
|
|
23
23
|
(0, utils_1.maybeCall)(onEnter);
|
|
24
24
|
field.maybeAutoSave();
|
|
25
|
-
} }, testId, others), void 0)) }, void 0));
|
|
25
|
+
}, readOnly: readOnly || field.readOnly }, testId, others), void 0)) }, void 0));
|
|
26
26
|
}
|
|
27
27
|
exports.BoundDateRangeField = BoundDateRangeField;
|
|
@@ -8,14 +8,14 @@ const utils_1 = require("../utils");
|
|
|
8
8
|
const defaultLabel_1 = require("../utils/defaultLabel");
|
|
9
9
|
/** Wraps `Switch` and binds it to a form field. */
|
|
10
10
|
function BoundSwitchField(props) {
|
|
11
|
-
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), labelStyle = "form", ...others } = props;
|
|
11
|
+
const { field, onChange = (value) => field.set(value), label = (0, defaultLabel_1.defaultLabel)(field.key), labelStyle = "form", disabled, ...others } = props;
|
|
12
12
|
const testId = (0, utils_1.useTestIds)(props, field.key);
|
|
13
13
|
return ((0, jsx_runtime_1.jsx)(mobx_react_1.Observer, { children: () => {
|
|
14
14
|
var _a;
|
|
15
15
|
return ((0, jsx_runtime_1.jsx)(inputs_1.Switch, Object.assign({ label: label, labelStyle: labelStyle, selected: (_a = field.value) !== null && _a !== void 0 ? _a : false, onChange: (selected) => {
|
|
16
16
|
onChange(selected);
|
|
17
17
|
field.maybeAutoSave();
|
|
18
|
-
} }, testId, others), void 0));
|
|
18
|
+
}, disabled: disabled || field.readOnly }, testId, others), void 0));
|
|
19
19
|
} }, void 0));
|
|
20
20
|
}
|
|
21
21
|
exports.BoundSwitchField = BoundSwitchField;
|