ish-ui 1.3.4 → 1.3.5
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/README.md +1 -1
- package/dist/colorPicker/ColorPicker.js +1 -1
- package/dist/formFields/AutosizeInput.d.ts +4 -1
- package/dist/formFields/AutosizeInput.js +9 -2
- package/dist/formFields/EditInPlaceFieldBase.js +9 -4
- package/dist/formFields/EditInPlaceMoneyField.js +1 -1
- package/dist/styles/animateStyles.js +2 -2
- package/dist/tagsInput/TagInputList.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ const useStyles = makeAppStyles()(({ spacing, palette, zIndex, transitions }, p,
|
|
|
77
77
|
marginBottom: spacing(1.25)
|
|
78
78
|
},
|
|
79
79
|
customAlfa: {
|
|
80
|
-
'& > div > div:first-
|
|
80
|
+
'& > div > div:first-of-type > div': {
|
|
81
81
|
background: 'none !important'
|
|
82
82
|
}
|
|
83
83
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { InputBaseComponentProps } from '@mui/material';
|
|
3
|
+
type InputElementProps = React.ComponentPropsWithRef<"input">;
|
|
4
|
+
interface AutosizeInputProps extends InputElementProps {
|
|
3
5
|
placeholder?: string;
|
|
4
6
|
/**
|
|
5
7
|
* Space kept free after the text, in px. Defaults to the advance width of a
|
|
@@ -9,6 +11,7 @@ interface AutosizeInputProps extends React.ComponentPropsWithRef<"input"> {
|
|
|
9
11
|
reserveWidth?: number;
|
|
10
12
|
/** MUI InputBase hands the DOM node over through this prop instead of `ref`. */
|
|
11
13
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
14
|
+
inputComponent?: React.ElementType<InputBaseComponentProps> | undefined;
|
|
12
15
|
}
|
|
13
16
|
export declare const AutosizeInput: React.FC<AutosizeInputProps>;
|
|
14
17
|
export {};
|
|
@@ -86,7 +86,7 @@ const getSpaceWidth = (probe, typographySignature) => {
|
|
|
86
86
|
return spaceWidth;
|
|
87
87
|
};
|
|
88
88
|
export const AutosizeInput = (_a) => {
|
|
89
|
-
var { placeholder, reserveWidth, inputRef, ref, value } = _a, props = __rest(_a, ["placeholder", "reserveWidth", "inputRef", "ref", "value"]);
|
|
89
|
+
var { placeholder, inputComponent, reserveWidth, inputRef, ref, value } = _a, props = __rest(_a, ["placeholder", "inputComponent", "reserveWidth", "inputRef", "ref", "value"]);
|
|
90
90
|
const [width, setWidth] = useState(0);
|
|
91
91
|
const spanRef = useRef(null);
|
|
92
92
|
const probeRef = useRef(null);
|
|
@@ -145,10 +145,17 @@ export const AutosizeInput = (_a) => {
|
|
|
145
145
|
if (props.onChange)
|
|
146
146
|
props.onChange(e);
|
|
147
147
|
};
|
|
148
|
+
// `React.ElementType<InputBaseComponentProps>` widens to every intrinsic tag,
|
|
149
|
+
// because InputBaseComponentProps carries an `[arbitrary: string]: any` index
|
|
150
|
+
// signature. The prop keeps that type for compatibility with MUI's InputBase,
|
|
151
|
+
// but rendering needs the narrower, input shaped contract this component
|
|
152
|
+
// actually passes. Falling back to the `input` tag rather than a wrapper
|
|
153
|
+
// component also keeps the element identity stable across renders.
|
|
154
|
+
const InputElement = (inputComponent !== null && inputComponent !== void 0 ? inputComponent : "input");
|
|
148
155
|
return (React.createElement("div", { style: { display: "inline-block", position: "relative" } },
|
|
149
156
|
React.createElement("span", { ref: spanRef, style: measureStyle, "aria-hidden": true }, value || placeholder || ""),
|
|
150
157
|
React.createElement("span", { ref: probeRef, style: measureStyle, "aria-hidden": true }),
|
|
151
|
-
React.createElement(
|
|
158
|
+
React.createElement(InputElement, Object.assign({}, props, { ref: setInputNode, type: "text", value: value, onChange: handleChange, placeholder: placeholder, style: Object.assign(Object.assign({}, props.style), { letterSpacing: "inherit", textTransform: "inherit", width: `${width}px`, boxSizing: "border-box",
|
|
152
159
|
// CRITICAL: Padding and borders must be 0, the measuring span has none either
|
|
153
160
|
paddingLeft: 0, paddingRight: 0, borderLeft: "none", borderRight: "none", margin: 0, textOverflow: "unset" }) }))));
|
|
154
161
|
};
|
|
@@ -37,14 +37,14 @@ const useStyles = makeAppStyles()((theme, p, classes) => ({
|
|
|
37
37
|
},
|
|
38
38
|
hideArrows: {
|
|
39
39
|
'&::-webkit-outer-spin-button': {
|
|
40
|
-
'
|
|
40
|
+
'WebkitAppearance': 'none',
|
|
41
41
|
margin: 0
|
|
42
42
|
},
|
|
43
43
|
'&::-webkit-inner-spin-button': {
|
|
44
|
-
'
|
|
44
|
+
'WebkitAppearance': 'none',
|
|
45
45
|
margin: 0
|
|
46
46
|
},
|
|
47
|
-
'
|
|
47
|
+
'MozAppearance': 'textfield'
|
|
48
48
|
},
|
|
49
49
|
inlineInput: {
|
|
50
50
|
padding: 0,
|
|
@@ -73,6 +73,11 @@ const EditInPlaceFieldBase = ({ invalid, className, inline, label, fieldClasses
|
|
|
73
73
|
return OutlinedInput;
|
|
74
74
|
}
|
|
75
75
|
}, [variant]);
|
|
76
|
+
const inputComponent = useMemo((props) => inline
|
|
77
|
+
? (InputProps === null || InputProps === void 0 ? void 0 : InputProps.inputComponent)
|
|
78
|
+
? props => React.createElement(AutosizeInput, Object.assign({}, props, { inputComponent: InputProps.inputComponent }))
|
|
79
|
+
: AutosizeInput
|
|
80
|
+
: InputProps === null || InputProps === void 0 ? void 0 : InputProps.inputComponent, [inline, InputProps === null || InputProps === void 0 ? void 0 : InputProps.inputComponent]);
|
|
76
81
|
return (React.createElement(FormControl, { fullWidth: true, error: invalid, variant: variant, margin: "none", className: cx(className, classes.inputWrapper) },
|
|
77
82
|
label && (React.createElement(InputLabel, { classes: {
|
|
78
83
|
root: cx(fieldClasses.label, 'd-flex', 'overflow-visible', rightAligned && classes.rightLabel),
|
|
@@ -80,7 +85,7 @@ const EditInPlaceFieldBase = ({ invalid, className, inline, label, fieldClasses
|
|
|
80
85
|
React.createElement("span", { className: classes.label }, label),
|
|
81
86
|
labelAdornment)),
|
|
82
87
|
CustomInput ||
|
|
83
|
-
React.createElement(InputComp, Object.assign({}, InputProps || {}, { inputComponent:
|
|
88
|
+
React.createElement(InputComp, Object.assign({}, InputProps || {}, { inputComponent: inputComponent, inputRef: inputNode, inputProps: Object.assign({ placeholder,
|
|
84
89
|
disabled, className: cx(fieldClasses.text, {
|
|
85
90
|
[classes.inlineInput]: inline,
|
|
86
91
|
[classes.readonly]: disabled,
|
|
@@ -34,7 +34,7 @@ function EditInPlaceMoneyField(_a) {
|
|
|
34
34
|
var _b;
|
|
35
35
|
var { InputProps, currencySymbol, className } = _a, restProps = __rest(_a, ["InputProps", "currencySymbol", "className"]);
|
|
36
36
|
const { cx } = useStyles();
|
|
37
|
-
return (React.createElement(EditInPlaceField, Object.assign({}, restProps, { preformatDisplayValue: preformatDisplayValue, InputProps: Object.assign(Object.assign({}, InputProps), { startAdornment: React.createElement(InputAdornment, { position: "start", className: (_b = restProps.fieldClasses) === null || _b === void 0 ? void 0 : _b.text },
|
|
37
|
+
return (React.createElement(EditInPlaceField, Object.assign({}, restProps, { preformatDisplayValue: preformatDisplayValue, InputProps: Object.assign(Object.assign({}, InputProps), { startAdornment: React.createElement(InputAdornment, { position: "start", className: cx((_b = restProps.fieldClasses) === null || _b === void 0 ? void 0 : _b.text, restProps.inline && 'mr-0-5') },
|
|
38
38
|
React.createElement("span", null, currencySymbol)), inputComponent: NumberFormatCustom }), className: cx('money', className) })));
|
|
39
39
|
}
|
|
40
40
|
export default EditInPlaceMoneyField;
|
|
@@ -23,8 +23,8 @@ export const animateStyles = Object.assign(Object.assign(Object.assign(Object.as
|
|
|
23
23
|
from: Object.assign(Object.assign({}, transform('translate3d(80px, 0, 0)')), prefixer('animationDuration', '0.5s', ['webkit', 'spec'])),
|
|
24
24
|
to: Object.assign(Object.assign({}, transform('translate3d(0px, 0, 0)')), prefixer('animationDuration', '0s', ['webkit', 'spec']))
|
|
25
25
|
})), keyframes('rotateOutCustom', {
|
|
26
|
-
from: Object.assign({}, prefixer('
|
|
27
|
-
to: Object.assign(Object.assign({}, transform('rotate3d(0, 0, 1, 720deg)')), prefixer('
|
|
26
|
+
from: Object.assign({}, prefixer('transformOrigin', 'center', ['webkit', 'spec'])),
|
|
27
|
+
to: Object.assign(Object.assign({}, transform('rotate3d(0, 0, 1, 720deg)')), prefixer('transformOrigin', 'center', ['webkit', 'spec']))
|
|
28
28
|
}, Object.assign({}, prefixer('animationDuration', '2.5s', ['webkit', 'spec'])))), keyframes('shake', {
|
|
29
29
|
'10%, 90%': Object.assign({}, transform('translate3d(-2px, 0, 0)')),
|
|
30
30
|
'20%, 80%': Object.assign({}, transform('translate3d(4px, 0, 0)')),
|
|
@@ -189,7 +189,7 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
|
|
|
189
189
|
return (React.createElement("div", { className: className, id: input.name },
|
|
190
190
|
React.createElement("div", { className: cx('relative', {
|
|
191
191
|
'pointer-events-none': disabled
|
|
192
|
-
}) }, React.createElement(Autocomplete, { value: input.value, multiple: true, open: menuIsOpen, options: filteredOptions, onBlur: exit, onChange: handleChange, renderOption: renderOption, filterOptions: filterOptionsInner, getOptionLabel: getOptionLabel, slots: {
|
|
192
|
+
}) }, React.createElement(Autocomplete, { value: (input === null || input === void 0 ? void 0 : input.value) || [], multiple: true, open: menuIsOpen, options: filteredOptions, onBlur: exit, onChange: handleChange, renderOption: renderOption, filterOptions: filterOptionsInner, getOptionLabel: getOptionLabel, slots: {
|
|
193
193
|
popper: inputValue || !trackCarretPosition ? undefined : popperAdapter,
|
|
194
194
|
listbox: inputValue ? undefined : listboxAdapter
|
|
195
195
|
}, classes: {
|