@esic-lab/data-core-ui 0.0.45 → 0.0.47

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/index.js CHANGED
@@ -377,7 +377,9 @@ __export(index_exports, {
377
377
  Loader: () => Loader,
378
378
  MenuNavBar: () => MenuNavBar,
379
379
  PrimaryButton: () => PrimaryButton,
380
+ ProfileSelect: () => ProfileSelect,
380
381
  ProgressBar: () => ProgressBar,
382
+ QRCodeGenerator: () => QRCodeGenerator,
381
383
  Radio: () => Radio,
382
384
  RadioGroup: () => RadioGroup,
383
385
  SecondaryButton: () => SecondaryButton,
@@ -391,6 +393,7 @@ __export(index_exports, {
391
393
  SortFilter: () => SortFilter,
392
394
  Switch: () => Switch,
393
395
  SwitchSelect: () => SwitchSelect,
396
+ TabProject: () => TabProject,
394
397
  TabSelectionButton: () => TabSelectionButton,
395
398
  TextAreaInput: () => TextAreaInput,
396
399
  TextInput: () => TextInput,
@@ -3750,41 +3753,66 @@ function Indicator({
3750
3753
  ],
3751
3754
  type,
3752
3755
  arrayData,
3753
- setArrayData
3756
+ setArrayData,
3757
+ canEdit,
3758
+ onDeleteClick
3754
3759
  }) {
3755
3760
  const [valueSwitch, setValueSwitch] = (0, import_react17.useState)("TEXT");
3756
3761
  const [cacheData, setCacheData] = (0, import_react17.useState)({
3757
3762
  indicatorType: type,
3758
3763
  inputType: valueSwitch,
3759
3764
  textValue: "",
3760
- numberValue: "",
3765
+ numberValue: 0,
3761
3766
  unit: ""
3762
3767
  });
3763
3768
  const [cacheEditData, setCacheEditData] = (0, import_react17.useState)({
3764
3769
  indicatorType: type,
3765
3770
  inputType: valueSwitch,
3766
3771
  textValue: "",
3767
- numberValue: "",
3772
+ numberValue: 0,
3768
3773
  unit: ""
3769
3774
  });
3770
3775
  const [editIndex, setEditIndex] = (0, import_react17.useState)(null);
3776
+ const [addError, setAddError] = (0, import_react17.useState)({});
3777
+ const [editError, setEditError] = (0, import_react17.useState)({});
3771
3778
  const handleAddIndicator = () => {
3772
- if (cacheData.textValue.trim() === "") return;
3773
- setArrayData([
3774
- ...arrayData,
3775
- valueSwitch === "TEXT" ? {
3776
- indicatorType: type,
3777
- inputType: "TEXT",
3778
- textValue: cacheData.textValue
3779
- } : cacheData
3780
- ]);
3779
+ const nextErr = {};
3780
+ const textValue = (cacheData.textValue ?? "").trim();
3781
+ const unit = (cacheData.unit ?? "").trim();
3782
+ if (textValue === "") {
3783
+ nextErr.textValue = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14";
3784
+ }
3785
+ if (valueSwitch === "NUMBER") {
3786
+ const num = cacheData.numberValue;
3787
+ if (num === void 0 || num === null || Number(num) <= 0) {
3788
+ nextErr.numberValue = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
3789
+ }
3790
+ if (unit === "") {
3791
+ nextErr.unit = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22";
3792
+ }
3793
+ }
3794
+ setAddError(nextErr);
3795
+ if (Object.keys(nextErr).length > 0) return;
3796
+ const newItem = valueSwitch === "TEXT" ? {
3797
+ indicatorType: type,
3798
+ inputType: "TEXT",
3799
+ textValue
3800
+ } : {
3801
+ indicatorType: type,
3802
+ inputType: "NUMBER",
3803
+ textValue,
3804
+ numberValue: Number(cacheData.numberValue),
3805
+ unit
3806
+ };
3807
+ setArrayData([...arrayData, newItem]);
3781
3808
  setCacheData({
3782
3809
  indicatorType: type,
3783
3810
  inputType: valueSwitch,
3784
3811
  textValue: "",
3785
- numberValue: "",
3812
+ numberValue: 0,
3786
3813
  unit: ""
3787
3814
  });
3815
+ setAddError({});
3788
3816
  };
3789
3817
  const handleChangeCashData = (key, value) => {
3790
3818
  setCacheData((prev) => ({
@@ -3810,11 +3838,32 @@ function Indicator({
3810
3838
  setEditIndex(null);
3811
3839
  };
3812
3840
  const handleConfirmEditIndicator = (index) => {
3813
- if (cacheEditData.textValue.trim() === "") return;
3841
+ const nextErr = {};
3842
+ const textValue = (cacheEditData.textValue ?? "").trim();
3843
+ const unit = (cacheEditData.unit ?? "").trim();
3844
+ const num = cacheEditData.numberValue;
3845
+ if (textValue === "") {
3846
+ nextErr.textValue = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14";
3847
+ }
3848
+ if (cacheEditData.inputType === "NUMBER") {
3849
+ if (num === void 0 || num === null || Number(num) <= 0) {
3850
+ nextErr.numberValue = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
3851
+ }
3852
+ if (unit === "") {
3853
+ nextErr.unit = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22";
3854
+ }
3855
+ }
3856
+ setEditError(nextErr);
3857
+ if (Object.keys(nextErr).length > 0) return;
3814
3858
  const newData = [...arrayData];
3815
- newData[index] = cacheEditData;
3859
+ newData[index] = {
3860
+ ...cacheEditData,
3861
+ textValue,
3862
+ ...cacheEditData.inputType === "NUMBER" ? { numberValue: Number(num), unit } : { numberValue: void 0, unit: void 0 }
3863
+ };
3816
3864
  setArrayData(newData);
3817
3865
  setEditIndex(null);
3866
+ setEditError({});
3818
3867
  };
3819
3868
  const handleChangeEditCashData = (e) => {
3820
3869
  const { name, value } = e.target;
@@ -3830,16 +3879,29 @@ function Indicator({
3830
3879
  {
3831
3880
  className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
3832
3881
  children: [
3833
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
3882
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3883
+ SwitchSelect,
3884
+ {
3885
+ option,
3886
+ onClick: handleClick,
3887
+ value: valueSwitch,
3888
+ label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17",
3889
+ required: true
3890
+ }
3891
+ ),
3834
3892
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3835
3893
  InputField,
3836
3894
  {
3837
3895
  label: `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3838
3896
  value: cacheData.textValue,
3839
3897
  className: "h-[32px]",
3840
- onChange: (e) => handleChangeCashData("textValue", String(e)),
3898
+ onChange: (val) => {
3899
+ handleChangeCashData("textValue", val ?? "");
3900
+ setAddError((p) => ({ ...p, textValue: void 0 }));
3901
+ },
3841
3902
  placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3842
- required: true
3903
+ required: true,
3904
+ error: addError.textValue
3843
3905
  }
3844
3906
  ),
3845
3907
  valueSwitch === "NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
@@ -3847,11 +3909,16 @@ function Indicator({
3847
3909
  InputFieldNumber,
3848
3910
  {
3849
3911
  label: `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3850
- value: cacheData.numberValue ?? "",
3912
+ value: cacheData.numberValue ?? 0,
3851
3913
  className: "h-[32px]",
3852
- onChange: (e) => handleChangeCashData("numberValue", String(e)),
3914
+ onChange: (val) => {
3915
+ handleChangeCashData("numberValue", val ?? 0);
3916
+ setAddError((p) => ({ ...p, numberValue: void 0 }));
3917
+ },
3918
+ min: 0,
3853
3919
  placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3854
- required: true
3920
+ required: true,
3921
+ error: addError.numberValue
3855
3922
  }
3856
3923
  ),
3857
3924
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -3860,53 +3927,83 @@ function Indicator({
3860
3927
  label: `\u0E2B\u0E19\u0E48\u0E27\u0E22`,
3861
3928
  value: cacheData.unit ?? "",
3862
3929
  className: "h-[32px]",
3863
- onChange: (e) => handleChangeCashData("unit", String(e)),
3930
+ onChange: (val) => {
3931
+ handleChangeCashData("unit", val ?? "");
3932
+ setAddError((p) => ({ ...p, unit: void 0 }));
3933
+ },
3864
3934
  placeholder: "\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22",
3865
- required: true
3935
+ required: true,
3936
+ error: addError.unit
3866
3937
  }
3867
3938
  )
3868
3939
  ] }),
3869
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_react12.IconCirclePlus, { onClick: handleAddIndicator, className: "mt-7 cursor-pointer", size: 32 })
3940
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3941
+ import_icons_react12.IconCirclePlus,
3942
+ {
3943
+ onClick: handleAddIndicator,
3944
+ className: "mt-8 cursor-pointer",
3945
+ size: 32
3946
+ }
3947
+ )
3870
3948
  ]
3871
3949
  }
3872
3950
  ),
3873
3951
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: arrayData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
3874
3952
  "div",
3875
3953
  {
3876
- className: `space-y-4 grid ${item.inputType === "TEXT" ? `grid-cols-[140px_1fr_50px_50px]` : `grid-cols-[140px_1fr_200px_150px_50px_50px]`} items-start`,
3954
+ className: `space-y-2 grid ${item.inputType === "TEXT" ? `grid-cols-[140px_1fr_50px_50px]` : `grid-cols-[140px_1fr_200px_150px_50px_50px]`} items-start`,
3877
3955
  children: [
3878
3956
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.inputType === "TEXT" ? "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }),
3879
- index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3880
- import_antd20.Input,
3881
- {
3882
- className: "body-1 mt-2",
3883
- variant: "underlined",
3884
- value: cacheEditData.textValue,
3885
- name: "textValue",
3886
- onChange: (e) => handleChangeEditCashData(e)
3887
- }
3888
- ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.textValue }),
3889
- item.inputType === "NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
3890
- index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3891
- import_antd20.Input,
3892
- {
3893
- className: "body-1 mt-2",
3894
- variant: "underlined",
3895
- value: cacheEditData.numberValue,
3896
- name: "numberValue",
3897
- onChange: (e) => handleChangeEditCashData(e)
3898
- }
3899
- ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.numberValue }),
3900
- index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3957
+ index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-[8px]", children: [
3958
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3901
3959
  import_antd20.Input,
3902
3960
  {
3903
3961
  className: "body-1 mt-2",
3904
3962
  variant: "underlined",
3905
- value: cacheEditData.unit,
3906
- name: "unit",
3907
- onChange: (e) => handleChangeEditCashData(e)
3963
+ value: cacheEditData.textValue,
3964
+ name: "textValue",
3965
+ onChange: (e) => {
3966
+ handleChangeEditCashData(e);
3967
+ setEditError((p) => ({ ...p, textValue: void 0 }));
3968
+ }
3908
3969
  }
3909
- ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.unit })
3970
+ ),
3971
+ editError.textValue && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-red-500 caption-1", children: editError.textValue })
3972
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.textValue }),
3973
+ item.inputType === "NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
3974
+ index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-[8px]", children: [
3975
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3976
+ import_antd20.Input,
3977
+ {
3978
+ type: "number",
3979
+ className: "body-1 mt-2",
3980
+ variant: "underlined",
3981
+ value: cacheEditData.numberValue,
3982
+ name: "numberValue",
3983
+ onChange: (e) => {
3984
+ handleChangeEditCashData(e);
3985
+ setEditError((p) => ({ ...p, numberValue: void 0 }));
3986
+ }
3987
+ }
3988
+ ),
3989
+ editError.numberValue && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-red-500 caption-1", children: editError.numberValue })
3990
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.numberValue }),
3991
+ index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col gap-[8px]", children: [
3992
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3993
+ import_antd20.Input,
3994
+ {
3995
+ className: "body-1 mt-2",
3996
+ variant: "underlined",
3997
+ value: cacheEditData.unit,
3998
+ name: "unit",
3999
+ onChange: (e) => {
4000
+ handleChangeEditCashData(e);
4001
+ setEditError((p) => ({ ...p, unit: void 0 }));
4002
+ }
4003
+ }
4004
+ ),
4005
+ editError.unit && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-red-500 caption-1", children: editError.unit })
4006
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2", children: item.unit })
3910
4007
  ] }),
