nexaas-ui-components 1.0.21 → 1.0.23

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
@@ -1,22 +1,24 @@
1
1
  import * as React4 from 'react';
2
- import React4__default, { forwardRef, useEffect, useState, useRef, useMemo, cloneElement, Fragment as Fragment$1 } from 'react';
2
+ import React4__default, { forwardRef, useEffect, useState, useRef, useMemo, cloneElement, Fragment as Fragment$1, useReducer } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import clsx9, { clsx } from 'clsx';
5
5
  import { DateInput3, DateRangePicker3, DatePicker3 } from '@blueprintjs/datetime2';
6
6
  import { Controller } from 'react-hook-form';
7
7
  import { create } from 'zustand';
8
8
  import { parse, format, set, startOfWeek, endOfWeek, startOfMonth, endOfMonth, sub, subYears } from 'date-fns';
9
- import { Switch, Popover, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, Transition, Menu as Menu$1, MenuButton, MenuItems, MenuItem, ListboxOption } from '@headlessui/react';
9
+ import { Switch, Popover, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, Transition, Menu as Menu$1, MenuButton, MenuItems, MenuItem, ListboxOption, Dialog } from '@headlessui/react';
10
10
  import { Float } from '@headlessui-float/react';
11
11
  import IntlCurrencyInputRaw from 'react-intl-currency-input';
12
12
  import * as lodashNamespace from 'lodash';
13
13
  import InputMask from 'react-input-mask';
14
14
  import * as ReactModalNamespace from 'react-modal';
15
15
  import { Tooltip } from 'react-tooltip';
16
- import { components } from 'react-select';
16
+ import Select, { components } from 'react-select';
17
17
  import AsyncSelect from 'react-select/async';
