@vertigis/react-ui 12.2.0 → 13.0.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/ColorInput/ColorInput.js +4 -1
- package/FormLabelAutocompleteField/FormLabelAutocompleteField .js +1 -1
- package/FormLabelColorField/FormLabelColorField.js +1 -1
- package/FormLabelNumberField/FormLabelNumberField.d.ts +1 -1
- package/FormLabelNumberField/FormLabelNumberField.js +14 -2
- package/FormLabelSliderField/FormLabelSliderField.js +1 -1
- package/FormLabelTextField/FormLabelTextField.js +9 -3
- package/IconMenu/IconMenu.js +10 -1
- package/InlineHelp/InlineHelp.d.ts +4 -0
- package/InlineHelp/InlineHelp.js +5 -2
- package/package.json +1 -1
package/ColorInput/ColorInput.js
CHANGED
|
@@ -88,7 +88,10 @@ export const ColorInput = forwardRef(function ColorInput({ "aria-labelledby": ar
|
|
|
88
88
|
// The rgb object will be used for passing values to the color picker component
|
|
89
89
|
const rgb = color ? color.rgb().object() : defaultRgbColor;
|
|
90
90
|
const classes = mergeStyles(colorInputClasses, classesProp);
|
|
91
|
-
return (_jsxs(Root, { className: clsx(classes.root, className), ...others, ref: ref, children: [_jsx(Button, { "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy,
|
|
91
|
+
return (_jsxs(Root, { className: clsx(classes.root, className), ...others, ref: ref, children: [_jsx(Button, { ...ButtonProps, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, disabled: ButtonProps?.disabled ?? disabled ?? muiFormControl?.disabled, className: clsx(classes.pickerButton, ButtonProps?.className), "data-test": "ColorInput-picker-button", onClick: event => {
|
|
92
|
+
handleColorPopoverOpen(event);
|
|
93
|
+
ButtonProps?.onClick?.(event);
|
|
94
|
+
}, children: _jsx("div", { className: classes.pickerButtonBackground, children: _jsx("div", { className: classes.pickerButtonColor, "data-test": "ColorInput-picker-button-color", style: {
|
|
92
95
|
// The rgb CSS string will be used for styling the color picker button
|
|
93
96
|
background: color ? color.rgb().string() : "transparent",
|
|
94
97
|
} }) }) }), _jsx(Popover, { anchorEl: buttonEl, open: !!buttonEl, anchorOrigin: {
|
|
@@ -15,6 +15,6 @@ const FormLabelAutocompleteField = forwardRef(function FormLabelAutocompleteFiel
|
|
|
15
15
|
const id = useId(idProp);
|
|
16
16
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
17
17
|
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
18
|
-
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { id: helperTextId,
|
|
18
|
+
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { ...FormHelperTextProps, id: helperTextId, children: helperText })), _jsx(Autocomplete, { "aria-labelledby": inputLabelId, defaultValue: defaultValue, disableClearable: disableClearable, disabled: disabled, getOptionLabel: getOptionLabel, onBlur: onBlur, onChange: onChange, onFocus: onFocus, options: options, filterOptions: filterOptions, renderInput: params => (_jsx(Input, { ...params.InputProps, inputProps: { ...params.inputProps }, sx: { width: "100%" } })), value: value, ...AutocompleteProps })] }));
|
|
19
19
|
});
|
|
20
20
|
export default FormLabelAutocompleteField;
|
|
@@ -14,7 +14,7 @@ const FormLabelColorField = forwardRef(function FormLabelColorField(props, ref)
|
|
|
14
14
|
const id = useId(idProp);
|
|
15
15
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
16
16
|
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
17
|
-
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { id: helperTextId,
|
|
17
|
+
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { ...FormHelperTextProps, id: helperTextId, children: helperText })), _jsx(ColorInput, { id: id, placeholder: placeholder, onBlur: onBlur, onFocus: onFocus, defaultValue: defaultValue, "aria-describedby": helperTextId, "aria-labelledby": inputLabelId, onChange: onChange, value: value, disabled: disabled, ...ColorInputProps,
|
|
18
18
|
// Workaround typings issue.
|
|
19
19
|
ref: ColorInputProps?.ref })] }));
|
|
20
20
|
});
|
|
@@ -6,7 +6,7 @@ import { type NumberInputProps } from "../NumberInput/index.js";
|
|
|
6
6
|
* Properties for FormLabelNumberField.
|
|
7
7
|
*/
|
|
8
8
|
export type FormLabelNumberFieldProps = Omit<TextFieldProps, "aria-label" | "value" | "onChange" | "InputProps" | "select" | "nativeSelect" | "multiline" | "minRows" | "maxRows" | "SelectProps" | "rows" | "type" | "title" | "onError"> & Pick<FormControlProps, "inlineHelpContent" | "inlineHelpUrl"> & NumberInputProps & {
|
|
9
|
-
InputProps?: Omit<NumberInputProps, "ref">;
|
|
9
|
+
InputProps?: Omit<NumberInputProps, "id" | "ref">;
|
|
10
10
|
NumberInputComponent?: FC<NumberInputProps>;
|
|
11
11
|
/**
|
|
12
12
|
* A label to display as helpText when the number input value is out of
|
|
@@ -47,9 +47,21 @@ const FormLabelNumberField = forwardRef(function FormLabelNumberField(props, ref
|
|
|
47
47
|
setNumberError(undefined);
|
|
48
48
|
onErrorEnd?.(numericValue, textValue);
|
|
49
49
|
}, [onErrorEnd]);
|
|
50
|
-
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, error: error || !!numberError, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), (helperText || numberError) && (_jsx(FormHelperText, { id: helperTextId,
|
|
50
|
+
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, error: error || !!numberError, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), (helperText || numberError) && (_jsx(FormHelperText, { ...FormHelperTextProps, id: helperTextId, children: numberError ?? helperText })), _jsx(FormNumberInput
|
|
51
|
+
// All of the properties fron here down to `InputProps` can be overridden by it.
|
|
52
|
+
// Any after that must be controlled by this component itself.
|
|
53
|
+
, {
|
|
54
|
+
// All of the properties fron here down to `InputProps` can be overridden by it.
|
|
55
|
+
// Any after that must be controlled by this component itself.
|
|
56
|
+
autoComplete: autoComplete,
|
|
51
57
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
52
|
-
autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth, name: name, value: value,
|
|
58
|
+
autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth, name: name, value: value, inputRef: inputRef, onBlur: onBlur, onChange: onChange, onFocus: onFocus, placeholder: placeholder, inputProps: inputProps, error: error, min: min, max: max, allowUndefined: allowUndefined, maxDecimalPlaces: maxDecimalPlaces, correctOnBlur: correctOnBlur, ...InputProps, "aria-describedby": helperTextId, id: id, onError: (numericValue, textValue, errorType) => {
|
|
59
|
+
InputProps?.onError?.(numericValue, textValue, errorType);
|
|
60
|
+
handleError(numericValue, textValue, errorType);
|
|
61
|
+
}, onErrorEnd: (numericValue, textValue) => {
|
|
62
|
+
InputProps?.onErrorEnd?.(numericValue, textValue);
|
|
63
|
+
handleErrorEnd(numericValue, textValue);
|
|
64
|
+
} })] }));
|
|
53
65
|
});
|
|
54
66
|
function getNumberErrorText(val, min, max) {
|
|
55
67
|
const hasMax = typeof max === "number" && !isNaN(max);
|
|
@@ -62,7 +62,7 @@ const FormLabelSliderField = forwardRef(function FormLabelSliderField(props, ref
|
|
|
62
62
|
//
|
|
63
63
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
64
64
|
autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth, id: inputId, inputProps: inputProps, inputRef: inputRef ?? inputReference, name: name, onChange: onChange, placeholder: placeholder, value: value, error: error, onError: handleError, onErrorEnd: handleErrorEnd, min, max, ...InputProps, sx: { maxWidth: typography.pxToRem(74), ...InputProps?.sx } }));
|
|
65
|
-
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, error: error || !!numberError, ...other, children: [label && (_jsx(FormLabel, { htmlFor: inputId, id: inputLabelId, children: label })), (helperText || !!numberError) && (_jsx(FormHelperText, { id: helperTextId,
|
|
65
|
+
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, disabled: disabled, error: error || !!numberError, ...other, children: [label && (_jsx(FormLabel, { htmlFor: inputId, id: inputLabelId, children: label })), (helperText || !!numberError) && (_jsx(FormHelperText, { ...FormHelperTextProps, id: helperTextId, children: numberError ?? helperText })), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Slider, { "aria-describedby": helperTextId, "aria-labelledby": inputLabelId, defaultValue: defaultValue, name: name, id: sliderId, value: value, onChange: handleSliderChange, disabled: disabled, min, max, ...SliderProps }), InputElement] })] }));
|
|
66
66
|
});
|
|
67
67
|
function getNumberErrorText(val, min, max) {
|
|
68
68
|
const hasMax = typeof max === "number" && !isNaN(max);
|
|
@@ -23,12 +23,18 @@ const FormLabelTextField = forwardRef(function FormLabelTextField(props, ref) {
|
|
|
23
23
|
}
|
|
24
24
|
inputMoreProps["aria-describedby"] = undefined;
|
|
25
25
|
}
|
|
26
|
-
const InputElement = (_jsx(Input
|
|
26
|
+
const InputElement = (_jsx(Input
|
|
27
|
+
// All of the properties fron here down to `InputProps` can be overridden by it.
|
|
28
|
+
// Any after that must be controlled by this component itself.
|
|
29
|
+
, {
|
|
30
|
+
// All of the properties fron here down to `InputProps` can be overridden by it.
|
|
31
|
+
// Any after that must be controlled by this component itself.
|
|
32
|
+
autoComplete: autoComplete,
|
|
27
33
|
// Disabling this linting rule since the intent is to forward it
|
|
28
34
|
// if it exists rather than set it.
|
|
29
35
|
//
|
|
30
36
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
31
|
-
autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth,
|
|
32
|
-
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { id: helperTextId,
|
|
37
|
+
autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth, inputProps: inputProps, inputRef: inputRef, maxRows: maxRows, minRows: minRows, multiline: multiline, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, placeholder: placeholder, rows: rows, type: type, value: value, ...inputMoreProps, ...InputProps, "aria-describedby": helperTextId, id: id }));
|
|
38
|
+
return (_jsxs(FormControl, { fullWidth: fullWidth, ref: ref, ...other, children: [label && (_jsx(FormLabel, { htmlFor: id, id: inputLabelId, children: label })), helperText && (_jsx(FormHelperText, { ...FormHelperTextProps, id: helperTextId, children: helperText })), select || nativeSelect ? (_jsx(Select, { "aria-describedby": helperTextId, id: id, labelId: inputLabelId, value: value, input: InputElement, ...SelectProps, ...(nativeSelect && { native: true }), children: children })) : (InputElement)] }));
|
|
33
39
|
});
|
|
34
40
|
export default FormLabelTextField;
|
package/IconMenu/IconMenu.js
CHANGED
|
@@ -16,6 +16,15 @@ const IconMenu = forwardRef(function IconMenu({ id: idProp, children, icon, clas
|
|
|
16
16
|
const [open, setOpen] = useState(false);
|
|
17
17
|
const id = useId(idProp);
|
|
18
18
|
const classes = mergeStyles(iconMenuClasses, classesProp);
|
|
19
|
-
return (_jsxs(Box, { className: clsx(classes.root, className), ref: ref, ...others, children: [_jsx(IconButton, { "aria-label": "More", "aria-owns": open ? id : undefined, "aria-haspopup": "true", "data-test": "IconMenu-btn", disabled: disabled, className: classes.iconButton,
|
|
19
|
+
return (_jsxs(Box, { className: clsx(classes.root, className), ref: ref, ...others, children: [_jsx(IconButton, { ...IconButtonProps, "aria-label": "More", "aria-owns": open ? id : undefined, "aria-haspopup": "true", "data-test": "IconMenu-btn", disabled: disabled, className: clsx(classes.iconButton, IconButtonProps?.className), onClick: event => {
|
|
20
|
+
setOpen(true);
|
|
21
|
+
IconButtonProps?.onClick?.(event);
|
|
22
|
+
}, ref: ref => (anchorRef.current = anchorRef.current ?? ref), children: icon }), _jsx(Menu, { ...MenuProps, open: MenuProps?.open ?? open, id: id, "data-test": "IconMenu-menu", anchorEl: anchorRef.current, onClose: (event, reason) => {
|
|
23
|
+
setOpen(false);
|
|
24
|
+
MenuProps?.onClose?.(event, reason);
|
|
25
|
+
}, onClick: event => {
|
|
26
|
+
setOpen(false);
|
|
27
|
+
MenuProps?.onClick?.(event);
|
|
28
|
+
}, children: children })] }));
|
|
20
29
|
});
|
|
21
30
|
export default IconMenu;
|
package/InlineHelp/InlineHelp.js
CHANGED
|
@@ -32,7 +32,7 @@ const StyledPopover = styled(Popover)(({ theme: { spacing } }) => ({
|
|
|
32
32
|
wordWrap: "break-word",
|
|
33
33
|
},
|
|
34
34
|
}));
|
|
35
|
-
const InlineHelp = forwardRef(function InlineHelp({ children, classes: classesProp, className, icon, title, url, ...other }, ref) {
|
|
35
|
+
const InlineHelp = forwardRef(function InlineHelp({ children, classes: classesProp, className, icon, onClose, title, url, ...other }, ref) {
|
|
36
36
|
const [iconBtnEl, setIconBtnEl] = useState();
|
|
37
37
|
const theme = useTheme();
|
|
38
38
|
const classes = mergeStyles(inlineHelpClasses, classesProp);
|
|
@@ -41,6 +41,9 @@ const InlineHelp = forwardRef(function InlineHelp({ children, classes: classesPr
|
|
|
41
41
|
const handleIconPopoverClose = () => setIconBtnEl(undefined);
|
|
42
42
|
return (_jsxs(Box, { className: clsx(classes.root, className), ref: ref, ...other, children: [_jsx(IconButton, { onClick: handleIconPopoverOpen, title: title, size: "small", "data-test": `${PREFIX}-button`, className: clsx({
|
|
43
43
|
[classes.errorIcon]: formControl?.error,
|
|
44
|
-
}), children: icon ? icon : _jsx(HelpIcon, {}) }), _jsxs(StyledPopover, { anchorEl: iconBtnEl, open: !!iconBtnEl, classes: { paper: classes.paper }, anchorOrigin: theme.direction === "rtl" ? RTL_ORIGIN : LTR_ORIGIN, transformOrigin: theme.direction === "rtl" ? RTL_ORIGIN : LTR_ORIGIN, onClose:
|
|
44
|
+
}), children: icon ? icon : _jsx(HelpIcon, {}) }), _jsxs(StyledPopover, { anchorEl: iconBtnEl, open: !!iconBtnEl, classes: { paper: classes.paper }, anchorOrigin: theme.direction === "rtl" ? RTL_ORIGIN : LTR_ORIGIN, transformOrigin: theme.direction === "rtl" ? RTL_ORIGIN : LTR_ORIGIN, onClose: () => {
|
|
45
|
+
handleIconPopoverClose();
|
|
46
|
+
onClose?.();
|
|
47
|
+
}, children: [_jsx(Typography, { children: children }), url && (_jsx(Link, { align: "right", display: "block", href: url.href, onClick: () => url.onClick?.(url.href), target: "_blank", variant: "body2", children: url.label }))] })] }));
|
|
45
48
|
});
|
|
46
49
|
export default InlineHelp;
|