@m4l/components 9.3.28 → 9.3.30-JA.beta-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/components/Color/Color.js +32 -131
- package/components/Color/Color.styles.js +6 -124
- package/components/Color/slots/ColorEnum.d.ts +1 -3
- package/components/Color/slots/ColorEnum.js +1 -3
- package/components/Color/slots/ColorSlots.d.ts +3 -18
- package/components/Color/slots/ColorSlots.js +6 -19
- package/components/Color/types.d.ts +6 -7
- package/components/DataGrid/DataGrid.js +1 -1
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.js +19 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/types.d.ts +12 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/types.js +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.d.ts +14 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.js +22 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/tests/helpers/generators.d.ts +26 -0
- package/components/DataGrid/tests/helpers/types.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts +3 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +1 -7
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +1 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +1 -1
- package/components/DynamicSort/subcomponents/FieldTypes/FieldTypeInterface.d.ts +2 -3
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.d.ts +3 -2
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.js +3 -2
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
- package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +1 -7
- package/components/Icon/Icon.js +1 -1
- package/components/Image/Image.js +1 -1
- package/components/Image/subcomponents/IntersectComponent/index.js +1 -1
- package/components/ImageText/ImageText.js +1 -1
- package/components/LanguagePopover/LanguagePopover.js +1 -1
- package/components/LinearProgressIndeterminate/LinearProgressIndeterminate.js +1 -1
- package/components/LoadingError/LoadingError.js +1 -1
- package/components/NumberInput/NumberInput.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByM4L/ObjectLogsByM4L.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByOthers/ObjectLogsByOthers.js +1 -1
- package/components/PDFViewer/PDFViewer.js +1 -1
- package/components/PrintingSystem/PrintingSystem.js +1 -1
- package/components/PropertyValue/PropertyValue.js +1 -1
- package/components/ToastContainer/ToastContainer.js +1 -1
- package/components/WindowBase/WindowBase.js +1 -1
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/AreaChip.js +4 -3
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +4 -3
- package/components/areas/components/AreasViewer/AreasViewer.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -1
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/commercial/TopBar/TopBar.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/index.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +1 -1
- package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.js +1 -1
- package/components/extended/React-resizable-panels/SplitLayout.js +1 -1
- package/components/formatters/BooleanFormatter/BooleanFormatter.js +1 -1
- package/components/formatters/ColorFormatter/ColorFormatter.d.ts +18 -0
- package/components/formatters/ColorFormatter/ColorFormatter.js +35 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.d.ts +2 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.js +15 -0
- package/components/formatters/ColorFormatter/constants.d.ts +1 -0
- package/components/formatters/ColorFormatter/constants.js +4 -0
- package/components/formatters/ColorFormatter/index.d.ts +3 -0
- package/components/formatters/ColorFormatter/index.js +1 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.d.ts +3 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.js +7 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.d.ts +4 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.js +11 -0
- package/components/formatters/ColorFormatter/types.d.ts +24 -0
- package/components/formatters/ColorFormatter/types.js +1 -0
- package/components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js +1 -1
- package/components/formatters/DateFormatter/DateFormatter.js +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +1 -1
- package/components/formatters/PeriodFormatter/PeriodFormatter.js +1 -1
- package/components/formatters/PointsFormatter/PointsFormatter.js +1 -1
- package/components/formatters/PriceFormatter/PriceFormatter.js +1 -1
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.js +1 -1
- package/components/formatters/index.d.ts +1 -0
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +28 -36
- package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +156 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/types.d.ts +9 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +41 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.js +50 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +4 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +3 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +21 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +19 -1
- package/components/hook-form/RHFColorPicker/slots/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.d.ts +33 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.js +147 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.d.ts +20 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.js +1 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.js +1 -1
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +1 -1
- package/components/hook-form/RHFPeriod/RHFPeriod.js +1 -1
- package/components/hook-form/RHFSelect/RHFSelect.js +1 -1
- package/components/hook-form/RHFTextField/RHFTextField.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +1 -1
- package/components/hook-form/RHFormProvider/RHFormProvider.d.ts +31 -0
- package/components/hook-form/RHFormProvider/RHFormProvider.js +93 -0
- package/components/hook-form/RHFormProvider/index.d.ts +4 -0
- package/components/hook-form/RHFormProvider/index.js +1 -0
- package/components/hook-form/RHFormProvider/schema.d.ts +17 -0
- package/components/hook-form/RHFormProvider/schema.js +29 -0
- package/components/hook-form/RHFormProvider/types.d.ts +129 -0
- package/components/hook-form/RHFormProvider/types.js +8 -0
- package/components/hook-form/index.d.ts +1 -0
- package/components/mui_extended/Accordion/Accordion.js +1 -1
- package/components/mui_extended/Avatar/Avatar.js +1 -1
- package/components/mui_extended/Avatar/subcomponents/SkeletonAvatar/index.js +1 -1
- package/components/mui_extended/Badge/Badge.js +1 -1
- package/components/mui_extended/CircularProgress/CircularProgress.js +1 -1
- package/components/mui_extended/DateTimePicker/DateTimePicker.js +1 -1
- package/components/mui_extended/Dialog/Dialog.js +1 -1
- package/components/mui_extended/ImageButton/ImageButton.js +1 -1
- package/components/mui_extended/MenuDivider/MenuDivider.js +1 -1
- package/components/mui_extended/NavLink/NavLink.js +1 -1
- package/components/mui_extended/Popover/Popover.js +1 -1
- package/components/mui_extended/Select/Select.js +1 -1
- package/components/mui_extended/Stack/Stack.js +1 -1
- package/components/mui_extended/TextField/TextField.js +1 -1
- package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +1 -1
- package/components/mui_extended/Typography/Typography.js +1 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +1 -1
- package/contexts/index.d.ts +3 -3
- package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +3 -3
- package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js +3 -3
- package/helpers/getStepsAndValidationSchema/types.d.ts +5 -4
- package/hooks/index.d.ts +1 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +1 -1
- package/hooks/useFormAddEdit/index.d.ts +1 -1
- package/hooks/useWatchTyped/index.d.ts +1 -0
- package/hooks/useWatchTyped/index.js +1 -0
- package/hooks/useWatchTyped/types.d.ts +11 -0
- package/hooks/useWatchTyped/useTypedWatch.d.ts +9 -0
- package/hooks/useWatchTyped/useTypedWatch.js +30 -0
- package/index.js +94 -77
- package/package.json +2 -2
- package/test/getNameDataTestId.js +2 -2
- package/components/hook-form/RHFormContext/index.d.ts +0 -120
- package/components/hook-form/RHFormContext/index.js +0 -91
- package/components/hook-form/RHFormContext/types.d.ts +0 -83
- package/hooks/useFormReadyForUpdate/types.d.ts +0 -8
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/types.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/index.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/skeleton.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/styles.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/types.d.ts +0 -0
|
@@ -8,6 +8,162 @@ const rhfcolorPickerStyles = {
|
|
|
8
8
|
flexDirection: "column",
|
|
9
9
|
gap: theme.vars.size.baseSpacings["sp0-5"],
|
|
10
10
|
width: "100%"
|
|
11
|
+
}),
|
|
12
|
+
/**
|
|
13
|
+
* Estilos para el IconButton que abre el color picker
|
|
14
|
+
*/
|
|
15
|
+
iconButton: ({ theme, ownerState }) => ({
|
|
16
|
+
// Estructura y layout básico
|
|
17
|
+
display: "flex",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
width: "fit-content",
|
|
20
|
+
height: "fit-content",
|
|
21
|
+
cursor: ownerState?.disabled ? "not-allowed" : "pointer",
|
|
22
|
+
color: theme.vars.palette.text.primary,
|
|
23
|
+
pointerEvents: ownerState?.disabled ? "none" : "auto",
|
|
24
|
+
// Espaciado
|
|
25
|
+
padding: 0,
|
|
26
|
+
// Radio de borde
|
|
27
|
+
borderRadius: theme.size.borderRadius.r1,
|
|
28
|
+
border: ownerState?.error ? `1px solid ${theme.vars.palette.error.enabled}` : void 0,
|
|
29
|
+
// Pseudoclases
|
|
30
|
+
"&:hover": {
|
|
31
|
+
background: ownerState?.error ? theme.vars.palette.error.hoverOpacity : theme.vars.palette.default.hoverOpacity
|
|
32
|
+
},
|
|
33
|
+
"&:active": {
|
|
34
|
+
background: ownerState?.error ? theme.vars.palette.error.activeOpacity : theme.vars.palette.default.activeOpacity
|
|
35
|
+
},
|
|
36
|
+
"&:focus-visible": {
|
|
37
|
+
outline: `1px solid ${theme.vars.palette.primary.focusVisible}`,
|
|
38
|
+
outlineOffset: 2
|
|
39
|
+
},
|
|
40
|
+
// Sizes medium
|
|
41
|
+
...ownerState?.size === "medium" && {
|
|
42
|
+
...theme.generalSettings.isMobile ? {
|
|
43
|
+
width: theme.vars.size.mobile.medium.action,
|
|
44
|
+
height: theme.vars.size.mobile.medium.action
|
|
45
|
+
} : {
|
|
46
|
+
width: theme.vars.size.desktop.medium.action,
|
|
47
|
+
height: theme.vars.size.desktop.medium.action
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
// Sizes small
|
|
51
|
+
...ownerState?.size === "small" && {
|
|
52
|
+
...theme.generalSettings.isMobile ? {
|
|
53
|
+
width: theme.vars.size.mobile.small.action,
|
|
54
|
+
height: theme.vars.size.mobile.small.action
|
|
55
|
+
} : {
|
|
56
|
+
width: theme.vars.size.desktop.small.action,
|
|
57
|
+
height: theme.vars.size.desktop.small.action
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
/**
|
|
62
|
+
* Popover
|
|
63
|
+
*/
|
|
64
|
+
popover: ({ theme, ownerState }) => ({
|
|
65
|
+
"& .MuiPaper-root": {
|
|
66
|
+
padding: theme.vars.size.baseSpacings.sp3,
|
|
67
|
+
border: theme.vars.size.borderStroke.container,
|
|
68
|
+
borderColor: ownerState?.error ? theme.vars.palette.border.error : theme.vars.palette.border.secondary,
|
|
69
|
+
borderRadius: `${theme.vars.size.borderRadius.r3} !important`,
|
|
70
|
+
"& .MuiButtonBase-root": {
|
|
71
|
+
// Ajuste específico de estilo para el contenido de los botones
|
|
72
|
+
justifyContent: "center"
|
|
73
|
+
},
|
|
74
|
+
boxShadow: "0 8px 24px -10px rgba(95, 108, 125, 0.16), 0 20px 60px 0 rgba(109, 124, 146, 0.12)"
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
/**
|
|
78
|
+
* estilos en picker
|
|
79
|
+
*/
|
|
80
|
+
sketchPicker: ({ theme }) => ({
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "column",
|
|
83
|
+
gap: theme.vars.size.baseSpacings.sp3,
|
|
84
|
+
boxShadow: "none !important",
|
|
85
|
+
background: `${theme.vars.palette.background.default} !important`,
|
|
86
|
+
padding: "0px !important",
|
|
87
|
+
"& > div": {
|
|
88
|
+
// Caja de selección de color
|
|
89
|
+
"&:nth-of-type(1)": {
|
|
90
|
+
borderRadius: `${theme.vars.size.borderRadius.r2} !important`
|
|
91
|
+
},
|
|
92
|
+
// Caja de selección horizontal de color
|
|
93
|
+
"&:nth-of-type(2)": {
|
|
94
|
+
display: "flex !important",
|
|
95
|
+
justifyContent: "center !important",
|
|
96
|
+
alignItems: "center !important",
|
|
97
|
+
gap: theme.vars.size.baseSpacings.sp3,
|
|
98
|
+
"& > div:nth-of-type(1)": {
|
|
99
|
+
padding: "0px !important",
|
|
100
|
+
"& > div:nth-of-type(1)": {
|
|
101
|
+
height: `${theme.vars.size.baseSpacings.sp3}!important`,
|
|
102
|
+
borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
|
|
103
|
+
"& > div > div > div > div": {
|
|
104
|
+
height: "10px !important"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"& > div:nth-of-type(2)": {
|
|
109
|
+
margin: "0px !important",
|
|
110
|
+
borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
|
|
111
|
+
height: `${theme.vars.size.desktop.medium.base} !important`,
|
|
112
|
+
width: `${theme.vars.size.desktop.medium.base} !important`,
|
|
113
|
+
"& div": {
|
|
114
|
+
borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
|
|
115
|
+
boxShadow: "none !important"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
// Inputs para el cambio de color mediante a texto( hexadecimal o rgb )
|
|
120
|
+
"&:nth-of-type(3)": {
|
|
121
|
+
padding: "0px !important",
|
|
122
|
+
"& > div": {
|
|
123
|
+
// Estilos compartidos para las cajas de color
|
|
124
|
+
"&:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3), &:nth-of-type(4), &:nth-of-type(5)": {
|
|
125
|
+
padding: "0px !important",
|
|
126
|
+
"& div": {
|
|
127
|
+
display: "flex !important",
|
|
128
|
+
flexDirection: "column-reverse !important",
|
|
129
|
+
"& label": {
|
|
130
|
+
textAlign: "left !important",
|
|
131
|
+
color: `${theme.vars.palette.text.secondary} !important`,
|
|
132
|
+
textTransform: "uppercase !important",
|
|
133
|
+
padding: "0px !important"
|
|
134
|
+
},
|
|
135
|
+
"& input": {
|
|
136
|
+
outline: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
137
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
138
|
+
background: theme.vars.palette.background.default,
|
|
139
|
+
color: theme.vars.palette.text.primary,
|
|
140
|
+
boxShadow: "none !important",
|
|
141
|
+
"&:hover": {
|
|
142
|
+
background: theme.vars.palette.primary.hoverOpacity
|
|
143
|
+
},
|
|
144
|
+
"&:focus-visible": {
|
|
145
|
+
outlineColor: theme.vars.palette.primary.focusVisible
|
|
146
|
+
},
|
|
147
|
+
"&:active": {
|
|
148
|
+
outlineColor: theme.vars.palette.primary.active
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
//Colores en grid varios del componente de react-color
|
|
156
|
+
"&:nth-of-type(4)": {
|
|
157
|
+
paddingTop: "0px !important",
|
|
158
|
+
"& > div > span > div": {
|
|
159
|
+
borderRadius: `${theme.vars.size.borderRadius["r1-5"]} !important`,
|
|
160
|
+
borderColor: theme.vars.palette.border.secondary
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"& .flexbox-fix": {
|
|
165
|
+
border: "0px !important"
|
|
166
|
+
}
|
|
11
167
|
})
|
|
12
168
|
};
|
|
13
169
|
export {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ColorResult } from 'react-color';
|
|
2
|
+
import { UseColorPickerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook que gestiona la lógica del color picker
|
|
5
|
+
*
|
|
6
|
+
* Este hook encapsula toda la funcionalidad de selección de color, incluyendo:
|
|
7
|
+
* - Gestión del estado del popover (abrir/cerrar)
|
|
8
|
+
* - Confirmación o cancelación de cambios
|
|
9
|
+
* - Generación del ownerState para estilos
|
|
10
|
+
* @param {UseColorPickerProps} props - Propiedades del hook
|
|
11
|
+
* @param {string} props.value - Valor actual del color
|
|
12
|
+
* @param {function} props.onChange - Callback ejecutado al confirmar un color
|
|
13
|
+
* @param {boolean} [props.error] - Indica si hay error de validación
|
|
14
|
+
* @param {boolean} [props.disabled] - Indica si el picker está deshabilitado
|
|
15
|
+
* @param {boolean} [props.isSkeleton] - Indica si está en modo skeleton
|
|
16
|
+
* @param {('small'|'medium')} props.currentSize - Tamaño del componente
|
|
17
|
+
* @returns {object} Objeto con estados y handlers
|
|
18
|
+
* @returns {HTMLElement|null} anchorEl - Elemento ancla para el Popover
|
|
19
|
+
* @returns {string|undefined} tempColor - Color temporal antes de confirmar
|
|
20
|
+
* @returns {object} iconButtonOwnerState - Estado para estilos del botón
|
|
21
|
+
* @returns {function} handleOpenPicker - Handler para abrir el picker
|
|
22
|
+
* @returns {function} handleClosePicker - Handler para cerrar el picker
|
|
23
|
+
* @returns {function} handleColorChange - Handler para cambio de color
|
|
24
|
+
* @returns {function} handleConfirm - Handler para confirmar selección
|
|
25
|
+
* @returns {function} handleCancel - Handler para cancelar selección
|
|
26
|
+
*/
|
|
27
|
+
export declare const useColorPicker: (props: UseColorPickerProps) => {
|
|
28
|
+
anchorEl: HTMLElement | null;
|
|
29
|
+
tempColor: string | undefined;
|
|
30
|
+
iconButtonOwnerState: {
|
|
31
|
+
size: "small" | "medium";
|
|
32
|
+
disabled: boolean | undefined;
|
|
33
|
+
value: string;
|
|
34
|
+
error: boolean;
|
|
35
|
+
};
|
|
36
|
+
handleOpenPicker: (event: React.MouseEvent<HTMLElement>) => void;
|
|
37
|
+
handleClosePicker: () => void;
|
|
38
|
+
handleColorChange: (color: ColorResult) => void;
|
|
39
|
+
handleConfirm: () => void;
|
|
40
|
+
handleCancel: () => void;
|
|
41
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
const useColorPicker = (props) => {
|
|
3
|
+
const { value, onChange, error, disabled, isSkeleton, currentSize } = props;
|
|
4
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
5
|
+
const [tempColor, setTempColor] = useState(
|
|
6
|
+
value ?? void 0
|
|
7
|
+
);
|
|
8
|
+
const handleOpenPicker = (event) => {
|
|
9
|
+
setTempColor(value ?? void 0);
|
|
10
|
+
setAnchorEl(event.currentTarget);
|
|
11
|
+
};
|
|
12
|
+
const handleClosePicker = () => {
|
|
13
|
+
setAnchorEl(null);
|
|
14
|
+
};
|
|
15
|
+
const handleColorChange = (color) => {
|
|
16
|
+
setTempColor(color.hex);
|
|
17
|
+
};
|
|
18
|
+
const handleConfirm = () => {
|
|
19
|
+
if (tempColor !== value) {
|
|
20
|
+
onChange(tempColor ?? null);
|
|
21
|
+
setTempColor(tempColor);
|
|
22
|
+
}
|
|
23
|
+
handleClosePicker();
|
|
24
|
+
};
|
|
25
|
+
const handleCancel = () => {
|
|
26
|
+
handleClosePicker();
|
|
27
|
+
};
|
|
28
|
+
const iconButtonOwnerState = useMemo(
|
|
29
|
+
() => ({
|
|
30
|
+
size: currentSize,
|
|
31
|
+
disabled: isSkeleton || disabled,
|
|
32
|
+
value,
|
|
33
|
+
error: !!error
|
|
34
|
+
}),
|
|
35
|
+
[currentSize, isSkeleton, disabled, value, error]
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
anchorEl,
|
|
39
|
+
tempColor,
|
|
40
|
+
iconButtonOwnerState,
|
|
41
|
+
handleOpenPicker,
|
|
42
|
+
handleClosePicker,
|
|
43
|
+
handleColorChange,
|
|
44
|
+
handleConfirm,
|
|
45
|
+
handleCancel
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
useColorPicker as u
|
|
50
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
var RHFColorPickerSlots = /* @__PURE__ */ ((RHFColorPickerSlots2) => {
|
|
2
2
|
RHFColorPickerSlots2["root"] = "root";
|
|
3
|
+
RHFColorPickerSlots2["iconButton"] = "iconButton";
|
|
4
|
+
RHFColorPickerSlots2["popover"] = "popover";
|
|
5
|
+
RHFColorPickerSlots2["sketchPicker"] = "sketchPicker";
|
|
3
6
|
return RHFColorPickerSlots2;
|
|
4
7
|
})(RHFColorPickerSlots || {});
|
|
5
8
|
export {
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { SketchPicker } from 'react-color';
|
|
1
2
|
/**
|
|
2
3
|
* Componente que es un envoltorio `div` que representa el contenedor raíz del `RHFColorPicker`.
|
|
3
4
|
*/
|
|
4
5
|
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
|
|
5
6
|
ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
|
|
6
7
|
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
8
|
+
/**
|
|
9
|
+
* Componente estilizado de IconButton como el contenedor raíz del componente de color.
|
|
10
|
+
*/
|
|
11
|
+
export declare const IconButtonStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/IconButton/types').IconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>, "value" | "size" | "children" | "title" | "component" | "name" | "id" | "type" | "selected" | "disabled" | "action" | "hidden" | "color" | "content" | "style" | "icon" | "tooltip" | "variant" | "translate" | "className" | "classes" | "src" | "sx" | "form" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "instaceDataTestId" | "placement" | "rotationAngle" | "ariaLabel" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "badgeProps" | keyof import('react').RefAttributes<HTMLButtonElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
|
|
12
|
+
ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
|
|
13
|
+
}, {}, {}>;
|
|
14
|
+
/**
|
|
15
|
+
* Componente `Popover` de M4L.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PopoverStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Popover/types').PopoverProps, keyof import('../../../mui_extended/Popover/types').PopoverProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
|
|
18
|
+
ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
|
|
19
|
+
}, {}, {}>;
|
|
20
|
+
/**
|
|
21
|
+
* Componente `SketchPicker` que viene de la libreria de react color.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SketchPickerStyled: import('@emotion/styled').StyledComponent<Pick<import('react-color').SketchPickerProps, keyof import('react-color').SketchPickerProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
|
|
24
|
+
ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
|
|
25
|
+
}, {}, {
|
|
26
|
+
ref?: import('react').Ref<SketchPicker> | undefined;
|
|
27
|
+
}>;
|
|
@@ -2,10 +2,28 @@ import { styled } from "@mui/material";
|
|
|
2
2
|
import { R as RHFCOLOR_PICKER_KEY_COMPONENT } from "../constants.js";
|
|
3
3
|
import { r as rhfcolorPickerStyles } from "../RHFColorPicker.styles.js";
|
|
4
4
|
import { R as RHFColorPickerSlots } from "./RHFColorPickerEnum.js";
|
|
5
|
+
import { SketchPicker } from "react-color";
|
|
6
|
+
import { P as Popover } from "../../../mui_extended/Popover/Popover.js";
|
|
7
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
|
|
5
8
|
const RootStyled = styled("div", {
|
|
6
9
|
name: RHFCOLOR_PICKER_KEY_COMPONENT,
|
|
7
10
|
slot: RHFColorPickerSlots.root
|
|
8
11
|
})(rhfcolorPickerStyles?.root);
|
|
12
|
+
const IconButtonStyled = styled(IconButton, {
|
|
13
|
+
name: RHFCOLOR_PICKER_KEY_COMPONENT,
|
|
14
|
+
slot: RHFColorPickerSlots.iconButton
|
|
15
|
+
})(rhfcolorPickerStyles?.iconButton);
|
|
16
|
+
const PopoverStyled = styled(Popover, {
|
|
17
|
+
name: RHFCOLOR_PICKER_KEY_COMPONENT,
|
|
18
|
+
slot: RHFColorPickerSlots.popover
|
|
19
|
+
})(rhfcolorPickerStyles?.popover);
|
|
20
|
+
const SketchPickerStyled = styled(SketchPicker, {
|
|
21
|
+
name: RHFCOLOR_PICKER_KEY_COMPONENT,
|
|
22
|
+
slot: RHFColorPickerSlots.sketchPicker
|
|
23
|
+
})(rhfcolorPickerStyles?.sketchPicker);
|
|
9
24
|
export {
|
|
10
|
-
|
|
25
|
+
IconButtonStyled as I,
|
|
26
|
+
PopoverStyled as P,
|
|
27
|
+
RootStyled as R,
|
|
28
|
+
SketchPickerStyled as S
|
|
11
29
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ColorPickerFieldProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente de campo de selección de color con UI completa
|
|
4
|
+
*
|
|
5
|
+
* Este componente proporciona la interfaz de usuario para seleccionar colores, incluyendo:
|
|
6
|
+
* - Label opcional con información de campo obligatorio y mensajes de ayuda
|
|
7
|
+
* - IconButton que muestra el color actual y abre el picker
|
|
8
|
+
* - Popover con SketchPicker para selección visual de colores
|
|
9
|
+
* - Botones de acción (Cancelar/Aceptar) para confirmar o descartar cambios
|
|
10
|
+
* - Mensaje de error de validación
|
|
11
|
+
*
|
|
12
|
+
* Este componente es la capa de UI que utiliza:
|
|
13
|
+
* - El hook `useColorPicker` para manejar toda la lógica de estado y eventos
|
|
14
|
+
* - El componente `Color` para la vista previa del color seleccionado
|
|
15
|
+
* @param {ColorPickerFieldProps} props - Propiedades del componente
|
|
16
|
+
* @param {string} props.value - Valor actual del color (hexadecimal o nombre CSS)
|
|
17
|
+
* @param {function} props.onChange - Callback ejecutado al confirmar un nuevo color
|
|
18
|
+
* @param {object} [props.error] - Objeto de error con mensaje de validación
|
|
19
|
+
* @param {string} [props.error.message] - Mensaje de error a mostrar
|
|
20
|
+
* @param {('small'|'medium')} [props.size] - Tamaño del componente
|
|
21
|
+
* @param {string} [props.label] - Etiqueta del campo
|
|
22
|
+
* @param {boolean} [props.mandatory] - Indica si el campo es obligatorio
|
|
23
|
+
* @param {string} [props.mandatoryMessage] - Mensaje para campos obligatorios
|
|
24
|
+
* @param {string|boolean} [props.helperMessage] - Mensaje de ayuda
|
|
25
|
+
* @param {boolean} [props.disabled] - Indica si el campo está deshabilitado
|
|
26
|
+
* @param {boolean} [props.isSkeleton] - Indica si está en modo skeleton (carga)
|
|
27
|
+
* @param {string} [props.className] - Clases CSS adicionales
|
|
28
|
+
* @param {string} [props.instaceDataTestId] - ID para testing
|
|
29
|
+
* @param {('small'|'medium')} props.currentSize - Tamaño actual calculado
|
|
30
|
+
* @param {Record<string, string>} props.classes - Clases CSS del componente
|
|
31
|
+
* @returns {JSX.Element} Componente de campo de selección de color
|
|
32
|
+
*/
|
|
33
|
+
export declare const ColorPickerField: (props: ColorPickerFieldProps) => import("react/jsx-runtime").JSX.Element;
|
package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "@mui/material";
|
|
3
|
+
import { u as useColorPicker } from "../../hooks/useColorPicker/useColorPicker.js";
|
|
4
|
+
import { I as IconButtonStyled, P as PopoverStyled, S as SketchPickerStyled } from "../../slots/RHFColorPickerSlots.js";
|
|
5
|
+
import { R as RHFColorPickerSlots } from "../../slots/RHFColorPickerEnum.js";
|
|
6
|
+
import { R as RHFCOLOR_PICKER_KEY_COMPONENT } from "../../constants.js";
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
|
+
import { a as getPropDataTestId } from "../../../../../test/getNameDataTestId.js";
|
|
9
|
+
import { u as useComponentSize } from "../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
|
+
import { L as Label } from "../../../../Label/Label.js";
|
|
11
|
+
import { C as Color } from "../../../../Color/Color.js";
|
|
12
|
+
import { A as ActionsContainer } from "../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
13
|
+
import { H as HelperError } from "../../../../HelperError/HelperError.js";
|
|
14
|
+
import { A as ActionCancel } from "../../../../CommonActions/components/ActionCancel/ActionCancel.js";
|
|
15
|
+
import { A as ActionIntro } from "../../../../CommonActions/components/ActionIntro/ActionIntro.js";
|
|
16
|
+
const ColorPickerField = (props) => {
|
|
17
|
+
const {
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
error,
|
|
21
|
+
size,
|
|
22
|
+
label,
|
|
23
|
+
mandatory,
|
|
24
|
+
mandatoryMessage,
|
|
25
|
+
helperMessage,
|
|
26
|
+
disabled,
|
|
27
|
+
isSkeleton,
|
|
28
|
+
className,
|
|
29
|
+
instaceDataTestId,
|
|
30
|
+
classes
|
|
31
|
+
} = props;
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
const { currentSize } = useComponentSize(size);
|
|
34
|
+
const ownerState = {
|
|
35
|
+
size: currentSize
|
|
36
|
+
};
|
|
37
|
+
const {
|
|
38
|
+
anchorEl,
|
|
39
|
+
tempColor,
|
|
40
|
+
iconButtonOwnerState,
|
|
41
|
+
handleOpenPicker,
|
|
42
|
+
handleClosePicker,
|
|
43
|
+
handleColorChange,
|
|
44
|
+
handleConfirm,
|
|
45
|
+
handleCancel
|
|
46
|
+
} = useColorPicker({
|
|
47
|
+
value,
|
|
48
|
+
onChange,
|
|
49
|
+
error: !!error,
|
|
50
|
+
disabled,
|
|
51
|
+
isSkeleton,
|
|
52
|
+
currentSize
|
|
53
|
+
});
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
label && /* @__PURE__ */ jsx(
|
|
56
|
+
Label,
|
|
57
|
+
{
|
|
58
|
+
size,
|
|
59
|
+
label,
|
|
60
|
+
mandatory,
|
|
61
|
+
mandatoryMessage,
|
|
62
|
+
helperMessage
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
IconButtonStyled,
|
|
67
|
+
{
|
|
68
|
+
onClick: handleOpenPicker,
|
|
69
|
+
"aria-busy": isSkeleton,
|
|
70
|
+
disabled: isSkeleton || disabled,
|
|
71
|
+
ownerState: iconButtonOwnerState,
|
|
72
|
+
size: currentSize,
|
|
73
|
+
icon: /* @__PURE__ */ jsx(Color, { value, size, error: !!error })
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxs(
|
|
77
|
+
PopoverStyled,
|
|
78
|
+
{
|
|
79
|
+
className: clsx(classes.popover, className),
|
|
80
|
+
size,
|
|
81
|
+
ownerState: iconButtonOwnerState,
|
|
82
|
+
open: Boolean(anchorEl),
|
|
83
|
+
arrowType: "no-arrow",
|
|
84
|
+
anchorEl,
|
|
85
|
+
onClose: handleClosePicker,
|
|
86
|
+
anchorOrigin: {
|
|
87
|
+
vertical: "bottom",
|
|
88
|
+
horizontal: "left"
|
|
89
|
+
},
|
|
90
|
+
transformOrigin: {
|
|
91
|
+
vertical: "top",
|
|
92
|
+
horizontal: "left"
|
|
93
|
+
},
|
|
94
|
+
sx: {
|
|
95
|
+
mt: error ? theme.vars.size.baseSpacings.sp7 : 0
|
|
96
|
+
},
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
SketchPickerStyled,
|
|
100
|
+
{
|
|
101
|
+
ownerState: { ownerState },
|
|
102
|
+
color: tempColor ?? value ?? void 0,
|
|
103
|
+
onChange: handleColorChange,
|
|
104
|
+
disableAlpha: true,
|
|
105
|
+
presetColors: [
|
|
106
|
+
"#D0021B",
|
|
107
|
+
"#F5A623",
|
|
108
|
+
"#F8E71C",
|
|
109
|
+
"#8B572A",
|
|
110
|
+
"#7ED321",
|
|
111
|
+
"#417505",
|
|
112
|
+
"#BD10E0",
|
|
113
|
+
"#9013FE",
|
|
114
|
+
"#4A90E2",
|
|
115
|
+
"#50E3C2",
|
|
116
|
+
"#B8E986",
|
|
117
|
+
"#000000",
|
|
118
|
+
"#4A4A4A",
|
|
119
|
+
"#9B9B9B",
|
|
120
|
+
"#FFFFFF"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsxs(ActionsContainer, { children: [
|
|
125
|
+
/* @__PURE__ */ jsx(ActionCancel, { onClick: handleCancel, size }),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
ActionIntro,
|
|
128
|
+
{
|
|
129
|
+
...getPropDataTestId(
|
|
130
|
+
RHFCOLOR_PICKER_KEY_COMPONENT,
|
|
131
|
+
RHFColorPickerSlots.root,
|
|
132
|
+
instaceDataTestId
|
|
133
|
+
),
|
|
134
|
+
onClick: handleConfirm,
|
|
135
|
+
size
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
error?.message && /* @__PURE__ */ jsx(HelperError, { size, message: error?.message + "" })
|
|
143
|
+
] });
|
|
144
|
+
};
|
|
145
|
+
export {
|
|
146
|
+
ColorPickerField as C
|
|
147
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
import { LabelProps } from '../../../../Label/types';
|
|
3
|
+
export interface ColorPickerFieldProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string | null) => void;
|
|
6
|
+
error?: {
|
|
7
|
+
message?: string;
|
|
8
|
+
};
|
|
9
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
10
|
+
label?: LabelProps['label'];
|
|
11
|
+
mandatory?: LabelProps['mandatory'];
|
|
12
|
+
mandatoryMessage?: LabelProps['mandatoryMessage'];
|
|
13
|
+
helperMessage?: LabelProps['helperMessage'];
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
isSkeleton?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
instaceDataTestId?: string;
|
|
18
|
+
currentSize: Extract<Sizes, 'small' | 'medium'>;
|
|
19
|
+
classes: Record<string, string>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -4,7 +4,7 @@ import { useId } from "react";
|
|
|
4
4
|
import { useFormContext, Controller } from "react-hook-form";
|
|
5
5
|
import { useFormatter } from "@m4l/graphics";
|
|
6
6
|
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
8
|
import { D as DateTimePicker } from "../../mui_extended/DateTimePicker/DateTimePicker.js";
|
|
9
9
|
import { R as RHFDateTimeRootStyled } from "./slots/RHFDateTimeSlots.js";
|
|
10
10
|
import { R as RHF_DATE_TIME_KEY_COMPONENT } from "./constants.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useFormContext, Controller } from "react-hook-form";
|
|
3
3
|
import useId from "@mui/material/utils/useId";
|
|
4
|
-
import {
|
|
4
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
5
5
|
import { L as Label } from "../../Label/Label.js";
|
|
6
6
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
7
7
|
import { N as NumberInput } from "../../NumberInput/NumberInput.js";
|
|
@@ -7,7 +7,7 @@ import { R as RHFPeriodRootStyled } from "./slots/RHFPeriodSlots.js";
|
|
|
7
7
|
import { P as Period } from "./subcomponents/Period/Period.js";
|
|
8
8
|
import { R as RHF_PERIOD_KEY_COMPONENT } from "./constants.js";
|
|
9
9
|
import clsx from "clsx";
|
|
10
|
-
import {
|
|
10
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
11
11
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
12
12
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
13
13
|
import { R as RHFPeriodSlots } from "./slots/RHFPeriodEnum.js";
|
|
@@ -4,7 +4,7 @@ import { R as RHFSELECT_CLASSES, a as RHFSELECT_COMPONENT_KEY } from "./constant
|
|
|
4
4
|
import { R as RHFSelectEnum } from "./slots/RHFSelectEnum.js";
|
|
5
5
|
import { R as RootStyled, L as LabelStyled, S as SelectStyled, H as HelperErrorStyled } from "./slots/RHFSlots.js";
|
|
6
6
|
import { useFormContext, Controller } from "react-hook-form";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
8
|
import { useId } from "react";
|
|
9
9
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
10
|
const RHFSelect = (props) => {
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useId } from "react";
|
|
3
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
4
4
|
import { InputAdornment } from "@mui/material";
|
|
5
|
-
import {
|
|
5
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
6
6
|
import { R as RHF_TEXT_FIELD_KEY_COMPONENT } from "./constant.js";
|
|
7
7
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
8
8
|
import clsx from "clsx";
|
package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useHostTools, useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
3
3
|
import isString from "lodash-es/isString";
|
|
4
4
|
import { useDropzone } from "react-dropzone";
|
|
5
|
-
import {
|
|
5
|
+
import { a as getPropDataTestId } from "../../../../../../test/getNameDataTestId.js";
|
|
6
6
|
import { I as Image } from "../../../../../Image/Image.js";
|
|
7
7
|
import { R as RHF_UPLOAD_IMAGE_KEY_COMPONENT } from "../../constants.js";
|
|
8
8
|
import { U as UploadImageSlots } from "../../slots/RHFUploadImageEnum.js";
|
|
@@ -4,7 +4,7 @@ import { U as UploadSingleFile } from "./subcomponents/UploadSingleFile/index.js
|
|
|
4
4
|
import { R as RHFUploadSingleFileRootStyled, L as LabelStyled, H as HelperErrorStyled } from "./slots/RHFUploadSingleFileSlots.js";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { D as DEFAULT_MAX_FILE_SIZE, R as RHF_UPLOAD_SINGLE_FILE_KEY_COMPONENT } from "./constants.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
|
|
8
8
|
import { R as RHFUploadSingleFileSlots } from "./slots/RHFUploadSingleFileEnum.js";
|
|
9
9
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
10
|
function RHFUploadSingleFile(props) {
|