@m4l/components 0.1.8 → 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.
Files changed (62) hide show
  1. package/commonjs.js +1 -1
  2. package/components/CommonActions/components/Actions/index.js +42 -41
  3. package/components/DataGrid/formatters/columnNestedValueFormatter/index.d.ts +3 -0
  4. package/components/DataGrid/formatters/columnNestedValueFormatter/types.d.ts +5 -0
  5. package/components/DataGrid/formatters/columnPointsFormatter/index.d.ts +3 -0
  6. package/components/DataGrid/formatters/columnPointsFormatter/types.d.ts +6 -0
  7. package/components/DataGrid/formatters/columnUncertaintyFormatter/index.d.ts +3 -0
  8. package/components/DataGrid/formatters/columnUncertaintyFormatter/types.d.ts +7 -0
  9. package/components/DataGrid/formatters/index.d.ts +4 -0
  10. package/components/DataGrid/types.d.ts +3 -1
  11. package/components/DynamicFilter/index.js +8 -7
  12. package/components/ErrorLabel/index.d.ts +3 -0
  13. package/components/ErrorLabel/styles.d.ts +2 -0
  14. package/components/ErrorLabel/types.d.ts +3 -0
  15. package/components/LanguagePopover/index.js +1 -0
  16. package/components/PaperForm/components/Header.d.ts +3 -0
  17. package/components/PaperForm/index.js +37 -46
  18. package/components/PaperForm/styles.d.ts +2 -3
  19. package/components/PaperForm/types.d.ts +1 -0
  20. package/components/PropertyValue/index.js +35 -24
  21. package/components/PropertyValue/styles.d.ts +3 -4
  22. package/components/PropertyValue/types.d.ts +8 -8
  23. package/components/animate/variants/bounce.d.ts +1 -1
  24. package/components/animate/variants/container.d.ts +1 -1
  25. package/components/animate/variants/fade.d.ts +1 -1
  26. package/components/animate/variants/transition.d.ts +3 -3
  27. package/components/formatters/BooleanFormatter/index.js +4 -3
  28. package/components/formatters/BooleanFormatter/types.d.ts +1 -1
  29. package/components/formatters/PointsFormatter/index.d.ts +3 -0
  30. package/components/formatters/PointsFormatter/types.d.ts +7 -0
  31. package/components/formatters/PriceFormatter/index.d.ts +3 -0
  32. package/components/formatters/PriceFormatter/types.d.ts +5 -0
  33. package/components/formatters/UncertaintyFormatter/index.d.ts +3 -0
  34. package/components/formatters/UncertaintyFormatter/types.d.ts +14 -0
  35. package/components/formatters/index.d.ts +4 -0
  36. package/components/formatters/index.js +100 -4
  37. package/components/hook-form/FormProvider/index.js +19 -7
  38. package/components/hook-form/FormProvider/types.d.ts +4 -1
  39. package/components/hook-form/RHFAutocompleteAsync/index.js +0 -1
  40. package/components/hook-form/RHFCheckbox/index.js +34 -29
  41. package/components/hook-form/RHFCheckbox/styles.d.ts +12 -1
  42. package/components/hook-form/RHFPeriod/dictionary.d.ts +3 -0
  43. package/components/hook-form/RHFPeriod/index.d.ts +3 -0
  44. package/components/hook-form/RHFPeriod/styles.d.ts +6 -0
  45. package/components/hook-form/RHFPeriod/types.d.ts +29 -0
  46. package/components/hook-form/RHFUpload/index.js +2 -3
  47. package/components/hook-form/index.d.ts +4 -0
  48. package/components/index.d.ts +4 -1
  49. package/components/mui_extended/Accordion/components/AccordionLabel.d.ts +3 -0
  50. package/components/mui_extended/Accordion/index.js +68 -8
  51. package/components/mui_extended/Accordion/styles.d.ts +4 -0
  52. package/components/mui_extended/Accordion/types.d.ts +4 -0
  53. package/components/mui_extended/Tab/index.d.ts +2 -1
  54. package/components/mui_extended/Tab/types.d.ts +5 -0
  55. package/hooks/index.d.ts +2 -0
  56. package/hooks/useFormAddEdit/index.d.ts +6 -0
  57. package/hooks/useFormAddEdit/types.d.ts +8 -0
  58. package/index.d.ts +1 -1
  59. package/index.js +289 -19
  60. package/package.json +3 -3
  61. package/components/PaperForm/skeleton.d.ts +0 -6
  62. package/components/hook-form/RHFCheckbox/skeleton.d.ts +0 -2