18
18
  import { useReactTable, getExpandedRowModel, getFacetedUniqueValues, getFacetedRowModel, getFilteredRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
19
19
  import { rankItem } from '@tanstack/match-sorter-utils';
20
+ import Fuse from 'fuse.js';
21
+ import { usePapaParse } from 'react-papaparse';
20
22
 
21
23
  // src/components/Button.tsx
22
24
  var SpinnerIcon = (props) => /* @__PURE__ */ jsx(
@@ -67,7 +69,7 @@ var variants = {
67
69
  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"
68
70
  },
69
71
  icon: {
70
- 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"
72
+ 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"
71
73
  },
72
74
  outline: {
73
75
  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"
@@ -203,7 +205,7 @@ var Button = ({
203
205
  };
204
206
  var sizes2 = {
205
207
  xxs: {
206
- text: "min-h-[14px] max-h-[40px]"
208
+ text: "min-h-[14px] max-h-[40px] text-[14px] gap-[4px]"
207
209
  },
208
210
  xs: {
209
211
  text: "h-[36px]"
@@ -2474,7 +2476,7 @@ var ModalDialog = ({
2474
2476
  description,
2475
2477
  children
2476
2478
  }) => {
2477
- const customStyles3 = {
2479
+ const customStyles6 = {
2478
2480
  content: {
2479
2481
  top: "50%",
2480
2482
  left: "50%",
@@ -2505,10 +2507,10 @@ var ModalDialog = ({
2505
2507
  ariaHideApp: false,
2506
2508
  isOpen: open,
2507
2509
  onRequestClose: onClose,
2508
- style: customStyles3,
2510
+ style: customStyles6,
2509
2511
  contentLabel: "Example Modal",
2510
2512
  children: /* @__PURE__ */ jsxs("div", { className: clsx9(sizes3[size]), children: [
2511
- /* @__PURE__ */ jsxs("div", { className: "pb-2 border-b border-b-neutral-200 flex items-center justify-between", children: [
2513
+ /* @__PURE__ */ jsxs("div", { className: "pb-[6px] border-b border-b-neutral-200 flex items-center justify-between", children: [
2512
2514
  /* @__PURE__ */ jsxs("h3", { className: "text-[24px] font-bold flex items-center gap-2", children: [
2513
2515
  alertType && /* @__PURE__ */ jsx("div", { className: clsx9([alertTypes[alertType]], "text-[30px]"), children: icon }),
2514
2516
  title
@@ -2536,7 +2538,7 @@ var ModalDialog = ({
2536
2538
  }
2537
2539
  },
2538
2540
  variant: "secondary",
2539
- size: "sm",
2541
+ size: "md",
2540
2542
  children: "Cancelar"
2541
2543
  }
2542
2544
  ),
@@ -3104,10 +3106,10 @@ var SelectFieldBip = ({
3104
3106
  onErrorBip,
3105
3107
  clearAfterSelect = true,
3106
3108
  messages = {
3107
- searching: "Searching...",
3108
- debounce: `Type at least {debounce} characters`,
3109
- emptyMessage: "No options found",
3110
- loading: "Loading..."
3109
+ searching: "Buscando...",
3110
+ debounce: `Digite pelo menos {debounce} caracteres`,
3111
+ emptyMessage: "Nenhuma op\xE7\xE3o encontrada",
3112
+ loading: "Carregando..."
3111
3113
  }
3112
3114
  }) => {
3113
3115
  var _a;
@@ -3193,15 +3195,15 @@ var SelectFieldBip = ({
3193
3195
  }
3194
3196
  );
3195
3197
  } else if (debounce2 && inputValue.length < debounce2) {
3196
- return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
3198
+ return /* @__PURE__ */ jsx("div", { style: { color: "var(--label)" }, className: "p-2 text-[14px]", children: messages.debounce.replace("{debounce}", String(debounce2)) });
3197
3199
  }
3198
3200
  };
3199
3201
  const NoOptionsMessage = (props) => {
3200
3202
  var _a2;
3201
3203
  if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
3202
- return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
3204
+ return /* @__PURE__ */ jsx("div", { className: "p-2 text-[14px]", style: { color: "var(--label)" }, children: messages.debounce.replace("{debounce}", String(debounce2)) });
3203
3205
  } else if (inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
3204
- return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.emptyMessage });
3206
+ return /* @__PURE__ */ jsx("div", { className: "p-2 text-[14px]", style: { color: "var(--label)" }, children: messages.emptyMessage });
3205
3207
  }
3206
3208
  };
3207
3209
  const DropdownIndicatorCustom = (props) => {
@@ -4579,7 +4581,1617 @@ var EditableText = ({
4579
4581
  }
4580
4582
  );
4581
4583
  };
4584
+ var EditableTextSelect = ({
4585
+ control,
4586
+ name,
4587
+ emptyLabel,
4588
+ options,
4589
+ optionStyle,
4590
+ valueStyle,
4591
+ showInputSeach,
4592
+ onChangeValue
4593
+ }) => {
4594
+ const [showModal, setShowModal] = useState(false);
4595
+ const [optionsList, setOptionsList] = useState(() => options);
4596
+ const [inputSearch, setInputSearch] = useState("");
4597
+ const optionsFuse = {
4598
+ includeScore: false,
4599
+ keys: ["name"]
4600
+ };
4601
+ const fuse = new Fuse(optionsList, optionsFuse);
4602
+ const filter = () => {
4603
+ var _a;
4604
+ let results = [...options];
4605
+ if (inputSearch) {
4606
+ results = (_a = fuse.search(inputSearch)) == null ? void 0 : _a.map((result) => result.item);
4607
+ }
4608
+ setOptionsList(results);
4609
+ };
4610
+ useEffect(() => {
4611
+ setOptionsList(() => options);
4612
+ }, [options]);
4613
+ useEffect(() => {
4614
+ filter();
4615
+ }, [inputSearch]);
4616
+ return /* @__PURE__ */ jsx(
4617
+ Controller,
4618
+ {
4619
+ control,
4620
+ name,
4621
+ render: ({ field }) => {
4622
+ var _a;
4623
+ return /* @__PURE__ */ jsxs(Menu$1, { children: [
4624
+ /* @__PURE__ */ jsx(Menu$1.Button, { children: /* @__PURE__ */ jsxs(
4625
+ "div",
4626
+ {
4627
+ className: "group flex gap-[5px] cursor-pointer z-[500] items-center",
4628
+ onClick: () => setShowModal(!showModal),
4629
+ children: [
4630
+ field.value ? valueStyle ? valueStyle(field.value) : (_a = field == null ? void 0 : field.value) == null ? void 0 : _a.name : /* @__PURE__ */ jsx(
4631
+ "label",
4632
+ {
4633
+ className: clsx9(
4634
+ {
4635
+ ["text-label"]: !field.value,
4636
+ ["text-paragraph"]: field.value
4637
+ },
4638
+ "text-p-md group-hover:underline group-hover:underline-offset-[3px] cursor-pointer decoration-blue-500"
4639
+ ),
4640
+ children: emptyLabel ? emptyLabel : "N\xE3o informado"
4641
+ }
4642
+ ),
4643
+ /* @__PURE__ */ jsx(
4644
+ "i",
4645
+ {
4646
+ style: { fontSize: "16px" },
4647
+ className: "uil uil-pen text-sm text-blue-500"
4648
+ }
4649
+ )
4650
+ ]
4651
+ }
4652
+ ) }),
4653
+ /* @__PURE__ */ jsx(Menu$1.Items, { children: /* @__PURE__ */ jsxs("div", { className: "w-[294px] p-2 bg-white border border-neutral-300 absolute z-[500] rounded-lg", children: [
4654
+ showInputSeach && /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsx(
4655
+ InputSmall,
4656
+ {
4657
+ icon: /* @__PURE__ */ jsx("i", { className: "uil uil-search" }),
4658
+ onChange: (e) => setInputSearch(e),
4659
+ value: inputSearch,
4660
+ placeholder: "Pesquisar",
4661
+ clearField: true,
4662
+ onKeyDown: (e) => {
4663
+ if (e.key == " " || e.code == "Space") {
4664
+ e.stopPropagation();
4665
+ }
4666
+ }
4667
+ }
4668
+ ) }),
4669
+ optionsList == null ? void 0 : optionsList.map((opt) => {
4670
+ var _a2;
4671
+ const selected = (opt == null ? void 0 : opt.id) === ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.id);
4672
+ return /* @__PURE__ */ jsx(
4673
+ Menu$1.Item,
4674
+ {
4675
+ onClick: () => {
4676
+ field.onChange(opt);
4677
+ if (onChangeValue) {
4678
+ onChangeValue(opt);
4679
+ }
4680
+ },
4681
+ as: "button",
4682
+ className: clsx9(
4683
+ "p-3 mb-1 rounded-lg items-center flex whitespace-nowrap no-underline w-full",
4684
+ {
4685
+ "bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]": selected
4686
+ },
4687
+ {
4688
+ "hover:bg-neutral-100 text-paragraph": !selected
4689
+ },
4690
+ {
4691
+ "cursor-pointer": !opt.disabled
4692
+ }
4693
+ ),
4694
+ children: /* @__PURE__ */ jsx("div", { className: "flex gap-2 w-full items-center whitespace-nowrap", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between items-center", children: [
4695
+ optionStyle ? /* @__PURE__ */ jsx("div", { children: optionStyle(opt) }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
4696
+ /* @__PURE__ */ jsx("span", { className: "font-bold", children: opt == null ? void 0 : opt.title }),
4697
+ /* @__PURE__ */ jsx(
4698
+ "span",
4699
+ {
4700
+ className: clsx9({
4701
+ "text-label": opt.disabled
4702
+ }),
4703
+ children: opt.name
4704
+ }
4705
+ ),
4706
+ opt == null ? void 0 : opt.description
4707
+ ] }),
4708
+ /* @__PURE__ */ jsx(
4709
+ "span",
4710
+ {
4711
+ className: clsx9(
4712
+ "group-hover:text-[#fff] ",
4713
+ {
4714
+ "text-[#fff]": selected
4715
+ },
4716
+ {
4717
+ "text-blue-500": !selected
4718
+ }
4719
+ ),
4720
+ children: selected && /* @__PURE__ */ jsx("i", { className: "uil uil-check" })
4721
+ }
4722
+ )
4723
+ ] }) })
4724
+ }
4725
+ );
4726
+ })
4727
+ ] }) })
4728
+ ] });
4729
+ }
4730
+ }
4731
+ );
4732
+ };
4733
+ function ImagePreview({ open, setOpen, previewImage }) {
4734
+ return /* @__PURE__ */ jsx(Transition.Root, { show: open, as: Fragment$1, children: /* @__PURE__ */ jsxs(
4735
+ Dialog,
4736
+ {
4737
+ as: "div",
4738
+ className: "relative z-[999]",
4739
+ onClose: () => setOpen(false),
4740
+ children: [
4741
+ /* @__PURE__ */ jsx(
4742
+ Transition.Child,
4743
+ {
4744
+ as: Fragment$1,
4745
+ enter: "ease-out duration-300",
4746
+ enterFrom: "opacity-0",
4747
+ enterTo: "opacity-100",
4748
+ leave: "ease-in duration-200",
4749
+ leaveFrom: "opacity-100",
4750
+ leaveTo: "opacity-0",
4751
+ children: /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" })
4752
+ }
4753
+ ),
4754
+ /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-10 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: /* @__PURE__ */ jsx(
4755
+ Transition.Child,
4756
+ {
4757
+ as: Fragment$1,
4758
+ enter: "ease-out duration-300",
4759
+ enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
4760
+ enterTo: "opacity-100 translate-y-0 sm:scale-100",
4761
+ leave: "ease-in duration-200",
4762
+ leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
4763
+ leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
4764
+ children: /* @__PURE__ */ jsx(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__ */ jsxs("div", { className: "flex flex-col h-full flex-1", children: [
4765
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-2", children: [
4766
+ /* @__PURE__ */ jsx("h2", { className: "text-t-sm font-bold", children: "Pr\xE9via da imagem" }),
4767
+ /* @__PURE__ */ jsx(
4768
+ "i",
4769
+ {
4770
+ className: "uil uil-times text-[28px] cursor-pointer",
4771
+ onClick: () => setOpen(false)
4772
+ }
4773
+ )
4774
+ ] }),
4775
+ /* @__PURE__ */ jsx("div", { className: "border-b border-neutral-200 mb-4" }),
4776
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 h-full items-center justify-center rounded-lg w-full ", children: /* @__PURE__ */ jsx("img", { src: previewImage, alt: "previewImage" }) })
4777
+ ] }) })
4778
+ }
4779
+ ) }) })
4780
+ ]
4781
+ }
4782
+ ) });
4783
+ }
4784
+ var FileStatus = ({
4785
+ name,
4786
+ isLoading,
4787
+ size,
4788
+ onRemove,
4789
+ isImage,
4790
+ image
4791
+ }) => {
4792
+ return /* @__PURE__ */ jsx(Fragment, { children: isImage ? /* @__PURE__ */ jsx(
4793
+ ImageFile,
4794
+ {
4795
+ isLoading,
4796
+ name,
4797
+ size,
4798
+ onRemove,
4799
+ image
4800
+ }
4801
+ ) : /* @__PURE__ */ jsx(
4802
+ File,
4803
+ {
4804
+ isLoading,
4805
+ name,
4806
+ size,
4807
+ onRemove,
4808
+ image
4809
+ }
4810
+ ) });
4811
+ };
4812
+ var ImageFile = ({ isLoading, name, size, onRemove, image }) => {
4813
+ const [imagePreviewModal, setImagePreviewModal] = useState(false);
4814
+ const [previewImage, setPreviewImage] = useState();
4815
+ return /* @__PURE__ */ jsx("div", { className: "group h-[130px] w-[130px] flex justify-between border border-neutral-300 rounded-[8px]", children: !isLoading && image ? /* @__PURE__ */ jsxs("div", { className: "w-full h-full relative", children: [
4816
+ /* @__PURE__ */ jsxs("div", { className: "hidden group-hover:block absolute top-3 left-3", children: [
4817
+ /* @__PURE__ */ jsx(
4818
+ Button,
4819
+ {
4820
+ className: "w-[32px] h-[32px]",
4821
+ variant: "iconSecondary",
4822
+ onClick: (evt) => {
4823
+ setImagePreviewModal(true);
4824
+ let newPreviewImage = new window.Image();
4825
+ newPreviewImage.src = image;
4826
+ setPreviewImage(newPreviewImage);
4827
+ },
4828
+ size: "xs",
4829
+ icon: /* @__PURE__ */ jsx("i", { className: "uil uil-search-plus text-[22px]" })
4830
+ }
4831
+ ),
4832
+ /* @__PURE__ */ jsx(
4833
+ ImagePreview,
4834
+ {
4835
+ open: imagePreviewModal,
4836
+ setOpen: setImagePreviewModal,
4837
+ previewImage
4838
+ }
4839
+ )
4840
+ ] }),
4841
+ /* @__PURE__ */ jsx("div", { className: "block absolute top-3 right-3", children: /* @__PURE__ */ jsx(
4842
+ Button,
4843
+ {
4844
+ className: "w-[32px] h-[32px]",
4845
+ variant: "iconSecondary",
4846
+ onClick: onRemove,
4847
+ size: "xs",
4848
+ icon: /* @__PURE__ */ jsx("i", { className: "uil uil-times text-xl" })
4849
+ }
4850
+ ) }),
4851
+ /* @__PURE__ */ jsx("div", { className: "w-full h-full group-hover:bg-[#16203499]/60 z-10", children: /* @__PURE__ */ jsx("img", { className: "relative -z-10", src: image, alt: "tumbnails" }) })
4852
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col justify-between p-[10px]", children: [
4853
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col ", children: [
4854
+ /* @__PURE__ */ jsx("div", { className: "flex self-end", children: /* @__PURE__ */ jsx(
4855
+ "i",
4856
+ {
4857
+ onClick: onRemove,
4858
+ className: "uil uil-times text-[28px] cursor-pointer"
4859
+ }
4860
+ ) }),
4861
+ /* @__PURE__ */ jsx("div", { className: "flex self-center items-center justify-center w-12 h-12 bg-blue-500 rounded-full animate-spin", children: /* @__PURE__ */ jsx(
4862
+ "img",
4863
+ {
4864
+ src: `/spinner-white.svg`,
4865
+ alt: "circle",
4866
+ width: 30,
4867
+ height: 30
4868
+ }
4869
+ ) })
4870
+ ] }),
4871
+ /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
4872
+ /* @__PURE__ */ jsx("span", { className: "text-p-sm", children: name }),
4873
+ /* @__PURE__ */ jsxs("div", { className: "text-xxs text-label", children: [
4874
+ size.to,
4875
+ " KB"
4876
+ ] })
4877
+ ] })
4878
+ ] }) });
4879
+ };
4880
+ var File = ({ isLoading, name, size, onRemove, image }) => {
4881
+ return /* @__PURE__ */ jsxs("div", { className: "w-full md:w-[410px] flex items-center justify-between px-3 py-2 border border-neutral-300 rounded-[4px]", children: [
4882
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-x-2 items-center", children: [
4883
+ isLoading ? /* @__PURE__ */ jsx(SpinnerIcon, { width: 19, height: 19, className: "animate-spin" }) : /* @__PURE__ */ jsx("span", { className: "text-success-500 flex", children: /* @__PURE__ */ jsx("i", { className: "uil uil-check-circle text-[23px]" }) }),
4884
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
4885
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-1", children: [
4886
+ /* @__PURE__ */ jsx("span", { className: "text-label self-end flex", children: /* @__PURE__ */ jsx("i", { className: "uil uil-file text-xs" }) }),
4887
+ /* @__PURE__ */ jsx("div", { className: "text-p-sm", children: /* @__PURE__ */ jsx(
4888
+ "a",
4889
+ {
4890
+ href: image,
4891
+ download: name,
4892
+ className: "text-blue-500 hover:text-blue-500 hover:underline active:text-blue-600 active:underline active:underline-offset-4",
4893
+ children: name
4894
+ }
4895
+ ) })
4896
+ ] }),
4897
+ /* @__PURE__ */ jsxs("div", { className: "text-xxs text-label", children: [
4898
+ size ? size.toLocaleString("en-US", {
4899
+ style: "decimal"
4900
+ // Other options: 'currency', 'percent', etc.
4901
+ }) : null,
4902
+ " ",
4903
+ "KB"
4904
+ ] })
4905
+ ] })
4906
+ ] }),
4907
+ /* @__PURE__ */ jsx(
4908
+ "i",
4909
+ {
4910
+ onClick: onRemove,
4911
+ className: "uil uil-times text-[24px] text-neutral-600 cursor-pointer"
4912
+ }
4913
+ )
4914
+ ] });
4915
+ };
4916
+
4917
+ // src/components/FileUpload/FileUploadReducer.tsx
4918
+ var initialState = {
4919
+ files: []
4920
+ };
4921
+ function reducer(state, action) {
4922
+ var _a, _b;
4923
+ switch (action.type) {
4924
+ case "UPLOAD_START":
4925
+ return {
4926
+ files: [
4927
+ ...state == null ? void 0 : state.files,
4928
+ {
4929
+ name: action.payload.file.name,
4930
+ size: action.payload.file.size,
4931
+ image: action.payload.file,
4932
+ type: action.payload.file.type,
4933
+ loading: true
4934
+ }
4935
+ ]
4936
+ };
4937
+ case "UPLOAD_END":
4938
+ return {
4939
+ files: (_a = state == null ? void 0 : state.files) == null ? void 0 : _a.map((file) => {
4940
+ if (file.name === action.payload.name) {
4941
+ return {
4942
+ ...file,
4943
+ image: action.payload.result,
4944
+ loading: false
4945
+ };
4946
+ }
4947
+ return file;
4948
+ })
4949
+ };
4950
+ case "REMOVE_FILE":
4951
+ return {
4952
+ files: (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.filter(
4953
+ (file) => file.name !== action.payload.name
4954
+ )
4955
+ };
4956
+ default:
4957
+ return state;
4958
+ }
4959
+ }
4960
+ var IconFile = (props) => /* @__PURE__ */ jsx(
4961
+ "svg",
4962
+ {
4963
+ width: "24",
4964
+ height: "30",
4965
+ viewBox: "0 0 24 30",
4966
+ ...props,
4967
+ fill: "none",
4968
+ xmlns: "http://www.w3.org/2000/svg",
4969
+ children: /* @__PURE__ */ jsx(
4970
+ "path",
4971
+ {
4972
+ 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",
4973
+ fill: "#009EDB"
4974
+ }
4975
+ )
4976
+ }
4977
+ );
4978
+ var IconCheck = (props) => /* @__PURE__ */ jsx(
4979
+ "svg",
4980
+ {
4981
+ width: "22",
4982
+ height: "16",
4983
+ viewBox: "0 0 22 16",
4984
+ fill: "none",
4985
+ xmlns: "http://www.w3.org/2000/svg",
4986
+ ...props,
4987
+ children: /* @__PURE__ */ jsx(
4988
+ "path",
4989
+ {
4990
+ 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",
4991
+ fill: "#009EDB"
4992
+ }
4993
+ )
4994
+ }
4995
+ );
4996
+ var IconFileUpload = (props) => /* @__PURE__ */ jsx(
4997
+ "svg",
4998
+ {
4999
+ width: "30",
5000
+ height: "30",
5001
+ viewBox: "0 0 30 30",
5002
+ fill: "none",
5003
+ xmlns: "http://www.w3.org/2000/svg",
5004
+ ...props,
5005
+ children: /* @__PURE__ */ jsx(
5006
+ "path",
5007
+ {
5008
+ 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",
5009
+ fill: "white"
5010
+ }
5011
+ )
5012
+ }
5013
+ );
5014
+ var FileUpload = ({
5015
+ icon = "file",
5016
+ multiple = false,
5017
+ direction = "vertical",
5018
+ isImage = false,
5019
+ setFiles,
5020
+ supportedFormats,
5021
+ validationFunction,
5022
+ files,
5023
+ error,
5024
+ name,
5025
+ limitMessage
5026
+ }) => {
5027
+ var _a;
5028
+ const [state, dispatch] = useReducer(reducer, initialState);
5029
+ const [dragging, setDragging] = useState(false);
5030
+ const [loading, setLoading] = useState(false);
5031
+ const { readString } = usePapaParse();
5032
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
5033
+ const hasError = {
5034
+ hasError: fieldValidationMessages.some((item) => item !== void 0)
5035
+ };
5036
+ useEffect(() => {
5037
+ var _a2;
5038
+ if ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.some((file) => file.loading === true)) {
5039
+ setLoading(true);
5040
+ } else {
5041
+ setLoading(false);
5042
+ }
5043
+ }, [state == null ? void 0 : state.files]);
5044
+ useEffect(() => {
5045
+ if (!files || files.length == 0) {
5046
+ state.files = [];
5047
+ }
5048
+ }, [files]);
5049
+ useEffect(() => {
5050
+ var _a2;
5051
+ if (!multiple && ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.length) === 0 || multiple) {
5052
+ window.addEventListener("dragover", handleDragOver);
5053
+ window.addEventListener("drop", handleDrop);
5054
+ window.addEventListener("dragleave", handleDragLeave);
5055
+ }
5056
+ return () => {
5057
+ window.removeEventListener("dragover", handleDragOver);
5058
+ window.removeEventListener("drop", handleDrop);
5059
+ window.removeEventListener("dragleave", handleDragLeave);
5060
+ };
5061
+ }, [multiple, state.files]);
5062
+ const handleDragOver = (event) => {
5063
+ var _a2;
5064
+ event.preventDefault();
5065
+ event.stopPropagation();
5066
+ if (!multiple && ((_a2 = state.files) == null ? void 0 : _a2.length) === 1) {
5067
+ setDragging(false);
5068
+ } else {
5069
+ setDragging(true);
5070
+ }
5071
+ };
5072
+ const handleDrop = (event) => {
5073
+ var _a2, _b, _c;
5074
+ event.preventDefault();
5075
+ event.stopPropagation();
5076
+ setDragging(false);
5077
+ let files2 = [...(_a2 = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a2.files];
5078
+ if (!multiple && (files2 == null ? void 0 : files2.length) === 1 || multiple && (files2 == null ? void 0 : files2.length) > 0) {
5079
+ const existingFiles = (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.map((f) => f.name);
5080
+ files2 = files2.filter((f) => !(existingFiles == null ? void 0 : existingFiles.includes(f.name)));
5081
+ files2.forEach((file) => {
5082
+ const reader = new FileReader();
5083
+ reader.addEventListener("loadstart", () => {
5084
+ dispatch({
5085
+ type: "UPLOAD_START",
5086
+ payload: { file }
5087
+ });
5088
+ });
5089
+ reader.addEventListener("load", () => {
5090
+ if (!validationFunction) {
5091
+ dispatch({
5092
+ type: "UPLOAD_END",
5093
+ payload: {
5094
+ name: file.name,
5095
+ result: reader.result
5096
+ }
5097
+ });
5098
+ setFiles && setFiles(file);
5099
+ }
5100
+ if (validationFunction(file)) {
5101
+ setTimeout(() => {
5102
+ dispatch({
5103
+ type: "UPLOAD_END",
5104
+ payload: {
5105
+ name: file.name,
5106
+ result: reader.result
5107
+ }
5108
+ });
5109
+ }, 1e3);
5110
+ setFiles && setFiles(file);
5111
+ } else {
5112
+ dispatch({
5113
+ type: "REMOVE_FILE",
5114
+ payload: {
5115
+ name: file.name
5116
+ }
5117
+ });
5118
+ }
5119
+ });
5120
+ reader.readAsDataURL(file);
5121
+ });
5122
+ (_c = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _c.clearData();
5123
+ }
5124
+ };
5125
+ const handleDragLeave = (event) => {
5126
+ if (event.screenX === 0 && event.screenY === 0) {
5127
+ setDragging(false);
5128
+ }
5129
+ event.stopPropagation();
5130
+ event.preventDefault();
5131
+ };
5132
+ const onChangeFile = (e) => {
5133
+ const files2 = Object.values(e.target.files);
5134
+ e.target.value = null;
5135
+ files2.forEach((file) => {
5136
+ const reader = new FileReader();
5137
+ reader.addEventListener("loadstart", () => {
5138
+ dispatch({
5139
+ type: "UPLOAD_START",
5140
+ payload: { file }
5141
+ });
5142
+ });
5143
+ reader.addEventListener("load", () => {
5144
+ setTimeout(() => {
5145
+ readString(String(file), {
5146
+ delimiter: ",",
5147
+ worker: true,
5148
+ complete: (results) => {
5149
+ if (!validationFunction) {
5150
+ dispatch({
5151
+ type: "UPLOAD_END",
5152
+ payload: {
5153
+ name: file.name,
5154
+ result: reader.result
5155
+ }
5156
+ });
5157
+ setFiles && setFiles(file);
5158
+ } else if (validationFunction(file)) {
5159
+ dispatch({
5160
+ type: "UPLOAD_END",
5161
+ payload: {
5162
+ name: file.name,
5163
+ result: reader.result
5164
+ }
5165
+ });
5166
+ setFiles && setFiles(file);
5167
+ } else {
5168
+ dispatch({
5169
+ type: "REMOVE_FILE",
5170
+ payload: {
5171
+ name: file.name
5172
+ }
5173
+ });
5174
+ }
5175
+ }
5176
+ });
5177
+ }, 1e3);
5178
+ });
5179
+ reader.readAsDataURL(file);
5180
+ });
5181
+ };
5182
+ const renderContent = () => {
5183
+ var _a2;
5184
+ if (loading) {
5185
+ return /* @__PURE__ */ jsx(LoadingContent, {});
5186
+ } else if (dragging) {
5187
+ return /* @__PURE__ */ jsx(DraggingContent, {});
5188
+ } else if (!multiple && ((_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.length) > 0) {
5189
+ return /* @__PURE__ */ jsx(BlockedContent, {});
5190
+ }
5191
+ return /* @__PURE__ */ jsx(
5192
+ DefaultContent,
5193
+ {
5194
+ icon,
5195
+ formats: supportedFormats == null ? void 0 : supportedFormats.join(", ").replace(/\./g, "").toUpperCase(),
5196
+ limitMessage
5197
+ }
5198
+ );
5199
+ };
5200
+ const removeFile = (name2) => {
5201
+ dispatch({
5202
+ type: "REMOVE_FILE",
5203
+ payload: {
5204
+ name: name2
5205
+ }
5206
+ });
5207
+ setFiles && setFiles(null);
5208
+ };
5209
+ return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
5210
+ "div",
5211
+ {
5212
+ className: clsx9(
5213
+ "flex gap-1 w-full rounded-lg items-center justify-center",
5214
+ {
5215
+ "flex-col gap-1": direction === "vertical"
5216
+ }
5217
+ ),
5218
+ children: [
5219
+ /* @__PURE__ */ jsx(
5220
+ "input",
5221
+ {
5222
+ id: "file-upload",
5223
+ name: "file-upload",
5224
+ type: "file",
5225
+ accept: supportedFormats == null ? void 0 : supportedFormats.join(","),
5226
+ multiple,
5227
+ className: "sr-only",
5228
+ onChange: onChangeFile
5229
+ }
5230
+ ),
5231
+ renderContent(),
5232
+ /* @__PURE__ */ jsx(
5233
+ "div",
5234
+ {
5235
+ className: clsx9(
5236
+ {
5237
+ "flex flex-col w-full gap-y-[6px]": direction === "vertical" && !isImage
5238
+ },
5239
+ {
5240
+ "flex flex-col gap-y-[6px] w-full": direction === "horizontal" && !isImage
5241
+ },
5242
+ {
5243
+ "flex gap-[6px]": direction === "vertical" && isImage
5244
+ },
5245
+ {
5246
+ "flex gap-[6px]": direction === "horizontal" && !isImage
5247
+ }
5248
+ ),
5249
+ children: (_a = state == null ? void 0 : state.files) == null ? void 0 : _a.map((file) => /* @__PURE__ */ jsx(
5250
+ FileStatus,
5251
+ {
5252
+ name: file == null ? void 0 : file.name,
5253
+ onRemove: () => removeFile(file == null ? void 0 : file.name),
5254
+ isLoading: file.loading,
5255
+ size: file.size,
5256
+ isImage: file.image && isImage,
5257
+ image: file.image
5258
+ },
5259
+ file.name
5260
+ ))
5261
+ }
5262
+ ),
5263
+ hasError && fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
5264
+ "div",
5265
+ {
5266
+ className: "text-dangerous-500 text-xs -mt-[6px]",
5267
+ role: "alert",
5268
+ "aria-label": message,
5269
+ children: message
5270
+ },
5271
+ index
5272
+ ))
5273
+ ]
5274
+ }
5275
+ ) });
5276
+ };
5277
+ var DefaultContent = ({ formats, icon, limitMessage }) => /* @__PURE__ */ jsx("div", { className: "w-full md:w-[410px] h-full flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col text-center items-center", children: [
5278
+ /* @__PURE__ */ jsx(
5279
+ "div",
5280
+ {
5281
+ className: "flex items-center justify-center w-14 h-14 mb-2 bg-blue-100 rounded-full",
5282
+ children: icon === "file" ? /* @__PURE__ */ jsx(IconFile, {}) : /* @__PURE__ */ jsx("i", { className: "uil uil-image-plus text-[28px] text-blue-500" })
5283
+ }
5284
+ ),
5285
+ /* @__PURE__ */ jsx("h1", { className: "font-bold text-base", children: icon === "file" ? "Arraste o arquivo e solte aqui" : "Arraste as imagens e solte aqui" }),
5286
+ /* @__PURE__ */ jsx(
5287
+ "label",
5288
+ {
5289
+ htmlFor: "file-upload",
5290
+ className: "relative leading-none cursor-pointer text-sm bg-white focus-within:outline-none",
5291
+ children: /* @__PURE__ */ jsxs("p", { children: [
5292
+ "ou\xA0",
5293
+ /* @__PURE__ */ jsx("span", { className: "text-blue-500", children: "selecione do seu computador" })
5294
+ ] })
5295
+ }
5296
+ ),
5297
+ /* @__PURE__ */ jsxs("small", { className: "text-label text-xxs leading-5", children: [
5298
+ "Formatos: ",
5299
+ formats,
5300
+ " | ",
5301
+ limitMessage ? limitMessage : "At\xE9 25 MB"
5302
+ ] })
5303
+ ] }) });
5304
+ var BlockedContent = () => /* @__PURE__ */ jsx("div", { className: "w-full md:w-[410px] h-full flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col text-center items-center justify-center", children: [
5305
+ /* @__PURE__ */ jsx(
5306
+ "div",
5307
+ {
5308
+ className: "flex items-center justify-center w-14 h-14 mb-1 bg-blue-100 rounded-full",
5309
+ children: /* @__PURE__ */ jsx(IconCheck, {})
5310
+ }
5311
+ ),
5312
+ /* @__PURE__ */ jsx("h1", { className: "font-bold text-base mt-1", children: "Arquivo carregado!" })
5313
+ ] }) });
5314
+ var DraggingContent = () => /* @__PURE__ */ jsx("div", { className: "w-full md:w-[410px] h-[152px] bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col p-4 custom-border justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col h-full text-center items-center justify-center", children: [
5315
+ /* @__PURE__ */ jsx(
5316
+ "div",
5317
+ {
5318
+ className: "flex items-center justify-center w-14 h-14 mb-2 bg-blue-500 rounded-full",
5319
+ children: /* @__PURE__ */ jsx(IconFileUpload, {})
5320
+ }
5321
+ ),
5322
+ /* @__PURE__ */ jsx("h1", { className: "font-bold text-base text-blue-500", children: "Solte aqui para carregar o arquivo" })
5323
+ ] }) }) });
5324
+ var LoadingContent = () => /* @__PURE__ */ jsx("div", { className: "w-full h-full bg-blue-100 flex flex-col p-4 custom-border", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col text-center items-center justify-center", children: [
5325
+ /* @__PURE__ */ jsx(SpinnerIcon, { className: "animate-spin" }),
5326
+ /* @__PURE__ */ jsx("h1", { className: "font-bold text-base text-blue-500", children: "Carregando arquivo..." })
5327
+ ] }) });
5328
+ function InfoIcon({
5329
+ content,
5330
+ id = "info-id"
5331
+ }) {
5332
+ return /* @__PURE__ */ jsxs(
5333
+ "div",
5334
+ {
5335
+ "data-tooltip-id": id,
5336
+ "data-tooltip-html": content,
5337
+ "data-tooltip-place": "top",
5338
+ children: [
5339
+ /* @__PURE__ */ jsx(Popover3, { id }),
5340
+ /* @__PURE__ */ jsx("i", { className: "uil uil-info-circle text-p-lg text-neutral-400" })
5341
+ ]
5342
+ }
5343
+ );
5344
+ }
5345
+
5346
+ // src/components/MultiSelect/MultiSelect.styles.tsx
5347
+ var customStyles3 = {
5348
+ indicatorSeparator: (provided, { hasValue }) => {
5349
+ return {
5350
+ ...provided,
5351
+ marginTop: "-6px",
5352
+ backgroundColor: hasValue ? "var(--input)" : "transparent"
5353
+ };
5354
+ },
5355
+ input: (provided, state) => ({
5356
+ ...provided,
5357
+ outline: "none",
5358
+ paddingLeft: state.selectProps.hasIcon ? "2.5rem" : "0px"
5359
+ }),
5360
+ clearIndicator: (provided) => ({
5361
+ ...provided,
5362
+ color: "var(--label)",
5363
+ marginTop: "-6px",
5364
+ ":hover": {
5365
+ color: "var(--label)"
5366
+ }
5367
+ }),
5368
+ dropdownIndicator: (provided, state) => ({
5369
+ ...provided,
5370
+ color: "var(--paragraph)",
5371
+ display: state.selectProps.isTargeted ? "none" : "flex",
5372
+ paddingRight: "12px",
5373
+ marginTop: "-6px",
5374
+ ":hover": {
5375
+ color: "var(--paragraph)"
5376
+ }
5377
+ }),
5378
+ menu: (provided) => ({
5379
+ ...provided,
5380
+ marginTop: "4px",
5381
+ border: "1px solid var(--neutral-300)",
5382
+ boxShadow: "none",
5383
+ borderRadius: "8px",
5384
+ padding: "0px 8px",
5385
+ zIndex: 70,
5386
+ background: "white"
5387
+ }),
5388
+ singleValue: (base, state) => ({
5389
+ ...base,
5390
+ color: state.data.value === "active" ? "#0EAF86" : "black",
5391
+ display: "flex"
5392
+ }),
5393
+ control: (provided, state) => ({
5394
+ ...provided,
5395
+ cursor: "pointer",
5396
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.menuIsOpen ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)",
5397
+ boxShadow: "none",
5398
+ outline: "none",
5399
+ borderRadius: "0.5rem",
5400
+ paddingLeft: "0px",
5401
+ placeholder: " ",
5402
+ minHeight: "46px",
5403
+ alignItems: "end",
5404
+ paddingTop: "8px",
5405
+ ":hover": {
5406
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.menuIsOpen ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)"
5407
+ }
5408
+ }),
5409
+ multiValue: (provided) => ({
5410
+ ...provided,
5411
+ borderRadius: "20px",
5412
+ backgroundColor: "var(--neutral-100)",
5413
+ padding: "0px"
5414
+ }),
5415
+ multiValueLabel: (provided) => ({
5416
+ ...provided,
5417
+ color: "var(--paragraph)",
5418
+ paddingTop: "2px",
5419
+ lineHeight: "16px"
5420
+ }),
5421
+ multiValueRemove: (provided) => ({
5422
+ ...provided,
5423
+ color: "var(--neutral-400)",
5424
+ paddingRight: "6px",
5425
+ paddingLeft: "0px",
5426
+ ":hover": {
5427
+ color: "var(--dangerous-500)"
5428
+ }
5429
+ }),
5430
+ option: (provided, state) => {
5431
+ let color = state.isSelected && !state.selectProps.isTargeted ? "white" : "var(--paragraph)";
5432
+ if (state.isDisabled) {
5433
+ color = "rgba(0,0,0,0.30)";
5434
+ }
5435
+ return {
5436
+ ...provided,
5437
+ height: "44px",
5438
+ cursor: "pointer",
5439
+ borderRadius: "8px",
5440
+ margin: "4px 0px",
5441
+ backgroundColor: state.isSelected && !state.selectProps.isTargeted ? "var(--blue-500)" : state.isFocused ? "var(--neutral-200)" : "white",
5442
+ color,
5443
+ fontWeight: state.isSelected && !state.selectProps.isTargeted ? 700 : 400,
5444
+ "&:hover": {
5445
+ backgroundColor: state.isSelected && !state.selectProps.isTargeted ? "var(--blue-500)" : "var(--neutral-200)"
5446
+ },
5447
+ "&:active": {
5448
+ backgroundColor: "var(--blue-500)",
5449
+ color: "white",
5450
+ fontWeight: 700
5451
+ },
5452
+ "&:active svg": {
5453
+ color: "white",
5454
+ fontWeight: 700
5455
+ },
5456
+ " svg": {
5457
+ color: "white"
5458
+ }
5459
+ };
5460
+ },
5461
+ container: (provided) => ({
5462
+ ...provided,
5463
+ border: "none",
5464
+ outline: "none",
5465
+ boxShadow: "none",
5466
+ padding: "none",
5467
+ margin: "none"
5468
+ })
5469
+ };
5470
+ var MultiSelect = ({
5471
+ name,
5472
+ options,
5473
+ label = "",
5474
+ error,
5475
+ defaultValue,
5476
+ control,
5477
+ isSearchable = false,
5478
+ required,
5479
+ disabled
5480
+ }) => {
5481
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
5482
+ const hasError = {
5483
+ hasError: fieldValidationMessages.some((item) => item !== void 0)
5484
+ };
5485
+ return /* @__PURE__ */ jsx(
5486
+ Controller,
5487
+ {
5488
+ name,
5489
+ control,
5490
+ defaultValue,
5491
+ render: ({ field }) => {
5492
+ const { DropdownIndicator, Option } = components;
5493
+ const DropdownIndicatorCustom = (props) => {
5494
+ return /* @__PURE__ */ jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-[20px]" }) });
5495
+ };
5496
+ const IconOption = (props) => {
5497
+ return /* @__PURE__ */ jsx(Option, { ...props, children: /* @__PURE__ */ jsx(
5498
+ "div",
5499
+ {
5500
+ style: {
5501
+ display: "flex",
5502
+ alignItems: "center",
5503
+ justifyContent: "space-between",
5504
+ height: "100%"
5505
+ },
5506
+ children: /* @__PURE__ */ jsx("span", { className: clsx9("text-p-md focus:text-white"), children: props.data.label })
5507
+ }
5508
+ ) });
5509
+ };
5510
+ const NoOptionsMessage = () => {
5511
+ return /* @__PURE__ */ jsx("div", { className: "p-2 text-neutral-300", children: "Nenhum dado encontrado" });
5512
+ };
5513
+ return /* @__PURE__ */ jsxs("div", { className: "relative h-full", id: "multiselect", children: [
5514
+ /* @__PURE__ */ jsx(
5515
+ Select,
5516
+ {
5517
+ ...field,
5518
+ ...hasError,
5519
+ isDisabled: disabled,
5520
+ name: field.name,
5521
+ ref: field.ref,
5522
+ styles: customStyles3,
5523
+ placeholder: " ",
5524
+ isSearchable,
5525
+ options,
5526
+ isMulti: true,
5527
+ tabSelectsValue: true,
5528
+ components: {
5529
+ ValueContainer: ValueContainer3,
5530
+ Option: IconOption,
5531
+ NoOptionsMessage,
5532
+ DropdownIndicator: DropdownIndicatorCustom
5533
+ },
5534
+ isOptionDisabled: (option) => option.blocked,
5535
+ hideSelectedOptions: false,
5536
+ closeMenuOnSelect: false
5537
+ }
5538
+ ),
5539
+ /* @__PURE__ */ jsxs(
5540
+ "span",
5541
+ {
5542
+ className: clsx9("text-label text-sm left-2.5", {
5543
+ [" scale-75 -translate-y-3 "]: field.value && field.value.length > 0,
5544
+ ["text-dangerous-500"]: hasError.hasError
5545
+ }),
5546
+ children: [
5547
+ label,
5548
+ required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
5549
+ ]
5550
+ }
5551
+ ),
5552
+ fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
5553
+ "div",
5554
+ {
5555
+ className: "text-dangerous-500 text-xs -mt-[5px]",
5556
+ role: "alert",
5557
+ "aria-label": message,
5558
+ children: message
5559
+ },
5560
+ index
5561
+ ))
5562
+ ] });
5563
+ }
5564
+ }
5565
+ );
5566
+ };
5567
+ var ValueContainer3 = ({ children, ...props }) => {
5568
+ return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
5569
+ };
5570
+
5571
+ // src/components/InputTag/InputTag.styles.tsx
5572
+ var customStyles4 = {
5573
+ input: (provided) => ({
5574
+ ...provided,
5575
+ outline: "none",
5576
+ height: "100%"
5577
+ }),
5578
+ indicatorSeparator: (provided) => ({
5579
+ ...provided,
5580
+ backgroundColor: "transparent"
5581
+ }),
5582
+ clearIndicator: (provided) => ({
5583
+ ...provided,
5584
+ color: "var(--label)",
5585
+ ":hover": {
5586
+ color: "var(--label)"
5587
+ }
5588
+ }),
5589
+ dropdownIndicator: (provided) => ({
5590
+ ...provided,
5591
+ display: "none"
5592
+ }),
5593
+ menu: (provided) => ({
5594
+ ...provided,
5595
+ marginTop: "4px",
5596
+ border: "1px solid var(--neutral-300)",
5597
+ boxShadow: "none",
5598
+ borderRadius: "8px",
5599
+ padding: "0px 8px",
5600
+ zIndex: 30,
5601
+ background: "white"
5602
+ }),
5603
+ control: (provided, state) => {
5604
+ return {
5605
+ ...provided,
5606
+ cursor: "pointer",
5607
+ paddingTop: state.selectProps.hasLabel ? "18px" : "0px",
5608
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.isFocused ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)",
5609
+ boxShadow: "none",
5610
+ outline: "none",
5611
+ borderRadius: "0.5rem",
5612
+ // height: "52px",
5613
+ // paddingLeft: '8px',
5614
+ placeholder: state.selectProps.hasLabel ? " " : state.selectProps.placeholder,
5615
+ alignItems: state.selectProps.hasLabel ? "end" : "center",
5616
+ ":hover": {
5617
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.isFocused ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)"
5618
+ // height: "52px",
5619
+ },
5620
+ ":focus-within": {
5621
+ // height: "52px",
5622
+ }
5623
+ };
5624
+ },
5625
+ multiValue: (provided) => ({
5626
+ ...provided,
5627
+ borderRadius: "20px",
5628
+ backgroundColor: "var(--neutral-100)",
5629
+ padding: "0px 6px"
5630
+ }),
5631
+ multiValueLabel: (provided) => ({
5632
+ ...provided,
5633
+ color: "var(--paragraph)"
5634
+ }),
5635
+ multiValueRemove: (provided) => ({
5636
+ ...provided,
5637
+ color: "var(--neutral-400)",
5638
+ ":hover": {
5639
+ color: "var(--dangerous-500)"
5640
+ }
5641
+ }),
5642
+ container: (provided) => ({
5643
+ ...provided,
5644
+ border: "none",
5645
+ outline: "none",
5646
+ boxShadow: "none",
5647
+ padding: "none",
5648
+ margin: "none"
5649
+ })
5650
+ };
5651
+ var InputTag = ({
5652
+ name,
5653
+ label = "",
5654
+ error,
5655
+ defaultValue,
5656
+ control,
5657
+ required,
5658
+ placeholder,
5659
+ blockSpaces = false
5660
+ }) => {
5661
+ const [inputValue, setInputValue] = useState("");
5662
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
5663
+ const hasError = {
5664
+ hasError: fieldValidationMessages.some((item) => item !== void 0)
5665
+ };
5666
+ const removeSpaces = (value) => {
5667
+ return value == null ? void 0 : value.replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
5668
+ };
5669
+ return /* @__PURE__ */ jsx(
5670
+ Controller,
5671
+ {
5672
+ name,
5673
+ control,
5674
+ defaultValue,
5675
+ render: ({ field }) => {
5676
+ const handleKeyDown = (event) => {
5677
+ if (!inputValue || ((field == null ? void 0 : field.value) || []).find((item) => (item == null ? void 0 : item.value) === inputValue))
5678
+ return;
5679
+ switch (event.key) {
5680
+ case "Enter":
5681
+ case "Tab":
5682
+ field.onChange([
5683
+ ...(field == null ? void 0 : field.value) || [],
5684
+ {
5685
+ label: blockSpaces ? removeSpaces(inputValue) : inputValue,
5686
+ value: blockSpaces ? removeSpaces(inputValue) : inputValue
5687
+ }
5688
+ ]);
5689
+ setInputValue("");
5690
+ event.preventDefault();
5691
+ }
5692
+ };
5693
+ const hasLabel = {
5694
+ hasLabel: (label == null ? void 0 : label.length) > 0
5695
+ };
5696
+ return /* @__PURE__ */ jsxs(
5697
+ "div",
5698
+ {
5699
+ className: `relative ${label ? "with-label" : ""}`,
5700
+ id: "inputtag",
5701
+ children: [
5702
+ /* @__PURE__ */ jsx(
5703
+ Select,
5704
+ {
5705
+ ...hasError,
5706
+ ...hasLabel,
5707
+ ...{ placeholder },
5708
+ ...field,
5709
+ styles: customStyles4,
5710
+ menuIsOpen: false,
5711
+ placeholder: hasLabel.hasLabel ? " " : placeholder,
5712
+ isMulti: true,
5713
+ tabSelectsValue: true,
5714
+ onKeyDown: handleKeyDown,
5715
+ isClearable: false,
5716
+ inputValue,
5717
+ onInputChange: (newValue) => setInputValue(newValue),
5718
+ isOptionDisabled: (option) => option.blocked
5719
+ }
5720
+ ),
5721
+ /* @__PURE__ */ jsxs(
5722
+ "span",
5723
+ {
5724
+ className: clsx9("text-label text-sm left-2.5", {
5725
+ [" scale-75 -translate-y-3 "]: field.value && field.value.length > 0,
5726
+ ["text-dangerous-500"]: hasError.hasError
5727
+ }),
5728
+ children: [
5729
+ label,
5730
+ required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
5731
+ ]
5732
+ }
5733
+ ),
5734
+ fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
5735
+ "div",
5736
+ {
5737
+ className: "text-dangerous-500 text-xs mt-[2px]",
5738
+ role: "alert",
5739
+ "aria-label": message,
5740
+ children: message
5741
+ },
5742
+ index
5743
+ ))
5744
+ ]
5745
+ }
5746
+ );
5747
+ }
5748
+ }
5749
+ );
5750
+ };
5751
+ var ValueContainer4 = ({ children, ...props }) => {
5752
+ return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
5753
+ };
5754
+ InputTag.displayName = "InputTag";
5755
+
5756
+ // src/components/MultiSelectBottom/MultiSelectBottom.styles.tsx
5757
+ var customStyles5 = {
5758
+ indicatorSeparator: (provided, { hasValue }) => {
5759
+ return {
5760
+ ...provided,
5761
+ display: "none"
5762
+ };
5763
+ },
5764
+ input: (provided, state) => ({
5765
+ ...provided,
5766
+ outline: "none",
5767
+ paddingLeft: state.selectProps.hasIcon ? "2.5rem" : "0px"
5768
+ }),
5769
+ clearIndicator: (provided) => ({
5770
+ ...provided,
5771
+ display: "none"
5772
+ }),
5773
+ dropdownIndicator: (provided, state) => ({
5774
+ ...provided,
5775
+ color: "var(--paragraph)",
5776
+ display: state.selectProps.isTargeted ? "none" : "flex",
5777
+ paddingRight: "12px",
5778
+ ":hover": {
5779
+ color: "var(--paragraph)"
5780
+ }
5781
+ }),
5782
+ menu: (provided) => ({
5783
+ ...provided,
5784
+ marginTop: "4px",
5785
+ border: "1px solid var(--neutral-300)",
5786
+ boxShadow: "none",
5787
+ borderRadius: "8px",
5788
+ padding: "0px 8px",
5789
+ zIndex: 70,
5790
+ background: "white"
5791
+ }),
5792
+ singleValue: (base, state) => ({
5793
+ ...base,
5794
+ color: state.data.value === "active" ? "#0EAF86" : "black",
5795
+ display: "flex"
5796
+ }),
5797
+ control: (provided, state) => ({
5798
+ ...provided,
5799
+ cursor: "pointer",
5800
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.menuIsOpen ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)",
5801
+ boxShadow: "none",
5802
+ outline: "none",
5803
+ borderRadius: "0.5rem",
5804
+ paddingLeft: "8px",
5805
+ placeholder: " ",
5806
+ height: "46px",
5807
+ alignItems: "end",
5808
+ ":hover": {
5809
+ border: state.selectProps.hasError ? "1px solid var(--dangerous-500)" : state.menuIsOpen ? "1px solid var(--blue-500)" : "1px solid var(--neutral-300)"
5810
+ }
5811
+ }),
5812
+ multiValue: (provided) => ({
5813
+ ...provided,
5814
+ borderRadius: "20px",
5815
+ backgroundColor: "var(--neutral-100)",
5816
+ padding: "0px 0px",
5817
+ display: "none"
5818
+ }),
5819
+ multiValueLabel: (provided) => ({
5820
+ ...provided,
5821
+ color: "var(--paragraph)",
5822
+ paddingTop: "6px"
5823
+ }),
5824
+ multiValueRemove: (provided) => ({
5825
+ ...provided,
5826
+ paddingRight: "6px",
5827
+ paddingLeft: "0px",
5828
+ color: "var(--neutral-400)",
5829
+ ":hover": {
5830
+ color: "var(--dangerous-500)"
5831
+ }
5832
+ }),
5833
+ option: (provided, state) => {
5834
+ let color = state.isSelected && !state.selectProps.isTargeted ? "white" : "var(--paragraph)";
5835
+ if (state.isDisabled) {
5836
+ color = "rgba(0,0,0,0.30)";
5837
+ }
5838
+ return {
5839
+ ...provided,
5840
+ height: "44px",
5841
+ cursor: "pointer",
5842
+ borderRadius: "8px",
5843
+ margin: "4px 0px",
5844
+ backgroundColor: state.isSelected && !state.selectProps.isTargeted ? "var(--blue-500)" : state.isFocused ? "var(--neutral-200)" : "white",
5845
+ color,
5846
+ fontWeight: state.isSelected && !state.selectProps.isTargeted ? 700 : 400,
5847
+ "&:hover": {
5848
+ backgroundColor: state.isSelected && !state.selectProps.isTargeted ? "var(--blue-500)" : "var(--neutral-200)"
5849
+ },
5850
+ "&:active": {
5851
+ backgroundColor: "var(--blue-500)",
5852
+ color: "white",
5853
+ fontWeight: 700
5854
+ },
5855
+ "&:active svg": {
5856
+ color: "white",
5857
+ fontWeight: 700
5858
+ },
5859
+ " svg": {
5860
+ color: "white"
5861
+ }
5862
+ };
5863
+ },
5864
+ container: (provided) => ({
5865
+ ...provided,
5866
+ border: "none",
5867
+ outline: "none",
5868
+ boxShadow: "none",
5869
+ padding: "none",
5870
+ margin: "none"
5871
+ }),
5872
+ valueContainer: (provided) => ({
5873
+ ...provided,
5874
+ padding: "2px 0px"
5875
+ })
5876
+ };
5877
+ var MultiSelectBottom = ({
5878
+ name,
5879
+ options,
5880
+ label = "",
5881
+ error,
5882
+ defaultValue,
5883
+ control,
5884
+ isSearchable = false,
5885
+ required,
5886
+ disabled,
5887
+ emptyMessage,
5888
+ filterOptions,
5889
+ debounce: debounce2 = 0
5890
+ }) => {
5891
+ const [loading, setLoading] = useState(false);
5892
+ const [optionsList, setOptionsList] = useState(() => options || []);
5893
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
5894
+ const hasError = {
5895
+ hasError: fieldValidationMessages.some((item) => item !== void 0)
5896
+ };
5897
+ ({
5898
+ hasLabel: (label == null ? void 0 : label.length) > 0
5899
+ });
5900
+ const loadOptions = (inputValue) => {
5901
+ setLoading(true);
5902
+ if (isSearchable && filterOptions) {
5903
+ if (!debounce2 || debounce2 && inputValue.length >= debounce2) {
5904
+ const result = filterOptions(inputValue);
5905
+ setLoading(false);
5906
+ return result;
5907
+ }
5908
+ } else {
5909
+ setOptionsList(options);
5910
+ }
5911
+ };
5912
+ return /* @__PURE__ */ jsx(
5913
+ Controller,
5914
+ {
5915
+ name,
5916
+ control,
5917
+ defaultValue,
5918
+ render: ({ field }) => {
5919
+ var _a, _b;
5920
+ const { DropdownIndicator, Option } = components;
5921
+ const DropdownIndicatorCustom = (props) => {
5922
+ return /* @__PURE__ */ jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-[20px]" }) });
5923
+ };
5924
+ const NoOptionsMessage = (props) => {
5925
+ var _a2;
5926
+ if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
5927
+ return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
5928
+ "Digite ",
5929
+ debounce2,
5930
+ " ou mais caracteres para pesquisar"
5931
+ ] });
5932
+ } else if (props.selectProps.inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
5933
+ return /* @__PURE__ */ jsx("div", { className: "p-2 text-neutral-300", children: "Nenhum dado encontrado" });
5934
+ }
5935
+ };
5936
+ const IconOption = (props) => {
5937
+ return /* @__PURE__ */ jsx(Option, { ...props, children: /* @__PURE__ */ jsx(
5938
+ "div",
5939
+ {
5940
+ style: {
5941
+ display: "flex",
5942
+ alignItems: "center",
5943
+ justifyContent: "space-between",
5944
+ height: "100%"
5945
+ },
5946
+ children: /* @__PURE__ */ jsx("span", { className: clsx9("text-p-md focus:text-white"), children: props.data.label })
5947
+ }
5948
+ ) });
5949
+ };
5950
+ const LoadingMessage = (props) => {
5951
+ if (!debounce2 || debounce2 && props.selectProps.inputValue.length >= debounce2) {
5952
+ return /* @__PURE__ */ jsxs(
5953
+ "div",
5954
+ {
5955
+ ...props.innerProps,
5956
+ className: "flex items-center gap-[6px] p-2",
5957
+ children: [
5958
+ /* @__PURE__ */ jsx(
5959
+ "img",
5960
+ {
5961
+ className: "animate-spin ",
5962
+ src: "/spinner.svg",
5963
+ alt: "circle",
5964
+ width: 16,
5965
+ height: 16
5966
+ }
5967
+ ),
5968
+ "Buscando..."
5969
+ ]
5970
+ }
5971
+ );
5972
+ } else if (debounce2 && props.selectProps.inputValue.length < debounce2) {
5973
+ return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
5974
+ "Digite ",
5975
+ debounce2,
5976
+ " ou mais caracteres para pesquisar"
5977
+ ] });
5978
+ }
5979
+ };
5980
+ return /* @__PURE__ */ jsxs("div", { className: "relative h-full", id: "multiselectbottom", children: [
5981
+ /* @__PURE__ */ jsx(
5982
+ AsyncSelect,
5983
+ {
5984
+ ...field,
5985
+ ...hasError,
5986
+ isDisabled: disabled,
5987
+ name: field.name,
5988
+ ref: field.ref,
5989
+ styles: customStyles5,
5990
+ placeholder: " ",
5991
+ isSearchable,
5992
+ options: optionsList,
5993
+ isMulti: true,
5994
+ defaultOptions: debounce2 > 0 ? false : options ? optionsList : true,
5995
+ loadOptions,
5996
+ tabSelectsValue: true,
5997
+ components: {
5998
+ ValueContainer: ValueContainer5,
5999
+ Option: IconOption,
6000
+ NoOptionsMessage,
6001
+ LoadingMessage,
6002
+ DropdownIndicator: DropdownIndicatorCustom
6003
+ },
6004
+ isOptionDisabled: (option) => option.blocked,
6005
+ hideSelectedOptions: false,
6006
+ closeMenuOnSelect: false,
6007
+ backspaceRemovesValue: false
6008
+ }
6009
+ ),
6010
+ /* @__PURE__ */ jsxs(
6011
+ "span",
6012
+ {
6013
+ className: clsx9("text-label text-sm left-2.5", {
6014
+ ["text-dangerous-500"]: hasError.hasError
6015
+ }),
6016
+ children: [
6017
+ label,
6018
+ required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
6019
+ ]
6020
+ }
6021
+ ),
6022
+ fieldValidationMessages == null ? void 0 : fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
6023
+ "div",
6024
+ {
6025
+ className: "text-dangerous-500 text-xs mt-[3px]",
6026
+ role: "alert",
6027
+ "aria-label": message,
6028
+ children: message
6029
+ },
6030
+ index
6031
+ )),
6032
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) > 0 ? (_b = field == null ? void 0 : field.value) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsxs("div", { className: "text-p-sm bg-neutral-100 rounded-[20px] py-2 px-3 flex items-center justify-between mt-3", children: [
6033
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: item.label }),
6034
+ /* @__PURE__ */ jsx(
6035
+ "button",
6036
+ {
6037
+ type: "button",
6038
+ onClick: () => {
6039
+ const copy = [...field.value];
6040
+ const index = copy.findIndex(
6041
+ (opt) => opt.value == item.value
6042
+ );
6043
+ copy.splice(index, 1);
6044
+ field.onChange(copy);
6045
+ },
6046
+ children: /* @__PURE__ */ jsx("i", { className: "uil uil-times text-sm text-neutral-400" })
6047
+ }
6048
+ )
6049
+ ] })) : /* @__PURE__ */ jsx("span", { className: "text-p-md text-label pt-2 pl-2", children: emptyMessage || "Nenhuma op\xE7\xE3o selecionada" }) })
6050
+ ] });
6051
+ }
6052
+ }
6053
+ );
6054
+ };
6055
+ var ValueContainer5 = ({ children, ...props }) => {
6056
+ return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
6057
+ };
6058
+ MultiSelectBottom.displayName = "MultiSelectBottom";
6059
+ function PageBox(props) {
6060
+ return /* @__PURE__ */ jsxs("div", { className: "py-5 px-4 border border-neutral-200 rounded-lg", children: [
6061
+ (props == null ? void 0 : props.title) && /* @__PURE__ */ jsx("h1", { className: "text-t-xs font-bold text-title mb-4", children: props.title }),
6062
+ props == null ? void 0 : props.children
6063
+ ] });
6064
+ }
6065
+ var PageHeader = ({
6066
+ title,
6067
+ breadcrumbs,
6068
+ children,
6069
+ description
6070
+ }) => {
6071
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row place-content-between font-sans pb-4 w-full", children: [
6072
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
6073
+ /* @__PURE__ */ jsx("div", { className: "flex flex-row items-center text-p-lg text-label", children: breadcrumbs && breadcrumbs.map((breadcrumb, index) => /* @__PURE__ */ jsx("div", { children: breadcrumb.link ? /* @__PURE__ */ jsx(
6074
+ "a",
6075
+ {
6076
+ href: breadcrumb.link,
6077
+ className: "hover:no-underline hover:text-paragraph",
6078
+ children: /* @__PURE__ */ jsxs("span", { className: "cursor-pointer flex items-center", children: [
6079
+ index > 0 && /* @__PURE__ */ jsx("i", { className: "uil uil-angle-right" }),
6080
+ breadcrumb.name
6081
+ ] })
6082
+ }
6083
+ ) : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
6084
+ /* @__PURE__ */ jsx("i", { className: "uil uil-angle-right" }),
6085
+ /* @__PURE__ */ jsx(
6086
+ "span",
6087
+ {
6088
+ className: index === breadcrumbs.length - 1 ? "text-paragraph" : "",
6089
+ children: breadcrumb.name
6090
+ }
6091
+ )
6092
+ ] }) }, index)) }),
6093
+ /* @__PURE__ */ jsxs("div", { children: [
6094
+ /* @__PURE__ */ jsx("h2", { className: "text-t-md text-title font-bold mb-1", children: title }),
6095
+ description && /* @__PURE__ */ jsx("span", { className: "text-p-lg text-label", children: description })
6096
+ ] })
6097
+ ] }),
6098
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-6 md:justify-end flex-1 mt-2 md:mt-0", children })
6099
+ ] });
6100
+ };
6101
+ var variants4 = {
6102
+ primary: {
6103
+ bar: "bg-gradient-to-b from-blue-start to-blue-end",
6104
+ text: "text-blue-500"
6105
+ },
6106
+ success: {
6107
+ bar: "bg-gradient-to-b from-success-start to-success-end",
6108
+ text: "text-success-500"
6109
+ },
6110
+ danger: {
6111
+ bar: "bg-gradient-to-b from-danger-start to-danger-end",
6112
+ text: "text-dangerous-600"
6113
+ },
6114
+ info: {
6115
+ bar: "bg-gradient-to-b from-blue-start to-blue-end",
6116
+ text: "text-blue-500"
6117
+ }
6118
+ };
6119
+ var ProgressBar = ({
6120
+ percentage,
6121
+ variant = "primary",
6122
+ status
6123
+ }) => {
6124
+ const [barPercentage, setBarPercentage] = useState(() => fixPercentage());
6125
+ function fixPercentage() {
6126
+ if (percentage > 100) {
6127
+ return 100;
6128
+ } else {
6129
+ return percentage;
6130
+ }
6131
+ }
6132
+ useEffect(() => {
6133
+ setBarPercentage(fixPercentage());
6134
+ }, [percentage]);
6135
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-[2px] min-w-[170px]", children: [
6136
+ /* @__PURE__ */ jsx("div", { className: "w-full p-[1px] border border-neutral-300 rounded-[15px]", children: /* @__PURE__ */ jsx(
6137
+ "div",
6138
+ {
6139
+ className: clsx9(variants4[variant].bar, "h-[14px] rounded-[15px]"),
6140
+ style: { width: `${barPercentage}%` }
6141
+ }
6142
+ ) }),
6143
+ status && /* @__PURE__ */ jsxs("span", { className: clsx9(variants4[variant].text, "text-blue-500 text-xs"), children: [
6144
+ status,
6145
+ percentage && /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
6146
+ "\xA0- ",
6147
+ percentage,
6148
+ " %"
6149
+ ] })
6150
+ ] })
6151
+ ] });
6152
+ };
6153
+ function SimpleTab({ tabs, onClick }) {
6154
+ const [currentTab, setCurrentTab] = useState(0);
6155
+ function isCurrentTab(index) {
6156
+ return index === currentTab;
6157
+ }
6158
+ return /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full flex-1", children: [
6159
+ /* @__PURE__ */ jsx("div", { className: "border-b border-neutral-200", children: /* @__PURE__ */ jsx("div", { className: "-mb-px flex", "aria-label": "Tabs", children: tabs.filter((item) => !item.hidden).map((tab, index) => /* @__PURE__ */ jsxs(
6160
+ "nav",
6161
+ {
6162
+ className: clsx9(
6163
+ isCurrentTab(index) ? "border-rose-700 text-rose-700 font-bold hover:border-rose-800 hover:text-rose-800 hover:font-bold" : "border-transparent text-label hover:text-paragraph",
6164
+ "group cursor-pointer flex items-center border-b-2 py-1 px-4 text-base"
6165
+ ),
6166
+ "aria-current": isCurrentTab(index) ? "page" : void 0,
6167
+ onClick: () => {
6168
+ setCurrentTab(index);
6169
+ if (onClick) {
6170
+ onClick(tabs[index]);
6171
+ }
6172
+ },
6173
+ children: [
6174
+ /* @__PURE__ */ jsx(
6175
+ "div",
6176
+ {
6177
+ id: "tab-icon",
6178
+ className: clsx9(
6179
+ isCurrentTab(index) ? "text-rose-700 group-hover:text-rose-800" : "text-label group-hover:text-paragraph",
6180
+ { "-ml-0.5 mr-2": tab.icon }
6181
+ ),
6182
+ "aria-hidden": "true",
6183
+ children: tab.icon
6184
+ }
6185
+ ),
6186
+ /* @__PURE__ */ jsx("span", { children: tab.label })
6187
+ ]
6188
+ },
6189
+ tab.key
6190
+ )) }) }),
6191
+ /* @__PURE__ */ jsx("div", { className: "h-full flex-1 flex flex-col", children: tabs[currentTab].children })
6192
+ ] }) });
6193
+ }
4582
6194
 
