nexaas-ui-components 1.0.6
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/README.md +136 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.cts +454 -0
- package/dist/index.d.ts +454 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/package.json +104 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { JSX, DetailedHTMLProps, InputHTMLAttributes, HTMLInputTypeAttribute, ReactNode, KeyboardEventHandler, MutableRefObject } from 'react';
|
|
4
|
+
import { UseFormRegisterReturn, Merge, FieldError, FieldErrorsImpl, Control } from 'react-hook-form';
|
|
5
|
+
import { ValueContainerProps } from 'react-select';
|
|
6
|
+
import { Table as Table$1 } from '@tanstack/react-table';
|
|
7
|
+
|
|
8
|
+
type ButtonProps = React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
icon?: JSX.Element;
|
|
10
|
+
variant?: keyof typeof variants$1;
|
|
11
|
+
size?: keyof typeof sizes$1;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
loadingIcon?: JSX.Element;
|
|
14
|
+
dropdown?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const sizes$1: {
|
|
17
|
+
xxs: {
|
|
18
|
+
text: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
};
|
|
21
|
+
xs: {
|
|
22
|
+
text: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
};
|
|
25
|
+
sm: {
|
|
26
|
+
text: string;
|
|
27
|
+
icon: string;
|
|
28
|
+
};
|
|
29
|
+
md: {
|
|
30
|
+
text: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
};
|
|
33
|
+
lg: {
|
|
34
|
+
text: string;
|
|
35
|
+
icon: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const variants$1: {
|
|
39
|
+
primary: {
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
secondary: {
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
icon: {
|
|
46
|
+
text: string;
|
|
47
|
+
};
|
|
48
|
+
outline: {
|
|
49
|
+
text: string;
|
|
50
|
+
};
|
|
51
|
+
dangerOutline: {
|
|
52
|
+
text: string;
|
|
53
|
+
};
|
|
54
|
+
danger: {
|
|
55
|
+
text: string;
|
|
56
|
+
};
|
|
57
|
+
success: {
|
|
58
|
+
text: string;
|
|
59
|
+
};
|
|
60
|
+
warn: {
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
blue: {
|
|
64
|
+
text: string;
|
|
65
|
+
};
|
|
66
|
+
link: {
|
|
67
|
+
text: string;
|
|
68
|
+
};
|
|
69
|
+
iconSecondary: {
|
|
70
|
+
text: string;
|
|
71
|
+
};
|
|
72
|
+
outlineIcon: {
|
|
73
|
+
text: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
declare const Button: ({ variant, size, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
78
|
+
type InputFieldProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
79
|
+
label?: string;
|
|
80
|
+
type?: HTMLInputTypeAttribute;
|
|
81
|
+
registration?: UseFormRegisterReturn;
|
|
82
|
+
onClick?: () => void;
|
|
83
|
+
error?: Merge<FieldError, FieldErrorsImpl<any>>;
|
|
84
|
+
onBlur?: (value: Event) => void;
|
|
85
|
+
inputProps?: any;
|
|
86
|
+
icon?: JSX.Element;
|
|
87
|
+
clearField?: boolean;
|
|
88
|
+
name?: string;
|
|
89
|
+
onClear?: () => void;
|
|
90
|
+
hideInput?: boolean;
|
|
91
|
+
};
|
|
92
|
+
declare const Input: ({ label, type, registration, onClick, error, onBlur, inputProps, icon, clearField, name, required, disabled, value, placeholder, defaultValue, onKeyUp, onKeyDown, onClear, hideInput, onChange, ref, }: InputFieldProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
94
|
+
declare const Logo: React__default.FC<{
|
|
95
|
+
className?: string;
|
|
96
|
+
}>;
|
|
97
|
+
|
|
98
|
+
declare const SpinnerIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
99
|
+
|
|
100
|
+
declare const RocketIcon: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
|
|
101
|
+
|
|
102
|
+
interface Props$6 {
|
|
103
|
+
icon?: JSX.Element;
|
|
104
|
+
label: string;
|
|
105
|
+
registration?: UseFormRegisterReturn;
|
|
106
|
+
error?: FieldError;
|
|
107
|
+
inputProps?: any;
|
|
108
|
+
clearField?: boolean;
|
|
109
|
+
control: Control<unknown>;
|
|
110
|
+
name: string | never;
|
|
111
|
+
required?: boolean;
|
|
112
|
+
defaultValue?: any;
|
|
113
|
+
onChangeFunction?: (e: any) => void;
|
|
114
|
+
maxDate?: any;
|
|
115
|
+
minDate?: any;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
small?: boolean;
|
|
118
|
+
onClear?: () => void;
|
|
119
|
+
popoverOffset?: [number, number];
|
|
120
|
+
}
|
|
121
|
+
declare const DatePickerInput: React.ForwardRefExoticComponent<Props$6 & React.RefAttributes<unknown>>;
|
|
122
|
+
|
|
123
|
+
type BadgeProps = {
|
|
124
|
+
variant?: keyof typeof variants;
|
|
125
|
+
children?: ReactNode | JSX.Element;
|
|
126
|
+
className?: string;
|
|
127
|
+
style?: any;
|
|
128
|
+
};
|
|
129
|
+
declare const variants: {
|
|
130
|
+
success: string;
|
|
131
|
+
warning: string;
|
|
132
|
+
blue: string;
|
|
133
|
+
gray: string;
|
|
134
|
+
dangerous: string;
|
|
135
|
+
light: string;
|
|
136
|
+
white: string;
|
|
137
|
+
primary: string;
|
|
138
|
+
dark: string;
|
|
139
|
+
outline: string;
|
|
140
|
+
"dark-gray": string;
|
|
141
|
+
};
|
|
142
|
+
declare const Badge: ({ variant, children, className, style, }: BadgeProps) => react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
interface Props$5 {
|
|
145
|
+
registration?: UseFormRegisterReturn;
|
|
146
|
+
error?: FieldError;
|
|
147
|
+
control: Control<any>;
|
|
148
|
+
name: string | never;
|
|
149
|
+
rangeCalendar?: boolean;
|
|
150
|
+
shortcutsChange?: (e: any) => void;
|
|
151
|
+
selectedShortcut?: number | null;
|
|
152
|
+
setSelectedShortcut?: (e: any) => void;
|
|
153
|
+
maxDate?: Date;
|
|
154
|
+
singleMonth?: boolean;
|
|
155
|
+
}
|
|
156
|
+
declare const Calendar: ({ registration, error, control, name, rangeCalendar, shortcutsChange, selectedShortcut, setSelectedShortcut, maxDate, singleMonth, }: Props$5) => react_jsx_runtime.JSX.Element;
|
|
157
|
+
|
|
158
|
+
type CheckboxProps = {
|
|
159
|
+
key?: string;
|
|
160
|
+
label?: string;
|
|
161
|
+
registration?: UseFormRegisterReturn;
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
};
|
|
164
|
+
declare const Checkbox: ({ key, label, registration, disabled, }: CheckboxProps) => react_jsx_runtime.JSX.Element;
|
|
165
|
+
|
|
166
|
+
interface Props$4 {
|
|
167
|
+
icon?: JSX.Element;
|
|
168
|
+
label?: string;
|
|
169
|
+
onApply?: () => void;
|
|
170
|
+
onClear?: () => void;
|
|
171
|
+
control: Control;
|
|
172
|
+
name: string;
|
|
173
|
+
rangeCalendar?: boolean;
|
|
174
|
+
defaultShortcut?: number | null;
|
|
175
|
+
shortcutsChange?: (e: any) => void;
|
|
176
|
+
singleMonth?: boolean;
|
|
177
|
+
maxDate?: Date | undefined;
|
|
178
|
+
}
|
|
179
|
+
declare const FilterCalendar: ({ icon, label, onApply, onClear, control, name, rangeCalendar, defaultShortcut, shortcutsChange, singleMonth, maxDate, }: Props$4) => react_jsx_runtime.JSX.Element;
|
|
180
|
+
|
|
181
|
+
interface Options {
|
|
182
|
+
id: any;
|
|
183
|
+
label: any;
|
|
184
|
+
description?: any;
|
|
185
|
+
disabled?: boolean;
|
|
186
|
+
icon?: JSX.Element;
|
|
187
|
+
}
|
|
188
|
+
interface Props$3 {
|
|
189
|
+
icon?: JSX.Element;
|
|
190
|
+
label?: string;
|
|
191
|
+
isMulti?: boolean;
|
|
192
|
+
options: Options[];
|
|
193
|
+
onApply?: () => void;
|
|
194
|
+
onClear?: () => void;
|
|
195
|
+
onSelectAll?: () => void;
|
|
196
|
+
control: Control;
|
|
197
|
+
name: string;
|
|
198
|
+
fetch?: (value: string | number, button: string) => Promise<Options[]>;
|
|
199
|
+
subFilters?: {
|
|
200
|
+
id: string | any;
|
|
201
|
+
name: string;
|
|
202
|
+
}[];
|
|
203
|
+
emptyMessage?: string;
|
|
204
|
+
initialMessage?: string;
|
|
205
|
+
applyOnClick?: boolean;
|
|
206
|
+
showFilter?: boolean;
|
|
207
|
+
}
|
|
208
|
+
declare const FilterOptions: ({ icon, label, isMulti, options, onApply, onClear, onSelectAll, control, name, fetch, subFilters, emptyMessage, initialMessage, applyOnClick, showFilter, }: Props$3) => react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
type InputMoneyProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
211
|
+
label?: string;
|
|
212
|
+
type?: HTMLInputTypeAttribute;
|
|
213
|
+
control: any;
|
|
214
|
+
onClick?: any;
|
|
215
|
+
error?: Merge<FieldError, FieldErrorsImpl<any>>;
|
|
216
|
+
onBlur?: (value: any) => void;
|
|
217
|
+
onChangeValue?: (e: any) => void;
|
|
218
|
+
inputProps?: any;
|
|
219
|
+
icon?: JSX.Element;
|
|
220
|
+
clearField?: boolean;
|
|
221
|
+
name?: string;
|
|
222
|
+
isWeightField?: boolean;
|
|
223
|
+
minFractionDigits?: number;
|
|
224
|
+
};
|
|
225
|
+
declare const InputMoney: React__default.ForwardRefExoticComponent<Omit<InputMoneyProps, "ref"> & React__default.RefAttributes<unknown>>;
|
|
226
|
+
|
|
227
|
+
type InputNumberProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
228
|
+
label?: string;
|
|
229
|
+
type?: HTMLInputTypeAttribute;
|
|
230
|
+
control: any;
|
|
231
|
+
onClick?: any;
|
|
232
|
+
error?: Merge<FieldError, FieldErrorsImpl<any>>;
|
|
233
|
+
onBlur?: any;
|
|
234
|
+
onChangeValue?: (e: any) => void;
|
|
235
|
+
inputProps?: any;
|
|
236
|
+
icon?: JSX.Element;
|
|
237
|
+
clearField?: boolean;
|
|
238
|
+
name?: string;
|
|
239
|
+
hideArrows?: boolean;
|
|
240
|
+
onlyNumbers?: boolean;
|
|
241
|
+
showZero?: boolean;
|
|
242
|
+
maxValue?: number;
|
|
243
|
+
};
|
|
244
|
+
declare function InputNumber({ label, type, onClick, error, onBlur, onChangeValue, inputProps, icon, clearField, name, required, disabled, value, placeholder, control, defaultValue, hideArrows, maxLength, onlyNumbers, showZero, maxValue, }: InputNumberProps): react_jsx_runtime.JSX.Element;
|
|
245
|
+
declare namespace InputNumber {
|
|
246
|
+
var displayName: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
type InputPercentageProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
250
|
+
label?: string;
|
|
251
|
+
control: any;
|
|
252
|
+
onClick?: any;
|
|
253
|
+
error?: FieldError;
|
|
254
|
+
onBlur?: any;
|
|
255
|
+
onChange?: any;
|
|
256
|
+
inputProps?: any;
|
|
257
|
+
icon?: JSX.Element;
|
|
258
|
+
clearField?: boolean;
|
|
259
|
+
name?: string;
|
|
260
|
+
maskChar?: string;
|
|
261
|
+
minFractionDigits?: number;
|
|
262
|
+
onChangeValue?: (e: any) => void;
|
|
263
|
+
};
|
|
264
|
+
declare function InputPercentage({ label, onClick, error, onBlur, inputProps, icon, clearField, name, required, disabled, placeholder, control, defaultValue, minFractionDigits, onChangeValue, maxLength, }: InputPercentageProps): react_jsx_runtime.JSX.Element;
|
|
265
|
+
declare namespace InputPercentage {
|
|
266
|
+
var displayName: string;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
type MaskedInputProps = {
|
|
270
|
+
label: string;
|
|
271
|
+
placeholder?: string;
|
|
272
|
+
type?: HTMLInputTypeAttribute;
|
|
273
|
+
error?: Merge<FieldError, FieldErrorsImpl<any>>;
|
|
274
|
+
mask?: string;
|
|
275
|
+
control: any;
|
|
276
|
+
name: string;
|
|
277
|
+
required?: boolean;
|
|
278
|
+
onKeyUp?: KeyboardEventHandler<HTMLInputElement>;
|
|
279
|
+
maskChar?: string;
|
|
280
|
+
alwaysShowMask?: boolean;
|
|
281
|
+
defaultValue?: any;
|
|
282
|
+
disabled?: boolean;
|
|
283
|
+
};
|
|
284
|
+
declare const MaskedInput: ({ type, name, label, placeholder, error, mask, control, required, onKeyUp, maskChar, alwaysShowMask, defaultValue, disabled, }: MaskedInputProps) => react_jsx_runtime.JSX.Element;
|
|
285
|
+
|
|
286
|
+
type ModalProps = {
|
|
287
|
+
open?: boolean;
|
|
288
|
+
onOpen?: () => void;
|
|
289
|
+
onClose?: () => void;
|
|
290
|
+
onCancel?: () => void;
|
|
291
|
+
triggerButton?: React__default.ReactElement;
|
|
292
|
+
confirmButton?: React__default.ReactElement;
|
|
293
|
+
title?: string | React__default.ReactElement;
|
|
294
|
+
cancelButton?: React__default.ReactElement;
|
|
295
|
+
icon?: JSX.Element;
|
|
296
|
+
alertType?: keyof typeof alertTypes;
|
|
297
|
+
size?: keyof typeof sizes;
|
|
298
|
+
info?: React__default.ReactElement;
|
|
299
|
+
description?: string;
|
|
300
|
+
children?: ReactNode;
|
|
301
|
+
};
|
|
302
|
+
declare const alertTypes: {
|
|
303
|
+
success: string;
|
|
304
|
+
error: string;
|
|
305
|
+
warning: string;
|
|
306
|
+
info: string;
|
|
307
|
+
primary: string;
|
|
308
|
+
};
|
|
309
|
+
declare const sizes: {
|
|
310
|
+
xs: string;
|
|
311
|
+
sm: string;
|
|
312
|
+
md: string;
|
|
313
|
+
lg: string;
|
|
314
|
+
null: string;
|
|
315
|
+
};
|
|
316
|
+
declare const ModalDialog: ({ open, onOpen, onClose, onCancel, triggerButton, confirmButton, title, cancelButton, icon, alertType, size, info, description, children, }: ModalProps) => react_jsx_runtime.JSX.Element;
|
|
317
|
+
|
|
318
|
+
interface Props$2 {
|
|
319
|
+
id: string;
|
|
320
|
+
displayArrow?: boolean;
|
|
321
|
+
openOnClick?: boolean;
|
|
322
|
+
}
|
|
323
|
+
declare const Popover: ({ id, displayArrow, openOnClick, }: Props$2) => react_jsx_runtime.JSX.Element;
|
|
324
|
+
|
|
325
|
+
type OptionType = {
|
|
326
|
+
value: number | string;
|
|
327
|
+
label: string;
|
|
328
|
+
};
|
|
329
|
+
type SelectFieldProps = {
|
|
330
|
+
name: string;
|
|
331
|
+
label?: string;
|
|
332
|
+
defaultValue?: any;
|
|
333
|
+
control?: any;
|
|
334
|
+
placeholder?: string;
|
|
335
|
+
isSearchable?: boolean;
|
|
336
|
+
onChange?: any;
|
|
337
|
+
required?: boolean;
|
|
338
|
+
isClearable?: boolean;
|
|
339
|
+
filterOptions?: (value: any) => any;
|
|
340
|
+
debounce?: number;
|
|
341
|
+
error?: Merge<FieldError, FieldErrorsImpl<any>>;
|
|
342
|
+
optionsList?: any;
|
|
343
|
+
disabled?: boolean;
|
|
344
|
+
onChangeValue?: (value: any) => void;
|
|
345
|
+
resize?: boolean;
|
|
346
|
+
optionStyle?: (option: any) => void;
|
|
347
|
+
valueStyle?: (option: any) => void;
|
|
348
|
+
icon?: JSX.Element;
|
|
349
|
+
emptyMessage?: string;
|
|
350
|
+
small?: boolean;
|
|
351
|
+
};
|
|
352
|
+
declare const SelectField: ({ name, error, label, defaultValue, control, placeholder, isSearchable, isClearable, onChange, required, debounce, filterOptions, optionsList, disabled, onChangeValue, resize, optionStyle, valueStyle, icon, emptyMessage, small, }: SelectFieldProps) => react_jsx_runtime.JSX.Element;
|
|
353
|
+
declare const ValueContainer: ({ children, ...props }: ValueContainerProps) => react_jsx_runtime.JSX.Element;
|
|
354
|
+
|
|
355
|
+
interface Props$1 {
|
|
356
|
+
disabled?: boolean;
|
|
357
|
+
control: Control<any>;
|
|
358
|
+
name: string;
|
|
359
|
+
label?: string;
|
|
360
|
+
defaultChecked?: boolean;
|
|
361
|
+
}
|
|
362
|
+
declare const Radio: ({ disabled, control, name, label, defaultChecked, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
363
|
+
|
|
364
|
+
type ToggleProps = {
|
|
365
|
+
name: string;
|
|
366
|
+
label?: string;
|
|
367
|
+
subLabel?: string;
|
|
368
|
+
control: Control<any>;
|
|
369
|
+
disabled?: boolean;
|
|
370
|
+
};
|
|
371
|
+
declare const Toggle: ({ name, label, subLabel, control, disabled, }: ToggleProps) => react_jsx_runtime.JSX.Element;
|
|
372
|
+
|
|
373
|
+
interface Props<TData> {
|
|
374
|
+
pageSizeOptions?: number[];
|
|
375
|
+
table: Table$1<TData>;
|
|
376
|
+
}
|
|
377
|
+
declare function PaginationSelect<TData>({ pageSizeOptions, table, }: Props<TData>): react_jsx_runtime.JSX.Element;
|
|
378
|
+
|
|
379
|
+
type CustomTData = {
|
|
380
|
+
_destroy?: string;
|
|
381
|
+
};
|
|
382
|
+
interface DataTableProps<TData extends CustomTData, TValue> {
|
|
383
|
+
tableContainerRef: MutableRefObject<any>;
|
|
384
|
+
columns: any[];
|
|
385
|
+
data?: any[];
|
|
386
|
+
searchKey?: string;
|
|
387
|
+
tableCTA?: React__default.ReactNode;
|
|
388
|
+
isLoading?: boolean;
|
|
389
|
+
onScroll?: any;
|
|
390
|
+
CTA?: React__default.ReactNode;
|
|
391
|
+
hidePagination?: boolean;
|
|
392
|
+
emptyButtonAction?: JSX.Element;
|
|
393
|
+
hideBlankState?: boolean;
|
|
394
|
+
getRowCanExpand?: () => boolean;
|
|
395
|
+
enableRowSelection?: () => boolean;
|
|
396
|
+
renderSubComponent?: (row: any) => any;
|
|
397
|
+
footer?: JSX.Element;
|
|
398
|
+
borderFull?: boolean;
|
|
399
|
+
withShadow?: boolean;
|
|
400
|
+
actionsSelection?: JSX.Element;
|
|
401
|
+
rowSelection?: any;
|
|
402
|
+
setRowSelection?: any;
|
|
403
|
+
hideHeader?: boolean;
|
|
404
|
+
backgroundColor?: string;
|
|
405
|
+
emptyState?: JSX.Element;
|
|
406
|
+
totalData?: number;
|
|
407
|
+
showFilter?: boolean;
|
|
408
|
+
placeholder?: string;
|
|
409
|
+
fetchData?: (options: {
|
|
410
|
+
pageIndex: number;
|
|
411
|
+
pageSize: number;
|
|
412
|
+
order?: string;
|
|
413
|
+
orderDir?: "ASC" | "DESC";
|
|
414
|
+
}) => Promise<{
|
|
415
|
+
rows: TData[];
|
|
416
|
+
pageCount: number;
|
|
417
|
+
}>;
|
|
418
|
+
openedSubComponent?: boolean;
|
|
419
|
+
setRows?: (e: any) => void;
|
|
420
|
+
selectAllOption?: boolean;
|
|
421
|
+
autoPagination?: boolean;
|
|
422
|
+
tableClass?: string;
|
|
423
|
+
rowClassName?: (row: any) => any;
|
|
424
|
+
listUpdate?: JSX.Element;
|
|
425
|
+
perPage?: number;
|
|
426
|
+
pageSizeOptions?: number[];
|
|
427
|
+
onFinishFetch?: () => void;
|
|
428
|
+
}
|
|
429
|
+
declare function DataTable<TData extends CustomTData, TValue>({ columns, tableClass, data, hidePagination, emptyButtonAction, hideBlankState, renderSubComponent, footer, borderFull, withShadow, actionsSelection, backgroundColor, emptyState, totalData, showFilter, placeholder, fetchData, openedSubComponent, getRowCanExpand, enableRowSelection, onScroll, tableContainerRef, setRows, selectAllOption, autoPagination, rowClassName, listUpdate, setRowSelection, rowSelection, perPage, pageSizeOptions, onFinishFetch, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
430
|
+
|
|
431
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
432
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
433
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
434
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
435
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
436
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
437
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
438
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
439
|
+
|
|
440
|
+
interface DataTablePaginationProps<TData> {
|
|
441
|
+
table: Table$1<TData>;
|
|
442
|
+
footer?: JSX.Element;
|
|
443
|
+
totalData?: number;
|
|
444
|
+
selectAllOption?: boolean;
|
|
445
|
+
onSelectAll?: (value: any) => void;
|
|
446
|
+
onRemoveAll?: (value: any) => void;
|
|
447
|
+
rowsSelected?: number;
|
|
448
|
+
tableRef?: MutableRefObject<HTMLDivElement>;
|
|
449
|
+
paginationScroll?: number;
|
|
450
|
+
pageSizeOptions?: number[];
|
|
451
|
+
}
|
|
452
|
+
declare function DataTablePagination<TData>({ table, footer, totalData, selectAllOption, onSelectAll, rowsSelected, onRemoveAll, tableRef, paginationScroll, pageSizeOptions, }: DataTablePaginationProps<TData>): react_jsx_runtime.JSX.Element;
|
|
453
|
+
|
|
454
|
+
export { Badge, Button, Calendar, Checkbox, type CheckboxProps, DataTable, DataTablePagination, DatePickerInput, FilterCalendar, FilterOptions, Input, InputMoney, InputNumber, InputPercentage, Logo, MaskedInput, ModalDialog, type ModalProps, type OptionType, PaginationSelect, Popover, Radio, RocketIcon, SelectField, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{jsx as Wt,jsxs as va}from"react/jsx-runtime";var $t=e=>va("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Wt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),Wt("path",{className:"opacity-75",fill:"currentColor",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"})]});import{Fragment as Na,jsx as tt,jsxs as Ca}from"react/jsx-runtime";var ya={xxs:{text:"h-[18px]",icon:"text-[16px]"},xs:{text:"h-8 min-w-8 max-w-20",icon:"text-[16px]"},sm:{text:"h-[32px]",icon:"text-[14px]"},md:{text:"h-[38px]",icon:"text-[20px]"},lg:{text:"h-[46px]",icon:"text-[20px]"}},wa={primary:{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]"},secondary:{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"},icon:{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"},outline:{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"},dangerOutline:{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"},danger:{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"},success:{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"},warn:{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"},blue:{text:"shadow-button bg-blue-500 text-white text-bold"},link:{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"},iconSecondary:{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"},outlineIcon:{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"}},Ut={xxs:{normal:"",icon:""},xs:{normal:"p-2",icon:"p-2"},sm:{normal:"px-3 py-[6px]",icon:"py-[6px] pl-2 pr-3"},md:{normal:"py-2 px-4",icon:"py-2 pl-3 pr-4"},lg:{normal:"py-3 px-4",icon:"p-3 pr-4"}},J=({variant:e="primary",size:t="lg",...a})=>{let i=a.icon&&a.children,g=wa[e].text,s=ya[t],y=a.icon?Ut[t].icon:Ut[t].normal,d=i?"gap-[6px]":"gap-0";return tt("button",{type:a.type,id:"button-component",...a,disabled:a.disabled||a.loading,className:`
|
|
2
|
+
${a.className}
|
|
3
|
+
${g}
|
|
4
|
+
${s.text}
|
|
5
|
+
${y}
|
|
6
|
+
${d}
|
|
7
|
+
whitespace-nowrap group rounded-lg font-bold disabled:shadow-none active:shadow-none flex items-center
|
|
8
|
+
`,children:Ca(Na,{children:[a.icon&&tt("div",{className:`flex items-center justify-center ${s.icon}`,children:a.icon&&!a.loading?a.icon:a.loadingIcon&&a.loading?a.loadingIcon:tt($t,{className:"animate-spin"})}),a.children,a.dropdown&&tt("i",{className:"uil uil-angle-down text-[18px]"})]})})};import Ve from"clsx";import{jsx as Ce,jsxs as pt}from"react/jsx-runtime";var at=({label:e,type:t,registration:a,onClick:i,error:g,onBlur:s,inputProps:y,icon:d,clearField:w,name:T,required:x,disabled:R,value:h,placeholder:c,defaultValue:f,onKeyUp:S,onKeyDown:u,onClear:v,hideInput:D,onChange:k,ref:b})=>{let n=[g==null?void 0:g.message],N=n.some(I=>I!==void 0),r={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 ${e?"pt-[22px]":"pt-[10px]"}
|
|
9
|
+
${N?"":"border-neutral-300"}`,icon:`absolute bg-neutral-100 h-[44px] top-[1px] left-[1.5px] w-[38px] rounded-l-lg text-[20px] ${N?"text-dangerous-500":"text-label peer-focus:text-blue-500"} peer-focus:border-blue-500`,rightIcon:"absolute h-[44px] top-[1px] right-[1.5px] w-[38px] text-[22px]",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",clear:"absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]",error:"border-dangerous-500 text-dangerous-500"},o={inputWithIcon:{paddingLeft:"48px"},labelWithIcon:{left:"3rem"}},m=T?document==null?void 0:document.getElementById(T):null;return pt("div",{className:"relative",children:[pt("div",{className:"relative outline-none",children:[Ce("input",{id:T,type:t,name:T,value:h,defaultValue:f,style:!e&&c&&d||d?o.inputWithIcon:void 0,className:Ve({[r.error]:N,[r.input]:!0,"pr-10":w,"pr-2":!w}),placeholder:!e&&c?c:" ",onChange:k,onBlur:s,onClick:i,disabled:R,ref:b,...y,...a,onKeyUp:S,onKeyDown:u}),d&&Ce("div",{className:Ve(r.icon,"flex justify-center items-center"),children:d}),D&&Ce("div",{className:Ve(r.rightIcon,"flex justify-center items-center"),children:Ce("i",{className:"uil uil-eye text-label cursor-pointer text-[20px]"})}),pt("label",{style:d?o.labelWithIcon:void 0,className:Ve({[r.label]:!0,"left-2.5":!d},"cursor-text whitespace-nowrap text-ellipsis overflow-hidden pointer-events-none"),htmlFor:T,children:[e,x&&e&&Ce("strong",{className:"text-dangerous-500",children:"\xA0*"})]}),w&&h&&h!==""&&!R&&Ce("i",{className:Ve({[r.clear]:!0},"uil uil-times clear-icon"),onClick:()=>{m&&(m==null||m.focus()),v&&v()}})]}),n.map((I,L)=>Ce("div",{className:"text-dangerous-500 text-p-xs mt-1 ml-[2px]",role:"alert","aria-label":I,children:I},L))]})};var Kt='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';import{jsx as Ra}from"react/jsx-runtime";var bn=({className:e})=>Ra("img",{src:Kt,alt:"Logo",className:e,width:100,height:100});import{jsx as Je,jsxs as Sa}from"react/jsx-runtime";var hn=e=>Sa("svg",{width:"800px",height:"800px",viewBox:"0 0 1024 1024",className:"icon",version:"1.1",style:e.style,xmlns:"http://www.w3.org/2000/svg",children:[Je("path",{d:"M512 301.2m-10 0a10 10 0 1 0 20 0 10 10 0 1 0-20 0Z",fill:"#E73B37"}),Je("path",{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",fill:"#39393A"}),Je("path",{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",fill:"#E73B37"}),Je("path",{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",fill:"#39393A"}),Je("path",{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",fill:"#E73B37"})]});import{DateInput3 as Ea}from"@blueprintjs/datetime2";import{forwardRef as ka,useState as mt,useRef as Pa,useEffect as Ia}from"react";import{Controller as Fa}from"react-hook-form";import{create as Da}from"zustand";var ot=Da(e=>({field:{},addValidationError:t=>e(a=>{let i={};return t==null||t.forEach(({position:g,path:s,code:y,message:d})=>{s==null||s.shift(),g!==null&&(s==null||s.splice(1,0,g==null?void 0:g.toString()));let w=s.join(".").replace(".","");i={...i,[w]:{code:y,message:d}}}),{...a,field:{...i}}}),dismissAllValidationErrors:()=>e(t=>({field:{}}))}));import gt from"clsx";import{format as Ma,parse as La}from"date-fns";import{jsx as Ie,jsxs as bt}from"react/jsx-runtime";var Hn=ka(({icon:e,label:t,registration:a,error:i,inputProps:g,clearField:s,control:y,name:d,required:w,defaultValue:T,onChangeFunction:x,maxDate:R,minDate:h,disabled:c,small:f,onClear:S,popoverOffset:u},v)=>{var G;let[D,k]=mt(!1),[b,n]=mt(!1),[N,r]=mt(0),o=Pa(null),m="dd/MM/yyyy";Ia(()=>{let l=()=>{o.current&&r(o.current.offsetWidth+10)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);let I=u||[N||250,-46],H=[(G=ot(l=>l.field)[d||(a==null?void 0:a.name)])==null?void 0:G.message,i==null?void 0:i.message],M={input:"text-p-md border rounded block pb-[10px] h-[46px] w-full disabled:bg-light-gray-100 ",icon:`absolute bg-light-gray-100 h-[44px] w-[38px] top-[1px] left-[1px] rounded-l-lg rounded-r-none ${H.some(l=>l!==void 0)?"text-dangerous-700":"text-label"}`,label:"absolute text-label text-sm",error:"border-dangerous-700 text-dangerous-700",clear:"absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]"},z=d?document==null?void 0:document.getElementById(d):null;return bt("div",{children:[Ie(Fa,{control:y,name:d,render:({field:l})=>bt("div",{id:"group-input-calendar",className:"relative",ref:A=>{o.current=A,typeof v=="function"?v(A):v&&(v.current=A)},style:{"--popover-offset-x":`${I[0]}px`,"--popover-offset-y":"-100px"},children:[e&&Ie("div",{id:"icon",className:gt(M.icon,"flex justify-center items-center text-[20px] bg-gray-100"),children:e}),Ie(Ea,{outOfRangeMessage:"Data n\xE3o permitida",invalidDateMessage:"Data inv\xE1lida",onError:()=>k(!0),defaultValue:l.value,inputProps:{className:M.input,style:{height:"46px"}},popoverProps:{placement:"bottom",usePortal:!1,minimal:!0,popoverClassName:"date-picker-popover"},disabled:c,onChange:(A,de)=>{de&&(l.onChange(A),n(!1),x&&x(A),k(!1))},value:l.value,locale:"pt",highlightCurrentDay:!0,formatDate:A=>Ma(A,m),parseDate:A=>La(A,m,new Date),maxDate:R,minDate:h}),bt("label",{className:gt("pointer-events-none ",M.label,`
|
|
10
|
+
${l.value&&l.value[0]!==null||D?" scale-75 -translate-y-3 ":""}
|
|
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:gt({[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 Ha from"clsx";import{jsx as Aa}from"react/jsx-runtime";var Ba={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"},zn=({variant:e="blue",children:t,className:a,style:i})=>Aa("span",{className:Ha({[Ba[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 Oa,DateRangePicker3 as za}from"@blueprintjs/datetime2";import{Controller as Va}from"react-hook-form";import{set as X,sub as te,startOfWeek as Gt,endOfWeek as Ja,startOfMonth as xt,endOfMonth as ja,subYears as Xa}from"date-fns";import{jsx as je,jsxs as Wa}from"react/jsx-runtime";var Gn=({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:[Gt(new Date),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Semana passada",dateRange:[Gt(te(new Date,{days:7})),Ja(te(new Date,{days:7}))]},{label:"Este M\xEAs",dateRange:[xt(new Date),X(new Date,{hours:23,minutes:59,seconds:59})]},{label:"M\xEAs passado",dateRange:[xt(te(new Date,{months:1})),ja(te(new Date,{months:1}))]},{label:"\xDAltimos 6 meses",dateRange:[xt(te(new Date,{months:6})),X(new Date,{hours:23,minutes:59,seconds:59}),,]}];return Wa("div",{children:[je(Va,{control:a,name:i,render:({field:{onChange:h,value:c}})=>je("div",{id:"group-input-calendar",className:"relative",children:g?je(za,{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:Xa(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(Oa,{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 $a from"clsx";import{jsx as Xe,jsxs as Ua}from"react/jsx-runtime";var Zn=({key:e="",label:t,registration:a,disabled:i})=>Xe("div",{children:Ua("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:$a("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 Ka,useState as ft}from"react";import{Controller as Ga}from"react-hook-form";import{Popover as qa,PopoverButton as _a,PopoverPanel as Ya}from"@headlessui/react";import We from"clsx";import{Float as ht}from"@headlessui-float/react";import{format as Za}from"date-fns";import{set as W,sub as ae,startOfWeek as qt,endOfWeek as Qa,startOfMonth as vt,endOfMonth as eo,subYears as to}from"date-fns";import{DatePicker3 as ao,DateRangePicker3 as oo}from"@blueprintjs/datetime2";import{jsx as q,jsxs as nt}from"react/jsx-runtime";var pr=({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]=ft([]),[f,S]=ft(""),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:[qt(new Date),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"Semana passada",dateRange:[qt(ae(new Date,{days:7})),Qa(ae(new Date,{days:7}))]},{label:"Este M\xEAs",dateRange:[vt(new Date),W(new Date,{hours:23,minutes:59,seconds:59})]},{label:"M\xEAs passado",dateRange:[vt(ae(new Date,{months:1})),eo(ae(new Date,{months:1}))]},{label:"\xDAltimos 6 meses",dateRange:[vt(ae(new Date,{months:6})),W(new Date,{hours:23,minutes:59,seconds:59}),,]}],[D,k]=ft(d||v[0]),b=q("div",{id:"group-input-calendar",className:"relative",children:y?q(oo,{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:to(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(ao,{onChange:n=>{c(n)},value:h,highlightCurrentDay:!0,locale:"pt"})});return q(Ga,{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(qa,{className:We({"w-full":u},"relative text-paragraph"),children:({open:o})=>{var m,I;return nt(ht,{composable:!0,shift:8,zIndex:99,offset:2,children:[q(ht.Reference,{children:q(_a,{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?Za(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(ht.Content,{children:q(Ya,{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 Ka(()=>{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 so,useEffect as _t,useState as Ue}from"react";import{Controller as lo}from"react-hook-form";import{Listbox as io,ListboxOption as uo,ListboxOptions as co,Popover as po,PopoverButton as mo,PopoverPanel as go}from"@headlessui/react";import le from"clsx";import{Float as wt}from"@headlessui-float/react";import{useRef as no}from"react";import $e from"clsx";import{jsx as Fe,jsxs as ro}from"react/jsx-runtime";function yt({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=no(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 ro("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 bo,jsx as F,jsxs as ye}from"react/jsx-runtime";var Mr=({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)};_t(()=>{m(!0);let p=setTimeout(()=>{I()},400);return()=>clearTimeout(p)},[b]);let L=(p,M)=>F(uo,{disabled:p.disabled,value:p,as:so,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(lo,{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(po,{className:le({"w-full":H},"relative text-paragraph"),children:({open:l})=>{var A,de;return ye(wt,{composable:!0,shift:8,zIndex:99,offset:2,children:[F(wt.Reference,{children:F(mo,{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(wt.Content,{children:F(go,{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 _t(()=>{v(p.value)},[l]),ye("div",{className:"flex flex-col gap-2",children:[F(io,{value:u||[],onChange:v,multiple:a,children:ye(co,{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(yt,{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(bo,{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 xo}from"react";import{Controller as fo}from"react-hook-form";import Nt from"clsx";import ho from"react-intl-currency-input";import{jsx as Ke,jsxs as rt}from"react/jsx-runtime";var vo=xo(({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
|
+
`,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"};return Ke(fo,{control:f,name:T,defaultValue:S,render:({field:o})=>{let m=(I,L,H)=>{I.preventDefault(),o.onChange(L),s&&s(L)};return typeof o.value=="string"&&(o.value=Number(o.value)),rt("div",{children:[rt("div",{className:"relative outline-none",children:[d&&Ke("div",{className:Nt(r.icon,"flex justify-center items-center"),children:d}),rt("div",{children:[Ke(ho,{...y,...o,type:"text",ref:D,className:Nt({[r.input]:!0,"pr-10":w,"pr-2":!w,"pl-[46px]":!e&&c&&d||d}),placeholder:!e&&c?c:" ",onClick:a,disabled:R,currency:"BRL",config:b,onChange:m,onBlur:()=>{g&&g(o.value)}}),rt("label",{className:Nt({[r.label]:!0,"left-[46px]":d,"left-2.5":!d},"cursor-text"),children:[e,x&&e&&Ke("strong",{className:"text-dangerous-500",children:"\xA0*"})]})]})]}),n.map((I,L)=>Ke("div",{className:"text-dangerous-500 text-xs mt-1 ml-[2px]",role:"alert","aria-label":I,children:I},L))]})}})});vo.displayName="InputMoney";import{useMemo as yo,useState as wo}from"react";import{Controller as No}from"react-hook-form";import Me from"clsx";import Co from"lodash/debounce";import{jsx as ge,jsxs as Ge}from"react/jsx-runtime";function To({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,hideArrows:u=!1,maxLength:v,onlyNumbers:D,showZero:k,maxValue:b}){let n=T?document==null?void 0:document.getElementById(T):null,N=[i==null?void 0:i.message],r=N.some(p=>p!==void 0),o={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 ${e?"pt-[22px]":"pt-[10px]"} ${r?"border-dangerous-500 text-dangerous-500":"border-neutral-300 focus-visible:border-blue-500"}`,icon:`absolute bg-neutral-100 h-[44px] top-[2px] left-[1.5px] w-[38px] rounded-l-lg ${r?"text-dangerous-500":"text-label"}
|
|
13
|
+
`,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 h-4 w-4 flex items-center justify-center"},[m,I]=wo(0),L=()=>{g&&g(h)},H=yo(()=>Co(()=>{L()},1e3),[]);return ge(No,{control:f,name:T,defaultValue:S,render:({field:{onChange:p,value:M}})=>{let z=l=>{H(),I(l)},G=l=>{if(p(l),s){let A={...l,target:{...l.target,value:l.target.value.replace(/^0+/,"")}};s(A)}z(m+1)};return Ge("div",{className:"relative",children:[Ge("div",{className:"relative outline-none",children:[d&&ge("div",{className:Me(o.icon,"flex justify-center items-center"),children:d}),Ge("div",{children:[ge("input",{type:"number",autoComplete:"off",id:T,className:Me({[o.input]:!0,"pr-10":w,"pr-2":!w,"pl-[57px]":!e&&c&&d}),placeholder:!e&&c?c:" ",onKeyDown:l=>{(l.code==="ArrowUp"||l.code==="ArrowDown"||l.code==="Enter"||l.key==="+"||l.key==="-"||l.key==="e"&&!D)&&l.preventDefault(),D&&!["Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Digit0","Backspace"].includes(l.code)&&l.preventDefault()},onClick:a,disabled:R,value:k?String(M):String(M).replace(/^0+/,""),onChange:l=>{let A=v?{...l,target:{...l.target,value:l.target.value.slice(0,v)}}:l;(!b||b&&Number(l.target.value)<=b)&&G(A)},defaultValue:M,onBlur:l=>{g&&g(l.target.value)}}),Ge("label",{className:Me({[o.label]:!0,"left-[3.5rem]":d,"left-2.5":!d},"cursor-text"),onClick:()=>n==null?void 0:n.focus(),children:[e,x&&e&&ge("strong",{className:"text-dangerous-500",children:"\xA0*"})]})]}),!u&&Ge("div",{className:Me([o.buttonsWrapper]),children:[ge("button",{type:"button",className:Me([o.button]),disabled:R,onClick:()=>{(!b||b&&Number(M||0)+1<=b)&&G(String(Number(M||0)+1))},children:ge("i",{className:"uil uil-angle-up text-[12px] text-neutral-600"})}),ge("button",{type:"button",className:Me([o.button]),disabled:R,onClick:()=>{(!b||b&&Number(M===0?0:Number(M)-1)<=b)&&G(M===0?0:String(Number(M)-1))},children:ge("i",{className:"uil uil-angle-down text-[12px] text-neutral-600"})})]})]}),N.map((l,A)=>ge("div",{className:"absolute text-dangerous-500 text-xs left-[4px] -bottom-[18px]",role:"alert","aria-label":l,children:l},A))]})}})}To.displayName="InputNumber";import{useRef as Ro}from"react";import{Controller as So}from"react-hook-form";import Ct from"clsx";import Do from"react-intl-currency-input";import{jsx as qe,jsxs as st}from"react/jsx-runtime";function Eo({label:e,onClick:t,error:a,onBlur:i,inputProps:g,icon:s,clearField:y,name:d,required:w,disabled:T,placeholder:x,control:R,defaultValue:h,minFractionDigits:c=2,onChangeValue:f,maxLength:S}){let v={locale:"pt-BR",formats:{number:{BRL:{currency:"BRL",minimumFractionDigits:c,maximumFractionDigits:c,useGrouping:!1}}}},D=Ro(null),k=[a==null?void 0:a.message],b=k.some(r=>r!==void 0),n={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 ${e?"pt-[22px]":"pt-[10px]"} ${b?"border-dangerous-500 text-dangerous-500":"border-neutral-300 focus-visible:border-blue-500"}`,icon:`absolute bg-neutral-100 h-[44px] top-[1px] left-[1.5px] w-[38px] text-[22px] rounded-lg ${b?"text-dangerous-500":"text-label"}
|
|
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(So,{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)),st("div",{children:[st("div",{className:"relative outline-none",children:[s&&qe("div",{className:Ct(n.icon,"flex justify-center items-center"),children:s}),st("div",{children:[qe(Do,{...g,...r,type:"text",ref:D,className:Ct({[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}),st("label",{className:Ct({[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))]})}})}Eo.displayName="InputPercentage";import{useRef as ko}from"react";import{Controller as Po}from"react-hook-form";import Io from"react-input-mask";import{jsx as Tt}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=ko(null);return Tt(Po,{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 Tt(Io,{...f,onKeyUp:w,disabled:h,mask:s,value:f.value||"",onChange:f.onChange,maskChar:T,alwaysShowMask:x,beforeMaskedStateChange:S,children:u=>Tt(at,{onKeyUp:w,type:e,label:a,placeholder:i,required:d,inputProps:u,error:g,name:t,disabled:h,ref:c})})}})};import Rt from"clsx";import{cloneElement as Fo}from"react";import*as St from"react-modal";import{jsx as Te,jsxs as Le}from"react/jsx-runtime";var Mo=St.default||St,Lo={success:"text-success-500",error:"text-dangerous-500",warning:"text-warning-500",info:"text-blue-500",primary:"text-rose-700"},Ho={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?Fo(g,{onClick:()=>{t()}}):null;return Le("div",{children:[S,Te(Mo,{ariaHideApp:!1,isOpen:e,onRequestClose:a,style:f,contentLabel:"Example Modal",children:Le("div",{className:Rt(Ho[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:Rt([Lo[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:Rt({"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 Bo}from"react-tooltip";import{Fragment as Ao,jsx as Yt}from"react/jsx-runtime";var zs=({id:e,displayArrow:t=!0,openOnClick:a=!1})=>Yt(Ao,{children:Yt(Bo,{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 Oo}from"react";import{Controller as zo}from"react-hook-form";import{components as ta}from"react-select";import Vo from"react-select/async";var Zt={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 Qt,useState as _e}from"react";import Dt from"clsx";import{Fragment as ea,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}=ta,m=Oo(null),[I,L]=_e(""),[H,p]=_e(!1),[M,z]=_e(()=>h||[]),[G,l]=_e(300),[A,de]=_e(!1);Qt(()=>{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 Qt(()=>{z(()=>h)},[h]),K(zo,{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(ea,{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:Dt("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:Dt("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(Vo,{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:Zt,placeholder:s||" ",isSearchable:y,options:M,tabSelectsValue:!0,components:{SingleValue:he,ValueContainer:Jo,Option:Ee,LoadingIndicator:()=>K(ea,{}),LoadingMessage:Oe,NoOptionsMessage:et,DropdownIndicator:ke,ClearIndicator:ce},closeMenuOnSelect:!0,hideSelectedOptions:!1,onChange:oe}),He("span",{className:Dt("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))]})}})},Jo=({children:e,...t})=>K(ta.ValueContainer,{...t,children:e});import{Controller as jo}from"react-hook-form";import{jsx as lt,jsxs as aa}from"react/jsx-runtime";var il=({disabled:e,control:t,name:a,label:i,defaultChecked:g})=>lt(jo,{name:a,control:t,render:({field:s})=>aa("div",{className:"flex items-center justify-center gap-2",children:[aa("label",{className:"custom-radio flex items-center",children:[lt("input",{name:a,id:a,type:"radio",className:"",onClick:y=>{s.onChange(y.target.value)},defaultChecked:g,disabled:e}),lt("span",{})]}),i&<("label",{htmlFor:a,className:"text-p-md cursor-pointer -pt-1",children:i})]})});import{Switch as oa}from"@headlessui/react";import{Controller as Xo}from"react-hook-form";import{jsx as Re,jsxs as Et}from"react/jsx-runtime";var{Group:Wo,Label:$o}=oa;function it(...e){return e.filter(Boolean).join(" ")}var gl=({name:e,label:t,subLabel:a,control:i,disabled:g})=>Et(Wo,{as:"div",className:"flex items-center",children:[Re(Xo,{control:i,name:e,render:({field:s})=>Re(oa,{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:it(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:Et("span",{className:it("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:it(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:it(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&&Et($o,{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 dt,useState as Ye}from"react";import na from"clsx";import{jsx as Y,jsxs as Se}from"react/jsx-runtime";function ra({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 dt(()=>{S()},[c]),dt(()=>{u("pageSize",s),t.setPageSize(s==null?void 0:s.id),t.setPageIndex(0),w({id:0,name:0})},[s]),dt(()=>{x(a?[...Array(a)].map((r,o)=>({id:o,name:o})):[])},[t==null?void 0:t.getPageCount()]),dt(()=>{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:na("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:na("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 ia,getCoreRowModel as Go,getExpandedRowModel as qo,getFacetedRowModel as _o,getFacetedUniqueValues as Yo,getFilteredRowModel as Zo,useReactTable as Qo}from"@tanstack/react-table";import da,{useEffect as Be,useMemo as en,useRef as tn,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 kt=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}));kt.displayName="Table";var Pt=xe.forwardRef(({className:e,...t},a)=>Ne("thead",{ref:a,className:we("w-full sticky top-0 z-[90]",e),...t}));Pt.displayName="TableHeader";var It=xe.forwardRef(({className:e,...t},a)=>Ne("tbody",{ref:a,className:we(e),...t}));It.displayName="TableBody";var Ft=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}));Ft.displayName="TableFooter";var ut=xe.forwardRef(({className:e,...t},a)=>Ne("tr",{ref:a,className:we(e),...t}));ut.displayName="TableRow";var Mt=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}));Mt.displayName="TableHead";var Lt=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}));Lt.displayName="TableCell";var Uo=xe.forwardRef(({className:e,...t},a)=>Ne("caption",{ref:a,className:we("text-default mt-4 text-sm",e),...t}));Uo.displayName="TableCaption";import{Fragment as Ko}from"react";import{Fragment as sa,jsx as V,jsxs as fe}from"react/jsx-runtime";function la({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(Ft,{children:[(T==null?void 0:T.length)>0&&V(ra,{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(sa,{children:"..."}),size:"xs",className:"justify-center"})]}),S.map((N,r)=>{let o=r<=c&&r>=f,m=r===x;return V(Ko,{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(sa,{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 an}from"@tanstack/match-sorter-utils";import{Fragment as ua,jsx as $,jsxs as ie}from"react/jsx-runtime";var on=(e,t,a,i)=>{let g=an(e.getValue(t),a);return i({itemRank:g}),g.passed};function ca({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 At,Ot,zt,Vt,Jt,jt;let G=tn(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=en(()=>({pageIndex:ce,pageSize:oe}),[ce,oe]),pa=()=>{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})}):ma(ce,oe).then(C=>{De(C.rows),!(C!=null&&C.rows)&&c>0&&Pe({pageIndex:ce-1,pageSize:oe})}),setTimeout(()=>{z&&z()},1e3)},ma=async(E,B)=>({rows:(await new Promise((_,ct)=>{let ze=[],ve,Xt;for(ve=0,Xt=c;ve<Xt;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)&&pa()},[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 ga=c<me.pageSize?1:Math.ceil(c/me.pageSize),Z=Qo({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:ga,manualPagination:!0,enableRowSelection:k,onRowSelectionChange:L,onSortingChange:O,onColumnFiltersChange:ue,onColumnVisibilityChange:A,onGlobalFilterChange:Ae,globalFilterFn:on,getCoreRowModel:Go(),getFilteredRowModel:Zo(),getFacetedRowModel:_o(),getFacetedUniqueValues:Yo(),onPaginationChange:Pe,getRowCanExpand:D,onExpandedChange:Oe,getExpandedRowModel:qo(),enableExpanding:!0,getRowId:E=>E.id,meta:{getRowStyles:m}});Be(()=>{k&&H&&se(Object.keys(H))},[H,k]);let ba=()=>{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)},xa=()=>{Z.toggleAllRowsSelected(),L({})},Ht=U&&(U==null?void 0:U.length)==0&&!j&&!s||!U||((Ot=(At=Z==null?void 0:Z.getRowModel())==null?void 0:At.rows)==null?void 0:Ot.length)==0,fa=!i&&c>0&&Z;function ha(){var E;if(Ht&&c!==null)return h||$("div",{});if(fa&&c!==null)return $(la,{table:Z,footer:d,totalData:c,tableRef:n,selectAllOption:r,onSelectAll:ba,rowsSelected:(E=Object.keys(H||{}))==null?void 0:E.length,onRemoveAll:xa,paginationScroll:P,pageSizeOptions:M});if(c==null)return $(ua,{})}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 Bt=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":!Ht,[t]:t}),children:[ie(kt,{className:Ze("w-full table_container z-20 overflow-x-scroll md:overflow-x-hidden"),onScroll:b,ref:n,children:[H&&((zt=Object.keys(H))==null?void 0:zt.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:[$(Pt,{children:(Vt=Z==null?void 0:Z.getHeaderGroups())==null?void 0:Vt.map((E,B)=>$(ut,{children:E.headers.map((C,ee)=>{var ct,ze,ve;let _=C.column.columnDef.meta;return $(Mt,{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:ia(C.column.columnDef.header,C.getContext()),((ct=re[0])==null?void 0:ct.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")}):$(ua,{})]})},B+ee+"th")})},E.id+B+"header"))}),$(It,{children:(jt=(Jt=Z==null?void 0:Z.getRowModel())==null?void 0:Jt.rows)==null?void 0:jt.map((E,B)=>$(da.Fragment,{children:!E.original._destroy&&ie(da.Fragment,{children:[$(ut,{id:E.id,className:"text-p-md font-normal h-[80px] text-paragraph w-fit",style:Bt(E),children:E.getVisibleCells().map((C,ee)=>{let _=C.column.columnDef.meta;return $(Lt,{id:C.id,style:{width:C.column.getSize(),backgroundColor:R||"",...Bt(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:ia(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"))})]})]}),ha()]})]})}export{zn as Badge,J as Button,Gn as Calendar,Zn as Checkbox,ca as DataTable,la as DataTablePagination,Hn as DatePickerInput,pr as FilterCalendar,Mr as FilterOptions,at as Input,vo as InputMoney,To as InputNumber,Eo as InputPercentage,bn as Logo,Ds as MaskedInput,Hs as ModalDialog,ra as PaginationSelect,zs as Popover,il as Radio,hn as RocketIcon,ol as SelectField,$t as SpinnerIcon,kt as Table,It as TableBody,Uo as TableCaption,Lt as TableCell,Ft as TableFooter,Mt as TableHead,Pt as TableHeader,ut as TableRow,gl as Toggle,Jo as ValueContainer};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|