@vertigis/react-ui 11.31.1 → 11.32.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.
@@ -3,10 +3,12 @@ import type { FormLabelClasses as MUIFormLabelClasses, FormLabelProps as MUIForm
3
3
  import type { OverridableComponent } from "@mui/material/OverridableComponent";
4
4
  declare const gcxFormLabelClasses: {
5
5
  errorIcon: string;
6
+ errorIconBackground: string;
6
7
  };
7
8
  export * from "@mui/material/FormLabel";
8
9
  export declare const formLabelClasses: {
9
10
  errorIcon: string;
11
+ errorIconBackground: string;
10
12
  root: string;
11
13
  colorSecondary: string;
12
14
  focused: string;
@@ -2,12 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import MUIFormLabel, { formLabelClasses as muiFormLabelClasses } from "@mui/material/FormLabel";
3
3
  import clsx from "clsx";
4
4
  import { forwardRef } from "react";
5
+ import Box from "../Box/index.js";
5
6
  import { useFormControl } from "../FormControl/index.js";
6
7
  import ErrorIcon from "../icons/Error.js";
7
8
  import { mergeStyles, styled } from "../styles/index.js";
8
9
  const PREFIX = "GcxFormLabel";
9
10
  const gcxFormLabelClasses = {
10
11
  errorIcon: `${PREFIX}-errorIcon`,
12
+ errorIconBackground: `${PREFIX}-errorIconBackground`,
11
13
  };
12
14
  // MUST be the first export, since some of the exports are overridden below.
13
15
  export * from "@mui/material/FormLabel";
@@ -18,7 +20,6 @@ export const formLabelClasses = {
18
20
  const StyledMUIFormLabel = styled(MUIFormLabel)(({ theme: { spacing, palette } }) => ({
19
21
  [`& .${formLabelClasses.errorIcon}`]: {
20
22
  fontSize: "0.875em",
21
- marginRight: spacing(0.5),
22
23
  },
23
24
  }));
24
25
  export const FormLabel = forwardRef(function FormLabel(props, ref) {
@@ -27,7 +28,7 @@ export const FormLabel = forwardRef(function FormLabel(props, ref) {
27
28
  // See https://github.com/mui-org/material-ui/pull/20278.
28
29
  const muiFormControl = useFormControl();
29
30
  const error = errorProp ?? muiFormControl?.error;
30
- const { errorIcon: errorIconClass, ...otherClasses } = mergeStyles(gcxFormLabelClasses, classes);
31
- return (_jsxs(StyledMUIFormLabel, { error: error, className: clsx("GcxFormLabel", className), ...other, classes: otherClasses, ref: ref, children: [error && _jsx(ErrorIcon, { className: errorIconClass, "data-test": "FormLabel-ErrorIcon" }), children] }));
31
+ const { errorIcon: errorIconClass, errorIconBackground: errorIconBackgroundClass, ...otherClasses } = mergeStyles(gcxFormLabelClasses, classes);
32
+ return (_jsxs(StyledMUIFormLabel, { error: error, className: clsx("GcxFormLabel", className), ...other, classes: otherClasses, ref: ref, children: [error && (_jsx(Box, { className: errorIconBackgroundClass, component: "span", children: _jsx(ErrorIcon, { className: errorIconClass, "data-test": "FormLabel-ErrorIcon" }) })), children] }));
32
33
  });
33
34
  export default FormLabel;
@@ -32,12 +32,6 @@ const StyledPopover = styled(Popover)(({ theme: { spacing } }) => ({
32
32
  wordWrap: "break-word",
33
33
  },
34
34
  }));
35
- const Root = styled(Box)(({ theme: { spacing } }) => ({
36
- [`& .${inlineHelpClasses.errorIcon}`]: {
37
- color: "white",
38
- marginTop: spacing(1),
39
- },
40
- }));
41
35
  const InlineHelp = forwardRef(function InlineHelp({ children, classes: classesProp, className, icon, title, url, ...other }, ref) {
42
36
  const [iconBtnEl, setIconBtnEl] = useState();
43
37
  const theme = useTheme();
@@ -45,7 +39,7 @@ const InlineHelp = forwardRef(function InlineHelp({ children, classes: classesPr
45
39
  const formControl = useFormControl();
46
40
  const handleIconPopoverOpen = (event) => setIconBtnEl(event.currentTarget);
47
41
  const handleIconPopoverClose = () => setIconBtnEl(undefined);
48
- return (_jsxs(Root, { className: clsx(classes.root, className), ref: ref, ...other, children: [_jsx(IconButton, { onClick: handleIconPopoverOpen, title: title, size: "small", "data-test": `${PREFIX}-button`, className: clsx({
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({
49
43
  [classes.errorIcon]: formControl?.error,
50
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: handleIconPopoverClose, 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 }))] })] }));
51
45
  });