3911
4008
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2 flex", children: editIndex !== null ? editIndex === index ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex", children: [
3912
4009
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -3916,11 +4013,36 @@ function Indicator({
3916
4013
  onClick: () => handleConfirmEditIndicator(index)
3917
4014
  }
3918
4015
  ),
3919
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_react12.IconX, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
3920
- ] }) : void 0 : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_react12.IconPencil, { className: "cursor-pointer", onClick: () => handleEditIndicator(index) }) }),
3921
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_react12.IconTrash, { onClick: () => handleDeleteIndicator(index) }) })
4016
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4017
+ import_icons_react12.IconX,
4018
+ {
4019
+ className: "cursor-pointer text-red-600",
4020
+ onClick: handleCancelEditIndicator
4021
+ }
4022
+ )
4023
+ ] }) : void 0 : canEdit && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4024
+ import_icons_react12.IconPencil,
4025
+ {
4026
+ className: "cursor-pointer",
4027
+ onClick: () => handleEditIndicator(index)
4028
+ }
4029
+ ) }),
4030
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4031
+ import_icons_react12.IconTrash,
4032
+ {
4033
+ onClick: () => {
4034
+ const confirm = () => handleDeleteIndicator(index);
4035
+ if (onDeleteClick) {
4036
+ onDeleteClick({ index, item, confirm });
4037
+ } else {
4038
+ confirm();
4039
+ }
4040
+ }
4041
+ }
4042
+ ) })
3922
4043
  ]
