@addsign/moje-agenda-shared-lib 1.0.39 → 1.0.41

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.
@@ -3,7 +3,8 @@ import { IFormFieldGlobalProps, IOptionItem } from '../../types';
3
3
  export interface ISelectFieldProps extends IFormFieldGlobalProps {
4
4
  options?: IOptionItem[];
5
5
  valueKey?: string;
6
- labelKey?: string;
6
+ labelKey?: string | ((item: any) => string);
7
7
  fetchUrl?: string;
8
+ loading?: boolean;
8
9
  }
9
- export default function SelectField({ label, name, value, description, onInputChange, options, placeholder, className, errors, clearable, required, disabled, rounded, fetchUrl, valueKey, labelKey, }: ISelectFieldProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function SelectField({ label, name, value, description, onInputChange, options, placeholder, className, errors, clearable, required, disabled, rounded, fetchUrl, valueKey, labelKey, loading, }: ISelectFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,8 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { d as MdClose, b as MdExpandLess, c as MdExpandMore, a as MdCheck } from "../../index-BMFehNPK.js";
4
4
  import '../../assets/tailwind.css';/* empty css */
5
+ import { c as FaSpinner } from "../../index-DH-TC1O6.js";
6
+ import SpinnerIcon from "../SpinnerIcon.js";
5
7
  import "../../index.esm-ifS8v9eQ.js";
6
8
  import "../../jspdf.plugin.autotable-7hp3hM-a.js";
7
9
  import "../../contexts/FederationContext.js";
@@ -23,10 +25,12 @@ function SelectField({
23
25
  rounded = true,
24
26
  fetchUrl,
25
27
  valueKey,
26
- labelKey
28
+ labelKey,
29
+ loading
27
30
  }) {
28
31
  var _a, _b, _c, _d;
29
32
  const [isFocused, setIsFocused] = React.useState(false);
33
+ const [isLoading, setIsLoading] = React.useState(false);
30
34
  const apiClient = (_a = useFederationContext()) == null ? void 0 : _a.apiClient;
31
35
  const [localOptions, setLocalOptions] = React.useState(options);
32
36
  const ref = React.useRef(null);
@@ -43,23 +47,28 @@ function SelectField({
43
47
  };
44
48
  React.useEffect(() => {
45
49
  const fetchOptions = async (fetchUrl2) => {
50
+ setIsLoading(true);
46
51
  const { data } = await apiClient.get(fetchUrl2);
47
52
  const isArrayOfNumbers = typeof data[0] === "number";
48
- const transformedOptions = data.map((item) => {
49
- if (isArrayOfNumbers) {
50
- return { value: item, label: item.toString() };
51
- } else {
52
- return {
53
- value: item[valueKey || "id"],
54
- label: item[labelKey || "name"]
55
- };
53
+ const isInPageable = data && data.hasOwnProperty("content");
54
+ const transformedOptions = (isInPageable ? data.content : data).map(
55
+ (item) => {
56
+ if (isArrayOfNumbers) {
57
+ return { value: item, label: item.toString() };
58
+ } else {
59
+ return {
60
+ value: item[valueKey || "id"],
61
+ label: labelKey instanceof Function && labelKey !== void 0 ? labelKey(item) : item[labelKey]
62
+ };
63
+ }
56
64
  }
57
- });
65
+ );
58
66
  setLocalOptions([
59
67
  { value: null, label: " " },
60
68
  // Add an empty option as the first item
61
69
  ...transformedOptions
62
70
  ]);
71
+ setIsLoading(false);
63
72
  };
64
73
  if (fetchUrl)
65
74
  fetchOptions(fetchUrl);
@@ -153,9 +162,9 @@ function SelectField({
153
162
  ${isFocused && ((_b = errors[name]) == null ? void 0 : _b.message) ? "outline-4 outline-red-200 outline-offset-0 border-none" : ""}
154
163
  ${rounded ? " rounded-lg " : " rounded-none "}
155
164
  ${!isFocused && ((_c = errors[name]) == null ? void 0 : _c.message) ? "border-red-200" : ""}
156
- ${disabled ? "opacity-80 cursor-not-allowed " : ""}
165
+ ${disabled || isLoading ? "opacity-80 cursor-not-allowed " : ""}
157
166
  `,
158
- onClick: () => !disabled ? handleToggleFocus() : null,
167
+ onClick: () => !disabled && !isLoading ? handleToggleFocus() : null,
159
168
  children: [
160
169
  /* @__PURE__ */ jsxs("div", { className: "grow shrink basis-0 min-h-5 xl:!min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] ", children: [
161
170
  /* @__PURE__ */ jsxs(
@@ -186,6 +195,7 @@ function SelectField({
186
195
  ]
187
196
  }
188
197
  ),
198
+ isLoading === true || loading && /* @__PURE__ */ jsx("div", { className: "w-6 h-6 relative flex items-center justify-center align-middle", children: /* @__PURE__ */ jsx(SpinnerIcon, { icon: /* @__PURE__ */ jsx(FaSpinner, {}) }) }),
189
199
  /* @__PURE__ */ jsx("div", { className: "w-6 h-6 relative cursor-pointer ", children: /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg", children: [
190
200
  isFocused && /* @__PURE__ */ jsx(MdExpandLess, {}),
191
201
  !isFocused && /* @__PURE__ */ jsx(MdExpandMore, {})
@@ -1 +1 @@
1
- {"version":3,"file":"SelectField.js","sources":["../../../lib/components/form/SelectField.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { IFormFieldGlobalProps, IOptionItem } from \"../../types\";\r\nimport { MdCheck, MdClose, MdExpandLess, MdExpandMore } from \"react-icons/md\";\r\nimport { useClickAway } from \"react-use\";\r\nimport { useFederationContext } from \"../../main\";\r\n\r\nexport interface ISelectFieldProps extends IFormFieldGlobalProps {\r\n options?: IOptionItem[];\r\n valueKey?: string;\r\n labelKey?: string;\r\n fetchUrl?: string;\r\n}\r\n\r\nexport default function SelectField({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n options,\r\n placeholder,\r\n className,\r\n errors = {},\r\n clearable,\r\n required,\r\n disabled,\r\n rounded = true,\r\n fetchUrl,\r\n valueKey,\r\n labelKey,\r\n}: ISelectFieldProps) {\r\n const [isFocused, setIsFocused] = React.useState(false);\r\n\r\n const apiClient = useFederationContext()?.apiClient;\r\n const [localOptions, setLocalOptions] = React.useState(options);\r\n\r\n const ref = React.useRef(null);\r\n const handleClear = (e: any) => {\r\n // value;\r\n e.stopPropagation(); // Add this line\r\n\r\n setIsFocused(false);\r\n onInputChange({\r\n ...e,\r\n target: {\r\n value: \"\",\r\n name: name,\r\n },\r\n });\r\n };\r\n\r\n React.useEffect(() => {\r\n const fetchOptions = async (fetchUrl: string) => {\r\n const { data } = await apiClient.get(fetchUrl);\r\n\r\n // Check if the first item in the data array is a number to determine the data type\r\n const isArrayOfNumbers = typeof data[0] === \"number\";\r\n\r\n // Transform data based on its type\r\n const transformedOptions = data.map((item: any) => {\r\n if (isArrayOfNumbers) {\r\n // If it's a number, use the number for both value and label\r\n return { value: item, label: item.toString() };\r\n } else {\r\n // Otherwise, extract using predefined keys or defaults\r\n return {\r\n value: item[valueKey || \"id\"],\r\n label: item[labelKey || \"name\"],\r\n };\r\n }\r\n });\r\n\r\n setLocalOptions([\r\n { value: null, label: \" \" }, // Add an empty option as the first item\r\n ...transformedOptions,\r\n ]);\r\n };\r\n\r\n if (fetchUrl) fetchOptions(fetchUrl);\r\n if (options) setLocalOptions(options);\r\n }, [fetchUrl, options, apiClient, valueKey, labelKey]); // ensure valueKey and labelKey are also in the dependency array if they are dynamic\r\n\r\n const handleToggleFocus = () => {\r\n setIsFocused((prev) => !prev);\r\n };\r\n\r\n useClickAway(ref, () => {\r\n setIsFocused(false);\r\n });\r\n\r\n const hangleChange = (option: IOptionItem) => {\r\n const tmp: any = {\r\n target: {\r\n value: option.value,\r\n name: name,\r\n },\r\n };\r\n\r\n onInputChange(tmp);\r\n setIsFocused(false);\r\n };\r\n const currentlySelectedOption = React.useMemo(() => {\r\n if (value === undefined || value === \"\") return null;\r\n return localOptions?.find((option) => option.value == value);\r\n }, [localOptions, value, options]);\r\n\r\n const listOfOptions = () => {\r\n if (!localOptions) return [];\r\n return (\r\n <div\r\n id=\"list\"\r\n className=\"max-h-[390px] min-w-20 w-full whitespace-nowrap absolute z-[100000] -top-[1px] mt-[4px] bg-white rounded-lg shadow-xl border\r\n border-gray-200 justify-start items-start inline-flex overflow-auto cursor-default\"\r\n >\r\n <div className=\"grow shrink basis-0 py-1 flex-col justify-start items-start inline-flex\">\r\n {localOptions.map((option, index) => {\r\n return (\r\n <div\r\n className=\"group self-stretch px-1.5 py-px justify-start items-center inline-flex hover:bg-gray-50 \"\r\n onClick={() => hangleChange(option)}\r\n key={index}\r\n >\r\n <div className=\"grow shrink basis-0 px-1 py-2 rounded-md flex-col justify-start items-start gap-2 inline-flex\">\r\n <div className=\"self-stretch justify-start items-center gap-2 inline-flex\">\r\n <div className=\"text-gray-900 text-sm font-normal leading-normal\">\r\n {option.label}\r\n </div>\r\n {option.description && (\r\n <div className=\"text-slate-600 sm-base font-normal leading-normal\">\r\n {option.description}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n <div className=\"w-5 h-5 relative\">\r\n {option.value === value && value !== \"\" && (\r\n <MdCheck size={22} className=\"text-primary\" />\r\n )}{\" \"}\r\n {option.value !== value && (\r\n <MdCheck\r\n size={22}\r\n className=\"text-transparent group-hover:text-gray-300\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n );\r\n };\r\n\r\n return (\r\n <>\r\n <div\r\n className={\r\n \"w-full min-h-30 flex-col justify-start items-start gap-0inline-flex \" +\r\n className\r\n }\r\n id=\"selectField\"\r\n ref={ref}\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm font-medium leading-tight\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={`self-stretch w-full px-3 py-1 bg-white border justify-start items-center gap-0 inline-flex outline-none \r\n ${isFocused ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 \" : \"\"}\r\n ${\r\n isFocused && errors[name]?.message\r\n ? \"outline-4 outline-red-200 outline-offset-0 border-none\"\r\n : \"\"\r\n } \r\n ${rounded ? \" rounded-lg \" : \" rounded-none \"}\r\n ${!isFocused && errors[name]?.message ? \"border-red-200\" : \"\"} \r\n ${disabled ? \"opacity-80 cursor-not-allowed \" : \"\"}\r\n `}\r\n onClick={() => (!disabled ? handleToggleFocus() : null)}\r\n >\r\n <div className=\"grow shrink basis-0 min-h-5 xl:!min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n <div\r\n className=\"text-gray-900 text-sm font-normal leading-normal text-ellipsis overflow-hidden w-full\"\r\n id={name}\r\n >\r\n {currentlySelectedOption?.label}\r\n {!currentlySelectedOption?.label && placeholder && (\r\n <span className=\"text-slate-400 font-normal\">\r\n {\" \"}\r\n {placeholder}\r\n </span>\r\n )}\r\n </div>\r\n <div className=\"text-slate-600 text-base font-normal leading-normal\">\r\n {currentlySelectedOption?.description}\r\n </div>\r\n </div>\r\n {clearable &&\r\n value !== \"\" &&\r\n value !== null &&\r\n value !== undefined && (\r\n <div\r\n className=\"w-6 h-6 relative cursor-pointer \"\r\n id={name + \":clear\"}\r\n onClick={handleClear}\r\n >\r\n <div className=\"absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg\">\r\n <MdClose />\r\n </div>{\" \"}\r\n </div>\r\n )}\r\n <div className=\"w-6 h-6 relative cursor-pointer \">\r\n <div className=\"absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg\">\r\n {isFocused && <MdExpandLess />}\r\n {!isFocused && <MdExpandMore />}\r\n </div>\r\n </div>\r\n </div>\r\n </div>{\" \"}\r\n <div className=\"w-full relative\">{isFocused && listOfOptions()}</div>\r\n {description && !isFocused && (\r\n <div\r\n className=\"self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}\r\n {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["fetchUrl"],"mappings":";;;;;;;;;AAaA,SAAwB,YAAY;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,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;AAAA,kBACC,oBAAA,OAAA,EAAI,WAAU,uDACZ,6EAAyB,aAC5B;AAAA,gBAAA,GACF;AAAA,gBACC,aACC,UAAU,MACV,UAAU,QACV,UAAU,UACR;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,IAAI,OAAO;AAAA,oBACX,SAAS;AAAA,oBAET,UAAA;AAAA,sBAAA,oBAAC,OAAI,EAAA,WAAU,gGACb,UAAA,oBAAC,UAAQ,CAAA,GACX;AAAA,sBAAO;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACT;AAAA,oCAEH,OAAI,EAAA,WAAU,qCACb,UAAC,qBAAA,OAAA,EAAI,WAAU,gGACZ,UAAA;AAAA,kBAAA,iCAAc,cAAa,EAAA;AAAA,kBAC3B,CAAC,aAAa,oBAAC,cAAa,EAAA;AAAA,gBAAA,EAAA,CAC/B,EACF,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,QAAO;AAAA,4BACN,OAAI,EAAA,WAAU,mBAAmB,UAAA,aAAa,iBAAgB;AAAA,QAC9D,eAAe,CAAC,aACf;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QAED,OAAO,IAAI,KACV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"SelectField.js","sources":["../../../lib/components/form/SelectField.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { IFormFieldGlobalProps, IOptionItem } from \"../../types\";\r\nimport { MdCheck, MdClose, MdExpandLess, MdExpandMore } from \"react-icons/md\";\r\nimport { useClickAway } from \"react-use\";\r\nimport { SpinnerIcon, useFederationContext } from \"../../main\";\r\nimport { FaSpinner } from \"react-icons/fa\";\r\n\r\nexport interface ISelectFieldProps extends IFormFieldGlobalProps {\r\n options?: IOptionItem[];\r\n valueKey?: string;\r\n labelKey?: string | ((item: any) => string);\r\n fetchUrl?: string;\r\n loading?: boolean;\r\n}\r\n\r\nexport default function SelectField({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n options,\r\n placeholder,\r\n className,\r\n errors = {},\r\n clearable,\r\n required,\r\n disabled,\r\n rounded = true,\r\n fetchUrl,\r\n valueKey,\r\n labelKey,\r\n loading,\r\n}: ISelectFieldProps) {\r\n const [isFocused, setIsFocused] = React.useState(false);\r\n const [isLoading, setIsLoading] = React.useState(false);\r\n const apiClient = useFederationContext()?.apiClient;\r\n const [localOptions, setLocalOptions] = React.useState(options);\r\n\r\n const ref = React.useRef(null);\r\n const handleClear = (e: any) => {\r\n // value;\r\n e.stopPropagation(); // Add this line\r\n\r\n setIsFocused(false);\r\n onInputChange({\r\n ...e,\r\n target: {\r\n value: \"\",\r\n name: name,\r\n },\r\n });\r\n };\r\n\r\n React.useEffect(() => {\r\n const fetchOptions = async (fetchUrl: string) => {\r\n setIsLoading(true);\r\n const { data } = await apiClient.get(fetchUrl);\r\n\r\n // Check if the first item in the data array is a number to determine the data type\r\n const isArrayOfNumbers = typeof data[0] === \"number\";\r\n const isInPageable = data && data.hasOwnProperty(\"content\");\r\n\r\n // Transform data based on its type\r\n const transformedOptions = (isInPageable ? data.content : data).map(\r\n (item: any) => {\r\n if (isArrayOfNumbers) {\r\n // If it's a number, use the number for both value and label\r\n return { value: item, label: item.toString() };\r\n } else {\r\n // Otherwise, extract using predefined keys or defaults\r\n return {\r\n value: item[valueKey || \"id\"],\r\n label:\r\n labelKey instanceof Function && labelKey !== undefined\r\n ? labelKey(item)\r\n : item[labelKey as string],\r\n };\r\n }\r\n }\r\n );\r\n\r\n setLocalOptions([\r\n { value: null, label: \" \" }, // Add an empty option as the first item\r\n ...transformedOptions,\r\n ]);\r\n setIsLoading(false);\r\n };\r\n\r\n if (fetchUrl) fetchOptions(fetchUrl);\r\n if (options) setLocalOptions(options);\r\n }, [fetchUrl, options, apiClient, valueKey, labelKey]); // ensure valueKey and labelKey are also in the dependency array if they are dynamic\r\n\r\n const handleToggleFocus = () => {\r\n setIsFocused((prev) => !prev);\r\n };\r\n\r\n useClickAway(ref, () => {\r\n setIsFocused(false);\r\n });\r\n\r\n const hangleChange = (option: IOptionItem) => {\r\n const tmp: any = {\r\n target: {\r\n value: option.value,\r\n name: name,\r\n },\r\n };\r\n\r\n onInputChange(tmp);\r\n setIsFocused(false);\r\n };\r\n const currentlySelectedOption = React.useMemo(() => {\r\n if (value === undefined || value === \"\") return null;\r\n return localOptions?.find((option) => option.value == value);\r\n }, [localOptions, value, options]);\r\n\r\n const listOfOptions = () => {\r\n if (!localOptions) return [];\r\n return (\r\n <div\r\n id=\"list\"\r\n className=\"max-h-[390px] min-w-20 w-full whitespace-nowrap absolute z-[100000] -top-[1px] mt-[4px] bg-white rounded-lg shadow-xl border\r\n border-gray-200 justify-start items-start inline-flex overflow-auto cursor-default\"\r\n >\r\n <div className=\"grow shrink basis-0 py-1 flex-col justify-start items-start inline-flex\">\r\n {localOptions.map((option, index) => {\r\n return (\r\n <div\r\n className=\"group self-stretch px-1.5 py-px justify-start items-center inline-flex hover:bg-gray-50 \"\r\n onClick={() => hangleChange(option)}\r\n key={index}\r\n >\r\n <div className=\"grow shrink basis-0 px-1 py-2 rounded-md flex-col justify-start items-start gap-2 inline-flex\">\r\n <div className=\"self-stretch justify-start items-center gap-2 inline-flex\">\r\n <div className=\"text-gray-900 text-sm font-normal leading-normal\">\r\n {option.label}\r\n </div>\r\n {option.description && (\r\n <div className=\"text-slate-600 sm-base font-normal leading-normal\">\r\n {option.description}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n <div className=\"w-5 h-5 relative\">\r\n {option.value === value && value !== \"\" && (\r\n <MdCheck size={22} className=\"text-primary\" />\r\n )}{\" \"}\r\n {option.value !== value && (\r\n <MdCheck\r\n size={22}\r\n className=\"text-transparent group-hover:text-gray-300\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n );\r\n };\r\n\r\n return (\r\n <>\r\n <div\r\n className={\r\n \"w-full min-h-30 flex-col justify-start items-start gap-0inline-flex \" +\r\n className\r\n }\r\n id=\"selectField\"\r\n ref={ref}\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm font-medium leading-tight\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n <div\r\n className={`self-stretch w-full px-3 py-1 bg-white border justify-start items-center gap-0 inline-flex outline-none \r\n ${isFocused ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 \" : \"\"}\r\n ${\r\n isFocused && errors[name]?.message\r\n ? \"outline-4 outline-red-200 outline-offset-0 border-none\"\r\n : \"\"\r\n } \r\n ${rounded ? \" rounded-lg \" : \" rounded-none \"}\r\n ${!isFocused && errors[name]?.message ? \"border-red-200\" : \"\"} \r\n ${disabled || isLoading ? \"opacity-80 cursor-not-allowed \" : \"\"}\r\n `}\r\n onClick={() =>\r\n !disabled && !isLoading ? handleToggleFocus() : null\r\n }\r\n >\r\n <div className=\"grow shrink basis-0 min-h-5 xl:!min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n <div\r\n className=\"text-gray-900 text-sm font-normal leading-normal text-ellipsis overflow-hidden w-full\"\r\n id={name}\r\n >\r\n {currentlySelectedOption?.label}\r\n {!currentlySelectedOption?.label && placeholder && (\r\n <span className=\"text-slate-400 font-normal\">\r\n {\" \"}\r\n {placeholder}\r\n </span>\r\n )}\r\n </div>\r\n <div className=\"text-slate-600 text-base font-normal leading-normal\">\r\n {currentlySelectedOption?.description}\r\n </div>\r\n </div>\r\n {clearable &&\r\n value !== \"\" &&\r\n value !== null &&\r\n value !== undefined && (\r\n <div\r\n className=\"w-6 h-6 relative cursor-pointer \"\r\n id={name + \":clear\"}\r\n onClick={handleClear}\r\n >\r\n <div className=\"absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg\">\r\n <MdClose />\r\n </div>{\" \"}\r\n </div>\r\n )}\r\n {isLoading === true ||\r\n (loading && (\r\n <div className=\"w-6 h-6 relative flex items-center justify-center align-middle\">\r\n <SpinnerIcon icon={<FaSpinner />} />\r\n </div>\r\n ))}\r\n\r\n <div className=\"w-6 h-6 relative cursor-pointer \">\r\n <div className=\"absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg\">\r\n {isFocused && <MdExpandLess />}\r\n {!isFocused && <MdExpandMore />}\r\n </div>\r\n </div>\r\n </div>\r\n </div>{\" \"}\r\n <div className=\"w-full relative\">{isFocused && listOfOptions()}</div>\r\n {description && !isFocused && (\r\n <div\r\n className=\"self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}\r\n {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["fetchUrl"],"mappings":";;;;;;;;;;;AAeA,SAAwB,YAAY;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;;AACpB,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AACtD,QAAM,CAAC,WAAW,YAAY,IAAI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WAAU,uDACZ,6EAAyB,aAC5B;AAAA,gBAAA,GACF;AAAA,gBACC,aACC,UAAU,MACV,UAAU,QACV,UAAU,UACR;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,IAAI,OAAO;AAAA,oBACX,SAAS;AAAA,oBAET,UAAA;AAAA,sBAAA,oBAAC,OAAI,EAAA,WAAU,gGACb,UAAA,oBAAC,UAAQ,CAAA,GACX;AAAA,sBAAO;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACT;AAAA,gBAEH,cAAc,QACZ,WACC,oBAAC,OAAI,EAAA,WAAU,mEACb,UAAA,oBAAC,aAAY,EAAA,MAAO,oBAAA,WAAA,CAAU,CAAA,EAAI,CAAA,GACpC;AAAA,oCAGH,OAAI,EAAA,WAAU,qCACb,UAAC,qBAAA,OAAA,EAAI,WAAU,gGACZ,UAAA;AAAA,kBAAA,iCAAc,cAAa,EAAA;AAAA,kBAC3B,CAAC,aAAa,oBAAC,cAAa,EAAA;AAAA,gBAAA,EAAA,CAC/B,EACF,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,QAAO;AAAA,4BACN,OAAI,EAAA,WAAU,mBAAmB,UAAA,aAAa,iBAAgB;AAAA,QAC9D,eAAe,CAAC,aACf;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QAED,OAAO,IAAI,KACV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA;AAEJ;"}
@@ -29,7 +29,7 @@ declare class PDFManager {
29
29
  startX?: number;
30
30
  fill?: boolean;
31
31
  }): void;
32
- appendTable(headers: string[], // The table headers
32
+ appendTable(headers: string[] | null, // The table headers
33
33
  data: any[][], // The table data as an array of arrays
34
34
  options?: {
35
35
  bold?: boolean;
@@ -39,7 +39,7 @@ declare class PDFManager {
39
39
  marginBottom?: number;
40
40
  }, tableOptions?: any): void;
41
41
  appendPageTitle(title: string): void;
42
- appendPageTitleWithLine(title: string): void;
42
+ appendPageTitleWithLine(title: string, fontSize?: number): void;
43
43
  appendPageTitleWithSquare(title: string): void;
44
44
  /**
45
45
  * Saves the current PDF document.
@@ -105,7 +105,7 @@ class PDFManager {
105
105
  } = options;
106
106
  this.currentYPosition += marginTop;
107
107
  this.doc.autoTable({
108
- head: [headers],
108
+ head: headers ? [headers] : null,
109
109
  body: data,
110
110
  startY: this.currentYPosition,
111
111
  margin: { left: 10 + marginLeft, right: 10 + marginRight },
@@ -120,16 +120,16 @@ class PDFManager {
120
120
  appendPageTitle(title) {
121
121
  this.appendText(title, { fontSize: 14, bold: true });
122
122
  }
123
- appendPageTitleWithLine(title) {
124
- this.appendText(title, { fontSize: 14, bold: true });
123
+ appendPageTitleWithLine(title, fontSize = 14) {
124
+ this.appendText(title, { fontSize, bold: true });
125
125
  this.appendSquare({
126
126
  color: "#002EA3",
127
127
  // Green square
128
128
  height: 0.2,
129
129
  width: 180,
130
- marginTop: -5,
130
+ marginTop: -fontSize / 3,
131
131
  // Add space between squares
132
- marginBottom: 7,
132
+ marginBottom: fontSize / 2 + 1,
133
133
  // Add space between squares
134
134
  startX: 10,
135
135
  fill: true
@@ -1 +1 @@
1
- {"version":3,"file":"PdfManager.js","sources":["../../lib/utils/PdfManager.ts"],"sourcesContent":["import jsPDF from \"jspdf\";\r\nimport \"jspdf-autotable\";\r\nimport fontArial from \"../fonts/arial\";\r\nimport fontArialBold from \"../fonts/arialBold\";\r\n\r\nclass PDFManager {\r\n private doc: jsPDF;\r\n private currentYPosition: number;\r\n private pageHeight: number;\r\n\r\n constructor() {\r\n this.doc = new jsPDF();\r\n this.pageHeight = this.doc.internal.pageSize.height; // Get page height\r\n this.currentYPosition = 10; // Start position at the top of the page\r\n this.loadFonts();\r\n }\r\n\r\n private loadFonts() {\r\n this.doc.addFileToVFS(\"arial.ttf\", fontArial);\r\n this.doc.addFont(\"arial.ttf\", \"Arial\", \"normal\");\r\n this.doc.addFileToVFS(\"arialBold.ttf\", fontArialBold);\r\n this.doc.addFont(\"arialBold.ttf\", \"Arial\", \"bold\");\r\n this.doc.setFont(\"Arial\", \"normal\");\r\n }\r\n\r\n /**\r\n * Checks if a page break is needed and adds a new page if required.\r\n */\r\n private checkPageBreak(lineHeight: number) {\r\n if (this.currentYPosition + lineHeight >= this.pageHeight) {\r\n this.doc.addPage();\r\n this.currentYPosition = 10; // Reset Y position for the new page\r\n }\r\n }\r\n\r\n /**\r\n * Appends text to the current PDF document.\r\n */\r\n appendText(\r\n text: string,\r\n options: {\r\n fontSize?: number;\r\n bold?: boolean;\r\n marginLeft?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n } = {},\r\n textOptions: any = {},\r\n ) {\r\n const {\r\n fontSize = 12,\r\n bold = false,\r\n marginTop = 0,\r\n marginLeft = 0,\r\n marginBottom = 0,\r\n } = options;\r\n const lineHeight = fontSize * 0.5; // Approximate line height based on font size\r\n const maxWidth = textOptions.width || 180 - marginLeft; // Adjust width based on offset\r\n\r\n this.doc.setFontSize(fontSize);\r\n\r\n this.doc.setFont(\"Arial\", bold ? \"bold\" : \"normal\");\r\n\r\n // Split the text into multiple lines if it exceeds the maxWidth\r\n const textLines = this.doc.splitTextToSize(text, maxWidth);\r\n this.currentYPosition += marginTop;\r\n // Loop through each line and append it to the document\r\n textLines.forEach((line: string) => {\r\n this.checkPageBreak(lineHeight); // Check if new page is needed\r\n this.doc.text(line, 10 + marginLeft, this.currentYPosition, {\r\n maxWidth, ...textOptions\r\n });\r\n\r\n this.currentYPosition += lineHeight; // Update Y position after each line\r\n });\r\n this.currentYPosition += marginBottom;\r\n }\r\n\r\n appendSquare(\r\n options: {\r\n color?: [number, number, number] | string; // RGB color or string (default is black)\r\n height?: number; // Square height (default is 10 units)\r\n width?: number; // Square width (default is 10 units)\r\n marginLeft?: number; // Left margin before the table\r\n marginTop?: number; // Top margin before the table\r\n marginBottom?: number; // Bottom margin after the table\r\n startX?: number; // X coordinate where the square starts (default is 10)\r\n fill?: boolean; // Whether the square should be filled or outlined (default is true)\r\n } = {},\r\n ) {\r\n const {\r\n color = [0, 0, 0], // Default black color\r\n height = 10, // Default square height\r\n width = 10, // Default square width\r\n marginTop = 0, // Default no offset\r\n marginBottom = 0, // Default no offset\r\n marginLeft = 0, // Default no offset\r\n startX = 10, // Default starting X position\r\n fill = true, // Default to filled square\r\n } = options;\r\n\r\n // Adjust currentYPosition for any offset\r\n this.currentYPosition += marginTop;\r\n\r\n // Check if a new page is needed\r\n this.checkPageBreak(height + marginTop + marginBottom);\r\n\r\n // Set the color for the square\r\n if (Array.isArray(color)) {\r\n this.doc.setFillColor(...color); // For RGB color\r\n this.doc.setDrawColor(...color); // For outline color in case it's not filled\r\n } else {\r\n this.doc.setFillColor(color); // For string color (e.g., 'red', '#FF0000')\r\n this.doc.setDrawColor(color); // For outline color in case it's not filled\r\n }\r\n\r\n // Draw the square (filled or outlined)\r\n if (fill) {\r\n this.doc.rect(startX + marginLeft, this.currentYPosition, width, height, \"F\"); // F for filled\r\n } else {\r\n this.doc.rect(startX + marginLeft, this.currentYPosition, width, height, \"S\"); // S for outlined (stroke)\r\n }\r\n\r\n // Update Y position after the square (including bottom margin)\r\n this.currentYPosition += height + marginBottom;\r\n }\r\n appendTable(\r\n headers: string[], // The table headers\r\n data: any[][], // The table data as an array of arrays\r\n options: {\r\n bold?: boolean; // Bold font for headers\r\n marginLeft?: number; // Left margin before the table\r\n marginRight?: number; // Left margin before the table\r\n marginTop?: number; // Top margin before the table\r\n marginBottom?: number; // Bottom margin after the table\r\n } = {},\r\n tableOptions: any = {},\r\n ) {\r\n const {\r\n bold = true,\r\n marginLeft = 0,\r\n marginRight = 0,\r\n marginTop = 0,\r\n marginBottom = 0,\r\n } = options;\r\n\r\n // Adjust the current Y position with the top margin\r\n this.currentYPosition += marginTop;\r\n\r\n // Append the table using autoTable\r\n (this.doc as any).autoTable({\r\n head: [headers],\r\n body: data,\r\n startY: this.currentYPosition,\r\n margin: { left: 10 + marginLeft, right: 10 + marginRight }, // Adjust the left margin\r\n styles: { ...tableOptions.styles },\r\n headStyles: { fontStyle: bold ? \"bold\" : \"normal\" },\r\n ...tableOptions,\r\n });\r\n\r\n // Update the Y position after the table\r\n this.currentYPosition =\r\n (this.doc as any).lastAutoTable.finalY + marginBottom;\r\n }\r\n\r\n //helper function for appening title with square\r\n appendPageTitle(title: string) {\r\n this.appendText(title, { fontSize: 14, bold: true });\r\n\r\n }\r\n appendPageTitleWithLine(title: string) {\r\n this.appendText(title, { fontSize: 14, bold: true });\r\n this.appendSquare({\r\n color: \"#002EA3\", // Green square\r\n height: 0.2,\r\n width: 180,\r\n marginTop: -5, // Add space between squares\r\n marginBottom: 7, // Add space between squares\r\n startX: 10,\r\n fill: true, // Filled green square\r\n });\r\n }\r\n\r\n appendPageTitleWithSquare(title: string) {\r\n this.appendSquare({\r\n color: \"#002EA3\", // Green square\r\n height: 10,\r\n width: 10,\r\n marginTop: 0, // Add space between squares\r\n marginBottom: 0, // Add space between squares\r\n startX: 10,\r\n fill: true, // Filled green square\r\n });\r\n this.appendText(title, { fontSize: 14, bold: true, marginLeft: 12, marginTop: -6, marginBottom: 5 });\r\n\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Saves the current PDF document.\r\n */\r\n savePDF(fileName: string = \"report.pdf\") {\r\n this.doc.save(fileName);\r\n this.doc.close()\r\n }\r\n}\r\n\r\nexport default PDFManager;\r\n"],"names":["jsPDF"],"mappings":";;;;;;;;;AAKA,MAAM,WAAW;AAAA,EAKf,cAAc;AAJN;AACA;AACA;AAGD,SAAA,MAAM,IAAIA;AACf,SAAK,aAAa,KAAK,IAAI,SAAS,SAAS;AAC7C,SAAK,mBAA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A,wBAAwB,OAAe;AACrC,SAAK,WAAW,OAAO,EAAE,UAAU,IAAI,MAAM,MAAM;AACnD,SAAK,aAAa;AAAA,MAChB,OAAO;AAAA;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA;AAAA,MACX,cAAc;AAAA;AAAA,MACd,QAAQ;AAAA,MACR,MAAM;AAAA;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,0BAA0B,OAAe;AACvC,SAAK,aAAa;AAAA,MAChB,OAAO;AAAA;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA;AAAA,MACX,cAAc;AAAA;AAAA,MACd,QAAQ;AAAA,MACR,MAAM;AAAA;AAAA,IAAA,CACP;AACD,SAAK,WAAW,OAAO,EAAE,UAAU,IAAI,MAAM,MAAM,YAAY,IAAI,WAAW,IAAI,cAAc,GAAG;AAAA,EAErG;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,WAAmB,cAAc;AAClC,SAAA,IAAI,KAAK,QAAQ;AACtB,SAAK,IAAI;EACX;AACF;"}
1
+ {"version":3,"file":"PdfManager.js","sources":["../../lib/utils/PdfManager.ts"],"sourcesContent":["import jsPDF from \"jspdf\";\r\nimport \"jspdf-autotable\";\r\nimport fontArial from \"../fonts/arial\";\r\nimport fontArialBold from \"../fonts/arialBold\";\r\n\r\nclass PDFManager {\r\n private doc: jsPDF;\r\n private currentYPosition: number;\r\n private pageHeight: number;\r\n\r\n constructor() {\r\n this.doc = new jsPDF();\r\n this.pageHeight = this.doc.internal.pageSize.height; // Get page height\r\n this.currentYPosition = 10; // Start position at the top of the page\r\n this.loadFonts();\r\n }\r\n\r\n private loadFonts() {\r\n this.doc.addFileToVFS(\"arial.ttf\", fontArial);\r\n this.doc.addFont(\"arial.ttf\", \"Arial\", \"normal\");\r\n this.doc.addFileToVFS(\"arialBold.ttf\", fontArialBold);\r\n this.doc.addFont(\"arialBold.ttf\", \"Arial\", \"bold\");\r\n this.doc.setFont(\"Arial\", \"normal\");\r\n }\r\n\r\n /**\r\n * Checks if a page break is needed and adds a new page if required.\r\n */\r\n private checkPageBreak(lineHeight: number) {\r\n if (this.currentYPosition + lineHeight >= this.pageHeight) {\r\n this.doc.addPage();\r\n this.currentYPosition = 10; // Reset Y position for the new page\r\n }\r\n }\r\n\r\n /**\r\n * Appends text to the current PDF document.\r\n */\r\n appendText(\r\n text: string,\r\n options: {\r\n fontSize?: number;\r\n bold?: boolean;\r\n marginLeft?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n } = {},\r\n textOptions: any = {},\r\n ) {\r\n const {\r\n fontSize = 12,\r\n bold = false,\r\n marginTop = 0,\r\n marginLeft = 0,\r\n marginBottom = 0,\r\n } = options;\r\n const lineHeight = fontSize * 0.5; // Approximate line height based on font size\r\n const maxWidth = textOptions.width || 180 - marginLeft; // Adjust width based on offset\r\n\r\n this.doc.setFontSize(fontSize);\r\n\r\n this.doc.setFont(\"Arial\", bold ? \"bold\" : \"normal\");\r\n\r\n // Split the text into multiple lines if it exceeds the maxWidth\r\n const textLines = this.doc.splitTextToSize(text, maxWidth);\r\n this.currentYPosition += marginTop;\r\n // Loop through each line and append it to the document\r\n textLines.forEach((line: string) => {\r\n this.checkPageBreak(lineHeight); // Check if new page is needed\r\n this.doc.text(line, 10 + marginLeft, this.currentYPosition, {\r\n maxWidth, ...textOptions\r\n });\r\n\r\n this.currentYPosition += lineHeight; // Update Y position after each line\r\n });\r\n this.currentYPosition += marginBottom;\r\n }\r\n\r\n appendSquare(\r\n options: {\r\n color?: [number, number, number] | string; // RGB color or string (default is black)\r\n height?: number; // Square height (default is 10 units)\r\n width?: number; // Square width (default is 10 units)\r\n marginLeft?: number; // Left margin before the table\r\n marginTop?: number; // Top margin before the table\r\n marginBottom?: number; // Bottom margin after the table\r\n startX?: number; // X coordinate where the square starts (default is 10)\r\n fill?: boolean; // Whether the square should be filled or outlined (default is true)\r\n } = {},\r\n ) {\r\n const {\r\n color = [0, 0, 0], // Default black color\r\n height = 10, // Default square height\r\n width = 10, // Default square width\r\n marginTop = 0, // Default no offset\r\n marginBottom = 0, // Default no offset\r\n marginLeft = 0, // Default no offset\r\n startX = 10, // Default starting X position\r\n fill = true, // Default to filled square\r\n } = options;\r\n\r\n // Adjust currentYPosition for any offset\r\n this.currentYPosition += marginTop;\r\n\r\n // Check if a new page is needed\r\n this.checkPageBreak(height + marginTop + marginBottom);\r\n\r\n // Set the color for the square\r\n if (Array.isArray(color)) {\r\n this.doc.setFillColor(...color); // For RGB color\r\n this.doc.setDrawColor(...color); // For outline color in case it's not filled\r\n } else {\r\n this.doc.setFillColor(color); // For string color (e.g., 'red', '#FF0000')\r\n this.doc.setDrawColor(color); // For outline color in case it's not filled\r\n }\r\n\r\n // Draw the square (filled or outlined)\r\n if (fill) {\r\n this.doc.rect(startX + marginLeft, this.currentYPosition, width, height, \"F\"); // F for filled\r\n } else {\r\n this.doc.rect(startX + marginLeft, this.currentYPosition, width, height, \"S\"); // S for outlined (stroke)\r\n }\r\n\r\n // Update Y position after the square (including bottom margin)\r\n this.currentYPosition += height + marginBottom;\r\n }\r\n appendTable(\r\n headers: string[] | null, // The table headers\r\n data: any[][], // The table data as an array of arrays\r\n options: {\r\n bold?: boolean; // Bold font for headers\r\n marginLeft?: number; // Left margin before the table\r\n marginRight?: number; // Left margin before the table\r\n marginTop?: number; // Top margin before the table\r\n marginBottom?: number; // Bottom margin after the table\r\n } = {},\r\n tableOptions: any = {},\r\n ) {\r\n const {\r\n bold = true,\r\n marginLeft = 0,\r\n marginRight = 0,\r\n marginTop = 0,\r\n marginBottom = 0,\r\n } = options;\r\n\r\n // Adjust the current Y position with the top margin\r\n this.currentYPosition += marginTop;\r\n\r\n // Append the table using autoTable\r\n (this.doc as any).autoTable({\r\n head: headers ? [headers] : null,\r\n body: data,\r\n startY: this.currentYPosition,\r\n margin: { left: 10 + marginLeft, right: 10 + marginRight }, // Adjust the left margin\r\n styles: { ...tableOptions.styles },\r\n headStyles: { fontStyle: bold ? \"bold\" : \"normal\" },\r\n ...tableOptions,\r\n });\r\n\r\n // Update the Y position after the table\r\n this.currentYPosition =\r\n (this.doc as any).lastAutoTable.finalY + marginBottom;\r\n }\r\n\r\n //helper function for appening title with square\r\n appendPageTitle(title: string) {\r\n this.appendText(title, { fontSize: 14, bold: true });\r\n\r\n }\r\n appendPageTitleWithLine(title: string, fontSize: number = 14) {\r\n this.appendText(title, { fontSize: fontSize, bold: true });\r\n this.appendSquare({\r\n color: \"#002EA3\", // Green square\r\n height: 0.2,\r\n width: 180,\r\n marginTop: -fontSize / 3, // Add space between squares\r\n marginBottom: (fontSize / 2) + 1, // Add space between squares\r\n startX: 10,\r\n fill: true, // Filled green square\r\n });\r\n }\r\n\r\n appendPageTitleWithSquare(title: string) {\r\n this.appendSquare({\r\n color: \"#002EA3\", // Green square\r\n height: 10,\r\n width: 10,\r\n marginTop: 0, // Add space between squares\r\n marginBottom: 0, // Add space between squares\r\n startX: 10,\r\n fill: true, // Filled green square\r\n });\r\n this.appendText(title, { fontSize: 14, bold: true, marginLeft: 12, marginTop: -6, marginBottom: 5 });\r\n\r\n }\r\n\r\n\r\n\r\n\r\n /**\r\n * Saves the current PDF document.\r\n */\r\n savePDF(fileName: string = \"report.pdf\") {\r\n this.doc.save(fileName);\r\n this.doc.close()\r\n }\r\n}\r\n\r\nexport default PDFManager;\r\n"],"names":["jsPDF"],"mappings":";;;;;;;;;AAKA,MAAM,WAAW;AAAA,EAKf,cAAc;AAJN;AACA;AACA;AAGD,SAAA,MAAM,IAAIA;AACf,SAAK,aAAa,KAAK,IAAI,SAAS,SAAS;AAC7C,SAAK,mBAAmB;AACxB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEQ,YAAY;AACb,SAAA,IAAI,aAAa,aAAa,SAAS;AAC5C,SAAK,IAAI,QAAQ,aAAa,SAAS,QAAQ;AAC1C,SAAA,IAAI,aAAa,iBAAiB,aAAa;AACpD,SAAK,IAAI,QAAQ,iBAAiB,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AAAA,MACvB,cAAe,WAAW,IAAK;AAAA;AAAA,MAC/B,QAAQ;AAAA,MACR,MAAM;AAAA;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,0BAA0B,OAAe;AACvC,SAAK,aAAa;AAAA,MAChB,OAAO;AAAA;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,WAAW;AAAA;AAAA,MACX,cAAc;AAAA;AAAA,MACd,QAAQ;AAAA,MACR,MAAM;AAAA;AAAA,IAAA,CACP;AACD,SAAK,WAAW,OAAO,EAAE,UAAU,IAAI,MAAM,MAAM,YAAY,IAAI,WAAW,IAAI,cAAc,GAAG;AAAA,EAErG;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,WAAmB,cAAc;AAClC,SAAA,IAAI,KAAK,QAAQ;AACtB,SAAK,IAAI;EACX;AACF;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@addsign/moje-agenda-shared-lib",
3
3
  "private": false,
4
- "version": "1.0.39",
4
+ "version": "1.0.41",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -69,7 +69,7 @@
69
69
  "react-dropzone": "^14.2.3",
70
70
  "react-hook-form": "^7.52.1",
71
71
  "react-icons": "^5.2.1",
72
- "react-tailwindcss-datepicker": "^1.6.6",
72
+ "react-tailwindcss-datepicker": "1.6.6",
73
73
  "react-use": "^17.5.0",
74
74
  "xlsx": "^0.18.5"
75
75
  }