@vertigis/react-ui 13.3.1 → 14.0.1
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 +3 -3
- package/CopyableText/CopyableText.js +1 -1
- package/FormControl/FormControl.js +1 -1
- package/FormLabel/FormLabel.js +1 -1
- package/FormLabelAutocompleteField/FormLabelAutocompleteField .js +2 -2
- package/FormLabelColorField/FormLabelColorField.js +2 -2
- package/FormLabelNumberField/FormLabelNumberField.js +2 -2
- package/FormLabelSliderField/FormLabelSliderField.js +2 -2
- package/FormLabelTextField/FormLabelTextField.js +1 -1
- package/IconMenu/IconMenu.js +1 -1
- package/InlineHelp/InlineHelp.js +1 -1
- package/Link/Link.js +1 -1
- package/Loader/Loader.js +1 -1
- package/Markdown/Markdown.js +3 -5
- package/NumberFormatContext/NumberFormatContext.js +2 -6
- package/NumberInput/NumberInput.js +13 -11
- package/SymbolInput/FontInput.js +7 -13
- package/SymbolInput/SimpleFillSymbolInput.js +80 -84
- package/SymbolInput/SimpleLineSymbolInput.js +46 -48
- package/SymbolInput/SimpleMarkerSymbolInput.js +8 -10
- package/SymbolInput/TextSymbolInput.js +11 -15
- package/Tab/Tab.js +1 -1
- package/Tabs/Tabs.js +1 -1
- package/icons/utils/createSvgIcon.js +1 -1
- package/package.json +1 -1
- package/styles/createTheme.js +95 -21
- package/utils/throttle.js +4 -2
- package/utils/url.js +2 -2
package/ColorInput/ColorInput.js
CHANGED
|
@@ -67,7 +67,7 @@ const Root = styled(Box)(({ theme: { palette, shape, typography } }) => ({
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
}));
|
|
70
|
-
export const ColorInput = forwardRef(
|
|
70
|
+
export const ColorInput = forwardRef(({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ButtonProps, className, classes: classesProp, disabled, presetColors, onChange, value: unsanitizedValue, sketchPickerStyle = {}, ...others }, ref) => {
|
|
71
71
|
const theme = useTheme();
|
|
72
72
|
const [buttonEl, setButtonEl] = useState();
|
|
73
73
|
const handleColorPopoverOpen = (event) => setButtonEl(event.currentTarget);
|
|
@@ -82,7 +82,7 @@ export const ColorInput = forwardRef(function ColorInput({ "aria-labelledby": ar
|
|
|
82
82
|
// See https://github.com/mui-org/material-ui/pull/20278.
|
|
83
83
|
const muiFormControl = useFormControl();
|
|
84
84
|
// `RGB(0,0,0)` will fail, we should instead convert to `rgb(0,0,0)`
|
|
85
|
-
const value = unsanitizedValue
|
|
85
|
+
const value = unsanitizedValue?.toLowerCase();
|
|
86
86
|
// Color allows us to easily convert between different color types
|
|
87
87
|
const color = parseColor(value);
|
|
88
88
|
// The rgb object will be used for passing values to the color picker component
|
|
@@ -113,7 +113,7 @@ export const ColorInput = forwardRef(function ColorInput({ "aria-labelledby": ar
|
|
|
113
113
|
g: rgb.g,
|
|
114
114
|
b: rgb.b,
|
|
115
115
|
a: rgb.alpha,
|
|
116
|
-
}, onChangeComplete: handleColorPickerChangeComplete, presetColors: presetColors
|
|
116
|
+
}, onChangeComplete: handleColorPickerChangeComplete, presetColors: presetColors ?? defaultColors, styles: {
|
|
117
117
|
default: {
|
|
118
118
|
picker: {
|
|
119
119
|
background: theme.palette.background.paper,
|
|
@@ -74,7 +74,7 @@ const CopyableText = forwardRef((props, ref) => {
|
|
|
74
74
|
readOnly: true,
|
|
75
75
|
"data-test": "CopyableText-Input",
|
|
76
76
|
...inputProps,
|
|
77
|
-
}, inputRef: mergeRefs(ref, localRef), value: value
|
|
77
|
+
}, inputRef: mergeRefs(ref, localRef), value: value ?? "", "data-test": "CopyableText-Input-Wrapper", ...otherInputProps }), _jsx(Tooltip, { "data-test": "CopyableText-Tooltip", open: open, onOpen: handleTooltipOpen, onClose: handleTooltipClose, title: showClickedMessage ? tooltipCopiedText : tooltipCopyText, placement: "bottom", children: _jsx(Button, { className: classes.iconButton, "data-test": "CopyableText-IconButton", disabled: !value, onClick: handleCopyUrl, onMouseDown: handleMouseDown, children: _jsx(CopyIcon, {}) }) })] }));
|
|
78
78
|
});
|
|
79
79
|
CopyableText.displayName = "CopyableText";
|
|
80
80
|
export default CopyableText;
|
|
@@ -22,7 +22,7 @@ const StyledMUIFormControl = styled(MUIFormControl)({
|
|
|
22
22
|
/**
|
|
23
23
|
* A simple extension for a Form Control that includes inline help.
|
|
24
24
|
*/
|
|
25
|
-
const FormControl = forwardRef(
|
|
25
|
+
const FormControl = forwardRef((props, ref) => {
|
|
26
26
|
const { children, classes, inlineHelpContent, inlineHelpUrl, inlineHelpTitle, ...other } = props;
|
|
27
27
|
const { inlineHelp: inlineHelpClass, ...otherClasses } = mergeStyles(gcxFormControlClasses, classes);
|
|
28
28
|
return (_jsxs(StyledMUIFormControl, { ...other, classes: otherClasses, ref: ref, children: [children, inlineHelpContent && (_jsx(InlineHelp, { title: inlineHelpTitle, className: inlineHelpClass, url: inlineHelpUrl, children: inlineHelpContent }))] }));
|
package/FormLabel/FormLabel.js
CHANGED
|
@@ -22,7 +22,7 @@ const StyledMUIFormLabel = styled(MUIFormLabel)(({ theme: { spacing, palette } }
|
|
|
22
22
|
fontSize: "0.875em",
|
|
23
23
|
},
|
|
24
24
|
}));
|
|
25
|
-
export const FormLabel = forwardRef(
|
|
25
|
+
export const FormLabel = forwardRef((props, ref) => {
|
|
26
26
|
const { children, classes, className, error: errorProp, ...other } = props;
|
|
27
27
|
// Careful. `useFormControl` can return undefined.
|
|
28
28
|
// See https://github.com/mui-org/material-ui/pull/20278.
|
|
@@ -10,8 +10,8 @@ import { useId } from "../utils/react.js";
|
|
|
10
10
|
* Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
|
|
11
11
|
* for inline help.
|
|
12
12
|
*/
|
|
13
|
-
const FormLabelAutocompleteField = forwardRef(
|
|
14
|
-
const { AutocompleteProps, defaultValue, disableClearable, disabled, filterOptions, FormHelperTextProps, fullWidth = false, getOptionLabel, helperText, id: idProp, label, onBlur, onChange, onFocus, options,
|
|
13
|
+
const FormLabelAutocompleteField = forwardRef((props, ref) => {
|
|
14
|
+
const { AutocompleteProps, defaultValue, disableClearable, disabled, filterOptions, FormHelperTextProps, fullWidth = false, getOptionLabel, helperText, id: idProp, label, onBlur, onChange, onFocus, options, value, ...other } = props;
|
|
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;
|
|
@@ -9,12 +9,12 @@ import { useId } from "../utils/react.js";
|
|
|
9
9
|
* Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
|
|
10
10
|
* for inline help.
|
|
11
11
|
*/
|
|
12
|
-
const FormLabelColorField = forwardRef(
|
|
12
|
+
const FormLabelColorField = forwardRef((props, ref) => {
|
|
13
13
|
const { defaultValue, FormHelperTextProps, fullWidth = false, helperText, id: idProp, label, onBlur, onChange, onFocus, placeholder, type, value, disabled, ColorInputProps, ...other } = props;
|
|
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, { ...FormHelperTextProps, id: helperTextId, children: helperText })), _jsx(ColorInput, { id: id,
|
|
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, 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
|
});
|
|
@@ -12,7 +12,7 @@ import { useId } from "../utils/react.js";
|
|
|
12
12
|
* Like TextField, but uses a FormLabel instead of an InputLabel, and uses
|
|
13
13
|
* NumberInput instead of a normal input.
|
|
14
14
|
*/
|
|
15
|
-
const FormLabelNumberField = forwardRef(
|
|
15
|
+
const FormLabelNumberField = forwardRef((props, ref) => {
|
|
16
16
|
const { autoComplete, autoFocus = false, children, className, defaultValue, FormHelperTextProps, fullWidth = false, helperText, id: idProp, InputLabelProps, inputProps, InputProps, inputRef, label, name, NumberInputComponent, onBlur, onChange, onFocus, placeholder, value, min, max, numberOutOfRangeErrorText, invalidNumberErrorText, maxDecimalPlacesErrorText, error, onError, onErrorEnd, allowUndefined, maxDecimalPlaces = DEFAULT_DECIMAL_PLACES, correctOnBlur = true, ...other } = props;
|
|
17
17
|
const id = useId(idProp);
|
|
18
18
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
@@ -47,7 +47,7 @@ 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
|
|
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
51
|
// All of the properties fron here down to `InputProps` can be overridden by it.
|
|
52
52
|
// Any after that must be controlled by this component itself.
|
|
53
53
|
, {
|
|
@@ -12,7 +12,7 @@ import { useId } from "../utils/react.js";
|
|
|
12
12
|
* Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
|
|
13
13
|
* for inline help.
|
|
14
14
|
*/
|
|
15
|
-
const FormLabelSliderField = forwardRef(
|
|
15
|
+
const FormLabelSliderField = forwardRef((props, ref) => {
|
|
16
16
|
const { autoComplete, autoFocus = false, defaultValue, disabled, FormHelperTextProps, fullWidth = false, helperText, id: idProp, InputLabelProps, inputProps, InputProps, inputRef, label, name, onBlur, onChange, onFocus, onKeyDown, onMouseUp, placeholder, value, SliderProps, numberOutOfRangeErrorText, invalidNumberErrorText, onError, onErrorEnd, error, maxDecimalPlacesErrorText, NumberInputComponent, ...other } = props;
|
|
17
17
|
const inputId = `${useId(idProp)}-input`;
|
|
18
18
|
const sliderId = `${useId(idProp)}-slider`;
|
|
@@ -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
|
|
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);
|
|
@@ -10,7 +10,7 @@ import { useId } from "../utils/react.js";
|
|
|
10
10
|
* Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
|
|
11
11
|
* for inline help.
|
|
12
12
|
*/
|
|
13
|
-
const FormLabelTextField = forwardRef(
|
|
13
|
+
const FormLabelTextField = forwardRef((props, ref) => {
|
|
14
14
|
const { autoComplete, autoFocus = false, children, defaultValue, FormHelperTextProps, fullWidth = false, helperText, id: idProp, InputLabelProps, inputProps, InputProps, inputRef, label, maxRows, minRows, multiline = false, name, nativeSelect = false, onBlur, onChange, onFocus, placeholder, rows, select = false, SelectProps, type, value, ...other } = props;
|
|
15
15
|
const id = useId(idProp);
|
|
16
16
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
package/IconMenu/IconMenu.js
CHANGED
|
@@ -11,7 +11,7 @@ export const iconMenuClasses = {
|
|
|
11
11
|
root: `${PREFIX}-root`,
|
|
12
12
|
iconButton: `${PREFIX}-iconButton`,
|
|
13
13
|
};
|
|
14
|
-
const IconMenu = forwardRef(
|
|
14
|
+
const IconMenu = forwardRef(({ id: idProp, children, icon, className, classes: classesProp, disabled, IconButtonProps, MenuProps, ...others }, ref) => {
|
|
15
15
|
const anchorRef = useRef();
|
|
16
16
|
const [open, setOpen] = useState(false);
|
|
17
17
|
const id = useId(idProp);
|
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(
|
|
35
|
+
const InlineHelp = forwardRef(({ 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);
|
package/Link/Link.js
CHANGED
|
@@ -24,7 +24,7 @@ const StyledMUILink = styled(MUILink)(() => ({
|
|
|
24
24
|
margin: "0 0.2em",
|
|
25
25
|
},
|
|
26
26
|
}));
|
|
27
|
-
const Link = forwardRef(
|
|
27
|
+
const Link = forwardRef(({ classes, children, showExternalLinkIcon, ...otherProps }, ref) => {
|
|
28
28
|
const { externalLinkIcon: externalLinkIconClass, ...otherClasses } = mergeStyles(gcxLinkClasses, classes);
|
|
29
29
|
return (_jsxs(StyledMUILink, { ...otherProps, classes: otherClasses, ref: ref, children: [children, showExternalLinkIcon && (_jsx(LinkExternal, { className: externalLinkIconClass, fontSize: "inherit", "data-test": "Link-external-icon" }))] }));
|
|
30
30
|
});
|
package/Loader/Loader.js
CHANGED
|
@@ -65,7 +65,7 @@ const Root = styled("div")(({ theme: { palette } }) => ({
|
|
|
65
65
|
visibility: "visible",
|
|
66
66
|
},
|
|
67
67
|
}));
|
|
68
|
-
const Loader = forwardRef(
|
|
68
|
+
const Loader = forwardRef(({ className, classes: classesProp, showBackground, visible, children }, ref) => {
|
|
69
69
|
const classes = mergeStyles(loaderClasses, classesProp);
|
|
70
70
|
return (_jsx(Fade, { in: visible, ref: ref, children: _jsxs(Root, { "aria-hidden": "true", className: clsx(classes.root, className, {
|
|
71
71
|
[classes.showBackground]: showBackground,
|
package/Markdown/Markdown.js
CHANGED
|
@@ -6,9 +6,7 @@ import { markdownToHtml } from "../utils/markdown.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* A component that renders markdown as HTML.
|
|
8
8
|
*/
|
|
9
|
-
const Markdown = ({ markdown, inline, escapeHtml, sanitize = sanitizeHtml, linkTarget, className, ...otherProps }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, ...otherProps }));
|
|
13
|
-
};
|
|
9
|
+
const Markdown = ({ markdown, inline, escapeHtml, sanitize = sanitizeHtml, linkTarget, className, ...otherProps }) => (_jsx(Box, { component: inline ? "span" : "div", className: clsx("GcxMarkdown", className), dangerouslySetInnerHTML: {
|
|
10
|
+
__html: sanitize(markdownToHtml(markdown, { inline, escapeHtml, linkTarget })),
|
|
11
|
+
}, ...otherProps }));
|
|
14
12
|
export default Markdown;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
const formatNumber = (n) => {
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
const parseNumber = (s) => {
|
|
6
|
-
return +s;
|
|
7
|
-
};
|
|
2
|
+
const formatNumber = (n) => `${n}`;
|
|
3
|
+
const parseNumber = (s) => +s;
|
|
8
4
|
/**
|
|
9
5
|
* A React context for components that gives access to number formatting
|
|
10
6
|
* utilities.
|
|
@@ -9,10 +9,10 @@ export const DEFAULT_DECIMAL_PLACES = 16;
|
|
|
9
9
|
* formatting and parsing. Default formatting and parsing can be overridden by
|
|
10
10
|
* wrapping this component in a NumberFormatContext.Provider.
|
|
11
11
|
*/
|
|
12
|
-
const NumberInput = forwardRef(
|
|
12
|
+
const NumberInput = forwardRef(({ onChange, onBlur, value, defaultValue, max, min, error, onError, onErrorEnd, allowUndefined, correctOnBlur = true, maxDecimalPlaces = DEFAULT_DECIMAL_PLACES, ...props }, ref) => {
|
|
13
13
|
const { formatNumber, parseNumber } = useContext(NumberFormatContext);
|
|
14
14
|
const [textValue, setTextValue] = useState(value === undefined ? "" : formatNumber(value));
|
|
15
|
-
const [numericValue, setNumericValue] = useState(value
|
|
15
|
+
const [numericValue, setNumericValue] = useState(value ?? NaN);
|
|
16
16
|
const [lastValid, setLastValid] = useState(numericValue);
|
|
17
17
|
const isValidNaN = useCallback((val) => allowUndefined && !val?.trim(), [allowUndefined]);
|
|
18
18
|
const isOutOfRange = useCallback((val) => (typeof min === "number" && val < min) || (typeof max === "number" && val > max), [min, max]);
|
|
@@ -22,14 +22,16 @@ const NumberInput = forwardRef(function NumberInput({ onChange, onBlur, value, d
|
|
|
22
22
|
: // If the user begins to type a negative number, do not present an invalid
|
|
23
23
|
// error.
|
|
24
24
|
textValue?.trim() !== "-" && parseNumber(textValue) !== numericValue;
|
|
25
|
-
const previousError = usePrevious(error
|
|
25
|
+
const previousError = usePrevious(error ?? invalidError);
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
if (!isNaN(numericValue) &&
|
|
27
|
+
if (!isNaN(numericValue) &&
|
|
28
|
+
!isOutOfRange(numericValue) &&
|
|
29
|
+
!isTooPrecise(numericValue)) {
|
|
28
30
|
setLastValid(numericValue);
|
|
29
31
|
}
|
|
30
32
|
}, [numericValue, isOutOfRange, isTooPrecise]);
|
|
31
33
|
useEffect(() => {
|
|
32
|
-
const e = error
|
|
34
|
+
const e = error ?? invalidError;
|
|
33
35
|
if (e !== previousError) {
|
|
34
36
|
if (invalidError) {
|
|
35
37
|
const inputVal = parseNumber(textValue);
|
|
@@ -95,7 +97,11 @@ const NumberInput = forwardRef(function NumberInput({ onChange, onBlur, value, d
|
|
|
95
97
|
return newValue;
|
|
96
98
|
}, [max, min, maxDecimalPlaces]);
|
|
97
99
|
useEffect(() => {
|
|
98
|
-
if (value
|
|
100
|
+
if (value === undefined) {
|
|
101
|
+
setTextValue("");
|
|
102
|
+
setNumericValue(NaN);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
99
105
|
// For controlled components, only update the text from the value if
|
|
100
106
|
// it's a valid number, and represents a number different from the
|
|
101
107
|
// one in the text box. Otherwise leave it alone so that it's not
|
|
@@ -105,10 +111,6 @@ const NumberInput = forwardRef(function NumberInput({ onChange, onBlur, value, d
|
|
|
105
111
|
}
|
|
106
112
|
setNumericValue(correctValue(value));
|
|
107
113
|
}
|
|
108
|
-
else {
|
|
109
|
-
setTextValue("");
|
|
110
|
-
setNumericValue(NaN);
|
|
111
|
-
}
|
|
112
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- It's intentional to omit numericValue. We only want this to run when the incoming value changes, not when numericValue changes in handleChange().
|
|
113
115
|
}, [value, formatNumber, correctValue]);
|
|
114
116
|
const handleChange = useCallback(event => {
|
|
@@ -130,7 +132,7 @@ const NumberInput = forwardRef(function NumberInput({ onChange, onBlur, value, d
|
|
|
130
132
|
}
|
|
131
133
|
onBlur?.(event);
|
|
132
134
|
}, [correctOnBlur, reformat, onBlur]);
|
|
133
|
-
return (_jsx(Input, { ref: ref, type: "text", value: textValue, onChange: handleChange, onBlur: handleBlur, defaultValue: typeof defaultValue === "number" ? formatNumber(defaultValue) : undefined, "data-test": "NumberInput-container", error: error
|
|
135
|
+
return (_jsx(Input, { ref: ref, type: "text", value: textValue, onChange: handleChange, onBlur: handleBlur, defaultValue: typeof defaultValue === "number" ? formatNumber(defaultValue) : undefined, "data-test": "NumberInput-container", error: error ?? invalidError, ...props }));
|
|
134
136
|
});
|
|
135
137
|
export default NumberInput;
|
|
136
138
|
function getDecimalPlaces(value) {
|
package/SymbolInput/FontInput.js
CHANGED
|
@@ -7,13 +7,11 @@ import FormLabelAutocompleteField from "../FormLabelAutocompleteField/FormLabelA
|
|
|
7
7
|
import FormLabelSliderField from "../FormLabelSliderField/index.js";
|
|
8
8
|
import FormLabelTextField from "../FormLabelTextField/index.js";
|
|
9
9
|
import { useId } from "../utils/react.js";
|
|
10
|
-
const getDecorationValues = (t) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
];
|
|
16
|
-
};
|
|
10
|
+
const getDecorationValues = (t) => [
|
|
11
|
+
{ id: "none", label: t.decorationNone },
|
|
12
|
+
{ id: "line-through", label: t.decorationLineThrough },
|
|
13
|
+
{ id: "underline", label: t.decorationLineUnderline },
|
|
14
|
+
];
|
|
17
15
|
const capitalizeFirstLetter = (value) => `${value.charAt(0).toUpperCase() + value.slice(1)}`;
|
|
18
16
|
const defaultFontJson = {
|
|
19
17
|
size: 9,
|
|
@@ -50,7 +48,7 @@ export const FontInput = ({ font, fontFamilies, languageResources, onChange, Aut
|
|
|
50
48
|
decoration: font.decoration ?? "none",
|
|
51
49
|
size: font.size ?? 9,
|
|
52
50
|
};
|
|
53
|
-
let fontFamily = fontList.find(f => f.font.family
|
|
51
|
+
let fontFamily = fontList.find(f => f.font.family === fontWithDefaults.family &&
|
|
54
52
|
f.font.style === fontWithDefaults.style &&
|
|
55
53
|
f.font.weight === fontWithDefaults.weight);
|
|
56
54
|
if (!fontFamily) {
|
|
@@ -71,11 +69,7 @@ export const FontInput = ({ font, fontFamilies, languageResources, onChange, Aut
|
|
|
71
69
|
};
|
|
72
70
|
fontList.push(fontFamily);
|
|
73
71
|
}
|
|
74
|
-
return (_jsxs(Box, { ...props, children: [_jsx(AutocompleteInput, { fullWidth: true, disableClearable: true, options: fontList, label: text.fontFamily, "aria-labelledby": labelId, filterOptions: (options, state) => {
|
|
75
|
-
return fontList.filter(f => f.name
|
|
76
|
-
.toLocaleLowerCase()
|
|
77
|
-
.indexOf(state.inputValue.toLocaleLowerCase()) !== -1);
|
|
78
|
-
}, getOptionLabel: option => option.name, value: fontFamily, onChange: (event, newValue, reason, details) => {
|
|
72
|
+
return (_jsxs(Box, { ...props, children: [_jsx(AutocompleteInput, { fullWidth: true, disableClearable: true, options: fontList, label: text.fontFamily, "aria-labelledby": labelId, filterOptions: (options, state) => fontList.filter(f => f.name.toLocaleLowerCase().includes(state.inputValue.toLocaleLowerCase())), getOptionLabel: option => option.name, value: fontFamily, onChange: (event, newValue, reason, details) => {
|
|
79
73
|
onChange({
|
|
80
74
|
...font,
|
|
81
75
|
family: newValue.font.family,
|
|
@@ -89,87 +89,83 @@ const SimpleFillSymbolInput = props => {
|
|
|
89
89
|
}, children: getSimpleFillStyles(text).map(fillStyle => (_jsx("option", { value: fillStyle.id, children: fillStyle.label }, fillStyle.id))) })] }))] }));
|
|
90
90
|
};
|
|
91
91
|
export default SimpleFillSymbolInput;
|
|
92
|
-
export const getSimpleFillStyles = (t) =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
label: t.lineStyleSolid,
|
|
173
|
-
},
|
|
174
|
-
];
|
|
175
|
-
};
|
|
92
|
+
export const getSimpleFillStyles = (t) => [
|
|
93
|
+
{
|
|
94
|
+
id: "esriSFSBackwardDiagonal",
|
|
95
|
+
label: t.fillStyleBackwardDiagonal,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "esriSFSCross",
|
|
99
|
+
label: t.fillStyleCross,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "esriSFSDiagonalCross",
|
|
103
|
+
label: t.fillStyleDiagonalCross,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "esriSFSForwardDiagonal",
|
|
107
|
+
label: t.fillStyleForwardDiagonal,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "esriSFSHorizontal",
|
|
111
|
+
label: t.fillStyleHorizontal,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "esriSFSNull",
|
|
115
|
+
label: t.fillStyleNone,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "esriSFSSolid",
|
|
119
|
+
label: t.fillStyleSolid,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "esriSFSVertical",
|
|
123
|
+
label: t.fillStyleVertical,
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
export const getSimpleLineStyles = (t) => [
|
|
127
|
+
{
|
|
128
|
+
id: "esriSLSDash",
|
|
129
|
+
label: t.lineStyleDash,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "esriSLSDashDot",
|
|
133
|
+
label: t.lineStyleDashDot,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "esriSLSDot",
|
|
137
|
+
label: t.lineStyleDot,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "esriSLSLongDash",
|
|
141
|
+
label: t.lineStyleLongDash,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "esriSLSLongDashDot",
|
|
145
|
+
label: t.lineStyleLongDashDot,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "esriSLSNull",
|
|
149
|
+
label: t.lineStyleNone,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "esriSLSShortDash",
|
|
153
|
+
label: t.lineStyleShortDash,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "esriSLSShortDashDot",
|
|
157
|
+
label: t.lineStyleShortDashDot,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "esriSLSShortDashDotDot",
|
|
161
|
+
label: t.lineStyleShortDashDotDot,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "esriSLSShortDot",
|
|
165
|
+
label: t.lineStyleShortDot,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "esriSLSSolid",
|
|
169
|
+
label: t.lineStyleSolid,
|
|
170
|
+
},
|
|
171
|
+
];
|
|
@@ -75,51 +75,49 @@ const SimpleLineSymbolInput = props => {
|
|
|
75
75
|
} })] }))] }));
|
|
76
76
|
};
|
|
77
77
|
export default SimpleLineSymbolInput;
|
|
78
|
-
export const getSimpleLineStyles = (t) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
];
|
|
125
|
-
};
|
|
78
|
+
export const getSimpleLineStyles = (t) => [
|
|
79
|
+
{
|
|
80
|
+
id: "esriSLSDash",
|
|
81
|
+
label: t.lineStyleDash,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "esriSLSDashDot",
|
|
85
|
+
label: t.lineStyleDashDot,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "esriSLSDot",
|
|
89
|
+
label: t.lineStyleDot,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "esriSLSLongDash",
|
|
93
|
+
label: t.lineStyleLongDash,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "esriSLSLongDashDot",
|
|
97
|
+
label: t.lineStyleLongDashDot,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "esriSLSNull",
|
|
101
|
+
label: t.lineStyleNone,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "esriSLSShortDash",
|
|
105
|
+
label: t.lineStyleShortDash,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "esriSLSShortDashDot",
|
|
109
|
+
label: t.lineStyleShortDashDot,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "esriSLSShortDashDotDot",
|
|
113
|
+
label: t.lineStyleShortDashDotDot,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "esriSLSShortDot",
|
|
117
|
+
label: t.lineStyleShortDot,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "esriSLSSolid",
|
|
121
|
+
label: t.lineStyleSolid,
|
|
122
|
+
},
|
|
123
|
+
];
|
|
@@ -150,13 +150,11 @@ const SimpleMarkerSymbolInput = props => {
|
|
|
150
150
|
} })] }))] }));
|
|
151
151
|
};
|
|
152
152
|
export default SimpleMarkerSymbolInput;
|
|
153
|
-
export const getSimpleMarkerStyles = (t) =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
];
|
|
162
|
-
};
|
|
153
|
+
export const getSimpleMarkerStyles = (t) => [
|
|
154
|
+
{ id: "esriSMSCircle", label: t.markerStyleCircle },
|
|
155
|
+
{ id: "esriSMSCross", label: t.markerStyleCross },
|
|
156
|
+
{ id: "esriSMSDiamond", label: t.markerStyleDiamond },
|
|
157
|
+
{ id: "esriSMSSquare", label: t.markerStyleSquare },
|
|
158
|
+
{ id: "esriSMSTriangle", label: t.markerStyleTriangle },
|
|
159
|
+
{ id: "esriSMSX", label: t.markerStyleX },
|
|
160
|
+
];
|
|
@@ -114,18 +114,14 @@ const TextSymbolInput = props => {
|
|
|
114
114
|
} })] }))] }))] }));
|
|
115
115
|
};
|
|
116
116
|
export default TextSymbolInput;
|
|
117
|
-
const getHorizontalAlignmentValues = (t) =>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{ id: "middle", label: t.verticalAlignmentMiddle },
|
|
129
|
-
{ id: "bottom", label: t.verticalAlignmentBottom },
|
|
130
|
-
];
|
|
131
|
-
};
|
|
117
|
+
const getHorizontalAlignmentValues = (t) => [
|
|
118
|
+
{ id: "left", label: t.horizontalAlignmentLeft },
|
|
119
|
+
{ id: "right", label: t.horizontalAlignmentRight },
|
|
120
|
+
{ id: "center", label: t.horizontalAlignmentCenter },
|
|
121
|
+
];
|
|
122
|
+
const getVerticalAlignmentValues = (t) => [
|
|
123
|
+
{ id: "baseline", label: t.verticalAlignmentBaseline },
|
|
124
|
+
{ id: "top", label: t.verticalAlignmentTop },
|
|
125
|
+
{ id: "middle", label: t.verticalAlignmentMiddle },
|
|
126
|
+
{ id: "bottom", label: t.verticalAlignmentBottom },
|
|
127
|
+
];
|
package/Tab/Tab.js
CHANGED
|
@@ -49,7 +49,7 @@ const Root = styled("div")({
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
export * from "@mui/material/Tab";
|
|
52
|
-
const Tab = forwardRef(
|
|
52
|
+
const Tab = forwardRef((props, ref) => {
|
|
53
53
|
const { className, classes, disabled, endAdornment, label, ...other } = props;
|
|
54
54
|
const { endAdornment: endAdornmentClass, fullWidthContainer: fullWidthContainerClass, tabAdorned: tabAdornedClass, tabContainer: tabContainerClass, labelWrapper: labelWrapperClass, ...otherClasses } = mergeStyles(gcxTabClasses, classes);
|
|
55
55
|
return (_jsxs(Root, { className: clsx(tabContainerClass, {
|
package/Tabs/Tabs.js
CHANGED
|
@@ -21,7 +21,7 @@ const StyledTabs = styled(MUITabs)({
|
|
|
21
21
|
backgroundColor: "transparent",
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
const Tabs = forwardRef(
|
|
24
|
+
const Tabs = forwardRef(({ classes, indicatorColor, ...props }, ref) => {
|
|
25
25
|
const { indicator: indicatorClass, indicatorTransparent: indicatorTransparentClass, ...otherClasses } = mergeStyles(gcxTabsClasses, classes);
|
|
26
26
|
return (_jsx(StyledTabs, { indicatorColor: indicatorColor, ...props, classes: {
|
|
27
27
|
indicator: clsx(indicatorClass, {
|
|
@@ -34,7 +34,7 @@ export default function createSvgIcon(path, displayName, mirror) {
|
|
|
34
34
|
return (_jsx(StyledIcon, { classes: otherClasses, className: clsx(className, {
|
|
35
35
|
[mirroredClass]: direction === "rtl" &&
|
|
36
36
|
mirror !== false &&
|
|
37
|
-
(mirror
|
|
37
|
+
(mirror ?? shouldMirror(displayName)),
|
|
38
38
|
}), ref: ref, ...otherProps }));
|
|
39
39
|
};
|
|
40
40
|
// Copied from MUI implementation.
|
package/package.json
CHANGED
package/styles/createTheme.js
CHANGED
|
@@ -9,6 +9,10 @@ const primaryTextColor = "#333333";
|
|
|
9
9
|
const primaryErrorColor = "#B22222";
|
|
10
10
|
const primaryWarningColor = "#BF5300";
|
|
11
11
|
const primarySuccessColor = "#008040";
|
|
12
|
+
const fontWeightLight = 300;
|
|
13
|
+
const fontWeightRegular = 400;
|
|
14
|
+
const fontWeightMedium = 600;
|
|
15
|
+
const fontWeightBold = 700;
|
|
12
16
|
const lightThemeOverrides = {
|
|
13
17
|
palette: {
|
|
14
18
|
background: {
|
|
@@ -20,7 +24,7 @@ const lightThemeOverrides = {
|
|
|
20
24
|
secondary: secondaryTextColor,
|
|
21
25
|
},
|
|
22
26
|
};
|
|
23
|
-
const
|
|
27
|
+
const getDefaultOptions = (pxToRem) => ({
|
|
24
28
|
palette: {
|
|
25
29
|
primary: blue,
|
|
26
30
|
secondary: green,
|
|
@@ -29,10 +33,80 @@ const defaultOptions = {
|
|
|
29
33
|
warning: { main: primaryWarningColor },
|
|
30
34
|
success: { main: primarySuccessColor },
|
|
31
35
|
},
|
|
36
|
+
// Defaults should match https://meridian.vertigis.com/docs/design-language/#typography
|
|
37
|
+
// Use `pxToRem` so clients with different root font sizes still work properly.
|
|
32
38
|
typography: {
|
|
33
|
-
fontFamily:
|
|
39
|
+
fontFamily: '"Segoe UI", "Helvetica Neue", "Roboto", Helvetica, Arial, sans-serif',
|
|
40
|
+
fontWeightLight,
|
|
41
|
+
fontWeightRegular,
|
|
42
|
+
fontWeightMedium,
|
|
43
|
+
fontWeightBold,
|
|
44
|
+
h1: {
|
|
45
|
+
fontSize: pxToRem(32),
|
|
46
|
+
fontWeight: fontWeightLight,
|
|
47
|
+
lineHeight: 1.25,
|
|
48
|
+
},
|
|
49
|
+
h2: {
|
|
50
|
+
fontSize: pxToRem(28),
|
|
51
|
+
fontWeight: fontWeightLight,
|
|
52
|
+
lineHeight: 1.25,
|
|
53
|
+
},
|
|
54
|
+
h3: {
|
|
55
|
+
fontSize: pxToRem(26),
|
|
56
|
+
fontWeight: fontWeightRegular,
|
|
57
|
+
lineHeight: 1.25,
|
|
58
|
+
},
|
|
59
|
+
h4: {
|
|
60
|
+
fontSize: pxToRem(22),
|
|
61
|
+
fontWeight: fontWeightRegular,
|
|
62
|
+
lineHeight: 1.25,
|
|
63
|
+
},
|
|
64
|
+
h5: {
|
|
65
|
+
fontSize: pxToRem(20),
|
|
66
|
+
fontWeight: fontWeightMedium,
|
|
67
|
+
lineHeight: 1.25,
|
|
68
|
+
},
|
|
69
|
+
h6: {
|
|
70
|
+
fontSize: pxToRem(16),
|
|
71
|
+
fontWeight: fontWeightMedium,
|
|
72
|
+
lineHeight: 1.125,
|
|
73
|
+
},
|
|
74
|
+
subtitle1: {
|
|
75
|
+
fontSize: pxToRem(16),
|
|
76
|
+
fontWeight: fontWeightRegular,
|
|
77
|
+
lineHeight: 1.125,
|
|
78
|
+
letterSpacing: pxToRem(0.15),
|
|
79
|
+
},
|
|
80
|
+
subtitle2: {
|
|
81
|
+
fontSize: pxToRem(14),
|
|
82
|
+
fontWeight: fontWeightMedium,
|
|
83
|
+
lineHeight: 1.5,
|
|
84
|
+
letterSpacing: pxToRem(0.17),
|
|
85
|
+
},
|
|
86
|
+
body1: {
|
|
87
|
+
fontSize: pxToRem(14),
|
|
88
|
+
fontWeight: fontWeightRegular,
|
|
89
|
+
lineHeight: 1.5,
|
|
90
|
+
},
|
|
91
|
+
body2: {
|
|
92
|
+
fontSize: pxToRem(12),
|
|
93
|
+
fontWeight: fontWeightRegular,
|
|
94
|
+
lineHeight: 1.375,
|
|
95
|
+
},
|
|
96
|
+
caption: {
|
|
97
|
+
fontSize: pxToRem(14),
|
|
98
|
+
fontWeight: fontWeightRegular,
|
|
99
|
+
fontStyle: "italic",
|
|
100
|
+
lineHeight: 1.625,
|
|
101
|
+
},
|
|
102
|
+
button: {
|
|
103
|
+
fontSize: pxToRem(14),
|
|
104
|
+
fontWeight: fontWeightRegular,
|
|
105
|
+
lineHeight: 1.75,
|
|
106
|
+
textTransform: "none",
|
|
107
|
+
},
|
|
34
108
|
},
|
|
35
|
-
};
|
|
109
|
+
});
|
|
36
110
|
const defaultDenseOptions = {
|
|
37
111
|
spacing: 6,
|
|
38
112
|
components: {
|
|
@@ -140,15 +214,15 @@ const getMenuItemStyles = ({ palette, transitions }) => ({
|
|
|
140
214
|
* separately after the fact.
|
|
141
215
|
*/
|
|
142
216
|
function getOverrides(theme) {
|
|
143
|
-
const { palette, shape, spacing, transitions, typography } = theme;
|
|
217
|
+
const { palette, shape, spacing, transitions, typography: { pxToRem, fontWeightMedium, fontWeightBold, body1, subtitle2 }, } = theme;
|
|
144
218
|
const isDarkMode = palette.mode === "dark";
|
|
145
219
|
return {
|
|
146
220
|
components: {
|
|
147
221
|
MuiAutocomplete: {
|
|
148
222
|
styleOverrides: {
|
|
149
223
|
root: {
|
|
150
|
-
|
|
151
|
-
|
|
224
|
+
".MuiInput-root": {
|
|
225
|
+
".MuiInput-input": {
|
|
152
226
|
// Let the height expand to fit content
|
|
153
227
|
height: "auto",
|
|
154
228
|
padding: "5px 8px",
|
|
@@ -181,7 +255,6 @@ function getOverrides(theme) {
|
|
|
181
255
|
root: {
|
|
182
256
|
borderStyle: "solid",
|
|
183
257
|
borderWidth: 1,
|
|
184
|
-
textTransform: "none",
|
|
185
258
|
"&.Mui-focusVisible:active": {
|
|
186
259
|
backgroundColor: alpha(palette.grey.A200, 0.5),
|
|
187
260
|
},
|
|
@@ -327,13 +400,13 @@ function getOverrides(theme) {
|
|
|
327
400
|
boxSizing: "inherit",
|
|
328
401
|
},
|
|
329
402
|
"strong, b": {
|
|
330
|
-
fontWeight:
|
|
403
|
+
fontWeight: fontWeightBold,
|
|
331
404
|
},
|
|
332
405
|
body: {
|
|
333
406
|
margin: 0,
|
|
334
407
|
padding: 0,
|
|
335
408
|
color: palette.text.primary,
|
|
336
|
-
...
|
|
409
|
+
...body1,
|
|
337
410
|
backgroundColor: palette.background.default,
|
|
338
411
|
overflow: "hidden",
|
|
339
412
|
"@media print": {
|
|
@@ -386,7 +459,7 @@ function getOverrides(theme) {
|
|
|
386
459
|
},
|
|
387
460
|
styleOverrides: {
|
|
388
461
|
root: {
|
|
389
|
-
...
|
|
462
|
+
...subtitle2,
|
|
390
463
|
marginTop: 0,
|
|
391
464
|
marginBottom: spacing(0.5),
|
|
392
465
|
"&.Mui-error": {
|
|
@@ -406,9 +479,9 @@ function getOverrides(theme) {
|
|
|
406
479
|
margin: spacing(0.5, 0),
|
|
407
480
|
color: "currentColor",
|
|
408
481
|
// Clear InlineHelp button
|
|
409
|
-
paddingRight:
|
|
482
|
+
paddingRight: pxToRem(32),
|
|
410
483
|
lineHeight: 1.4,
|
|
411
|
-
fontWeight:
|
|
484
|
+
fontWeight: fontWeightMedium,
|
|
412
485
|
"&.Mui-error, &.Mui-error.Mui-focused": {
|
|
413
486
|
borderRadius: shape.borderRadius,
|
|
414
487
|
color: palette.text.primary,
|
|
@@ -416,8 +489,8 @@ function getOverrides(theme) {
|
|
|
416
489
|
// Error icon background circle
|
|
417
490
|
"& .GcxFormLabel-errorIconBackground": {
|
|
418
491
|
display: "inline-flex",
|
|
419
|
-
width:
|
|
420
|
-
height:
|
|
492
|
+
width: pxToRem(22),
|
|
493
|
+
height: pxToRem(22),
|
|
421
494
|
justifyContent: "center",
|
|
422
495
|
marginRight: "4px",
|
|
423
496
|
alignItems: "center",
|
|
@@ -562,7 +635,7 @@ function getOverrides(theme) {
|
|
|
562
635
|
// styling for any existing code still using this
|
|
563
636
|
// property.
|
|
564
637
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
565
|
-
// @ts-
|
|
638
|
+
// @ts-expect-error
|
|
566
639
|
props: { button: true },
|
|
567
640
|
style: {
|
|
568
641
|
...getMenuItemStyles(theme),
|
|
@@ -613,12 +686,12 @@ function getOverrides(theme) {
|
|
|
613
686
|
},
|
|
614
687
|
paddingTop: 4,
|
|
615
688
|
paddingBottom: 4,
|
|
616
|
-
|
|
689
|
+
"& .MuiListItemIcon-root svg": {
|
|
617
690
|
// MUI sets this to 1.25rem, which ignores the
|
|
618
691
|
// theme's `htmlFontSize` setting. Override with
|
|
619
692
|
// pxToRem to get the correct height regardless of
|
|
620
693
|
// HTML font size.
|
|
621
|
-
fontSize:
|
|
694
|
+
fontSize: pxToRem(20),
|
|
622
695
|
},
|
|
623
696
|
},
|
|
624
697
|
},
|
|
@@ -664,7 +737,7 @@ function getOverrides(theme) {
|
|
|
664
737
|
valueLabel: {
|
|
665
738
|
// Set the minimum height to avoid it jumping around
|
|
666
739
|
// when the label does not have a value.
|
|
667
|
-
minHeight:
|
|
740
|
+
minHeight: pxToRem(28),
|
|
668
741
|
},
|
|
669
742
|
},
|
|
670
743
|
},
|
|
@@ -790,7 +863,7 @@ function getOverrides(theme) {
|
|
|
790
863
|
// Chosen to match PanelGroup in react-ui-internal.
|
|
791
864
|
backgroundColor: isDarkMode ? palette.grey[900] : palette.grey[200],
|
|
792
865
|
fontWeight: "bold",
|
|
793
|
-
fontSize:
|
|
866
|
+
fontSize: pxToRem(14),
|
|
794
867
|
},
|
|
795
868
|
},
|
|
796
869
|
},
|
|
@@ -963,11 +1036,12 @@ function getOverrides(theme) {
|
|
|
963
1036
|
}
|
|
964
1037
|
function createTheme(options = {}) {
|
|
965
1038
|
// Merge the VertiGIS Studio theme defaults with any user specified theme options
|
|
966
|
-
const mode = options
|
|
1039
|
+
const mode = options?.palette && options.palette.mode === "dark" ? "dark" : "light";
|
|
967
1040
|
// If we are using light mode, then we want to use our defined light theme palette
|
|
968
1041
|
const modeOptions = mode === "light" ? lightThemeOverrides : {};
|
|
969
1042
|
const { dense = false, ...overrides } = options;
|
|
970
|
-
const
|
|
1043
|
+
const defaultTheme = createMuiTheme();
|
|
1044
|
+
const mergedOptions = deepAssign({}, getDefaultOptions(defaultTheme.typography.pxToRem), modeOptions, dense ? defaultDenseOptions : {}, overrides);
|
|
971
1045
|
const createdTheme = createMuiTheme(mergedOptions);
|
|
972
1046
|
return overrideTheme(createdTheme, getOverrides(createdTheme));
|
|
973
1047
|
}
|
package/utils/throttle.js
CHANGED
|
@@ -13,7 +13,8 @@ export function throttle(func, msBetweenRequests) {
|
|
|
13
13
|
if (!isScheduled) {
|
|
14
14
|
window.setTimeout(() => {
|
|
15
15
|
isScheduled = false;
|
|
16
|
-
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
17
|
+
func(...args);
|
|
17
18
|
}, msBetweenRequests);
|
|
18
19
|
isScheduled = true;
|
|
19
20
|
}
|
|
@@ -30,7 +31,8 @@ export function throttleAnimation(func) {
|
|
|
30
31
|
if (!isScheduled) {
|
|
31
32
|
requestAnimationFrame(() => {
|
|
32
33
|
isScheduled = false;
|
|
33
|
-
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
35
|
+
func(...args);
|
|
34
36
|
});
|
|
35
37
|
isScheduled = true;
|
|
36
38
|
}
|
package/utils/url.js
CHANGED
|
@@ -69,6 +69,6 @@ export function setHashParams(kvp) {
|
|
|
69
69
|
* @param paramsString The string to be set as the hash string.
|
|
70
70
|
*/
|
|
71
71
|
function setHashParamsString(paramsString) {
|
|
72
|
-
|
|
73
|
-
history.replaceState(null, document.title, getUrlWithoutHash() +
|
|
72
|
+
const pString = paramsString.startsWith("#") ? paramsString : `#${paramsString}`;
|
|
73
|
+
history.replaceState(null, document.title, getUrlWithoutHash() + pString);
|
|
74
74
|
}
|