3923
- }
4044
+ },
4045
+ index
3924
4046
  )) })
3925
4047
  ] });
3926
4048
  }
@@ -3962,6 +4084,406 @@ var FilterPopUp = (filter) => {
3962
4084
  ] }) : void 0
3963
4085
  ] });
3964
4086
  };
4087
+
4088
+ // src/ProfileSelect/ProfileSelect/ProfileSelect.tsx
4089
+ var import_react19 = require("react");
4090
+ var import_icons_react14 = require("@tabler/icons-react");
4091
+ var import_antd21 = require("antd");
4092
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4093
+ function ProfileSelect({
4094
+ allUser,
4095
+ assignUser,
4096
+ mode,
4097
+ onUpdateAssignUser
4098
+ }) {
4099
+ const [maxVisible, setMaxVisible] = (0, import_react19.useState)(4);
4100
+ const [userNotAssign, setUserNotAssign] = (0, import_react19.useState)([]);
4101
+ const [search, setSearch] = (0, import_react19.useState)("");
4102
+ const [isShowSelect, setIsShowSelect] = (0, import_react19.useState)(false);
4103
+ const containerRef = (0, import_react19.useRef)(null);
4104
+ const selectRef = (0, import_react19.useRef)(null);
4105
+ const avatarSize = 30;
4106
+ const spacing = 8;
4107
+ (0, import_react19.useEffect)(() => {
4108
+ const handler = (e) => {
4109
+ if (!selectRef?.current?.contains(e.target) && !containerRef?.current?.contains(e.target)) {
4110
+ setIsShowSelect(false);
4111
+ }
4112
+ };
4113
+ document.addEventListener("mousedown", handler);
4114
+ return () => {
4115
+ document.removeEventListener("mousedown", handler);
4116
+ };
4117
+ }, []);
4118
+ (0, import_react19.useEffect)(() => {
4119
+ if (!containerRef.current) return;
4120
+ const updateWidth = () => {
4121
+ if (containerRef.current) {
4122
+ const rect = containerRef.current.getBoundingClientRect();
4123
+ const count = Math.floor(rect.width / (avatarSize + spacing));
4124
+ setMaxVisible(Math.max(1, count));
4125
+ }
4126
+ };
4127
+ const resizeObserver = new ResizeObserver(updateWidth);
4128
+ resizeObserver.observe(containerRef.current);
4129
+ updateWidth();
4130
+ return () => {
4131
+ resizeObserver.disconnect();
4132
+ };
4133
+ }, [allUser]);
4134
+ (0, import_react19.useEffect)(() => {
4135
+ setUserNotAssign(
4136
+ allUser.filter((u) => !assignUser.some((au) => au.id === u.id))
4137
+ );
4138
+ }, [allUser, assignUser]);
4139
+ const showPlus = assignUser.length > maxVisible;
4140
+ const visibleUsers = showPlus ? assignUser.slice(0, maxVisible - 1) : assignUser;
4141
+ const extraCount = assignUser.length - (maxVisible - 1);
4142
+ const normalizedSearch = search.trim().toLowerCase();
4143
+ const filteredAssigned = normalizedSearch ? assignUser.filter(
4144
+ (u) => u.name.toLowerCase().includes(normalizedSearch)
4145
+ ) : assignUser;
4146
+ const filteredUnassigned = normalizedSearch ? userNotAssign.filter(
4147
+ (u) => u.name.toLowerCase().includes(normalizedSearch)
4148
+ ) : userNotAssign;
4149
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref: containerRef, className: "relative body-1", children: [
4150
+ mode === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4151
+ import_icons_react14.IconUsers,
4152
+ {
4153
+ size: 40,
4154
+ className: "p-2 border rounded cursor-pointer",
4155
+ onClick: () => setIsShowSelect(!isShowSelect)
4156
+ }
4157
+ ) }) : mode === "showAssign" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4158
+ "button",
4159
+ {
4160
+ className: "w-full h-[40px] flex -space-x-2 p-2 border-1 rounded-sm",
4161
+ onClick: () => setIsShowSelect(!isShowSelect),
4162
+ children: [
4163
+ visibleUsers.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex items-center cursor-point", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "relative group cursor-pointer", children: [
4164
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4165
+ "img",
4166
+ {
4167
+ src: user.profile,
4168
+ alt: user.name,
4169
+ style: {
4170
+ width: avatarSize,
4171
+ height: avatarSize,
4172
+ borderRadius: "50%"
4173
+ },
4174
+ className: "border border-white group-hover:border-2 group-hover:border-red-500 transition"
4175
+ }
4176
+ ),
4177
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4178
+ "span",
4179
+ {
4180
+ className: "absolute top-0 right-0 -translate-y-2 translate-x-2 \r\n rounded-full bg-white opacity-0 group-hover:opacity-100 \r\n border-2 border-red-500 flex items-center justify-center transition",
4181
+ onClick: () => onUpdateAssignUser(user, "remove"),
4182
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconX, { className: "w-4 h-4 text-red-500" })
4183
+ }
4184
+ )
4185
+ ] }) }, user.id)),
4186
+ showPlus && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4187
+ "div",
4188
+ {
4189
+ className: "border border-white flex items-center justify-center bg-gray-300 text-black text-sm",
4190
+ style: {
4191
+ width: avatarSize,
4192
+ height: avatarSize,
4193
+ borderRadius: "50%"
4194
+ },
4195
+ children: [
4196
+ "+",
4197
+ extraCount
4198
+ ]
4199
+ }
4200
+ )
4201
+ ]
4202
+ }
4203
+ ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "w-full h-[40px] flex -space-x-2 p-2 border-1 rounded-sm", children: [
4204
+ visibleUsers.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex items-center ", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { className: "relative group ", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4205
+ "img",
4206
+ {
4207
+ src: user.profile,
4208
+ alt: user.name,
4209
+ style: {
4210
+ width: avatarSize,
4211
+ height: avatarSize,
4212
+ borderRadius: "50%"
4213
+ },
4214
+ className: "border border-white transition"
4215
+ }
4216
+ ) }) }, user.id)),
4217
+ showPlus && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4218
+ "div",
4219
+ {
4220
+ className: "border border-white flex items-center justify-center bg-gray-300 text-black text-sm",
4221
+ style: {
4222
+ width: avatarSize,
4223
+ height: avatarSize,
4224
+ borderRadius: "50%"
4225
+ },
4226
+ children: [
4227
+ "+",
4228
+ extraCount
4229
+ ]
4230
+ }
4231
+ )
4232
+ ] }),
4233
+ isShowSelect ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4234
+ "div",
4235
+ {
4236
+ className: "absolute top-12 min-w-[261px] max-w-[400px] w-full h-[314px] p-2 text-xs border-1 rounded-sm ",
4237
+ ref: selectRef,
4238
+ children: [
4239
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex border-1 rounded-md p-2 gap-2 items-center", children: [
4240
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconSearch, {}),
4241
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4242
+ import_antd21.Input,
4243
+ {
4244
+ variant: "borderless",
4245
+ placeholder: "\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E0A\u0E37\u0E48\u0E2D",
4246
+ className: "body-3",
4247
+ value: search,
4248
+ onChange: (e) => setSearch(e.target.value)
4249
+ }
4250
+ )
4251
+ ] }),
4252
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "overflow-y-auto h-[250px] pt-2 px-4 body-3", children: [
4253
+ filteredAssigned.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
4254
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: "\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01" }),
4255
+ filteredAssigned.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4256
+ "button",
4257
+ {
4258
+ className: "flex items-center group my-1 w-full p-1 rounded hover:bg-gray-100",
4259
+ onClick: () => onUpdateAssignUser(user, "remove"),
4260
+ children: [
4261
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "relative cursor-pointer", children: [
4262
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4263
+ "img",
4264
+ {
4265
+ src: user.profile,
4266
+ alt: user.name,
4267
+ style: {
4268
+ width: avatarSize,
4269
+ height: avatarSize,
4270
+ borderRadius: "50%"
4271
+ },
4272
+ className: "border-2 border-red-500"
4273
+ }
4274
+ ),
4275
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4276
+ "span",
4277
+ {
4278
+ className: "absolute top-0 right-0 -translate-y-2 translate-x-2 \r\n rounded-full bg-white opacity-0 group-hover:opacity-100 \r\n border-2 border-red-500 flex items-center justify-center transition",
4279
+ onClick: () => onUpdateAssignUser(user, "remove"),
4280
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons_react14.IconX, { className: "text-red-500", size: 15 })
4281
+ }
4282
+ )
4283
+ ] }),
4284
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ml-2", children: user.name })
4285
+ ]
4286
+ },
4287
+ user.id
4288
+ ))
4289
+ ] }),
4290
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { children: "\u0E1C\u0E39\u0E49\u0E04\u0E19 " }),
4291
+ filteredUnassigned.map((user) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4292
+ "button",
4293
+ {
4294
+ className: "flex items-center my-1 hover:bg-gray-100 w-full p-1 rounded",
4295
+ onClick: () => onUpdateAssignUser(user),
4296
+ children: [
4297
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4298
+ "img",
4299
+ {
4300
+ src: user.profile,
4301
+ alt: user.name,
4302
+ style: {
4303
+ width: avatarSize,
4304
+ height: avatarSize,
4305
+ borderRadius: "50%"
4306
+ },
4307
+ className: "border "
4308
+ }
4309
+ ),
4310
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ml-2", children: user.name })
4311
+ ]
4312
+ },
4313
+ user.id
4314
+ ))
4315
+ ] })
4316
+ ]
4317
+ }
4318
+ ) : null
4319
+ ] });
4320
+ }
4321
+
4322
+ // src/Button/QRCode/QRCode.tsx
4323
+ var import_react20 = require("react");
4324
+ var import_qrcode = __toESM(require("qrcode"));
4325
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4326
+ var QRCodeGenerator = ({
4327
+ url,
4328
+ previewSize = 200,
4329
+ defaultExportSize = 512,
4330
+ fileBaseName = "qr-code"
4331
+ }) => {
4332
+ const canvasRef = (0, import_react20.useRef)(null);
4333
+ const [format3, setFormat] = (0, import_react20.useState)("png");
4334
+ const [exportSize, setExportSize] = (0, import_react20.useState)(defaultExportSize);
4335
+ const sizeOption = [
4336
+ {
4337
+ label: "64 x 64",
4338
+ value: "64"
4339
+ },
4340
+ {
4341
+ label: "128 x 128",
4342
+ value: "128"
4343
+ },
4344
+ {
4345
+ label: "256 x 256",
4346
+ value: "256"
4347
+ },
4348
+ {
4349
+ label: "512 x 512",
4350
+ value: "512"
4351
+ },
4352
+ {
4353
+ label: "1024 x 1024",
4354
+ value: "1024"
4355
+ },
4356
+ {
4357
+ label: "2048 x 2048",
4358
+ value: "2048"
4359
+ },
4360
+ {
4361
+ label: "4096 x 4096",
4362
+ value: "4096"
4363
+ }
4364
+ ];
4365
+ const typeOption = [
4366
+ {
4367
+ label: "PNG",
4368
+ value: "png"
4369
+ },
4370
+ {
4371
+ label: "SVG",
4372
+ value: "svg"
4373
+ },
4374
+ {
4375
+ label: "JPEG",
4376
+ value: "jpeg"
4377
+ }
4378
+ ];
4379
+ (0, import_react20.useEffect)(() => {
4380
+ if (!canvasRef.current) return;
4381
+ import_qrcode.default.toCanvas(canvasRef.current, url, { width: previewSize, margin: 1 }, (error) => {
4382
+ if (error) console.error(error);
4383
+ });
4384
+ }, [url, previewSize]);
4385
+ const download = async () => {
4386
+ try {
4387
+ if (format3 === "svg") {
4388
+ const svgString = await import_qrcode.default.toString(url, {
4389
+ type: "svg",
4390
+ width: exportSize,
4391
+ margin: 1
4392
+ });
4393
+ const blob = new Blob([svgString], { type: "image/svg+xml" });
4394
+ const objUrl = URL.createObjectURL(blob);
4395
+ triggerDownload(objUrl, `${fileBaseName}.svg`);
4396
+ URL.revokeObjectURL(objUrl);
4397
+ } else {
4398
+ const offscreen = document.createElement("canvas");
4399
+ await import_qrcode.default.toCanvas(offscreen, url, {
4400
+ width: exportSize,
4401
+ margin: 1
4402
+ });
4403
+ const mime = format3 === "png" ? "image/png" : "image/jpeg";
4404
+ const dataURL = format3 === "jpeg" ? offscreen.toDataURL(mime, 0.92) : offscreen.toDataURL(mime);
4405
+ triggerDownload(dataURL, `${fileBaseName}.${format3}`);
4406
+ }
4407
+ } catch (err) {
4408
+ console.error("Failed to generate QR export:", err);
4409
+ alert("Sorry, something went wrong creating the download.");
4410
+ }
4411
+ };
4412
+ const triggerDownload = (href, filename) => {
4413
+ const a = document.createElement("a");
4414
+ a.href = href;
4415
+ a.download = filename;
4416
+ document.body.appendChild(a);
4417
+ a.click();
4418
+ a.remove();
4419
+ };
4420
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { style: { display: "inline-flex", flexDirection: "column", gap: 8 }, className: "justify-center items-center", children: [
4421
+ url === "" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "border-1 p-2 mb-2", style: { width: `${previewSize}px`, height: `${previewSize}px` } }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("canvas", { ref: canvasRef, className: "border-1 p-2 mb-2" }),
4422
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4423
+ "div",
4424
+ {
4425
+ style: {
4426
+ display: "flex",
4427
+ gap: 8,
4428
+ alignItems: "center",
4429
+ flexWrap: "wrap"
4430
+ },
4431
+ className: "flex-col",
4432
+ children: [
4433
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-2 mx-2", children: [
4434
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "border-1 p-2 rounded-md flex flex-col w-1/2 text-sm text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4435
+ SelectField,
4436
+ {
4437
+ label: "\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A",
4438
+ value: format3,
4439
+ onChange: (e) => setFormat(e.target.value),
4440
+ options: typeOption
4441
+ }
4442
+ ) }),
4443
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "border-1 p-2 rounded-md flex flex-col w-1/2 text-sm text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4444
+ SelectField,
4445
+ {
4446
+ label: "\u0E02\u0E19\u0E32\u0E14 (px)",
4447
+ value: exportSize,
4448
+ onChange: (e) => setExportSize(Number(e.target.value)),
4449
+ options: sizeOption
4450
+ }
4451
+ ) })
4452
+ ] }),
4453
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PrimaryButton, { onClick: download, disabled: url === "", textColor: "white", title: "\u0E14\u0E32\u0E27\u0E42\u0E2B\u0E25\u0E14\u0E23\u0E2B\u0E31\u0E2A QR" })
4454
+ ]
4455
+ }
4456
+ )
4457
+ ] });
4458
+ };
4459
+
4460
+ // src/TabPropject/Tabproject/TabProject.tsx
4461
+ var import_antd22 = require("antd");
4462
+ var import_jsx_runtime44 = require("react/jsx-runtime");
4463
+ function TabProject({ tabOption, now, onChange }) {
4464
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4465
+ import_antd22.Tabs,
4466
+ {
4467
+ activeKey: now,
4468
+ items: tabOption.map((item, i) => {
4469
+ return {
4470
+ key: item.key,
4471
+ label: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
4472
+ "button",
4473
+ {
4474
+ className: "tab-label flex gap-2 items-center body-1",
4475
+ onClick: () => onChange(item.key),
4476
+ children: [
4477
+ item.icon,
4478
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label })
4479
+ ]
4480
+ }
4481
+ )
4482
+ };
4483
+ })
4484
+ }
4485
+ );
4486
+ }
3965
4487
  // Annotate the CommonJS export names for ESM import in node:
3966
4488
  0 && (module.exports = {
3967
4489
  AntDModal,
@@ -3986,7 +4508,9 @@ var FilterPopUp = (filter) => {
3986
4508
  Loader,
3987
4509
  MenuNavBar,
3988
4510
  PrimaryButton,
4511
+ ProfileSelect,
3989
4512
  ProgressBar,
4513
+ QRCodeGenerator,
3990
4514
  Radio,
3991
4515
  RadioGroup,
3992
4516
  SecondaryButton,
@@ -4000,6 +4524,7 @@ var FilterPopUp = (filter) => {
4000
4524
  SortFilter,
4001
4525
  Switch,
4002
4526
  SwitchSelect,
4527
+ TabProject,
4003
4528
  TabSelectionButton,
4004
4529
  TextAreaInput,
4005
4530
  TextInput,