@homebound/beam 2.200.1 → 2.201.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/inputs/ErrorMessage.d.ts +1 -0
- package/dist/inputs/ErrorMessage.js +4 -2
- package/dist/inputs/NumberField.d.ts +1 -0
- package/dist/inputs/TextField.d.ts +1 -0
- package/dist/inputs/TextField.js +2 -2
- package/dist/inputs/TextFieldBase.d.ts +1 -0
- package/dist/inputs/TextFieldBase.js +3 -3
- package/dist/inputs/internal/SelectFieldBase.d.ts +1 -0
- package/dist/inputs/internal/SelectFieldInput.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ErrorMessage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_aria_1 = require("react-aria");
|
|
5
6
|
const components_1 = require("../components");
|
|
6
7
|
const Css_1 = require("../Css");
|
|
7
8
|
/**
|
|
@@ -10,7 +11,8 @@ const Css_1 = require("../Css");
|
|
|
10
11
|
* Not currently exported as part of our public API.
|
|
11
12
|
*/
|
|
12
13
|
function ErrorMessage(props) {
|
|
13
|
-
const { id, errorMsg, contrast = false, ...others } = props;
|
|
14
|
-
|
|
14
|
+
const { id, errorMsg, contrast = false, hidden = false, ...others } = props;
|
|
15
|
+
const errorEl = errorMsg ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.red600.sm.df.mtPx(4).if(contrast).red400.$ }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.fs0.$ }, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "error" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)("span", Object.assign({ id: id, css: Css_1.Css.ml1.mtPx(2).$ }, others, { children: errorMsg }), void 0)] }), void 0)) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0));
|
|
16
|
+
return hidden ? (0, jsx_runtime_1.jsx)(react_aria_1.VisuallyHidden, { children: errorEl }, void 0) : errorEl;
|
|
15
17
|
}
|
|
16
18
|
exports.ErrorMessage = ErrorMessage;
|
|
@@ -31,6 +31,7 @@ export interface NumberFieldProps {
|
|
|
31
31
|
/** Whether to show comma separation for group numbers.
|
|
32
32
|
* @default true */
|
|
33
33
|
useGrouping?: boolean;
|
|
34
|
+
hideErrorMessage?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export declare function NumberField(props: NumberFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
36
37
|
export declare function formatValue(value: number, factor: number, numFractionDigits: number | undefined, numIntegerDigits: number | undefined): number | undefined;
|
|
@@ -9,6 +9,7 @@ export interface TextFieldProps<X> extends BeamTextFieldProps<X> {
|
|
|
9
9
|
onEnter?: VoidFunction;
|
|
10
10
|
endAdornment?: ReactNode;
|
|
11
11
|
startAdornment?: ReactNode;
|
|
12
|
+
hideErrorMessage?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare function TextField<X extends Only<TextFieldXss, X>>(props: TextFieldProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare type TextFieldApi = {
|
package/dist/inputs/TextField.js
CHANGED
|
@@ -8,7 +8,7 @@ const components_1 = require("../components");
|
|
|
8
8
|
const TextFieldBase_1 = require("./TextFieldBase");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
function TextField(props) {
|
|
11
|
-
const { disabled = false, readOnly = false, required, errorMsg, value = "", onBlur, onFocus, api, onEnter, ...otherProps } = props;
|
|
11
|
+
const { disabled = false, readOnly = false, required, errorMsg, value = "", onBlur, onFocus, api, onEnter, hideErrorMessage, ...otherProps } = props;
|
|
12
12
|
const isDisabled = !!disabled;
|
|
13
13
|
const isReadOnly = !!readOnly;
|
|
14
14
|
const textFieldProps = {
|
|
@@ -36,6 +36,6 @@ function TextField(props) {
|
|
|
36
36
|
focus: () => inputRef.current && inputRef.current.focus(),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(TextFieldBase_1.TextFieldBase, Object.assign({}, (0, react_aria_1.mergeProps)(textFieldProps, { onBlur, onFocus }), { errorMsg: errorMsg, required: required, labelProps: labelProps, inputProps: inputProps, inputRef: inputRef, tooltip: (0, components_1.resolveTooltip)(disabled, undefined, readOnly) }), void 0));
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(TextFieldBase_1.TextFieldBase, Object.assign({}, (0, react_aria_1.mergeProps)(textFieldProps, { onBlur, onFocus }), { errorMsg: errorMsg, required: required, labelProps: labelProps, inputProps: inputProps, inputRef: inputRef, tooltip: (0, components_1.resolveTooltip)(disabled, undefined, readOnly), hideErrorMessage: hideErrorMessage }), void 0));
|
|
40
40
|
}
|
|
41
41
|
exports.TextField = TextField;
|
|
@@ -16,5 +16,6 @@ export interface TextFieldBaseProps<X> extends Pick<BeamTextFieldProps<X>, "labe
|
|
|
16
16
|
clearable?: boolean;
|
|
17
17
|
textAreaMinHeight?: number;
|
|
18
18
|
tooltip?: ReactNode;
|
|
19
|
+
hideErrorMessage?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare function TextFieldBase<X extends Only<TextFieldXss, X>>(props: TextFieldBaseProps<X>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -17,7 +17,7 @@ const useTestIds_1 = require("../utils/useTestIds");
|
|
|
17
17
|
function TextFieldBase(props) {
|
|
18
18
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
19
|
const { fieldProps } = (0, PresentationContext_1.usePresentationContext)();
|
|
20
|
-
const { label, required, labelProps, hideLabel = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.hideLabel) !== null && _a !== void 0 ? _a : false, inputProps, inputRef, inputWrapRef, groupProps, compact = (_b = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact) !== null && _b !== void 0 ? _b : false, errorMsg, helperText, multiline = false, onChange, onBlur, onFocus, xss, endAdornment, startAdornment, inlineLabel, contrast = false, borderless = (_c = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.borderless) !== null && _c !== void 0 ? _c : false, textAreaMinHeight = 96, clearable = false, tooltip, visuallyDisabled = (_d = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.visuallyDisabled) !== null && _d !== void 0 ? _d : true, errorInTooltip = (_e = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.errorInTooltip) !== null && _e !== void 0 ? _e : false, } = props;
|
|
20
|
+
const { label, required, labelProps, hideLabel = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.hideLabel) !== null && _a !== void 0 ? _a : false, inputProps, inputRef, inputWrapRef, groupProps, compact = (_b = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.compact) !== null && _b !== void 0 ? _b : false, errorMsg, helperText, multiline = false, onChange, onBlur, onFocus, xss, endAdornment, startAdornment, inlineLabel, contrast = false, borderless = (_c = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.borderless) !== null && _c !== void 0 ? _c : false, textAreaMinHeight = 96, clearable = false, tooltip, visuallyDisabled = (_d = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.visuallyDisabled) !== null && _d !== void 0 ? _d : true, errorInTooltip = (_e = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.errorInTooltip) !== null && _e !== void 0 ? _e : false, hideErrorMessage = false, } = props;
|
|
21
21
|
const typeScale = (_f = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.typeScale) !== null && _f !== void 0 ? _f : (inputProps.readOnly && !hideLabel ? "smMd" : "sm");
|
|
22
22
|
const internalProps = props.internalProps || {};
|
|
23
23
|
const { compound = false, forceFocus = false, forceHover = false } = internalProps;
|
|
@@ -120,7 +120,7 @@ function TextFieldBase(props) {
|
|
|
120
120
|
onChange(undefined);
|
|
121
121
|
// Reset focus to input element
|
|
122
122
|
(_a = fieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
123
|
-
} }, void 0)), errorInTooltip && errorMsg && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.df.aic.pl1.fs0.$ }, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "error", color: Css_1.Palette.Red600, tooltip: errorMsg }, void 0) }), void 0)), !multiline && endAdornment && (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.df.aic.pl1.fs0.$ }, { children: endAdornment }), void 0)] }), void 0)),
|
|
124
|
-
}), !compound && !inputProps.disabled && !inputProps.readOnly && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [errorMsg && !errorInTooltip && (0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, Object.assign({ id: errorMessageId, errorMsg: errorMsg }, tid.errorMsg), void 0), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, Object.assign({ helperText: helperText }, tid.helperText), void 0)] }, void 0))] }), void 0));
|
|
123
|
+
} }, void 0)), errorInTooltip && errorMsg && !hideErrorMessage && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.df.aic.pl1.fs0.$ }, { children: (0, jsx_runtime_1.jsx)(components_1.Icon, { icon: "error", color: Css_1.Palette.Red600, tooltip: errorMsg }, void 0) }), void 0)), !multiline && endAdornment && (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.df.aic.pl1.fs0.$ }, { children: endAdornment }), void 0)] }), void 0)),
|
|
124
|
+
}), !compound && !inputProps.disabled && !inputProps.readOnly && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [errorMsg && !errorInTooltip && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.ErrorMessage, Object.assign({ id: errorMessageId, errorMsg: errorMsg, hidden: hideErrorMessage }, tid.errorMsg), void 0)), helperText && (0, jsx_runtime_1.jsx)(HelperText_1.HelperText, Object.assign({ helperText: helperText }, tid.helperText), void 0)] }, void 0))] }), void 0));
|
|
125
125
|
}
|
|
126
126
|
exports.TextFieldBase = TextFieldBase;
|
|
@@ -36,6 +36,7 @@ export interface BeamSelectFieldBaseProps<O, V extends Value> extends BeamFocusa
|
|
|
36
36
|
placeholder?: string;
|
|
37
37
|
/** Only used for Single Select Fields. If set, prepends an option with a `undefined` value at the top of the list */
|
|
38
38
|
unsetLabel?: string;
|
|
39
|
+
hideErrorMessage?: boolean;
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Provides a non-native select/dropdown widget.
|
|
@@ -26,6 +26,7 @@ interface SelectFieldInputProps<O, V extends Value> extends PresentationFieldPro
|
|
|
26
26
|
nothingSelectedText: string;
|
|
27
27
|
tooltip?: ReactNode;
|
|
28
28
|
resetField: VoidFunction;
|
|
29
|
+
hideErrorMessage?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export declare function SelectFieldInput<O, V extends Value>(props: SelectFieldInputProps<O, V>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
32
|
export {};
|