@m4l/components 9.1.119 → 9.1.121
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/.storybook/decorators/WithAppearanceContext/index.d.ts +0 -0
- package/.storybook/utils/getStylesColorsByMode.d.ts +4 -4
- package/components/Chip/Chip.js +8 -5
- package/components/Chip/ChipStyles.js +21 -18
- package/components/Chip/slots/ChipSlots.d.ts +5 -5
- package/components/Chip/types.d.ts +14 -7
- package/components/DataGrid/contexts/DataGridContext/index.js +3 -5
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +1 -3
- package/components/DataGrid/contexts/FilterContext/index.d.ts +1 -1
- package/components/DataGrid/dictionary.d.ts +18 -0
- package/components/DataGrid/dictionary.js +19 -1
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.js +1 -1
- package/components/DataGrid/formatters/ColumnDateFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/index.js +1 -2
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.js +1 -3
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.d.ts +0 -3
- package/components/DataGrid/hooks/useDataGrid.d.ts +2 -1
- package/components/DataGrid/icons.d.ts +15 -0
- package/components/DataGrid/icons.js +18 -0
- package/components/DataGrid/index.d.ts +5 -1
- package/components/DataGrid/index.js +5 -10
- package/components/DataGrid/slots/DataGridEnum.d.ts +30 -0
- package/components/DataGrid/slots/DataGridEnum.js +44 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +48 -0
- package/components/DataGrid/slots/DataGridSlot.js +97 -0
- package/components/DataGrid/styles.d.ts +2 -1
- package/components/DataGrid/styles.js +479 -12
- package/components/DataGrid/subcomponents/Actions/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/index.js +7 -7
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.js +13 -12
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.js +5 -6
- package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.js +14 -13
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/index.js +7 -6
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.js +2 -4
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +28 -27
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +11 -11
- package/components/DataGrid/subcomponents/Actions/types.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +5 -4
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +12 -43
- package/components/DataGrid/subcomponents/Table/subcomponents/SelectColumn.js +2 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/index.js +2 -4
- package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +0 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +3 -28
- package/components/DataGrid/types.d.ts +6 -0
- package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +10 -4
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.js +1 -1
- package/components/gclick/MyDevice/MyDevice.js +1 -1
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +0 -1
- package/components/hook-form/RHFSelect/RHFSelect.d.ts +1 -1
- package/components/hook-form/RHFSelect/RHFSelect.js +21 -3
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFSelect/types.d.ts +1 -1
- package/components/mui_extended/Select/Select.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +195 -145
- package/components/mui_extended/Select/Select.styles.js +69 -81
- package/components/mui_extended/Select/constants.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectEnum.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectEnum.js +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +19 -11
- package/components/mui_extended/Select/slots/SelectSlots.js +7 -7
- package/components/mui_extended/Select/tests/Select.test.d.ts +1 -0
- package/components/mui_extended/Select/types.d.ts +26 -16
- package/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/components/DataGrid/classes/constants.d.ts +0 -1
- package/components/DataGrid/classes/constants.js +0 -4
- package/components/DataGrid/classes/index.d.ts +0 -33
- package/components/DataGrid/classes/index.js +0 -71
- package/components/DataGrid/classes/types.d.ts +0 -30
- package/components/DataGrid/formatters/ColumnDateFormatter/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Actions/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/types.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/types.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +0 -7
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.js +0 -50
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.js +0 -10
- package/storybook/components/Label/Label.stories.d.ts +0 -16
- package/storybook/components/formatters/CourseFormatter/CourseFormatter.stories.d.ts +0 -25
- package/storybook/components/formatters/CourseFormatter/constants.d.ts +0 -3
- package/storybook/components/formatters/CourseFormatter/types.d.ts +0 -3
- /package/components/DataGrid/subcomponents/Actions/subcomponents/{Settings/types.d.ts → types.d.ts} +0 -0
- /package/components/{mui_extended/Select/test/Select.test.d.ts → DataGrid/tests/DataGrid.test.d.ts} +0 -0
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEnvironment, useModuleSkeleton, useModuleDictionary
|
|
2
|
+
import { useEnvironment, useModuleSkeleton, useModuleDictionary } from "@m4l/core";
|
|
3
3
|
import { useTheme } from "@mui/material";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { forwardRef,
|
|
6
|
-
import { A as ArrowDownStyled,
|
|
5
|
+
import { forwardRef, useMemo, useState, useCallback } from "react";
|
|
6
|
+
import { A as ArrowDownStyled, a as AdormentStyled, S as SelectRootStyled, b as SkeletonSelectStyled, M as MenuItemListStyled, c as MenuItemNoOptionStyled, L as LabelPlaceholerStyled, R as RenderValueContainerStyled, d as RenderValueTypography } from "./slots/SelectSlots.js";
|
|
7
7
|
import { S as SELECT_CLASSES, a as SELECT_KEY_COMPONENT, I as ICON_ARROW_DOWN } from "./constants.js";
|
|
8
8
|
import { S as SELECT_DICTIONARY } from "./dictionary.js";
|
|
9
9
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
10
10
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
|
+
import { C as Chip } from "../../Chip/Chip.js";
|
|
11
12
|
import { S as SelectSlots } from "./slots/SelectEnum.js";
|
|
12
|
-
const Select = forwardRef(
|
|
13
|
-
|
|
14
|
-
value,
|
|
13
|
+
const Select = forwardRef(
|
|
14
|
+
function Select2({
|
|
15
|
+
value = null,
|
|
15
16
|
options = [],
|
|
17
|
+
multiple,
|
|
16
18
|
onChange,
|
|
17
19
|
size = "medium",
|
|
18
20
|
disabled = false,
|
|
@@ -21,155 +23,203 @@ const Select = forwardRef((props, ref) => {
|
|
|
21
23
|
placeholder,
|
|
22
24
|
className,
|
|
23
25
|
dataTestId,
|
|
24
|
-
id,
|
|
25
26
|
...otherProps
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}, [value, selectedValue]);
|
|
40
|
-
const paletteColor = getPropertyByString(
|
|
41
|
-
theme.vars.palette,
|
|
42
|
-
disabled ? "default" : error ? "error" : "primary",
|
|
43
|
-
theme.vars.palette.default
|
|
44
|
-
);
|
|
45
|
-
const ownerState = useMemo(() => ({
|
|
46
|
-
size: adjustedSize,
|
|
47
|
-
disabled,
|
|
48
|
-
error,
|
|
49
|
-
variant,
|
|
50
|
-
paletteColor
|
|
51
|
-
}), [adjustedSize, disabled, error, variant, paletteColor]);
|
|
52
|
-
const handleLocalChange = (event) => {
|
|
53
|
-
const newValue = event.target.value;
|
|
54
|
-
setSelectedValue(newValue);
|
|
55
|
-
setOpen(false);
|
|
56
|
-
const selectedOption = options.find((option) => String(option.id) === String(newValue));
|
|
57
|
-
if (selectedOption && onChange) {
|
|
58
|
-
onChange(selectedOption);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const arrowDropDownIcon = `${host_static_assets}/${environment_assets}/${ICON_ARROW_DOWN}`;
|
|
62
|
-
const ArrowIcon = useMemo(() => {
|
|
63
|
-
return () => /* @__PURE__ */ jsx(
|
|
64
|
-
ArrowDownStyled,
|
|
65
|
-
{
|
|
66
|
-
ownerState: { ...ownerState },
|
|
67
|
-
icon: arrowDropDownIcon,
|
|
68
|
-
disabled,
|
|
69
|
-
size: adjustedSize,
|
|
70
|
-
onClick: () => {
|
|
71
|
-
!disabled && setOpen(!open);
|
|
72
|
-
},
|
|
73
|
-
rotationAngle: open ? 180 : 0
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}, [ownerState, arrowDropDownIcon, disabled, adjustedSize, open]);
|
|
77
|
-
const RenderIcon = (icon) => {
|
|
78
|
-
if (!icon) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
if (typeof icon !== "string") {
|
|
82
|
-
return icon;
|
|
83
|
-
} else {
|
|
84
|
-
return /* @__PURE__ */ jsx(
|
|
85
|
-
AdormentStyled,
|
|
86
|
-
{
|
|
87
|
-
ownerState: {},
|
|
88
|
-
src: icon,
|
|
89
|
-
size: adjustedSize,
|
|
90
|
-
className: SELECT_CLASSES.renderValueStartAdorment,
|
|
91
|
-
disabled
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const renderValue = () => {
|
|
97
|
-
if (!Boolean(selectedValue)) {
|
|
98
|
-
return /* @__PURE__ */ jsx(LabelPlaceholerStyled, { variant: "body", color: "text.disabled", ownerState: {}, children: placeholder });
|
|
99
|
-
}
|
|
100
|
-
const selectedOption = options.find((option) => String(option.id) === String(selectedValue));
|
|
101
|
-
return selectedOption ? /* @__PURE__ */ jsxs(RenderValueContainerStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.renderValueContainer, children: [
|
|
102
|
-
selectedOption.startAdornment && RenderIcon(selectedOption.startAdornment),
|
|
103
|
-
/* @__PURE__ */ jsx(RenderValueTypography, { variant: "body", color: "text.primary", ownerState: {}, size: adjustedSize, className: SELECT_CLASSES.renderValueTypography, children: selectedOption.label })
|
|
104
|
-
] }) : "";
|
|
105
|
-
};
|
|
106
|
-
if (isSkeleton) {
|
|
107
|
-
return /* @__PURE__ */ jsx(SkeletonSelectStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.skeletonSelect });
|
|
108
|
-
}
|
|
109
|
-
return /* @__PURE__ */ jsx(
|
|
110
|
-
SelectRootStyled,
|
|
111
|
-
{
|
|
112
|
-
...otherProps,
|
|
113
|
-
...getPropDataTestId(SELECT_KEY_COMPONENT, SelectSlots.root, dataTestId),
|
|
114
|
-
id,
|
|
115
|
-
ref,
|
|
116
|
-
className: clsx(SELECT_CLASSES.root, SELECT_CLASSES[variant], className),
|
|
117
|
-
ownerState: { ...ownerState },
|
|
118
|
-
IconComponent: ArrowIcon,
|
|
119
|
-
value: selectedValue,
|
|
120
|
-
onChange: handleLocalChange,
|
|
121
|
-
fullWidth: true,
|
|
27
|
+
}, ref) {
|
|
28
|
+
const { currentSize } = useComponentSize(size);
|
|
29
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
30
|
+
const isSkeleton = useModuleSkeleton();
|
|
31
|
+
const { getLabel } = useModuleDictionary();
|
|
32
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
33
|
+
const arrowDropDownIcon = `${host_static_assets}/${environment_assets}/${ICON_ARROW_DOWN}`;
|
|
34
|
+
const selectedValue = useMemo(() => value, [value]);
|
|
35
|
+
const [open, setOpen] = useState(false);
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const ownerState = useMemo(() => ({
|
|
38
|
+
size: adjustedSize,
|
|
122
39
|
disabled,
|
|
123
40
|
error,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
paddingBottom: theme.vars.size.baseSpacings.sp3,
|
|
136
|
-
paddingLeft: 0,
|
|
137
|
-
paddingRight: 0,
|
|
138
|
-
"& .MuiList-root": {
|
|
139
|
-
padding: 0,
|
|
140
|
-
display: "flex",
|
|
141
|
-
flexDirection: "column",
|
|
142
|
-
gap: theme.vars.size.baseSpacings.sp1
|
|
143
|
-
}
|
|
144
|
-
}
|
|
41
|
+
variant
|
|
42
|
+
}), [adjustedSize, disabled, error, variant]);
|
|
43
|
+
const handleLocalChange = useCallback((event) => {
|
|
44
|
+
const newValue = event.target.value;
|
|
45
|
+
if (!onChange) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (multiple) {
|
|
49
|
+
const selectedOptions = options.filter((option) => newValue.includes(option.id));
|
|
50
|
+
if (selectedOptions.length > 0) {
|
|
51
|
+
onChange(selectedOptions);
|
|
145
52
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
53
|
+
} else {
|
|
54
|
+
const selectedOption = options.find((option) => option.id === newValue);
|
|
55
|
+
if (selectedOption) {
|
|
56
|
+
onChange(selectedOption);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [multiple, onChange, options]);
|
|
60
|
+
const handleDelete = useCallback((optionToDelete) => {
|
|
61
|
+
if (multiple && Array.isArray(selectedValue)) {
|
|
62
|
+
const newSelectedOptions = options.filter((option) => option.id !== optionToDelete.id && selectedValue.includes(option.id));
|
|
63
|
+
onChange?.(newSelectedOptions);
|
|
64
|
+
}
|
|
65
|
+
}, [multiple, selectedValue, onChange, options]);
|
|
66
|
+
const ArrowIcon = useMemo(() => {
|
|
67
|
+
return () => /* @__PURE__ */ jsx(
|
|
68
|
+
ArrowDownStyled,
|
|
149
69
|
{
|
|
150
|
-
className: SELECT_CLASSES.menuItemList,
|
|
151
70
|
ownerState: { ...ownerState },
|
|
152
|
-
|
|
153
|
-
value: String(option.id),
|
|
71
|
+
icon: arrowDropDownIcon,
|
|
154
72
|
disabled,
|
|
155
|
-
label: option.label,
|
|
156
|
-
selected: selectedValue === option.id,
|
|
157
|
-
startIcon: RenderIcon(option.startAdornment)
|
|
158
|
-
},
|
|
159
|
-
String(option.id)
|
|
160
|
-
)) : /* @__PURE__ */ jsx(
|
|
161
|
-
MenuItemNoOptionStyled,
|
|
162
|
-
{
|
|
163
|
-
ownerState: { ...ownerState },
|
|
164
|
-
className: SELECT_CLASSES.menuItemNoOptions,
|
|
165
73
|
size: adjustedSize,
|
|
166
|
-
|
|
167
|
-
|
|
74
|
+
onClick: () => {
|
|
75
|
+
!disabled && setOpen(!open);
|
|
76
|
+
},
|
|
77
|
+
rotationAngle: open ? 180 : 0
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}, [ownerState, arrowDropDownIcon, disabled, adjustedSize, open]);
|
|
81
|
+
const RenderIcon = useCallback((icon) => {
|
|
82
|
+
if (!icon) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (typeof icon !== "string") {
|
|
86
|
+
return icon;
|
|
87
|
+
} else {
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
AdormentStyled,
|
|
90
|
+
{
|
|
91
|
+
ownerState: {},
|
|
92
|
+
src: icon,
|
|
93
|
+
size: adjustedSize,
|
|
94
|
+
className: SELECT_CLASSES.renderValueStartAdorment,
|
|
95
|
+
disabled
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}, [disabled, adjustedSize]);
|
|
100
|
+
const onMouseDownIconButtonChip = useCallback((e) => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
}, []);
|
|
103
|
+
const onKeyDownIconButtonChip = useCallback((e) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
}, []);
|
|
106
|
+
const renderValue = () => {
|
|
107
|
+
if (!selectedValue || multiple && Array.isArray(selectedValue) && selectedValue.length === 0) {
|
|
108
|
+
return /* @__PURE__ */ jsx(LabelPlaceholerStyled, { variant: "body", color: "text.disabled", ownerState: {}, children: placeholder });
|
|
109
|
+
}
|
|
110
|
+
if (multiple) {
|
|
111
|
+
if (!Array.isArray(selectedValue)) {
|
|
112
|
+
return null;
|
|
168
113
|
}
|
|
169
|
-
|
|
114
|
+
const selectedOptions = selectedValue.map((optionId) => options.find((opt) => opt.id === optionId));
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
RenderValueContainerStyled,
|
|
117
|
+
{
|
|
118
|
+
ownerState: { ...ownerState },
|
|
119
|
+
className: SELECT_CLASSES.renderValueContainer,
|
|
120
|
+
children: selectedOptions.map((option) => option ? /* @__PURE__ */ jsx(
|
|
121
|
+
Chip,
|
|
122
|
+
{
|
|
123
|
+
size: adjustedSize,
|
|
124
|
+
label: option.label,
|
|
125
|
+
startIcon: option.startAdornment,
|
|
126
|
+
opacity: true,
|
|
127
|
+
onDeleted: () => handleDelete(option),
|
|
128
|
+
iconButtonProps: { onMouseDown: onMouseDownIconButtonChip, onKeyDown: onKeyDownIconButtonChip }
|
|
129
|
+
},
|
|
130
|
+
option.id
|
|
131
|
+
) : null)
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
} else {
|
|
135
|
+
const selectedOption = options.find((option) => String(option.id) === String(selectedValue));
|
|
136
|
+
return selectedOption ? /* @__PURE__ */ jsxs(RenderValueContainerStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.renderValueContainer, children: [
|
|
137
|
+
selectedOption.startAdornment && RenderIcon(selectedOption.startAdornment),
|
|
138
|
+
/* @__PURE__ */ jsx(RenderValueTypography, { variant: "body", color: "text.primary", ownerState: {}, size: adjustedSize, className: SELECT_CLASSES.renderValueTypography, children: selectedOption.label })
|
|
139
|
+
] }) : "";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const onOpen = useCallback(() => {
|
|
143
|
+
setOpen(true);
|
|
144
|
+
}, []);
|
|
145
|
+
const onClose = useCallback(() => {
|
|
146
|
+
setOpen(false);
|
|
147
|
+
}, []);
|
|
148
|
+
const StyledSelect = useMemo(() => SelectRootStyled(), []);
|
|
149
|
+
if (isSkeleton) {
|
|
150
|
+
return /* @__PURE__ */ jsx(SkeletonSelectStyled, { ownerState: { ...ownerState }, className: SELECT_CLASSES.skeletonSelect });
|
|
170
151
|
}
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
StyledSelect,
|
|
154
|
+
{
|
|
155
|
+
...otherProps,
|
|
156
|
+
...getPropDataTestId(SELECT_KEY_COMPONENT, SelectSlots.root, dataTestId),
|
|
157
|
+
ref,
|
|
158
|
+
className: clsx(SELECT_CLASSES.root, SELECT_CLASSES[variant], className),
|
|
159
|
+
ownerState: { ...ownerState },
|
|
160
|
+
IconComponent: ArrowIcon,
|
|
161
|
+
multiple,
|
|
162
|
+
value: selectedValue ?? (multiple ? [] : ""),
|
|
163
|
+
onChange: handleLocalChange,
|
|
164
|
+
fullWidth: true,
|
|
165
|
+
disabled,
|
|
166
|
+
error,
|
|
167
|
+
renderValue,
|
|
168
|
+
open,
|
|
169
|
+
native: false,
|
|
170
|
+
onOpen,
|
|
171
|
+
onClose,
|
|
172
|
+
displayEmpty: true,
|
|
173
|
+
MenuProps: {
|
|
174
|
+
sx: {
|
|
175
|
+
"& .MuiPaper-root": {
|
|
176
|
+
paddingTop: theme.vars.size.baseSpacings.sp3,
|
|
177
|
+
paddingBottom: theme.vars.size.baseSpacings.sp3,
|
|
178
|
+
paddingLeft: 0,
|
|
179
|
+
paddingRight: 0,
|
|
180
|
+
"& .MuiList-root": {
|
|
181
|
+
padding: 0,
|
|
182
|
+
display: "flex",
|
|
183
|
+
flexDirection: "column",
|
|
184
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
children: options.length > 0 ? options.map(
|
|
190
|
+
(option) => {
|
|
191
|
+
const isSelected = multiple ? Array.isArray(selectedValue) && selectedValue.some((opt) => {
|
|
192
|
+
return opt === option.id;
|
|
193
|
+
}) : selectedValue === option.id;
|
|
194
|
+
return /* @__PURE__ */ jsx(
|
|
195
|
+
MenuItemListStyled,
|
|
196
|
+
{
|
|
197
|
+
className: SELECT_CLASSES.menuItemList,
|
|
198
|
+
ownerState: { ...ownerState },
|
|
199
|
+
size: adjustedSize,
|
|
200
|
+
value: option.id,
|
|
201
|
+
disabled,
|
|
202
|
+
selected: isSelected,
|
|
203
|
+
label: option.label,
|
|
204
|
+
startIcon: RenderIcon(option.startAdornment)
|
|
205
|
+
},
|
|
206
|
+
String(option.id)
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
) : /* @__PURE__ */ jsx(
|
|
210
|
+
MenuItemNoOptionStyled,
|
|
211
|
+
{
|
|
212
|
+
ownerState: { ...ownerState },
|
|
213
|
+
className: SELECT_CLASSES.menuItemNoOptions,
|
|
214
|
+
size: adjustedSize,
|
|
215
|
+
label: getLabel(SELECT_DICTIONARY.noOptions),
|
|
216
|
+
disabled: true
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
);
|
|
173
223
|
export {
|
|
174
224
|
Select as S
|
|
175
225
|
};
|
|
@@ -1,39 +1,66 @@
|
|
|
1
1
|
import { S as SELECT_CLASSES } from "./constants.js";
|
|
2
|
-
import { a as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
|
+
import { g as getHeightSizeStyles, a as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const selectStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Estilos para el componente Select
|
|
6
6
|
*/
|
|
7
|
-
root: ({ theme, ownerState }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
7
|
+
root: ({ theme, ownerState }) => {
|
|
8
|
+
const color = ownerState.disabled ? "default" : ownerState.error ? "error" : "primary";
|
|
9
|
+
return {
|
|
10
|
+
[`&.${SELECT_CLASSES.root}`]: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
13
|
+
border: theme.vars.size.borderStroke.actionInput,
|
|
14
|
+
borderColor: ownerState.error ? theme.vars.palette[color].enabled : theme.vars.palette.border.default,
|
|
15
|
+
padding: 0,
|
|
16
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
17
|
+
all: "unset",
|
|
18
|
+
display: "none"
|
|
19
|
+
},
|
|
20
|
+
'&:has(.MuiSelect-select[aria-expanded="true"])': {
|
|
21
|
+
border: `1px solid ${theme.vars.palette[color].focus}`
|
|
22
|
+
},
|
|
23
|
+
"& .M4LImage-root": {
|
|
24
|
+
...getHeightSizeStyles(
|
|
25
|
+
theme.generalSettings.isMobile,
|
|
26
|
+
ownerState.size || "medium",
|
|
27
|
+
"base",
|
|
28
|
+
(val) => {
|
|
29
|
+
return {
|
|
30
|
+
height: val,
|
|
31
|
+
width: val
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
},
|
|
36
|
+
"& .MuiSelect-select": {
|
|
37
|
+
padding: `${theme.vars.size.baseSpacings.sp1}!important`,
|
|
38
|
+
minHeight: "unset"
|
|
39
|
+
},
|
|
40
|
+
// Estilos para la variante text
|
|
41
|
+
[`&.${SELECT_CLASSES.text}`]: {
|
|
42
|
+
borderTop: 0,
|
|
43
|
+
borderRight: 0,
|
|
44
|
+
borderBottom: theme.vars.size.borderStroke.actionInput,
|
|
45
|
+
borderLeft: 0,
|
|
46
|
+
borderColor: ownerState.error ? theme.vars.palette[color].enabled : theme.vars.palette.border.default
|
|
47
|
+
},
|
|
48
|
+
"&:hover": {
|
|
49
|
+
backgroundColor: ownerState.disabled ? "unset" : theme.vars.palette[color].hoverOpacity
|
|
50
|
+
},
|
|
51
|
+
"&:focus-within": {
|
|
52
|
+
borderColor: theme.vars.palette[color].focus
|
|
53
|
+
},
|
|
54
|
+
'&[aria-hidden="true"]': {
|
|
55
|
+
pointerEvents: "none"
|
|
56
|
+
},
|
|
57
|
+
...ownerState.error && {
|
|
58
|
+
borderColor: theme.vars.palette[color].enabled,
|
|
59
|
+
"&:hover": {
|
|
60
|
+
borderColor: theme.vars.palette[color].hover,
|
|
61
|
+
backgroundColor: theme.vars.palette[color].hoverOpacity
|
|
33
62
|
}
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
"& .MuiButtonBase-root": {
|
|
63
|
+
},
|
|
37
64
|
// Tamaño del componente
|
|
38
65
|
...getSizeStyles(
|
|
39
66
|
theme,
|
|
@@ -42,57 +69,14 @@ const selectStyles = {
|
|
|
42
69
|
"action",
|
|
43
70
|
(height) => {
|
|
44
71
|
return {
|
|
45
|
-
|
|
72
|
+
minHeight: height,
|
|
73
|
+
height: "unset"
|
|
46
74
|
};
|
|
47
75
|
}
|
|
48
76
|
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
minHeight: "unset"
|
|
53
|
-
},
|
|
54
|
-
// Estilos para la variante text
|
|
55
|
-
[`&.${SELECT_CLASSES.text}`]: {
|
|
56
|
-
borderTop: 0,
|
|
57
|
-
borderRight: 0,
|
|
58
|
-
borderBottom: theme.vars.size.borderStroke.actionInput,
|
|
59
|
-
borderLeft: 0,
|
|
60
|
-
borderColor: ownerState.error ? ownerState.paletteColor?.enabled : theme.vars.palette.border.default
|
|
61
|
-
},
|
|
62
|
-
"&:hover": {
|
|
63
|
-
backgroundColor: ownerState.disabled ? "unset" : ownerState.paletteColor?.hoverOpacity
|
|
64
|
-
},
|
|
65
|
-
"&:focus-within": {
|
|
66
|
-
borderColor: ownerState.paletteColor?.focus
|
|
67
|
-
},
|
|
68
|
-
'&[aria-hidden="true"]': {
|
|
69
|
-
pointerEvents: "none"
|
|
70
|
-
},
|
|
71
|
-
"&[inert]": {
|
|
72
|
-
pointerEvents: "none",
|
|
73
|
-
opacity: 0.5
|
|
74
|
-
},
|
|
75
|
-
...ownerState.error && {
|
|
76
|
-
borderColor: ownerState.paletteColor?.enabled,
|
|
77
|
-
"&:hover": {
|
|
78
|
-
borderColor: ownerState.paletteColor?.hover,
|
|
79
|
-
backgroundColor: ownerState.paletteColor?.hoverOpacity
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
// Tamaño del componente
|
|
83
|
-
...getSizeStyles(
|
|
84
|
-
theme,
|
|
85
|
-
theme.generalSettings.isMobile,
|
|
86
|
-
ownerState.size || "medium",
|
|
87
|
-
"action",
|
|
88
|
-
(height) => {
|
|
89
|
-
return {
|
|
90
|
-
minHeight: height
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
}),
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
},
|
|
96
80
|
/**
|
|
97
81
|
* Estilos para el ícono de la fila
|
|
98
82
|
*/
|
|
@@ -104,12 +88,15 @@ const selectStyles = {
|
|
|
104
88
|
renderValueContainer: ({ theme }) => ({
|
|
105
89
|
display: "flex",
|
|
106
90
|
alignItems: "center",
|
|
107
|
-
gap: theme.vars.size.baseSpacings.sp1
|
|
91
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
92
|
+
flexWrap: "wrap"
|
|
108
93
|
}),
|
|
109
94
|
arrowDown: {},
|
|
110
95
|
renderValueTypography: () => ({
|
|
111
96
|
lineHeight: "inherit!important"
|
|
112
97
|
}),
|
|
98
|
+
// chip: () => ({
|
|
99
|
+
// }),
|
|
113
100
|
/**
|
|
114
101
|
* Styles for the label option
|
|
115
102
|
*/
|
|
@@ -122,14 +109,15 @@ const selectStyles = {
|
|
|
122
109
|
* @returns {object} The styles for the label placeholder
|
|
123
110
|
*/
|
|
124
111
|
labelPlaceholer: ({ theme }) => ({
|
|
125
|
-
paddingLeft: theme.vars.size.baseSpacings.sp1
|
|
112
|
+
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
113
|
+
paddingRight: theme.vars.size.baseSpacings.sp3
|
|
126
114
|
}),
|
|
127
115
|
/**
|
|
128
116
|
* Styles for the menu item select
|
|
129
117
|
* @param {object} theme - The theme object
|
|
130
118
|
* @returns {object} The styles for the menu item select
|
|
131
119
|
*/
|
|
132
|
-
|
|
120
|
+
menuItem: {},
|
|
133
121
|
/**
|
|
134
122
|
* Estilos del menuItem que no tiene opciones
|
|
135
123
|
* @param {object} theme - The theme object
|
|
@@ -16,7 +16,7 @@ export declare const COMBINATED_TEXTFIELD_ENUMS: {
|
|
|
16
16
|
text: SelectComplementaryClasses.text;
|
|
17
17
|
root: SelectSlots.root;
|
|
18
18
|
adorment: SelectSlots.adorment;
|
|
19
|
-
|
|
19
|
+
menuItem: SelectSlots.menuItem;
|
|
20
20
|
menuItemNoOptions: SelectSlots.menuItemNoOptions;
|
|
21
21
|
skeletonSelect: SelectSlots.skeletonSelect;
|
|
22
22
|
renderValueContainer: SelectSlots.renderValueContainer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var SelectSlots = /* @__PURE__ */ ((SelectSlots2) => {
|
|
2
2
|
SelectSlots2["root"] = "root";
|
|
3
3
|
SelectSlots2["adorment"] = "adorment";
|
|
4
|
-
SelectSlots2["
|
|
4
|
+
SelectSlots2["menuItem"] = "menuItem";
|
|
5
5
|
SelectSlots2["menuItemNoOptions"] = "menuItemNoOptions";
|
|
6
6
|
SelectSlots2["skeletonSelect"] = "skeletonMenuItem";
|
|
7
7
|
SelectSlots2["renderValueContainer"] = "renderValueContainer";
|