@addsign/moje-agenda-shared-lib 2.0.41 → 2.0.42
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/dist/Combination-D2GKeTwa.js +1162 -0
- package/dist/Combination-D2GKeTwa.js.map +1 -0
- package/dist/Dialog-CCrUyF91.js +424 -0
- package/dist/Dialog-CCrUyF91.js.map +1 -0
- package/dist/assets/style.css +61 -8
- package/dist/chevron-down-CfJmko7t.js +14 -0
- package/dist/chevron-down-CfJmko7t.js.map +1 -0
- package/dist/components/Attachments.js +2 -1
- package/dist/components/Attachments.js.map +1 -1
- package/dist/components/ConfirmationModalDialog.js +1 -1
- package/dist/components/ConfirmationModalDialog.js.map +1 -1
- package/dist/components/Modal.js +1 -1
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/datatable/DataTable.js +3 -2
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +35 -9
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +5 -4
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -1
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/DateRangeField.js +2 -2
- package/dist/components/form/DateRangeField.js.map +1 -1
- package/dist/components/form/FileInput.js +3 -2
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +3 -2
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +8 -7
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/InputField.js +3 -2
- package/dist/components/form/InputField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +2 -1
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/RadioGroup.js +1 -1
- package/dist/components/form/RadioGroup.js.map +1 -1
- package/dist/components/form/SelectField.js +5 -4
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/layout/Neoptimizovano.js +2 -1
- package/dist/components/layout/Neoptimizovano.js.map +1 -1
- package/dist/components/layout/PageTitle.js +1 -1
- package/dist/components/layout/PageTitle.js.map +1 -1
- package/dist/components/layout/SectionTitle.js +1 -1
- package/dist/components/layout/SectionTitle.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +2 -1
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DatePicker.js +1 -1
- package/dist/components/ui/DateTimePicker.js +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +2 -2
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +27 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/multi-select.d.ts +67 -0
- package/dist/components/ui/multi-select.js +295 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/radioGroup.js +5 -5
- package/dist/components/ui/select.js +8 -16
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/toast.js +5 -5
- package/dist/components/ui/tooltip.js +6 -6
- package/dist/index-B0wyIFEr.js +47 -0
- package/dist/index-B0wyIFEr.js.map +1 -0
- package/dist/index-BcR8DnnV.js +234 -0
- package/dist/index-BcR8DnnV.js.map +1 -0
- package/dist/index-CK9QfV6i.js +40 -0
- package/dist/index-CK9QfV6i.js.map +1 -0
- package/dist/index-CcNKXchf.js +2203 -0
- package/dist/index-CcNKXchf.js.map +1 -0
- package/dist/index-D75exu1X.js +18 -0
- package/dist/index-D75exu1X.js.map +1 -0
- package/dist/index-DzfDO78K.js +15 -0
- package/dist/index-DzfDO78K.js.map +1 -0
- package/dist/index-NZPkObcw.js +110 -0
- package/dist/index-NZPkObcw.js.map +1 -0
- package/dist/index-qqHvAsVd.js +2266 -0
- package/dist/index-qqHvAsVd.js.map +1 -0
- package/dist/index-wO-IHm1z.js +131 -0
- package/dist/index-wO-IHm1z.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/popover-CcrzvSk7.js +319 -0
- package/dist/popover-CcrzvSk7.js.map +1 -0
- package/lib/components/ConfirmationModalDialog.tsx +1 -1
- package/lib/components/Modal.tsx +1 -1
- package/lib/components/datatable/DataTable.tsx +1 -1
- package/lib/components/datatable/DataTableServer.tsx +49 -15
- package/lib/components/form/AutocompleteSearchBar.tsx +3 -3
- package/lib/components/form/DateRangeField.tsx +2 -2
- package/lib/components/form/FormField.tsx +6 -6
- package/lib/components/form/InputField.tsx +3 -2
- package/lib/components/form/RadioGroup.tsx +1 -1
- package/lib/components/form/SelectField.tsx +3 -3
- package/lib/components/layout/PageTitle.tsx +19 -19
- package/lib/components/layout/SectionTitle.tsx +1 -1
- package/lib/components/ui/badge.tsx +36 -0
- package/lib/components/ui/multi-select.tsx +365 -0
- package/lib/main.ts +4 -0
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ function RadioGroup({
|
|
|
40
40
|
className: " accent-primary border-gray-300 mr-2"
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm font-normal leading-tight", children: option.label })
|
|
44
44
|
] }, index)) }),
|
|
45
45
|
description && /* @__PURE__ */ jsx("div", { className: "HintText self-stretch text-slate-600 text-sm font-normal leading-tight", children: description }),
|
|
46
46
|
errors[name] && /* @__PURE__ */ jsx("div", { className: "HintText self-stretch text-red-600 text-sm font-normal leading-tight", children: (_a = errors[name]) == null ? void 0 : _a.message })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../../lib/components/form/RadioGroup.tsx"],"sourcesContent":["import { IFormFieldGlobalProps, IOptionItem } from \"../../types\";\r\n\r\nexport interface IRadioGroupProps extends IFormFieldGlobalProps {\r\n options?: IOptionItem[];\r\n valueKey?: string;\r\n labelKey?: string;\r\n}\r\n\r\nexport default function RadioGroup({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n options,\r\n errors = {},\r\n required,\r\n disabled,\r\n register = () => {},\r\n}: IRadioGroupProps) {\r\n return (\r\n <div className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex mb-2\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n </div>\r\n <div className=\"flex flex-col gap-1\">\r\n {options?.map((option, index) => (\r\n <label key={index} className=\"inline-flex items-center space-x-2\">\r\n <input\r\n type=\"radio\"\r\n name={name}\r\n value={option.value}\r\n checked={value === option.value}\r\n disabled={disabled}\r\n {...register(name)} // Spread the rest of register's return value\r\n onChange={onInputChange}\r\n className=\" accent-primary border-gray-300 mr-2\"\r\n />\r\n <span className=\"text-
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../../lib/components/form/RadioGroup.tsx"],"sourcesContent":["import { IFormFieldGlobalProps, IOptionItem } from \"../../types\";\r\n\r\nexport interface IRadioGroupProps extends IFormFieldGlobalProps {\r\n options?: IOptionItem[];\r\n valueKey?: string;\r\n labelKey?: string;\r\n}\r\n\r\nexport default function RadioGroup({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n options,\r\n errors = {},\r\n required,\r\n disabled,\r\n register = () => {},\r\n}: IRadioGroupProps) {\r\n return (\r\n <div className=\"w-full min-h-30 flex-col justify-start items-start gap-1.5 sharedLibrary\">\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex mb-2\">\r\n {label && (\r\n <label\r\n className=\"text-slate-700 text-sm leading-tight font-medium\"\r\n htmlFor={name}\r\n >\r\n {label} {required ? \"*\" : \"\"}\r\n </label>\r\n )}\r\n </div>\r\n <div className=\"flex flex-col gap-1\">\r\n {options?.map((option, index) => (\r\n <label key={index} className=\"inline-flex items-center space-x-2\">\r\n <input\r\n type=\"radio\"\r\n name={name}\r\n value={option.value}\r\n checked={value === option.value}\r\n disabled={disabled}\r\n {...register(name)} // Spread the rest of register's return value\r\n onChange={onInputChange}\r\n className=\" accent-primary border-gray-300 mr-2\"\r\n />\r\n <span className=\"text-muted-foreground text-sm font-normal leading-tight\">\r\n {option.label}\r\n </span>\r\n </label>\r\n ))}\r\n </div>\r\n {description && (\r\n <div className=\"HintText self-stretch text-slate-600 text-sm font-normal leading-tight\">\r\n {description}\r\n </div>\r\n )}\r\n {errors[name] && (\r\n <div className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\">\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n}\r\n"],"names":[],"mappings":";AAQA,SAAwB,WAAW;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV;AAAA,EACA;AAAA,EACA,WAAW,MAAM;AAAA,EAAC;AACpB,GAAqB;;AAEjB,SAAA,qBAAC,OAAI,EAAA,WAAU,6EACb,UAAA;AAAA,IAAC,oBAAA,OAAA,EAAI,WAAU,sEACZ,UACC,SAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,SAAS;AAAA,QAER,UAAA;AAAA,UAAA;AAAA,UAAM;AAAA,UAAE,WAAW,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAGhC;AAAA,IACC,oBAAA,OAAA,EAAI,WAAU,uBACZ,UAAS,mCAAA,IAAI,CAAC,QAAQ,UACrB,qBAAC,SAAkB,EAAA,WAAU,sCAC3B,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL;AAAA,UACA,OAAO,OAAO;AAAA,UACd,SAAS,UAAU,OAAO;AAAA,UAC1B;AAAA,UACC,GAAG,SAAS,IAAI;AAAA,UACjB,UAAU;AAAA,UACV,WAAU;AAAA,QAAA;AAAA,MACZ;AAAA,MACC,oBAAA,QAAA,EAAK,WAAU,2DACb,iBAAO,OACV;AAAA,IAAA,KAbU,KAcZ,IAEJ;AAAA,IACC,eACC,oBAAC,OAAI,EAAA,WAAU,0EACZ,UACH,aAAA;AAAA,IAED,OAAO,IAAI,KACT,oBAAA,OAAA,EAAI,WAAU,wEACZ,WAAA,YAAO,IAAI,MAAX,mBAAc,QACjB,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
|
@@ -4,11 +4,12 @@ import { b as MdClose, M as MdExpandLess, a as MdExpandMore, c as MdCheck } from
|
|
|
4
4
|
import "../../tailwind-l0sNRNKZ.js";
|
|
5
5
|
import { c as FaSpinner } from "../../index-DH-TC1O6.js";
|
|
6
6
|
import SpinnerIcon from "../SpinnerIcon.js";
|
|
7
|
+
import "../ui/multi-select.js";
|
|
7
8
|
import "../../index.esm-ifS8v9eQ.js";
|
|
8
9
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
9
10
|
import "../../contexts/FederationContext.js";
|
|
10
11
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
11
|
-
import "../../Dialog-
|
|
12
|
+
import "../../Dialog-CCrUyF91.js";
|
|
12
13
|
import "../ui/ScrollArea.js";
|
|
13
14
|
import "../ui/input.js";
|
|
14
15
|
import "../ui/form.js";
|
|
@@ -128,7 +129,7 @@ function SelectField({
|
|
|
128
129
|
onClick: () => hangleChange(option),
|
|
129
130
|
children: [
|
|
130
131
|
/* @__PURE__ */ jsx("div", { className: "grow shrink basis-0 px-1 py-2 rounded-md flex-col justify-start items-start gap-2 inline-flex", children: /* @__PURE__ */ jsxs("div", { className: "self-stretch justify-start items-center gap-2 inline-flex", children: [
|
|
131
|
-
/* @__PURE__ */ jsx("div", { className: "text-
|
|
132
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-sm font-normal leading-normal", children: option.label }),
|
|
132
133
|
option.description && /* @__PURE__ */ jsx("div", { className: "text-slate-600 sm-base font-normal leading-normal", children: option.description })
|
|
133
134
|
] }) }),
|
|
134
135
|
/* @__PURE__ */ jsxs("div", { className: "w-5 h-5 relative", children: [
|
|
@@ -186,11 +187,11 @@ function SelectField({
|
|
|
186
187
|
/* @__PURE__ */ jsxs(
|
|
187
188
|
"div",
|
|
188
189
|
{
|
|
189
|
-
className: "text-
|
|
190
|
+
className: "text-muted-foreground text-sm font-normal leading-normal text-ellipsis overflow-hidden w-full",
|
|
190
191
|
id: name,
|
|
191
192
|
children: [
|
|
192
193
|
currentlySelectedOption == null ? void 0 : currentlySelectedOption.label,
|
|
193
|
-
!(currentlySelectedOption == null ? void 0 : currentlySelectedOption.label) && placeholder && /* @__PURE__ */ jsxs("span", { className: "text-
|
|
194
|
+
!(currentlySelectedOption == null ? void 0 : currentlySelectedOption.label) && placeholder && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-normal", children: [
|
|
194
195
|
" ",
|
|
195
196
|
placeholder
|
|
196
197
|
] })
|
|
@@ -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 { 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-auto 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-[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 !disabled && (\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 && !disabled && <MdExpandLess />}\r\n {!isFocused && !disabled && <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,MAAM,SAAS,KAAK;AAChD,QAAA,aAAY,0BAAwB,MAAxB,mBAAwB;AAC1C,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,OAAO;AAExD,QAAA,MAAM,MAAM,OAAO,IAAI;AACvB,QAAA,cAAc,CAAC,MAAW;AAE9B,MAAE,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AA,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,aAAA,CAAC,YAAY,oBAAC,cAAa,CAAA,CAAA;AAAA,kBACxC,CAAC,aAAa,CAAC,gCAAa,cAAa,CAAA,CAAA;AAAA,gBAAA,EAAA,CAC5C,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-auto 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-muted-foreground 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-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n <div\r\n className=\"text-muted-foreground 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-muted-foreground 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 !disabled && (\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 && !disabled && <MdExpandLess />}\r\n {!isFocused && !disabled && <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,M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from "react/jsx-runtime";
|
|
2
2
|
import "../../tailwind-l0sNRNKZ.js";
|
|
3
3
|
import "react";
|
|
4
|
+
import "../ui/multi-select.js";
|
|
4
5
|
import "../../index.esm-ifS8v9eQ.js";
|
|
5
6
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
6
7
|
import "../../contexts/FederationContext.js";
|
|
7
|
-
import "../../Dialog-
|
|
8
|
+
import "../../Dialog-CCrUyF91.js";
|
|
8
9
|
import "../ui/ScrollArea.js";
|
|
9
10
|
import "../ui/input.js";
|
|
10
11
|
import "../ui/form.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Neoptimizovano.js","sources":["../../../lib/components/layout/Neoptimizovano.tsx"],"sourcesContent":["import { ButtonCN } from \"../../main\";\r\n\r\nexport default function Neoptimizovano() {\r\n return (\r\n <div className=\"flex flex-col gap-2 flex-1 items-center justify-center min-h-[50vh] text-center\">\r\n <h1>Není optimalizováno pro toto rozlišení</h1>\r\n <ButtonCN onClick={() => history.back()}>Zpět</ButtonCN>\r\n </div>\r\n );\r\n}\r\n"],"names":["ButtonCN"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Neoptimizovano.js","sources":["../../../lib/components/layout/Neoptimizovano.tsx"],"sourcesContent":["import { ButtonCN } from \"../../main\";\r\n\r\nexport default function Neoptimizovano() {\r\n return (\r\n <div className=\"flex flex-col gap-2 flex-1 items-center justify-center min-h-[50vh] text-center\">\r\n <h1>Není optimalizováno pro toto rozlišení</h1>\r\n <ButtonCN onClick={() => history.back()}>Zpět</ButtonCN>\r\n </div>\r\n );\r\n}\r\n"],"names":["ButtonCN"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAwB,iBAAiB;AAErC,SAAA,qBAAC,OAAI,EAAA,WAAU,mFACb,UAAA;AAAA,IAAA,oBAAC,QAAG,UAAsC,yCAAA,CAAA;AAAA,wBACzCA,QAAS,EAAA,SAAS,MAAM,QAAQ,QAAQ,UAAI,QAAA;AAAA,EAC/C,EAAA,CAAA;AAEJ;"}
|
|
@@ -4,7 +4,7 @@ function PageTitle({
|
|
|
4
4
|
textSize = "text-2xl",
|
|
5
5
|
...props
|
|
6
6
|
}) {
|
|
7
|
-
const className = ` text-
|
|
7
|
+
const className = ` text-muted-foreground ${textSize} font-medium font-['Inter'] leading-7 mb-5`;
|
|
8
8
|
return /* @__PURE__ */ jsx("h1", { ...props, className, children });
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTitle.js","sources":["../../../lib/components/layout/PageTitle.tsx"],"sourcesContent":["interface IPageTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n textSize?: string;\n children?: React.ReactNode;\n}\n\nexport default function PageTitle({\n children,\n textSize = \"text-2xl\",\n ...props\n}: IPageTitleProps) {\n // Combine textSize with the other fixed class names\n const className = ` text-
|
|
1
|
+
{"version":3,"file":"PageTitle.js","sources":["../../../lib/components/layout/PageTitle.tsx"],"sourcesContent":["interface IPageTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\r\n textSize?: string;\r\n children?: React.ReactNode;\r\n}\r\n\r\nexport default function PageTitle({\r\n children,\r\n textSize = \"text-2xl\",\r\n ...props\r\n}: IPageTitleProps) {\r\n // Combine textSize with the other fixed class names\r\n const className = ` text-muted-foreground ${textSize} font-medium font-['Inter'] leading-7 mb-5`;\r\n\r\n return (\r\n <h1 {...props} className={className}>\r\n {children}\r\n </h1>\r\n );\r\n}\r\n"],"names":[],"mappings":";AAKA,SAAwB,UAAU;AAAA,EAChC;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAoB;AAEZ,QAAA,YAAY,0BAA0B,QAAQ;AAEpD,SACG,oBAAA,MAAA,EAAI,GAAG,OAAO,WACZ,SACH,CAAA;AAEJ;"}
|
|
@@ -4,7 +4,7 @@ function SectionTitle({
|
|
|
4
4
|
textSize = "text-lg",
|
|
5
5
|
...props
|
|
6
6
|
}) {
|
|
7
|
-
const className = ` text-
|
|
7
|
+
const className = ` text-muted-foreground ${textSize} font-semibold font-['Inter'] leading-7 mb-3`;
|
|
8
8
|
return /* @__PURE__ */ jsx("div", { className: "border-b border-gray-300 pt-2 mb-5 ", children: /* @__PURE__ */ jsx("h2", { ...props, className, children }) });
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionTitle.js","sources":["../../../lib/components/layout/SectionTitle.tsx"],"sourcesContent":["import * as React from \"react\";\r\n\r\ninterface ISectionTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\r\n textSize?: string;\r\n children?: React.ReactNode;\r\n}\r\nexport default function SectionTitle({\r\n children,\r\n textSize = \"text-lg\",\r\n ...props\r\n}: ISectionTitleProps) {\r\n // Combine textSize with the other fixed class names\r\n const className = ` text-
|
|
1
|
+
{"version":3,"file":"SectionTitle.js","sources":["../../../lib/components/layout/SectionTitle.tsx"],"sourcesContent":["import * as React from \"react\";\r\n\r\ninterface ISectionTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\r\n textSize?: string;\r\n children?: React.ReactNode;\r\n}\r\nexport default function SectionTitle({\r\n children,\r\n textSize = \"text-lg\",\r\n ...props\r\n}: ISectionTitleProps) {\r\n // Combine textSize with the other fixed class names\r\n const className = ` text-muted-foreground ${textSize} font-semibold font-['Inter'] leading-7 mb-3`;\r\n\r\n return (\r\n <div className=\"border-b border-gray-300 pt-2 mb-5 \">\r\n <h2 {...props} className={className}>\r\n {children}\r\n </h2>\r\n </div>\r\n );\r\n}\r\n"],"names":[],"mappings":";AAMA,SAAwB,aAAa;AAAA,EACnC;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAuB;AAEf,QAAA,YAAY,0BAA0B,QAAQ;AAGlD,SAAA,oBAAC,OAAI,EAAA,WAAU,wCACb,UAAA,oBAAC,QAAI,GAAG,OAAO,WACZ,SACH,CAAA,EACF,CAAA;AAEJ;"}
|
|
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useEffect } from "react";
|
|
3
3
|
import SectionTitle from "../layout/SectionTitle.js";
|
|
4
4
|
import "../../tailwind-l0sNRNKZ.js";
|
|
5
|
+
import "../ui/multi-select.js";
|
|
5
6
|
import "../../index.esm-ifS8v9eQ.js";
|
|
6
7
|
import "../../jspdf.plugin.autotable-7hp3hM-a.js";
|
|
7
8
|
import "../../contexts/FederationContext.js";
|
|
@@ -9,7 +10,7 @@ import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
|
9
10
|
import { getFullName } from "../../utils/getFullName.js";
|
|
10
11
|
import { handleErrors } from "../../utils/handleErrors.js";
|
|
11
12
|
import { EApproverRoles } from "../../types.js";
|
|
12
|
-
import "../../Dialog-
|
|
13
|
+
import "../../Dialog-CCrUyF91.js";
|
|
13
14
|
import "../ui/ScrollArea.js";
|
|
14
15
|
import "../ui/input.js";
|
|
15
16
|
import "../ui/form.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileOverview.js","sources":["../../../lib/components/profiles/ProfileOverview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\r\nimport SectionTitle from \"../layout/SectionTitle\";\r\nimport {\r\n EApproverRoles,\r\n IProfileApprover,\r\n IStep,\r\n getFullName,\r\n handleErrors,\r\n useFederationContext,\r\n} from \"../../main\";\r\nimport { AxiosResponse } from \"axios\";\r\nimport IconInCircle from \"../layout/IconInCircle\";\r\n\r\ninterface ProfileOverviewProps {\r\n employeeId?: number;\r\n onProfileApproversChange?: (data: IProfileApprover[]) => void;\r\n steps: IStep[];\r\n}\r\n\r\ninterface IApproverRoleGroup {\r\n name: string;\r\n roles: EApproverRoles[];\r\n all: boolean;\r\n parallel: boolean;\r\n stepType: number;\r\n}\r\n\r\nconst approverRoleGroups: IApproverRoleGroup[] = [\r\n {\r\n name: \"Předschvalovatelé\",\r\n roles: [EApproverRoles.predschvalovatel],\r\n all: true,\r\n parallel: true,\r\n stepType: 1,\r\n },\r\n {\r\n name: \"Schvalovatelé\",\r\n roles: [\r\n EApproverRoles.vedouci,\r\n EApproverRoles.zastupce,\r\n EApproverRoles.zastupce9,\r\n EApproverRoles.vyssiSchvalovatel,\r\n EApproverRoles.vyssiSchvalovatelZastupce,\r\n EApproverRoles.vyssiSchvalovatelZastupce9,\r\n ],\r\n all: false,\r\n parallel: true,\r\n stepType: 2,\r\n },\r\n {\r\n name: \"Docházkový vedoucí\",\r\n roles: [EApproverRoles.dochazkovyVedouci],\r\n all: true,\r\n parallel: false,\r\n stepType: 3,\r\n },\r\n];\r\n\r\nexport default function ProfileOverview({\r\n employeeId,\r\n onProfileApproversChange,\r\n steps,\r\n}: ProfileOverviewProps) {\r\n const [profileApprovers, setProfileApprovers] = useState<\r\n Array<IProfileApprover>\r\n >([]);\r\n const context = useFederationContext();\r\n\r\n const currentApprovers = useMemo(() => {\r\n return approverRoleGroups.map((group) => {\r\n const groupApprovers = profileApprovers.filter((approver) =>\r\n group.roles.includes(approver.role)\r\n );\r\n\r\n const groupApprovedSteps = steps.filter(\r\n (step) =>\r\n step.type == group.stepType &&\r\n groupApprovers.some(\r\n (approver) =>\r\n step.employee.employeeId == approver?.approver?.employeeId\r\n )\r\n );\r\n\r\n return {\r\n ...group,\r\n numberOfApprovers: groupApprovers.length,\r\n numberOfApprovedSteps: groupApprovedSteps.length,\r\n isComplete:\r\n (group.all && groupApprovers.length == groupApprovedSteps.length) ||\r\n (!group.all && groupApprovedSteps.length > 0),\r\n };\r\n });\r\n }, [profileApprovers, steps]);\r\n\r\n useEffect(() => {\r\n context.apiClient\r\n .get<IProfileApprover[]>(\r\n \"/timeoff/approve-profile\" + (employeeId ? \"/\" + employeeId : \"\")\r\n )\r\n .then((response: AxiosResponse) => {\r\n setProfileApprovers(response.data);\r\n })\r\n .catch((error) => {\r\n handleErrors(\r\n error,\r\n context.emitter,\r\n \"Nepodařilo se dohledat schvalovací profil pro uživatele \" +\r\n employeeId\r\n );\r\n console.error(\"Error submitting form:\", error);\r\n });\r\n }, [employeeId, context.emitter, context.apiClient]);\r\n\r\n const decisionsTranslations = (decision: string): string | null => {\r\n const translations: { [key: string]: string } = {\r\n approved: \"Schváleno\",\r\n rejected: \"Zamítnuto\",\r\n cancelled: \"Stornováno\",\r\n evided: \"Zaevidováno\",\r\n };\r\n\r\n return translations[decision] || null;\r\n };\r\n // pri nacteni profileApprovers se muze dat vedet parent componente inbfo o aktualnich schvalovatelich\r\n useEffect(() => {\r\n if (onProfileApproversChange) onProfileApproversChange(profileApprovers);\r\n }, [profileApprovers, onProfileApproversChange]);\r\n\r\n const findStep = (\r\n steps: IStep[],\r\n group: IApproverRoleGroup,\r\n row: IProfileApprover\r\n ) => {\r\n return steps.find(\r\n (step) =>\r\n step.type == group.stepType &&\r\n step.employee.employeeId == row.position?.employee?.employeeId\r\n );\r\n };\r\n\r\n return (\r\n <>\r\n <SectionTitle>Postup schvalování</SectionTitle>\r\n <div className=\"flex gap-4\">\r\n {currentApprovers.map((group, index) => (\r\n <div\r\n key={group.name}\r\n className={\r\n \"w-full lg:w-1/3 rounded-lg shadow-xl p-5 border gap-4 flex flex-col \"\r\n }\r\n >\r\n <div className=\"flex justify-between\">\r\n <h3 className=\"text-xl font-bold\">\r\n {group.name} - {index}\r\n </h3>\r\n\r\n <IconInCircle\r\n isComplete={group.isComplete}\r\n title={\r\n group.numberOfApprovedSteps + \" / \" + group.numberOfApprovers\r\n }\r\n isPending={!group.isComplete}\r\n ></IconInCircle>\r\n </div>\r\n {profileApprovers\r\n .filter((it) => group.roles.includes(it.role))\r\n .map((row, index) => (\r\n <div\r\n key={index}\r\n className=\" border rounded-lg p-4 flex justify-between gap-5\"\r\n >\r\n <div>\r\n <h3 className=\"\">\r\n {getFullName(row.position?.employee, true, true)}\r\n </h3>\r\n <p className=\"text-sm \">{row.roleTxt}</p>\r\n {findStep(steps, group, row) && (\r\n <>\r\n <p className=\"text-sm \"></p>{\" \"}\r\n {findStep(steps, group, row)?.decision && (\r\n <p className=\"text-sm \">\r\n {decisionsTranslations(\r\n findStep(steps, group, row)?.decision || \"\"\r\n )}{\" \"}\r\n (\r\n {new Date(\r\n findStep(steps, group, row)?.date || 0\r\n ).toLocaleString()}\r\n )\r\n </p>\r\n )}\r\n {findStep(steps, group, row)?.comment && (\r\n <p className=\"text-sm \">\r\n <b>Komentář</b>:{\" \"}\r\n {findStep(steps, group, row)?.comment}{\" \"}\r\n </p>\r\n )}\r\n </>\r\n )}\r\n </div>\r\n <IconInCircle\r\n isComplete={findStep(steps, group, row) != null}\r\n isPending={!group.isComplete}\r\n />\r\n </div>\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["steps","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,qBAA2C;AAAA,EAC/C;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,eAAe,gBAAgB;AAAA,IACvC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,MACL,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,IACA,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,eAAe,iBAAiB;AAAA,IACxC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AACF;AAEA,SAAwB,gBAAgB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAE9C,CAAE,CAAA;AACJ,QAAM,UAAU;AAEV,QAAA,mBAAmB,QAAQ,MAAM;AAC9B,WAAA,mBAAm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,OAAO,GAAG,MAA1B,mBAA6B,aAC5B,qBAAC,KAAE,EAAA,WAAU,YACV,UAAA;AAAA,wBAAA;AAAA,4BACC,cAAS,OAAO,OAAO,GAAG,MAA1B,mBAA6B,aAAY;AAAA,wBAC3C;AAAA,wBAAG;AAAA,wBAAI;AAAA,wBAEN,IAAI;AAAA,4BACH,cAAS,OAAO,OAAO,GAAG,MAA1B,mBAA6B,SAAQ;AAAA,0BACrC,eAAe;AAAA,wBAAE;AAAA,sBAAA,GAErB;AAAA,wBAED,cAAS,OAAO,OAAO,GAAG,MAA1B,mBAA6B,YAC5B,qBAAC,KAAE,EAAA,WAAU,YACX,UAAA;AAAA,wBAAA,oBAAC,OAAE,UAAQ,WAAA,CAAA;AAAA,wBAAI;AAAA,wBAAE;AAAA,yBAChB,cAAS,OAAO,OAAO,GAAG,MAA1B,mBAA6B;AAAA,wBAAS;AAAA,sBAAA,GACzC;AAAA,oBAAA,GAEJ;AAAA,kBAAA,GAEJ;AAAA,kBACA;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,YAAY,SAAS,OAAO,OAAO,GAAG,KAAK;AAAA,sBAC3C,WAAW,CAAC,MAAM;AAAA,oBAAA;AAAA,kBACpB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAnCKA;AAAAA,YAAA;AAAA,WAqCR;AAAA,QAAA;AAAA,MAAA;AAAA,MA3DE,MAAM;AAAA,IA6Dd,CAAA,GACH;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ProfileOverview.js","sources":["../../../lib/components/profiles/ProfileOverview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\r\nimport SectionTitle from \"../layout/SectionTitle\";\r\nimport {\r\n EApproverRoles,\r\n IProfileApprover,\r\n IStep,\r\n getFullName,\r\n handleErrors,\r\n useFederationContext,\r\n} from \"../../main\";\r\nimport { AxiosResponse } from \"axios\";\r\nimport IconInCircle from \"../layout/IconInCircle\";\r\n\r\ninterface ProfileOverviewProps {\r\n employeeId?: number;\r\n onProfileApproversChange?: (data: IProfileApprover[]) => void;\r\n steps: IStep[];\r\n}\r\n\r\ninterface IApproverRoleGroup {\r\n name: string;\r\n roles: EApproverRoles[];\r\n all: boolean;\r\n parallel: boolean;\r\n stepType: number;\r\n}\r\n\r\nconst approverRoleGroups: IApproverRoleGroup[] = [\r\n {\r\n name: \"Předschvalovatelé\",\r\n roles: [EApproverRoles.predschvalovatel],\r\n all: true,\r\n parallel: true,\r\n stepType: 1,\r\n },\r\n {\r\n name: \"Schvalovatelé\",\r\n roles: [\r\n EApproverRoles.vedouci,\r\n EApproverRoles.zastupce,\r\n EApproverRoles.zastupce9,\r\n EApproverRoles.vyssiSchvalovatel,\r\n EApproverRoles.vyssiSchvalovatelZastupce,\r\n EApproverRoles.vyssiSchvalovatelZastupce9,\r\n ],\r\n all: false,\r\n parallel: true,\r\n stepType: 2,\r\n },\r\n {\r\n name: \"Docházkový vedoucí\",\r\n roles: [EApproverRoles.dochazkovyVedouci],\r\n all: true,\r\n parallel: false,\r\n stepType: 3,\r\n },\r\n];\r\n\r\nexport default function ProfileOverview({\r\n employeeId,\r\n onProfileApproversChange,\r\n steps,\r\n}: ProfileOverviewProps) {\r\n const [profileApprovers, setProfileApprovers] = useState<\r\n Array<IProfileApprover>\r\n >([]);\r\n const context = useFederationContext();\r\n\r\n const currentApprovers = useMemo(() => {\r\n return approverRoleGroups.map((group) => {\r\n const groupApprovers = profileApprovers.filter((approver) =>\r\n group.roles.includes(approver.role)\r\n );\r\n\r\n const groupApprovedSteps = steps.filter(\r\n (step) =>\r\n step.type == group.stepType &&\r\n groupApprovers.some(\r\n (approver) =>\r\n step.employee.employeeId == approver?.approver?.employeeId\r\n )\r\n );\r\n\r\n return {\r\n ...group,\r\n numberOfApprovers: groupApprovers.length,\r\n numberOfApprovedSteps: groupApprovedSteps.length,\r\n isComplete:\r\n (group.all && groupApprovers.length == groupApprovedSteps.length) ||\r\n (!group.all && groupApprovedSteps.length > 0),\r\n };\r\n });\r\n }, [profileApprovers, steps]);\r\n\r\n useEffect(() => {\r\n context.apiClient\r\n .get<IProfileApprover[]>(\r\n \"/timeoff/approve-profile\" + (employeeId ? \"/\" + employeeId : \"\")\r\n )\r\n .then((response: AxiosResponse) => {\r\n setProfileApprovers(response.data);\r\n })\r\n .catch((error) => {\r\n handleErrors(\r\n error,\r\n context.emitter,\r\n \"Nepodařilo se dohledat schvalovací profil pro uživatele \" +\r\n employeeId\r\n );\r\n console.error(\"Error submitting form:\", error);\r\n });\r\n }, [employeeId, context.emitter, context.apiClient]);\r\n\r\n const decisionsTranslations = (decision: string): string | null => {\r\n const translations: { [key: string]: string } = {\r\n approved: \"Schváleno\",\r\n rejected: \"Zamítnuto\",\r\n cancelled: \"Stornováno\",\r\n evided: \"Zaevidováno\",\r\n };\r\n\r\n return translations[decision] || null;\r\n };\r\n // pri nacteni profileApprovers se muze dat vedet parent componente inbfo o aktualnich schvalovatelich\r\n useEffect(() => {\r\n if (onProfileApproversChange) onProfileApproversChange(profileApprovers);\r\n }, [profileApprovers, onProfileApproversChange]);\r\n\r\n const findStep = (\r\n steps: IStep[],\r\n group: IApproverRoleGroup,\r\n row: IProfileApprover\r\n ) => {\r\n return steps.find(\r\n (step) =>\r\n step.type == group.stepType &&\r\n step.employee.employeeId == row.position?.employee?.employeeId\r\n );\r\n };\r\n\r\n return (\r\n <>\r\n <SectionTitle>Postup schvalování</SectionTitle>\r\n <div className=\"flex gap-4\">\r\n {currentApprovers.map((group, index) => (\r\n <div\r\n key={group.name}\r\n className={\r\n \"w-full lg:w-1/3 rounded-lg shadow-xl p-5 border gap-4 flex flex-col \"\r\n }\r\n >\r\n <div className=\"flex justify-between\">\r\n <h3 className=\"text-xl font-bold\">\r\n {group.name} - {index}\r\n </h3>\r\n\r\n <IconInCircle\r\n isComplete={group.isComplete}\r\n title={\r\n group.numberOfApprovedSteps + \" / \" + group.numberOfApprovers\r\n }\r\n isPending={!group.isComplete}\r\n ></IconInCircle>\r\n </div>\r\n {profileApprovers\r\n .filter((it) => group.roles.includes(it.role))\r\n .map((row, index) => (\r\n <div\r\n key={index}\r\n className=\" border rounded-lg p-4 flex justify-between gap-5\"\r\n >\r\n <div>\r\n <h3 className=\"\">\r\n {getFullName(row.position?.employee, true, true)}\r\n </h3>\r\n <p className=\"text-sm \">{row.roleTxt}</p>\r\n {findStep(steps, group, row) && (\r\n <>\r\n <p className=\"text-sm \"></p>{\" \"}\r\n {findStep(steps, group, row)?.decision && (\r\n <p className=\"text-sm \">\r\n {decisionsTranslations(\r\n findStep(steps, group, row)?.decision || \"\"\r\n )}{\" \"}\r\n (\r\n {new Date(\r\n findStep(steps, group, row)?.date || 0\r\n ).toLocaleString()}\r\n )\r\n </p>\r\n )}\r\n {findStep(steps, group, row)?.comment && (\r\n <p className=\"text-sm \">\r\n <b>Komentář</b>:{\" \"}\r\n {findStep(steps, group, row)?.comment}{\" \"}\r\n </p>\r\n )}\r\n </>\r\n )}\r\n </div>\r\n <IconInCircle\r\n isComplete={findStep(steps, group, row) != null}\r\n isPending={!group.isComplete}\r\n />\r\n </div>\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["steps","index"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,qBAA2C;AAAA,EAC/C;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,eAAe,gBAAgB;AAAA,IACvC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,MACL,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,IACA,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,eAAe,i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
|
|
3
3
|
import { cn } from "../../utils/utils.js";
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "./command.js";
|
|
6
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-
|
|
6
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-CcrzvSk7.js";
|
|
7
7
|
import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
|
|
8
8
|
import { X } from "../../x-DciOkaU0.js";
|
|
9
9
|
import { C as Check } from "../../check-B7dJm08z.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { f as format, C as Calendar$1, i as isValid } from "../../Calendar-DWT4e7Th.js";
|
|
4
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-
|
|
4
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from "../../popover-CcrzvSk7.js";
|
|
5
5
|
import { cn } from "../../utils/utils.js";
|
|
6
6
|
import { forwardRef, useState, useEffect } from "react";
|
|
7
7
|
import { Input } from "./input.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { t as toDate, c as constructFrom, s as setMonth, f as format, C as Calendar, i as isValid } from "../../Calendar-DWT4e7Th.js";
|
|
4
|
-
import { P as Popover, a as PopoverTrigger, b as PopoverContent, c as PopoverClose } from "../../popover-
|
|
4
|
+
import { P as Popover, a as PopoverTrigger, b as PopoverContent, c as PopoverClose } from "../../popover-CcrzvSk7.js";
|
|
5
5
|
import { cn } from "../../utils/utils.js";
|
|
6
6
|
import React__default, { forwardRef, useEffect } from "react";
|
|
7
7
|
import { Input } from "./input.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { D, c, e, i, g, f, b, a, h, d } from "../../Dialog-
|
|
3
|
+
import { D, c, e, i, g, f, b, a, h, d } from "../../Dialog-CCrUyF91.js";
|
|
4
4
|
import "../../utils/utils.js";
|
|
5
5
|
import "../../x-DciOkaU0.js";
|
|
6
6
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { P as Primitive } from "../../index-B761_inZ.js";
|
|
4
|
-
import { P as Presence } from "../../index-
|
|
5
|
-
import { c as createContextScope, b as composeEventHandlers, a as useCallbackRef, u as useLayoutEffect2 } from "../../index-
|
|
4
|
+
import { P as Presence } from "../../index-wO-IHm1z.js";
|
|
5
|
+
import { c as createContextScope, b as composeEventHandlers, a as useCallbackRef, u as useLayoutEffect2 } from "../../index-NZPkObcw.js";
|
|
6
6
|
import { u as useComposedRefs } from "../../index-D9mvqz1C.js";
|
|
7
7
|
import { u as useDirection } from "../../index-Bk8dRTPE.js";
|
|
8
8
|
import { c as clamp } from "../../index-IXOTxK3N.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "secondary" | "default" | "destructive" | "outline" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as cva } from "../../index-udNDzvjB.js";
|
|
3
|
+
import { cn } from "../../utils/utils.js";
|
|
4
|
+
const badgeVariants = cva(
|
|
5
|
+
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
10
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
11
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
12
|
+
outline: "text-foreground"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
function Badge({ className, variant, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
Badge,
|
|
25
|
+
badgeVariants
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../../lib/components/ui/badge.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { cva, type VariantProps } from \"class-variance-authority\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\n\r\nconst badgeVariants = cva(\r\n \"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\r\n {\r\n variants: {\r\n variant: {\r\n default:\r\n \"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80\",\r\n secondary:\r\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\r\n destructive:\r\n \"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80\",\r\n outline: \"text-foreground\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n },\r\n }\r\n);\r\n\r\nexport interface BadgeProps\r\n extends React.HTMLAttributes<HTMLDivElement>,\r\n VariantProps<typeof badgeVariants> {}\r\n\r\nfunction Badge({ className, variant, ...props }: BadgeProps) {\r\n return (\r\n <div className={cn(badgeVariants({ variant }), className)} {...props} />\r\n );\r\n}\r\n\r\nexport { Badge, badgeVariants };\r\n"],"names":[],"mappings":";;;AAKA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAMA,SAAS,MAAM,EAAE,WAAW,SAAS,GAAG,SAAqB;AAC3D,SACG,oBAAA,OAAA,EAAI,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAI,GAAG,MAAO,CAAA;AAE1E;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { u as useComposedRefs } from "../../index-D9mvqz1C.js";
|
|
4
|
-
import { c as createContextScope, b as composeEventHandlers } from "../../index-
|
|
5
|
-
import { u as useControllableState } from "../../index-
|
|
4
|
+
import { c as createContextScope, b as composeEventHandlers } from "../../index-NZPkObcw.js";
|
|
5
|
+
import { u as useControllableState } from "../../index-B0wyIFEr.js";
|
|
6
6
|
import { u as usePrevious } from "../../index-CshadhlS.js";
|
|
7
|
-
import { u as useSize } from "../../index-
|
|
8
|
-
import { P as Presence } from "../../index-
|
|
7
|
+
import { u as useSize } from "../../index-CK9QfV6i.js";
|
|
8
|
+
import { P as Presence } from "../../index-wO-IHm1z.js";
|
|
9
9
|
import { P as Primitive } from "../../index-B761_inZ.js";
|
|
10
10
|
import { cn } from "../../utils/utils.js";
|
|
11
11
|
import { C as Check } from "../../check-B7dJm08z.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default from "react";
|
|
4
|
-
import { R as Root, P as Portal, O as Overlay, C as Content, D as Dialog, e as DialogContent } from "../../Dialog-
|
|
4
|
+
import { R as Root, P as Portal, O as Overlay, C as Content, D as Dialog, e as DialogContent } from "../../Dialog-CCrUyF91.js";
|
|
5
5
|
import { P as Primitive } from "../../index-B761_inZ.js";
|
|
6
|
-
import { u as useId } from "../../index-
|
|
6
|
+
import { u as useId } from "../../index-DzfDO78K.js";
|
|
7
7
|
import { cn } from "../../utils/utils.js";
|
|
8
8
|
import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
|
|
9
9
|
/**
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { IOptionItem } from '../../types';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Variants for the multi-select component to handle different styles.
|
|
6
|
+
* Uses class-variance-authority (cva) to define different styles based on "variant" prop.
|
|
7
|
+
*/
|
|
8
|
+
declare const multiSelectVariants: (props?: ({
|
|
9
|
+
variant?: "secondary" | "default" | "destructive" | "inverted" | null | undefined;
|
|
10
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Props for MultiSelect component
|
|
13
|
+
*/
|
|
14
|
+
interface MultiSelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "value">, VariantProps<typeof multiSelectVariants> {
|
|
15
|
+
/**
|
|
16
|
+
* An array of option objects to be displayed in the multi-select component.
|
|
17
|
+
* Each option object has a label, value, and an optional icon.
|
|
18
|
+
*/
|
|
19
|
+
options: IOptionItem[];
|
|
20
|
+
/**
|
|
21
|
+
* Callback function triggered when the selected values change.
|
|
22
|
+
* Receives an array of the new selected values.
|
|
23
|
+
*/
|
|
24
|
+
onChange: (value: string[]) => void;
|
|
25
|
+
/** The controlled value of the component */
|
|
26
|
+
value?: string[];
|
|
27
|
+
/** The default selected values when the component mounts (uncontrolled mode) */
|
|
28
|
+
defaultValue?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Placeholder text to be displayed when no values are selected.
|
|
31
|
+
* Optional, defaults to "Select options".
|
|
32
|
+
*/
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Placeholder text to be displayed when no values are selected.
|
|
36
|
+
* Optional, defaults to "Select options".
|
|
37
|
+
*/
|
|
38
|
+
placeholderSearch?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum number of items to display. Extra selected items will be summarized.
|
|
41
|
+
* Optional, defaults to 3.
|
|
42
|
+
*/
|
|
43
|
+
maxCount?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The modality of the popover. When set to true, interaction with outside elements
|
|
46
|
+
* will be disabled and only popover content will be visible to screen readers.
|
|
47
|
+
* Optional, defaults to false.
|
|
48
|
+
*/
|
|
49
|
+
modalPopover?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* If true, renders the multi-select component as a child of another component.
|
|
52
|
+
* Optional, defaults to false.
|
|
53
|
+
*/
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Additional class names to apply custom styles to the multi-select component.
|
|
57
|
+
* Optional, can be used to add custom styles.
|
|
58
|
+
*/
|
|
59
|
+
className?: string;
|
|
60
|
+
/**
|
|
61
|
+
* If true, the multi-select component will be disabled.
|
|
62
|
+
* Optional, defaults to false.
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLButtonElement>>;
|
|
67
|
+
export {};
|