@@ -0,0 +1,7 @@
1
+ import { ComponentType } from 'react';
2
+ export declare type CalibrationPoint = number | null;
3
+ export interface PointsFormatterProps {
4
+ Component?: ComponentType;
5
+ unit?: string;
6
+ value?: Array<CalibrationPoint>;
7
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { PriceFormatterProps } from './types';
3
+ export declare function PriceFormatter(props: PriceFormatterProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { ComponentForrmaterType } from '../types';
2
+ export interface PriceFormatterProps {
3
+ Component?: ComponentForrmaterType;
4
+ value?: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { UncertaintyFormatterProps } from './types';
3
+ export declare function UncertaintyFormatter(props: UncertaintyFormatterProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { ComponentType } from 'react';
2
+ export interface UncertaintyRange {
3
+ cmc_min_closed: boolean;
4
+ cmc_min: number;
5
+ cmc_max_closed: boolean;
6
+ cmc_max: number;
7
+ cmc_uncertainty: number;
8
+ }
9
+ export interface UncertaintyFormatterProps {
10
+ Component?: ComponentType;
11
+ symbol?: string;
12
+ unit?: string;
13
+ value?: Array<UncertaintyRange>;
14
+ }
@@ -1,2 +1,6 @@
1
1
  export { BooleanFormatter } from './BooleanFormatter';
2
2
  export { DateFormatter } from './DateFormatter';
3
+ export { UncertaintyFormatter } from './UncertaintyFormatter';
4
+ export { PointsFormatter } from './PointsFormatter';
5
+ export { PriceFormatter } from './PriceFormatter';
6
+ export type { UncertaintyRange } from './UncertaintyFormatter/types';
@@ -1,7 +1,61 @@
1
- import "react";
2
- import "@m4l/core";
1
+ import require$$0 from "react";
2
+ import { jsx, Fragment } from "react/jsx-runtime";
3
+ import { getPropertyByString } from "@m4l/core";
3
4
  import "@mui/material";
4
- import "react/jsx-runtime";
5
+ function UncertaintyFormatter(props) {
6
+ const {
7
+ value,
8
+ unit,
9
+ symbol,
10
+ Component = require$$0.Fragment
11
+ } = props;
12
+ if (value === void 0 || value === null || !Array.isArray(value)) {
13
+ return /* @__PURE__ */ jsx(Fragment, {
14
+ children: ""
15
+ });
16
+ }
17
+ let result = "";
18
+ value.map((obj, idx) => {
19
+ const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
20
+ const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
21
+ result = result.concat(`${idx > 0 ? " " : ""}`, obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} \xB1 ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} \xB1 ${obj.cmc_uncertainty}]`);
22
+ });
23
+ return /* @__PURE__ */ jsx(Component, {
24
+ children: result
25
+ });
26
+ }
27
+ function PointsFormatter(props) {
28
+ const {
29
+ value,
30
+ unit,
31
+ Component = require$$0.Fragment
32
+ } = props;
33
+ console.log("points", value);
34
+ if (value === void 0 || value === null || !Array.isArray(value)) {
35
+ return /* @__PURE__ */ jsx(Fragment, {
36
+ children: "[]"
37
+ });
38
+ }
39
+ let result = "";
40
+ value.map((point) => {
41
+ if (point) {
42
+ console.log("point", point);
43
+ result = result.concat(`[${point}${unit}]`);
44
+ }
45
+ });
46
+ return /* @__PURE__ */ jsx(Component, {
47
+ children: result
48
+ });
49
+ }
50
+ function PriceFormatter(props) {
51
+ const {
52
+ value,
53
+ Component = require$$0.Fragment
54
+ } = props;
55
+ return /* @__PURE__ */ jsx(Component, {
56
+ children: `${value}$Cop`
57
+ });
58
+ }
5
59
  function getFormattersComponentsDictionary() {
6
60
  return ["formatters"];
7
61
  }
@@ -13,4 +67,46 @@ const defaultFormattersDictionary = {
13
67
  boolean_false: "False"
14
68
  }
15
69
  };
16
- export { defaultFormattersDictionary as d, getFormattersComponentsDictionary as g };
70
+ function columnUncertaintyFormatter(props) {
71
+ const {
72
+ fieldUnit,
73
+ fieldValue,
74
+ fieldSymbol,
75
+ Component
76
+ } = props;
77
+ return (obProps) => {
78
+ return /* @__PURE__ */ jsx(UncertaintyFormatter, {
79
+ Component,
80
+ value: getPropertyByString(obProps, fieldValue),
81
+ unit: getPropertyByString(obProps, fieldUnit),
82
+ symbol: getPropertyByString(obProps, fieldSymbol)
83
+ });
84
+ };
85
+ }
86
+ function columnPointsFormatter(props) {
87
+ const {
88
+ fieldUnit,
89
+ fieldValue,
90
+ Component
91
+ } = props;
92
+ return (obProps) => {
93
+ return /* @__PURE__ */ jsx(PointsFormatter, {
94
+ Component,
95
+ value: getPropertyByString(obProps, fieldValue),
96
+ unit: getPropertyByString(obProps, fieldUnit)
97
+ });
98
+ };
99
+ }
100
+ function columnNestedValueFormatter(props) {
101
+ const {
102
+ fieldValue,
103
+ Component = require$$0.Fragment
104
+ } = props;
105
+ return (obProps) => {
106
+ console.log("columnNestedValueFormatter", obProps, fieldValue);
107
+ return /* @__PURE__ */ jsx(Component, {
108
+ children: getPropertyByString(obProps, fieldValue)
109
+ });
110
+ };
111
+ }
112
+ export { PointsFormatter as P, UncertaintyFormatter as U, PriceFormatter as a, columnPointsFormatter as b, columnUncertaintyFormatter as c, defaultFormattersDictionary as d, columnNestedValueFormatter as e, getFormattersComponentsDictionary as g };
@@ -18,25 +18,37 @@ function FormProvider(props) {
18
18
  children,
19
19
  onSubmit,
20
20
  values,
21
- validationSchema
21
+ validationSchema,
22
+ statusLoad = "ready"
22
23
  } = props;
23
24
  const methods = useForm({
24
25
  resolver: o(validationSchema),
25
26
  defaultValues: values
26
27
  });
27
28
  useEffect(() => {
28
- if (values.initial) {
29
+ console.log("useEffect FormProvider reload_values_provider===", statusLoad);
30
+ if (statusLoad === "reload_values_provider") {
31
+ const keys = Object.keys(values);
32
+ keys.forEach((key) => {
33
+ methods.setValue(key, values[key], {
34
+ shouldValidate: false,
35
+ shouldDirty: false,
36
+ shouldTouch: false
37
+ });
38
+ });
29
39
  return;
30
40
  }
31
- const keys = Object.keys(values);
32
- keys.forEach((key) => {
33
- methods.setValue(key, values[key], {
41
+ }, [methods, statusLoad, values]);
42
+ useEffect(() => {
43
+ if (statusLoad === "ready") {
44
+ console.log("useEffect FormProvider Ready", statusLoad);
45
+ methods.setValue("statusLoad", "ready", {
34
46
  shouldValidate: false,
35
47
  shouldDirty: false,
36
48
  shouldTouch: false
37
49
  });
38
- });
39
- }, [methods, values]);
50
+ }
51
+ }, [statusLoad]);
40
52
  return /* @__PURE__ */ jsx(FormProvider$1, {
41
53
  ...methods,
42
54
  children: /* @__PURE__ */ jsx(WrapperFormProvider, {
@@ -1,8 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { FieldValues } from 'react-hook-form';
3
+ export declare type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
4
+ export declare type FormInitialValues = FieldValues;
3
5
  export interface FormProviderProps {
4
6
  children: ReactNode;
5
7
  onSubmit: (data: FieldValues) => void;
6
- values: FieldValues;
8
+ values: FormInitialValues;
7
9
  validationSchema: any;
10
+ statusLoad?: FormStatusLoad;
8
11
  }
@@ -156,7 +156,6 @@ function RHFAutocompleteAsync(props) {
156
156
  setOpen(false);
157
157
  },
158
158
  onChange: (_e, val) => {
159
- console.log("onChante auto", _e, val);
160
159
  onChange(val);
161
160
  },
162
161
  disabled,
@@ -1,20 +1,19 @@
1
1
  import { useFormContext, Controller } from "react-hook-form";
2
2
  import { styled } from "@mui/material/styles";
3
3
  import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
4
  import { useModuleSkeleton } from "@m4l/core";
5
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
6
6
  const WrapperSKTRHFCheckbox = styled("div")(() => ({
7
- 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"
8
16
  }));
9
- function SKTRHFCheckbox() {
10
- return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
11
- children: /* @__PURE__ */ jsx(Skeleton, {
12
- variant: "rectangular",
13
- width: 16,
14
- height: 16
15
- })
16
- });
17
- }
18
17
  const ErrorLabel = styled("p")(({
19
18
  theme
20
19
  }) => ({
@@ -32,29 +31,35 @@ function RHFCheckbox({
32
31
  control
33
32
  } = useFormContext();
34
33
  const isSkeleton = useModuleSkeleton();
35
- return /* @__PURE__ */ jsx(
36
- FormControlLabel,
37
- {
38
- control: /* @__PURE__ */ jsx(Controller, {
39
- name,
40
- control,
41
- render: ({
42
- field,
43
- fieldState: {
44
- error
45
- }
46
- }) => isSkeleton ? /* @__PURE__ */ jsx(SKTRHFCheckbox, {}) : /* @__PURE__ */ jsxs(Fragment, {
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, {
47
52
  children: [/* @__PURE__ */ jsx(Checkbox, {
48
53
  size: sizeCheck,
49
54
  ...field,
50
55
  checked: field.value
51
- }), console.log("Error1", error?.message), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
56
+ }), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
52
57
  children: error?.message + ""
53
58
  })]
54
- })
55
- }),
56
- ...other
57
- }
58
- );
59
+ });
60
+ }
61
+ }),
62
+ ...other
63
+ });
59
64
  }
60
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/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
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>, {}, {}>;
@@ -0,0 +1,3 @@
1
+ import { Dictionary } from '@m4l/core';
2
+ export declare function getPeriodComponetsDictionary(): string[];
3
+ export declare const defaultPeriodDictionary: Dictionary;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { RHFPeriodProps } from './types';
3
+ export declare const RHFPeriod: (props: RHFPeriodProps) => JSX.Element;
@@ -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
+ };
@@ -219,10 +219,9 @@ function RHFUploadImage({
219
219
  const handleDrop = useCallback((acceptedFiles) => {
220
220
  const file = acceptedFiles[0];
221
221
  if (file) {
222
- setValue(name, {
223
- ...file,
222
+ setValue(name, Object.assign(file, {
224
223
  preview: URL.createObjectURL(file)
225
- });
224
+ }));
226
225
  }
227
226
  }, [setValue]);
228
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';
@@ -3,14 +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 type { Column, EditorProps } from 'react-data-grid';
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';
11
13
  export { TextEditor, NumberEditor } from '../components/DataGrid/components/editors/TextEditor';
12
14
  export * from '../components/DynamicFilter';
13
15
  export * from '../components/DynamicFilter/dictionary';
16
+ export * from '../components/ErrorLabel';
14
17
  export type { FilterFieldApply, RawFilterFieldApply, InitialFilterFieldApply, } from '../components/DynamicFilter/types';
15
18
  export * from './CommonActions/';
16
19
  export * from './CommonActions/dictionary';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { AccordionLabelProps } from '../types';
3
+ export declare const AccordionLabel: (props: AccordionLabelProps) => JSX.Element;
@@ -1,7 +1,64 @@
1
- import { Accordion as Accordion$1, AccordionSummary, Skeleton, AccordionDetails } from "@mui/material";
1
+ import { Skeleton, Accordion as Accordion$1, AccordionSummary, AccordionDetails } from "@mui/material";
2
2
  import { I as IconButton } from "../IconButton/index.js";
3
3
  import { useEnvironment, useModuleSkeleton } from "@m4l/core";
4
- import { jsxs, jsx } from "react/jsx-runtime";
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) => {
35
+ const {
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
+ };
5
62
  function Accordion(props) {
6
63
  const {
7
64
  label,
@@ -9,7 +66,8 @@ function Accordion(props) {
9
66
  SKTHeight,
10
67
  children,
11
68
  accordionProps,
12
- summaryProps
69
+ summaryProps,
70
+ labelIcon
13
71
  } = props;
14
72
  const {
15
73
  host_static_assets,
@@ -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: isSkeleton ? /* @__PURE__ */ jsx(Skeleton, {
36
- variant: "text",
37
- width: SKTWidht,
38
- height: SKTHeight
39
- }) : label
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,6 +5,10 @@ export declare type AccordionProps = {
5
5
  children: ReactNode;
6
6
  accordionProps?: MUIAccordionProps;
7
7
  summaryProps?: AccordionSummaryProps;
8
+ labelIcon?: string;
8
9
  SKTWidht?: string | number;
9
10
  SKTHeight?: string | number;
10
11
  };
12
+ export interface AccordionLabelProps extends Pick<AccordionProps, 'label' | 'SKTWidht' | 'SKTHeight' | 'labelIcon'> {
13
+ isSkeleton: boolean;
14
+ }
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare function Tab(props: any): JSX.Element;
2
+ import { TabProps } from './types';
3
+ export declare function Tab(props: TabProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { TabProps as MUITabProps } from '@mui/material';
2
+ export interface TabProps extends MUITabProps {
3
+ SKTWidth: string | number;
4
+ SKTHeight: string | number;
5
+ }
@@ -0,0 +1,2 @@
1
+ export { useFormAddEdit } from './useFormAddEdit';
2
+ export { useModal } from './useModal';
@@ -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
@@ -1,4 +1,4 @@
1
1
  export * from './components';
2
2
  export * from './contexts';
3
- export * from './hooks/useModal';
3
+ export * from './hooks';
4
4
  export { Logo } from './assets/Logo';