@arquimedes.co/eureka-forms 3.0.18-refactor → 3.0.19-refactor
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.
|
@@ -28,9 +28,17 @@ export const StyledSelect = styled(MuiSelect)(({ theme, size, ...props }) => ({
|
|
|
28
28
|
'&:hover:not(.Mui-readOnly) .Erk-MuiOutlinedInput-notchedOutline': {
|
|
29
29
|
borderColor: props.disabled || props.readOnly ? theme.palette.outline.main : theme.palette.primary.main,
|
|
30
30
|
},
|
|
31
|
+
'&.Mui-readOnly': {
|
|
32
|
+
'& .Erk-MuiSelect-select': {
|
|
33
|
+
color: theme.palette.text.primary,
|
|
34
|
+
WebkitTextFillColor: theme.palette.text.primary,
|
|
35
|
+
},
|
|
36
|
+
'& .Erk-MuiSelect-icon': {
|
|
37
|
+
color: theme.palette.text.primary + 'a0',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
31
40
|
'& .Mui-disabled, &.Mui-readOnly': {
|
|
32
41
|
cursor: 'default',
|
|
33
|
-
pointerEvents: 'none',
|
|
34
42
|
},
|
|
35
43
|
'&.Erk-MuiInputBase-root.Mui-focused': {
|
|
36
44
|
'& .Erk-MuiOutlinedInput-notchedOutline': {
|
|
@@ -7,7 +7,6 @@ const filter = createFilterOptions();
|
|
|
7
7
|
const StyledAutoComplete = styled(MuiAutocomplete)(({ theme, readOnly, ...props }) => ({
|
|
8
8
|
'& .Erk-MuiInputBase-root': {
|
|
9
9
|
cursor: props.disabled || readOnly ? 'default' : 'text',
|
|
10
|
-
pointerEvents: props.disabled || readOnly ? 'none' : undefined,
|
|
11
10
|
},
|
|
12
11
|
'& .Erk-MuiInputBase-input': {
|
|
13
12
|
paddingRight: 24,
|
|
@@ -19,6 +18,7 @@ const StyledAutoComplete = styled(MuiAutocomplete)(({ theme, readOnly, ...props
|
|
|
19
18
|
color: theme.palette.text.primary + 'a0',
|
|
20
19
|
'& .Erk-MuiButtonBase-root': {
|
|
21
20
|
padding: 0,
|
|
21
|
+
color: readOnly ? theme.palette.text.primary + 'a0' : undefined,
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
'& .Erk-MuiAutocomplete-popupIndicatorOpen': {
|
|
@@ -27,7 +27,7 @@ const StyledAutoComplete = styled(MuiAutocomplete)(({ theme, readOnly, ...props
|
|
|
27
27
|
}));
|
|
28
28
|
export default function ErkSmartSelect({ options, value = '', onChange, label, getValueString = (value) => value?.value, loading = false, getOptionSelected, IconComponent, size = 'small', disabled = false, readOnly = false, searchable = false, inputRef, ...others }) {
|
|
29
29
|
if (searchable) {
|
|
30
|
-
return (_jsx(StyledAutoComplete, { fullWidth: true, openOnFocus: true, size: size, loading: loading, disabled: disabled, readOnly: readOnly, options: options ?? [], loadingText: "Cargando...", onFocus: others.onFocus, "data-testid": "smart-select", noOptionsText: "No hay opciones", value: !loading && value ? value : null, onChange: (_event, newValue) => onChange?.(newValue), popupIcon: loading ? _jsx(CircularProgress, { size: 22 }) : IconComponent ? _jsx(IconComponent, {}) : undefined, filterOptions: (options, params) => {
|
|
30
|
+
return (_jsx(StyledAutoComplete, { fullWidth: true, openOnFocus: true, size: size, loading: loading, disabled: disabled || readOnly, readOnly: readOnly, options: options ?? [], loadingText: "Cargando...", onFocus: others.onFocus, "data-testid": "smart-select", noOptionsText: "No hay opciones", value: !loading && value ? value : null, onChange: (_event, newValue) => onChange?.(newValue), popupIcon: loading ? _jsx(CircularProgress, { size: 22 }) : IconComponent ? _jsx(IconComponent, {}) : undefined, filterOptions: (options, params) => {
|
|
31
31
|
if (value && value.label === params?.inputValue) {
|
|
32
32
|
return options;
|
|
33
33
|
}
|
|
@@ -46,11 +46,7 @@ export default function ErkSmartSelect({ options, value = '', onChange, label, g
|
|
|
46
46
|
// Regular option
|
|
47
47
|
return option?.label ?? '';
|
|
48
48
|
}
|
|
49
|
-
}, slotProps: {
|
|
50
|
-
popper: {
|
|
51
|
-
sx: { zIndex: 1305 },
|
|
52
|
-
},
|
|
53
|
-
}, renderInput: (params) => (_jsx(StyledTextField, { ...params, size: size, label: label, labelMargin: 0, name: others.name, readOnly: readOnly, disabled: disabled, inputRef: inputRef, error: others.error, onBlur: others.onBlur, required: others.required, helperText: others.helperText })) }));
|
|
49
|
+
}, slotProps: { popper: { sx: { zIndex: 1305 } } }, renderInput: (params) => (_jsx(StyledTextField, { ...params, size: size, label: label, labelMargin: 0, name: others.name, readOnly: readOnly, disabled: disabled, inputRef: inputRef, error: others.error, onBlur: others.onBlur, required: others.required, helperText: others.helperText })) }));
|
|
54
50
|
}
|
|
55
51
|
else {
|
|
56
52
|
return (_jsxs(ErkSelect, { ...others, labelMargin: 0, disabled: disabled, readOnly: readOnly, inputRef: inputRef, onChange: (value) => onChange?.(options?.find((option) => getValueString(option) === value)), value: loading ? '' : getValueString(value), label: label, IconComponent: loading ? () => _jsx(CircularProgress, { size: 22 }) : IconComponent, children: [options?.map((option) => (_jsx(ErkMenuItem, { value: getValueString(option), "data-testid": 'smart-select-' + getValueString(option), children: option.label }, getValueString(option)))), options === undefined && value && !loading && (_jsx(ErkMenuItem, { value: getValueString(value), children: value.label ?? '' }, getValueString(value)))] }));
|
package/package.json
CHANGED