4583
- export { Accordion, Badge, Button, ButtonLink, Calendar, Checkbox, CopyPopover, DataTable, DataTablePagination, DatePickerInput, EditableButton, EditableText, FilterCalendar, FilterOptions, Input, InputMoney, InputNumber, InputPercentage, Item, Logo, MaskedInput, Menu, ModalDialog, PaginationSelect, Popover3 as Popover, Radio, RocketIcon, SelectField, SelectFieldBip, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer, sizes2 as sizes };
6195
+ export { Accordion, Badge, Button, ButtonLink, Calendar, Checkbox, CopyPopover, DataTable, DataTablePagination, DatePickerInput, EditableButton, EditableText, EditableTextSelect, FileUpload, FilterCalendar, FilterOptions, InfoIcon, Input, InputMoney, InputNumber, InputPercentage, InputTag, Item, Logo, MaskedInput, Menu, ModalDialog, MultiSelect, MultiSelectBottom, PageBox, PageHeader, PaginationSelect, Popover3 as Popover, ProgressBar, Radio, RocketIcon, SelectField, SelectFieldBip, SimpleTab, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer4 as ValueContainer, sizes2 as sizes };
4584
6196
  //# sourceMappingURL=index.js.map
4585
6197
  //# sourceMappingURL=index.js.map