@m4l/components 0.1.7 → 0.1.9
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/commonjs.js +1 -1
- package/components/CommonActions/components/Actions/index.js +42 -41
- package/components/DataGrid/components/editors/TextEditor/index.d.ts +6 -0
- package/components/DataGrid/formatters/columnNestedValueFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnNestedValueFormatter/types.d.ts +5 -0
- package/components/DataGrid/formatters/columnPointsFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnPointsFormatter/types.d.ts +6 -0
- package/components/DataGrid/formatters/columnUncertaintyFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/columnUncertaintyFormatter/types.d.ts +7 -0
- package/components/DataGrid/formatters/index.d.ts +4 -0
- package/components/DataGrid/index.js +66 -4
- package/components/DataGrid/types.d.ts +5 -2
- package/components/DynamicFilter/index.js +8 -7
- package/components/ErrorLabel/index.d.ts +3 -0
- package/components/ErrorLabel/styles.d.ts +2 -0
- package/components/ErrorLabel/types.d.ts +3 -0
- package/components/LanguagePopover/index.js +3 -1
- package/components/ModalDialog/index.js +1 -1
- package/components/NoItemSelected/index.d.ts +1 -2
- package/components/NoItemSelected/index.js +3 -5
- package/components/PaperForm/components/Header.d.ts +3 -0
- package/components/PaperForm/index.js +39 -47
- package/components/PaperForm/styles.d.ts +2 -3
- package/components/PaperForm/types.d.ts +2 -2
- package/components/PropertyValue/index.js +38 -26
- package/components/PropertyValue/styles.d.ts +3 -4
- package/components/PropertyValue/types.d.ts +8 -9
- package/components/animate/variants/bounce.d.ts +1 -1
- package/components/animate/variants/container.d.ts +1 -1
- package/components/animate/variants/fade.d.ts +1 -1
- package/components/animate/variants/transition.d.ts +3 -3
- package/components/formatters/BooleanFormatter/index.js +4 -3
- package/components/formatters/BooleanFormatter/types.d.ts +1 -1
- package/components/formatters/PointsFormatter/index.d.ts +3 -0
- package/components/formatters/PointsFormatter/types.d.ts +7 -0
- package/components/formatters/PriceFormatter/index.d.ts +3 -0
- package/components/formatters/PriceFormatter/types.d.ts +5 -0
- package/components/formatters/UncertaintyFormatter/index.d.ts +3 -0
- package/components/formatters/UncertaintyFormatter/types.d.ts +14 -0
- package/components/formatters/index.d.ts +4 -0
- package/components/formatters/index.js +100 -4
- package/components/hook-form/FormProvider/index.js +19 -7
- package/components/hook-form/FormProvider/types.d.ts +4 -1
- package/components/hook-form/RHFAutocomplete/index.js +4 -2
- package/components/hook-form/RHFAutocomplete/types.d.ts +0 -1
- package/components/hook-form/RHFAutocompleteAsync/index.js +15 -5
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +1 -2
- package/components/hook-form/RHFCheckbox/index.d.ts +2 -1
- package/components/hook-form/RHFCheckbox/index.js +51 -30
- package/components/hook-form/RHFCheckbox/styles.d.ts +12 -1
- package/components/hook-form/RHFCheckbox/types.d.ts +0 -1
- package/components/hook-form/RHFDateTime/index.js +2 -2
- package/components/hook-form/RHFDateTime/types.d.ts +0 -1
- package/components/hook-form/RHFPeriod/dictionary.d.ts +3 -0
- package/components/hook-form/RHFPeriod/index.d.ts +3 -0
- package/components/hook-form/RHFPeriod/styles.d.ts +6 -0
- package/components/hook-form/RHFPeriod/types.d.ts +29 -0
- package/components/hook-form/RHFTextField/index.js +41 -17
- package/components/hook-form/RHFTextField/types.d.ts +0 -1
- package/components/hook-form/RHFUpload/index.js +5 -5
- package/components/hook-form/index.d.ts +4 -0
- package/components/index.d.ts +5 -1
- package/components/mui_extended/Accordion/components/AccordionLabel.d.ts +3 -0
- package/components/mui_extended/Accordion/index.js +74 -14
- package/components/mui_extended/Accordion/styles.d.ts +4 -0
- package/components/mui_extended/Accordion/types.d.ts +4 -1
- package/components/mui_extended/Button/index.js +25 -25
- package/components/mui_extended/Tab/index.d.ts +2 -1
- package/components/mui_extended/Tab/index.js +2 -1
- package/components/mui_extended/Tab/types.d.ts +5 -0
- package/components/mui_extended/index.d.ts +1 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/useFormAddEdit/index.d.ts +6 -0
- package/hooks/useFormAddEdit/types.d.ts +8 -0
- package/index.d.ts +1 -1
- package/index.js +290 -20
- package/package.json +3 -3
- package/utils/index.js +0 -1
- package/components/NoItemSelected/types.d.ts +0 -10
- package/components/PaperForm/skeleton.d.ts +0 -6
- package/components/hook-form/RHFCheckbox/skeleton.d.ts +0 -2
|
@@ -1,44 +1,65 @@
|
|
|
1
1
|
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
-
import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
|
|
3
2
|
import { styled } from "@mui/material/styles";
|
|
4
|
-
import {
|
|
3
|
+
import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
|
|
4
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
5
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
6
|
const WrapperSKTRHFCheckbox = styled("div")(() => ({
|
|
6
|
-
display: "flex"
|
|
7
|
+
display: "flex",
|
|
8
|
+
justifyContent: "center",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
padding: "8px"
|
|
11
|
+
}));
|
|
12
|
+
const SKTCheckSkeleton = styled(Skeleton)(() => ({
|
|
13
|
+
width: "20px",
|
|
14
|
+
height: "20px",
|
|
15
|
+
borderRadius: "4px"
|
|
16
|
+
}));
|
|
17
|
+
const ErrorLabel = styled("p")(({
|
|
18
|
+
theme
|
|
19
|
+
}) => ({
|
|
20
|
+
...theme.typography.caption,
|
|
21
|
+
color: theme.palette.error.main,
|
|
22
|
+
marginRight: 14,
|
|
23
|
+
marginLeft: 14
|
|
7
24
|
}));
|
|
8
|
-
function SKTRHFCheckbox() {
|
|
9
|
-
return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
|
|
10
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
11
|
-
variant: "rectangular",
|
|
12
|
-
width: 16,
|
|
13
|
-
height: 16
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
25
|
function RHFCheckbox({
|
|
18
26
|
name,
|
|
19
27
|
sizeCheck = "small",
|
|
20
|
-
isSkeleton = false,
|
|
21
28
|
...other
|
|
22
29
|
}) {
|
|
23
30
|
const {
|
|
24
31
|
control
|
|
25
32
|
} = useFormContext();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const isSkeleton = useModuleSkeleton();
|
|
34
|
+
return /* @__PURE__ */ jsx(FormControlLabel, {
|
|
35
|
+
control: /* @__PURE__ */ jsx(Controller, {
|
|
36
|
+
name,
|
|
37
|
+
control,
|
|
38
|
+
render: ({
|
|
39
|
+
field,
|
|
40
|
+
fieldState: {
|
|
41
|
+
error
|
|
42
|
+
}
|
|
43
|
+
}) => {
|
|
44
|
+
if (isSkeleton) {
|
|
45
|
+
return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
|
|
46
|
+
children: /* @__PURE__ */ jsx(SKTCheckSkeleton, {
|
|
47
|
+
variant: "rectangular"
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
52
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
53
|
+
size: sizeCheck,
|
|
54
|
+
...field,
|
|
55
|
+
checked: field.value
|
|
56
|
+
}), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
|
|
57
|
+
children: error?.message + ""
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
...other
|
|
63
|
+
});
|
|
43
64
|
}
|
|
44
65
|
export { RHFCheckbox as R };
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const WrapperSKTRHFCheckbox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
2
|
+
export declare const WrapperSKTRHFCheckbox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const SKTCheckSkeleton: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
animation?: false | "wave" | "pulse" | undefined;
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").SkeletonClasses> | undefined;
|
|
7
|
+
height?: string | number | undefined;
|
|
8
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
+
variant?: "text" | "rectangular" | "rounded" | "circular" | undefined;
|
|
10
|
+
width?: string | number | undefined;
|
|
11
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
12
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
13
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "width" | "height" | "animation" | "children" | "sx" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -2,7 +2,6 @@ import { FormControlLabelProps } from '@mui/material';
|
|
|
2
2
|
export interface RHFCheckboxProps extends Omit<FormControlLabelProps, 'control'> {
|
|
3
3
|
name: string;
|
|
4
4
|
sizeCheck?: 'small' | 'medium';
|
|
5
|
-
isSkeleton?: boolean;
|
|
6
5
|
}
|
|
7
6
|
export interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'> {
|
|
8
7
|
name: string;
|
|
@@ -2,7 +2,7 @@ import { useFormContext, Controller } from "react-hook-form";
|
|
|
2
2
|
import { Skeleton, TextField } from "@mui/material";
|
|
3
3
|
import { styled } from "@mui/material/styles";
|
|
4
4
|
import { DateTimePicker } from "@mui/x-date-pickers";
|
|
5
|
-
import { useEnvironment } from "@m4l/core";
|
|
5
|
+
import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
const SKTRHFWrapperTextField = styled("div")(({
|
|
8
8
|
theme
|
|
@@ -21,10 +21,10 @@ function RHFDateTime(props) {
|
|
|
21
21
|
skeletonProps: skeletoProps = {}
|
|
22
22
|
} = props;
|
|
23
23
|
const {
|
|
24
|
-
isSkeleton = false,
|
|
25
24
|
width = "100%",
|
|
26
25
|
height = 14
|
|
27
26
|
} = skeletoProps;
|
|
27
|
+
const isSkeleton = useModuleSkeleton();
|
|
28
28
|
const {
|
|
29
29
|
control
|
|
30
30
|
} = useFormContext();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WrapperProps } from './types';
|
|
3
|
+
export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const ContainerPeriod: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & WrapperProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const SKTWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const Gap: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare type PeriodProps = {
|
|
2
|
+
name: string;
|
|
3
|
+
variant?: 'single';
|
|
4
|
+
};
|
|
5
|
+
export declare enum ETimePeriods {
|
|
6
|
+
YEARS = 0,
|
|
7
|
+
MONTHS = 1,
|
|
8
|
+
DAYS = 2
|
|
9
|
+
}
|
|
10
|
+
export declare type PeriodVariant = 'monoperiod' | 'multiperiod';
|
|
11
|
+
export declare type PeriodTime = {
|
|
12
|
+
id: number;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type PeriodType = {
|
|
16
|
+
variant: PeriodVariant;
|
|
17
|
+
selPeriodTime: ETimePeriods;
|
|
18
|
+
singleValue: number | '';
|
|
19
|
+
years?: number;
|
|
20
|
+
months?: number;
|
|
21
|
+
days?: number;
|
|
22
|
+
};
|
|
23
|
+
export interface WrapperProps {
|
|
24
|
+
error: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare type RHFPeriodProps = {
|
|
27
|
+
name: string;
|
|
28
|
+
variant?: PeriodVariant;
|
|
29
|
+
};
|
|
@@ -2,6 +2,7 @@ import { useFormContext, Controller } from "react-hook-form";
|
|
|
2
2
|
import { Skeleton, TextField } from "@mui/material";
|
|
3
3
|
import { styled } from "@mui/material/styles";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
const SKTRHFWrapperTextField = styled("div")(({
|
|
7
8
|
theme
|
|
@@ -13,18 +14,19 @@ const SKTRHFWrapperTextField = styled("div")(({
|
|
|
13
14
|
padding: "12px 14px",
|
|
14
15
|
borderRadius: theme.spacing(1)
|
|
15
16
|
}));
|
|
16
|
-
const RHFTextField = forwardRef((props,
|
|
17
|
+
const RHFTextField = forwardRef((props, inputRef) => {
|
|
17
18
|
const {
|
|
18
|
-
name,
|
|
19
|
+
name: nameRHF,
|
|
19
20
|
autoComplete = "off",
|
|
20
21
|
skeletonProps: skeletoProps = {},
|
|
22
|
+
type,
|
|
21
23
|
...other
|
|
22
24
|
} = props;
|
|
23
25
|
const {
|
|
24
|
-
isSkeleton = false,
|
|
25
26
|
width = "100%",
|
|
26
27
|
height = 14
|
|
27
28
|
} = skeletoProps;
|
|
29
|
+
const isSkeleton = useModuleSkeleton();
|
|
28
30
|
const {
|
|
29
31
|
control
|
|
30
32
|
} = useFormContext();
|
|
@@ -38,25 +40,47 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
return /* @__PURE__ */ jsx(Controller, {
|
|
41
|
-
name,
|
|
43
|
+
name: nameRHF,
|
|
42
44
|
control,
|
|
43
45
|
render: ({
|
|
44
|
-
field
|
|
46
|
+
field: {
|
|
47
|
+
onChange,
|
|
48
|
+
onBlur,
|
|
49
|
+
value,
|
|
50
|
+
name,
|
|
51
|
+
ref
|
|
52
|
+
},
|
|
45
53
|
fieldState: {
|
|
46
54
|
error
|
|
47
55
|
}
|
|
48
|
-
}) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
}) => {
|
|
57
|
+
const onInternalChange = (event) => {
|
|
58
|
+
if (type === "number") {
|
|
59
|
+
if (event.target.value) {
|
|
60
|
+
onChange(Number(event.target.value));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
onChange(event);
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
TextField,
|
|
68
|
+
{
|
|
69
|
+
inputRef,
|
|
70
|
+
autoComplete,
|
|
71
|
+
onChange: onInternalChange,
|
|
72
|
+
onBlur,
|
|
73
|
+
value,
|
|
74
|
+
name,
|
|
75
|
+
ref,
|
|
76
|
+
fullWidth: true,
|
|
77
|
+
error: !!error,
|
|
78
|
+
helperText: error?.message,
|
|
79
|
+
type,
|
|
80
|
+
...other
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
60
84
|
});
|
|
61
85
|
});
|
|
62
86
|
RHFTextField.displayName = "RHFTextField";
|
|
@@ -173,8 +173,9 @@ function UploadImage({
|
|
|
173
173
|
opacity: 1
|
|
174
174
|
},
|
|
175
175
|
...(isDragReject || error) && {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
bgcolor: "error.lighter",
|
|
177
|
+
borderColor: "error.light",
|
|
178
|
+
color: "error.main"
|
|
178
179
|
}
|
|
179
180
|
},
|
|
180
181
|
children: /* @__PURE__ */ jsxs(ContainerUploadBody, {
|
|
@@ -218,10 +219,9 @@ function RHFUploadImage({
|
|
|
218
219
|
const handleDrop = useCallback((acceptedFiles) => {
|
|
219
220
|
const file = acceptedFiles[0];
|
|
220
221
|
if (file) {
|
|
221
|
-
setValue(name, {
|
|
222
|
-
...file,
|
|
222
|
+
setValue(name, Object.assign(file, {
|
|
223
223
|
preview: URL.createObjectURL(file)
|
|
224
|
-
});
|
|
224
|
+
}));
|
|
225
225
|
}
|
|
226
226
|
}, [setValue]);
|
|
227
227
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { FormProvider } from './FormProvider';
|
|
2
|
+
export type { FormInitialValues, FormStatusLoad } from './FormProvider/types';
|
|
2
3
|
export { RHFAutocomplete } from './RHFAutocomplete';
|
|
3
4
|
export { RHFAutocompleteAsync } from './RHFAutocompleteAsync';
|
|
4
5
|
export { RHFCheckbox } from './RHFCheckbox';
|
|
@@ -7,4 +8,7 @@ export { RHFMultiCheckbox } from './RHFMultiCheckbox';
|
|
|
7
8
|
export { RHFSelect } from './RHFSelect';
|
|
8
9
|
export { RHFTextField } from './RHFTextField';
|
|
9
10
|
export { RHFRadioGroup } from './RHFRadioGroup';
|
|
11
|
+
export { RHFPeriod } from './RHFPeriod';
|
|
12
|
+
export type { PeriodType } from './RHFPeriod/types';
|
|
13
|
+
export { getPeriodComponetsDictionary } from './RHFPeriod/dictionary';
|
|
10
14
|
export * from './RHFUpload';
|
package/components/index.d.ts
CHANGED
|
@@ -3,13 +3,17 @@ export * from '../components/hook-form';
|
|
|
3
3
|
export * from '../components/mui_extended';
|
|
4
4
|
export * from '../components/CompanyLogo';
|
|
5
5
|
export * from './formatters';
|
|
6
|
+
export * from './formatters/types';
|
|
6
7
|
export * from './formatters/dicctionary';
|
|
7
8
|
export { DataGrid } from '../components/DataGrid';
|
|
8
|
-
export
|
|
9
|
+
export * from '../components/DataGrid/formatters';
|
|
10
|
+
export type { Column, EditorProps, FormatterProps } from 'react-data-grid';
|
|
9
11
|
export type { RowKey } from '../components/DataGrid/types';
|
|
10
12
|
export { getDataGridComponentsDictionary as getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
|
13
|
+
export { TextEditor, NumberEditor } from '../components/DataGrid/components/editors/TextEditor';
|
|
11
14
|
export * from '../components/DynamicFilter';
|
|
12
15
|
export * from '../components/DynamicFilter/dictionary';
|
|
16
|
+
export * from '../components/ErrorLabel';
|
|
13
17
|
export type { FilterFieldApply, RawFilterFieldApply, InitialFilterFieldApply, } from '../components/DynamicFilter/types';
|
|
14
18
|
export * from './CommonActions/';
|
|
15
19
|
export * from './CommonActions/dictionary';
|
|
@@ -1,21 +1,79 @@
|
|
|
1
|
-
import { Accordion as Accordion$1, AccordionSummary,
|
|
1
|
+
import { Skeleton, Accordion as Accordion$1, AccordionSummary, AccordionDetails } from "@mui/material";
|
|
2
2
|
import { I as IconButton } from "../IconButton/index.js";
|
|
3
|
-
import { useEnvironment } from "@m4l/core";
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
4
|
+
import { I as Icon } from "../../Icon/index.js";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
styled("div")(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
borderRadius: theme.spacing(0.5),
|
|
14
|
+
height: theme.spacing(4.5),
|
|
15
|
+
minHeight: theme.spacing(4.5),
|
|
16
|
+
backgroundColor: theme.palette.background.header,
|
|
17
|
+
paddingLeft: theme.spacing(2),
|
|
18
|
+
paddingRight: theme.spacing(2),
|
|
19
|
+
marginBottom: "0px"
|
|
20
|
+
}));
|
|
21
|
+
const WrapperAccordionLabel = styled("div")(({
|
|
22
|
+
theme
|
|
23
|
+
}) => ({
|
|
24
|
+
display: "flex",
|
|
25
|
+
justifyContent: "flex-start",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
gap: theme.spacing(2)
|
|
28
|
+
}));
|
|
29
|
+
const Label = styled("span")(({
|
|
30
|
+
theme
|
|
31
|
+
}) => ({
|
|
32
|
+
...theme.typography.subtitle2
|
|
33
|
+
}));
|
|
34
|
+
const AccordionLabel = (props) => {
|
|
6
35
|
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
36
|
+
isSkeleton,
|
|
37
|
+
label,
|
|
38
|
+
SKTWidht,
|
|
39
|
+
SKTHeight,
|
|
40
|
+
labelIcon
|
|
41
|
+
} = props;
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
children: isSkeleton ? /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
44
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
45
|
+
variant: "circular",
|
|
46
|
+
width: "16px",
|
|
47
|
+
height: "16px"
|
|
48
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
49
|
+
variant: "text",
|
|
50
|
+
width: SKTWidht,
|
|
51
|
+
height: SKTHeight
|
|
52
|
+
})]
|
|
53
|
+
}) : /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
54
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Icon, {
|
|
55
|
+
src: labelIcon
|
|
56
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
57
|
+
children: label
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
function Accordion(props) {
|
|
10
63
|
const {
|
|
11
64
|
label,
|
|
12
|
-
isSkeleton,
|
|
13
65
|
SKTWidht,
|
|
14
66
|
SKTHeight,
|
|
15
67
|
children,
|
|
16
68
|
accordionProps,
|
|
17
|
-
summaryProps
|
|
69
|
+
summaryProps,
|
|
70
|
+
labelIcon
|
|
18
71
|
} = props;
|
|
72
|
+
const {
|
|
73
|
+
host_static_assets,
|
|
74
|
+
environment_assets
|
|
75
|
+
} = useEnvironment();
|
|
76
|
+
const isSkeleton = useModuleSkeleton();
|
|
19
77
|
return /* @__PURE__ */ jsxs(Accordion$1, {
|
|
20
78
|
variant: "outlined",
|
|
21
79
|
square: true,
|
|
@@ -32,11 +90,13 @@ function Accordion(props) {
|
|
|
32
90
|
src: `${host_static_assets}/${environment_assets}/frontend/components/accordion/assets/icons/expanded.svg`
|
|
33
91
|
}),
|
|
34
92
|
...summaryProps,
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
93
|
+
children: /* @__PURE__ */ jsx(AccordionLabel, {
|
|
94
|
+
isSkeleton,
|
|
95
|
+
label,
|
|
96
|
+
SKTWidht,
|
|
97
|
+
SKTHeight,
|
|
98
|
+
labelIcon
|
|
99
|
+
})
|
|
40
100
|
}), /* @__PURE__ */ jsx(AccordionDetails, {
|
|
41
101
|
children
|
|
42
102
|
})]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKTAccordionWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const WrapperAccordionLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -5,7 +5,10 @@ export declare type AccordionProps = {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
accordionProps?: MUIAccordionProps;
|
|
7
7
|
summaryProps?: AccordionSummaryProps;
|
|
8
|
-
|
|
8
|
+
labelIcon?: string;
|
|
9
9
|
SKTWidht?: string | number;
|
|
10
10
|
SKTHeight?: string | number;
|
|
11
11
|
};
|
|
12
|
+
export interface AccordionLabelProps extends Pick<AccordionProps, 'label' | 'SKTWidht' | 'SKTHeight' | 'labelIcon'> {
|
|
13
|
+
isSkeleton: boolean;
|
|
14
|
+
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
-
import { LoadingButton as LoadingButton$1 } from "@mui/lab";
|
|
2
|
-
import { Skeleton, styled as styled$1 } from "@mui/material";
|
|
3
|
-
import { styled, alpha } from "@mui/material/styles";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
1
|
import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
6
2
|
import MuiButton from "@mui/material/Button";
|
|
3
|
+
import { styled, Skeleton } from "@mui/material";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { LoadingButton as LoadingButton$1 } from "@mui/lab";
|
|
6
|
+
import { styled as styled$1, alpha } from "@mui/material/styles";
|
|
7
7
|
import { I as IconButton } from "../IconButton/index.js";
|
|
8
8
|
import { u as useBase } from "../../DynamicFilter/index.js";
|
|
9
9
|
import { useMemo } from "react";
|
|
10
|
-
const
|
|
10
|
+
const SKTButton = styled(Skeleton)(({
|
|
11
|
+
theme
|
|
12
|
+
}) => ({
|
|
13
|
+
borderRadius: theme.spacing(0.5)
|
|
14
|
+
}));
|
|
15
|
+
const Button = (props) => {
|
|
16
|
+
const isSkeleton = useModuleSkeleton();
|
|
17
|
+
if (isSkeleton) {
|
|
18
|
+
return /* @__PURE__ */ jsx(SKTButton, {
|
|
19
|
+
variant: "rectangular",
|
|
20
|
+
width: "100px",
|
|
21
|
+
height: "36px"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(MuiButton, {
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const WrapperSKTLoadingButton = styled$1("div")(({
|
|
11
29
|
theme
|
|
12
30
|
}) => ({
|
|
13
31
|
display: "flex",
|
|
@@ -37,25 +55,7 @@ const LoadingButton = (props) => {
|
|
|
37
55
|
children
|
|
38
56
|
});
|
|
39
57
|
};
|
|
40
|
-
const
|
|
41
|
-
theme
|
|
42
|
-
}) => ({
|
|
43
|
-
borderRadius: theme.spacing(0.5)
|
|
44
|
-
}));
|
|
45
|
-
const Button = (props) => {
|
|
46
|
-
const isSkeleton = useModuleSkeleton();
|
|
47
|
-
if (isSkeleton) {
|
|
48
|
-
return /* @__PURE__ */ jsx(SKTButton, {
|
|
49
|
-
variant: "rectangular",
|
|
50
|
-
width: "100px",
|
|
51
|
-
height: "36px"
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return /* @__PURE__ */ jsx(MuiButton, {
|
|
55
|
-
...props
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
const SKTWrapperFilterButton = styled("div")(({
|
|
58
|
+
const SKTWrapperFilterButton = styled$1("div")(({
|
|
59
59
|
theme
|
|
60
60
|
}) => ({
|
|
61
61
|
display: "flex",
|
|
@@ -65,7 +65,7 @@ const SKTWrapperFilterButton = styled("div")(({
|
|
|
65
65
|
height: theme.spacing(3.75),
|
|
66
66
|
background: alpha(theme.palette.primary.main, 0.3)
|
|
67
67
|
}));
|
|
68
|
-
const WrapperFilterButton = styled("div")(() => ({
|
|
68
|
+
const WrapperFilterButton = styled$1("div")(() => ({
|
|
69
69
|
"&.isDirty": {
|
|
70
70
|
animationName: "dirtyEffect",
|
|
71
71
|
animationDuration: "1s",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
1
2
|
import { Skeleton, Tab as Tab$1 } from "@mui/material";
|
|
2
3
|
import { styled } from "@mui/material/styles";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -8,11 +9,11 @@ const SKTTabWrapper = styled("div")(({
|
|
|
8
9
|
}));
|
|
9
10
|
function Tab(props) {
|
|
10
11
|
const {
|
|
11
|
-
isSkeleton,
|
|
12
12
|
SKTWidth,
|
|
13
13
|
SKTHeight,
|
|
14
14
|
...other
|
|
15
15
|
} = props;
|
|
16
|
+
const isSkeleton = useModuleSkeleton();
|
|
16
17
|
if (isSkeleton) {
|
|
17
18
|
return /* @__PURE__ */ jsx(SKTTabWrapper, {
|
|
18
19
|
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
@@ -4,6 +4,7 @@ export { type AvatarProps } from './Avatar/types';
|
|
|
4
4
|
export { BoxIcon } from './BoxIcon';
|
|
5
5
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
6
6
|
export type { TLink } from './Breadcrumbs/types';
|
|
7
|
+
export { Button } from './Button';
|
|
7
8
|
export { IconButton } from './IconButton';
|
|
8
9
|
export { LinkWithRoute } from './LinkWithRoute';
|
|
9
10
|
export { LoadingButton } from './LoadingButton';
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormStatusLoad } from '../../components/hook-form/FormProvider/types';
|
|
2
|
+
import { UseFormAddEditProps } from './types';
|
|
3
|
+
export declare const useFormAddEdit: (props: UseFormAddEditProps) => {
|
|
4
|
+
formValues: import("react-hook-form").FieldValues;
|
|
5
|
+
statusLoad: FormStatusLoad;
|
|
6
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FormInitialValues } from '../../components/hook-form/FormProvider/types';
|
|
3
|
+
export interface UseFormAddEditProps {
|
|
4
|
+
objectId?: number;
|
|
5
|
+
endPoint: string;
|
|
6
|
+
initialValues: FormInitialValues;
|
|
7
|
+
formatDataEnpoint?: (data: FieldValues) => FormInitialValues;
|
|
8
|
+
}
|
package/index.d.ts
CHANGED