nexaas-ui-components 1.0.7 → 1.0.9
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 +3770 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3710 -13
- package/dist/index.js.map +1 -1
- package/package.json +12 -7
package/dist/index.js
CHANGED
|
@@ -1,15 +1,3712 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import clsx7, { clsx } from 'clsx';
|
|
3
|
+
import { DateInput3, DateRangePicker3, DatePicker3 } from '@blueprintjs/datetime2';
|
|
4
|
+
import * as React2 from 'react';
|
|
5
|
+
import React2__default, { forwardRef, useState, useRef, useEffect, useMemo, cloneElement, Fragment as Fragment$1 } from 'react';
|
|
6
|
+
import { Controller } from 'react-hook-form';
|
|
7
|
+
import { create } from 'zustand';
|
|
8
|
+
import { parse, format, set, startOfWeek, endOfWeek, startOfMonth, endOfMonth, sub, subYears } from 'date-fns';
|
|
9
|
+
import { Switch, Popover, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, ListboxOption } from '@headlessui/react';
|
|
10
|
+
import { Float } from '@headlessui-float/react';
|
|
11
|
+
import * as IntlCurrencyInputModule from 'react-intl-currency-input';
|
|
12
|
+
import _debounce from 'lodash/debounce';
|
|
13
|
+
import InputMask from 'react-input-mask';
|
|
14
|
+
import * as ReactModalNamespace from 'react-modal';
|
|
15
|
+
import { Tooltip } from 'react-tooltip';
|
|
16
|
+
import { components } from 'react-select';
|
|
17
|
+
import AsyncSelect from 'react-select/async';
|
|
18
|
+
import { useReactTable, getExpandedRowModel, getFacetedUniqueValues, getFacetedRowModel, getFilteredRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
19
|
+
import { rankItem } from '@tanstack/match-sorter-utils';
|
|
20
|
+
|
|
21
|
+
// src/assets/spinner.tsx
|
|
22
|
+
var SpinnerIcon = (props) => /* @__PURE__ */ jsxs(
|
|
23
|
+
"svg",
|
|
24
|
+
{
|
|
25
|
+
width: 16,
|
|
26
|
+
height: 16,
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
fill: "none",
|
|
29
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
30
|
+
...props,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"circle",
|
|
34
|
+
{
|
|
35
|
+
className: "opacity-25",
|
|
36
|
+
cx: "12",
|
|
37
|
+
cy: "12",
|
|
38
|
+
r: "10",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "4"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"path",
|
|
45
|
+
{
|
|
46
|
+
className: "opacity-75",
|
|
47
|
+
fill: "currentColor",
|
|
48
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
var sizes = {
|
|
55
|
+
xxs: {
|
|
56
|
+
text: "h-[18px]",
|
|
57
|
+
icon: "text-[16px]"
|
|
58
|
+
},
|
|
59
|
+
xs: {
|
|
60
|
+
text: "h-8 min-w-8 max-w-20",
|
|
61
|
+
icon: "text-[16px]"
|
|
62
|
+
},
|
|
63
|
+
sm: {
|
|
64
|
+
text: "h-[32px]",
|
|
65
|
+
icon: "text-[14px]"
|
|
66
|
+
},
|
|
67
|
+
md: {
|
|
68
|
+
text: "h-[38px]",
|
|
69
|
+
icon: "text-[20px]"
|
|
70
|
+
},
|
|
71
|
+
lg: {
|
|
72
|
+
text: "h-[46px]",
|
|
73
|
+
icon: "text-[20px]"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var variants = {
|
|
77
|
+
primary: {
|
|
78
|
+
text: "bg-gradient-to-b from-[#FF4D8B] to-[#DA3063] text-white shadow-[0_2px_6px_0_rgba(218,48,99,0.25)] hover:from-[#ff4d84] hover:to-[#df4573] active:from-[#ae264f] active:to-[#ae264f] disabled:opacity-50 disabled:shadow-none active:shadow-none disabled:hover:from-[#FF4D8B] disabled:hover:to-[#DA3063]"
|
|
79
|
+
},
|
|
80
|
+
secondary: {
|
|
81
|
+
text: "shadow-button bg-surface border-[0.5px] border-neutral-400 text-neutral-600 hover:bg-neutral-100 active:shadow-none disabled:text-neutral-400 disabled:opacity-50"
|
|
82
|
+
},
|
|
83
|
+
icon: {
|
|
84
|
+
text: "shadow-button bg-white border-[0.5px] border-neutral-300 hover:bg-[#f5f5f5] active:bg-neutral-100 disabled:text-neutral-400 disabled:border-[0.5px] disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
85
|
+
},
|
|
86
|
+
outline: {
|
|
87
|
+
text: "shadow-button bg-surface border-[0.5px] border-rose-500 text-rose-500 hover:bg-rose-50 active:bg-rose-100 disabled:bg-surface disabled:border-[0.5px] disabled:border-rose-700 disabled:opacity-50 active:shadow-none"
|
|
88
|
+
},
|
|
89
|
+
dangerOutline: {
|
|
90
|
+
text: "shadow-button text-dangerous-500 bg-surface border-[0.5px] border-dangerous-500 hover:bg-dangerous-100 active:bg-dangerous-500 active:text-white disabled:opacity-50 disabled:bg-white disabled:text-dangerous-500 active:shadow-none"
|
|
91
|
+
},
|
|
92
|
+
danger: {
|
|
93
|
+
text: "shadow-button text-white bg-gradient-to-b from-danger-start to-danger-end hover:from-[#fe6464] hover:to-[#e24e4e] active:from-dangerous-600 active:to-dangerous-600 disabled:opacity-50 disabled:from-dangerous-500 disabled:to-dangerous-500 active:shadow-none"
|
|
94
|
+
},
|
|
95
|
+
success: {
|
|
96
|
+
text: "shadow-button text-white bg-gradient-to-b from-success-start to-success-end hover:from-[#40f09b] hover:to-[#28c67a] active:from-success-600 active:to-success-600 disabled:opacity-50 disabled:from-success-start disabled:to-success-end active:shadow-none"
|
|
97
|
+
},
|
|
98
|
+
warn: {
|
|
99
|
+
text: "shadow-button text-white bg-gradient-to-b from-warning-start to-warning-end hover:from-[#febd5b] hover:to-[#f4a52e] active:from-warning-600 active:to-warning-600 disabled:opacity-50 disabled:from-warning-start disabled:to-warning-end active:shadow-none"
|
|
100
|
+
},
|
|
101
|
+
blue: {
|
|
102
|
+
text: "shadow-button bg-blue-500 text-white text-bold"
|
|
103
|
+
},
|
|
104
|
+
link: {
|
|
105
|
+
text: "text-left text-blue-500 hover:text-blue-600 hover:underline active:text-blue-600 disabled:text-blue-500 disabled:no-underline shadow-none font-normal disabled:opacity-50"
|
|
106
|
+
},
|
|
107
|
+
iconSecondary: {
|
|
108
|
+
text: "border-[1px] border-none text-white active:bg-[#0A0A0A40]/20 hover:bg-[#F5F5F526]/10 hover:text-white disabled:text-neutral-400 disabled:border-[0.5px] disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
109
|
+
},
|
|
110
|
+
outlineIcon: {
|
|
111
|
+
text: "bg-white text-rose-500 hover:shadow-button active:bg-rose-500 active:text-white disabled:text-neutral-400 disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var paddingConfig = {
|
|
115
|
+
xxs: {
|
|
116
|
+
normal: "",
|
|
117
|
+
icon: ""
|
|
118
|
+
},
|
|
119
|
+
xs: {
|
|
120
|
+
normal: "p-2",
|
|
121
|
+
icon: "p-2"
|
|
122
|
+
},
|
|
123
|
+
sm: {
|
|
124
|
+
normal: "px-3 py-[6px]",
|
|
125
|
+
icon: "py-[6px] pl-2 pr-3"
|
|
126
|
+
},
|
|
127
|
+
md: {
|
|
128
|
+
normal: "py-2 px-4",
|
|
129
|
+
icon: "py-2 pl-3 pr-4"
|
|
130
|
+
},
|
|
131
|
+
lg: {
|
|
132
|
+
normal: "py-3 px-4",
|
|
133
|
+
icon: "p-3 pr-4"
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var Button = ({
|
|
137
|
+
variant = "primary",
|
|
138
|
+
size = "lg",
|
|
139
|
+
...props
|
|
140
|
+
}) => {
|
|
141
|
+
const applyGap = props.icon && props.children;
|
|
142
|
+
const appliedVariant = variants[variant].text;
|
|
143
|
+
const appliedSize = sizes[size];
|
|
144
|
+
const appliedPadding = props.icon ? paddingConfig[size].icon : paddingConfig[size].normal;
|
|
145
|
+
const gapText = applyGap ? "gap-[6px]" : "gap-0";
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
type: props.type,
|
|
150
|
+
id: "button-component",
|
|
151
|
+
...props,
|
|
152
|
+
disabled: props.disabled || props.loading,
|
|
153
|
+
className: `
|
|
154
|
+
${props.className}
|
|
155
|
+
${appliedVariant}
|
|
156
|
+
${appliedSize.text}
|
|
157
|
+
${appliedPadding}
|
|
158
|
+
${gapText}
|
|
7
159
|
whitespace-nowrap group rounded-lg font-bold disabled:shadow-none active:shadow-none flex items-center
|
|
8
|
-
`,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
${e?"left-[3rem]":"left-2.5"}`),style:{top:"13px"},children:[t,w&&t&&Ie("strong",{className:"text-dangerous-700 ml-1",children:"*"})]}),s&&(l==null?void 0:l.value)&&(l==null?void 0:l.value)!==""&&!c&&Ie("i",{className:xt({[M.clear]:!0},"uil uil-times clear-icon"),onClick:()=>{z&&(z==null||z.focus()),S&&S()}})]})}),H.map((l,A)=>Ie("div",{className:"absolute text-dangerous-700 text-xs mt-[2px] ml-1",role:"alert","aria-label":l,children:l},A))]})});import Aa from"clsx";import{jsx as za}from"react/jsx-runtime";var Oa={success:"bg-success-100 text-success-600",warning:"bg-warning-100 text-warning-600",blue:"bg-blue-100 text-blue-500",gray:"bg-neutral-100 text-neutral-400",dangerous:"bg-dangerous-100 text-dangerous-600",light:"bg-neutral-100 text-neutral-400",white:"bg-[#FFF] text-neutral-400 px-4 py-[6px] border border-light shadow-button text-paragraph",primary:"bg-rose-100 text-rose-800",dark:"bg-neutral-700 text-white",outline:"bg-white text-rose-700 border border-neutral-200","dark-gray":"bg-neutral-100 text-neutral-600"},Jn=({variant:e="blue",children:t,className:a,style:i})=>za("span",{className:Aa({[Oa[e]]:(e==null?void 0:e.length)>0},"py-1 px-2 text-p-md font-normal inline-flex items-center justify-center gap-1 rounded-full text-center",a),style:i,children:t});import{DatePicker3 as Va,DateRangePicker3 as Ja}from"@blueprintjs/datetime2";import{Controller as ja}from"react-hook-form";import{set as X,sub as te,startOfWeek as _t,endOfWeek as Xa,startOfMonth as ht,endOfMonth as Wa,subYears as $a}from"date-fns";import{jsx as je,jsxs as Ua}from"react/jsx-runtime";var _n=({registration:e,error:t,control:a,name:i,rangeCalendar:g=!1,shortcutsChange:s,selectedShortcut:y,setSelectedShortcut:d,maxDate:w=new Date,singleMonth:T=!1})=>{let x=[t==null?void 0:t.message],R=[{label:"Todo o per\xEDodo",dateRange:[]},{label:"Hoje",dateRange:[X(new Date,{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Ontem",dateRange:[X(te(new Date,{days:1}),{hours:0,minutes:0,seconds:0}),X(te(new Date,{days:1}),{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 7 dias",dateRange:[X(te(new Date,{days:7}),{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 14 dias",dateRange:[X(te(new Date,{days:14}),{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 30 dias",dateRange:[X(te(new Date,{days:30}),{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 60 dias",dateRange:[X(te(new Date,{days:60}),{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 90 dias",dateRange:[X(te(new Date,{days:90}),{hours:0,minutes:0,seconds:0}),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Esta semana",dateRange:[_t(new Date),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Semana passada",dateRange:[_t(te(new Date,{days:7})),Xa(te(new Date,{days:7}))]},{label:"Este M\xEAs",dateRange:[ht(new Date),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"M\xEAs passado",dateRange:[ht(te(new Date,{months:1})),Wa(te(new Date,{months:1}))]},{label:"\xDAltimos 6 meses",dateRange:[ht(te(new Date,{months:6})),X(new Date,{hours:23,minutes:59,seconds:59}),,]}];return Ua("div",{children:[je(ja,{control:a,name:i,render:({field:{onChange:h,value:c}})=>je("div",{id:"group-input-calendar",className:"relative",children:g?je(Ja,{allowSingleDayRange:!0,shortcuts:R,selectedShortcutIndex:y||R[0],onChange:f=>{let S=[];f[0]&&f[0]!==null&&S.push(X(f[0],{hours:0,minutes:0,seconds:0})),f[1]&&f[1]!==null&&S.push(X(f[1],{hours:23,minutes:59,seconds:59})),f[0]!==null&&f[1]==null&&(s&&s(null),d&&d(null)),s&&s(""),h(S)},singleMonthOnly:T,value:c,highlightCurrentDay:!0,minDate:$a(new Date,50),maxDate:w,locale:"pt",onShortcutChange:f=>{let S=R.findIndex(u=>u.label===f.label);S!==-1&&d&&d(S),s&&s(f)}}):je(Va,{onChange:f=>{h(f)},value:c,highlightCurrentDay:!0,locale:"pt"})})}),x.map((h,c)=>je("div",{className:"text-dangerous-500 text-xs mt-[2px]",role:"alert","aria-label":h,children:h},c))]})};import Ka from"clsx";import{jsx as Xe,jsxs as Ga}from"react/jsx-runtime";var er=({key:e="",label:t,registration:a,disabled:i})=>Xe("div",{children:Ga("div",{className:"relative flex items-start",children:[Xe("div",{className:"flex h-5 items-center",children:Xe("input",{...a,id:a?a.name:e,disabled:i,type:"checkbox",className:Ka("disabled:hover:bg-neutral-100 disabled:cursor-default cursor-pointer h-[16px] w-[16px] rounded-[2.5px] border border-neutral-200 text-blue-500 focus:rounded-[4px] focus:border-[1.5px] focus:ring-blue-500 focus-visible:ring-blue-500 checked:after:text-blue-500 disabled:bg-neutral-100")})}),Xe("div",{className:"ml-3 text-sm",children:Xe("label",{htmlFor:a==null?void 0:a.name,className:"cursor-pointer font-medium text-gray-700",children:t})})]})});import{useEffect as qa,useState as vt}from"react";import{Controller as _a}from"react-hook-form";import{Popover as Ya,PopoverButton as Za,PopoverPanel as Qa}from"@headlessui/react";import We from"clsx";import{Float as yt}from"@headlessui-float/react";import{format as eo}from"date-fns";import{set as W,sub as ae,startOfWeek as Yt,endOfWeek as to,startOfMonth as wt,endOfMonth as ao,subYears as oo}from"date-fns";import{DatePicker3 as no,DateRangePicker3 as ro}from"@blueprintjs/datetime2";import{jsx as q,jsxs as nt}from"react/jsx-runtime";var gr=({icon:e,label:t,onApply:a,onClear:i,control:g,name:s,rangeCalendar:y=!0,defaultShortcut:d,shortcutsChange:w,singleMonth:T=!1,maxDate:x=void 0})=>{let R={filter:"rounded-3xl shadow-input bg-white hover:bg-neutral-100 border border-neutral-300 active:text-blue-500 active:bg-blue-100 active:border-blue-500",filterOpen:"rounded-3xl shadow-input border border-blue-500 bg-blue-100 text-blue-500",filterActive:"rounded-3xl border border-blue-500 text-blue-500 bg-blue-100 shadow-input hover:bg-blue-500 hover:text-white active:text-white active:bg-blue-600 active:border-blue-600"},[h,c]=vt([]),[f,S]=vt(""),u=(window==null?void 0:window.innerWidth)<768,v=[{label:"Todo o per\xEDodo",dateRange:[]},{label:"Hoje",dateRange:[W(new Date,{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Ontem",dateRange:[W(ae(new Date,{days:1}),{hours:0,minutes:0,seconds:0}),W(ae(new Date,{days:1}),{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 7 dias",dateRange:[W(ae(new Date,{days:7}),{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 14 dias",dateRange:[W(ae(new Date,{days:14}),{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 30 dias",dateRange:[W(ae(new Date,{days:30}),{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 60 dias",dateRange:[W(ae(new Date,{days:60}),{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"\xDAltimos 90 dias",dateRange:[W(ae(new Date,{days:90}),{hours:0,minutes:0,seconds:0}),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Esta semana",dateRange:[Yt(new Date),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Semana passada",dateRange:[Yt(ae(new Date,{days:7})),to(ae(new Date,{days:7}))]},{label:"Este M\xEAs",dateRange:[wt(new Date),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"M\xEAs passado",dateRange:[wt(ae(new Date,{months:1})),ao(ae(new Date,{months:1}))]},{label:"\xDAltimos 6 meses",dateRange:[wt(ae(new Date,{months:6})),W(new Date,{hours:23,minutes:59,seconds:59}),,]}],[D,k]=vt(d||v[0]),b=q("div",{id:"group-input-calendar",className:"relative",children:y?q(ro,{allowSingleDayRange:!0,shortcuts:v,selectedShortcutIndex:D,onChange:n=>{let N=[];n[0]&&n[0]!==null&&N.push(W(n[0],{hours:0,minutes:0,seconds:0})),n[1]&&n[1]!==null&&N.push(W(n[1],{hours:23,minutes:59,seconds:59})),n[0]!==null&&n[1]==null&&(S(""),k&&k(null)),S(""),c(N)},singleMonthOnly:T,value:h,highlightCurrentDay:!0,minDate:oo(new Date,50),maxDate:x,locale:"pt",onShortcutChange:n=>{let N=v.findIndex(r=>r.label===n.label);N!==-1&&k&&k(N),S(n==null?void 0:n.label)}}):q(no,{onChange:n=>{c(n)},value:h,highlightCurrentDay:!0,locale:"pt"})});return q(_a,{name:s,control:g,render:({field:n})=>{var r;let N=((r=n==null?void 0:n.value)==null?void 0:r.length)>0;return q(Ya,{className:We({"w-full":u},"relative text-paragraph"),children:({open:o})=>{var m,I;return nt(yt,{composable:!0,shift:8,zIndex:99,offset:2,children:[q(yt.Reference,{children:q(Za,{as:"button",children:nt("div",{className:We({[R.filter]:!N&&!o,[R.filterOpen]:o&&!N,[R.filterActive]:o&&N||!o&&N},"group px-3 h-[36px] text-p-ls font-bold disabled:shadow-none active:shadow-none flex items-center justify-between outline-none gap-2"),children:[e&&q("div",{className:We({"text-label group-active:text-blue-500":!n.value&&!o,"text-blue-500":o&&!n.value,"text-blue-500 group-hover:text-white group-active:text-white":o&&n.value}),children:e}),q("label",{className:We({"text-paragraph group-active:text-blue-500":!n.value&&!o,"text-blue-500":o&&!n.value,"text-blue-500 group-hover:text-white group-active:text-white":o&&n.value},"truncate cursor-pointer"),children:f||(((m=n==null?void 0:n.value)==null?void 0:m.length)>0?(I=n==null?void 0:n.value)==null?void 0:I.map(L=>L!==null?eo(L,"dd/MM/yyyy"):"").join(" - "):t)}),q("i",{className:We({"text-label group-active:text-blue-500":!n.value&&!o,"text-blue-500":o&&!n.value,"text-blue-500 group-hover:text-white group-active:text-white":o&&n.value},"uil uil-angle-down text-[18px]")})]})})}),o&&q(yt.Content,{children:q(Qa,{className:"p-3 whitespace-nowrap bg-white rounded-lg shadow-dropdown border-[0.5px] border-neutral-300",children:({close:L})=>{let H=()=>{c(n.value),L()};return qa(()=>{c(n.value)},[o]),nt("div",{className:"flex flex-col gap-2",children:[b,nt("div",{className:"flex gap-2 items-center justify-end border-t border-t-neutral-200 pt-3",children:[i&&q("div",{className:"mr-1",children:q(J,{variant:"link",size:"xxs",onClick:()=>{i&&(i(),c([]),n.onChange([])),L()},children:"Limpar"})}),q(J,{size:"xs",variant:"secondary",onClick:()=>{H()},children:"Cancelar"}),q(J,{size:"xs",variant:"primary",disabled:JSON.stringify(h)===JSON.stringify(n==null?void 0:n.value),onClick:()=>{n.onChange(h),a&&a(),L()},children:"Aplicar"})]})]})}})})]})}})}})};import{Fragment as io,useEffect as Zt,useState as Ue}from"react";import{Controller as uo}from"react-hook-form";import{Listbox as co,ListboxOption as po,ListboxOptions as mo,Popover as go,PopoverButton as bo,PopoverPanel as xo}from"@headlessui/react";import le from"clsx";import{Float as Ct}from"@headlessui-float/react";import{useRef as so}from"react";import $e from"clsx";import{jsx as Fe,jsxs as lo}from"react/jsx-runtime";function Nt({type:e,registration:t,onClick:a,onBlur:i,onChange:g,inputProps:s,icon:y,clearField:d,disabled:w,placeholder:T,className:x,onKeyDown:R,value:h,searchOnClick:c,onClear:f,collapsed:S}){let u=so(null),v={input:"text-p-md text-paragraph w-full outline-none placeholder:text-label",icon:"text-label group-focus-within:text-neutral-600 m-[10px]",wrapper:`shadow-input border border-neutral-300 focus-within:border-blue-500 group rounded-lg h-9 w-full text-paragraph flex items-center justify-between disabled:bg-neutral-100 ${w?"bg-neutral-100":"bg-white"} ${x}`,clear:"pr-[5px] cursor-pointer text-label text-[16px]"},D=u==null?void 0:u.current;return lo("div",{className:$e(v.wrapper),children:[y&&!c&&Fe("div",{className:$e(v.icon),children:y}),Fe("input",{...t,...s,type:"search-text",ref:u,className:$e({"pl-1":S},v.input),placeholder:T,onBlur:i,onChange:k=>g(k.target.value),onClick:a,disabled:w,onKeyDown:R}),d&&h&&!w&&Fe("i",{className:$e(v.clear,"uil uil-times"),onClick:()=>{D.value="",D==null||D.focus(),g(""),f&&f()}}),c&&Fe("div",{className:"py-1",children:Fe("button",{type:"button",className:$e({"border-l border-input pl-1":d&&h&&!w,"text-blue-500":!w,"text-neutral-300":w,"pl-[2px]":S}),onClick:c,children:Fe("i",{className:"uil uil-search text-[16px] mr-2 pl-1"})})})]})}import{Fragment as fo,jsx as F,jsxs as ye}from"react/jsx-runtime";var Hr=({icon:e,label:t,isMulti:a,options:i=[],onApply:g,onClear:s,onSelectAll:y,control:d,name:w,fetch:T,subFilters:x=[],emptyMessage:R,initialMessage:h,applyOnClick:c=!1,showFilter:f=!1})=>{let S={filter:"rounded-3xl shadow-input bg-white hover:bg-neutral-100 border border-neutral-300 active:text-blue-500 active:bg-blue-100 active:border-blue-500",filterOpen:"rounded-3xl shadow-input border border-blue-500 bg-blue-100 text-blue-500",filterActive:"rounded-3xl border border-blue-500 text-blue-500 bg-blue-100 shadow-input hover:bg-blue-500 hover:text-white active:text-white active:bg-blue-600 active:border-blue-600"},[u,v]=Ue(a?[]:{}),[D,k]=Ue(()=>i),[b,n]=Ue(""),[N,r]=Ue((x==null?void 0:x.length)>0?x[0].id:null),[o,m]=Ue(!1),I=async()=>{if((b==null?void 0:b.length)>0||(i==null?void 0:i.length)>0)if(T)k(await T(b,N));else{let M=i.filter(z=>{var G;return(G=z==null?void 0:z.label)==null?void 0:G.toLowerCase().includes(b.toLowerCase())}).sort((z,G)=>{var l;return(l=z==null?void 0:z.label)==null?void 0:l.toLowerCase()});k(M)}else k([]);m(!1)};Zt(()=>{m(!0);let p=setTimeout(()=>{I()},400);return()=>clearTimeout(p)},[b]);let L=(p,M)=>F(po,{disabled:p.disabled,value:p,as:io,children:ye("div",{className:le("relative cursor-pointer outline-none select-none p-3 rounded-lg pr-9 text-paragraph mt-1 first:mt-0 overflow-hidden w-full",{"hover:bg-neutral-200":!p.disabled&&!M,"text-gray-200":p.disabled,"bg-blue-500 hover:bg-blue-500":M}),children:[F("span",{className:le({"font-semibold text-white":M},"text-wrap break-words font-normal block"),children:p==null?void 0:p.label}),F("span",{className:le({"font-semibold text-white":M},"w-[200px] whitespace-nowrap text-ellipsis overflow-hidden text-label text-p-sm block"),children:p==null?void 0:p.description}),M?F("span",{className:le("absolute inset-y-0 text-white right-0 flex items-center pr-4"),children:F("i",{className:"uil uil-check text-lg"})}):null]})},p.id),H=(window==null?void 0:window.innerWidth)<768;return F(uo,{name:w,control:d,render:({field:p})=>{var z,G;let M=a?((z=p==null?void 0:p.value)==null?void 0:z.length)>0:!!((G=p==null?void 0:p.value)!=null&&G.id);return F(go,{className:le({"w-full":H},"relative text-paragraph"),children:({open:l})=>{var A,de;return ye(Ct,{composable:!0,shift:8,zIndex:99,offset:2,children:[F(Ct.Reference,{children:F(bo,{as:"button",children:ye("div",{className:le({[S.filter]:!M&&!l,[S.filterOpen]:l&&!M,[S.filterActive]:l&&M||!l&&M},"group px-3 h-[36px] text-p-ls font-bold disabled:shadow-none active:shadow-none flex items-center justify-between outline-none gap-2"),children:[e&&F("div",{className:le({"text-label group-active:text-blue-500":!p.value&&!l,"text-blue-500":l&&!p.value,"text-blue-500 group-hover:text-white group-active:text-white":l&&p.value}),children:e}),F("label",{className:le({"text-paragraph group-active:text-blue-500":!p.value&&!l,"text-blue-500":l&&!p.value,"text-blue-500 group-hover:text-white group-active:text-white":l&&p.value},"truncate cursor-pointer"),children:a?t:(A=p==null?void 0:p.value)!=null&&A.id?(de=p==null?void 0:p.value)==null?void 0:de.label:t}),a&&p.value&&p.value.length>0&&F("div",{className:"bg-blue-500 text-white text-p-xs px-1 py-[2px] rounded group-hover:bg-blue-500",children:p.value.length}),F("i",{className:le({"text-label group-active:text-blue-500":!p.value&&!l,"text-blue-500":l&&!p.value,"text-blue-500 group-hover:text-white group-active:text-white":l&&p.value},"uil uil-angle-down text-[18px]")})]})})}),l&&F(Ct.Content,{children:F(xo,{className:"p-3 whitespace-nowrap bg-white rounded-lg shadow-dropdown border-[0.5px] border-neutral-300",children:({close:ue})=>{let re=()=>{v(p.value),ue()};return Zt(()=>{v(p.value)},[l]),ye("div",{className:"flex flex-col gap-2",children:[F(co,{value:u||[],onChange:v,multiple:a,children:ye(mo,{static:!0,className:"max-h-60 w-full overflow-x-hidden overflow-y-auto bg-white text-p-md focus:outline-none sm:text-sm relative",children:[ye("div",{className:"mr-1 sticky top-0 z-30",children:[f&&F(Nt,{icon:F("i",{className:"uil uil-search"}),onChange:O=>n(O),value:b,placeholder:"Pesquisar",clearField:!0,onKeyDown:O=>{(O.key===" "||O.code==="Space")&&O.stopPropagation()}}),x&&T&&F("div",{className:"flex items-center gap-2 pt-2 bg-white",children:x.map((O,Q)=>{let se=(O==null?void 0:O.id)===N;return F("button",{className:le({"bg-blue-500 text-white":se,"text-paragraph":!se},"rounded-[20px] border-[0.5px] border-neutral-200 px-4 py-[6px]"),onClick:()=>{N==O.id?r(null):r(O.id)},children:O.name},Q)})})]}),o&&ye("div",{className:"flex items-center justify-center gap-2 w-full my-4",children:[F("img",{className:"animate-spin",src:"/spinner-gray.svg",alt:"circle",width:13,height:13}),"Carregando"]}),(D==null?void 0:D.length)===0&&(b==null?void 0:b.length)>0&&!o&&F("div",{className:"py-4",children:F("span",{className:"text-label text-p-md",children:R})}),h&&(D==null?void 0:D.length)===0&&(b==null?void 0:b.length)===0&&!o&&(i==null?void 0:i.length)===0&&!(u!=null&&u.id)&&F("div",{className:"py-4",children:F("span",{className:"text-label text-p-md",children:h})}),h&&u&&(u==null?void 0:u.id)&&(b==null?void 0:b.length)===0&&F("div",{className:"py-2",children:a?F(fo,{children:u==null?void 0:u.map(O=>{let Q=a?u&&(u==null?void 0:u.length)>0&&(u==null?void 0:u.some(se=>se.id===O.id)):u&&(u==null?void 0:u.id)===O.id;return L(i,Q)})}):L(p.value,!0)}),!o&&(D==null?void 0:D.map(O=>{let Q=a?u&&u.length>0&&u.some(se=>se.id===O.id):u&&u.id===O.id;return L(O,Q)}))]})}),!c&&ye("div",{className:"flex gap-2 items-center justify-end border-t border-t-neutral-200 pt-3",children:[a&&y&&F("div",{className:"border-r pr-2 border-neutral-300",children:F(J,{variant:"link",size:"xxs",onClick:()=>{y(),p.onChange(i),v(i),ue()},children:"Marcar todos"})}),s&&F("div",{className:"mr-1",children:F(J,{variant:"link",size:"xxs",onClick:()=>{s&&(s(),v([]),p.onChange([])),ue()},children:"Limpar"})}),F(J,{size:"xs",variant:"secondary",onClick:()=>{re()},children:"Cancelar"}),F(J,{size:"xs",variant:"primary",disabled:JSON.stringify(u)===JSON.stringify(p==null?void 0:p.value),onClick:()=>{p.onChange(u),g&&g(),ue()},children:"Aplicar"})]})]})}})})]})}})}})};import{forwardRef as ho}from"react";import{Controller as vo}from"react-hook-form";import Tt from"clsx";import*as rt from"react-intl-currency-input";import{jsx as Ke,jsxs as st}from"react/jsx-runtime";var yo=(rt==null?void 0:rt.default)||rt,wo=ho(({label:e,type:t,onClick:a,error:i,onBlur:g,onChangeValue:s,inputProps:y,icon:d,clearField:w,name:T,required:x,disabled:R,value:h,placeholder:c,control:f,defaultValue:S,isWeightField:u,minFractionDigits:v=2},D)=>{let b={locale:"pt-BR",formats:{number:{BRL:u?{currency:"BRL",minimumFractionDigits:v,maximumFractionDigits:v,useGrouping:!1}:{style:"currency",currency:"BRL",minimumFractionDigits:v,maximumFractionDigits:v}}}},n=[i==null?void 0:i.message],N=n.some(o=>o!==void 0),r={input:`text-p-md pl-2 peer text-paragraph shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border ${e?"pt-[22px]":"pt-[10px]"} ${N?"border-dangerous-500 text-dangerous-500":"border-neutral-300 focus-visible:border-blue-500"}`,icon:`absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${N?"text-dangerous-500":"text-label"}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`,label:"absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0",buttonsWrapper:"absolute top-[7px] right-[10px] cursor-pointer text-label flex flex-col gap-[2px]",button:"border-[0.5px] border-neutral-300 rounded shadow-input"},N=d?document==null?void 0:document.getElementById(d):null;return qe(Eo,{control:R,name:d,defaultValue:h,render:({field:r})=>{let o=(m,I,L)=>{m.preventDefault(),r.onChange(I.toString()),f&&f(I.toString())};return typeof r.value=="string"&&(r.value=Number(r.value)),it("div",{children:[it("div",{className:"relative outline-none",children:[s&&qe("div",{className:Rt(n.icon,"flex justify-center items-center"),children:s}),it("div",{children:[qe(ko,{...g,...r,type:"text",ref:D,className:Rt({[n.input]:!0,"pr-10":y,"pr-2":!y,"pl-[3rem]":s}),placeholder:!e&&x?x:" ",onClick:t,disabled:T,currency:"BRL",config:v,onChange:o,max:S}),it("label",{className:Rt({[n.label]:!0,"left-[3rem]":s,"left-2.5":!s},"cursor-text"),onClick:()=>N==null?void 0:N.focus(),children:[e,w&&e&&qe("strong",{className:"text-dangerous-500",children:"\xA0*"})]})]})]}),k.map((m,I)=>qe("div",{className:"text-dangerous-500 text-xs mt-1 ml-[2px]",role:"alert","aria-label":m,children:m},I))]})}})}Po.displayName="InputPercentage";import{useRef as Io}from"react";import{Controller as Fo}from"react-hook-form";import Mo from"react-input-mask";import{jsx as St}from"react/jsx-runtime";var Ds=({type:e="text",name:t,label:a,placeholder:i,error:g,mask:s,control:y,required:d,onKeyUp:w,maskChar:T="",alwaysShowMask:x,defaultValue:R,disabled:h})=>{let c=Io(null);return St(Fo,{name:t,control:y,defaultValue:R,render:({field:f})=>{let S=u=>{let{nextState:v,previousState:D}=u;var{value:k}=v,b=v.selection,n=b?b.start:null,N=[".","-","/","(",")"," "],r=[...k];return N.includes(r[r.length-1])&&(n===k.length&&(n--,b={start:n,end:n}),k=k.slice(0,-1)),{value:k,selection:b}};return St(Mo,{...f,onKeyUp:w,disabled:h,mask:s,value:f.value||"",onChange:f.onChange,maskChar:T,alwaysShowMask:x,beforeMaskedStateChange:S,children:u=>St(at,{onKeyUp:w,type:e,label:a,placeholder:i,required:d,inputProps:u,error:g,name:t,disabled:h,ref:c})})}})};import Dt from"clsx";import{cloneElement as Lo}from"react";import*as Et from"react-modal";import{jsx as Te,jsxs as Le}from"react/jsx-runtime";var Ho=Et.default||Et,Bo={success:"text-success-500",error:"text-dangerous-500",warning:"text-warning-500",info:"text-blue-500",primary:"text-rose-700"},Ao={xs:"w-[350px]",sm:"w-[662px]",md:"w-[960px]",lg:"w-[80%] min-w-[800px]",null:""},Hs=({open:e,onOpen:t=()=>{},onClose:a,onCancel:i,triggerButton:g,confirmButton:s,title:y,cancelButton:d,icon:w,alertType:T,size:x="sm",info:R,description:h,children:c})=>{let f={content:{top:"50%",left:"50%",right:"auto",bottom:"auto",marginRight:"-50%",transform:"translate(-50%, -50%)",border:"1px solid #E8E8E9",padding:"24px",borderRadius:"8px",overflow:"initial"},overlay:{backgroundColor:"rgb(107,114,128,0.50)",zIndex:9999}},S=g?Lo(g,{onClick:()=>{t()}}):null;return Le("div",{children:[S,Te(Ho,{ariaHideApp:!1,isOpen:e,onRequestClose:a,style:f,contentLabel:"Example Modal",children:Le("div",{className:Dt(Ao[x]),children:[Le("div",{className:"pb-2 border-b border-b-neutral-200 flex items-center justify-between",children:[Le("h3",{className:"text-[24px] font-bold flex items-center gap-2",children:[T&&Te("div",{className:Dt([Bo[T]],"text-[30px]"),children:w}),y]}),Te("button",{onClick:i,className:"text-neutral-500 text-[24px]",children:Te("i",{className:"uil uil-times"})})]}),Te("div",{children:c}),Le("div",{className:"pt-6 border-t border-t-neutral-200 flex w-full items-center justify-between",children:[Te("div",{className:Dt({"flex-1":R}),children:R}),Le("div",{className:"flex flex-col-reverse md:flex-row gap-3 items-center md:justify-end w-full md:w-auto",children:[d||Te(J,{onClick:()=>{i&&i()},variant:"secondary",size:"sm",children:"Cancelar"}),s]})]})]})})]})};import{Tooltip as Oo}from"react-tooltip";import{Fragment as zo,jsx as Qt}from"react/jsx-runtime";var zs=({id:e,displayArrow:t=!0,openOnClick:a=!1})=>Qt(zo,{children:Qt(Oo,{id:e,className:"absolute bg-neutral-700 text-sm text-neutral-100 py-2 px-4 max-w-[430px] break-words whitespace-normal",classNameArrow:t?"":{noArrow:"hidden"}.noArrow,openOnClick:a,delayHide:0,delayShow:0})});import{useRef as Vo}from"react";import{Controller as Jo}from"react-hook-form";import{components as oa}from"react-select";import jo from"react-select/async";var ea={indicatorSeparator:(e,t)=>{var a;return{...e,backgroundColor:t.hasValue&&((a=e==null?void 0:e.selectProps)!=null&&a.isSearchable)?"var(--input)":"transparent"}},clearIndicator:e=>({...e,color:"var(--label)",":hover":{color:"var(--label)"}}),dropdownIndicator:(e,t)=>{var a;return{...e,color:"var(--paragraph)",transform:(a=t==null?void 0:t.selectProps)!=null&&a.menuIsOpen?"rotate(180deg)":"rotate(0)",":hover":{color:"var(--paragraph)"}}},input:(e,t)=>({...e,paddingLeft:t.selectProps.hasIcon?"34px":"0px",paddingTop:t.selectProps.hasLabel?"10px":"0px"}),menu:e=>({...e,marginTop:"4px",border:"1px solid var(--neutral-300)",boxShadow:"none",borderRadius:"8px",background:"white",zIndex:20}),menuList:e=>({...e,padding:"8px"}),singleValue:(e,t)=>({...e,paddingLeft:t.selectProps.hasIcon?"34px":"0px",paddingTop:t.selectProps.hasLabel?"10px":"0",color:t.data.value==="active"?"#0EAF86":t.selectProps.hasError?"var(--dangerous-500)":"black",display:"flex"}),control:(e,t)=>({...e,cursor:"pointer",border:t.selectProps.hasError?"1px solid var(--dangerous-700)":t.menuIsOpen?"1px solid var(--blue-700)":"1px solid var(--dark-blue-300)",boxShadow:"none",outline:"none",borderRadius:"0.5rem",placeholder:" ",height:t.selectProps.smallField?"30px":"46px",backgroundColor:t.isDisabled?"var(--light-100)":"white",":hover":{border:t.selectProps.hasError?"1px solid var(--dangerous-700)":t.menuIsOpen?"1px solid var(--blue-700)":"1px solid var(--neutral-300)"}}),multiValue:e=>({...e,borderRadius:"20px",backgroundColor:"var(--neutral-100)",padding:"0px 8px"}),multiValueLabel:e=>({...e,color:"var(--paragraph)"}),multiValueRemove:e=>({...e,color:"var(--neutral-400)",":hover":{color:"var(--dangerous-500)"}}),option:(e,t)=>{let a=t.isSelected?"white":t!=null&&t.isDisabled?"var(--label)":"var(--paragraph)";return{...e,cursor:t.isDisabled?"auto":"pointer",pointerEvents:t.isDisabled?"none":"",borderRadius:"8px",margin:"4px 0px",padding:"12px",backgroundColor:t.isSelected?"var(--blue-500)":"white",color:a,fontWeight:t.isSelected?700:400,"&:hover":{backgroundColor:t.isSelected?"var(--blue-500)":"var(--neutral-200)"},"&:active":{backgroundColor:"var(--blue-500)",color:"white",fontWeight:700},"&:active i":{color:"white",fontWeight:700}," i":{color:"white"}}},container:e=>({...e,border:"none",outline:"none",boxShadow:"none",padding:"none",margin:"none"})};import{useEffect as ta,useState as _e}from"react";import kt from"clsx";import{Fragment as aa,jsx as K,jsxs as He}from"react/jsx-runtime";var ol=({name:e,error:t,label:a,defaultValue:i,control:g,placeholder:s,isSearchable:y=!1,isClearable:d=!1,onChange:w,required:T,debounce:x=0,filterOptions:R,optionsList:h,disabled:c,onChangeValue:f,resize:S=!0,optionStyle:u,valueStyle:v,icon:D,emptyMessage:k,small:b=!1})=>{var De;let{Option:n,DropdownIndicator:N,ClearIndicator:r,SingleValue:o}=oa,m=Vo(null),[I,L]=_e(""),[H,p]=_e(!1),[M,z]=_e(()=>h||[]),[G,l]=_e(300),[A,de]=_e(!1);ta(()=>{let j=()=>{var he,Ee;if((he=m==null?void 0:m.current)!=null&&he.getBoundingClientRect){let Oe=(Ee=m==null?void 0:m.current)==null?void 0:Ee.getBoundingClientRect(),ke=window.innerHeight-Oe.bottom-24;l(ke<250?276:ke)}};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[m]);let ue=j=>{if(p(!0),y&&R){if(x&&j.length>=x||!x){let he=R(j);return p(!1),he}}else z(h)},O=[(De=ot(j=>j.field)[e])==null?void 0:De.message,t==null?void 0:t.message],Q={hasError:O.some(j=>j!==void 0)},se={smallField:b},Qe={hasLabel:(a==null?void 0:a.length)>0},Ae=S?{menuHeight:G}:null,U={hasIcon:D};return ta(()=>{z(()=>h)},[h]),K(Jo,{name:e,control:g,defaultValue:i,render:({field:j})=>{let he=P=>K(o,{...P,children:v?v(P==null?void 0:P.data):He(aa,{children:[P.data.label," "]})}),Ee=P=>K(n,{...P,children:u?u(P==null?void 0:P.data):K("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:K("span",{className:kt("text-p-md focus:text-white"),children:P.data.label})})}),Oe=P=>{if(!x||x&&I.length>=x)return He("div",{...P.innerProps,className:"flex items-center gap-[6px] p-2",children:[K("img",{className:"animate-spin ",src:"/spinner.svg",alt:"circle",width:16,height:16}),"Buscando..."]});if(x&&I.length<x)return He("div",{className:"p-2 text-neutral-300",children:["Digite ",x," ou mais caracteres para pesquisar"]})},et=P=>{var pe;if(P.selectProps.inputValue.length==0&&x>0||x>0&&P.selectProps.inputValue.length<x)return He("div",{className:"text-dangerous-500 text-sm",children:["Digite ",x," ou mais caracteres para pesquisar"]});if(P.selectProps.inputValue.length>0&&((pe=P==null?void 0:P.options)==null?void 0:pe.length)==0)return K("div",{className:"text-dangerous-500 text-sm",children:"Nenhum dado encontrado"})},ke=P=>K(N,{...P,children:K("i",{className:`uil uil-angle-down text-[20px] ${b?"h-[20px] -mt-[7px]":"h-full"}`})}),ce=P=>K(r,{...P,children:K("i",{className:"uil uil-times text-[16px]"})}),oe=P=>{j.onChange(P),f&&f(P)},Pe=async P=>{var pe;if(P.key==="Enter"){P.preventDefault();let me=await ue((pe=P==null?void 0:P.target)==null?void 0:pe.value);(me==null?void 0:me.length)>0&&oe(me[0])}};return He("div",{className:"relative w-full",id:"select",ref:m,children:[D&&K("div",{className:kt("z-[70] absolute bg-neutral-100 top-[1px] left-[1px] rounded-l-lg flex justify-center items-center h-[44px] w-[38px] text-[22px] text-dark-blue-600",{"text-blue-500":A&&U.hasIcon,"text-red-500":Q.hasError&&U.hasIcon}),children:D}),K(jo,{onKeyDown:Pe,...j,...Q,...Qe,...Ae,...U,...se,isDisabled:c,onFocus:()=>de(!0),onBlur:()=>de(!1),loadingMessage:()=>K("div",{children:"Carregando"}),isLoading:H,defaultOptions:x>0?!1:h?M:!0,loadOptions:ue,name:j.name,isClearable:d,styles:ea,placeholder:s||" ",isSearchable:y,options:M,tabSelectsValue:!0,components:{SingleValue:he,ValueContainer:Xo,Option:Ee,LoadingIndicator:()=>K(aa,{}),LoadingMessage:Oe,NoOptionsMessage:et,DropdownIndicator:ke,ClearIndicator:ce},closeMenuOnSelect:!0,hideSelectedOptions:!1,onChange:oe}),He("span",{className:kt("text-label text-sm left-2.5 cursor-pointer pointer-events-none absolute transition-all duration-200",{"scale-75 -translate-y-3":j.value||I,"ml-[35px]":U.hasIcon,"ml-[2px]":!U.hasIcon,"top-2.5":!(j.value||I),"top-0":j.value||I}),children:[a,T&&a&&K("strong",{className:"text-dangerous-700",children:"\xA0*"})]}),O.map((P,pe)=>K("div",{style:{color:"var(--dangerous-700)"},className:"text-xs ml-[2px]",role:"alert","aria-label":P,children:P},pe))]})}})},Xo=({children:e,...t})=>K(oa.ValueContainer,{...t,children:e});import{Controller as Wo}from"react-hook-form";import{jsx as dt,jsxs as na}from"react/jsx-runtime";var il=({disabled:e,control:t,name:a,label:i,defaultChecked:g})=>dt(Wo,{name:a,control:t,render:({field:s})=>na("div",{className:"flex items-center justify-center gap-2",children:[na("label",{className:"custom-radio flex items-center",children:[dt("input",{name:a,id:a,type:"radio",className:"",onClick:y=>{s.onChange(y.target.value)},defaultChecked:g,disabled:e}),dt("span",{})]}),i&&dt("label",{htmlFor:a,className:"text-p-md cursor-pointer -pt-1",children:i})]})});import{Switch as ra}from"@headlessui/react";import{Controller as $o}from"react-hook-form";import{jsx as Re,jsxs as Pt}from"react/jsx-runtime";var{Group:Uo,Label:Ko}=ra;function ut(...e){return e.filter(Boolean).join(" ")}var gl=({name:e,label:t,subLabel:a,control:i,disabled:g})=>Pt(Uo,{as:"div",className:"flex items-center",children:[Re($o,{control:i,name:e,render:({field:s})=>Re(ra,{disabled:g,...s,className:"h-[18px] w-[33px] focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-full",checked:!!s.value,onChange:y=>{s.onChange(y)},children:({checked:y})=>Re("div",{className:ut(y?"bg-blue-500":"bg-neutral-200","relative inline-flex h-[18px] p-[2px] w-[33px] flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out "),children:Pt("span",{className:ut("pointer-events-none relative inline-block -top-[2px] right-[2px] h-[14px] w-[14px] transform rounded-full shadow ring-0 transition duration-200 ease-in-out",y?"translate-x-[15px]":"translate-x-0",g?"bg-neutral-300":"bg-white"),children:[Re("span",{className:ut(y?"opacity-0 ease-out duration-100":"opacity-100 ease-in duration-200","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"}),Re("span",{className:ut(y?"opacity-100 ease-in duration-200":"opacity-0 ease-out duration-100","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"})]})})})}),t&&Pt(Ko,{as:"span",className:"flex flex-col gap-1 ml-2 cursor-pointer",children:[Re("span",{className:"text-sm text-paragraph",children:t}),a&&Re("span",{className:"text-sm",children:a})]})]});import{Combobox as be}from"@headlessui/react";import{useEffect as ct,useState as Ye}from"react";import sa from"clsx";import{jsx as Y,jsxs as Se}from"react/jsx-runtime";function la({pageSizeOptions:e,table:t}){var v,D,k,b,n,N;let a=t==null?void 0:t.getPageCount(),i=a?[...Array(a)]:[],g=i==null?void 0:i.map((r,o)=>({id:o,name:o})),[s,y]=Ye({id:((v=JSON.parse(sessionStorage.getItem("pageSize")))==null?void 0:v.id)||20,name:((D=JSON.parse(sessionStorage.getItem("pageSize")))==null?void 0:D.name)||20}),[d,w]=Ye({id:((b=(k=t==null?void 0:t.getState())==null?void 0:k.pagination)==null?void 0:b.pageIndex)||0,name:((N=(n=t==null?void 0:t.getState())==null?void 0:n.pagination)==null?void 0:N.pageIndex)||0}),[T,x]=Ye(()=>g),[R,h]=Ye(e==null?void 0:e.map(r=>({id:r,name:r}))),[c,f]=Ye(""),S=()=>{let r=[...g];x(r.filter(o=>(o.name+1).toString().startsWith(c)))},u=(r,o)=>{sessionStorage.setItem(r,JSON.stringify(o))};return ct(()=>{S()},[c]),ct(()=>{u("pageSize",s),t.setPageSize(s==null?void 0:s.id),t.setPageIndex(0),w({id:0,name:0})},[s]),ct(()=>{x(a?[...Array(a)].map((r,o)=>({id:o,name:o})):[])},[t==null?void 0:t.getPageCount()]),ct(()=>{var r,o,m,I,L,H;((o=(r=t==null?void 0:t.getState())==null?void 0:r.pagination)==null?void 0:o.pageIndex)>=0&&w({id:(I=(m=t==null?void 0:t.getState())==null?void 0:m.pagination)==null?void 0:I.pageIndex,name:(H=(L=t==null?void 0:t.getState())==null?void 0:L.pagination)==null?void 0:H.pageIndex})},[t==null?void 0:t.getState().pagination]),Se("div",{className:"hidden md:flex items-center gap-2",children:[Se("div",{className:"flex items-center gap-2 text-paragraph",children:[Y("span",{children:"Exibir "}),Y(be,{value:s,onChange:r=>{y(r)},children:({open:r})=>Se("div",{className:"relative",children:[Se(be.Button,{className:"flex items-center justify-between w-[70px] h-[42px] text-paragraph outline-none text-p-sm cursor-pointer peer relative shadow-input rounded-lg border p-2 disabled:bg-neutral-100 border-neutral-300",children:[s==null?void 0:s.name,r?Y("i",{className:"uil uil-angle-up text-base top-[13px] pl-3 cursor-pointer text-label"}):Y("i",{className:"uil uil-angle-down text-base top-[13px] pl-3 cursor-pointer text-label"})]}),Y(be.Options,{className:"w-full outline-none max-h-[200px] overflow-auto border-[0.5px] mt-1 color-neutral-300 flex flex-col gap-y-2 p-1 absolute right-0 bottom-12 z-[999] rounded-lg bg-white",children:R==null?void 0:R.map(o=>{let m=(o==null?void 0:o.id)===(s==null?void 0:s.id);return Y(be.Option,{value:o,className:sa("p-2 rounded-lg items-center justify-center cursor-pointer flex whitespace-nowrap no-underline ",{"bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]":m},{"hover:bg-neutral-100 text-paragraph":!m}),children:o.name},(s==null?void 0:s.id)+"size")})})]})}),Y("span",{children:" resultados"})]}),Y("div",{className:"bg-neutral-300 h-[20px] w-[1px]"}),Se("div",{className:"flex items-center gap-2 text-paragraph",children:[Y("span",{children:"Ir para a p\xE1gina "}),Y(be,{value:d,onChange:r=>{r&&(r!=null&&r.id)&&(w({id:r==null?void 0:r.id,name:r==null?void 0:r.id}),u("pageIndex",r==null?void 0:r.id),t.setPageIndex(r==null?void 0:r.id),f(""))},children:({open:r})=>Se("div",{className:"relative",children:[Se(be.Button,{className:"relative",children:[Y(be.Input,{as:"input",onKeyDown:o=>{var I;let m=Number((I=o.target)==null?void 0:I.value);o.key=="Enter"&&m&&m<=a&&(w({id:m-1,name:m-1}),u("pageIndex",m),t.setPageIndex(m-1),f(""))},displayValue:o=>d?(d==null?void 0:d.id)+1:(o==null?void 0:o.id)+1,onChange:o=>{o.target.value&&f(o.target.value)},className:"h-[42px] w-[70px] outline-none text-p-md text-paragraph cursor-pointer border-neutral-300 peer shadow-input rounded-lg border block disabled:bg-neutral-100 p-2"}),r?Y("i",{className:"uil uil-angle-up text-base absolute top-[10px] right-2 cursor-pointer text-label"}):Y("i",{className:"uil uil-angle-down text-base absolute top-[10px] right-2 cursor-pointer text-label"})]}),Y(be.Options,{className:"w-full outline-none max-h-[200px] overflow-auto border-[0.5px] mt-1 color-neutral-300 flex flex-col gap-y-2 p-1 absolute right-0 bottom-12 z-[999] rounded-lg bg-white",children:T.map(o=>{let m=(o==null?void 0:o.id)===(d==null?void 0:d.id);return Y(be.Option,{value:o,className:sa("p-2 rounded-lg items-center justify-center cursor-pointer flex whitespace-nowrap no-underline ",{"bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]":m},{"hover:bg-neutral-100 text-paragraph":!m}),children:(o==null?void 0:o.name)+1},(d==null?void 0:d.id)+"page")})})]})})]})]})}import{flexRender as ua,getCoreRowModel as _o,getExpandedRowModel as Yo,getFacetedRowModel as Zo,getFacetedUniqueValues as Qo,getFilteredRowModel as en,useReactTable as tn}from"@tanstack/react-table";import ca,{useEffect as Be,useMemo as an,useRef as on,useState as ne}from"react";import{clsx as we}from"clsx";import*as xe from"react";import{jsx as Ne}from"react/jsx-runtime";var It=xe.forwardRef(({className:e,...t},a)=>Ne("table",{ref:a,className:we("table-scroll block text-left border-separate border-spacing-0 w-full",e),onScroll:t.onScroll,...t}));It.displayName="Table";var Ft=xe.forwardRef(({className:e,...t},a)=>Ne("thead",{ref:a,className:we("w-full sticky top-0 z-[90]",e),...t}));Ft.displayName="TableHeader";var Mt=xe.forwardRef(({className:e,...t},a)=>Ne("tbody",{ref:a,className:we(e),...t}));Mt.displayName="TableBody";var Lt=xe.forwardRef(({className:e,...t},a)=>Ne("div",{ref:a,className:we(" flex flex-col md:flex-row gap-2 md:gap-0 justify-between items-center py-4 px-6 bg-white w-full h-full border border-neutral-200 rounded-t-lg",e),...t}));Lt.displayName="TableFooter";var pt=xe.forwardRef(({className:e,...t},a)=>Ne("tr",{ref:a,className:we(e),...t}));pt.displayName="TableRow";var Ht=xe.forwardRef(({className:e,...t},a)=>Ne("th",{ref:a,className:we({"hover:bg-neutral-100":t.sortable},"text-p-md z-[50] bg-white font-normal text-neutral-700 p-4 text-left border-t border-b border-neutral-200 first:border-l last:border-r first:rounded-tl-lg first:rounded-bl-lg last:rounded-tr-lg last:rounded-br-lg",e),...t}));Ht.displayName="TableHead";var Bt=xe.forwardRef(({className:e,...t},a)=>Ne("td",{ref:a,className:we("align-middle h-[80px] border-b border-neutral-200 whitespace-nowrap py-4 px-5",e),...t}));Bt.displayName="TableCell";var Go=xe.forwardRef(({className:e,...t},a)=>Ne("caption",{ref:a,className:we("text-default mt-4 text-sm",e),...t}));Go.displayName="TableCaption";import{Fragment as qo}from"react";import{Fragment as ia,jsx as V,jsxs as fe}from"react/jsx-runtime";function da({table:e,footer:t=V("div",{}),totalData:a,selectAllOption:i,onSelectAll:g,rowsSelected:s,onRemoveAll:y,tableRef:d,paginationScroll:w,pageSizeOptions:T=[]}){var v,D,k,b,n;let x=(v=e==null?void 0:e.getState())==null?void 0:v.pagination.pageIndex,R=a,h=e==null?void 0:e.getPageCount(),c=((D=e==null?void 0:e.getState())==null?void 0:D.pagination.pageIndex)+2,f=((k=e==null?void 0:e.getState())==null?void 0:k.pagination.pageIndex)-2,S=h?[...Array(h)]:[],u=((n=(b=e==null?void 0:e.getRowModel())==null?void 0:b.rows)==null?void 0:n.length)||0;return fe("div",{className:"w-full flex flex-col sticky z-[90] bottom-0",children:[V("div",{className:"bg-none overflow-x-hidden md:overflow-x-auto overflow-y-hidden table-scroll rounded-lg relative top-[8px] -space-y-1 z-[302] h-[12px]",onScroll:N=>{d==null||d.current.scrollTo({left:N.currentTarget.scrollLeft})},children:V("div",{style:{width:w?w-2:0},children:"\xA0"})}),fe(Lt,{children:[(T==null?void 0:T.length)>0&&V(la,{table:e,pageSizeOptions:T}),fe("div",{className:"flex flex-col md:flex-row items-center justify-center md:justify-normal gap-2 md:gap-4",children:[t,i&&V("div",{children:s!==a?V("div",{className:"md:border-l border-gray-300 pl-4",children:fe(J,{size:"xxs",onClick:g,variant:"link",children:["Selecionar todos os ",a]})}):V("div",{className:"md:border-l border-gray-300 pl-4",children:V(J,{size:"xxs",onClick:y,variant:"link",children:"Desmarcar todos"})})})]}),fe("div",{className:"flex flex-col md:flex-row items-center md:justify-end justify-center gap-2 flex-1",children:[fe("span",{className:"text-p-md text-paragraph mr-1",children:["Mostrando ",u," de ",R," resultados"]}),fe("div",{className:"flex items-center gap-2",children:[V(J,{onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),variant:"icon",icon:V("i",{className:"uil uil-angle-left text-base"}),size:"xs",className:"justify-center"}),f>=1&&fe("div",{className:"flex gap-2",children:[V(J,{onClick:()=>e.setPageIndex(0),variant:"icon",icon:V("div",{style:{fontSize:"12px",color:"#393C4D"},children:1}),size:"xs",className:"justify-center"}),f!==1&&V(J,{disabled:!0,variant:"icon",icon:V(ia,{children:"..."}),size:"xs",className:"justify-center"})]}),S.map((N,r)=>{let o=r<=c&&r>=f,m=r===x;return V(qo,{children:o&&V(J,{onClick:()=>e.setPageIndex(r),className:"font-normal text-xs justify-center",variant:m?"blue":"icon",size:"xs",icon:V("div",{style:{fontSize:"12px",color:m?"#FFF":"#393C4D"},children:(r+1).toLocaleString("pt-BR")})})},r+"pagination")}),c+1<h&&fe("div",{className:"flex gap-2",children:[c!==S.length-2&&V(J,{disabled:!0,variant:"icon",icon:V(ia,{children:"..."}),size:"xs",className:"justify-center"}),V(J,{onClick:()=>e.setPageIndex(h),variant:"icon",icon:V("div",{style:{fontSize:"12px",color:"#393C4D"},children:h.toLocaleString("pt-BR")}),size:"xs",className:"font-normal justify-center"})]}),V(J,{onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),variant:"icon",icon:V("i",{className:"uil uil-angle-right text-base"}),size:"xs",className:"justify-center"})]})]})]})]})}import Ze from"clsx";import{rankItem as nn}from"@tanstack/match-sorter-utils";import{Fragment as pa,jsx as $,jsxs as ie}from"react/jsx-runtime";var rn=(e,t,a,i)=>{let g=nn(e.getValue(t),a);return i({itemRank:g}),g.passed};function ma({columns:e,tableClass:t="",data:a=[],hidePagination:i,emptyButtonAction:g,hideBlankState:s,renderSubComponent:y=()=>{},footer:d,borderFull:w=!1,withShadow:T=!0,actionsSelection:x,backgroundColor:R,emptyState:h,totalData:c=0,showFilter:f,placeholder:S,fetchData:u,openedSubComponent:v=!1,getRowCanExpand:D,enableRowSelection:k,onScroll:b,tableContainerRef:n,setRows:N,selectAllOption:r,autoPagination:o,rowClassName:m,listUpdate:I,setRowSelection:L,rowSelection:H,perPage:p,pageSizeOptions:M,onFinishFetch:z}){var zt,Vt,Jt,jt,Xt,Wt;let G=on(null),[l,A]=ne({}),[de,ue]=ne([]),[re,O]=ne([]),[Q,se]=ne([]),[Qe,Ae]=ne(""),[U,De]=ne([]),[j,he]=ne(!0),[Ee,Oe]=ne({}),[et,ke]=ne(()=>c),[{pageIndex:ce,pageSize:oe},Pe]=ne({pageIndex:0,pageSize:i?999999:p||20}),[P,pe]=ne(),me=an(()=>({pageIndex:ce,pageSize:oe}),[ce,oe]),ga=()=>{var E,B;u&&!o?u({pageSize:oe,pageIndex:ce,order:(E=re[0])==null?void 0:E.id,orderDir:(B=re[0])!=null&&B.desc?"DESC":"ASC"}).then(C=>{De(C.rows),!(C!=null&&C.rows)&&c>0&&Pe({pageIndex:ce-1,pageSize:oe})}):ba(ce,oe).then(C=>{De(C.rows),!(C!=null&&C.rows)&&c>0&&Pe({pageIndex:ce-1,pageSize:oe})}),setTimeout(()=>{z&&z()},1e3)},ba=async(E,B)=>({rows:(await new Promise((_,mt)=>{let ze=[],ve,$t;for(ve=0,$t=c;ve<$t;ve+=B)ze.push(a==null?void 0:a.slice(ve,ve+B));_(ze)}))[E],pageCount:Number(B)});Be(()=>{if(!(n!=null&&n.current))return;let E=new ResizeObserver(()=>{var B;pe((B=n==null?void 0:n.current)==null?void 0:B.scrollWidth)});return E.observe(n==null?void 0:n.current),()=>E.disconnect()},[]),Be(()=>{(u||o)&&ga()},[ce,oe,re]),Be(()=>{c!==et&&(Pe({pageIndex:0,pageSize:me.pageSize}),ke(c))},[c]),Be(()=>{a&&(De(()=>o?a.slice(0,oe):a),he(!1))},[a]);let xa=c<me.pageSize?1:Math.ceil(c/me.pageSize),Z=tn({data:(U==null?void 0:U.length)>0?U:[],columns:e,state:{sorting:re,columnVisibility:l,rowSelection:H,globalFilter:Qe,columnFilters:de,pagination:me,expanded:Ee},pageCount:xa,manualPagination:!0,enableRowSelection:k,onRowSelectionChange:L,onSortingChange:O,onColumnFiltersChange:ue,onColumnVisibilityChange:A,onGlobalFilterChange:Ae,globalFilterFn:rn,getCoreRowModel:_o(),getFilteredRowModel:en(),getFacetedRowModel:Zo(),getFacetedUniqueValues:Qo(),onPaginationChange:Pe,getRowCanExpand:D,onExpandedChange:Oe,getExpandedRowModel:Yo(),enableExpanding:!0,getRowId:E=>E.id,meta:{getRowStyles:m}});Be(()=>{k&&H&&se(Object.keys(H))},[H,k]);let fa=()=>{Z.toggleAllRowsSelected(!0);let E=a==null?void 0:a.map(C=>C==null?void 0:C.id),B={};E==null||E.forEach(C=>{B={...B,[C]:!0}}),L(B)},ha=()=>{Z.toggleAllRowsSelected(),L({})},At=U&&(U==null?void 0:U.length)==0&&!j&&!s||!U||((Vt=(zt=Z==null?void 0:Z.getRowModel())==null?void 0:zt.rows)==null?void 0:Vt.length)==0,va=!i&&c>0&&Z;function ya(){var E;if(At&&c!==null)return h||$("div",{});if(va&&c!==null)return $(da,{table:Z,footer:d,totalData:c,tableRef:n,selectAllOption:r,onSelectAll:fa,rowsSelected:(E=Object.keys(H||{}))==null?void 0:E.length,onRemoveAll:ha,paginationScroll:P,pageSizeOptions:M});if(c==null)return $(pa,{})}Be(()=>{if(H&&Object.keys(H).length==0){let E=document.getElementsByClassName("th-shadow");Object.keys(E).forEach(B=>{var C,ee;(ee=(C=E[B])==null?void 0:C.classList)==null||ee.add("with-shadow")})}else if(H&&Object.keys(H).length==1){let E=document.getElementsByClassName("th-shadow");Object.keys(E).forEach(B=>{var C,ee;(ee=(C=E[B])==null?void 0:C.classList)==null||ee.remove("with-shadow")})}},[H]);let Ot=E=>{var C,ee;let B=Z;return m?(ee=(C=B==null?void 0:B.options)==null?void 0:C.meta)==null?void 0:ee.getRowStyles(E):{}};return ie("div",{className:"w-full h-full flex flex-col",children:[f&&ie("div",{className:"w-full flex justify-between md:items-center flex-col md:flex-row gap-y-2 md:gap-y-0",children:[$("div",{className:"w-full md:max-w-[350px]",id:"filter-table",children:$(at,{onChange:E=>Ae(E.target.value),name:"filter",value:Qe,icon:$("i",{className:"uil uil-search"}),placeholder:"Buscar pedido por ID, C\xF3digo ou Cliente",clearField:!0,onClear:()=>Ae("")})}),I]}),ie("div",{className:Ze("w-full flex mt-4 flex-col justify-between",{"flex-1":!At,[t]:t}),children:[ie(It,{className:Ze("w-full table_container z-20 overflow-x-scroll md:overflow-x-hidden"),onScroll:b,ref:n,children:[H&&((Jt=Object.keys(H))==null?void 0:Jt.length)>0&&x&&(U==null?void 0:U.length)>0&&ie("div",{className:"h-[76px] flex items-center justify-between px-4 bg-gradient-to-b from-blue-start to-blue-end rounded-lg -mb-[1px]",children:[ie("div",{className:"flex gap-6",children:[ie("span",{className:"text-white text-p-lg",children:[Object.keys(H).length," selecionado(s)"]}),x]}),$("button",{title:"set-row",onClick:()=>L({}),children:$("i",{className:"uil uil-times text-white"})})]}),ie("div",{className:"table w-full mr-[2px]",ref:G,children:[$(Ft,{children:(jt=Z==null?void 0:Z.getHeaderGroups())==null?void 0:jt.map((E,B)=>$(pt,{children:E.headers.map((C,ee)=>{var mt,ze,ve;let _=C.column.columnDef.meta;return $(Ht,{style:{width:C.getSize()},scope:"col",className:Ze({"hover:bg-neutral-100 th-shadow cursor-pointer":C.column.getCanSort(),"with-shadow":(Q==null?void 0:Q.length)==0&&T},_==null?void 0:_.header,_==null?void 0:_.className),children:ie("div",{onClick:C.column.getToggleSortingHandler(),children:[C.isPlaceholder?null:ua(C.column.columnDef.header,C.getContext()),((mt=re[0])==null?void 0:mt.id)==C.column.id?$("i",{className:Ze({"rotate-0":!((ze=re[0])!=null&&ze.desc),"rotate-180":(ve=re[0])==null?void 0:ve.desc},"uil uil-arrow-down text-blue-500 transform ml-1 text-[18px] duration-75")}):$(pa,{})]})},B+ee+"th")})},E.id+B+"header"))}),$(Mt,{children:(Wt=(Xt=Z==null?void 0:Z.getRowModel())==null?void 0:Xt.rows)==null?void 0:Wt.map((E,B)=>$(ca.Fragment,{children:!E.original._destroy&&ie(ca.Fragment,{children:[$(pt,{id:E.id,className:"text-p-md font-normal h-[80px] text-paragraph w-fit",style:Ot(E),children:E.getVisibleCells().map((C,ee)=>{let _=C.column.columnDef.meta;return $(Bt,{id:C.id,style:{width:C.column.getSize(),backgroundColor:R||"",...Ot(E)},className:Ze({hidden:C.row.original._destroy,"first:border-l last:border-r":w,"first:rounded-bl-lg last:rounded-br-lg":w&&E.index===(a==null?void 0:a.length)-1},_==null?void 0:_.cell,_==null?void 0:_.className),children:ua(C.column.columnDef.cell,C.getContext())},C.id)})},E.id),(E.getIsExpanded()||v)&&$("tr",{children:$("td",{colSpan:E.getVisibleCells().length,children:y({row:E})})})]})},B+"row"))})]})]}),ya()]})]})}export{Jn as Badge,J as Button,_n as Calendar,er as Checkbox,ma as DataTable,da as DataTablePagination,An as DatePickerInput,gr as FilterCalendar,Hr as FilterOptions,at as Input,wo as InputMoney,So as InputNumber,Po as InputPercentage,fn as Logo,Ds as MaskedInput,Hs as ModalDialog,la as PaginationSelect,zs as Popover,il as Radio,yn as RocketIcon,ol as SelectField,Kt as SpinnerIcon,It as Table,Mt as TableBody,Go as TableCaption,Bt as TableCell,Lt as TableFooter,Ht as TableHead,Ft as TableHeader,pt as TableRow,gl as Toggle,Xo as ValueContainer};
|
|
160
|
+
`,
|
|
161
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
162
|
+
props.icon && /* @__PURE__ */ jsx(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: `flex items-center justify-center ${appliedSize.icon}`,
|
|
166
|
+
children: props.icon && !props.loading ? props.icon : props.loadingIcon && props.loading ? props.loadingIcon : /* @__PURE__ */ jsx(SpinnerIcon, { className: "animate-spin" })
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
props.children,
|
|
170
|
+
props.dropdown && /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-[18px]" })
|
|
171
|
+
] })
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
var Input = ({
|
|
176
|
+
label,
|
|
177
|
+
type,
|
|
178
|
+
registration,
|
|
179
|
+
onClick,
|
|
180
|
+
error,
|
|
181
|
+
onBlur,
|
|
182
|
+
inputProps,
|
|
183
|
+
icon,
|
|
184
|
+
clearField,
|
|
185
|
+
name,
|
|
186
|
+
required,
|
|
187
|
+
disabled,
|
|
188
|
+
value,
|
|
189
|
+
placeholder,
|
|
190
|
+
defaultValue,
|
|
191
|
+
onKeyUp,
|
|
192
|
+
onKeyDown,
|
|
193
|
+
onClear,
|
|
194
|
+
hideInput,
|
|
195
|
+
onChange,
|
|
196
|
+
ref
|
|
197
|
+
}) => {
|
|
198
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
199
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
200
|
+
const styles = {
|
|
201
|
+
input: `text-p-md pl-2 peer shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border-1 focus-visible:border-blue-500 ${label ? "pt-[22px]" : "pt-[10px]"}
|
|
202
|
+
${!hasError ? "border-neutral-300" : ""}`,
|
|
203
|
+
icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1.5px] w-[38px] rounded-l-lg text-[20px] ${hasError ? "text-dangerous-500" : "text-label peer-focus:text-blue-500"} peer-focus:border-blue-500`,
|
|
204
|
+
rightIcon: "absolute h-[44px] top-[1px] right-[1.5px] w-[38px] text-[22px]",
|
|
205
|
+
label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0",
|
|
206
|
+
clear: "absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]",
|
|
207
|
+
error: "border-dangerous-500 text-dangerous-500"
|
|
208
|
+
};
|
|
209
|
+
const inlineStyles = {
|
|
210
|
+
inputWithIcon: { paddingLeft: "48px" },
|
|
211
|
+
labelWithIcon: { left: "3rem" }
|
|
212
|
+
};
|
|
213
|
+
const input = name ? document == null ? void 0 : document.getElementById(name) : null;
|
|
214
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
215
|
+
/* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
"input",
|
|
218
|
+
{
|
|
219
|
+
id: name,
|
|
220
|
+
type,
|
|
221
|
+
name,
|
|
222
|
+
value,
|
|
223
|
+
defaultValue,
|
|
224
|
+
style: !label && placeholder && icon || icon ? inlineStyles.inputWithIcon : void 0,
|
|
225
|
+
className: clsx7({
|
|
226
|
+
[styles.error]: hasError,
|
|
227
|
+
[styles.input]: true,
|
|
228
|
+
["pr-10"]: clearField,
|
|
229
|
+
["pr-2"]: !clearField
|
|
230
|
+
}),
|
|
231
|
+
placeholder: !label && placeholder ? placeholder : " ",
|
|
232
|
+
onChange,
|
|
233
|
+
onBlur,
|
|
234
|
+
onClick,
|
|
235
|
+
disabled,
|
|
236
|
+
ref,
|
|
237
|
+
...inputProps,
|
|
238
|
+
...registration,
|
|
239
|
+
onKeyUp,
|
|
240
|
+
onKeyDown
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
icon && /* @__PURE__ */ jsx(
|
|
244
|
+
"div",
|
|
245
|
+
{
|
|
246
|
+
className: clsx7(styles.icon, "flex justify-center items-center"),
|
|
247
|
+
children: icon
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
hideInput && /* @__PURE__ */ jsx(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
className: clsx7(
|
|
254
|
+
styles.rightIcon,
|
|
255
|
+
"flex justify-center items-center"
|
|
256
|
+
),
|
|
257
|
+
children: /* @__PURE__ */ jsx("i", { className: "uil uil-eye text-label cursor-pointer text-[20px]" })
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ jsxs(
|
|
261
|
+
"label",
|
|
262
|
+
{
|
|
263
|
+
style: icon ? inlineStyles.labelWithIcon : void 0,
|
|
264
|
+
className: clsx7(
|
|
265
|
+
{
|
|
266
|
+
[styles.label]: true,
|
|
267
|
+
["left-2.5"]: !icon
|
|
268
|
+
},
|
|
269
|
+
"cursor-text whitespace-nowrap text-ellipsis overflow-hidden pointer-events-none"
|
|
270
|
+
),
|
|
271
|
+
htmlFor: name,
|
|
272
|
+
children: [
|
|
273
|
+
label,
|
|
274
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
clearField && value && value !== "" && !disabled && /* @__PURE__ */ jsx(
|
|
279
|
+
"i",
|
|
280
|
+
{
|
|
281
|
+
className: clsx7(
|
|
282
|
+
{
|
|
283
|
+
[styles.clear]: true
|
|
284
|
+
},
|
|
285
|
+
"uil uil-times clear-icon"
|
|
286
|
+
),
|
|
287
|
+
onClick: () => {
|
|
288
|
+
if (input) {
|
|
289
|
+
input == null ? void 0 : input.focus();
|
|
290
|
+
}
|
|
291
|
+
if (onClear) {
|
|
292
|
+
onClear();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
] }),
|
|
298
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: "text-dangerous-500 text-p-xs mt-1 ml-[2px]",
|
|
302
|
+
role: "alert",
|
|
303
|
+
"aria-label": message,
|
|
304
|
+
children: message
|
|
305
|
+
},
|
|
306
|
+
index
|
|
307
|
+
))
|
|
308
|
+
] });
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// src/assets/example-logo.svg
|
|
312
|
+
var example_logo_default = 'data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">%0A <rect width="100" height="100" fill="%23FF4D8B"/>%0A <text x="50" y="50" font-size="20" text-anchor="middle" dy=".3em" fill="white">LOGO</text>%0A</svg>%0A';
|
|
313
|
+
var Logo = ({ className }) => {
|
|
314
|
+
return /* @__PURE__ */ jsx(
|
|
315
|
+
"img",
|
|
316
|
+
{
|
|
317
|
+
src: example_logo_default,
|
|
318
|
+
alt: "Logo",
|
|
319
|
+
className,
|
|
320
|
+
width: 100,
|
|
321
|
+
height: 100
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
};
|
|
325
|
+
var RocketIcon = (props) => /* @__PURE__ */ jsxs(
|
|
326
|
+
"svg",
|
|
327
|
+
{
|
|
328
|
+
width: "800px",
|
|
329
|
+
height: "800px",
|
|
330
|
+
viewBox: "0 0 1024 1024",
|
|
331
|
+
className: "icon",
|
|
332
|
+
version: "1.1",
|
|
333
|
+
style: props.style,
|
|
334
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
335
|
+
children: [
|
|
336
|
+
/* @__PURE__ */ jsx(
|
|
337
|
+
"path",
|
|
338
|
+
{
|
|
339
|
+
d: "M512 301.2m-10 0a10 10 0 1 0 20 0 10 10 0 1 0-20 0Z",
|
|
340
|
+
fill: "#E73B37"
|
|
341
|
+
}
|
|
342
|
+
),
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
"path",
|
|
345
|
+
{
|
|
346
|
+
d: "M400.3 744.5c2.1-0.7 4.1-1.4 6.2-2-2 0.6-4.1 1.3-6.2 2z m0 0c2.1-0.7 4.1-1.4 6.2-2-2 0.6-4.1 1.3-6.2 2z",
|
|
347
|
+
fill: "#39393A"
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ jsx(
|
|
351
|
+
"path",
|
|
352
|
+
{
|
|
353
|
+
d: "M511.8 256.6c24.4 0 44.2 19.8 44.2 44.2S536.2 345 511.8 345s-44.2-19.8-44.2-44.2 19.9-44.2 44.2-44.2m0-20c-35.5 0-64.2 28.7-64.2 64.2s28.7 64.2 64.2 64.2 64.2-28.7 64.2-64.2-28.7-64.2-64.2-64.2z",
|
|
354
|
+
fill: "#E73B37"
|
|
355
|
+
}
|
|
356
|
+
),
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
"path",
|
|
359
|
+
{
|
|
360
|
+
d: "M730.7 529.5c0.4-8.7 0.6-17.4 0.6-26.2 0-179.6-86.1-339.1-219.3-439.5-133.1 100.4-219.2 259.9-219.2 439.5 0 8.8 0.2 17.5 0.6 26.1-56 56-90.6 133.3-90.6 218.7 0 61.7 18 119.1 49.1 167.3 30.3-49.8 74.7-90.1 127.7-115.3 39-18.6 82.7-29 128.8-29 48.3 0 93.9 11.4 134.3 31.7 52.5 26.3 96.3 67.7 125.6 118.4 33.4-49.4 52.9-108.9 52.9-173.1 0-85.4-34.6-162.6-90.5-218.6zM351.1 383.4c9.2-37.9 22.9-74.7 40.6-109.5a502.1 502.1 0 0 1 63.6-95.9c17.4-20.6 36.4-39.9 56.8-57.5 20.4 17.6 39.4 36.9 56.8 57.5 24.8 29.5 46.2 61.8 63.6 95.9 17.7 34.8 31.4 71.6 40.6 109.5 8.7 35.8 13.5 72.7 14.2 109.9C637.4 459 577 438.9 512 438.9c-65 0-125.3 20.1-175.1 54.4 0.7-37.2 5.5-74.1 14.2-109.9z m-90.6 449.2c-9.1-27-13.7-55.5-13.7-84.4 0-35.8 7-70.6 20.8-103.2 8.4-19.8 19-38.4 31.9-55.5 9.7 61.5 29.5 119.7 57.8 172.6-36.4 17.8-69 41.6-96.8 70.5z m364.2-85.3c-0.7-0.3-1.5-0.5-2.2-0.8-0.4-0.2-0.9-0.3-1.3-0.5-0.6-0.2-1.3-0.5-1.9-0.7-0.8-0.3-1.5-0.5-2.3-0.8-0.8-0.3-1.5-0.5-2.3-0.7l-0.9-0.3c-1-0.3-2.1-0.7-3.1-1-1.2-0.4-2.4-0.7-3.5-1.1l-3-0.9c-0.2-0.1-0.4-0.1-0.7-0.2-1.1-0.3-2.3-0.7-3.4-1-1.2-0.3-2.4-0.6-3.5-0.9l-3.6-0.9-3.6-0.9c-1-0.3-2.1-0.5-3.1-0.7-1.2-0.3-2.4-0.5-3.6-0.8-1.3-0.3-2.5-0.6-3.8-0.8h-0.3c-0.9-0.2-1.9-0.4-2.8-0.6-0.4-0.1-0.7-0.1-1.1-0.2-1.1-0.2-2.2-0.4-3.4-0.6-1.2-0.2-2.4-0.4-3.6-0.7l-5.4-0.9c-0.9-0.1-1.9-0.3-2.8-0.4-0.8-0.1-1.6-0.3-2.5-0.4-2.6-0.4-5.1-0.7-7.7-1-1.2-0.1-2.3-0.3-3.5-0.4h-0.4c-0.9-0.1-1.8-0.2-2.8-0.3-1.1-0.1-2.1-0.2-3.2-0.3-1.7-0.2-3.4-0.3-5.1-0.4-0.8-0.1-1.5-0.1-2.3-0.2-0.9-0.1-1.9-0.1-2.8-0.2-0.4 0-0.8 0-1.2-0.1-1.1-0.1-2.1-0.1-3.2-0.2-0.5 0-1-0.1-1.5-0.1-1.3-0.1-2.6-0.1-3.9-0.1-0.8 0-1.5-0.1-2.3-0.1-1.2 0-2.4 0-3.5-0.1h-13.9c-2.3 0-4.6 0.1-6.9 0.2-0.9 0-1.9 0.1-2.8 0.1-0.8 0-1.5 0.1-2.3 0.1-1.4 0.1-2.8 0.2-4.1 0.3-1.4 0.1-2.7 0.2-4.1 0.3-1.4 0.1-2.7 0.2-4.1 0.4-0.6 0-1.2 0.1-1.8 0.2l-7.8 0.9c-1.1 0.1-2.1 0.3-3.2 0.4-1 0.1-2.1 0.3-3.1 0.4-3.2 0.5-6.4 0.9-9.5 1.5-0.7 0.1-1.4 0.2-2.1 0.4-0.9 0.1-1.7 0.3-2.6 0.5-1.1 0.2-2.3 0.4-3.4 0.6-0.9 0.2-1.7 0.3-2.6 0.5-0.4 0.1-0.8 0.1-1.1 0.2-0.7 0.1-1.4 0.3-2.1 0.4-1.2 0.3-2.4 0.5-3.6 0.8-1.2 0.3-2.4 0.5-3.6 0.8-0.2 0-0.4 0.1-0.6 0.1-0.5 0.1-1 0.2-1.5 0.4-1.1 0.3-2.3 0.6-3.5 0.9-1.3 0.3-2.5 0.6-3.8 1-0.4 0.1-0.9 0.2-1.4 0.4-1.3 0.4-2.7 0.7-4 1.1-1.5 0.4-3 0.9-4.6 1.3-1 0.3-2.1 0.6-3.1 1-2.1 0.6-4.1 1.3-6.2 2-0.7 0.2-1.4 0.5-2.1 0.7-15-27.5-27.4-56.4-37-86.2-11.7-36.1-19.2-73.6-22.5-111.6-0.6-6.7-1-13.3-1.3-20-0.1-1.2-0.1-2.4-0.1-3.6-0.1-1.2-0.1-2.4-0.1-3.6 0-1.2-0.1-2.4-0.1-3.6 0-1.2-0.1-2.4-0.1-3.7 18.8-14 39.2-25.8 61-35 36.1-15.3 74.5-23 114.1-23 39.6 0 78 7.8 114.1 23 21.8 9.2 42.2 20.9 61 35v0.1c0 1 0 1.9-0.1 2.9 0 1.4-0.1 2.8-0.1 4.3 0 0.7 0 1.3-0.1 2-0.1 1.8-0.1 3.5-0.2 5.3-0.3 6.7-0.8 13.3-1.3 20-3.3 38.5-11 76.5-23 113-9.7 30.3-22.3 59.4-37.6 87.1z m136.8 90.9a342.27 342.27 0 0 0-96.3-73.2c29.1-53.7 49.5-112.8 59.4-175.5 12.8 17.1 23.4 35.6 31.8 55.5 13.8 32.7 20.8 67.4 20.8 103.2 0 31-5.3 61.3-15.7 90z",
|
|
361
|
+
fill: "#39393A"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ jsx(
|
|
365
|
+
"path",
|
|
366
|
+
{
|
|
367
|
+
d: "M512 819.3c8.7 0 24.7 22.9 24.7 60.4s-16 60.4-24.7 60.4-24.7-22.9-24.7-60.4 16-60.4 24.7-60.4m0-20c-24.7 0-44.7 36-44.7 80.4 0 44.4 20 80.4 44.7 80.4s44.7-36 44.7-80.4c0-44.4-20-80.4-44.7-80.4z",
|
|
368
|
+
fill: "#E73B37"
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
var useFieldErrorsStore = create(
|
|
375
|
+
(set3) => ({
|
|
376
|
+
field: {},
|
|
377
|
+
addValidationError: (validationErrors) => set3((state) => {
|
|
378
|
+
let fieldErrorsByPath = {};
|
|
379
|
+
validationErrors == null ? void 0 : validationErrors.forEach(
|
|
380
|
+
({ position, path, code, message }) => {
|
|
381
|
+
path == null ? void 0 : path.shift();
|
|
382
|
+
if (position !== null) {
|
|
383
|
+
path == null ? void 0 : path.splice(1, 0, position == null ? void 0 : position.toString());
|
|
384
|
+
}
|
|
385
|
+
const fieldPathWithPosition = path.join(".").replace(".", "");
|
|
386
|
+
fieldErrorsByPath = {
|
|
387
|
+
...fieldErrorsByPath,
|
|
388
|
+
[fieldPathWithPosition]: {
|
|
389
|
+
code,
|
|
390
|
+
message
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
return {
|
|
396
|
+
...state,
|
|
397
|
+
field: {
|
|
398
|
+
...fieldErrorsByPath
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}),
|
|
402
|
+
dismissAllValidationErrors: () => set3((state) => ({
|
|
403
|
+
field: {}
|
|
404
|
+
}))
|
|
405
|
+
})
|
|
406
|
+
);
|
|
407
|
+
var DatePickerInput = forwardRef(
|
|
408
|
+
({
|
|
409
|
+
icon,
|
|
410
|
+
label,
|
|
411
|
+
registration,
|
|
412
|
+
error,
|
|
413
|
+
inputProps,
|
|
414
|
+
clearField,
|
|
415
|
+
control,
|
|
416
|
+
name,
|
|
417
|
+
required,
|
|
418
|
+
defaultValue,
|
|
419
|
+
onChangeFunction,
|
|
420
|
+
maxDate,
|
|
421
|
+
minDate,
|
|
422
|
+
disabled,
|
|
423
|
+
small,
|
|
424
|
+
onClear,
|
|
425
|
+
popoverOffset
|
|
426
|
+
}, ref) => {
|
|
427
|
+
var _a;
|
|
428
|
+
const [invalidDate, setInvalidDate] = useState(false);
|
|
429
|
+
const [showCalendar, setShowCalendar] = useState(false);
|
|
430
|
+
const [inputWidth, setInputWidth] = useState(0);
|
|
431
|
+
const inputContainerRef = useRef(null);
|
|
432
|
+
const dateFnsFormat = "dd/MM/yyyy";
|
|
433
|
+
useEffect(() => {
|
|
434
|
+
const updateWidth = () => {
|
|
435
|
+
if (inputContainerRef.current) {
|
|
436
|
+
setInputWidth(inputContainerRef.current.offsetWidth + 10);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
updateWidth();
|
|
440
|
+
window.addEventListener("resize", updateWidth);
|
|
441
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
442
|
+
}, []);
|
|
443
|
+
const finalOffset = popoverOffset || [inputWidth || 250, -46];
|
|
444
|
+
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
445
|
+
const fieldValidationMessages = [
|
|
446
|
+
(_a = fieldValidation[name ? name : registration == null ? void 0 : registration.name]) == null ? void 0 : _a.message,
|
|
447
|
+
error == null ? void 0 : error.message
|
|
448
|
+
];
|
|
449
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
450
|
+
const styles = {
|
|
451
|
+
input: `text-p-md border rounded block pb-[10px] h-[46px] w-full disabled:bg-light-gray-100 `,
|
|
452
|
+
icon: `absolute bg-light-gray-100 h-[44px] w-[38px] top-[1px] left-[1px] rounded-l-lg rounded-r-none ${hasError ? "text-dangerous-700" : "text-label"}`,
|
|
453
|
+
label: "absolute text-label text-sm",
|
|
454
|
+
clear: "absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]"
|
|
455
|
+
};
|
|
456
|
+
const input = name ? document == null ? void 0 : document.getElementById(name) : null;
|
|
457
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
458
|
+
/* @__PURE__ */ jsx(
|
|
459
|
+
Controller,
|
|
460
|
+
{
|
|
461
|
+
control,
|
|
462
|
+
name,
|
|
463
|
+
render: ({ field }) => {
|
|
464
|
+
return /* @__PURE__ */ jsxs(
|
|
465
|
+
"div",
|
|
466
|
+
{
|
|
467
|
+
id: "group-input-calendar",
|
|
468
|
+
className: "relative",
|
|
469
|
+
ref: (node) => {
|
|
470
|
+
inputContainerRef.current = node;
|
|
471
|
+
if (typeof ref === "function") {
|
|
472
|
+
ref(node);
|
|
473
|
+
} else if (ref) {
|
|
474
|
+
ref.current = node;
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
style: {
|
|
478
|
+
["--popover-offset-x"]: `${finalOffset[0]}px`,
|
|
479
|
+
["--popover-offset-y"]: `${ -100}px`
|
|
480
|
+
},
|
|
481
|
+
children: [
|
|
482
|
+
icon && /* @__PURE__ */ jsx(
|
|
483
|
+
"div",
|
|
484
|
+
{
|
|
485
|
+
id: "icon",
|
|
486
|
+
className: clsx7(
|
|
487
|
+
styles.icon,
|
|
488
|
+
"flex justify-center items-center text-[20px] bg-gray-100"
|
|
489
|
+
),
|
|
490
|
+
children: icon
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ jsx(
|
|
494
|
+
DateInput3,
|
|
495
|
+
{
|
|
496
|
+
outOfRangeMessage: "Data n\xE3o permitida",
|
|
497
|
+
invalidDateMessage: "Data inv\xE1lida",
|
|
498
|
+
onError: () => setInvalidDate(true),
|
|
499
|
+
defaultValue: field.value,
|
|
500
|
+
inputProps: {
|
|
501
|
+
className: styles.input,
|
|
502
|
+
style: { height: "46px" }
|
|
503
|
+
},
|
|
504
|
+
popoverProps: {
|
|
505
|
+
placement: "bottom",
|
|
506
|
+
usePortal: false,
|
|
507
|
+
minimal: true,
|
|
508
|
+
popoverClassName: "date-picker-popover"
|
|
509
|
+
},
|
|
510
|
+
disabled,
|
|
511
|
+
onChange: (e, isUserChange) => {
|
|
512
|
+
if (isUserChange) {
|
|
513
|
+
field.onChange(e);
|
|
514
|
+
setShowCalendar(false);
|
|
515
|
+
if (onChangeFunction) {
|
|
516
|
+
onChangeFunction(e);
|
|
517
|
+
}
|
|
518
|
+
setInvalidDate(false);
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
value: field.value,
|
|
522
|
+
locale: "pt",
|
|
523
|
+
highlightCurrentDay: true,
|
|
524
|
+
formatDate: (value) => format(value, dateFnsFormat),
|
|
525
|
+
parseDate: (value) => parse(value, dateFnsFormat, /* @__PURE__ */ new Date()),
|
|
526
|
+
maxDate,
|
|
527
|
+
minDate
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
/* @__PURE__ */ jsxs(
|
|
531
|
+
"label",
|
|
532
|
+
{
|
|
533
|
+
className: clsx7(
|
|
534
|
+
"pointer-events-none ",
|
|
535
|
+
styles.label,
|
|
536
|
+
`
|
|
537
|
+
${field.value && field.value[0] !== null || invalidDate ? " scale-75 -translate-y-3 " : ""}
|
|
538
|
+
${icon ? "left-[3rem]" : "left-2.5"}`
|
|
539
|
+
),
|
|
540
|
+
style: { top: "13px" },
|
|
541
|
+
children: [
|
|
542
|
+
label,
|
|
543
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-700 ml-1", children: "*" })
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
clearField && (field == null ? void 0 : field.value) && (field == null ? void 0 : field.value) !== "" && !disabled && /* @__PURE__ */ jsx(
|
|
548
|
+
"i",
|
|
549
|
+
{
|
|
550
|
+
className: clsx7(
|
|
551
|
+
{
|
|
552
|
+
[styles.clear]: true
|
|
553
|
+
},
|
|
554
|
+
"uil uil-times clear-icon"
|
|
555
|
+
),
|
|
556
|
+
onClick: () => {
|
|
557
|
+
if (input) {
|
|
558
|
+
input == null ? void 0 : input.focus();
|
|
559
|
+
}
|
|
560
|
+
if (onClear) {
|
|
561
|
+
onClear();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
className: "absolute text-dangerous-700 text-xs mt-[2px] ml-1",
|
|
576
|
+
role: "alert",
|
|
577
|
+
"aria-label": message,
|
|
578
|
+
children: message
|
|
579
|
+
},
|
|
580
|
+
index
|
|
581
|
+
))
|
|
582
|
+
] });
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
var variants2 = {
|
|
586
|
+
success: "bg-success-100 text-success-600",
|
|
587
|
+
warning: "bg-warning-100 text-warning-600",
|
|
588
|
+
blue: "bg-blue-100 text-blue-500",
|
|
589
|
+
gray: "bg-neutral-100 text-neutral-400",
|
|
590
|
+
dangerous: "bg-dangerous-100 text-dangerous-600",
|
|
591
|
+
light: "bg-neutral-100 text-neutral-400",
|
|
592
|
+
white: "bg-[#FFF] text-neutral-400 px-4 py-[6px] border border-light shadow-button text-paragraph",
|
|
593
|
+
primary: "bg-rose-100 text-rose-800",
|
|
594
|
+
dark: "bg-neutral-700 text-white",
|
|
595
|
+
outline: "bg-white text-rose-700 border border-neutral-200",
|
|
596
|
+
"dark-gray": "bg-neutral-100 text-neutral-600"
|
|
597
|
+
};
|
|
598
|
+
var Badge = ({
|
|
599
|
+
variant = "blue",
|
|
600
|
+
children,
|
|
601
|
+
className,
|
|
602
|
+
style
|
|
603
|
+
}) => {
|
|
604
|
+
return /* @__PURE__ */ jsx(
|
|
605
|
+
"span",
|
|
606
|
+
{
|
|
607
|
+
className: clsx7(
|
|
608
|
+
{ [variants2[variant]]: (variant == null ? void 0 : variant.length) > 0 },
|
|
609
|
+
"py-1 px-2 text-p-md font-normal inline-flex items-center justify-center gap-1 rounded-full text-center",
|
|
610
|
+
className
|
|
611
|
+
),
|
|
612
|
+
style,
|
|
613
|
+
children
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
};
|
|
617
|
+
var Calendar = ({
|
|
618
|
+
registration,
|
|
619
|
+
error,
|
|
620
|
+
control,
|
|
621
|
+
name,
|
|
622
|
+
rangeCalendar = false,
|
|
623
|
+
shortcutsChange,
|
|
624
|
+
selectedShortcut,
|
|
625
|
+
setSelectedShortcut,
|
|
626
|
+
maxDate = /* @__PURE__ */ new Date(),
|
|
627
|
+
singleMonth = false
|
|
628
|
+
}) => {
|
|
629
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
630
|
+
const shorcuts = [
|
|
631
|
+
{
|
|
632
|
+
label: "Todo o per\xEDodo",
|
|
633
|
+
dateRange: []
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
label: "Hoje",
|
|
637
|
+
dateRange: [
|
|
638
|
+
set(/* @__PURE__ */ new Date(), {
|
|
639
|
+
hours: 0,
|
|
640
|
+
minutes: 0,
|
|
641
|
+
seconds: 0
|
|
642
|
+
}),
|
|
643
|
+
set(/* @__PURE__ */ new Date(), {
|
|
644
|
+
hours: 23,
|
|
645
|
+
minutes: 59,
|
|
646
|
+
seconds: 59
|
|
647
|
+
})
|
|
648
|
+
]
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
label: "Ontem",
|
|
652
|
+
dateRange: [
|
|
653
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 1 }), {
|
|
654
|
+
hours: 0,
|
|
655
|
+
minutes: 0,
|
|
656
|
+
seconds: 0
|
|
657
|
+
}),
|
|
658
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 1 }), {
|
|
659
|
+
hours: 23,
|
|
660
|
+
minutes: 59,
|
|
661
|
+
seconds: 59
|
|
662
|
+
})
|
|
663
|
+
]
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
label: "\xDAltimos 7 dias",
|
|
667
|
+
dateRange: [
|
|
668
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 7 }), {
|
|
669
|
+
hours: 0,
|
|
670
|
+
minutes: 0,
|
|
671
|
+
seconds: 0
|
|
672
|
+
}),
|
|
673
|
+
set(/* @__PURE__ */ new Date(), {
|
|
674
|
+
hours: 23,
|
|
675
|
+
minutes: 59,
|
|
676
|
+
seconds: 59
|
|
677
|
+
})
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
label: "\xDAltimos 14 dias",
|
|
682
|
+
dateRange: [
|
|
683
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 14 }), {
|
|
684
|
+
hours: 0,
|
|
685
|
+
minutes: 0,
|
|
686
|
+
seconds: 0
|
|
687
|
+
}),
|
|
688
|
+
set(/* @__PURE__ */ new Date(), {
|
|
689
|
+
hours: 23,
|
|
690
|
+
minutes: 59,
|
|
691
|
+
seconds: 59
|
|
692
|
+
})
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
label: "\xDAltimos 30 dias",
|
|
697
|
+
dateRange: [
|
|
698
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 30 }), {
|
|
699
|
+
hours: 0,
|
|
700
|
+
minutes: 0,
|
|
701
|
+
seconds: 0
|
|
702
|
+
}),
|
|
703
|
+
set(/* @__PURE__ */ new Date(), {
|
|
704
|
+
hours: 23,
|
|
705
|
+
minutes: 59,
|
|
706
|
+
seconds: 59
|
|
707
|
+
})
|
|
708
|
+
]
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
label: "\xDAltimos 60 dias",
|
|
712
|
+
dateRange: [
|
|
713
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 60 }), {
|
|
714
|
+
hours: 0,
|
|
715
|
+
minutes: 0,
|
|
716
|
+
seconds: 0
|
|
717
|
+
}),
|
|
718
|
+
set(/* @__PURE__ */ new Date(), {
|
|
719
|
+
hours: 23,
|
|
720
|
+
minutes: 59,
|
|
721
|
+
seconds: 59
|
|
722
|
+
})
|
|
723
|
+
]
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
label: "\xDAltimos 90 dias",
|
|
727
|
+
dateRange: [
|
|
728
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 90 }), {
|
|
729
|
+
hours: 0,
|
|
730
|
+
minutes: 0,
|
|
731
|
+
seconds: 0
|
|
732
|
+
}),
|
|
733
|
+
set(/* @__PURE__ */ new Date(), {
|
|
734
|
+
hours: 23,
|
|
735
|
+
minutes: 59,
|
|
736
|
+
seconds: 59
|
|
737
|
+
})
|
|
738
|
+
]
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
label: "Esta semana",
|
|
742
|
+
dateRange: [
|
|
743
|
+
startOfWeek(/* @__PURE__ */ new Date()),
|
|
744
|
+
set(/* @__PURE__ */ new Date(), {
|
|
745
|
+
hours: 23,
|
|
746
|
+
minutes: 59,
|
|
747
|
+
seconds: 59
|
|
748
|
+
})
|
|
749
|
+
]
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
label: "Semana passada",
|
|
753
|
+
dateRange: [
|
|
754
|
+
startOfWeek(sub(/* @__PURE__ */ new Date(), { days: 7 })),
|
|
755
|
+
endOfWeek(sub(/* @__PURE__ */ new Date(), { days: 7 }))
|
|
756
|
+
]
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
label: "Este M\xEAs",
|
|
760
|
+
dateRange: [
|
|
761
|
+
startOfMonth(/* @__PURE__ */ new Date()),
|
|
762
|
+
set(/* @__PURE__ */ new Date(), {
|
|
763
|
+
hours: 23,
|
|
764
|
+
minutes: 59,
|
|
765
|
+
seconds: 59
|
|
766
|
+
})
|
|
767
|
+
]
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
label: "M\xEAs passado",
|
|
771
|
+
dateRange: [
|
|
772
|
+
startOfMonth(sub(/* @__PURE__ */ new Date(), { months: 1 })),
|
|
773
|
+
endOfMonth(sub(/* @__PURE__ */ new Date(), { months: 1 }))
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
label: "\xDAltimos 6 meses",
|
|
778
|
+
dateRange: [
|
|
779
|
+
startOfMonth(sub(/* @__PURE__ */ new Date(), { months: 6 })),
|
|
780
|
+
set(/* @__PURE__ */ new Date(), {
|
|
781
|
+
hours: 23,
|
|
782
|
+
minutes: 59,
|
|
783
|
+
seconds: 59
|
|
784
|
+
}),
|
|
785
|
+
,
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
];
|
|
789
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
790
|
+
/* @__PURE__ */ jsx(
|
|
791
|
+
Controller,
|
|
792
|
+
{
|
|
793
|
+
control,
|
|
794
|
+
name,
|
|
795
|
+
render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx("div", { id: "group-input-calendar", className: "relative", children: rangeCalendar ? /* @__PURE__ */ jsx(
|
|
796
|
+
DateRangePicker3,
|
|
797
|
+
{
|
|
798
|
+
allowSingleDayRange: true,
|
|
799
|
+
shortcuts: shorcuts,
|
|
800
|
+
selectedShortcutIndex: selectedShortcut || shorcuts[0],
|
|
801
|
+
onChange: (e) => {
|
|
802
|
+
let date = [];
|
|
803
|
+
if (e[0] && e[0] !== null) {
|
|
804
|
+
date.push(
|
|
805
|
+
set(e[0], {
|
|
806
|
+
hours: 0,
|
|
807
|
+
minutes: 0,
|
|
808
|
+
seconds: 0
|
|
809
|
+
})
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
if (e[1] && e[1] !== null) {
|
|
813
|
+
date.push(
|
|
814
|
+
set(e[1], {
|
|
815
|
+
hours: 23,
|
|
816
|
+
minutes: 59,
|
|
817
|
+
seconds: 59
|
|
818
|
+
})
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
if (e[0] !== null && e[1] == null) {
|
|
822
|
+
if (shortcutsChange) shortcutsChange(null);
|
|
823
|
+
if (setSelectedShortcut) setSelectedShortcut(null);
|
|
824
|
+
}
|
|
825
|
+
if (shortcutsChange) shortcutsChange("");
|
|
826
|
+
onChange(date);
|
|
827
|
+
},
|
|
828
|
+
singleMonthOnly: singleMonth,
|
|
829
|
+
value,
|
|
830
|
+
highlightCurrentDay: true,
|
|
831
|
+
minDate: subYears(/* @__PURE__ */ new Date(), 50),
|
|
832
|
+
maxDate,
|
|
833
|
+
locale: "pt",
|
|
834
|
+
onShortcutChange: (e) => {
|
|
835
|
+
const index = shorcuts.findIndex(
|
|
836
|
+
(item) => item.label === e.label
|
|
837
|
+
);
|
|
838
|
+
if (index !== -1 && setSelectedShortcut) {
|
|
839
|
+
setSelectedShortcut(index);
|
|
840
|
+
}
|
|
841
|
+
if (shortcutsChange) shortcutsChange(e);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
) : /* @__PURE__ */ jsx(
|
|
845
|
+
DatePicker3,
|
|
846
|
+
{
|
|
847
|
+
onChange: (e) => {
|
|
848
|
+
onChange(e);
|
|
849
|
+
},
|
|
850
|
+
value,
|
|
851
|
+
highlightCurrentDay: true,
|
|
852
|
+
locale: "pt"
|
|
853
|
+
}
|
|
854
|
+
) })
|
|
855
|
+
}
|
|
856
|
+
),
|
|
857
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
858
|
+
"div",
|
|
859
|
+
{
|
|
860
|
+
className: "text-dangerous-500 text-xs mt-[2px]",
|
|
861
|
+
role: "alert",
|
|
862
|
+
"aria-label": message,
|
|
863
|
+
children: message
|
|
864
|
+
},
|
|
865
|
+
index
|
|
866
|
+
))
|
|
867
|
+
] });
|
|
868
|
+
};
|
|
869
|
+
var Checkbox = ({
|
|
870
|
+
key = "",
|
|
871
|
+
label,
|
|
872
|
+
registration,
|
|
873
|
+
disabled
|
|
874
|
+
}) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-start", children: [
|
|
875
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-5 items-center", children: /* @__PURE__ */ jsx(
|
|
876
|
+
"input",
|
|
877
|
+
{
|
|
878
|
+
...registration,
|
|
879
|
+
id: registration ? registration.name : key,
|
|
880
|
+
disabled,
|
|
881
|
+
type: "checkbox",
|
|
882
|
+
className: clsx7(
|
|
883
|
+
"disabled:hover:bg-neutral-100 disabled:cursor-default cursor-pointer h-[16px] w-[16px] rounded-[2.5px] border border-neutral-200 text-blue-500 focus:rounded-[4px] focus:border-[1.5px] focus:ring-blue-500 focus-visible:ring-blue-500 checked:after:text-blue-500 disabled:bg-neutral-100"
|
|
884
|
+
)
|
|
885
|
+
}
|
|
886
|
+
) }),
|
|
887
|
+
/* @__PURE__ */ jsx("div", { className: "ml-3 text-sm", children: /* @__PURE__ */ jsx(
|
|
888
|
+
"label",
|
|
889
|
+
{
|
|
890
|
+
htmlFor: registration == null ? void 0 : registration.name,
|
|
891
|
+
className: "cursor-pointer font-medium text-gray-700",
|
|
892
|
+
children: label
|
|
893
|
+
}
|
|
894
|
+
) })
|
|
895
|
+
] }) });
|
|
896
|
+
var FilterCalendar = ({
|
|
897
|
+
icon,
|
|
898
|
+
label,
|
|
899
|
+
onApply,
|
|
900
|
+
onClear,
|
|
901
|
+
control,
|
|
902
|
+
name,
|
|
903
|
+
rangeCalendar = true,
|
|
904
|
+
defaultShortcut,
|
|
905
|
+
shortcutsChange,
|
|
906
|
+
singleMonth = false,
|
|
907
|
+
maxDate = void 0
|
|
908
|
+
}) => {
|
|
909
|
+
const style = {
|
|
910
|
+
filter: "rounded-3xl shadow-input bg-white hover:bg-neutral-100 border border-neutral-300 active:text-blue-500 active:bg-blue-100 active:border-blue-500",
|
|
911
|
+
filterOpen: "rounded-3xl shadow-input border border-blue-500 bg-blue-100 text-blue-500",
|
|
912
|
+
filterActive: "rounded-3xl border border-blue-500 text-blue-500 bg-blue-100 shadow-input hover:bg-blue-500 hover:text-white active:text-white active:bg-blue-600 active:border-blue-600"
|
|
913
|
+
};
|
|
914
|
+
const [currentValue, setCurrentValue] = useState([]);
|
|
915
|
+
const [calendarLabel, setCalendarLabel] = useState("");
|
|
916
|
+
const isMobileSize = (window == null ? void 0 : window.innerWidth) < 768;
|
|
917
|
+
const shorcuts = [
|
|
918
|
+
{
|
|
919
|
+
label: "Todo o per\xEDodo",
|
|
920
|
+
dateRange: []
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
label: "Hoje",
|
|
924
|
+
dateRange: [
|
|
925
|
+
set(/* @__PURE__ */ new Date(), {
|
|
926
|
+
hours: 0,
|
|
927
|
+
minutes: 0,
|
|
928
|
+
seconds: 0
|
|
929
|
+
}),
|
|
930
|
+
set(/* @__PURE__ */ new Date(), {
|
|
931
|
+
hours: 23,
|
|
932
|
+
minutes: 59,
|
|
933
|
+
seconds: 59
|
|
934
|
+
})
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
label: "Ontem",
|
|
939
|
+
dateRange: [
|
|
940
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 1 }), {
|
|
941
|
+
hours: 0,
|
|
942
|
+
minutes: 0,
|
|
943
|
+
seconds: 0
|
|
944
|
+
}),
|
|
945
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 1 }), {
|
|
946
|
+
hours: 23,
|
|
947
|
+
minutes: 59,
|
|
948
|
+
seconds: 59
|
|
949
|
+
})
|
|
950
|
+
]
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
label: "\xDAltimos 7 dias",
|
|
954
|
+
dateRange: [
|
|
955
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 7 }), {
|
|
956
|
+
hours: 0,
|
|
957
|
+
minutes: 0,
|
|
958
|
+
seconds: 0
|
|
959
|
+
}),
|
|
960
|
+
set(/* @__PURE__ */ new Date(), {
|
|
961
|
+
hours: 23,
|
|
962
|
+
minutes: 59,
|
|
963
|
+
seconds: 59
|
|
964
|
+
})
|
|
965
|
+
]
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
label: "\xDAltimos 14 dias",
|
|
969
|
+
dateRange: [
|
|
970
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 14 }), {
|
|
971
|
+
hours: 0,
|
|
972
|
+
minutes: 0,
|
|
973
|
+
seconds: 0
|
|
974
|
+
}),
|
|
975
|
+
set(/* @__PURE__ */ new Date(), {
|
|
976
|
+
hours: 23,
|
|
977
|
+
minutes: 59,
|
|
978
|
+
seconds: 59
|
|
979
|
+
})
|
|
980
|
+
]
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
label: "\xDAltimos 30 dias",
|
|
984
|
+
dateRange: [
|
|
985
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 30 }), {
|
|
986
|
+
hours: 0,
|
|
987
|
+
minutes: 0,
|
|
988
|
+
seconds: 0
|
|
989
|
+
}),
|
|
990
|
+
set(/* @__PURE__ */ new Date(), {
|
|
991
|
+
hours: 23,
|
|
992
|
+
minutes: 59,
|
|
993
|
+
seconds: 59
|
|
994
|
+
})
|
|
995
|
+
]
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
label: "\xDAltimos 60 dias",
|
|
999
|
+
dateRange: [
|
|
1000
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 60 }), {
|
|
1001
|
+
hours: 0,
|
|
1002
|
+
minutes: 0,
|
|
1003
|
+
seconds: 0
|
|
1004
|
+
}),
|
|
1005
|
+
set(/* @__PURE__ */ new Date(), {
|
|
1006
|
+
hours: 23,
|
|
1007
|
+
minutes: 59,
|
|
1008
|
+
seconds: 59
|
|
1009
|
+
})
|
|
1010
|
+
]
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
label: "\xDAltimos 90 dias",
|
|
1014
|
+
dateRange: [
|
|
1015
|
+
set(sub(/* @__PURE__ */ new Date(), { days: 90 }), {
|
|
1016
|
+
hours: 0,
|
|
1017
|
+
minutes: 0,
|
|
1018
|
+
seconds: 0
|
|
1019
|
+
}),
|
|
1020
|
+
set(/* @__PURE__ */ new Date(), {
|
|
1021
|
+
hours: 23,
|
|
1022
|
+
minutes: 59,
|
|
1023
|
+
seconds: 59
|
|
1024
|
+
})
|
|
1025
|
+
]
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
label: "Esta semana",
|
|
1029
|
+
dateRange: [
|
|
1030
|
+
startOfWeek(/* @__PURE__ */ new Date()),
|
|
1031
|
+
set(/* @__PURE__ */ new Date(), {
|
|
1032
|
+
hours: 23,
|
|
1033
|
+
minutes: 59,
|
|
1034
|
+
seconds: 59
|
|
1035
|
+
})
|
|
1036
|
+
]
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
label: "Semana passada",
|
|
1040
|
+
dateRange: [
|
|
1041
|
+
startOfWeek(sub(/* @__PURE__ */ new Date(), { days: 7 })),
|
|
1042
|
+
endOfWeek(sub(/* @__PURE__ */ new Date(), { days: 7 }))
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
label: "Este M\xEAs",
|
|
1047
|
+
dateRange: [
|
|
1048
|
+
startOfMonth(/* @__PURE__ */ new Date()),
|
|
1049
|
+
set(/* @__PURE__ */ new Date(), {
|
|
1050
|
+
hours: 23,
|
|
1051
|
+
minutes: 59,
|
|
1052
|
+
seconds: 59
|
|
1053
|
+
})
|
|
1054
|
+
]
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
label: "M\xEAs passado",
|
|
1058
|
+
dateRange: [
|
|
1059
|
+
startOfMonth(sub(/* @__PURE__ */ new Date(), { months: 1 })),
|
|
1060
|
+
endOfMonth(sub(/* @__PURE__ */ new Date(), { months: 1 }))
|
|
1061
|
+
]
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
label: "\xDAltimos 6 meses",
|
|
1065
|
+
dateRange: [
|
|
1066
|
+
startOfMonth(sub(/* @__PURE__ */ new Date(), { months: 6 })),
|
|
1067
|
+
set(/* @__PURE__ */ new Date(), {
|
|
1068
|
+
hours: 23,
|
|
1069
|
+
minutes: 59,
|
|
1070
|
+
seconds: 59
|
|
1071
|
+
}),
|
|
1072
|
+
,
|
|
1073
|
+
]
|
|
1074
|
+
}
|
|
1075
|
+
];
|
|
1076
|
+
const [selectedShortcut, setSelectedShortcut] = useState(
|
|
1077
|
+
defaultShortcut || shorcuts[0]
|
|
1078
|
+
);
|
|
1079
|
+
const calendar = /* @__PURE__ */ jsx("div", { id: "group-input-calendar", className: "relative", children: rangeCalendar ? /* @__PURE__ */ jsx(
|
|
1080
|
+
DateRangePicker3,
|
|
1081
|
+
{
|
|
1082
|
+
allowSingleDayRange: true,
|
|
1083
|
+
shortcuts: shorcuts,
|
|
1084
|
+
selectedShortcutIndex: selectedShortcut,
|
|
1085
|
+
onChange: (e) => {
|
|
1086
|
+
let date = [];
|
|
1087
|
+
if (e[0] && e[0] !== null) {
|
|
1088
|
+
date.push(
|
|
1089
|
+
set(e[0], {
|
|
1090
|
+
hours: 0,
|
|
1091
|
+
minutes: 0,
|
|
1092
|
+
seconds: 0
|
|
1093
|
+
})
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
if (e[1] && e[1] !== null) {
|
|
1097
|
+
date.push(
|
|
1098
|
+
set(e[1], {
|
|
1099
|
+
hours: 23,
|
|
1100
|
+
minutes: 59,
|
|
1101
|
+
seconds: 59
|
|
1102
|
+
})
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
if (e[0] !== null && e[1] == null) {
|
|
1106
|
+
setCalendarLabel("");
|
|
1107
|
+
if (setSelectedShortcut) setSelectedShortcut(null);
|
|
1108
|
+
}
|
|
1109
|
+
setCalendarLabel("");
|
|
1110
|
+
setCurrentValue(date);
|
|
1111
|
+
},
|
|
1112
|
+
singleMonthOnly: singleMonth,
|
|
1113
|
+
value: currentValue,
|
|
1114
|
+
highlightCurrentDay: true,
|
|
1115
|
+
minDate: subYears(/* @__PURE__ */ new Date(), 50),
|
|
1116
|
+
maxDate,
|
|
1117
|
+
locale: "pt",
|
|
1118
|
+
onShortcutChange: (e) => {
|
|
1119
|
+
const index = shorcuts.findIndex((item) => item.label === e.label);
|
|
1120
|
+
if (index !== -1 && setSelectedShortcut) {
|
|
1121
|
+
setSelectedShortcut(index);
|
|
1122
|
+
}
|
|
1123
|
+
setCalendarLabel(e == null ? void 0 : e.label);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
) : /* @__PURE__ */ jsx(
|
|
1127
|
+
DatePicker3,
|
|
1128
|
+
{
|
|
1129
|
+
onChange: (e) => {
|
|
1130
|
+
setCurrentValue(e);
|
|
1131
|
+
},
|
|
1132
|
+
value: currentValue,
|
|
1133
|
+
highlightCurrentDay: true,
|
|
1134
|
+
locale: "pt"
|
|
1135
|
+
}
|
|
1136
|
+
) });
|
|
1137
|
+
return /* @__PURE__ */ jsx(
|
|
1138
|
+
Controller,
|
|
1139
|
+
{
|
|
1140
|
+
name,
|
|
1141
|
+
control,
|
|
1142
|
+
render: ({ field }) => {
|
|
1143
|
+
var _a;
|
|
1144
|
+
let hasValue = ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) > 0;
|
|
1145
|
+
return /* @__PURE__ */ jsx(
|
|
1146
|
+
Popover,
|
|
1147
|
+
{
|
|
1148
|
+
className: clsx7(
|
|
1149
|
+
{ ["w-full"]: isMobileSize },
|
|
1150
|
+
"relative text-paragraph"
|
|
1151
|
+
),
|
|
1152
|
+
children: ({ open }) => {
|
|
1153
|
+
var _a2, _b;
|
|
1154
|
+
return /* @__PURE__ */ jsxs(Float, { composable: true, shift: 8, zIndex: 99, offset: 2, children: [
|
|
1155
|
+
/* @__PURE__ */ jsx(Float.Reference, { children: /* @__PURE__ */ jsx(PopoverButton, { as: "button", children: /* @__PURE__ */ jsxs(
|
|
1156
|
+
"div",
|
|
1157
|
+
{
|
|
1158
|
+
className: clsx7(
|
|
1159
|
+
{
|
|
1160
|
+
[style.filter]: !hasValue && !open,
|
|
1161
|
+
[style.filterOpen]: open && !hasValue,
|
|
1162
|
+
[style.filterActive]: open && hasValue || !open && hasValue
|
|
1163
|
+
},
|
|
1164
|
+
`group px-3 h-[36px] text-p-ls font-bold disabled:shadow-none active:shadow-none flex items-center justify-between outline-none gap-2`
|
|
1165
|
+
),
|
|
1166
|
+
children: [
|
|
1167
|
+
icon && /* @__PURE__ */ jsx(
|
|
1168
|
+
"div",
|
|
1169
|
+
{
|
|
1170
|
+
className: clsx7({
|
|
1171
|
+
["text-label group-active:text-blue-500"]: !field.value && !open,
|
|
1172
|
+
["text-blue-500"]: open && !field.value,
|
|
1173
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1174
|
+
}),
|
|
1175
|
+
children: icon
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
/* @__PURE__ */ jsx(
|
|
1179
|
+
"label",
|
|
1180
|
+
{
|
|
1181
|
+
className: clsx7(
|
|
1182
|
+
{
|
|
1183
|
+
["text-paragraph group-active:text-blue-500"]: !field.value && !open,
|
|
1184
|
+
["text-blue-500"]: open && !field.value,
|
|
1185
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1186
|
+
},
|
|
1187
|
+
"truncate cursor-pointer"
|
|
1188
|
+
),
|
|
1189
|
+
children: calendarLabel ? calendarLabel : ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.length) > 0 ? (_b = field == null ? void 0 : field.value) == null ? void 0 : _b.map(
|
|
1190
|
+
(item) => item !== null ? format(item, "dd/MM/yyyy") : ""
|
|
1191
|
+
).join(" - ") : label
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ jsx(
|
|
1195
|
+
"i",
|
|
1196
|
+
{
|
|
1197
|
+
className: clsx7(
|
|
1198
|
+
{
|
|
1199
|
+
["text-label group-active:text-blue-500"]: !field.value && !open,
|
|
1200
|
+
["text-blue-500"]: open && !field.value,
|
|
1201
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1202
|
+
},
|
|
1203
|
+
"uil uil-angle-down text-[18px]"
|
|
1204
|
+
)
|
|
1205
|
+
}
|
|
1206
|
+
)
|
|
1207
|
+
]
|
|
1208
|
+
}
|
|
1209
|
+
) }) }),
|
|
1210
|
+
open && /* @__PURE__ */ jsx(Float.Content, { children: /* @__PURE__ */ jsx(PopoverPanel, { className: "p-3 whitespace-nowrap bg-white rounded-lg shadow-dropdown border-[0.5px] border-neutral-300", children: ({ close }) => {
|
|
1211
|
+
const onClose = () => {
|
|
1212
|
+
setCurrentValue(field.value);
|
|
1213
|
+
close();
|
|
1214
|
+
};
|
|
1215
|
+
useEffect(() => {
|
|
1216
|
+
setCurrentValue(field.value);
|
|
1217
|
+
}, [open]);
|
|
1218
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1219
|
+
calendar,
|
|
1220
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center justify-end border-t border-t-neutral-200 pt-3", children: [
|
|
1221
|
+
onClear && /* @__PURE__ */ jsx("div", { className: "mr-1", children: /* @__PURE__ */ jsx(
|
|
1222
|
+
Button,
|
|
1223
|
+
{
|
|
1224
|
+
variant: "link",
|
|
1225
|
+
size: "xxs",
|
|
1226
|
+
onClick: () => {
|
|
1227
|
+
if (onClear) {
|
|
1228
|
+
onClear();
|
|
1229
|
+
setCurrentValue([]);
|
|
1230
|
+
field.onChange([]);
|
|
1231
|
+
}
|
|
1232
|
+
close();
|
|
1233
|
+
},
|
|
1234
|
+
children: "Limpar"
|
|
1235
|
+
}
|
|
1236
|
+
) }),
|
|
1237
|
+
/* @__PURE__ */ jsx(
|
|
1238
|
+
Button,
|
|
1239
|
+
{
|
|
1240
|
+
size: "xs",
|
|
1241
|
+
variant: "secondary",
|
|
1242
|
+
onClick: () => {
|
|
1243
|
+
onClose();
|
|
1244
|
+
},
|
|
1245
|
+
children: "Cancelar"
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ jsx(
|
|
1249
|
+
Button,
|
|
1250
|
+
{
|
|
1251
|
+
size: "xs",
|
|
1252
|
+
variant: "primary",
|
|
1253
|
+
disabled: JSON.stringify(currentValue) === JSON.stringify(field == null ? void 0 : field.value),
|
|
1254
|
+
onClick: () => {
|
|
1255
|
+
field.onChange(currentValue);
|
|
1256
|
+
if (onApply) onApply();
|
|
1257
|
+
close();
|
|
1258
|
+
},
|
|
1259
|
+
children: "Aplicar"
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
] })
|
|
1263
|
+
] });
|
|
1264
|
+
} }) })
|
|
1265
|
+
] });
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
);
|
|
1272
|
+
};
|
|
1273
|
+
function InputSmall({
|
|
1274
|
+
type,
|
|
1275
|
+
registration,
|
|
1276
|
+
onClick,
|
|
1277
|
+
onBlur,
|
|
1278
|
+
onChange,
|
|
1279
|
+
inputProps,
|
|
1280
|
+
icon,
|
|
1281
|
+
clearField,
|
|
1282
|
+
disabled,
|
|
1283
|
+
placeholder,
|
|
1284
|
+
className,
|
|
1285
|
+
onKeyDown,
|
|
1286
|
+
value,
|
|
1287
|
+
searchOnClick,
|
|
1288
|
+
onClear,
|
|
1289
|
+
collapsed
|
|
1290
|
+
}) {
|
|
1291
|
+
const inputRef = useRef(null);
|
|
1292
|
+
const styles = {
|
|
1293
|
+
input: `text-p-md text-paragraph w-full outline-none placeholder:text-label`,
|
|
1294
|
+
icon: "text-label group-focus-within:text-neutral-600 m-[10px]",
|
|
1295
|
+
wrapper: `shadow-input border border-neutral-300 focus-within:border-blue-500 group rounded-lg h-9 w-full text-paragraph flex items-center justify-between disabled:bg-neutral-100 ${disabled ? "bg-neutral-100" : "bg-white"} ${className}`,
|
|
1296
|
+
clear: "pr-[5px] cursor-pointer text-label text-[16px]"
|
|
1297
|
+
};
|
|
1298
|
+
const elem = inputRef == null ? void 0 : inputRef.current;
|
|
1299
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx7(styles.wrapper), children: [
|
|
1300
|
+
icon && !searchOnClick && /* @__PURE__ */ jsx("div", { className: clsx7(styles.icon), children: icon }),
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
"input",
|
|
1303
|
+
{
|
|
1304
|
+
...registration,
|
|
1305
|
+
...inputProps,
|
|
1306
|
+
type: "search-text",
|
|
1307
|
+
ref: inputRef,
|
|
1308
|
+
className: clsx7(
|
|
1309
|
+
{
|
|
1310
|
+
["pl-1"]: collapsed
|
|
1311
|
+
},
|
|
1312
|
+
styles.input
|
|
1313
|
+
),
|
|
1314
|
+
placeholder,
|
|
1315
|
+
onBlur,
|
|
1316
|
+
onChange: (e) => onChange(e.target.value),
|
|
1317
|
+
onClick,
|
|
1318
|
+
disabled,
|
|
1319
|
+
onKeyDown
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
clearField && value && !disabled && /* @__PURE__ */ jsx(
|
|
1323
|
+
"i",
|
|
1324
|
+
{
|
|
1325
|
+
className: clsx7(styles.clear, "uil uil-times"),
|
|
1326
|
+
onClick: () => {
|
|
1327
|
+
elem.value = "";
|
|
1328
|
+
elem == null ? void 0 : elem.focus();
|
|
1329
|
+
onChange("");
|
|
1330
|
+
if (onClear) {
|
|
1331
|
+
onClear();
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
),
|
|
1336
|
+
searchOnClick && /* @__PURE__ */ jsx("div", { className: "py-1", children: /* @__PURE__ */ jsx(
|
|
1337
|
+
"button",
|
|
1338
|
+
{
|
|
1339
|
+
type: "button",
|
|
1340
|
+
className: clsx7({
|
|
1341
|
+
["border-l border-input pl-1"]: clearField && value && !disabled,
|
|
1342
|
+
["text-blue-500"]: !disabled,
|
|
1343
|
+
["text-neutral-300"]: disabled,
|
|
1344
|
+
["pl-[2px]"]: collapsed
|
|
1345
|
+
}),
|
|
1346
|
+
onClick: searchOnClick,
|
|
1347
|
+
children: /* @__PURE__ */ jsx("i", { className: "uil uil-search text-[16px] mr-2 pl-1" })
|
|
1348
|
+
}
|
|
1349
|
+
) })
|
|
1350
|
+
] });
|
|
1351
|
+
}
|
|
1352
|
+
var FilterOptions = ({
|
|
1353
|
+
icon,
|
|
1354
|
+
label,
|
|
1355
|
+
isMulti,
|
|
1356
|
+
options = [],
|
|
1357
|
+
onApply,
|
|
1358
|
+
onClear,
|
|
1359
|
+
onSelectAll,
|
|
1360
|
+
control,
|
|
1361
|
+
name,
|
|
1362
|
+
fetch,
|
|
1363
|
+
subFilters = [],
|
|
1364
|
+
emptyMessage,
|
|
1365
|
+
initialMessage,
|
|
1366
|
+
applyOnClick = false,
|
|
1367
|
+
showFilter = false
|
|
1368
|
+
}) => {
|
|
1369
|
+
const style = {
|
|
1370
|
+
filter: "rounded-3xl shadow-input bg-white hover:bg-neutral-100 border border-neutral-300 active:text-blue-500 active:bg-blue-100 active:border-blue-500",
|
|
1371
|
+
filterOpen: "rounded-3xl shadow-input border border-blue-500 bg-blue-100 text-blue-500",
|
|
1372
|
+
filterActive: "rounded-3xl border border-blue-500 text-blue-500 bg-blue-100 shadow-input hover:bg-blue-500 hover:text-white active:text-white active:bg-blue-600 active:border-blue-600"
|
|
1373
|
+
};
|
|
1374
|
+
const [currentValue, setCurrentValue] = useState(isMulti ? [] : {});
|
|
1375
|
+
const [data, setData] = useState(() => options);
|
|
1376
|
+
const [filter, setFilter] = useState("");
|
|
1377
|
+
const [subFilter, setSubFilter] = useState(
|
|
1378
|
+
(subFilters == null ? void 0 : subFilters.length) > 0 ? subFilters[0].id : null
|
|
1379
|
+
);
|
|
1380
|
+
const [loading, setLoading] = useState(false);
|
|
1381
|
+
const search = async () => {
|
|
1382
|
+
if ((filter == null ? void 0 : filter.length) > 0 || (options == null ? void 0 : options.length) > 0) {
|
|
1383
|
+
if (fetch) {
|
|
1384
|
+
setData(await fetch(filter, subFilter));
|
|
1385
|
+
} else {
|
|
1386
|
+
const result = options.filter(
|
|
1387
|
+
(opt) => {
|
|
1388
|
+
var _a;
|
|
1389
|
+
return (_a = opt == null ? void 0 : opt.label) == null ? void 0 : _a.toLowerCase().includes(filter.toLowerCase());
|
|
1390
|
+
}
|
|
1391
|
+
);
|
|
1392
|
+
const order = result.sort((a, b) => {
|
|
1393
|
+
var _a;
|
|
1394
|
+
return (_a = a == null ? void 0 : a.label) == null ? void 0 : _a.toLowerCase();
|
|
1395
|
+
});
|
|
1396
|
+
setData(order);
|
|
1397
|
+
}
|
|
1398
|
+
} else {
|
|
1399
|
+
setData([]);
|
|
1400
|
+
}
|
|
1401
|
+
setLoading(false);
|
|
1402
|
+
};
|
|
1403
|
+
useEffect(() => {
|
|
1404
|
+
setLoading(true);
|
|
1405
|
+
const timeout = setTimeout(() => {
|
|
1406
|
+
search();
|
|
1407
|
+
}, 400);
|
|
1408
|
+
return () => clearTimeout(timeout);
|
|
1409
|
+
}, [filter]);
|
|
1410
|
+
const optionStyle = (option, isSelected) => {
|
|
1411
|
+
return /* @__PURE__ */ jsx(
|
|
1412
|
+
ListboxOption,
|
|
1413
|
+
{
|
|
1414
|
+
disabled: option.disabled,
|
|
1415
|
+
value: option,
|
|
1416
|
+
as: Fragment$1,
|
|
1417
|
+
children: /* @__PURE__ */ jsxs(
|
|
1418
|
+
"div",
|
|
1419
|
+
{
|
|
1420
|
+
className: clsx7(
|
|
1421
|
+
"relative cursor-pointer outline-none select-none p-3 rounded-lg pr-9 text-paragraph mt-1 first:mt-0 overflow-hidden w-full",
|
|
1422
|
+
{
|
|
1423
|
+
["hover:bg-neutral-200"]: !option.disabled && !isSelected,
|
|
1424
|
+
["text-gray-200"]: option.disabled,
|
|
1425
|
+
["bg-blue-500 hover:bg-blue-500"]: isSelected
|
|
1426
|
+
}
|
|
1427
|
+
),
|
|
1428
|
+
children: [
|
|
1429
|
+
/* @__PURE__ */ jsx(
|
|
1430
|
+
"span",
|
|
1431
|
+
{
|
|
1432
|
+
className: clsx7(
|
|
1433
|
+
{
|
|
1434
|
+
["font-semibold text-white"]: isSelected
|
|
1435
|
+
},
|
|
1436
|
+
"text-wrap break-words font-normal block"
|
|
1437
|
+
),
|
|
1438
|
+
children: option == null ? void 0 : option.label
|
|
1439
|
+
}
|
|
1440
|
+
),
|
|
1441
|
+
/* @__PURE__ */ jsx(
|
|
1442
|
+
"span",
|
|
1443
|
+
{
|
|
1444
|
+
className: clsx7(
|
|
1445
|
+
{
|
|
1446
|
+
["font-semibold text-white"]: isSelected
|
|
1447
|
+
},
|
|
1448
|
+
"w-[200px] whitespace-nowrap text-ellipsis overflow-hidden text-label text-p-sm block"
|
|
1449
|
+
),
|
|
1450
|
+
children: option == null ? void 0 : option.description
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
isSelected ? /* @__PURE__ */ jsx(
|
|
1454
|
+
"span",
|
|
1455
|
+
{
|
|
1456
|
+
className: clsx7(
|
|
1457
|
+
"absolute inset-y-0 text-white right-0 flex items-center pr-4"
|
|
1458
|
+
),
|
|
1459
|
+
children: /* @__PURE__ */ jsx("i", { className: "uil uil-check text-lg" })
|
|
1460
|
+
}
|
|
1461
|
+
) : null
|
|
1462
|
+
]
|
|
1463
|
+
}
|
|
1464
|
+
)
|
|
1465
|
+
},
|
|
1466
|
+
option.id
|
|
1467
|
+
);
|
|
1468
|
+
};
|
|
1469
|
+
const isMobileSize = (window == null ? void 0 : window.innerWidth) < 768;
|
|
1470
|
+
return /* @__PURE__ */ jsx(
|
|
1471
|
+
Controller,
|
|
1472
|
+
{
|
|
1473
|
+
name,
|
|
1474
|
+
control,
|
|
1475
|
+
render: ({ field }) => {
|
|
1476
|
+
var _a, _b;
|
|
1477
|
+
let hasValue = isMulti ? ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) > 0 : !!((_b = field == null ? void 0 : field.value) == null ? void 0 : _b.id);
|
|
1478
|
+
return /* @__PURE__ */ jsx(
|
|
1479
|
+
Popover,
|
|
1480
|
+
{
|
|
1481
|
+
className: clsx7(
|
|
1482
|
+
{ ["w-full"]: isMobileSize },
|
|
1483
|
+
"relative text-paragraph"
|
|
1484
|
+
),
|
|
1485
|
+
children: ({ open }) => {
|
|
1486
|
+
var _a2, _b2;
|
|
1487
|
+
return /* @__PURE__ */ jsxs(Float, { composable: true, shift: 8, zIndex: 99, offset: 2, children: [
|
|
1488
|
+
/* @__PURE__ */ jsx(Float.Reference, { children: /* @__PURE__ */ jsx(PopoverButton, { as: "button", children: /* @__PURE__ */ jsxs(
|
|
1489
|
+
"div",
|
|
1490
|
+
{
|
|
1491
|
+
className: clsx7(
|
|
1492
|
+
{
|
|
1493
|
+
[style.filter]: !hasValue && !open,
|
|
1494
|
+
[style.filterOpen]: open && !hasValue,
|
|
1495
|
+
[style.filterActive]: open && hasValue || !open && hasValue
|
|
1496
|
+
},
|
|
1497
|
+
`group px-3 h-[36px] text-p-ls font-bold disabled:shadow-none active:shadow-none flex items-center justify-between outline-none gap-2`
|
|
1498
|
+
),
|
|
1499
|
+
children: [
|
|
1500
|
+
icon && /* @__PURE__ */ jsx(
|
|
1501
|
+
"div",
|
|
1502
|
+
{
|
|
1503
|
+
className: clsx7({
|
|
1504
|
+
["text-label group-active:text-blue-500"]: !field.value && !open,
|
|
1505
|
+
["text-blue-500"]: open && !field.value,
|
|
1506
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1507
|
+
}),
|
|
1508
|
+
children: icon
|
|
1509
|
+
}
|
|
1510
|
+
),
|
|
1511
|
+
/* @__PURE__ */ jsx(
|
|
1512
|
+
"label",
|
|
1513
|
+
{
|
|
1514
|
+
className: clsx7(
|
|
1515
|
+
{
|
|
1516
|
+
["text-paragraph group-active:text-blue-500"]: !field.value && !open,
|
|
1517
|
+
["text-blue-500"]: open && !field.value,
|
|
1518
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1519
|
+
},
|
|
1520
|
+
"truncate cursor-pointer"
|
|
1521
|
+
),
|
|
1522
|
+
children: isMulti ? label : ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.id) ? (_b2 = field == null ? void 0 : field.value) == null ? void 0 : _b2.label : label
|
|
1523
|
+
}
|
|
1524
|
+
),
|
|
1525
|
+
isMulti && field.value && field.value.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-blue-500 text-white text-p-xs px-1 py-[2px] rounded group-hover:bg-blue-500", children: field.value.length }),
|
|
1526
|
+
/* @__PURE__ */ jsx(
|
|
1527
|
+
"i",
|
|
1528
|
+
{
|
|
1529
|
+
className: clsx7(
|
|
1530
|
+
{
|
|
1531
|
+
["text-label group-active:text-blue-500"]: !field.value && !open,
|
|
1532
|
+
["text-blue-500"]: open && !field.value,
|
|
1533
|
+
["text-blue-500 group-hover:text-white group-active:text-white"]: open && field.value
|
|
1534
|
+
},
|
|
1535
|
+
"uil uil-angle-down text-[18px]"
|
|
1536
|
+
)
|
|
1537
|
+
}
|
|
1538
|
+
)
|
|
1539
|
+
]
|
|
1540
|
+
}
|
|
1541
|
+
) }) }),
|
|
1542
|
+
open && /* @__PURE__ */ jsx(Float.Content, { children: /* @__PURE__ */ jsx(PopoverPanel, { className: "p-3 whitespace-nowrap bg-white rounded-lg shadow-dropdown border-[0.5px] border-neutral-300", children: ({ close }) => {
|
|
1543
|
+
const onClose = () => {
|
|
1544
|
+
setCurrentValue(field.value);
|
|
1545
|
+
close();
|
|
1546
|
+
};
|
|
1547
|
+
useEffect(() => {
|
|
1548
|
+
setCurrentValue(field.value);
|
|
1549
|
+
}, [open]);
|
|
1550
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1551
|
+
/* @__PURE__ */ jsx(
|
|
1552
|
+
Listbox,
|
|
1553
|
+
{
|
|
1554
|
+
value: currentValue || [],
|
|
1555
|
+
onChange: setCurrentValue,
|
|
1556
|
+
multiple: isMulti,
|
|
1557
|
+
children: /* @__PURE__ */ jsxs(
|
|
1558
|
+
ListboxOptions,
|
|
1559
|
+
{
|
|
1560
|
+
static: true,
|
|
1561
|
+
className: "max-h-60 w-full overflow-x-hidden overflow-y-auto bg-white text-p-md focus:outline-none sm:text-sm relative",
|
|
1562
|
+
children: [
|
|
1563
|
+
/* @__PURE__ */ jsxs("div", { className: "mr-1 sticky top-0 z-30", children: [
|
|
1564
|
+
showFilter && /* @__PURE__ */ jsx(
|
|
1565
|
+
InputSmall,
|
|
1566
|
+
{
|
|
1567
|
+
icon: /* @__PURE__ */ jsx("i", { className: "uil uil-search" }),
|
|
1568
|
+
onChange: (e) => setFilter(e),
|
|
1569
|
+
value: filter,
|
|
1570
|
+
placeholder: "Pesquisar",
|
|
1571
|
+
clearField: true,
|
|
1572
|
+
onKeyDown: (e) => {
|
|
1573
|
+
if (e.key === " " || e.code === "Space") {
|
|
1574
|
+
e.stopPropagation();
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
),
|
|
1579
|
+
subFilters && fetch && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 pt-2 bg-white", children: subFilters.map((item, index) => {
|
|
1580
|
+
const active = (item == null ? void 0 : item.id) === subFilter;
|
|
1581
|
+
return /* @__PURE__ */ jsx(
|
|
1582
|
+
"button",
|
|
1583
|
+
{
|
|
1584
|
+
className: clsx7(
|
|
1585
|
+
{
|
|
1586
|
+
["bg-blue-500 text-white"]: active,
|
|
1587
|
+
["text-paragraph"]: !active
|
|
1588
|
+
},
|
|
1589
|
+
`rounded-[20px] border-[0.5px] border-neutral-200 px-4 py-[6px]`
|
|
1590
|
+
),
|
|
1591
|
+
onClick: () => {
|
|
1592
|
+
if (subFilter == item.id) {
|
|
1593
|
+
setSubFilter(null);
|
|
1594
|
+
} else {
|
|
1595
|
+
setSubFilter(item.id);
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
children: item.name
|
|
1599
|
+
},
|
|
1600
|
+
index
|
|
1601
|
+
);
|
|
1602
|
+
}) })
|
|
1603
|
+
] }),
|
|
1604
|
+
loading && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 w-full my-4", children: [
|
|
1605
|
+
/* @__PURE__ */ jsx(
|
|
1606
|
+
"img",
|
|
1607
|
+
{
|
|
1608
|
+
className: "animate-spin",
|
|
1609
|
+
src: "/spinner-gray.svg",
|
|
1610
|
+
alt: "circle",
|
|
1611
|
+
width: 13,
|
|
1612
|
+
height: 13
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1615
|
+
"Carregando"
|
|
1616
|
+
] }),
|
|
1617
|
+
(data == null ? void 0 : data.length) === 0 && (filter == null ? void 0 : filter.length) > 0 && !loading && /* @__PURE__ */ jsx("div", { className: "py-4", children: /* @__PURE__ */ jsx("span", { className: "text-label text-p-md", children: emptyMessage }) }),
|
|
1618
|
+
initialMessage && (data == null ? void 0 : data.length) === 0 && (filter == null ? void 0 : filter.length) === 0 && !loading && (options == null ? void 0 : options.length) === 0 && !(currentValue == null ? void 0 : currentValue.id) && /* @__PURE__ */ jsx("div", { className: "py-4", children: /* @__PURE__ */ jsx("span", { className: "text-label text-p-md", children: initialMessage }) }),
|
|
1619
|
+
initialMessage && currentValue && (currentValue == null ? void 0 : currentValue.id) && (filter == null ? void 0 : filter.length) === 0 && /* @__PURE__ */ jsx("div", { className: "py-2", children: isMulti ? /* @__PURE__ */ jsx(Fragment, { children: currentValue == null ? void 0 : currentValue.map((option) => {
|
|
1620
|
+
let isSelected = isMulti ? currentValue && (currentValue == null ? void 0 : currentValue.length) > 0 && (currentValue == null ? void 0 : currentValue.some(
|
|
1621
|
+
(e) => e.id === option.id
|
|
1622
|
+
)) : currentValue && (currentValue == null ? void 0 : currentValue.id) === option.id;
|
|
1623
|
+
return optionStyle(
|
|
1624
|
+
options,
|
|
1625
|
+
isSelected
|
|
1626
|
+
);
|
|
1627
|
+
}) }) : optionStyle(field.value, true) }),
|
|
1628
|
+
!loading && (data == null ? void 0 : data.map((option) => {
|
|
1629
|
+
let isSelected = isMulti ? currentValue && currentValue.length > 0 && currentValue.some(
|
|
1630
|
+
(e) => e.id === option.id
|
|
1631
|
+
) : currentValue && currentValue.id === option.id;
|
|
1632
|
+
return optionStyle(option, isSelected);
|
|
1633
|
+
}))
|
|
1634
|
+
]
|
|
1635
|
+
}
|
|
1636
|
+
)
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
!applyOnClick && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center justify-end border-t border-t-neutral-200 pt-3", children: [
|
|
1640
|
+
isMulti && onSelectAll && /* @__PURE__ */ jsx("div", { className: "border-r pr-2 border-neutral-300", children: /* @__PURE__ */ jsx(
|
|
1641
|
+
Button,
|
|
1642
|
+
{
|
|
1643
|
+
variant: "link",
|
|
1644
|
+
size: "xxs",
|
|
1645
|
+
onClick: () => {
|
|
1646
|
+
onSelectAll();
|
|
1647
|
+
field.onChange(options);
|
|
1648
|
+
setCurrentValue(options);
|
|
1649
|
+
close();
|
|
1650
|
+
},
|
|
1651
|
+
children: "Marcar todos"
|
|
1652
|
+
}
|
|
1653
|
+
) }),
|
|
1654
|
+
onClear && /* @__PURE__ */ jsx("div", { className: "mr-1", children: /* @__PURE__ */ jsx(
|
|
1655
|
+
Button,
|
|
1656
|
+
{
|
|
1657
|
+
variant: "link",
|
|
1658
|
+
size: "xxs",
|
|
1659
|
+
onClick: () => {
|
|
1660
|
+
if (onClear) {
|
|
1661
|
+
onClear();
|
|
1662
|
+
setCurrentValue([]);
|
|
1663
|
+
field.onChange([]);
|
|
1664
|
+
}
|
|
1665
|
+
close();
|
|
1666
|
+
},
|
|
1667
|
+
children: "Limpar"
|
|
1668
|
+
}
|
|
1669
|
+
) }),
|
|
1670
|
+
/* @__PURE__ */ jsx(
|
|
1671
|
+
Button,
|
|
1672
|
+
{
|
|
1673
|
+
size: "xs",
|
|
1674
|
+
variant: "secondary",
|
|
1675
|
+
onClick: () => {
|
|
1676
|
+
onClose();
|
|
1677
|
+
},
|
|
1678
|
+
children: "Cancelar"
|
|
1679
|
+
}
|
|
1680
|
+
),
|
|
1681
|
+
/* @__PURE__ */ jsx(
|
|
1682
|
+
Button,
|
|
1683
|
+
{
|
|
1684
|
+
size: "xs",
|
|
1685
|
+
variant: "primary",
|
|
1686
|
+
disabled: JSON.stringify(currentValue) === JSON.stringify(field == null ? void 0 : field.value),
|
|
1687
|
+
onClick: () => {
|
|
1688
|
+
field.onChange(currentValue);
|
|
1689
|
+
if (onApply) onApply();
|
|
1690
|
+
close();
|
|
1691
|
+
},
|
|
1692
|
+
children: "Aplicar"
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1695
|
+
] })
|
|
1696
|
+
] });
|
|
1697
|
+
} }) })
|
|
1698
|
+
] });
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
);
|
|
1705
|
+
};
|
|
1706
|
+
var IntlCurrencyInput = (IntlCurrencyInputModule == null ? void 0 : IntlCurrencyInputModule.default) || IntlCurrencyInputModule;
|
|
1707
|
+
var InputMoney = forwardRef(
|
|
1708
|
+
({
|
|
1709
|
+
label,
|
|
1710
|
+
type,
|
|
1711
|
+
onClick,
|
|
1712
|
+
error,
|
|
1713
|
+
onBlur,
|
|
1714
|
+
onChangeValue,
|
|
1715
|
+
inputProps,
|
|
1716
|
+
icon,
|
|
1717
|
+
clearField,
|
|
1718
|
+
name,
|
|
1719
|
+
required,
|
|
1720
|
+
disabled,
|
|
1721
|
+
value,
|
|
1722
|
+
placeholder,
|
|
1723
|
+
control,
|
|
1724
|
+
defaultValue,
|
|
1725
|
+
isWeightField,
|
|
1726
|
+
minFractionDigits = 2
|
|
1727
|
+
}, ref) => {
|
|
1728
|
+
const numberConfig = isWeightField ? {
|
|
1729
|
+
currency: "BRL",
|
|
1730
|
+
minimumFractionDigits: minFractionDigits,
|
|
1731
|
+
maximumFractionDigits: minFractionDigits,
|
|
1732
|
+
useGrouping: false
|
|
1733
|
+
} : {
|
|
1734
|
+
style: "currency",
|
|
1735
|
+
currency: "BRL",
|
|
1736
|
+
minimumFractionDigits: minFractionDigits,
|
|
1737
|
+
maximumFractionDigits: minFractionDigits
|
|
1738
|
+
};
|
|
1739
|
+
const currencyConfig = {
|
|
1740
|
+
locale: "pt-BR",
|
|
1741
|
+
formats: {
|
|
1742
|
+
number: {
|
|
1743
|
+
BRL: numberConfig
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
1748
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
1749
|
+
const styles = {
|
|
1750
|
+
input: `text-p-md pl-2 peer text-paragraph shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
|
|
1751
|
+
icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
|
|
1752
|
+
`,
|
|
1753
|
+
label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0"};
|
|
1754
|
+
return /* @__PURE__ */ jsx(
|
|
1755
|
+
Controller,
|
|
1756
|
+
{
|
|
1757
|
+
control,
|
|
1758
|
+
name,
|
|
1759
|
+
defaultValue,
|
|
1760
|
+
render: ({ field }) => {
|
|
1761
|
+
const handleChange = (event, value2, maskedValue) => {
|
|
1762
|
+
event.preventDefault();
|
|
1763
|
+
field.onChange(value2);
|
|
1764
|
+
if (onChangeValue) {
|
|
1765
|
+
onChangeValue(value2);
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
if (typeof field.value === "string")
|
|
1769
|
+
field.value = Number(field.value);
|
|
1770
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1771
|
+
/* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
|
|
1772
|
+
icon && /* @__PURE__ */ jsx(
|
|
1773
|
+
"div",
|
|
1774
|
+
{
|
|
1775
|
+
className: clsx7(
|
|
1776
|
+
styles.icon,
|
|
1777
|
+
"flex justify-center items-center"
|
|
1778
|
+
),
|
|
1779
|
+
children: icon
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1783
|
+
/* @__PURE__ */ jsx(
|
|
1784
|
+
IntlCurrencyInput,
|
|
1785
|
+
{
|
|
1786
|
+
...inputProps,
|
|
1787
|
+
...field,
|
|
1788
|
+
type: "text",
|
|
1789
|
+
ref,
|
|
1790
|
+
className: clsx7({
|
|
1791
|
+
[styles.input]: true,
|
|
1792
|
+
["pr-10"]: clearField,
|
|
1793
|
+
["pr-2"]: !clearField,
|
|
1794
|
+
["pl-[46px]"]: !label && placeholder && icon || icon
|
|
1795
|
+
}),
|
|
1796
|
+
placeholder: !label && placeholder ? placeholder : " ",
|
|
1797
|
+
onClick,
|
|
1798
|
+
disabled,
|
|
1799
|
+
currency: "BRL",
|
|
1800
|
+
config: currencyConfig,
|
|
1801
|
+
onChange: handleChange,
|
|
1802
|
+
onBlur: () => {
|
|
1803
|
+
if (onBlur) {
|
|
1804
|
+
onBlur(field.value);
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
),
|
|
1809
|
+
/* @__PURE__ */ jsxs(
|
|
1810
|
+
"label",
|
|
1811
|
+
{
|
|
1812
|
+
className: clsx7(
|
|
1813
|
+
{
|
|
1814
|
+
[styles.label]: true,
|
|
1815
|
+
["left-[46px]"]: icon,
|
|
1816
|
+
["left-2.5"]: !icon
|
|
1817
|
+
},
|
|
1818
|
+
"cursor-text"
|
|
1819
|
+
),
|
|
1820
|
+
children: [
|
|
1821
|
+
label,
|
|
1822
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
1823
|
+
]
|
|
1824
|
+
}
|
|
1825
|
+
)
|
|
1826
|
+
] })
|
|
1827
|
+
] }),
|
|
1828
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
1829
|
+
"div",
|
|
1830
|
+
{
|
|
1831
|
+
className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
|
|
1832
|
+
role: "alert",
|
|
1833
|
+
"aria-label": message,
|
|
1834
|
+
children: message
|
|
1835
|
+
},
|
|
1836
|
+
index
|
|
1837
|
+
))
|
|
1838
|
+
] });
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
);
|
|
1844
|
+
InputMoney.displayName = "InputMoney";
|
|
1845
|
+
function InputNumber({
|
|
1846
|
+
label,
|
|
1847
|
+
type,
|
|
1848
|
+
onClick,
|
|
1849
|
+
error,
|
|
1850
|
+
onBlur,
|
|
1851
|
+
onChangeValue,
|
|
1852
|
+
inputProps,
|
|
1853
|
+
icon,
|
|
1854
|
+
clearField,
|
|
1855
|
+
name,
|
|
1856
|
+
required,
|
|
1857
|
+
disabled,
|
|
1858
|
+
value,
|
|
1859
|
+
placeholder,
|
|
1860
|
+
control,
|
|
1861
|
+
defaultValue,
|
|
1862
|
+
hideArrows = false,
|
|
1863
|
+
maxLength,
|
|
1864
|
+
onlyNumbers,
|
|
1865
|
+
showZero,
|
|
1866
|
+
maxValue
|
|
1867
|
+
}) {
|
|
1868
|
+
const input = name ? document == null ? void 0 : document.getElementById(name) : null;
|
|
1869
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
1870
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
1871
|
+
const styles = {
|
|
1872
|
+
input: `text-p-md pl-2 peer shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border-1 ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
|
|
1873
|
+
icon: `absolute bg-neutral-100 h-[44px] top-[2px] left-[1.5px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
|
|
1874
|
+
`,
|
|
1875
|
+
label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0",
|
|
1876
|
+
buttonsWrapper: "absolute top-[7px] right-[10px] cursor-pointer text-label flex flex-col gap-[2px]",
|
|
1877
|
+
button: "border-[0.5px] border-neutral-300 rounded shadow-input h-4 w-4 flex items-center justify-center"
|
|
1878
|
+
};
|
|
1879
|
+
const [debouncedCount, setDebouncedCount] = useState(0);
|
|
1880
|
+
const save = () => {
|
|
1881
|
+
if (onBlur) {
|
|
1882
|
+
onBlur(value);
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
const updateCount = useMemo(() => {
|
|
1886
|
+
return _debounce(() => {
|
|
1887
|
+
save();
|
|
1888
|
+
}, 1e3);
|
|
1889
|
+
}, []);
|
|
1890
|
+
return /* @__PURE__ */ jsx(
|
|
1891
|
+
Controller,
|
|
1892
|
+
{
|
|
1893
|
+
control,
|
|
1894
|
+
name,
|
|
1895
|
+
defaultValue,
|
|
1896
|
+
render: ({ field: { onChange, value: value2 } }) => {
|
|
1897
|
+
const update = (value3) => {
|
|
1898
|
+
updateCount();
|
|
1899
|
+
setDebouncedCount(value3);
|
|
1900
|
+
};
|
|
1901
|
+
const changeValue = (value3) => {
|
|
1902
|
+
onChange(value3);
|
|
1903
|
+
if (onChangeValue) {
|
|
1904
|
+
const val = {
|
|
1905
|
+
...value3,
|
|
1906
|
+
target: {
|
|
1907
|
+
...value3.target,
|
|
1908
|
+
value: value3.target.value.replace(/^0+/, "")
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
onChangeValue(val);
|
|
1912
|
+
}
|
|
1913
|
+
update(debouncedCount + 1);
|
|
1914
|
+
};
|
|
1915
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1916
|
+
/* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
|
|
1917
|
+
icon && /* @__PURE__ */ jsx(
|
|
1918
|
+
"div",
|
|
1919
|
+
{
|
|
1920
|
+
className: clsx7(
|
|
1921
|
+
styles.icon,
|
|
1922
|
+
"flex justify-center items-center"
|
|
1923
|
+
),
|
|
1924
|
+
children: icon
|
|
1925
|
+
}
|
|
1926
|
+
),
|
|
1927
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1928
|
+
/* @__PURE__ */ jsx(
|
|
1929
|
+
"input",
|
|
1930
|
+
{
|
|
1931
|
+
type: "number",
|
|
1932
|
+
autoComplete: "off",
|
|
1933
|
+
id: name,
|
|
1934
|
+
className: clsx7({
|
|
1935
|
+
[styles.input]: true,
|
|
1936
|
+
["pr-10"]: clearField,
|
|
1937
|
+
["pr-2"]: !clearField,
|
|
1938
|
+
["pl-[57px]"]: !label && placeholder && icon
|
|
1939
|
+
}),
|
|
1940
|
+
placeholder: !label && placeholder ? placeholder : " ",
|
|
1941
|
+
onKeyDown: (e) => {
|
|
1942
|
+
if (e.code === "ArrowUp" || e.code === "ArrowDown" || e.code === "Enter" || e.key === "+" || e.key === "-" || e.key === "e" && !onlyNumbers) {
|
|
1943
|
+
e.preventDefault();
|
|
1944
|
+
}
|
|
1945
|
+
if (onlyNumbers && ![
|
|
1946
|
+
"Digit1",
|
|
1947
|
+
"Digit2",
|
|
1948
|
+
"Digit3",
|
|
1949
|
+
"Digit4",
|
|
1950
|
+
"Digit5",
|
|
1951
|
+
"Digit6",
|
|
1952
|
+
"Digit7",
|
|
1953
|
+
"Digit8",
|
|
1954
|
+
"Digit9",
|
|
1955
|
+
"Digit0",
|
|
1956
|
+
"Backspace"
|
|
1957
|
+
].includes(e.code)) {
|
|
1958
|
+
e.preventDefault();
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
onClick,
|
|
1962
|
+
disabled,
|
|
1963
|
+
value: showZero ? String(value2) : String(value2).replace(/^0+/, ""),
|
|
1964
|
+
onChange: (e) => {
|
|
1965
|
+
let value3 = maxLength ? {
|
|
1966
|
+
...e,
|
|
1967
|
+
target: {
|
|
1968
|
+
...e.target,
|
|
1969
|
+
value: e.target.value.slice(0, maxLength)
|
|
1970
|
+
}
|
|
1971
|
+
} : e;
|
|
1972
|
+
if (!maxValue || maxValue && Number(e.target.value) <= maxValue) {
|
|
1973
|
+
changeValue(value3);
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
defaultValue: value2,
|
|
1977
|
+
onBlur: (evt) => {
|
|
1978
|
+
if (onBlur) onBlur(evt.target.value);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
),
|
|
1982
|
+
/* @__PURE__ */ jsxs(
|
|
1983
|
+
"label",
|
|
1984
|
+
{
|
|
1985
|
+
className: clsx7(
|
|
1986
|
+
{
|
|
1987
|
+
[styles.label]: true,
|
|
1988
|
+
["left-[3.5rem]"]: icon,
|
|
1989
|
+
["left-2.5"]: !icon
|
|
1990
|
+
},
|
|
1991
|
+
"cursor-text"
|
|
1992
|
+
),
|
|
1993
|
+
onClick: () => input == null ? void 0 : input.focus(),
|
|
1994
|
+
children: [
|
|
1995
|
+
label,
|
|
1996
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
)
|
|
2000
|
+
] }),
|
|
2001
|
+
!hideArrows && /* @__PURE__ */ jsxs("div", { className: clsx7([styles.buttonsWrapper]), children: [
|
|
2002
|
+
/* @__PURE__ */ jsx(
|
|
2003
|
+
"button",
|
|
2004
|
+
{
|
|
2005
|
+
type: "button",
|
|
2006
|
+
className: clsx7([styles.button]),
|
|
2007
|
+
disabled,
|
|
2008
|
+
onClick: () => {
|
|
2009
|
+
if (!maxValue || maxValue && Number(value2 || 0) + 1 <= maxValue) {
|
|
2010
|
+
changeValue(String(Number(value2 || 0) + 1));
|
|
2011
|
+
}
|
|
2012
|
+
},
|
|
2013
|
+
children: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-up text-[12px] text-neutral-600" })
|
|
2014
|
+
}
|
|
2015
|
+
),
|
|
2016
|
+
/* @__PURE__ */ jsx(
|
|
2017
|
+
"button",
|
|
2018
|
+
{
|
|
2019
|
+
type: "button",
|
|
2020
|
+
className: clsx7([styles.button]),
|
|
2021
|
+
disabled,
|
|
2022
|
+
onClick: () => {
|
|
2023
|
+
if (!maxValue || maxValue && Number(value2 === 0 ? 0 : Number(value2) - 1) <= maxValue) {
|
|
2024
|
+
changeValue(
|
|
2025
|
+
value2 === 0 ? 0 : String(Number(value2) - 1)
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
children: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-[12px] text-neutral-600" })
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
] })
|
|
2033
|
+
] }),
|
|
2034
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
2035
|
+
"div",
|
|
2036
|
+
{
|
|
2037
|
+
className: "absolute text-dangerous-500 text-xs left-[4px] -bottom-[18px]",
|
|
2038
|
+
role: "alert",
|
|
2039
|
+
"aria-label": message,
|
|
2040
|
+
children: message
|
|
2041
|
+
},
|
|
2042
|
+
index
|
|
2043
|
+
))
|
|
2044
|
+
] });
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
2048
|
+
}
|
|
2049
|
+
InputNumber.displayName = "InputNumber";
|
|
2050
|
+
var IntlCurrencyInput2 = (IntlCurrencyInputModule == null ? void 0 : IntlCurrencyInputModule.default) || IntlCurrencyInputModule;
|
|
2051
|
+
function InputPercentage({
|
|
2052
|
+
label,
|
|
2053
|
+
onClick,
|
|
2054
|
+
error,
|
|
2055
|
+
onBlur,
|
|
2056
|
+
inputProps,
|
|
2057
|
+
icon,
|
|
2058
|
+
clearField,
|
|
2059
|
+
name,
|
|
2060
|
+
required,
|
|
2061
|
+
disabled,
|
|
2062
|
+
placeholder,
|
|
2063
|
+
control,
|
|
2064
|
+
defaultValue,
|
|
2065
|
+
minFractionDigits = 2,
|
|
2066
|
+
onChangeValue,
|
|
2067
|
+
maxLength
|
|
2068
|
+
}) {
|
|
2069
|
+
const config = {
|
|
2070
|
+
currency: "BRL",
|
|
2071
|
+
minimumFractionDigits: minFractionDigits,
|
|
2072
|
+
maximumFractionDigits: minFractionDigits,
|
|
2073
|
+
useGrouping: false
|
|
2074
|
+
};
|
|
2075
|
+
const currencyConfig = {
|
|
2076
|
+
locale: "pt-BR",
|
|
2077
|
+
formats: {
|
|
2078
|
+
number: {
|
|
2079
|
+
BRL: config
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
let inputRef = useRef(null);
|
|
2084
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
2085
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
2086
|
+
const styles = {
|
|
2087
|
+
input: `text-p-md pl-2 peer shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border-1 ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
|
|
2088
|
+
icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1.5px] w-[38px] text-[22px] rounded-lg ${hasError ? "text-dangerous-500" : "text-label"}
|
|
2089
|
+
`,
|
|
2090
|
+
label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0"};
|
|
2091
|
+
const input = name ? document == null ? void 0 : document.getElementById(name) : null;
|
|
2092
|
+
return /* @__PURE__ */ jsx(
|
|
2093
|
+
Controller,
|
|
2094
|
+
{
|
|
2095
|
+
control,
|
|
2096
|
+
name,
|
|
2097
|
+
defaultValue,
|
|
2098
|
+
render: ({ field }) => {
|
|
2099
|
+
const handleChange = (event, value, maskedValue) => {
|
|
2100
|
+
event.preventDefault();
|
|
2101
|
+
field.onChange(value.toString());
|
|
2102
|
+
if (onChangeValue) {
|
|
2103
|
+
onChangeValue(value.toString());
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
if (typeof field.value === "string") field.value = Number(field.value);
|
|
2107
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2108
|
+
/* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
|
|
2109
|
+
icon && /* @__PURE__ */ jsx(
|
|
2110
|
+
"div",
|
|
2111
|
+
{
|
|
2112
|
+
className: clsx7(
|
|
2113
|
+
styles.icon,
|
|
2114
|
+
"flex justify-center items-center"
|
|
2115
|
+
),
|
|
2116
|
+
children: icon
|
|
2117
|
+
}
|
|
2118
|
+
),
|
|
2119
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2120
|
+
/* @__PURE__ */ jsx(
|
|
2121
|
+
IntlCurrencyInput2,
|
|
2122
|
+
{
|
|
2123
|
+
...inputProps,
|
|
2124
|
+
...field,
|
|
2125
|
+
type: "text",
|
|
2126
|
+
ref: inputRef,
|
|
2127
|
+
className: clsx7({
|
|
2128
|
+
[styles.input]: true,
|
|
2129
|
+
["pr-10"]: clearField,
|
|
2130
|
+
["pr-2"]: !clearField,
|
|
2131
|
+
["pl-[3rem]"]: icon
|
|
2132
|
+
}),
|
|
2133
|
+
placeholder: !label && placeholder ? placeholder : " ",
|
|
2134
|
+
onClick,
|
|
2135
|
+
disabled,
|
|
2136
|
+
currency: "BRL",
|
|
2137
|
+
config: currencyConfig,
|
|
2138
|
+
onChange: handleChange,
|
|
2139
|
+
max: maxLength
|
|
2140
|
+
}
|
|
2141
|
+
),
|
|
2142
|
+
/* @__PURE__ */ jsxs(
|
|
2143
|
+
"label",
|
|
2144
|
+
{
|
|
2145
|
+
className: clsx7(
|
|
2146
|
+
{
|
|
2147
|
+
[styles.label]: true,
|
|
2148
|
+
["left-[3rem]"]: icon,
|
|
2149
|
+
["left-2.5"]: !icon
|
|
2150
|
+
},
|
|
2151
|
+
"cursor-text"
|
|
2152
|
+
),
|
|
2153
|
+
onClick: () => input == null ? void 0 : input.focus(),
|
|
2154
|
+
children: [
|
|
2155
|
+
label,
|
|
2156
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
2157
|
+
]
|
|
2158
|
+
}
|
|
2159
|
+
)
|
|
2160
|
+
] })
|
|
2161
|
+
] }),
|
|
2162
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
2163
|
+
"div",
|
|
2164
|
+
{
|
|
2165
|
+
className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
|
|
2166
|
+
role: "alert",
|
|
2167
|
+
"aria-label": message,
|
|
2168
|
+
children: message
|
|
2169
|
+
},
|
|
2170
|
+
index
|
|
2171
|
+
))
|
|
2172
|
+
] });
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
InputPercentage.displayName = "InputPercentage";
|
|
2178
|
+
var MaskedInput = ({
|
|
2179
|
+
type = "text",
|
|
2180
|
+
name,
|
|
2181
|
+
label,
|
|
2182
|
+
placeholder,
|
|
2183
|
+
error,
|
|
2184
|
+
mask,
|
|
2185
|
+
control,
|
|
2186
|
+
required,
|
|
2187
|
+
onKeyUp,
|
|
2188
|
+
maskChar = "",
|
|
2189
|
+
alwaysShowMask,
|
|
2190
|
+
defaultValue,
|
|
2191
|
+
disabled
|
|
2192
|
+
}) => {
|
|
2193
|
+
const ref = useRef(null);
|
|
2194
|
+
return /* @__PURE__ */ jsx(
|
|
2195
|
+
Controller,
|
|
2196
|
+
{
|
|
2197
|
+
name,
|
|
2198
|
+
control,
|
|
2199
|
+
defaultValue,
|
|
2200
|
+
render: ({ field }) => {
|
|
2201
|
+
const beforeMaskedValueChange = (states) => {
|
|
2202
|
+
const { nextState, previousState } = states;
|
|
2203
|
+
var { value } = nextState;
|
|
2204
|
+
var selection = nextState.selection;
|
|
2205
|
+
var cursorPosition = selection ? selection.start : null;
|
|
2206
|
+
var chars = [".", "-", "/", "(", ")", " "];
|
|
2207
|
+
var words = [...value];
|
|
2208
|
+
if (chars.includes(words[words.length - 1])) {
|
|
2209
|
+
if (cursorPosition === value.length) {
|
|
2210
|
+
cursorPosition--;
|
|
2211
|
+
selection = {
|
|
2212
|
+
start: cursorPosition,
|
|
2213
|
+
end: cursorPosition
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
value = value.slice(0, -1);
|
|
2217
|
+
}
|
|
2218
|
+
return {
|
|
2219
|
+
value,
|
|
2220
|
+
selection
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
return /* @__PURE__ */ jsx(
|
|
2224
|
+
InputMask,
|
|
2225
|
+
{
|
|
2226
|
+
...field,
|
|
2227
|
+
onKeyUp,
|
|
2228
|
+
disabled,
|
|
2229
|
+
mask,
|
|
2230
|
+
value: field.value || "",
|
|
2231
|
+
onChange: field.onChange,
|
|
2232
|
+
maskChar,
|
|
2233
|
+
alwaysShowMask,
|
|
2234
|
+
beforeMaskedStateChange: beforeMaskedValueChange,
|
|
2235
|
+
children: (inputProps) => /* @__PURE__ */ jsx(
|
|
2236
|
+
Input,
|
|
2237
|
+
{
|
|
2238
|
+
onKeyUp,
|
|
2239
|
+
type,
|
|
2240
|
+
label,
|
|
2241
|
+
placeholder,
|
|
2242
|
+
required,
|
|
2243
|
+
inputProps,
|
|
2244
|
+
error,
|
|
2245
|
+
name,
|
|
2246
|
+
disabled,
|
|
2247
|
+
ref
|
|
2248
|
+
}
|
|
2249
|
+
)
|
|
2250
|
+
}
|
|
2251
|
+
);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
);
|
|
2255
|
+
};
|
|
2256
|
+
var Modal = ReactModalNamespace.default || ReactModalNamespace;
|
|
2257
|
+
var alertTypes = {
|
|
2258
|
+
success: "text-success-500",
|
|
2259
|
+
error: "text-dangerous-500",
|
|
2260
|
+
warning: "text-warning-500",
|
|
2261
|
+
info: "text-blue-500",
|
|
2262
|
+
primary: "text-rose-700"
|
|
2263
|
+
};
|
|
2264
|
+
var sizes2 = {
|
|
2265
|
+
xs: "w-[350px]",
|
|
2266
|
+
sm: "w-[662px]",
|
|
2267
|
+
md: "w-[960px]",
|
|
2268
|
+
lg: "w-[80%] min-w-[800px]",
|
|
2269
|
+
null: ""
|
|
2270
|
+
};
|
|
2271
|
+
var ModalDialog = ({
|
|
2272
|
+
open,
|
|
2273
|
+
onOpen = () => {
|
|
2274
|
+
},
|
|
2275
|
+
onClose,
|
|
2276
|
+
onCancel,
|
|
2277
|
+
triggerButton,
|
|
2278
|
+
confirmButton,
|
|
2279
|
+
title,
|
|
2280
|
+
cancelButton,
|
|
2281
|
+
icon,
|
|
2282
|
+
alertType,
|
|
2283
|
+
size = "sm",
|
|
2284
|
+
info,
|
|
2285
|
+
description,
|
|
2286
|
+
children
|
|
2287
|
+
}) => {
|
|
2288
|
+
const customStyles2 = {
|
|
2289
|
+
content: {
|
|
2290
|
+
top: "50%",
|
|
2291
|
+
left: "50%",
|
|
2292
|
+
right: "auto",
|
|
2293
|
+
bottom: "auto",
|
|
2294
|
+
marginRight: "-50%",
|
|
2295
|
+
transform: "translate(-50%, -50%)",
|
|
2296
|
+
border: "1px solid #E8E8E9",
|
|
2297
|
+
padding: "24px",
|
|
2298
|
+
borderRadius: "8px",
|
|
2299
|
+
overflow: "initial"
|
|
2300
|
+
},
|
|
2301
|
+
overlay: {
|
|
2302
|
+
backgroundColor: "rgb(107,114,128,0.50)",
|
|
2303
|
+
zIndex: 9999
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
const trigger = triggerButton ? cloneElement(triggerButton, {
|
|
2307
|
+
onClick: () => {
|
|
2308
|
+
onOpen();
|
|
2309
|
+
}
|
|
2310
|
+
}) : null;
|
|
2311
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2312
|
+
trigger,
|
|
2313
|
+
/* @__PURE__ */ jsx(
|
|
2314
|
+
Modal,
|
|
2315
|
+
{
|
|
2316
|
+
ariaHideApp: false,
|
|
2317
|
+
isOpen: open,
|
|
2318
|
+
onRequestClose: onClose,
|
|
2319
|
+
style: customStyles2,
|
|
2320
|
+
contentLabel: "Example Modal",
|
|
2321
|
+
children: /* @__PURE__ */ jsxs("div", { className: clsx7(sizes2[size]), children: [
|
|
2322
|
+
/* @__PURE__ */ jsxs("div", { className: "pb-2 border-b border-b-neutral-200 flex items-center justify-between", children: [
|
|
2323
|
+
/* @__PURE__ */ jsxs("h3", { className: "text-[24px] font-bold flex items-center gap-2", children: [
|
|
2324
|
+
alertType && /* @__PURE__ */ jsx("div", { className: clsx7([alertTypes[alertType]], "text-[30px]"), children: icon }),
|
|
2325
|
+
title
|
|
2326
|
+
] }),
|
|
2327
|
+
/* @__PURE__ */ jsx("button", { onClick: onCancel, className: "text-neutral-500 text-[24px]", children: /* @__PURE__ */ jsx("i", { className: "uil uil-times" }) })
|
|
2328
|
+
] }),
|
|
2329
|
+
/* @__PURE__ */ jsx("div", { children }),
|
|
2330
|
+
/* @__PURE__ */ jsxs("div", { className: "pt-6 border-t border-t-neutral-200 flex w-full items-center justify-between", children: [
|
|
2331
|
+
/* @__PURE__ */ jsx(
|
|
2332
|
+
"div",
|
|
2333
|
+
{
|
|
2334
|
+
className: clsx7({
|
|
2335
|
+
["flex-1"]: info
|
|
2336
|
+
}),
|
|
2337
|
+
children: info
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2340
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse md:flex-row gap-3 items-center md:justify-end w-full md:w-auto", children: [
|
|
2341
|
+
cancelButton || /* @__PURE__ */ jsx(
|
|
2342
|
+
Button,
|
|
2343
|
+
{
|
|
2344
|
+
onClick: () => {
|
|
2345
|
+
if (onCancel) {
|
|
2346
|
+
onCancel();
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
variant: "secondary",
|
|
2350
|
+
size: "sm",
|
|
2351
|
+
children: "Cancelar"
|
|
2352
|
+
}
|
|
2353
|
+
),
|
|
2354
|
+
confirmButton
|
|
2355
|
+
] })
|
|
2356
|
+
] })
|
|
2357
|
+
] })
|
|
2358
|
+
}
|
|
2359
|
+
)
|
|
2360
|
+
] });
|
|
2361
|
+
};
|
|
2362
|
+
var Popover3 = ({
|
|
2363
|
+
id,
|
|
2364
|
+
displayArrow = true,
|
|
2365
|
+
openOnClick = false
|
|
2366
|
+
}) => {
|
|
2367
|
+
const style = {
|
|
2368
|
+
noArrow: "hidden"
|
|
2369
|
+
};
|
|
2370
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2371
|
+
Tooltip,
|
|
2372
|
+
{
|
|
2373
|
+
id,
|
|
2374
|
+
className: "absolute bg-neutral-700 text-sm text-neutral-100 py-2 px-4 max-w-[430px] break-words whitespace-normal",
|
|
2375
|
+
classNameArrow: !displayArrow ? style.noArrow : "",
|
|
2376
|
+
openOnClick,
|
|
2377
|
+
delayHide: 0,
|
|
2378
|
+
delayShow: 0
|
|
2379
|
+
}
|
|
2380
|
+
) });
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
// src/components/Select/Select.styles.ts
|
|
2384
|
+
var customStyles = {
|
|
2385
|
+
indicatorSeparator: (provided, props) => {
|
|
2386
|
+
var _a;
|
|
2387
|
+
return {
|
|
2388
|
+
...provided,
|
|
2389
|
+
backgroundColor: props.hasValue && ((_a = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a.isSearchable) ? "var(--input)" : "transparent"
|
|
2390
|
+
};
|
|
2391
|
+
},
|
|
2392
|
+
clearIndicator: (provided) => ({
|
|
2393
|
+
...provided,
|
|
2394
|
+
color: "var(--label)",
|
|
2395
|
+
":hover": {
|
|
2396
|
+
color: "var(--label)"
|
|
2397
|
+
}
|
|
2398
|
+
}),
|
|
2399
|
+
dropdownIndicator: (provided, state) => {
|
|
2400
|
+
var _a;
|
|
2401
|
+
return {
|
|
2402
|
+
...provided,
|
|
2403
|
+
color: "var(--paragraph)",
|
|
2404
|
+
transform: ((_a = state == null ? void 0 : state.selectProps) == null ? void 0 : _a.menuIsOpen) ? "rotate(180deg)" : "rotate(0)",
|
|
2405
|
+
":hover": {
|
|
2406
|
+
color: "var(--paragraph)"
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
},
|
|
2410
|
+
input: (provided, state) => ({
|
|
2411
|
+
...provided,
|
|
2412
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2413
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0px"
|
|
2414
|
+
}),
|
|
2415
|
+
menu: (provided) => ({
|
|
2416
|
+
...provided,
|
|
2417
|
+
marginTop: "4px",
|
|
2418
|
+
border: "1px solid var(--neutral-300)",
|
|
2419
|
+
boxShadow: "none",
|
|
2420
|
+
borderRadius: "8px",
|
|
2421
|
+
background: "white",
|
|
2422
|
+
zIndex: 20
|
|
2423
|
+
}),
|
|
2424
|
+
menuList: (provided) => ({
|
|
2425
|
+
...provided,
|
|
2426
|
+
padding: "8px"
|
|
2427
|
+
}),
|
|
2428
|
+
singleValue: (base, state) => ({
|
|
2429
|
+
...base,
|
|
2430
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2431
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0",
|
|
2432
|
+
color: state.data.value === "active" ? "#0EAF86" : state.selectProps.hasError ? "var(--dangerous-500)" : "black",
|
|
2433
|
+
display: "flex"
|
|
2434
|
+
}),
|
|
2435
|
+
control: (provided, state) => ({
|
|
2436
|
+
...provided,
|
|
2437
|
+
cursor: "pointer",
|
|
2438
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--dark-blue-300)",
|
|
2439
|
+
boxShadow: "none",
|
|
2440
|
+
outline: "none",
|
|
2441
|
+
borderRadius: "0.5rem",
|
|
2442
|
+
placeholder: " ",
|
|
2443
|
+
height: state.selectProps.smallField ? "30px" : "46px",
|
|
2444
|
+
backgroundColor: state.isDisabled ? "var(--light-100)" : "white",
|
|
2445
|
+
":hover": {
|
|
2446
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--neutral-300)"
|
|
2447
|
+
}
|
|
2448
|
+
}),
|
|
2449
|
+
multiValue: (provided) => ({
|
|
2450
|
+
...provided,
|
|
2451
|
+
borderRadius: "20px",
|
|
2452
|
+
backgroundColor: "var(--neutral-100)",
|
|
2453
|
+
padding: "0px 8px"
|
|
2454
|
+
}),
|
|
2455
|
+
multiValueLabel: (provided) => ({
|
|
2456
|
+
...provided,
|
|
2457
|
+
color: "var(--paragraph)"
|
|
2458
|
+
}),
|
|
2459
|
+
multiValueRemove: (provided) => ({
|
|
2460
|
+
...provided,
|
|
2461
|
+
color: "var(--neutral-400)",
|
|
2462
|
+
":hover": {
|
|
2463
|
+
color: "var(--dangerous-500)"
|
|
2464
|
+
}
|
|
2465
|
+
}),
|
|
2466
|
+
option: (provided, state) => {
|
|
2467
|
+
let color = state.isSelected ? "white" : (state == null ? void 0 : state.isDisabled) ? "var(--label)" : "var(--paragraph)";
|
|
2468
|
+
return {
|
|
2469
|
+
...provided,
|
|
2470
|
+
cursor: state.isDisabled ? "auto" : "pointer",
|
|
2471
|
+
pointerEvents: state.isDisabled ? "none" : "",
|
|
2472
|
+
borderRadius: "8px",
|
|
2473
|
+
margin: "4px 0px",
|
|
2474
|
+
padding: "12px",
|
|
2475
|
+
backgroundColor: state.isSelected ? "var(--blue-500)" : "white",
|
|
2476
|
+
color,
|
|
2477
|
+
fontWeight: state.isSelected ? 700 : 400,
|
|
2478
|
+
"&:hover": {
|
|
2479
|
+
backgroundColor: state.isSelected ? "var(--blue-500)" : "var(--neutral-200)"
|
|
2480
|
+
},
|
|
2481
|
+
"&:active": {
|
|
2482
|
+
backgroundColor: "var(--blue-500)",
|
|
2483
|
+
color: "white",
|
|
2484
|
+
fontWeight: 700
|
|
2485
|
+
},
|
|
2486
|
+
"&:active i": {
|
|
2487
|
+
color: "white",
|
|
2488
|
+
fontWeight: 700
|
|
2489
|
+
},
|
|
2490
|
+
" i": {
|
|
2491
|
+
color: "white"
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
},
|
|
2495
|
+
container: (provided) => ({
|
|
2496
|
+
...provided,
|
|
2497
|
+
border: "none",
|
|
2498
|
+
outline: "none",
|
|
2499
|
+
boxShadow: "none",
|
|
2500
|
+
padding: "none",
|
|
2501
|
+
margin: "none"
|
|
2502
|
+
})
|
|
2503
|
+
};
|
|
2504
|
+
var SelectField = ({
|
|
2505
|
+
name,
|
|
2506
|
+
error,
|
|
2507
|
+
label,
|
|
2508
|
+
defaultValue,
|
|
2509
|
+
control,
|
|
2510
|
+
placeholder,
|
|
2511
|
+
isSearchable = false,
|
|
2512
|
+
isClearable = false,
|
|
2513
|
+
onChange,
|
|
2514
|
+
required,
|
|
2515
|
+
debounce = 0,
|
|
2516
|
+
filterOptions,
|
|
2517
|
+
optionsList,
|
|
2518
|
+
disabled,
|
|
2519
|
+
onChangeValue,
|
|
2520
|
+
resize = true,
|
|
2521
|
+
optionStyle,
|
|
2522
|
+
valueStyle,
|
|
2523
|
+
icon,
|
|
2524
|
+
emptyMessage,
|
|
2525
|
+
small = false
|
|
2526
|
+
}) => {
|
|
2527
|
+
var _a;
|
|
2528
|
+
const { Option, DropdownIndicator, ClearIndicator, SingleValue } = components;
|
|
2529
|
+
const selectRef = useRef(null);
|
|
2530
|
+
const [inputValue, setInputValue] = useState("");
|
|
2531
|
+
const [loading, setLoading] = useState(false);
|
|
2532
|
+
const [options, setOptions] = useState(() => optionsList || []);
|
|
2533
|
+
const [availableHeight, setAvailableHeight] = useState(300);
|
|
2534
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
2535
|
+
useEffect(() => {
|
|
2536
|
+
const updateAvailableHeight = () => {
|
|
2537
|
+
var _a2, _b;
|
|
2538
|
+
if ((_a2 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a2.getBoundingClientRect) {
|
|
2539
|
+
const rect = (_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
2540
|
+
const bottomSpace = window.innerHeight - rect.bottom;
|
|
2541
|
+
const margin = bottomSpace - 24;
|
|
2542
|
+
setAvailableHeight(margin < 250 ? 276 : margin);
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
updateAvailableHeight();
|
|
2546
|
+
window.addEventListener("resize", updateAvailableHeight);
|
|
2547
|
+
return () => {
|
|
2548
|
+
window.removeEventListener("resize", updateAvailableHeight);
|
|
2549
|
+
};
|
|
2550
|
+
}, [selectRef]);
|
|
2551
|
+
const loadOptions = (inputValue2) => {
|
|
2552
|
+
setLoading(true);
|
|
2553
|
+
if (isSearchable && filterOptions) {
|
|
2554
|
+
if (debounce && inputValue2.length >= debounce || !debounce) {
|
|
2555
|
+
const result = filterOptions(inputValue2);
|
|
2556
|
+
setLoading(false);
|
|
2557
|
+
return result;
|
|
2558
|
+
}
|
|
2559
|
+
} else {
|
|
2560
|
+
setOptions(optionsList);
|
|
2561
|
+
}
|
|
2562
|
+
};
|
|
2563
|
+
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
2564
|
+
const fieldValidationMessages = [
|
|
2565
|
+
(_a = fieldValidation[name]) == null ? void 0 : _a.message,
|
|
2566
|
+
error == null ? void 0 : error.message
|
|
2567
|
+
];
|
|
2568
|
+
const hasError = {
|
|
2569
|
+
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
2570
|
+
};
|
|
2571
|
+
const smallField = {
|
|
2572
|
+
smallField: small
|
|
2573
|
+
};
|
|
2574
|
+
const hasLabel = {
|
|
2575
|
+
hasLabel: (label == null ? void 0 : label.length) > 0
|
|
2576
|
+
};
|
|
2577
|
+
const menuHeight = resize ? {
|
|
2578
|
+
menuHeight: availableHeight
|
|
2579
|
+
} : null;
|
|
2580
|
+
const hasIcon = {
|
|
2581
|
+
hasIcon: icon
|
|
2582
|
+
};
|
|
2583
|
+
useEffect(() => {
|
|
2584
|
+
setOptions(() => optionsList);
|
|
2585
|
+
}, [optionsList]);
|
|
2586
|
+
return /* @__PURE__ */ jsx(
|
|
2587
|
+
Controller,
|
|
2588
|
+
{
|
|
2589
|
+
name,
|
|
2590
|
+
control,
|
|
2591
|
+
defaultValue,
|
|
2592
|
+
render: ({ field }) => {
|
|
2593
|
+
const CustomSingleValue = (props) => {
|
|
2594
|
+
return /* @__PURE__ */ jsx(SingleValue, { ...props, children: valueStyle ? valueStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2595
|
+
props.data.label,
|
|
2596
|
+
" "
|
|
2597
|
+
] }) });
|
|
2598
|
+
};
|
|
2599
|
+
const IconOption = (props) => {
|
|
2600
|
+
return /* @__PURE__ */ jsx(Option, { ...props, children: optionStyle ? optionStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsx(
|
|
2601
|
+
"div",
|
|
2602
|
+
{
|
|
2603
|
+
style: {
|
|
2604
|
+
display: "flex",
|
|
2605
|
+
alignItems: "center",
|
|
2606
|
+
justifyContent: "space-between"
|
|
2607
|
+
},
|
|
2608
|
+
children: /* @__PURE__ */ jsx("span", { className: clsx7("text-p-md focus:text-white"), children: props.data.label })
|
|
2609
|
+
}
|
|
2610
|
+
) });
|
|
2611
|
+
};
|
|
2612
|
+
const LoadingMessage = (props) => {
|
|
2613
|
+
if (!debounce || debounce && inputValue.length >= debounce) {
|
|
2614
|
+
return /* @__PURE__ */ jsxs(
|
|
2615
|
+
"div",
|
|
2616
|
+
{
|
|
2617
|
+
...props.innerProps,
|
|
2618
|
+
className: "flex items-center gap-[6px] p-2",
|
|
2619
|
+
children: [
|
|
2620
|
+
/* @__PURE__ */ jsx(
|
|
2621
|
+
"img",
|
|
2622
|
+
{
|
|
2623
|
+
className: "animate-spin ",
|
|
2624
|
+
src: "/spinner.svg",
|
|
2625
|
+
alt: "circle",
|
|
2626
|
+
width: 16,
|
|
2627
|
+
height: 16
|
|
2628
|
+
}
|
|
2629
|
+
),
|
|
2630
|
+
"Buscando..."
|
|
2631
|
+
]
|
|
2632
|
+
}
|
|
2633
|
+
);
|
|
2634
|
+
} else if (debounce && inputValue.length < debounce) {
|
|
2635
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
2636
|
+
"Digite ",
|
|
2637
|
+
debounce,
|
|
2638
|
+
" ou mais caracteres para pesquisar"
|
|
2639
|
+
] });
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
const NoOptionsMessage = (props) => {
|
|
2643
|
+
var _a2;
|
|
2644
|
+
if (props.selectProps.inputValue.length == 0 && debounce > 0 || debounce > 0 && props.selectProps.inputValue.length < debounce) {
|
|
2645
|
+
return /* @__PURE__ */ jsxs("div", { className: "text-dangerous-500 text-sm", children: [
|
|
2646
|
+
"Digite ",
|
|
2647
|
+
debounce,
|
|
2648
|
+
" ou mais caracteres para pesquisar"
|
|
2649
|
+
] });
|
|
2650
|
+
} else if (props.selectProps.inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
2651
|
+
return /* @__PURE__ */ jsx("div", { className: "text-dangerous-500 text-sm", children: "Nenhum dado encontrado" });
|
|
2652
|
+
}
|
|
2653
|
+
};
|
|
2654
|
+
const DropdownIndicatorCustom = (props) => {
|
|
2655
|
+
return /* @__PURE__ */ jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(
|
|
2656
|
+
"i",
|
|
2657
|
+
{
|
|
2658
|
+
className: `uil uil-angle-down text-[20px] ${small ? "h-[20px] -mt-[7px]" : "h-full"}`
|
|
2659
|
+
}
|
|
2660
|
+
) });
|
|
2661
|
+
};
|
|
2662
|
+
const ClearIndicatorCustom = (props) => {
|
|
2663
|
+
return /* @__PURE__ */ jsx(ClearIndicator, { ...props, children: /* @__PURE__ */ jsx("i", { className: "uil uil-times text-[16px]" }) });
|
|
2664
|
+
};
|
|
2665
|
+
const onChange2 = (value) => {
|
|
2666
|
+
field.onChange(value);
|
|
2667
|
+
if (onChangeValue) {
|
|
2668
|
+
onChangeValue(value);
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
const handleKeyDown = async (event) => {
|
|
2672
|
+
var _a2;
|
|
2673
|
+
if (event.key === "Enter") {
|
|
2674
|
+
event.preventDefault();
|
|
2675
|
+
const fetchedOptions = await loadOptions((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value);
|
|
2676
|
+
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
2677
|
+
onChange2(fetchedOptions[0]);
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
};
|
|
2681
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", id: "select", ref: selectRef, children: [
|
|
2682
|
+
icon && /* @__PURE__ */ jsx(
|
|
2683
|
+
"div",
|
|
2684
|
+
{
|
|
2685
|
+
className: clsx7(
|
|
2686
|
+
"z-[70] absolute bg-neutral-100 top-[1px] left-[1px] rounded-l-lg flex justify-center items-center h-[44px] w-[38px] text-[22px] text-dark-blue-600",
|
|
2687
|
+
{
|
|
2688
|
+
"text-blue-500": isFocused && hasIcon.hasIcon,
|
|
2689
|
+
"text-red-500": hasError.hasError && hasIcon.hasIcon
|
|
2690
|
+
}
|
|
2691
|
+
),
|
|
2692
|
+
children: icon
|
|
2693
|
+
}
|
|
2694
|
+
),
|
|
2695
|
+
/* @__PURE__ */ jsx(
|
|
2696
|
+
AsyncSelect,
|
|
2697
|
+
{
|
|
2698
|
+
onKeyDown: handleKeyDown,
|
|
2699
|
+
...field,
|
|
2700
|
+
...hasError,
|
|
2701
|
+
...hasLabel,
|
|
2702
|
+
...menuHeight,
|
|
2703
|
+
...hasIcon,
|
|
2704
|
+
...smallField,
|
|
2705
|
+
isDisabled: disabled,
|
|
2706
|
+
onFocus: () => setIsFocused(true),
|
|
2707
|
+
onBlur: () => setIsFocused(false),
|
|
2708
|
+
loadingMessage: () => /* @__PURE__ */ jsx("div", { children: "Carregando" }),
|
|
2709
|
+
isLoading: loading,
|
|
2710
|
+
defaultOptions: debounce > 0 ? false : optionsList ? options : true,
|
|
2711
|
+
loadOptions,
|
|
2712
|
+
name: field.name,
|
|
2713
|
+
isClearable,
|
|
2714
|
+
styles: customStyles,
|
|
2715
|
+
placeholder: placeholder || " ",
|
|
2716
|
+
isSearchable,
|
|
2717
|
+
options,
|
|
2718
|
+
tabSelectsValue: true,
|
|
2719
|
+
components: {
|
|
2720
|
+
SingleValue: CustomSingleValue,
|
|
2721
|
+
ValueContainer,
|
|
2722
|
+
Option: IconOption,
|
|
2723
|
+
LoadingIndicator: () => /* @__PURE__ */ jsx(Fragment, {}),
|
|
2724
|
+
LoadingMessage,
|
|
2725
|
+
NoOptionsMessage,
|
|
2726
|
+
DropdownIndicator: DropdownIndicatorCustom,
|
|
2727
|
+
ClearIndicator: ClearIndicatorCustom
|
|
2728
|
+
},
|
|
2729
|
+
closeMenuOnSelect: true,
|
|
2730
|
+
hideSelectedOptions: false,
|
|
2731
|
+
onChange: onChange2
|
|
2732
|
+
}
|
|
2733
|
+
),
|
|
2734
|
+
/* @__PURE__ */ jsxs(
|
|
2735
|
+
"span",
|
|
2736
|
+
{
|
|
2737
|
+
className: clsx7(
|
|
2738
|
+
"text-label text-sm left-2.5 cursor-pointer pointer-events-none absolute transition-all duration-200",
|
|
2739
|
+
{
|
|
2740
|
+
"scale-75 -translate-y-3": field.value || inputValue,
|
|
2741
|
+
"ml-[35px]": hasIcon.hasIcon,
|
|
2742
|
+
"ml-[2px]": !hasIcon.hasIcon,
|
|
2743
|
+
"top-2.5": !(field.value || inputValue),
|
|
2744
|
+
"top-0": field.value || inputValue
|
|
2745
|
+
}
|
|
2746
|
+
),
|
|
2747
|
+
children: [
|
|
2748
|
+
label,
|
|
2749
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-700", children: "\xA0*" })
|
|
2750
|
+
]
|
|
2751
|
+
}
|
|
2752
|
+
),
|
|
2753
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
2754
|
+
"div",
|
|
2755
|
+
{
|
|
2756
|
+
style: { color: "var(--dangerous-700)" },
|
|
2757
|
+
className: "text-xs ml-[2px]",
|
|
2758
|
+
role: "alert",
|
|
2759
|
+
"aria-label": message,
|
|
2760
|
+
children: message
|
|
2761
|
+
},
|
|
2762
|
+
index
|
|
2763
|
+
))
|
|
2764
|
+
] });
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
);
|
|
2768
|
+
};
|
|
2769
|
+
var ValueContainer = ({ children, ...props }) => {
|
|
2770
|
+
return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
|
|
2771
|
+
};
|
|
2772
|
+
var Radio = ({
|
|
2773
|
+
disabled,
|
|
2774
|
+
control,
|
|
2775
|
+
name,
|
|
2776
|
+
label,
|
|
2777
|
+
defaultChecked
|
|
2778
|
+
}) => {
|
|
2779
|
+
return /* @__PURE__ */ jsx(
|
|
2780
|
+
Controller,
|
|
2781
|
+
{
|
|
2782
|
+
name,
|
|
2783
|
+
control,
|
|
2784
|
+
render: ({ field }) => {
|
|
2785
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2", children: [
|
|
2786
|
+
/* @__PURE__ */ jsxs("label", { className: "custom-radio flex items-center", children: [
|
|
2787
|
+
/* @__PURE__ */ jsx(
|
|
2788
|
+
"input",
|
|
2789
|
+
{
|
|
2790
|
+
name,
|
|
2791
|
+
id: name,
|
|
2792
|
+
type: "radio",
|
|
2793
|
+
className: "",
|
|
2794
|
+
onClick: (e) => {
|
|
2795
|
+
field.onChange(e.target.value);
|
|
2796
|
+
},
|
|
2797
|
+
defaultChecked,
|
|
2798
|
+
disabled
|
|
2799
|
+
}
|
|
2800
|
+
),
|
|
2801
|
+
/* @__PURE__ */ jsx("span", {})
|
|
2802
|
+
] }),
|
|
2803
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: name, className: "text-p-md cursor-pointer -pt-1", children: label })
|
|
2804
|
+
] });
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
);
|
|
2808
|
+
};
|
|
2809
|
+
var { Group, Label } = Switch;
|
|
2810
|
+
function classNames(...classes) {
|
|
2811
|
+
return classes.filter(Boolean).join(" ");
|
|
2812
|
+
}
|
|
2813
|
+
var Toggle = ({
|
|
2814
|
+
name,
|
|
2815
|
+
label,
|
|
2816
|
+
subLabel,
|
|
2817
|
+
control,
|
|
2818
|
+
disabled
|
|
2819
|
+
}) => {
|
|
2820
|
+
return /* @__PURE__ */ jsxs(Group, { as: "div", className: "flex items-center", children: [
|
|
2821
|
+
/* @__PURE__ */ jsx(
|
|
2822
|
+
Controller,
|
|
2823
|
+
{
|
|
2824
|
+
control,
|
|
2825
|
+
name,
|
|
2826
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
2827
|
+
Switch,
|
|
2828
|
+
{
|
|
2829
|
+
disabled,
|
|
2830
|
+
...field,
|
|
2831
|
+
className: "h-[18px] w-[33px] focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-full",
|
|
2832
|
+
checked: Boolean(field.value),
|
|
2833
|
+
onChange: (value) => {
|
|
2834
|
+
field.onChange(value);
|
|
2835
|
+
},
|
|
2836
|
+
children: ({ checked }) => /* @__PURE__ */ jsx(
|
|
2837
|
+
"div",
|
|
2838
|
+
{
|
|
2839
|
+
className: classNames(
|
|
2840
|
+
checked ? "bg-blue-500" : "bg-neutral-200",
|
|
2841
|
+
"relative inline-flex h-[18px] p-[2px] w-[33px] flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out "
|
|
2842
|
+
),
|
|
2843
|
+
children: /* @__PURE__ */ jsxs(
|
|
2844
|
+
"span",
|
|
2845
|
+
{
|
|
2846
|
+
className: classNames(
|
|
2847
|
+
"pointer-events-none relative inline-block -top-[2px] right-[2px] h-[14px] w-[14px] transform rounded-full shadow ring-0 transition duration-200 ease-in-out",
|
|
2848
|
+
checked ? "translate-x-[15px]" : "translate-x-0",
|
|
2849
|
+
disabled ? "bg-neutral-300" : "bg-white"
|
|
2850
|
+
),
|
|
2851
|
+
children: [
|
|
2852
|
+
/* @__PURE__ */ jsx(
|
|
2853
|
+
"span",
|
|
2854
|
+
{
|
|
2855
|
+
className: classNames(
|
|
2856
|
+
checked ? "opacity-0 ease-out duration-100" : "opacity-100 ease-in duration-200",
|
|
2857
|
+
"absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"
|
|
2858
|
+
),
|
|
2859
|
+
"aria-hidden": "true"
|
|
2860
|
+
}
|
|
2861
|
+
),
|
|
2862
|
+
/* @__PURE__ */ jsx(
|
|
2863
|
+
"span",
|
|
2864
|
+
{
|
|
2865
|
+
className: classNames(
|
|
2866
|
+
checked ? "opacity-100 ease-in duration-200" : "opacity-0 ease-out duration-100",
|
|
2867
|
+
"absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"
|
|
2868
|
+
),
|
|
2869
|
+
"aria-hidden": "true"
|
|
2870
|
+
}
|
|
2871
|
+
)
|
|
2872
|
+
]
|
|
2873
|
+
}
|
|
2874
|
+
)
|
|
2875
|
+
}
|
|
2876
|
+
)
|
|
2877
|
+
}
|
|
2878
|
+
)
|
|
2879
|
+
}
|
|
2880
|
+
),
|
|
2881
|
+
label && /* @__PURE__ */ jsxs(Label, { as: "span", className: "flex flex-col gap-1 ml-2 cursor-pointer", children: [
|
|
2882
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-paragraph", children: label }),
|
|
2883
|
+
subLabel && /* @__PURE__ */ jsx("span", { className: "text-sm", children: subLabel })
|
|
2884
|
+
] })
|
|
2885
|
+
] });
|
|
2886
|
+
};
|
|
2887
|
+
function PaginationSelect({
|
|
2888
|
+
pageSizeOptions,
|
|
2889
|
+
table
|
|
2890
|
+
}) {
|
|
2891
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2892
|
+
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
2893
|
+
const pagesArray = pageCount ? [...Array(pageCount)] : [];
|
|
2894
|
+
const options = pagesArray == null ? void 0 : pagesArray.map((item, index) => ({
|
|
2895
|
+
id: index,
|
|
2896
|
+
name: index
|
|
2897
|
+
}));
|
|
2898
|
+
const [pageSizeSelected, setPageSizeSelected] = useState({
|
|
2899
|
+
id: ((_a = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _a.id) || 20,
|
|
2900
|
+
name: ((_b = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _b.name) || 20
|
|
2901
|
+
});
|
|
2902
|
+
const [pageSelected, setPageSelected] = useState({
|
|
2903
|
+
id: ((_d = (_c = table == null ? void 0 : table.getState()) == null ? void 0 : _c.pagination) == null ? void 0 : _d.pageIndex) || 0,
|
|
2904
|
+
name: ((_f = (_e = table == null ? void 0 : table.getState()) == null ? void 0 : _e.pagination) == null ? void 0 : _f.pageIndex) || 0
|
|
2905
|
+
});
|
|
2906
|
+
const [pagesOptions, setPagesOptions] = useState(() => options);
|
|
2907
|
+
const [pageSizesOptions, setPagesSizesOptions] = useState(
|
|
2908
|
+
pageSizeOptions == null ? void 0 : pageSizeOptions.map((item) => ({
|
|
2909
|
+
id: item,
|
|
2910
|
+
name: item
|
|
2911
|
+
}))
|
|
2912
|
+
);
|
|
2913
|
+
const [query, setQuery] = useState("");
|
|
2914
|
+
const filter = () => {
|
|
2915
|
+
let copy = [...options];
|
|
2916
|
+
setPagesOptions(
|
|
2917
|
+
copy.filter((item) => {
|
|
2918
|
+
return (item.name + 1).toString().startsWith(query);
|
|
2919
|
+
})
|
|
2920
|
+
);
|
|
2921
|
+
};
|
|
2922
|
+
const saveSessionStorage = (key, values) => {
|
|
2923
|
+
sessionStorage.setItem(key, JSON.stringify(values));
|
|
2924
|
+
};
|
|
2925
|
+
useEffect(() => {
|
|
2926
|
+
filter();
|
|
2927
|
+
}, [query]);
|
|
2928
|
+
useEffect(() => {
|
|
2929
|
+
saveSessionStorage("pageSize", pageSizeSelected);
|
|
2930
|
+
table.setPageSize(pageSizeSelected == null ? void 0 : pageSizeSelected.id);
|
|
2931
|
+
table.setPageIndex(0);
|
|
2932
|
+
setPageSelected({
|
|
2933
|
+
id: 0,
|
|
2934
|
+
name: 0
|
|
2935
|
+
});
|
|
2936
|
+
}, [pageSizeSelected]);
|
|
2937
|
+
useEffect(() => {
|
|
2938
|
+
setPagesOptions(
|
|
2939
|
+
pageCount ? [...Array(pageCount)].map((item, index) => ({
|
|
2940
|
+
id: index,
|
|
2941
|
+
name: index
|
|
2942
|
+
})) : []
|
|
2943
|
+
);
|
|
2944
|
+
}, [table == null ? void 0 : table.getPageCount()]);
|
|
2945
|
+
useEffect(() => {
|
|
2946
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2947
|
+
if (((_b2 = (_a2 = table == null ? void 0 : table.getState()) == null ? void 0 : _a2.pagination) == null ? void 0 : _b2.pageIndex) >= 0) {
|
|
2948
|
+
setPageSelected({
|
|
2949
|
+
id: (_d2 = (_c2 = table == null ? void 0 : table.getState()) == null ? void 0 : _c2.pagination) == null ? void 0 : _d2.pageIndex,
|
|
2950
|
+
name: (_f2 = (_e2 = table == null ? void 0 : table.getState()) == null ? void 0 : _e2.pagination) == null ? void 0 : _f2.pageIndex
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
}, [table == null ? void 0 : table.getState().pagination]);
|
|
2954
|
+
return /* @__PURE__ */ jsxs("div", { className: "hidden md:flex items-center gap-2", children: [
|
|
2955
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-paragraph", children: [
|
|
2956
|
+
/* @__PURE__ */ jsx("span", { children: "Exibir " }),
|
|
2957
|
+
/* @__PURE__ */ jsx(
|
|
2958
|
+
Combobox,
|
|
2959
|
+
{
|
|
2960
|
+
value: pageSizeSelected,
|
|
2961
|
+
onChange: (value) => {
|
|
2962
|
+
setPageSizeSelected(value);
|
|
2963
|
+
},
|
|
2964
|
+
children: ({ open }) => /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2965
|
+
/* @__PURE__ */ jsxs(Combobox.Button, { className: "flex items-center justify-between w-[70px] h-[42px] text-paragraph outline-none text-p-sm cursor-pointer peer relative shadow-input rounded-lg border p-2 disabled:bg-neutral-100 border-neutral-300", children: [
|
|
2966
|
+
pageSizeSelected == null ? void 0 : pageSizeSelected.name,
|
|
2967
|
+
open ? /* @__PURE__ */ jsx("i", { className: "uil uil-angle-up text-base top-[13px] pl-3 cursor-pointer text-label" }) : /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-base top-[13px] pl-3 cursor-pointer text-label" })
|
|
2968
|
+
] }),
|
|
2969
|
+
/* @__PURE__ */ jsx(Combobox.Options, { className: "w-full outline-none max-h-[200px] overflow-auto border-[0.5px] mt-1 color-neutral-300 flex flex-col gap-y-2 p-1 absolute right-0 bottom-12 z-[999] rounded-lg bg-white", children: pageSizesOptions == null ? void 0 : pageSizesOptions.map((opt) => {
|
|
2970
|
+
const selected = (opt == null ? void 0 : opt.id) === (pageSizeSelected == null ? void 0 : pageSizeSelected.id);
|
|
2971
|
+
return /* @__PURE__ */ jsx(
|
|
2972
|
+
Combobox.Option,
|
|
2973
|
+
{
|
|
2974
|
+
value: opt,
|
|
2975
|
+
className: clsx7(
|
|
2976
|
+
"p-2 rounded-lg items-center justify-center cursor-pointer flex whitespace-nowrap no-underline ",
|
|
2977
|
+
{
|
|
2978
|
+
"bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]": selected
|
|
2979
|
+
},
|
|
2980
|
+
{
|
|
2981
|
+
"hover:bg-neutral-100 text-paragraph": !selected
|
|
2982
|
+
}
|
|
2983
|
+
),
|
|
2984
|
+
children: opt.name
|
|
2985
|
+
},
|
|
2986
|
+
(pageSizeSelected == null ? void 0 : pageSizeSelected.id) + "size"
|
|
2987
|
+
);
|
|
2988
|
+
}) })
|
|
2989
|
+
] })
|
|
2990
|
+
}
|
|
2991
|
+
),
|
|
2992
|
+
/* @__PURE__ */ jsx("span", { children: " resultados" })
|
|
2993
|
+
] }),
|
|
2994
|
+
/* @__PURE__ */ jsx("div", { className: "bg-neutral-300 h-[20px] w-[1px]" }),
|
|
2995
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-paragraph", children: [
|
|
2996
|
+
/* @__PURE__ */ jsx("span", { children: "Ir para a p\xE1gina " }),
|
|
2997
|
+
/* @__PURE__ */ jsx(
|
|
2998
|
+
Combobox,
|
|
2999
|
+
{
|
|
3000
|
+
value: pageSelected,
|
|
3001
|
+
onChange: (value) => {
|
|
3002
|
+
if (value && (value == null ? void 0 : value.id)) {
|
|
3003
|
+
setPageSelected({
|
|
3004
|
+
id: value == null ? void 0 : value.id,
|
|
3005
|
+
name: value == null ? void 0 : value.id
|
|
3006
|
+
});
|
|
3007
|
+
saveSessionStorage("pageIndex", value == null ? void 0 : value.id);
|
|
3008
|
+
table.setPageIndex(value == null ? void 0 : value.id);
|
|
3009
|
+
setQuery("");
|
|
3010
|
+
}
|
|
3011
|
+
},
|
|
3012
|
+
children: ({ open }) => /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3013
|
+
/* @__PURE__ */ jsxs(Combobox.Button, { className: "relative", children: [
|
|
3014
|
+
/* @__PURE__ */ jsx(
|
|
3015
|
+
Combobox.Input,
|
|
3016
|
+
{
|
|
3017
|
+
as: "input",
|
|
3018
|
+
onKeyDown: (e) => {
|
|
3019
|
+
var _a2;
|
|
3020
|
+
const val = Number((_a2 = e.target) == null ? void 0 : _a2.value);
|
|
3021
|
+
if (e.key == "Enter" && val && val <= pageCount) {
|
|
3022
|
+
setPageSelected({
|
|
3023
|
+
id: val - 1,
|
|
3024
|
+
name: val - 1
|
|
3025
|
+
});
|
|
3026
|
+
saveSessionStorage("pageIndex", val);
|
|
3027
|
+
table.setPageIndex(val - 1);
|
|
3028
|
+
setQuery("");
|
|
3029
|
+
}
|
|
3030
|
+
},
|
|
3031
|
+
displayValue: (item) => {
|
|
3032
|
+
return pageSelected ? (pageSelected == null ? void 0 : pageSelected.id) + 1 : (item == null ? void 0 : item.id) + 1;
|
|
3033
|
+
},
|
|
3034
|
+
onChange: (e) => {
|
|
3035
|
+
if (e.target.value) {
|
|
3036
|
+
setQuery(e.target.value);
|
|
3037
|
+
}
|
|
3038
|
+
},
|
|
3039
|
+
className: "h-[42px] w-[70px] outline-none text-p-md text-paragraph cursor-pointer border-neutral-300 peer shadow-input rounded-lg border block disabled:bg-neutral-100 p-2"
|
|
3040
|
+
}
|
|
3041
|
+
),
|
|
3042
|
+
open ? /* @__PURE__ */ jsx("i", { className: "uil uil-angle-up text-base absolute top-[10px] right-2 cursor-pointer text-label" }) : /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-base absolute top-[10px] right-2 cursor-pointer text-label" })
|
|
3043
|
+
] }),
|
|
3044
|
+
/* @__PURE__ */ jsx(Combobox.Options, { className: "w-full outline-none max-h-[200px] overflow-auto border-[0.5px] mt-1 color-neutral-300 flex flex-col gap-y-2 p-1 absolute right-0 bottom-12 z-[999] rounded-lg bg-white", children: pagesOptions.map((opt) => {
|
|
3045
|
+
const selected = (opt == null ? void 0 : opt.id) === (pageSelected == null ? void 0 : pageSelected.id);
|
|
3046
|
+
return /* @__PURE__ */ jsx(
|
|
3047
|
+
Combobox.Option,
|
|
3048
|
+
{
|
|
3049
|
+
value: opt,
|
|
3050
|
+
className: clsx7(
|
|
3051
|
+
"p-2 rounded-lg items-center justify-center cursor-pointer flex whitespace-nowrap no-underline ",
|
|
3052
|
+
{
|
|
3053
|
+
"bg-blue-500 hover:bg-blue-500 hover:text-[#FFFFFF] text-[#FFFFFF]": selected
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
"hover:bg-neutral-100 text-paragraph": !selected
|
|
3057
|
+
}
|
|
3058
|
+
),
|
|
3059
|
+
children: (opt == null ? void 0 : opt.name) + 1
|
|
3060
|
+
},
|
|
3061
|
+
(pageSelected == null ? void 0 : pageSelected.id) + "page"
|
|
3062
|
+
);
|
|
3063
|
+
}) })
|
|
3064
|
+
] })
|
|
3065
|
+
}
|
|
3066
|
+
)
|
|
3067
|
+
] })
|
|
3068
|
+
] });
|
|
3069
|
+
}
|
|
3070
|
+
var Table = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3071
|
+
"table",
|
|
3072
|
+
{
|
|
3073
|
+
ref,
|
|
3074
|
+
className: clsx(
|
|
3075
|
+
"table-scroll block text-left border-separate border-spacing-0 w-full",
|
|
3076
|
+
className
|
|
3077
|
+
),
|
|
3078
|
+
onScroll: props.onScroll,
|
|
3079
|
+
...props
|
|
3080
|
+
}
|
|
3081
|
+
));
|
|
3082
|
+
Table.displayName = "Table";
|
|
3083
|
+
var TableHeader = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3084
|
+
"thead",
|
|
3085
|
+
{
|
|
3086
|
+
ref,
|
|
3087
|
+
className: clsx("w-full sticky top-0 z-[90]", className),
|
|
3088
|
+
...props
|
|
3089
|
+
}
|
|
3090
|
+
));
|
|
3091
|
+
TableHeader.displayName = "TableHeader";
|
|
3092
|
+
var TableBody = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: clsx(className), ...props }));
|
|
3093
|
+
TableBody.displayName = "TableBody";
|
|
3094
|
+
var TableFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3095
|
+
"div",
|
|
3096
|
+
{
|
|
3097
|
+
ref,
|
|
3098
|
+
className: clsx(
|
|
3099
|
+
" flex flex-col md:flex-row gap-2 md:gap-0 justify-between items-center py-4 px-6 bg-white w-full h-full border border-neutral-200 rounded-t-lg",
|
|
3100
|
+
className
|
|
3101
|
+
),
|
|
3102
|
+
...props
|
|
3103
|
+
}
|
|
3104
|
+
));
|
|
3105
|
+
TableFooter.displayName = "TableFooter";
|
|
3106
|
+
var TableRow = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className: clsx(className), ...props }));
|
|
3107
|
+
TableRow.displayName = "TableRow";
|
|
3108
|
+
var TableHead = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3109
|
+
"th",
|
|
3110
|
+
{
|
|
3111
|
+
ref,
|
|
3112
|
+
className: clsx(
|
|
3113
|
+
{
|
|
3114
|
+
"hover:bg-neutral-100": props.sortable
|
|
3115
|
+
},
|
|
3116
|
+
"text-p-md z-[50] bg-white font-normal text-neutral-700 p-4 text-left border-t border-b border-neutral-200 first:border-l last:border-r first:rounded-tl-lg first:rounded-bl-lg last:rounded-tr-lg last:rounded-br-lg",
|
|
3117
|
+
className
|
|
3118
|
+
),
|
|
3119
|
+
...props
|
|
3120
|
+
}
|
|
3121
|
+
));
|
|
3122
|
+
TableHead.displayName = "TableHead";
|
|
3123
|
+
var TableCell = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3124
|
+
"td",
|
|
3125
|
+
{
|
|
3126
|
+
ref,
|
|
3127
|
+
className: clsx(
|
|
3128
|
+
"align-middle h-[80px] border-b border-neutral-200 whitespace-nowrap py-4 px-5",
|
|
3129
|
+
className
|
|
3130
|
+
),
|
|
3131
|
+
...props
|
|
3132
|
+
}
|
|
3133
|
+
));
|
|
3134
|
+
TableCell.displayName = "TableCell";
|
|
3135
|
+
var TableCaption = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3136
|
+
"caption",
|
|
3137
|
+
{
|
|
3138
|
+
ref,
|
|
3139
|
+
className: clsx("text-default mt-4 text-sm", className),
|
|
3140
|
+
...props
|
|
3141
|
+
}
|
|
3142
|
+
));
|
|
3143
|
+
TableCaption.displayName = "TableCaption";
|
|
3144
|
+
function DataTablePagination({
|
|
3145
|
+
table,
|
|
3146
|
+
footer = /* @__PURE__ */ jsx("div", {}),
|
|
3147
|
+
totalData,
|
|
3148
|
+
selectAllOption,
|
|
3149
|
+
onSelectAll,
|
|
3150
|
+
rowsSelected,
|
|
3151
|
+
onRemoveAll,
|
|
3152
|
+
tableRef,
|
|
3153
|
+
paginationScroll,
|
|
3154
|
+
pageSizeOptions = []
|
|
3155
|
+
}) {
|
|
3156
|
+
var _a, _b, _c, _d, _e;
|
|
3157
|
+
const selectedPage = (_a = table == null ? void 0 : table.getState()) == null ? void 0 : _a.pagination.pageIndex;
|
|
3158
|
+
const results = totalData;
|
|
3159
|
+
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
3160
|
+
const limitPagePositive = ((_b = table == null ? void 0 : table.getState()) == null ? void 0 : _b.pagination.pageIndex) + 2;
|
|
3161
|
+
const limitPageNegative = ((_c = table == null ? void 0 : table.getState()) == null ? void 0 : _c.pagination.pageIndex) - 2;
|
|
3162
|
+
const pagesArray = pageCount ? [...Array(pageCount)] : [];
|
|
3163
|
+
const pageRowsCount = ((_e = (_d = table == null ? void 0 : table.getRowModel()) == null ? void 0 : _d.rows) == null ? void 0 : _e.length) || 0;
|
|
3164
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col sticky z-[90] bottom-0", children: [
|
|
3165
|
+
/* @__PURE__ */ jsx(
|
|
3166
|
+
"div",
|
|
3167
|
+
{
|
|
3168
|
+
className: "bg-none overflow-x-hidden md:overflow-x-auto overflow-y-hidden table-scroll rounded-lg relative top-[8px] -space-y-1 z-[302] h-[12px]",
|
|
3169
|
+
onScroll: (evt) => {
|
|
3170
|
+
tableRef == null ? void 0 : tableRef.current.scrollTo({
|
|
3171
|
+
left: evt.currentTarget.scrollLeft
|
|
3172
|
+
});
|
|
3173
|
+
},
|
|
3174
|
+
children: /* @__PURE__ */ jsx(
|
|
3175
|
+
"div",
|
|
3176
|
+
{
|
|
3177
|
+
style: {
|
|
3178
|
+
width: paginationScroll ? paginationScroll - 2 : 0
|
|
3179
|
+
},
|
|
3180
|
+
children: "\xA0"
|
|
3181
|
+
}
|
|
3182
|
+
)
|
|
3183
|
+
}
|
|
3184
|
+
),
|
|
3185
|
+
/* @__PURE__ */ jsxs(TableFooter, { children: [
|
|
3186
|
+
(pageSizeOptions == null ? void 0 : pageSizeOptions.length) > 0 && /* @__PURE__ */ jsx(PaginationSelect, { table, pageSizeOptions }),
|
|
3187
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row items-center justify-center md:justify-normal gap-2 md:gap-4", children: [
|
|
3188
|
+
footer,
|
|
3189
|
+
selectAllOption && /* @__PURE__ */ jsx("div", { children: rowsSelected !== totalData ? /* @__PURE__ */ jsx("div", { className: "md:border-l border-gray-300 pl-4", children: /* @__PURE__ */ jsxs(Button, { size: "xxs", onClick: onSelectAll, variant: "link", children: [
|
|
3190
|
+
"Selecionar todos os ",
|
|
3191
|
+
totalData
|
|
3192
|
+
] }) }) : /* @__PURE__ */ jsx("div", { className: "md:border-l border-gray-300 pl-4", children: /* @__PURE__ */ jsx(Button, { size: "xxs", onClick: onRemoveAll, variant: "link", children: "Desmarcar todos" }) }) })
|
|
3193
|
+
] }),
|
|
3194
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row items-center md:justify-end justify-center gap-2 flex-1", children: [
|
|
3195
|
+
/* @__PURE__ */ jsxs("span", { className: "text-p-md text-paragraph mr-1", children: [
|
|
3196
|
+
"Mostrando ",
|
|
3197
|
+
pageRowsCount,
|
|
3198
|
+
" de ",
|
|
3199
|
+
results,
|
|
3200
|
+
" resultados"
|
|
3201
|
+
] }),
|
|
3202
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3203
|
+
/* @__PURE__ */ jsx(
|
|
3204
|
+
Button,
|
|
3205
|
+
{
|
|
3206
|
+
onClick: () => table.previousPage(),
|
|
3207
|
+
disabled: !table.getCanPreviousPage(),
|
|
3208
|
+
variant: "icon",
|
|
3209
|
+
icon: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-left text-base" }),
|
|
3210
|
+
size: "xs",
|
|
3211
|
+
className: "justify-center"
|
|
3212
|
+
}
|
|
3213
|
+
),
|
|
3214
|
+
limitPageNegative >= 1 && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
3215
|
+
/* @__PURE__ */ jsx(
|
|
3216
|
+
Button,
|
|
3217
|
+
{
|
|
3218
|
+
onClick: () => table.setPageIndex(0),
|
|
3219
|
+
variant: "icon",
|
|
3220
|
+
icon: /* @__PURE__ */ jsx(
|
|
3221
|
+
"div",
|
|
3222
|
+
{
|
|
3223
|
+
style: {
|
|
3224
|
+
fontSize: "12px",
|
|
3225
|
+
color: "#393C4D"
|
|
3226
|
+
},
|
|
3227
|
+
children: 1
|
|
3228
|
+
}
|
|
3229
|
+
),
|
|
3230
|
+
size: "xs",
|
|
3231
|
+
className: "justify-center"
|
|
3232
|
+
}
|
|
3233
|
+
),
|
|
3234
|
+
limitPageNegative !== 1 && /* @__PURE__ */ jsx(
|
|
3235
|
+
Button,
|
|
3236
|
+
{
|
|
3237
|
+
disabled: true,
|
|
3238
|
+
variant: "icon",
|
|
3239
|
+
icon: /* @__PURE__ */ jsx(Fragment, { children: "..." }),
|
|
3240
|
+
size: "xs",
|
|
3241
|
+
className: "justify-center"
|
|
3242
|
+
}
|
|
3243
|
+
)
|
|
3244
|
+
] }),
|
|
3245
|
+
pagesArray.map((elem, index) => {
|
|
3246
|
+
const checkPageIndexLimit = index <= limitPagePositive && index >= limitPageNegative;
|
|
3247
|
+
const isSelectedPage = index === selectedPage;
|
|
3248
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: checkPageIndexLimit && /* @__PURE__ */ jsx(
|
|
3249
|
+
Button,
|
|
3250
|
+
{
|
|
3251
|
+
onClick: () => table.setPageIndex(index),
|
|
3252
|
+
className: "font-normal text-xs justify-center",
|
|
3253
|
+
variant: isSelectedPage ? "blue" : "icon",
|
|
3254
|
+
size: "xs",
|
|
3255
|
+
icon: /* @__PURE__ */ jsx(
|
|
3256
|
+
"div",
|
|
3257
|
+
{
|
|
3258
|
+
style: {
|
|
3259
|
+
fontSize: "12px",
|
|
3260
|
+
color: isSelectedPage ? "#FFF" : "#393C4D"
|
|
3261
|
+
},
|
|
3262
|
+
children: (index + 1).toLocaleString("pt-BR")
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
}
|
|
3266
|
+
) }, index + "pagination");
|
|
3267
|
+
}),
|
|
3268
|
+
limitPagePositive + 1 < pageCount && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
3269
|
+
limitPagePositive !== pagesArray.length - 2 && /* @__PURE__ */ jsx(
|
|
3270
|
+
Button,
|
|
3271
|
+
{
|
|
3272
|
+
disabled: true,
|
|
3273
|
+
variant: "icon",
|
|
3274
|
+
icon: /* @__PURE__ */ jsx(Fragment, { children: "..." }),
|
|
3275
|
+
size: "xs",
|
|
3276
|
+
className: "justify-center"
|
|
3277
|
+
}
|
|
3278
|
+
),
|
|
3279
|
+
/* @__PURE__ */ jsx(
|
|
3280
|
+
Button,
|
|
3281
|
+
{
|
|
3282
|
+
onClick: () => table.setPageIndex(pageCount),
|
|
3283
|
+
variant: "icon",
|
|
3284
|
+
icon: /* @__PURE__ */ jsx(
|
|
3285
|
+
"div",
|
|
3286
|
+
{
|
|
3287
|
+
style: {
|
|
3288
|
+
fontSize: "12px",
|
|
3289
|
+
color: "#393C4D"
|
|
3290
|
+
},
|
|
3291
|
+
children: pageCount.toLocaleString("pt-BR")
|
|
3292
|
+
}
|
|
3293
|
+
),
|
|
3294
|
+
size: "xs",
|
|
3295
|
+
className: "font-normal justify-center"
|
|
3296
|
+
}
|
|
3297
|
+
)
|
|
3298
|
+
] }),
|
|
3299
|
+
/* @__PURE__ */ jsx(
|
|
3300
|
+
Button,
|
|
3301
|
+
{
|
|
3302
|
+
onClick: () => table.nextPage(),
|
|
3303
|
+
disabled: !table.getCanNextPage(),
|
|
3304
|
+
variant: "icon",
|
|
3305
|
+
icon: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-right text-base" }),
|
|
3306
|
+
size: "xs",
|
|
3307
|
+
className: "justify-center"
|
|
3308
|
+
}
|
|
3309
|
+
)
|
|
3310
|
+
] })
|
|
3311
|
+
] })
|
|
3312
|
+
] })
|
|
3313
|
+
] });
|
|
3314
|
+
}
|
|
3315
|
+
var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
3316
|
+
const itemRank = rankItem(row.getValue(columnId), value);
|
|
3317
|
+
addMeta({
|
|
3318
|
+
itemRank
|
|
3319
|
+
});
|
|
3320
|
+
return itemRank.passed;
|
|
3321
|
+
};
|
|
3322
|
+
function DataTable({
|
|
3323
|
+
columns,
|
|
3324
|
+
tableClass = "",
|
|
3325
|
+
data = [],
|
|
3326
|
+
hidePagination,
|
|
3327
|
+
emptyButtonAction,
|
|
3328
|
+
hideBlankState,
|
|
3329
|
+
renderSubComponent = () => {
|
|
3330
|
+
},
|
|
3331
|
+
footer,
|
|
3332
|
+
borderFull = false,
|
|
3333
|
+
withShadow = true,
|
|
3334
|
+
actionsSelection,
|
|
3335
|
+
backgroundColor,
|
|
3336
|
+
emptyState,
|
|
3337
|
+
totalData = 0,
|
|
3338
|
+
showFilter,
|
|
3339
|
+
placeholder,
|
|
3340
|
+
fetchData,
|
|
3341
|
+
openedSubComponent = false,
|
|
3342
|
+
getRowCanExpand,
|
|
3343
|
+
enableRowSelection,
|
|
3344
|
+
onScroll,
|
|
3345
|
+
tableContainerRef,
|
|
3346
|
+
setRows,
|
|
3347
|
+
selectAllOption,
|
|
3348
|
+
autoPagination,
|
|
3349
|
+
rowClassName,
|
|
3350
|
+
listUpdate,
|
|
3351
|
+
setRowSelection,
|
|
3352
|
+
rowSelection,
|
|
3353
|
+
perPage,
|
|
3354
|
+
pageSizeOptions,
|
|
3355
|
+
onFinishFetch
|
|
3356
|
+
}) {
|
|
3357
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3358
|
+
const tableRef = useRef(null);
|
|
3359
|
+
const [columnVisibility, setColumnVisibility] = useState({});
|
|
3360
|
+
const [columnFilters, setColumnFilters] = useState([]);
|
|
3361
|
+
const [sorting, setSorting] = useState([]);
|
|
3362
|
+
const [arrRowSelected, setArrRowSelected] = useState([]);
|
|
3363
|
+
const [globalFilter, setGlobalFilter] = useState("");
|
|
3364
|
+
const [dataTable, setDataTable] = useState([]);
|
|
3365
|
+
const [loading, setLoading] = useState(true);
|
|
3366
|
+
const [expanded, setExpanded] = useState({});
|
|
3367
|
+
const [total, setTotal] = useState(() => totalData);
|
|
3368
|
+
const [{ pageIndex, pageSize }, setPagination] = useState({
|
|
3369
|
+
pageIndex: 0,
|
|
3370
|
+
pageSize: hidePagination ? 999999 : perPage ? perPage : 20
|
|
3371
|
+
});
|
|
3372
|
+
const [paginationScroll, setPaginationScroll] = useState();
|
|
3373
|
+
const pagination = useMemo(
|
|
3374
|
+
() => ({
|
|
3375
|
+
pageIndex,
|
|
3376
|
+
pageSize
|
|
3377
|
+
}),
|
|
3378
|
+
[pageIndex, pageSize]
|
|
3379
|
+
);
|
|
3380
|
+
const fetch = () => {
|
|
3381
|
+
var _a2, _b2;
|
|
3382
|
+
if (fetchData && !autoPagination) {
|
|
3383
|
+
fetchData({
|
|
3384
|
+
pageSize,
|
|
3385
|
+
pageIndex,
|
|
3386
|
+
order: (_a2 = sorting[0]) == null ? void 0 : _a2.id,
|
|
3387
|
+
orderDir: ((_b2 = sorting[0]) == null ? void 0 : _b2.desc) ? "DESC" : "ASC"
|
|
3388
|
+
}).then((response) => {
|
|
3389
|
+
setDataTable(response.rows);
|
|
3390
|
+
if (!(response == null ? void 0 : response.rows) && totalData > 0) {
|
|
3391
|
+
setPagination({
|
|
3392
|
+
pageIndex: pageIndex - 1,
|
|
3393
|
+
pageSize
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
});
|
|
3397
|
+
} else {
|
|
3398
|
+
manualPagination(pageIndex, pageSize).then((response) => {
|
|
3399
|
+
setDataTable(response.rows);
|
|
3400
|
+
if (!(response == null ? void 0 : response.rows) && totalData > 0) {
|
|
3401
|
+
setPagination({
|
|
3402
|
+
pageIndex: pageIndex - 1,
|
|
3403
|
+
pageSize
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
});
|
|
3407
|
+
}
|
|
3408
|
+
setTimeout(() => {
|
|
3409
|
+
if (onFinishFetch) {
|
|
3410
|
+
onFinishFetch();
|
|
3411
|
+
}
|
|
3412
|
+
}, 1e3);
|
|
3413
|
+
};
|
|
3414
|
+
const manualPagination = async (pageIndex2, pageSize2) => {
|
|
3415
|
+
const promise = new Promise((resolve, reject) => {
|
|
3416
|
+
let shortArrays = [], i, len;
|
|
3417
|
+
for (i = 0, len = totalData; i < len; i += pageSize2) {
|
|
3418
|
+
shortArrays.push(data == null ? void 0 : data.slice(i, i + pageSize2));
|
|
3419
|
+
}
|
|
3420
|
+
resolve(shortArrays);
|
|
3421
|
+
});
|
|
3422
|
+
let dataPromise = await promise;
|
|
3423
|
+
return {
|
|
3424
|
+
rows: dataPromise[pageIndex2],
|
|
3425
|
+
pageCount: Number(pageSize2)
|
|
3426
|
+
};
|
|
3427
|
+
};
|
|
3428
|
+
useEffect(() => {
|
|
3429
|
+
if (!(tableContainerRef == null ? void 0 : tableContainerRef.current)) return;
|
|
3430
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
3431
|
+
var _a2;
|
|
3432
|
+
setPaginationScroll((_a2 = tableContainerRef == null ? void 0 : tableContainerRef.current) == null ? void 0 : _a2.scrollWidth);
|
|
3433
|
+
});
|
|
3434
|
+
resizeObserver.observe(tableContainerRef == null ? void 0 : tableContainerRef.current);
|
|
3435
|
+
return () => resizeObserver.disconnect();
|
|
3436
|
+
}, []);
|
|
3437
|
+
useEffect(() => {
|
|
3438
|
+
if (fetchData || autoPagination) {
|
|
3439
|
+
fetch();
|
|
3440
|
+
}
|
|
3441
|
+
}, [pageIndex, pageSize, sorting]);
|
|
3442
|
+
useEffect(() => {
|
|
3443
|
+
if (totalData !== total) {
|
|
3444
|
+
setPagination({
|
|
3445
|
+
pageIndex: 0,
|
|
3446
|
+
pageSize: pagination.pageSize
|
|
3447
|
+
});
|
|
3448
|
+
setTotal(totalData);
|
|
3449
|
+
}
|
|
3450
|
+
}, [totalData]);
|
|
3451
|
+
useEffect(() => {
|
|
3452
|
+
if (data) {
|
|
3453
|
+
setDataTable(
|
|
3454
|
+
() => autoPagination ? data.slice(0, pageSize) : data
|
|
3455
|
+
);
|
|
3456
|
+
setLoading(false);
|
|
3457
|
+
}
|
|
3458
|
+
}, [data]);
|
|
3459
|
+
const pages = totalData < pagination.pageSize ? 1 : Math.ceil(totalData / pagination.pageSize);
|
|
3460
|
+
let table = useReactTable({
|
|
3461
|
+
data: (dataTable == null ? void 0 : dataTable.length) > 0 ? dataTable : [],
|
|
3462
|
+
columns,
|
|
3463
|
+
state: {
|
|
3464
|
+
sorting,
|
|
3465
|
+
columnVisibility,
|
|
3466
|
+
rowSelection,
|
|
3467
|
+
globalFilter,
|
|
3468
|
+
columnFilters,
|
|
3469
|
+
pagination,
|
|
3470
|
+
expanded
|
|
3471
|
+
},
|
|
3472
|
+
pageCount: pages,
|
|
3473
|
+
manualPagination: true,
|
|
3474
|
+
enableRowSelection,
|
|
3475
|
+
onRowSelectionChange: setRowSelection,
|
|
3476
|
+
onSortingChange: setSorting,
|
|
3477
|
+
onColumnFiltersChange: setColumnFilters,
|
|
3478
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
3479
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
3480
|
+
globalFilterFn: fuzzyFilter,
|
|
3481
|
+
getCoreRowModel: getCoreRowModel(),
|
|
3482
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
3483
|
+
// getSortedRowModel: getSortedRowModel(),
|
|
3484
|
+
getFacetedRowModel: getFacetedRowModel(),
|
|
3485
|
+
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
3486
|
+
onPaginationChange: setPagination,
|
|
3487
|
+
getRowCanExpand,
|
|
3488
|
+
onExpandedChange: setExpanded,
|
|
3489
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
3490
|
+
enableExpanding: true,
|
|
3491
|
+
getRowId: (row) => {
|
|
3492
|
+
return row.id;
|
|
3493
|
+
},
|
|
3494
|
+
meta: {
|
|
3495
|
+
getRowStyles: rowClassName
|
|
3496
|
+
}
|
|
3497
|
+
});
|
|
3498
|
+
useEffect(() => {
|
|
3499
|
+
if (enableRowSelection && rowSelection) {
|
|
3500
|
+
setArrRowSelected(Object.keys(rowSelection));
|
|
3501
|
+
}
|
|
3502
|
+
}, [rowSelection, enableRowSelection]);
|
|
3503
|
+
const onSelectAll = () => {
|
|
3504
|
+
table.toggleAllRowsSelected(true);
|
|
3505
|
+
const araysIds = data == null ? void 0 : data.map((item) => item == null ? void 0 : item.id);
|
|
3506
|
+
let selected = {};
|
|
3507
|
+
araysIds == null ? void 0 : araysIds.forEach((id) => {
|
|
3508
|
+
selected = {
|
|
3509
|
+
...selected,
|
|
3510
|
+
[id]: true
|
|
3511
|
+
};
|
|
3512
|
+
});
|
|
3513
|
+
setRowSelection(selected);
|
|
3514
|
+
return;
|
|
3515
|
+
};
|
|
3516
|
+
const onRemoveAll = () => {
|
|
3517
|
+
table.toggleAllRowsSelected();
|
|
3518
|
+
setRowSelection({});
|
|
3519
|
+
return;
|
|
3520
|
+
};
|
|
3521
|
+
const hideTableData = dataTable && (dataTable == null ? void 0 : dataTable.length) == 0 && !loading && !hideBlankState || !dataTable || ((_b = (_a = table == null ? void 0 : table.getRowModel()) == null ? void 0 : _a.rows) == null ? void 0 : _b.length) == 0;
|
|
3522
|
+
const canShowTableData = !hidePagination && totalData > 0 && table;
|
|
3523
|
+
function renderBottomTable() {
|
|
3524
|
+
var _a2;
|
|
3525
|
+
if (hideTableData && totalData !== null) {
|
|
3526
|
+
if (emptyState) {
|
|
3527
|
+
return emptyState;
|
|
3528
|
+
} else {
|
|
3529
|
+
return /* @__PURE__ */ jsx("div", {});
|
|
3530
|
+
}
|
|
3531
|
+
} else if (canShowTableData && totalData !== null) {
|
|
3532
|
+
return /* @__PURE__ */ jsx(
|
|
3533
|
+
DataTablePagination,
|
|
3534
|
+
{
|
|
3535
|
+
table,
|
|
3536
|
+
footer,
|
|
3537
|
+
totalData,
|
|
3538
|
+
tableRef: tableContainerRef,
|
|
3539
|
+
selectAllOption,
|
|
3540
|
+
onSelectAll,
|
|
3541
|
+
rowsSelected: (_a2 = Object.keys(rowSelection || {})) == null ? void 0 : _a2.length,
|
|
3542
|
+
onRemoveAll,
|
|
3543
|
+
paginationScroll,
|
|
3544
|
+
pageSizeOptions
|
|
3545
|
+
}
|
|
3546
|
+
);
|
|
3547
|
+
} else if (totalData == null) {
|
|
3548
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
useEffect(() => {
|
|
3552
|
+
if (rowSelection && Object.keys(rowSelection).length == 0) {
|
|
3553
|
+
const elements = document.getElementsByClassName("th-shadow");
|
|
3554
|
+
Object.keys(elements).forEach((index) => {
|
|
3555
|
+
var _a2, _b2;
|
|
3556
|
+
(_b2 = (_a2 = elements[index]) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.add("with-shadow");
|
|
3557
|
+
});
|
|
3558
|
+
} else if (rowSelection && Object.keys(rowSelection).length == 1) {
|
|
3559
|
+
const elements = document.getElementsByClassName("th-shadow");
|
|
3560
|
+
Object.keys(elements).forEach((index) => {
|
|
3561
|
+
var _a2, _b2;
|
|
3562
|
+
(_b2 = (_a2 = elements[index]) == null ? void 0 : _a2.classList) == null ? void 0 : _b2.remove("with-shadow");
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
}, [rowSelection]);
|
|
3566
|
+
const stylesRow = (row) => {
|
|
3567
|
+
var _a2, _b2;
|
|
3568
|
+
const tb = table;
|
|
3569
|
+
return rowClassName ? (_b2 = (_a2 = tb == null ? void 0 : tb.options) == null ? void 0 : _a2.meta) == null ? void 0 : _b2.getRowStyles(row) : {};
|
|
3570
|
+
};
|
|
3571
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col", children: [
|
|
3572
|
+
showFilter && /* @__PURE__ */ jsxs("div", { className: "w-full flex justify-between md:items-center flex-col md:flex-row gap-y-2 md:gap-y-0", children: [
|
|
3573
|
+
/* @__PURE__ */ jsx("div", { className: "w-full md:max-w-[350px]", id: "filter-table", children: /* @__PURE__ */ jsx(
|
|
3574
|
+
Input,
|
|
3575
|
+
{
|
|
3576
|
+
onChange: (e) => setGlobalFilter(e.target.value),
|
|
3577
|
+
name: "filter",
|
|
3578
|
+
value: globalFilter,
|
|
3579
|
+
icon: /* @__PURE__ */ jsx("i", { className: "uil uil-search" }),
|
|
3580
|
+
placeholder: "Buscar pedido por ID, C\xF3digo ou Cliente",
|
|
3581
|
+
clearField: true,
|
|
3582
|
+
onClear: () => setGlobalFilter("")
|
|
3583
|
+
}
|
|
3584
|
+
) }),
|
|
3585
|
+
listUpdate
|
|
3586
|
+
] }),
|
|
3587
|
+
/* @__PURE__ */ jsxs(
|
|
3588
|
+
"div",
|
|
3589
|
+
{
|
|
3590
|
+
className: clsx7("w-full flex mt-4 flex-col justify-between", {
|
|
3591
|
+
"flex-1": !hideTableData,
|
|
3592
|
+
[tableClass]: tableClass
|
|
3593
|
+
}),
|
|
3594
|
+
children: [
|
|
3595
|
+
/* @__PURE__ */ jsxs(
|
|
3596
|
+
Table,
|
|
3597
|
+
{
|
|
3598
|
+
className: clsx7(
|
|
3599
|
+
"w-full table_container z-20 overflow-x-scroll md:overflow-x-hidden"
|
|
3600
|
+
),
|
|
3601
|
+
onScroll,
|
|
3602
|
+
ref: tableContainerRef,
|
|
3603
|
+
children: [
|
|
3604
|
+
rowSelection && ((_c = Object.keys(rowSelection)) == null ? void 0 : _c.length) > 0 && actionsSelection && (dataTable == null ? void 0 : dataTable.length) > 0 && /* @__PURE__ */ jsxs("div", { className: "h-[76px] flex items-center justify-between px-4 bg-gradient-to-b from-blue-start to-blue-end rounded-lg -mb-[1px]", children: [
|
|
3605
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
3606
|
+
/* @__PURE__ */ jsxs("span", { className: "text-white text-p-lg", children: [
|
|
3607
|
+
Object.keys(rowSelection).length,
|
|
3608
|
+
" selecionado(s)"
|
|
3609
|
+
] }),
|
|
3610
|
+
actionsSelection
|
|
3611
|
+
] }),
|
|
3612
|
+
/* @__PURE__ */ jsx("button", { title: "set-row", onClick: () => setRowSelection({}), children: /* @__PURE__ */ jsx("i", { className: "uil uil-times text-white" }) })
|
|
3613
|
+
] }),
|
|
3614
|
+
/* @__PURE__ */ jsxs("div", { className: "table w-full mr-[2px]", ref: tableRef, children: [
|
|
3615
|
+
/* @__PURE__ */ jsx(TableHeader, { children: (_d = table == null ? void 0 : table.getHeaderGroups()) == null ? void 0 : _d.map((headerGroup, headerIndex) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header, index) => {
|
|
3616
|
+
var _a2, _b2, _c2;
|
|
3617
|
+
const classes = header.column.columnDef.meta;
|
|
3618
|
+
return /* @__PURE__ */ jsx(
|
|
3619
|
+
TableHead,
|
|
3620
|
+
{
|
|
3621
|
+
style: {
|
|
3622
|
+
width: header.getSize()
|
|
3623
|
+
},
|
|
3624
|
+
scope: "col",
|
|
3625
|
+
className: clsx7(
|
|
3626
|
+
{
|
|
3627
|
+
"hover:bg-neutral-100 th-shadow cursor-pointer": header.column.getCanSort(),
|
|
3628
|
+
["with-shadow"]: (arrRowSelected == null ? void 0 : arrRowSelected.length) == 0 && withShadow
|
|
3629
|
+
},
|
|
3630
|
+
classes == null ? void 0 : classes.header,
|
|
3631
|
+
classes == null ? void 0 : classes.className
|
|
3632
|
+
),
|
|
3633
|
+
children: /* @__PURE__ */ jsxs("div", { onClick: header.column.getToggleSortingHandler(), children: [
|
|
3634
|
+
header.isPlaceholder ? null : flexRender(
|
|
3635
|
+
header.column.columnDef.header,
|
|
3636
|
+
header.getContext()
|
|
3637
|
+
),
|
|
3638
|
+
((_a2 = sorting[0]) == null ? void 0 : _a2.id) == header.column.id ? /* @__PURE__ */ jsx(
|
|
3639
|
+
"i",
|
|
3640
|
+
{
|
|
3641
|
+
className: clsx7(
|
|
3642
|
+
{
|
|
3643
|
+
["rotate-0"]: !((_b2 = sorting[0]) == null ? void 0 : _b2.desc),
|
|
3644
|
+
["rotate-180"]: (_c2 = sorting[0]) == null ? void 0 : _c2.desc
|
|
3645
|
+
},
|
|
3646
|
+
"uil uil-arrow-down text-blue-500 transform ml-1 text-[18px] duration-75"
|
|
3647
|
+
)
|
|
3648
|
+
}
|
|
3649
|
+
) : /* @__PURE__ */ jsx(Fragment, {})
|
|
3650
|
+
] })
|
|
3651
|
+
},
|
|
3652
|
+
headerIndex + index + "th"
|
|
3653
|
+
);
|
|
3654
|
+
}) }, headerGroup.id + headerIndex + "header")) }),
|
|
3655
|
+
/* @__PURE__ */ jsx(TableBody, { children: (_f = (_e = table == null ? void 0 : table.getRowModel()) == null ? void 0 : _e.rows) == null ? void 0 : _f.map((row, rowIndex) => {
|
|
3656
|
+
return /* @__PURE__ */ jsx(React2__default.Fragment, { children: !row.original._destroy && /* @__PURE__ */ jsxs(React2__default.Fragment, { children: [
|
|
3657
|
+
/* @__PURE__ */ jsx(
|
|
3658
|
+
TableRow,
|
|
3659
|
+
{
|
|
3660
|
+
id: row.id,
|
|
3661
|
+
className: `text-p-md font-normal h-[80px] text-paragraph w-fit`,
|
|
3662
|
+
style: stylesRow(row),
|
|
3663
|
+
children: row.getVisibleCells().map((cell, index) => {
|
|
3664
|
+
const classes = cell.column.columnDef.meta;
|
|
3665
|
+
return /* @__PURE__ */ jsx(
|
|
3666
|
+
TableCell,
|
|
3667
|
+
{
|
|
3668
|
+
id: cell.id,
|
|
3669
|
+
style: {
|
|
3670
|
+
width: cell.column.getSize(),
|
|
3671
|
+
backgroundColor: backgroundColor ? backgroundColor : "",
|
|
3672
|
+
...stylesRow(row)
|
|
3673
|
+
},
|
|
3674
|
+
className: clsx7(
|
|
3675
|
+
{
|
|
3676
|
+
["hidden"]: cell.row.original._destroy,
|
|
3677
|
+
["first:border-l last:border-r"]: borderFull,
|
|
3678
|
+
["first:rounded-bl-lg last:rounded-br-lg"]: borderFull && row.index === (data == null ? void 0 : data.length) - 1
|
|
3679
|
+
},
|
|
3680
|
+
classes == null ? void 0 : classes.cell,
|
|
3681
|
+
classes == null ? void 0 : classes.className
|
|
3682
|
+
),
|
|
3683
|
+
children: flexRender(
|
|
3684
|
+
cell.column.columnDef.cell,
|
|
3685
|
+
cell.getContext()
|
|
3686
|
+
)
|
|
3687
|
+
},
|
|
3688
|
+
cell.id
|
|
3689
|
+
);
|
|
3690
|
+
})
|
|
3691
|
+
},
|
|
3692
|
+
row.id
|
|
3693
|
+
),
|
|
3694
|
+
(row.getIsExpanded() || openedSubComponent) && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: row.getVisibleCells().length, children: renderSubComponent({
|
|
3695
|
+
row
|
|
3696
|
+
}) }) })
|
|
3697
|
+
] }) }, rowIndex + "row");
|
|
3698
|
+
}) })
|
|
3699
|
+
] })
|
|
3700
|
+
]
|
|
3701
|
+
}
|
|
3702
|
+
),
|
|
3703
|
+
renderBottomTable()
|
|
3704
|
+
]
|
|
3705
|
+
}
|
|
3706
|
+
)
|
|
3707
|
+
] });
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
export { Badge, Button, Calendar, Checkbox, DataTable, DataTablePagination, DatePickerInput, FilterCalendar, FilterOptions, Input, InputMoney, InputNumber, InputPercentage, Logo, MaskedInput, ModalDialog, PaginationSelect, Popover3 as Popover, Radio, RocketIcon, SelectField, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer };
|
|
3711
|
+
//# sourceMappingURL=index.js.map
|
|
15
3712
|
//# sourceMappingURL=index.js.map
|