nexaas-ui-components 1.0.21 → 1.0.22
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.cjs +772 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +771 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,8 @@ var reactSelect = require('react-select');
|
|
|
18
18
|
var AsyncSelect = require('react-select/async');
|
|
19
19
|
var reactTable = require('@tanstack/react-table');
|
|
20
20
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
21
|
+
var Fuse = require('fuse.js');
|
|
22
|
+
var reactPapaparse = require('react-papaparse');
|
|
21
23
|
|
|
22
24
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
25
|
|
|
@@ -46,6 +48,7 @@ var lodashNamespace__namespace = /*#__PURE__*/_interopNamespace(lodashNamespace)
|
|
|
46
48
|
var InputMask__default = /*#__PURE__*/_interopDefault(InputMask);
|
|
47
49
|
var ReactModalNamespace__namespace = /*#__PURE__*/_interopNamespace(ReactModalNamespace);
|
|
48
50
|
var AsyncSelect__default = /*#__PURE__*/_interopDefault(AsyncSelect);
|
|
51
|
+
var Fuse__default = /*#__PURE__*/_interopDefault(Fuse);
|
|
49
52
|
|
|
50
53
|
// src/components/Button.tsx
|
|
51
54
|
var SpinnerIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -96,7 +99,7 @@ var variants = {
|
|
|
96
99
|
text: "shadow-button bg-surface border-[0.5px] border-neutral-400 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-600 active:text-neutral-600 active:shadow-none disabled:text-neutral-400 disabled:opacity-50"
|
|
97
100
|
},
|
|
98
101
|
icon: {
|
|
99
|
-
text: "shadow-button bg-white border-[0.5px] border-neutral-300 text-neutral-500 hover:bg-[#f5f5f5] hover:text-neutral-600 active:bg-neutral-100 active:text-neutral-600 disabled:text-neutral-400 disabled:border-[0.5px] disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
102
|
+
text: "shadow-button gap-1 bg-white border-[0.5px] border-neutral-300 text-neutral-500 hover:bg-[#f5f5f5] hover:text-neutral-600 active:bg-neutral-100 active:text-neutral-600 disabled:text-neutral-400 disabled:border-[0.5px] disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
100
103
|
},
|
|
101
104
|
outline: {
|
|
102
105
|
text: "shadow-button bg-surface border-[0.5px] border-rose-500 text-rose-500 hover:bg-rose-50 hover:text-rose-600 active:bg-rose-100 active:text-rose-600 disabled:bg-surface disabled:border-[0.5px] disabled:border-rose-700 disabled:opacity-50 active:shadow-none"
|
|
@@ -232,7 +235,7 @@ var Button = ({
|
|
|
232
235
|
};
|
|
233
236
|
var sizes2 = {
|
|
234
237
|
xxs: {
|
|
235
|
-
text: "min-h-[14px] max-h-[40px]"
|
|
238
|
+
text: "min-h-[14px] max-h-[40px] text-[14px] gap-[4px]"
|
|
236
239
|
},
|
|
237
240
|
xs: {
|
|
238
241
|
text: "h-[36px]"
|
|
@@ -3222,15 +3225,15 @@ var SelectFieldBip = ({
|
|
|
3222
3225
|
}
|
|
3223
3226
|
);
|
|
3224
3227
|
} else if (debounce2 && inputValue.length < debounce2) {
|
|
3225
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-
|
|
3228
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "var(--label)" }, className: "p-2 text-[14px]", children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
3226
3229
|
}
|
|
3227
3230
|
};
|
|
3228
3231
|
const NoOptionsMessage = (props) => {
|
|
3229
3232
|
var _a2;
|
|
3230
3233
|
if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
|
|
3231
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-
|
|
3234
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-[14px]", style: { color: "var(--label)" }, children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
3232
3235
|
} else if (inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
3233
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-
|
|
3236
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-[14px]", style: { color: "var(--label)" }, children: messages.emptyMessage });
|
|
3234
3237
|
}
|
|
3235
3238
|
};
|
|
3236
3239
|
const DropdownIndicatorCustom = (props) => {
|
|
@@ -4608,6 +4611,767 @@ var EditableText = ({
|
|
|
4608
4611
|
}
|
|
4609
4612
|
);
|
|
4610
4613
|
};
|
|
4614
|
+
var EditableTextSelect = ({
|
|
4615
|
+
control,
|
|
4616
|
+
name,
|
|
4617
|
+
emptyLabel,
|
|
4618
|
+
options,
|
|
4619
|
+
optionStyle,
|
|
4620
|
+
valueStyle,
|
|
4621
|
+
showInputSeach,
|
|
4622
|
+
onChangeValue
|
|
4623
|
+
}) => {
|
|
4624
|
+
const [showModal, setShowModal] = React4.useState(false);
|
|
4625
|
+
const [optionsList, setOptionsList] = React4.useState(() => options);
|
|
4626
|
+
const [inputSearch, setInputSearch] = React4.useState("");
|
|
4627
|
+
const optionsFuse = {
|
|
4628
|
+
includeScore: false,
|
|
4629
|
+
keys: ["name"]
|
|
4630
|
+
};
|
|
4631
|
+
const fuse = new Fuse__default.default(optionsList, optionsFuse);
|
|
4632
|
+
const filter = () => {
|
|
4633
|
+
var _a;
|
|
4634
|
+
let results = [...options];
|
|
4635
|
+
if (inputSearch) {
|
|
4636
|
+
results = (_a = fuse.search(inputSearch)) == null ? void 0 : _a.map((result) => result.item);
|
|
4637
|
+
}
|
|
4638
|
+
setOptionsList(results);
|
|
4639
|
+
};
|
|
4640
|
+
React4.useEffect(() => {
|
|
4641
|
+
setOptionsList(() => options);
|
|
4642
|
+
}, [options]);
|
|
4643
|
+
React4.useEffect(() => {
|
|
4644
|
+
filter();
|
|
4645
|
+
}, [inputSearch]);
|
|
4646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4647
|
+
reactHookForm.Controller,
|
|
4648
|
+
{
|
|
4649
|
+
control,
|
|
4650
|
+
name,
|
|
4651
|
+
render: ({ field }) => {
|
|
4652
|
+
var _a;
|
|
4653
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu, { children: [
|
|
4654
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Menu.Button, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4655
|
+
"div",
|
|
4656
|
+
{
|
|
4657
|
+
className: "group flex gap-[5px] cursor-pointer z-[500] items-center",
|
|
4658
|
+
onClick: () => setShowModal(!showModal),
|
|
4659
|
+
children: [
|
|
4660
|
+
field.value ? valueStyle ? valueStyle(field.value) : (_a = field == null ? void 0 : field.value) == null ? void 0 : _a.name : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4661
|
+
"label",
|
|
4662
|
+
{
|
|
4663
|
+
className: clsx9__default.default(
|
|
4664
|
+
{
|
|
4665
|
+
["text-label"]: !field.value,
|
|
4666
|
+
["text-paragraph"]: field.value
|
|
4667
|
+
},
|
|
4668
|
+
"text-p-md group-hover:underline group-hover:underline-offset-[3px] cursor-pointer decoration-blue-500"
|
|
4669
|
+
),
|
|
4670
|
+
children: emptyLabel ? emptyLabel : "N\xE3o informado"
|
|
4671
|
+
}
|
|
4672
|
+
),
|
|
4673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4674
|
+
"i",
|
|
4675
|
+
{
|
|
4676
|
+
style: { fontSize: "16px" },
|
|
4677
|
+
className: "uil uil-pen text-sm text-blue-500"
|
|
4678
|
+
}
|
|
4679
|
+
)
|
|
4680
|
+
]
|
|
4681
|
+
}
|
|
4682
|
+
) }),
|
|
4683
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Menu.Items, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[294px] p-2 bg-white border border-neutral-300 absolute z-[500] rounded-lg", children: [
|
|
4684
|
+
showInputSeach && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4685
|
+
InputSmall,
|
|
4686
|
+
{
|
|
4687
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-search" }),
|
|
4688
|
+
onChange: (e) => setInputSearch(e),
|
|
4689
|
+
value: inputSearch,
|
|
4690
|
+
placeholder: "Pesquisar",
|
|
4691
|
+
clearField: true,
|
|
4692
|
+
onKeyDown: (e) => {
|
|
4693
|
+
if (e.key == " " || e.code == "Space") {
|
|
4694
|
+
e.stopPropagation();
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
) }),
|
|
4699
|
+
optionsList == null ? void 0 : optionsList.map((opt) => {
|
|
4700
|
+
var _a2;
|
|
4701
|
+
const selected = (opt == null ? void 0 : opt.id) === ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.id);
|
|
4702
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4703
|
+
react.Menu.Item,
|
|
4704
|
+
{
|
|
4705
|
+
onClick: () => {
|
|
4706
|
+
field.onChange(opt);
|
|
4707
|
+
if (onChangeValue) {
|
|
4708
|
+
onChangeValue(opt);
|
|
4709
|
+
}
|
|
4710
|
+
},
|
|
4711
|
+
as: "button",
|
|
4712
|
+
className: clsx9__default.default(
|
|
4713
|
+
"p-3 mb-1 rounded-lg items-center flex whitespace-nowrap no-underline w-full",
|
|
4714
|
+
{
|
|
4715
|
+
"bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]": selected
|
|
4716
|
+
},
|
|
4717
|
+
{
|
|
4718
|
+
"hover:bg-neutral-100 text-paragraph": !selected
|
|
4719
|
+
},
|
|
4720
|
+
{
|
|
4721
|
+
"cursor-pointer": !opt.disabled
|
|
4722
|
+
}
|
|
4723
|
+
),
|
|
4724
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 w-full items-center whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full justify-between items-center", children: [
|
|
4725
|
+
optionStyle ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: optionStyle(opt) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
4726
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: opt == null ? void 0 : opt.title }),
|
|
4727
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4728
|
+
"span",
|
|
4729
|
+
{
|
|
4730
|
+
className: clsx9__default.default({
|
|
4731
|
+
"text-label": opt.disabled
|
|
4732
|
+
}),
|
|
4733
|
+
children: opt.name
|
|
4734
|
+
}
|
|
4735
|
+
),
|
|
4736
|
+
opt == null ? void 0 : opt.description
|
|
4737
|
+
] }),
|
|
4738
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4739
|
+
"span",
|
|
4740
|
+
{
|
|
4741
|
+
className: clsx9__default.default(
|
|
4742
|
+
"group-hover:text-[#fff] ",
|
|
4743
|
+
{
|
|
4744
|
+
"text-[#fff]": selected
|
|
4745
|
+
},
|
|
4746
|
+
{
|
|
4747
|
+
"text-blue-500": !selected
|
|
4748
|
+
}
|
|
4749
|
+
),
|
|
4750
|
+
children: selected && /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-check" })
|
|
4751
|
+
}
|
|
4752
|
+
)
|
|
4753
|
+
] }) })
|
|
4754
|
+
}
|
|
4755
|
+
);
|
|
4756
|
+
})
|
|
4757
|
+
] }) })
|
|
4758
|
+
] });
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
);
|
|
4762
|
+
};
|
|
4763
|
+
function ImagePreview({ open, setOpen, previewImage }) {
|
|
4764
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Transition.Root, { show: open, as: React4.Fragment, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4765
|
+
react.Dialog,
|
|
4766
|
+
{
|
|
4767
|
+
as: "div",
|
|
4768
|
+
className: "relative z-[999]",
|
|
4769
|
+
onClose: () => setOpen(false),
|
|
4770
|
+
children: [
|
|
4771
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4772
|
+
react.Transition.Child,
|
|
4773
|
+
{
|
|
4774
|
+
as: React4.Fragment,
|
|
4775
|
+
enter: "ease-out duration-300",
|
|
4776
|
+
enterFrom: "opacity-0",
|
|
4777
|
+
enterTo: "opacity-100",
|
|
4778
|
+
leave: "ease-in duration-200",
|
|
4779
|
+
leaveFrom: "opacity-100",
|
|
4780
|
+
leaveTo: "opacity-0",
|
|
4781
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" })
|
|
4782
|
+
}
|
|
4783
|
+
),
|
|
4784
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 z-10 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4785
|
+
react.Transition.Child,
|
|
4786
|
+
{
|
|
4787
|
+
as: React4.Fragment,
|
|
4788
|
+
enter: "ease-out duration-300",
|
|
4789
|
+
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
4790
|
+
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
4791
|
+
leave: "ease-in duration-200",
|
|
4792
|
+
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
4793
|
+
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
4794
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Panel, { className: "flex flex-col min-w-[350px] min-h-[250px] relative transform overflow-hidden rounded-lg bg-white p-6 text-left shadow-xl transition-all", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full flex-1", children: [
|
|
4795
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between mb-2", children: [
|
|
4796
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-t-sm font-bold", children: "Pr\xE9via da imagem" }),
|
|
4797
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4798
|
+
"i",
|
|
4799
|
+
{
|
|
4800
|
+
className: "uil uil-times text-[28px] cursor-pointer",
|
|
4801
|
+
onClick: () => setOpen(false)
|
|
4802
|
+
}
|
|
4803
|
+
)
|
|
4804
|
+
] }),
|
|
4805
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-neutral-200 mb-4" }),
|
|
4806
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 h-full items-center justify-center rounded-lg w-full ", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: previewImage, alt: "previewImage" }) })
|
|
4807
|
+
] }) })
|
|
4808
|
+
}
|
|
4809
|
+
) }) })
|
|
4810
|
+
]
|
|
4811
|
+
}
|
|
4812
|
+
) });
|
|
4813
|
+
}
|
|
4814
|
+
var FileStatus = ({
|
|
4815
|
+
name,
|
|
4816
|
+
isLoading,
|
|
4817
|
+
size,
|
|
4818
|
+
onRemove,
|
|
4819
|
+
isImage,
|
|
4820
|
+
image
|
|
4821
|
+
}) => {
|
|
4822
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4823
|
+
ImageFile,
|
|
4824
|
+
{
|
|
4825
|
+
isLoading,
|
|
4826
|
+
name,
|
|
4827
|
+
size,
|
|
4828
|
+
onRemove,
|
|
4829
|
+
image
|
|
4830
|
+
}
|
|
4831
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4832
|
+
File,
|
|
4833
|
+
{
|
|
4834
|
+
isLoading,
|
|
4835
|
+
name,
|
|
4836
|
+
size,
|
|
4837
|
+
onRemove,
|
|
4838
|
+
image
|
|
4839
|
+
}
|
|
4840
|
+
) });
|
|
4841
|
+
};
|
|
4842
|
+
var ImageFile = ({ isLoading, name, size, onRemove, image }) => {
|
|
4843
|
+
const [imagePreviewModal, setImagePreviewModal] = React4.useState(false);
|
|
4844
|
+
const [previewImage, setPreviewImage] = React4.useState();
|
|
4845
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "group h-[130px] w-[130px] flex justify-between border border-neutral-300 rounded-[8px]", children: !isLoading && image ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full relative", children: [
|
|
4846
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden group-hover:block absolute top-3 left-3", children: [
|
|
4847
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4848
|
+
Button,
|
|
4849
|
+
{
|
|
4850
|
+
className: "w-[32px] h-[32px]",
|
|
4851
|
+
variant: "iconSecondary",
|
|
4852
|
+
onClick: (evt) => {
|
|
4853
|
+
setImagePreviewModal(true);
|
|
4854
|
+
let newPreviewImage = new window.Image();
|
|
4855
|
+
newPreviewImage.src = image;
|
|
4856
|
+
setPreviewImage(newPreviewImage);
|
|
4857
|
+
},
|
|
4858
|
+
size: "xs",
|
|
4859
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-search-plus text-[22px]" })
|
|
4860
|
+
}
|
|
4861
|
+
),
|
|
4862
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4863
|
+
ImagePreview,
|
|
4864
|
+
{
|
|
4865
|
+
open: imagePreviewModal,
|
|
4866
|
+
setOpen: setImagePreviewModal,
|
|
4867
|
+
previewImage
|
|
4868
|
+
}
|
|
4869
|
+
)
|
|
4870
|
+
] }),
|
|
4871
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "block absolute top-3 right-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4872
|
+
Button,
|
|
4873
|
+
{
|
|
4874
|
+
className: "w-[32px] h-[32px]",
|
|
4875
|
+
variant: "iconSecondary",
|
|
4876
|
+
onClick: onRemove,
|
|
4877
|
+
size: "xs",
|
|
4878
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-times text-xl" })
|
|
4879
|
+
}
|
|
4880
|
+
) }),
|
|
4881
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full group-hover:bg-[#16203499]/60 z-10", children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "relative -z-10", src: image, alt: "tumbnails" }) })
|
|
4882
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col justify-between p-[10px]", children: [
|
|
4883
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col ", children: [
|
|
4884
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex self-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4885
|
+
"i",
|
|
4886
|
+
{
|
|
4887
|
+
onClick: onRemove,
|
|
4888
|
+
className: "uil uil-times text-[28px] cursor-pointer"
|
|
4889
|
+
}
|
|
4890
|
+
) }),
|
|
4891
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex self-center items-center justify-center w-12 h-12 bg-blue-500 rounded-full animate-spin", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4892
|
+
"img",
|
|
4893
|
+
{
|
|
4894
|
+
src: `/spinner-white.svg`,
|
|
4895
|
+
alt: "circle",
|
|
4896
|
+
width: 30,
|
|
4897
|
+
height: 30
|
|
4898
|
+
}
|
|
4899
|
+
) })
|
|
4900
|
+
] }),
|
|
4901
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
4902
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-p-sm", children: name }),
|
|
4903
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xxs text-label", children: [
|
|
4904
|
+
size.to,
|
|
4905
|
+
" KB"
|
|
4906
|
+
] })
|
|
4907
|
+
] })
|
|
4908
|
+
] }) });
|
|
4909
|
+
};
|
|
4910
|
+
var File = ({ isLoading, name, size, onRemove, image }) => {
|
|
4911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full md:w-[410px] flex items-center justify-between px-3 py-2 border border-neutral-300 rounded-[4px]", children: [
|
|
4912
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-x-2 items-center", children: [
|
|
4913
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(SpinnerIcon, { width: 19, height: 19, className: "animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-success-500 flex", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-check-circle text-[23px]" }) }),
|
|
4914
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
4915
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-x-1", children: [
|
|
4916
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-label self-end flex", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-file text-xs" }) }),
|
|
4917
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-p-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4918
|
+
"a",
|
|
4919
|
+
{
|
|
4920
|
+
href: image,
|
|
4921
|
+
download: name,
|
|
4922
|
+
className: "text-blue-500 hover:text-blue-500 hover:underline active:text-blue-600 active:underline active:underline-offset-4",
|
|
4923
|
+
children: name
|
|
4924
|
+
}
|
|
4925
|
+
) })
|
|
4926
|
+
] }),
|
|
4927
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xxs text-label", children: [
|
|
4928
|
+
size ? size.toLocaleString("en-US", {
|
|
4929
|
+
style: "decimal"
|
|
4930
|
+
// Other options: 'currency', 'percent', etc.
|
|
4931
|
+
}) : null,
|
|
4932
|
+
" ",
|
|
4933
|
+
"KB"
|
|
4934
|
+
] })
|
|
4935
|
+
] })
|
|
4936
|
+
] }),
|
|
4937
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4938
|
+
"i",
|
|
4939
|
+
{
|
|
4940
|
+
onClick: onRemove,
|
|
4941
|
+
className: "uil uil-times text-[24px] text-neutral-600 cursor-pointer"
|
|
4942
|
+
}
|
|
4943
|
+
)
|
|
4944
|
+
] });
|
|
4945
|
+
};
|
|
4946
|
+
|
|
4947
|
+
// src/components/FileUpload/FileUploadReducer.tsx
|
|
4948
|
+
var initialState = {
|
|
4949
|
+
files: []
|
|
4950
|
+
};
|
|
4951
|
+
function reducer(state, action) {
|
|
4952
|
+
var _a, _b;
|
|
4953
|
+
switch (action.type) {
|
|
4954
|
+
case "UPLOAD_START":
|
|
4955
|
+
return {
|
|
4956
|
+
files: [
|
|
4957
|
+
...state == null ? void 0 : state.files,
|
|
4958
|
+
{
|
|
4959
|
+
name: action.payload.file.name,
|
|
4960
|
+
size: action.payload.file.size,
|
|
4961
|
+
image: action.payload.file,
|
|
4962
|
+
type: action.payload.file.type,
|
|
4963
|
+
loading: true
|
|
4964
|
+
}
|
|
4965
|
+
]
|
|
4966
|
+
};
|
|
4967
|
+
case "UPLOAD_END":
|
|
4968
|
+
return {
|
|
4969
|
+
files: (_a = state == null ? void 0 : state.files) == null ? void 0 : _a.map((file) => {
|
|
4970
|
+
if (file.name === action.payload.name) {
|
|
4971
|
+
return {
|
|
4972
|
+
...file,
|
|
4973
|
+
image: action.payload.result,
|
|
4974
|
+
loading: false
|
|
4975
|
+
};
|
|
4976
|
+
}
|
|
4977
|
+
return file;
|
|
4978
|
+
})
|
|
4979
|
+
};
|
|
4980
|
+
case "REMOVE_FILE":
|
|
4981
|
+
return {
|
|
4982
|
+
files: (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.filter(
|
|
4983
|
+
(file) => file.name !== action.payload.name
|
|
4984
|
+
)
|
|
4985
|
+
};
|
|
4986
|
+
default:
|
|
4987
|
+
return state;
|
|
4988
|
+
}
|
|
4989
|
+
}
|
|
4990
|
+
var IconFile = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4991
|
+
"svg",
|
|
4992
|
+
{
|
|
4993
|
+
width: "24",
|
|
4994
|
+
height: "30",
|
|
4995
|
+
viewBox: "0 0 24 30",
|
|
4996
|
+
...props,
|
|
4997
|
+
fill: "none",
|
|
4998
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4999
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5000
|
+
"path",
|
|
5001
|
+
{
|
|
5002
|
+
d: "M24 10.41C23.9844 10.2722 23.9542 10.1364 23.91 10.005V9.87C23.8379 9.71577 23.7417 9.574 23.625 9.45L14.625 0.45C14.501 0.333324 14.3592 0.237121 14.205 0.165H14.07L13.59 0H4.5C3.30653 0 2.16193 0.474106 1.31802 1.31802C0.474106 2.16193 0 3.30653 0 4.5V25.5C0 26.6935 0.474106 27.8381 1.31802 28.682C2.16193 29.5259 3.30653 30 4.5 30H19.5C20.6935 30 21.8381 29.5259 22.682 28.682C23.5259 27.8381 24 26.6935 24 25.5V10.5C24 10.5 24 10.5 24 10.41ZM15 5.115L18.885 9H15V5.115ZM21 25.5C21 25.8978 20.842 26.2794 20.5607 26.5607C20.2794 26.842 19.8978 27 19.5 27H4.5C4.10218 27 3.72064 26.842 3.43934 26.5607C3.15804 26.2794 3 25.8978 3 25.5V4.5C3 4.10217 3.15804 3.72064 3.43934 3.43934C3.72064 3.15804 4.10218 3 4.5 3H12V10.5C12 10.8978 12.158 11.2794 12.4393 11.5607C12.7206 11.842 13.1022 12 13.5 12H21V25.5Z",
|
|
5003
|
+
fill: "#009EDB"
|
|
5004
|
+
}
|
|
5005
|
+
)
|
|
5006
|
+
}
|
|
5007
|
+
);
|
|
5008
|
+
var IconCheck = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5009
|
+
"svg",
|
|
5010
|
+
{
|
|
5011
|
+
width: "22",
|
|
5012
|
+
height: "16",
|
|
5013
|
+
viewBox: "0 0 22 16",
|
|
5014
|
+
fill: "none",
|
|
5015
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5016
|
+
...props,
|
|
5017
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5018
|
+
"path",
|
|
5019
|
+
{
|
|
5020
|
+
d: "M21.065 0.815035C20.9256 0.674443 20.7597 0.562851 20.5769 0.486698C20.3941 0.410545 20.198 0.371338 20 0.371338C19.802 0.371338 19.6059 0.410545 19.4231 0.486698C19.2403 0.562851 19.0744 0.674443 18.935 0.815035L7.76 12.005L3.065 7.29503C2.92022 7.15518 2.74931 7.04521 2.56202 6.9714C2.37474 6.89759 2.17476 6.8614 1.97348 6.86488C1.77221 6.86836 1.5736 6.91145 1.38898 6.99169C1.20436 7.07194 1.03736 7.18775 0.897501 7.33254C0.757643 7.47732 0.647672 7.64823 0.573866 7.83551C0.50006 8.02279 0.463864 8.22278 0.467347 8.42405C0.470829 8.62532 0.513921 8.82394 0.594161 9.00855C0.674401 9.19317 0.790219 9.36018 0.935001 9.50004L6.695 15.26C6.83445 15.4006 7.00035 15.5122 7.18314 15.5884C7.36593 15.6645 7.56198 15.7037 7.76 15.7037C7.95802 15.7037 8.15408 15.6645 8.33687 15.5884C8.51966 15.5122 8.68556 15.4006 8.825 15.26L21.065 3.02004C21.2173 2.87957 21.3388 2.70909 21.4219 2.51935C21.505 2.3296 21.5479 2.12469 21.5479 1.91754C21.5479 1.71038 21.505 1.50548 21.4219 1.31573C21.3388 1.12598 21.2173 0.955499 21.065 0.815035Z",
|
|
5021
|
+
fill: "#009EDB"
|
|
5022
|
+
}
|
|
5023
|
+
)
|
|
5024
|
+
}
|
|
5025
|
+
);
|
|
5026
|
+
var IconFileUpload = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5027
|
+
"svg",
|
|
5028
|
+
{
|
|
5029
|
+
width: "30",
|
|
5030
|
+
height: "30",
|
|
5031
|
+
viewBox: "0 0 30 30",
|
|
5032
|
+
fill: "none",
|
|
5033
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5034
|
+
...props,
|
|
5035
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5036
|
+
"path",
|
|
5037
|
+
{
|
|
5038
|
+
d: "M10.0649 8.56503L13.4999 5.11503V19.5C13.4999 19.8979 13.6579 20.2794 13.9392 20.5607C14.2205 20.842 14.6021 21 14.9999 21C15.3977 21 15.7792 20.842 16.0605 20.5607C16.3418 20.2794 16.4999 19.8979 16.4999 19.5V5.11503L19.9349 8.56503C20.0743 8.70562 20.2402 8.81721 20.423 8.89337C20.6058 8.96952 20.8019 9.00873 20.9999 9.00873C21.1979 9.00873 21.394 8.96952 21.5767 8.89337C21.7595 8.81721 21.9254 8.70562 22.0649 8.56503C22.2055 8.42558 22.3171 8.25968 22.3932 8.07689C22.4694 7.8941 22.5086 7.69805 22.5086 7.50003C22.5086 7.30201 22.4694 7.10595 22.3932 6.92316C22.3171 6.74037 22.2055 6.57447 22.0649 6.43503L16.0649 0.435028C15.9222 0.298467 15.754 0.191419 15.5699 0.120028C15.2047 -0.0299994 14.7951 -0.0299994 14.4299 0.120028C14.2457 0.191419 14.0775 0.298467 13.9349 0.435028L7.93488 6.43503C7.79502 6.57489 7.68408 6.74092 7.60839 6.92365C7.5327 7.10639 7.49374 7.30224 7.49374 7.50003C7.49374 7.69782 7.5327 7.89367 7.60839 8.0764C7.68408 8.25914 7.79502 8.42517 7.93488 8.56503C8.07474 8.70489 8.24077 8.81583 8.4235 8.89152C8.60624 8.96721 8.80209 9.00617 8.99988 9.00617C9.19767 9.00617 9.39352 8.96721 9.57625 8.89152C9.75898 8.81583 9.92502 8.70489 10.0649 8.56503ZM28.4999 15C28.1021 15 27.7205 15.1581 27.4392 15.4394C27.1579 15.7207 26.9999 16.1022 26.9999 16.5V25.5C26.9999 25.8979 26.8418 26.2794 26.5605 26.5607C26.2792 26.842 25.8977 27 25.4999 27H4.49988C4.10205 27 3.72052 26.842 3.43922 26.5607C3.15791 26.2794 2.99988 25.8979 2.99988 25.5V16.5C2.99988 16.1022 2.84184 15.7207 2.56054 15.4394C2.27923 15.1581 1.8977 15 1.49988 15C1.10205 15 0.720522 15.1581 0.439218 15.4394C0.157913 15.7207 -0.00012207 16.1022 -0.00012207 16.5V25.5C-0.00012207 26.6935 0.473984 27.8381 1.3179 28.682C2.16181 29.5259 3.3064 30 4.49988 30H25.4999C26.6934 30 27.8379 29.5259 28.6819 28.682C29.5258 27.8381 29.9999 26.6935 29.9999 25.5V16.5C29.9999 16.1022 29.8418 15.7207 29.5605 15.4394C29.2792 15.1581 28.8977 15 28.4999 15Z",
|
|
5039
|
+
fill: "white"
|
|
5040
|
+
}
|
|
5041
|
+
)
|
|
5042
|
+
}
|
|
5043
|
+
);
|
|
5044
|
+
var FileUpload = ({
|
|
5045
|
+
icon = "file",
|
|
5046
|
+
multiple = false,
|
|
5047
|
+
direction = "vertical",
|
|
5048
|
+
isImage = false,
|
|
5049
|
+
setFiles,
|
|
5050
|
+
supportedFormats,
|
|
5051
|
+
validationFunction,
|
|
5052
|
+
files,
|
|
5053
|
+
error,
|
|
5054
|
+
name,
|
|
5055
|
+
limitMessage
|
|
5056
|
+
}) => {
|
|
5057
|
+
var _a;
|
|
5058
|
+
const [state, dispatch] = React4.useReducer(reducer, initialState);
|
|
5059
|
+
const [dragging, setDragging] = React4.useState(false);
|
|
5060
|
+
const [loading, setLoading] = React4.useState(false);
|
|
5061
|
+
const { readString } = reactPapaparse.usePapaParse();
|
|
5062
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
5063
|
+
const hasError = {
|
|
5064
|
+
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
5065
|
+
};
|
|
5066
|
+
React4.useEffect(() => {
|
|
5067
|
+
var _a2;
|
|
5068
|
+
if ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.some((file) => file.loading === true)) {
|
|
5069
|
+
setLoading(true);
|
|
5070
|
+
} else {
|
|
5071
|
+
setLoading(false);
|
|
5072
|
+
}
|
|
5073
|
+
}, [state == null ? void 0 : state.files]);
|
|
5074
|
+
React4.useEffect(() => {
|
|
5075
|
+
if (!files || files.length == 0) {
|
|
5076
|
+
state.files = [];
|
|
5077
|
+
}
|
|
5078
|
+
}, [files]);
|
|
5079
|
+
React4.useEffect(() => {
|
|
5080
|
+
var _a2;
|
|
5081
|
+
if (!multiple && ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.length) === 0 || multiple) {
|
|
5082
|
+
window.addEventListener("dragover", handleDragOver);
|
|
5083
|
+
window.addEventListener("drop", handleDrop);
|
|
5084
|
+
window.addEventListener("dragleave", handleDragLeave);
|
|
5085
|
+
}
|
|
5086
|
+
return () => {
|
|
5087
|
+
window.removeEventListener("dragover", handleDragOver);
|
|
5088
|
+
window.removeEventListener("drop", handleDrop);
|
|
5089
|
+
window.removeEventListener("dragleave", handleDragLeave);
|
|
5090
|
+
};
|
|
5091
|
+
}, [multiple, state.files]);
|
|
5092
|
+
const handleDragOver = (event) => {
|
|
5093
|
+
var _a2;
|
|
5094
|
+
event.preventDefault();
|
|
5095
|
+
event.stopPropagation();
|
|
5096
|
+
if (!multiple && ((_a2 = state.files) == null ? void 0 : _a2.length) === 1) {
|
|
5097
|
+
setDragging(false);
|
|
5098
|
+
} else {
|
|
5099
|
+
setDragging(true);
|
|
5100
|
+
}
|
|
5101
|
+
};
|
|
5102
|
+
const handleDrop = (event) => {
|
|
5103
|
+
var _a2, _b, _c;
|
|
5104
|
+
event.preventDefault();
|
|
5105
|
+
event.stopPropagation();
|
|
5106
|
+
setDragging(false);
|
|
5107
|
+
let files2 = [...(_a2 = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a2.files];
|
|
5108
|
+
if (!multiple && (files2 == null ? void 0 : files2.length) === 1 || multiple && (files2 == null ? void 0 : files2.length) > 0) {
|
|
5109
|
+
const existingFiles = (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.map((f) => f.name);
|
|
5110
|
+
files2 = files2.filter((f) => !(existingFiles == null ? void 0 : existingFiles.includes(f.name)));
|
|
5111
|
+
files2.forEach((file) => {
|
|
5112
|
+
const reader = new FileReader();
|
|
5113
|
+
reader.addEventListener("loadstart", () => {
|
|
5114
|
+
dispatch({
|
|
5115
|
+
type: "UPLOAD_START",
|
|
5116
|
+
payload: { file }
|
|
5117
|
+
});
|
|
5118
|
+
});
|
|
5119
|
+
reader.addEventListener("load", () => {
|
|
5120
|
+
if (!validationFunction) {
|
|
5121
|
+
dispatch({
|
|
5122
|
+
type: "UPLOAD_END",
|
|
5123
|
+
payload: {
|
|
5124
|
+
name: file.name,
|
|
5125
|
+
result: reader.result
|
|
5126
|
+
}
|
|
5127
|
+
});
|
|
5128
|
+
setFiles && setFiles(file);
|
|
5129
|
+
}
|
|
5130
|
+
if (validationFunction(file)) {
|
|
5131
|
+
setTimeout(() => {
|
|
5132
|
+
dispatch({
|
|
5133
|
+
type: "UPLOAD_END",
|
|
5134
|
+
payload: {
|
|
5135
|
+
name: file.name,
|
|
5136
|
+
result: reader.result
|
|
5137
|
+
}
|
|
5138
|
+
});
|
|
5139
|
+
}, 1e3);
|
|
5140
|
+
setFiles && setFiles(file);
|
|
5141
|
+
} else {
|
|
5142
|
+
dispatch({
|
|
5143
|
+
type: "REMOVE_FILE",
|
|
5144
|
+
payload: {
|
|
5145
|
+
name: file.name
|
|
5146
|
+
}
|
|
5147
|
+
});
|
|
5148
|
+
}
|
|
5149
|
+
});
|
|
5150
|
+
reader.readAsDataURL(file);
|
|
5151
|
+
});
|
|
5152
|
+
(_c = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _c.clearData();
|
|
5153
|
+
}
|
|
5154
|
+
};
|
|
5155
|
+
const handleDragLeave = (event) => {
|
|
5156
|
+
if (event.screenX === 0 && event.screenY === 0) {
|
|
5157
|
+
setDragging(false);
|
|
5158
|
+
}
|
|
5159
|
+
event.stopPropagation();
|
|
5160
|
+
event.preventDefault();
|
|
5161
|
+
};
|
|
5162
|
+
const onChangeFile = (e) => {
|
|
5163
|
+
const files2 = Object.values(e.target.files);
|
|
5164
|
+
e.target.value = null;
|
|
5165
|
+
files2.forEach((file) => {
|
|
5166
|
+
const reader = new FileReader();
|
|
5167
|
+
reader.addEventListener("loadstart", () => {
|
|
5168
|
+
dispatch({
|
|
5169
|
+
type: "UPLOAD_START",
|
|
5170
|
+
payload: { file }
|
|
5171
|
+
});
|
|
5172
|
+
});
|
|
5173
|
+
reader.addEventListener("load", () => {
|
|
5174
|
+
setTimeout(() => {
|
|
5175
|
+
readString(String(file), {
|
|
5176
|
+
delimiter: ",",
|
|
5177
|
+
worker: true,
|
|
5178
|
+
complete: (results) => {
|
|
5179
|
+
if (!validationFunction) {
|
|
5180
|
+
dispatch({
|
|
5181
|
+
type: "UPLOAD_END",
|
|
5182
|
+
payload: {
|
|
5183
|
+
name: file.name,
|
|
5184
|
+
result: reader.result
|
|
5185
|
+
}
|
|
5186
|
+
});
|
|
5187
|
+
setFiles && setFiles(file);
|
|
5188
|
+
} else if (validationFunction(file)) {
|
|
5189
|
+
dispatch({
|
|
5190
|
+
type: "UPLOAD_END",
|
|
5191
|
+
payload: {
|
|
5192
|
+
name: file.name,
|
|
5193
|
+
result: reader.result
|
|
5194
|
+
}
|
|
5195
|
+
});
|
|
5196
|
+
setFiles && setFiles(file);
|
|
5197
|
+
} else {
|
|
5198
|
+
dispatch({
|
|
5199
|
+
type: "REMOVE_FILE",
|
|
5200
|
+
payload: {
|
|
5201
|
+
name: file.name
|
|
5202
|
+
}
|
|
5203
|
+
});
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
});
|
|
5207
|
+
}, 1e3);
|
|
5208
|
+
});
|
|
5209
|
+
reader.readAsDataURL(file);
|
|
5210
|
+
});
|
|
5211
|
+
};
|
|
5212
|
+
const renderContent = () => {
|
|
5213
|
+
var _a2;
|
|
5214
|
+
if (loading) {
|
|
5215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LoadingContent, {});
|
|
5216
|
+
} else if (dragging) {
|
|
5217
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DraggingContent, {});
|
|
5218
|
+
} else if (!multiple && ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.length) > 0) {
|
|
5219
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BlockedContent, {});
|
|
5220
|
+
}
|
|
5221
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5222
|
+
DefaultContent,
|
|
5223
|
+
{
|
|
5224
|
+
icon,
|
|
5225
|
+
formats: supportedFormats == null ? void 0 : supportedFormats.join(", ").replace(/\./g, "").toUpperCase(),
|
|
5226
|
+
limitMessage
|
|
5227
|
+
}
|
|
5228
|
+
);
|
|
5229
|
+
};
|
|
5230
|
+
const removeFile = (name2) => {
|
|
5231
|
+
dispatch({
|
|
5232
|
+
type: "REMOVE_FILE",
|
|
5233
|
+
payload: {
|
|
5234
|
+
name: name2
|
|
5235
|
+
}
|
|
5236
|
+
});
|
|
5237
|
+
setFiles && setFiles(null);
|
|
5238
|
+
};
|
|
5239
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5240
|
+
"div",
|
|
5241
|
+
{
|
|
5242
|
+
className: clsx9__default.default(
|
|
5243
|
+
"flex gap-1 w-full rounded-lg items-center justify-center",
|
|
5244
|
+
{
|
|
5245
|
+
"flex-col gap-1": direction === "vertical"
|
|
5246
|
+
}
|
|
5247
|
+
),
|
|
5248
|
+
children: [
|
|
5249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5250
|
+
"input",
|
|
5251
|
+
{
|
|
5252
|
+
id: "file-upload",
|
|
5253
|
+
name: "file-upload",
|
|
5254
|
+
type: "file",
|
|
5255
|
+
accept: supportedFormats == null ? void 0 : supportedFormats.join(","),
|
|
5256
|
+
multiple,
|
|
5257
|
+
className: "sr-only",
|
|
5258
|
+
onChange: onChangeFile
|
|
5259
|
+
}
|
|
5260
|
+
),
|
|
5261
|
+
renderContent(),
|
|
5262
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5263
|
+
"div",
|
|
5264
|
+
{
|
|
5265
|
+
className: clsx9__default.default(
|
|
5266
|
+
{
|
|
5267
|
+
"flex flex-col w-full gap-y-[6px]": direction === "vertical" && !isImage
|
|
5268
|
+
},
|
|
5269
|
+
{
|
|
5270
|
+
"flex flex-col gap-y-[6px] w-full": direction === "horizontal" && !isImage
|
|
5271
|
+
},
|
|
5272
|
+
{
|
|
5273
|
+
"flex gap-[6px]": direction === "vertical" && isImage
|
|
5274
|
+
},
|
|
5275
|
+
{
|
|
5276
|
+
"flex gap-[6px]": direction === "horizontal" && !isImage
|
|
5277
|
+
}
|
|
5278
|
+
),
|
|
5279
|
+
children: (_a = state == null ? void 0 : state.files) == null ? void 0 : _a.map((file) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5280
|
+
FileStatus,
|
|
5281
|
+
{
|
|
5282
|
+
name: file == null ? void 0 : file.name,
|
|
5283
|
+
onRemove: () => removeFile(file == null ? void 0 : file.name),
|
|
5284
|
+
isLoading: file.loading,
|
|
5285
|
+
size: file.size,
|
|
5286
|
+
isImage: file.image && isImage,
|
|
5287
|
+
image: file.image
|
|
5288
|
+
},
|
|
5289
|
+
file.name
|
|
5290
|
+
))
|
|
5291
|
+
}
|
|
5292
|
+
),
|
|
5293
|
+
hasError && fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5294
|
+
"div",
|
|
5295
|
+
{
|
|
5296
|
+
className: "text-dangerous-500 text-xs -mt-[6px]",
|
|
5297
|
+
role: "alert",
|
|
5298
|
+
"aria-label": message,
|
|
5299
|
+
children: message
|
|
5300
|
+
},
|
|
5301
|
+
index
|
|
5302
|
+
))
|
|
5303
|
+
]
|
|
5304
|
+
}
|
|
5305
|
+
) });
|
|
5306
|
+
};
|
|
5307
|
+
var DefaultContent = ({ formats, icon, limitMessage }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full md:w-[410px] h-full flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col text-center items-center", children: [
|
|
5308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5309
|
+
"div",
|
|
5310
|
+
{
|
|
5311
|
+
className: "flex items-center justify-center w-14 h-14 mb-2 bg-blue-100 rounded-full",
|
|
5312
|
+
children: icon === "file" ? /* @__PURE__ */ jsxRuntime.jsx(IconFile, {}) : /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-image-plus text-[28px] text-blue-500" })
|
|
5313
|
+
}
|
|
5314
|
+
),
|
|
5315
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-bold text-base", children: icon === "file" ? "Arraste o arquivo e solte aqui" : "Arraste as imagens e solte aqui" }),
|
|
5316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5317
|
+
"label",
|
|
5318
|
+
{
|
|
5319
|
+
htmlFor: "file-upload",
|
|
5320
|
+
className: "relative leading-none cursor-pointer text-sm bg-white focus-within:outline-none",
|
|
5321
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
5322
|
+
"ou\xA0",
|
|
5323
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-blue-500", children: "selecione do seu computador" })
|
|
5324
|
+
] })
|
|
5325
|
+
}
|
|
5326
|
+
),
|
|
5327
|
+
/* @__PURE__ */ jsxRuntime.jsxs("small", { className: "text-label text-xxs leading-5", children: [
|
|
5328
|
+
"Formatos: ",
|
|
5329
|
+
formats,
|
|
5330
|
+
" | ",
|
|
5331
|
+
limitMessage ? limitMessage : "At\xE9 25 MB"
|
|
5332
|
+
] })
|
|
5333
|
+
] }) });
|
|
5334
|
+
var BlockedContent = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full md:w-[410px] h-full flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col text-center items-center justify-center", children: [
|
|
5335
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5336
|
+
"div",
|
|
5337
|
+
{
|
|
5338
|
+
className: "flex items-center justify-center w-14 h-14 mb-1 bg-blue-100 rounded-full",
|
|
5339
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconCheck, {})
|
|
5340
|
+
}
|
|
5341
|
+
),
|
|
5342
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-bold text-base mt-1", children: "Arquivo carregado!" })
|
|
5343
|
+
] }) });
|
|
5344
|
+
var DraggingContent = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full md:w-[410px] h-[152px] bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col p-4 custom-border justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col h-full text-center items-center justify-center", children: [
|
|
5345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5346
|
+
"div",
|
|
5347
|
+
{
|
|
5348
|
+
className: "flex items-center justify-center w-14 h-14 mb-2 bg-blue-500 rounded-full",
|
|
5349
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconFileUpload, {})
|
|
5350
|
+
}
|
|
5351
|
+
),
|
|
5352
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-bold text-base text-blue-500", children: "Solte aqui para carregar o arquivo" })
|
|
5353
|
+
] }) }) });
|
|
5354
|
+
var LoadingContent = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full bg-blue-100 flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col text-center items-center justify-center", children: [
|
|
5355
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpinnerIcon, { className: "animate-spin" }),
|
|
5356
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-bold text-base text-blue-500", children: "Carregando arquivo..." })
|
|
5357
|
+
] }) });
|
|
5358
|
+
function InfoIcon({
|
|
5359
|
+
content,
|
|
5360
|
+
id = "info-id"
|
|
5361
|
+
}) {
|
|
5362
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5363
|
+
"div",
|
|
5364
|
+
{
|
|
5365
|
+
"data-tooltip-id": id,
|
|
5366
|
+
"data-tooltip-html": content,
|
|
5367
|
+
"data-tooltip-place": "top",
|
|
5368
|
+
children: [
|
|
5369
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover3, { id }),
|
|
5370
|
+
/* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-info-circle text-p-lg text-neutral-400" })
|
|
5371
|
+
]
|
|
5372
|
+
}
|
|
5373
|
+
);
|
|
5374
|
+
}
|
|
4611
5375
|
|
|
4612
5376
|
exports.Accordion = Accordion;
|
|
4613
5377
|
exports.Badge = Badge;
|
|
@@ -4621,8 +5385,11 @@ exports.DataTablePagination = DataTablePagination;
|
|
|
4621
5385
|
exports.DatePickerInput = DatePickerInput;
|
|
4622
5386
|
exports.EditableButton = EditableButton;
|
|
4623
5387
|
exports.EditableText = EditableText;
|
|
5388
|
+
exports.EditableTextSelect = EditableTextSelect;
|
|
5389
|
+
exports.FileUpload = FileUpload;
|
|
4624
5390
|
exports.FilterCalendar = FilterCalendar;
|
|
4625
5391
|
exports.FilterOptions = FilterOptions;
|
|
5392
|
+
exports.InfoIcon = InfoIcon;
|
|
4626
5393
|
exports.Input = Input;
|
|
4627
5394
|
exports.InputMoney = InputMoney;
|
|
4628
5395
|
exports.InputNumber = InputNumber;
|