nexaas-ui-components 1.0.103 → 1.0.105
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 +231 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +233 -136
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React6 from 'react';
|
|
2
|
-
import React6__default, { forwardRef, useEffect, useState, useRef, useImperativeHandle, useMemo, cloneElement, Fragment as Fragment$1, useReducer } from 'react';
|
|
2
|
+
import React6__default, { forwardRef, useEffect, useState, useRef, useCallback, useImperativeHandle, useMemo, cloneElement, Fragment as Fragment$1, useReducer } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import clsx9, { clsx } from 'clsx';
|
|
5
5
|
import { DateInput3, DateRangePicker3, DatePicker3 } from '@blueprintjs/datetime2';
|
|
6
6
|
import { Controller } from 'react-hook-form';
|
|
7
7
|
import { create } from 'zustand';
|
|
8
|
-
import {
|
|
8
|
+
import { format, startOfDay, endOfDay, set, startOfWeek, endOfWeek, startOfMonth, endOfMonth, sub, subYears } from 'date-fns';
|
|
9
9
|
import { Switch, Popover as Popover$1, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, Transition, Menu as Menu$1, MenuButton, MenuItems, MenuItem, TabGroup, TabList, Tab, TabPanels, TabPanel, ListboxOption, Dialog } from '@headlessui/react';
|
|
10
10
|
import { Float } from '@headlessui-float/react';
|
|
11
11
|
import { Tooltip } from 'react-tooltip';
|
|
@@ -238,7 +238,7 @@ var Button = ({
|
|
|
238
238
|
useEffect(() => {
|
|
239
239
|
if (!hotkey || !props.onClick) return;
|
|
240
240
|
const handleKeyDown = (event) => {
|
|
241
|
-
var
|
|
241
|
+
var _a2, _b;
|
|
242
242
|
if (props.disabled || props.loading) return;
|
|
243
243
|
const keys = hotkey.toLowerCase().split("+").map((k) => k.trim());
|
|
244
244
|
const primaryKey = keys.pop();
|
|
@@ -253,7 +253,7 @@ var Button = ({
|
|
|
253
253
|
space: " ",
|
|
254
254
|
spacebar: " "
|
|
255
255
|
};
|
|
256
|
-
const normalizedPrimary = (
|
|
256
|
+
const normalizedPrimary = (_a2 = keyAliases[primaryKey]) != null ? _a2 : primaryKey;
|
|
257
257
|
const match = event.key.toLowerCase() === normalizedPrimary && event.ctrlKey === requiredCtrl && event.altKey === requiredAlt && event.shiftKey === requiredShift && event.metaKey === requiredMeta;
|
|
258
258
|
if (match) {
|
|
259
259
|
event.preventDefault();
|
|
@@ -415,12 +415,12 @@ var ButtonLink = forwardRef(
|
|
|
415
415
|
iconPosition = "left",
|
|
416
416
|
...props
|
|
417
417
|
}, ref) => {
|
|
418
|
-
var
|
|
418
|
+
var _a2;
|
|
419
419
|
const applyGap = icon;
|
|
420
420
|
useEffect(() => {
|
|
421
421
|
if (!hotkey) return;
|
|
422
422
|
const handleKeyDown = (event) => {
|
|
423
|
-
var
|
|
423
|
+
var _a3;
|
|
424
424
|
if (disabled) return;
|
|
425
425
|
const keys = hotkey.toLowerCase().split("+").map((k) => k.trim());
|
|
426
426
|
const primaryKey = keys.pop();
|
|
@@ -433,7 +433,7 @@ var ButtonLink = forwardRef(
|
|
|
433
433
|
if (match) {
|
|
434
434
|
event.preventDefault();
|
|
435
435
|
if (props.onClick) {
|
|
436
|
-
(
|
|
436
|
+
(_a3 = props.onClick) == null ? void 0 : _a3.call(props, event);
|
|
437
437
|
} else {
|
|
438
438
|
const linkElement = document.querySelector(
|
|
439
439
|
`a[href="${props.href}"]`
|
|
@@ -470,7 +470,7 @@ var ButtonLink = forwardRef(
|
|
|
470
470
|
ref,
|
|
471
471
|
className: clsx9(
|
|
472
472
|
{
|
|
473
|
-
[(
|
|
473
|
+
[(_a2 = variants2[variant]) == null ? void 0 : _a2.text]: true,
|
|
474
474
|
[sizes2[size].text]: true,
|
|
475
475
|
["pointer-events-none shadow-none text-label"]: disabled,
|
|
476
476
|
["px-2"]: variant !== "link" && variant !== "linkDanger",
|
|
@@ -771,7 +771,65 @@ var useFieldErrorsStore = create(
|
|
|
771
771
|
}))
|
|
772
772
|
})
|
|
773
773
|
);
|
|
774
|
+
|
|
775
|
+
// src/utils/date-input.ts
|
|
776
|
+
var MASK_SLASH_POSITIONS = [2, 5];
|
|
777
|
+
var MAX_DIGITS = 8;
|
|
778
|
+
var formatDigits = (digits) => {
|
|
779
|
+
let out = digits.slice(0, 2);
|
|
780
|
+
if (digits.length > 2) out += `/${digits.slice(2, 4)}`;
|
|
781
|
+
if (digits.length > 4) out += `/${digits.slice(4, MAX_DIGITS)}`;
|
|
782
|
+
return out;
|
|
783
|
+
};
|
|
784
|
+
var maskDateInput = (raw) => {
|
|
785
|
+
if (!/^[\d/]*$/.test(raw)) return raw;
|
|
786
|
+
for (let i = 0; i < raw.length; i++) {
|
|
787
|
+
if (raw[i] === "/" && !MASK_SLASH_POSITIONS.includes(i)) return raw;
|
|
788
|
+
}
|
|
789
|
+
const digits = raw.replace(/\//g, "").slice(0, MAX_DIGITS);
|
|
790
|
+
let out = formatDigits(digits);
|
|
791
|
+
if (raw.endsWith("/") && (digits.length === 2 || digits.length === 4)) {
|
|
792
|
+
out += "/";
|
|
793
|
+
}
|
|
794
|
+
return out;
|
|
795
|
+
};
|
|
796
|
+
var resolveTwoDigitYear = (yy, maxYear) => {
|
|
797
|
+
const year = 2e3 + yy;
|
|
798
|
+
return year > maxYear ? year - 100 : year;
|
|
799
|
+
};
|
|
800
|
+
var parseDateInput = (value, maxYear, allowTwoDigitYear = false) => {
|
|
801
|
+
const text = value.trim().replace(/[-.]/g, "/");
|
|
802
|
+
const digitsOnly = /^(\d{2})(\d{2})(\d{4})$/.exec(text);
|
|
803
|
+
const withSeparators = allowTwoDigitYear ? /^(\d{1,2})\/(\d{1,2})\/(\d{2}|\d{4})$/.exec(text) : /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text);
|
|
804
|
+
const match = digitsOnly != null ? digitsOnly : withSeparators;
|
|
805
|
+
if (!match) return /* @__PURE__ */ new Date(NaN);
|
|
806
|
+
const day = Number(match[1]);
|
|
807
|
+
const month = Number(match[2]);
|
|
808
|
+
const year = match[3].length === 2 ? resolveTwoDigitYear(Number(match[3]), maxYear) : Number(match[3]);
|
|
809
|
+
const date = new Date(2e3, 0, 1);
|
|
810
|
+
date.setFullYear(year, month - 1, day);
|
|
811
|
+
date.setHours(0, 0, 0, 0);
|
|
812
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
813
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
814
|
+
}
|
|
815
|
+
return date;
|
|
816
|
+
};
|
|
774
817
|
var DEFAULT_POPOVER_OFFSET = [0, 8];
|
|
818
|
+
var INVALID_DATE_MESSAGE = "Data inv\xE1lida";
|
|
819
|
+
var OUT_OF_RANGE_MESSAGE = "Data n\xE3o permitida";
|
|
820
|
+
var _a;
|
|
821
|
+
var nativeValueSetter = (_a = Object.getOwnPropertyDescriptor(
|
|
822
|
+
typeof HTMLInputElement !== "undefined" ? HTMLInputElement.prototype : {},
|
|
823
|
+
"value"
|
|
824
|
+
)) == null ? void 0 : _a.set;
|
|
825
|
+
var applyDateMask = (event) => {
|
|
826
|
+
const input = event.target;
|
|
827
|
+
if (input.selectionStart !== input.value.length) return;
|
|
828
|
+
const masked = maskDateInput(input.value);
|
|
829
|
+
if (masked !== input.value && nativeValueSetter) {
|
|
830
|
+
nativeValueSetter.call(input, masked);
|
|
831
|
+
}
|
|
832
|
+
};
|
|
775
833
|
var DatePickerInput = forwardRef(
|
|
776
834
|
({
|
|
777
835
|
icon,
|
|
@@ -792,17 +850,28 @@ var DatePickerInput = forwardRef(
|
|
|
792
850
|
onClear,
|
|
793
851
|
popoverOffset
|
|
794
852
|
}, ref) => {
|
|
795
|
-
var
|
|
796
|
-
const [
|
|
853
|
+
var _a2;
|
|
854
|
+
const [dateError, setDateError] = useState(null);
|
|
797
855
|
const [showCalendar, setShowCalendar] = useState(false);
|
|
798
856
|
const inputContainerRef = useRef(null);
|
|
799
857
|
const dateFnsFormat = "dd/MM/yyyy";
|
|
858
|
+
const effectiveMaxDate = maxDate || new Date((/* @__PURE__ */ new Date()).getFullYear() + 5, 11, 31);
|
|
859
|
+
const maxYear = new Date(effectiveMaxDate).getFullYear();
|
|
860
|
+
const effectiveMinDate = minDate || new Date(1900, 0, 1);
|
|
861
|
+
const maskedInputNodeRef = useRef(null);
|
|
862
|
+
const maskedInputRef = useCallback((node) => {
|
|
863
|
+
var _a3;
|
|
864
|
+
(_a3 = maskedInputNodeRef.current) == null ? void 0 : _a3.removeEventListener("input", applyDateMask);
|
|
865
|
+
maskedInputNodeRef.current = node;
|
|
866
|
+
node == null ? void 0 : node.addEventListener("input", applyDateMask);
|
|
867
|
+
}, []);
|
|
800
868
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
801
869
|
const fieldValidationMessages = [
|
|
802
|
-
(
|
|
870
|
+
(_a2 = fieldValidation[name ? name : registration == null ? void 0 : registration.name]) == null ? void 0 : _a2.message,
|
|
803
871
|
error == null ? void 0 : error.message
|
|
804
872
|
];
|
|
805
873
|
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
874
|
+
const inputBorder = (dateErrorShown) => hasError ? "border-dangerous-500 text-dangerous-500" : dateErrorShown ? "border-dangerous-500 placeholder:text-dangerous-500" : "border-stroke";
|
|
806
875
|
const styles = {
|
|
807
876
|
// Borda e sombra iguais as do Input: `rounded-lg` (era `rounded`, 4px contra os 8px do
|
|
808
877
|
// Input) e o mesmo bloco de disabled, com os tokens `--input-bg-disabled` /
|
|
@@ -811,9 +880,9 @@ var DatePickerInput = forwardRef(
|
|
|
811
880
|
// `border-solid` e obrigatorio aqui (o Input nao precisa): o Blueprint declara
|
|
812
881
|
// `.bp6-input { border: none }`, que vence o `border-style: solid` do preflight do
|
|
813
882
|
// Tailwind (seletor `*`). Sem ele a borda tem largura e cor certas mas nao aparece.
|
|
814
|
-
input: `text-p-md text-paragraph bg-surface shadow-input border-solid border-[0.5px] rounded-lg block pb-[10px] h-[46px] w-full disabled:bg-[var(--input-bg-disabled)] disabled:border-[var(--input-border-disabled)] disabled:text-disabled disabled:cursor-not-allowed disabled:shadow-none input-focus-ring
|
|
883
|
+
input: `text-p-md text-paragraph bg-surface shadow-input border-solid border-[0.5px] rounded-lg block pb-[10px] h-[46px] w-full disabled:bg-[var(--input-bg-disabled)] disabled:border-[var(--input-border-disabled)] disabled:text-disabled disabled:cursor-not-allowed disabled:shadow-none input-focus-ring`,
|
|
815
884
|
// left-[1.5px] como no Input: cobre a borda de 0.5px sem deixar fiapo aparecendo.
|
|
816
|
-
icon:
|
|
885
|
+
icon: "absolute bg-neutral-100 h-[42px] w-[38px] top-[2px] left-[1.5px] rounded-l-lg rounded-r-none",
|
|
817
886
|
label: "absolute text-label text-sm",
|
|
818
887
|
clear: "absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]"
|
|
819
888
|
};
|
|
@@ -837,6 +906,41 @@ var DatePickerInput = forwardRef(
|
|
|
837
906
|
return null;
|
|
838
907
|
};
|
|
839
908
|
const normalizedValue = normalizeDate(field.value);
|
|
909
|
+
const dateErrorShown = !normalizedValue && dateError !== null;
|
|
910
|
+
const commitValue = (e) => {
|
|
911
|
+
let value = null;
|
|
912
|
+
if (e) {
|
|
913
|
+
const date = new Date(e);
|
|
914
|
+
date.setUTCHours(23, 59, 59, 0);
|
|
915
|
+
value = date.toISOString();
|
|
916
|
+
}
|
|
917
|
+
field.onChange(value);
|
|
918
|
+
setShowCalendar(false);
|
|
919
|
+
if (onChangeFunction) {
|
|
920
|
+
onChangeFunction(value);
|
|
921
|
+
}
|
|
922
|
+
setDateError(null);
|
|
923
|
+
};
|
|
924
|
+
const handleDateError = (date) => {
|
|
925
|
+
setDateError(
|
|
926
|
+
date && !isNaN(date.getTime()) ? OUT_OF_RANGE_MESSAGE : INVALID_DATE_MESSAGE
|
|
927
|
+
);
|
|
928
|
+
if (field.value) {
|
|
929
|
+
field.onChange(null);
|
|
930
|
+
if (onChangeFunction) {
|
|
931
|
+
onChangeFunction(null);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
const commitTwoDigitYear = (e) => {
|
|
936
|
+
const typed = e.target.value.trim();
|
|
937
|
+
if (!/^\d{1,2}[/.-]\d{1,2}[/.-]\d{2}$/.test(typed)) return;
|
|
938
|
+
const date = parseDateInput(typed, maxYear, true);
|
|
939
|
+
if (isNaN(date.getTime()) || date < startOfDay(new Date(effectiveMinDate)) || date > endOfDay(new Date(effectiveMaxDate))) {
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
commitValue(date);
|
|
943
|
+
};
|
|
840
944
|
return /* @__PURE__ */ jsxs(
|
|
841
945
|
"div",
|
|
842
946
|
{
|
|
@@ -857,6 +961,7 @@ var DatePickerInput = forwardRef(
|
|
|
857
961
|
id: "icon",
|
|
858
962
|
className: clsx9(
|
|
859
963
|
styles.icon,
|
|
964
|
+
hasError || dateErrorShown ? "text-dangerous-700" : "text-label",
|
|
860
965
|
"flex justify-center items-center text-[20px]"
|
|
861
966
|
),
|
|
862
967
|
children: icon
|
|
@@ -865,9 +970,9 @@ var DatePickerInput = forwardRef(
|
|
|
865
970
|
/* @__PURE__ */ jsx(
|
|
866
971
|
DateInput3,
|
|
867
972
|
{
|
|
868
|
-
outOfRangeMessage: "
|
|
869
|
-
invalidDateMessage: "
|
|
870
|
-
onError:
|
|
973
|
+
outOfRangeMessage: "",
|
|
974
|
+
invalidDateMessage: "",
|
|
975
|
+
onError: handleDateError,
|
|
871
976
|
defaultValue: normalizedValue,
|
|
872
977
|
inputProps: {
|
|
873
978
|
// `inputClassName`, nao `className`: o DateInput3 repassa `inputProps` para o
|
|
@@ -875,8 +980,11 @@ var DatePickerInput = forwardRef(
|
|
|
875
980
|
// sai so com `bp6-input` e todas as classes daqui viravam letra morta (sem
|
|
876
981
|
// `shadow-input`, sem `input-focus-ring`, sem os estados de disabled). O
|
|
877
982
|
// InputGroup aplica `inputClassName` no proprio <input>.
|
|
878
|
-
inputClassName: styles.input,
|
|
879
|
-
|
|
983
|
+
inputClassName: clsx9(styles.input, inputBorder(dateErrorShown)),
|
|
984
|
+
placeholder: dateErrorShown ? dateError : void 0,
|
|
985
|
+
style: { height: "46px" },
|
|
986
|
+
inputRef: maskedInputRef,
|
|
987
|
+
onBlur: commitTwoDigitYear
|
|
880
988
|
},
|
|
881
989
|
popoverProps: {
|
|
882
990
|
placement: "bottom-start",
|
|
@@ -908,18 +1016,7 @@ var DatePickerInput = forwardRef(
|
|
|
908
1016
|
disabled,
|
|
909
1017
|
onChange: (e, isUserChange) => {
|
|
910
1018
|
if (isUserChange) {
|
|
911
|
-
|
|
912
|
-
if (e) {
|
|
913
|
-
const date = new Date(e);
|
|
914
|
-
date.setUTCHours(23, 59, 59, 0);
|
|
915
|
-
value = date.toISOString();
|
|
916
|
-
}
|
|
917
|
-
field.onChange(value);
|
|
918
|
-
setShowCalendar(false);
|
|
919
|
-
if (onChangeFunction) {
|
|
920
|
-
onChangeFunction(value);
|
|
921
|
-
}
|
|
922
|
-
setInvalidDate(false);
|
|
1019
|
+
commitValue(e);
|
|
923
1020
|
}
|
|
924
1021
|
},
|
|
925
1022
|
value: normalizedValue,
|
|
@@ -931,9 +1028,9 @@ var DatePickerInput = forwardRef(
|
|
|
931
1028
|
);
|
|
932
1029
|
return format(adjusted, dateFnsFormat);
|
|
933
1030
|
},
|
|
934
|
-
parseDate: (value) =>
|
|
935
|
-
maxDate:
|
|
936
|
-
minDate:
|
|
1031
|
+
parseDate: (value) => parseDateInput(value, maxYear),
|
|
1032
|
+
maxDate: effectiveMaxDate,
|
|
1033
|
+
minDate: effectiveMinDate
|
|
937
1034
|
}
|
|
938
1035
|
),
|
|
939
1036
|
/* @__PURE__ */ jsxs(
|
|
@@ -943,7 +1040,7 @@ var DatePickerInput = forwardRef(
|
|
|
943
1040
|
"pointer-events-none ",
|
|
944
1041
|
styles.label,
|
|
945
1042
|
`
|
|
946
|
-
${field.value && field.value[0] !== null ||
|
|
1043
|
+
${field.value && field.value[0] !== null || dateErrorShown ? " scale-75 -translate-y-[10px] " : ""}
|
|
947
1044
|
${icon ? "left-[3rem]" : "left-2.5"}`
|
|
948
1045
|
),
|
|
949
1046
|
style: { top: "13px" },
|
|
@@ -1568,8 +1665,8 @@ var FilterCalendar = ({
|
|
|
1568
1665
|
name,
|
|
1569
1666
|
control,
|
|
1570
1667
|
render: ({ field }) => {
|
|
1571
|
-
var
|
|
1572
|
-
let hasValue = ((
|
|
1668
|
+
var _a2, _b, _c;
|
|
1669
|
+
let hasValue = ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.length) > 0 || !!calendarLabel && calendarLabel !== shorcuts[0].label;
|
|
1573
1670
|
const clearValue = () => {
|
|
1574
1671
|
if (!onClear) return;
|
|
1575
1672
|
onClear();
|
|
@@ -1820,13 +1917,13 @@ var FilterOptions = ({
|
|
|
1820
1917
|
} else {
|
|
1821
1918
|
const result = options.filter(
|
|
1822
1919
|
(opt) => {
|
|
1823
|
-
var
|
|
1824
|
-
return (
|
|
1920
|
+
var _a2;
|
|
1921
|
+
return (_a2 = opt == null ? void 0 : opt.label) == null ? void 0 : _a2.toLowerCase().includes(filter.toLowerCase());
|
|
1825
1922
|
}
|
|
1826
1923
|
);
|
|
1827
1924
|
const order = result.sort((a, b) => {
|
|
1828
|
-
var
|
|
1829
|
-
return (
|
|
1925
|
+
var _a2;
|
|
1926
|
+
return (_a2 = a == null ? void 0 : a.label) == null ? void 0 : _a2.toLowerCase();
|
|
1830
1927
|
});
|
|
1831
1928
|
setData(order);
|
|
1832
1929
|
}
|
|
@@ -1913,8 +2010,8 @@ var FilterOptions = ({
|
|
|
1913
2010
|
name,
|
|
1914
2011
|
control,
|
|
1915
2012
|
render: ({ field }) => {
|
|
1916
|
-
var
|
|
1917
|
-
let hasValue = isMulti ? ((
|
|
2013
|
+
var _a2, _b;
|
|
2014
|
+
let hasValue = isMulti ? ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.length) > 0 : !!((_b = field == null ? void 0 : field.value) == null ? void 0 : _b.id);
|
|
1918
2015
|
return /* @__PURE__ */ jsx(
|
|
1919
2016
|
Popover$1,
|
|
1920
2017
|
{
|
|
@@ -1923,7 +2020,7 @@ var FilterOptions = ({
|
|
|
1923
2020
|
"relative text-paragraph"
|
|
1924
2021
|
),
|
|
1925
2022
|
children: ({ open }) => {
|
|
1926
|
-
var
|
|
2023
|
+
var _a3, _b2;
|
|
1927
2024
|
return /* @__PURE__ */ jsxs(Float, { composable: true, shift: 8, zIndex: 99, offset: 6, children: [
|
|
1928
2025
|
/* @__PURE__ */ jsx(Float.Reference, { children: /* @__PURE__ */ jsx(
|
|
1929
2026
|
PopoverButton,
|
|
@@ -1964,7 +2061,7 @@ var FilterOptions = ({
|
|
|
1964
2061
|
},
|
|
1965
2062
|
"truncate cursor-pointer"
|
|
1966
2063
|
),
|
|
1967
|
-
children: isMulti ? label : ((
|
|
2064
|
+
children: isMulti ? label : ((_a3 = field == null ? void 0 : field.value) == null ? void 0 : _a3.id) ? (_b2 = field == null ? void 0 : field.value) == null ? void 0 : _b2.label : label
|
|
1968
2065
|
}
|
|
1969
2066
|
),
|
|
1970
2067
|
isMulti && field.value && field.value.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-blue-500 text-accent-label text-p-xs px-1 py-[2px] rounded group-hover:bg-blue-500", children: field.value.length }),
|
|
@@ -2210,13 +2307,13 @@ var FilterSelect = ({
|
|
|
2210
2307
|
} else {
|
|
2211
2308
|
const result = options.filter(
|
|
2212
2309
|
(opt) => {
|
|
2213
|
-
var
|
|
2214
|
-
return (
|
|
2310
|
+
var _a2;
|
|
2311
|
+
return (_a2 = opt == null ? void 0 : opt.label) == null ? void 0 : _a2.toLowerCase().includes(filter.toLowerCase());
|
|
2215
2312
|
}
|
|
2216
2313
|
);
|
|
2217
2314
|
const order = result.sort((a, b) => {
|
|
2218
|
-
var
|
|
2219
|
-
return (
|
|
2315
|
+
var _a2;
|
|
2316
|
+
return (_a2 = a == null ? void 0 : a.label) == null ? void 0 : _a2.toLowerCase();
|
|
2220
2317
|
});
|
|
2221
2318
|
setData(order);
|
|
2222
2319
|
}
|
|
@@ -2303,8 +2400,8 @@ var FilterSelect = ({
|
|
|
2303
2400
|
name,
|
|
2304
2401
|
control,
|
|
2305
2402
|
render: ({ field }) => {
|
|
2306
|
-
var
|
|
2307
|
-
let hasValue = isMulti ? ((
|
|
2403
|
+
var _a2, _b;
|
|
2404
|
+
let hasValue = isMulti ? ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.length) > 0 : !!((_b = field == null ? void 0 : field.value) == null ? void 0 : _b.id);
|
|
2308
2405
|
return /* @__PURE__ */ jsx(
|
|
2309
2406
|
Popover$1,
|
|
2310
2407
|
{
|
|
@@ -2313,7 +2410,7 @@ var FilterSelect = ({
|
|
|
2313
2410
|
"relative text-paragraph"
|
|
2314
2411
|
),
|
|
2315
2412
|
children: ({ open }) => {
|
|
2316
|
-
var
|
|
2413
|
+
var _a3, _b2;
|
|
2317
2414
|
return /* @__PURE__ */ jsxs(Float, { composable: true, shift: 8, zIndex: 99, offset: 6, children: [
|
|
2318
2415
|
/* @__PURE__ */ jsx(Float.Reference, { children: /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
2319
2416
|
/* @__PURE__ */ jsxs(
|
|
@@ -2326,7 +2423,7 @@ var FilterSelect = ({
|
|
|
2326
2423
|
),
|
|
2327
2424
|
children: [
|
|
2328
2425
|
icon && /* @__PURE__ */ jsx("div", { className: "text-[18px] leading-none", children: icon }),
|
|
2329
|
-
/* @__PURE__ */ jsx("span", { className: "truncate cursor-pointer", children: isMulti ? label : ((
|
|
2426
|
+
/* @__PURE__ */ jsx("span", { className: "truncate cursor-pointer", children: isMulti ? label : ((_a3 = field == null ? void 0 : field.value) == null ? void 0 : _a3.id) ? (_b2 = field == null ? void 0 : field.value) == null ? void 0 : _b2.label : label }),
|
|
2330
2427
|
isMulti && field.value && field.value.length > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-[2px] bg-blue-500 px-1 py-px text-p-xs text-white group-hover/chip:bg-[#007fb0] group-active/chip:bg-[#007fb0]", children: field.value.length }),
|
|
2331
2428
|
/* @__PURE__ */ jsx(
|
|
2332
2429
|
"i",
|
|
@@ -3122,7 +3219,7 @@ var ModalDialog = ({
|
|
|
3122
3219
|
headerBorder = false,
|
|
3123
3220
|
closeOnOverlayClick = true
|
|
3124
3221
|
}) => {
|
|
3125
|
-
var
|
|
3222
|
+
var _a2;
|
|
3126
3223
|
const customStyles6 = {
|
|
3127
3224
|
content: {
|
|
3128
3225
|
top: "50%",
|
|
@@ -3143,7 +3240,7 @@ var ModalDialog = ({
|
|
|
3143
3240
|
zIndex: 9999
|
|
3144
3241
|
}
|
|
3145
3242
|
};
|
|
3146
|
-
const hasIcon = React6__default.isValidElement(icon) && !(icon.type === React6__default.Fragment && React6__default.Children.count((
|
|
3243
|
+
const hasIcon = React6__default.isValidElement(icon) && !(icon.type === React6__default.Fragment && React6__default.Children.count((_a2 = icon.props) == null ? void 0 : _a2.children) === 0);
|
|
3147
3244
|
const trigger = triggerButton ? cloneElement(triggerButton, {
|
|
3148
3245
|
onClick: () => {
|
|
3149
3246
|
onOpen();
|
|
@@ -3232,10 +3329,10 @@ var ModalDialog = ({
|
|
|
3232
3329
|
// src/components/Select/Select.styles.ts
|
|
3233
3330
|
var customStyles = {
|
|
3234
3331
|
indicatorSeparator: (provided, props) => {
|
|
3235
|
-
var
|
|
3332
|
+
var _a2;
|
|
3236
3333
|
return {
|
|
3237
3334
|
...provided,
|
|
3238
|
-
backgroundColor: props.hasValue && ((
|
|
3335
|
+
backgroundColor: props.hasValue && ((_a2 = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a2.isSearchable) ? "var(--input)" : "transparent"
|
|
3239
3336
|
};
|
|
3240
3337
|
},
|
|
3241
3338
|
clearIndicator: (provided) => ({
|
|
@@ -3395,7 +3492,7 @@ var SelectField = ({
|
|
|
3395
3492
|
clearOnMenuClose,
|
|
3396
3493
|
showArrow = true
|
|
3397
3494
|
}) => {
|
|
3398
|
-
var
|
|
3495
|
+
var _a2;
|
|
3399
3496
|
const { Option, DropdownIndicator, ClearIndicator, SingleValue } = components;
|
|
3400
3497
|
const selectRef = useRef(null);
|
|
3401
3498
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -3406,8 +3503,8 @@ var SelectField = ({
|
|
|
3406
3503
|
const [isFocused, setIsFocused] = useState(false);
|
|
3407
3504
|
useEffect(() => {
|
|
3408
3505
|
const updateAvailableHeight = () => {
|
|
3409
|
-
var
|
|
3410
|
-
if ((
|
|
3506
|
+
var _a3, _b;
|
|
3507
|
+
if ((_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.getBoundingClientRect) {
|
|
3411
3508
|
const rect = (_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
3412
3509
|
const bottomSpace = window.innerHeight - rect.bottom;
|
|
3413
3510
|
const margin = bottomSpace - 24;
|
|
@@ -3437,7 +3534,7 @@ var SelectField = ({
|
|
|
3437
3534
|
};
|
|
3438
3535
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
3439
3536
|
const fieldValidationMessages = [
|
|
3440
|
-
(
|
|
3537
|
+
(_a2 = fieldValidation[name]) == null ? void 0 : _a2.message,
|
|
3441
3538
|
error == null ? void 0 : error.message
|
|
3442
3539
|
];
|
|
3443
3540
|
const hasError = {
|
|
@@ -3506,7 +3603,7 @@ var SelectField = ({
|
|
|
3506
3603
|
}
|
|
3507
3604
|
};
|
|
3508
3605
|
const NoOptionsMessage = (props) => {
|
|
3509
|
-
var
|
|
3606
|
+
var _a3, _b;
|
|
3510
3607
|
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
3511
3608
|
return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
3512
3609
|
"Digite ",
|
|
@@ -3515,18 +3612,18 @@ var SelectField = ({
|
|
|
3515
3612
|
] });
|
|
3516
3613
|
} else if (initialMessage && !debounce2 && isSearchable && props.selectProps.inputValue.length === 0) {
|
|
3517
3614
|
return /* @__PURE__ */ jsx("div", { className: "p-2 text-neutral-300", children: initialMessage });
|
|
3518
|
-
} else if ((props.selectProps.inputValue.length > 0 && isSearchable || !isSearchable || isSearchable && ((
|
|
3615
|
+
} else if ((props.selectProps.inputValue.length > 0 && isSearchable || !isSearchable || isSearchable && ((_a3 = props == null ? void 0 : props.options) == null ? void 0 : _a3.length) == 0) && ((_b = props == null ? void 0 : props.options) == null ? void 0 : _b.length) == 0) {
|
|
3519
3616
|
return /* @__PURE__ */ jsx("div", { className: "p-2 text-neutral-300", children: emptyMessage || "Sem opc\u0327o\u0303es disponi\u0301veis" });
|
|
3520
3617
|
}
|
|
3521
3618
|
};
|
|
3522
3619
|
const DropdownIndicatorCustom = (props) => {
|
|
3523
|
-
var
|
|
3620
|
+
var _a3;
|
|
3524
3621
|
return /* @__PURE__ */ jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(
|
|
3525
3622
|
"i",
|
|
3526
3623
|
{
|
|
3527
3624
|
className: clsx9(
|
|
3528
3625
|
"uil text-[20px]",
|
|
3529
|
-
((
|
|
3626
|
+
((_a3 = props.selectProps) == null ? void 0 : _a3.menuIsOpen) ? "uil-angle-up" : "uil-angle-down",
|
|
3530
3627
|
small ? "h-[20px] -mt-[7px]" : "h-full"
|
|
3531
3628
|
)
|
|
3532
3629
|
}
|
|
@@ -3542,10 +3639,10 @@ var SelectField = ({
|
|
|
3542
3639
|
}
|
|
3543
3640
|
};
|
|
3544
3641
|
const handleKeyDown = async (event) => {
|
|
3545
|
-
var
|
|
3642
|
+
var _a3;
|
|
3546
3643
|
if (event.key === "Enter") {
|
|
3547
3644
|
event.preventDefault();
|
|
3548
|
-
const fetchedOptions = await loadOptions((
|
|
3645
|
+
const fetchedOptions = await loadOptions((_a3 = event == null ? void 0 : event.target) == null ? void 0 : _a3.value);
|
|
3549
3646
|
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
3550
3647
|
onChange2(fetchedOptions[0]);
|
|
3551
3648
|
}
|
|
@@ -3664,10 +3761,10 @@ var ValueContainer = ({ children, ...props }) => {
|
|
|
3664
3761
|
// src/components/SelectFieldBip/SelectFieldBip.styles.tsx
|
|
3665
3762
|
var customStyles2 = {
|
|
3666
3763
|
indicatorSeparator: (provided, props) => {
|
|
3667
|
-
var
|
|
3764
|
+
var _a2;
|
|
3668
3765
|
return {
|
|
3669
3766
|
...provided,
|
|
3670
|
-
backgroundColor: props.hasValue && ((
|
|
3767
|
+
backgroundColor: props.hasValue && ((_a2 = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a2.isSearchable) ? "var(--input)" : "transparent",
|
|
3671
3768
|
padding: "0px"
|
|
3672
3769
|
};
|
|
3673
3770
|
},
|
|
@@ -3679,11 +3776,11 @@ var customStyles2 = {
|
|
|
3679
3776
|
}
|
|
3680
3777
|
}),
|
|
3681
3778
|
dropdownIndicator: (provided, state) => {
|
|
3682
|
-
var
|
|
3779
|
+
var _a2;
|
|
3683
3780
|
return {
|
|
3684
3781
|
...provided,
|
|
3685
3782
|
color: "var(--paragraph)",
|
|
3686
|
-
transform: ((
|
|
3783
|
+
transform: ((_a2 = state == null ? void 0 : state.selectProps) == null ? void 0 : _a2.menuIsOpen) ? "rotate(180deg)" : "rotate(0)",
|
|
3687
3784
|
":hover": {
|
|
3688
3785
|
color: "var(--paragraph)"
|
|
3689
3786
|
}
|
|
@@ -3831,7 +3928,7 @@ var SelectFieldBip = forwardRef(
|
|
|
3831
3928
|
loading: "Carregando..."
|
|
3832
3929
|
}
|
|
3833
3930
|
}, ref) => {
|
|
3834
|
-
var
|
|
3931
|
+
var _a2;
|
|
3835
3932
|
const { Option, SingleValue } = components;
|
|
3836
3933
|
const selectRef = useRef(null);
|
|
3837
3934
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -3839,16 +3936,16 @@ var SelectFieldBip = forwardRef(
|
|
|
3839
3936
|
const [cachedOptions, setCachedOptions] = useState([]);
|
|
3840
3937
|
useImperativeHandle(ref, () => ({
|
|
3841
3938
|
focus: () => {
|
|
3842
|
-
var
|
|
3843
|
-
return (
|
|
3939
|
+
var _a3;
|
|
3940
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.focus();
|
|
3844
3941
|
},
|
|
3845
3942
|
clearValue: () => {
|
|
3846
|
-
var
|
|
3847
|
-
return (
|
|
3943
|
+
var _a3;
|
|
3944
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
3848
3945
|
},
|
|
3849
3946
|
getValue: () => {
|
|
3850
|
-
var
|
|
3851
|
-
return (
|
|
3947
|
+
var _a3;
|
|
3948
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.getValue();
|
|
3852
3949
|
},
|
|
3853
3950
|
selectRef: selectRef.current
|
|
3854
3951
|
}));
|
|
@@ -3866,7 +3963,7 @@ var SelectFieldBip = forwardRef(
|
|
|
3866
3963
|
};
|
|
3867
3964
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
3868
3965
|
const fieldValidationMessages = [
|
|
3869
|
-
(
|
|
3966
|
+
(_a2 = fieldValidation[name]) == null ? void 0 : _a2.message,
|
|
3870
3967
|
error == null ? void 0 : error.message
|
|
3871
3968
|
];
|
|
3872
3969
|
const hasError = {
|
|
@@ -3947,7 +4044,7 @@ var SelectFieldBip = forwardRef(
|
|
|
3947
4044
|
}
|
|
3948
4045
|
};
|
|
3949
4046
|
const NoOptionsMessage = (props) => {
|
|
3950
|
-
var
|
|
4047
|
+
var _a3;
|
|
3951
4048
|
if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
|
|
3952
4049
|
return /* @__PURE__ */ jsx(
|
|
3953
4050
|
"div",
|
|
@@ -3957,7 +4054,7 @@ var SelectFieldBip = forwardRef(
|
|
|
3957
4054
|
children: messages.debounce.replace("{debounce}", String(debounce2))
|
|
3958
4055
|
}
|
|
3959
4056
|
);
|
|
3960
|
-
} else if (inputValue.length > 0 && ((
|
|
4057
|
+
} else if (inputValue.length > 0 && ((_a3 = props == null ? void 0 : props.options) == null ? void 0 : _a3.length) == 0) {
|
|
3961
4058
|
return /* @__PURE__ */ jsx(
|
|
3962
4059
|
"div",
|
|
3963
4060
|
{
|
|
@@ -3972,7 +4069,7 @@ var SelectFieldBip = forwardRef(
|
|
|
3972
4069
|
return null;
|
|
3973
4070
|
};
|
|
3974
4071
|
const handleKeyDown = async (event) => {
|
|
3975
|
-
var
|
|
4072
|
+
var _a3;
|
|
3976
4073
|
if (event.key === "Enter") {
|
|
3977
4074
|
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
3978
4075
|
event.preventDefault();
|
|
@@ -3982,17 +4079,17 @@ var SelectFieldBip = forwardRef(
|
|
|
3982
4079
|
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
3983
4080
|
onChange(fetchedOptions[0]);
|
|
3984
4081
|
setTimeout(() => {
|
|
3985
|
-
var
|
|
4082
|
+
var _a4, _b, _c;
|
|
3986
4083
|
if (clearAfterSelect) {
|
|
3987
4084
|
setInputValue("");
|
|
3988
|
-
(
|
|
4085
|
+
(_a4 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a4.clearValue();
|
|
3989
4086
|
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.focus();
|
|
3990
4087
|
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.onMenuClose();
|
|
3991
4088
|
field.onChange(null);
|
|
3992
4089
|
}
|
|
3993
4090
|
}, 10);
|
|
3994
4091
|
} else {
|
|
3995
|
-
onErrorBip((
|
|
4092
|
+
onErrorBip((_a3 = event == null ? void 0 : event.target) == null ? void 0 : _a3.value);
|
|
3996
4093
|
selectRef.current.inputRef.select();
|
|
3997
4094
|
selectRef.current.onMenuClose();
|
|
3998
4095
|
}
|
|
@@ -4005,12 +4102,12 @@ var SelectFieldBip = forwardRef(
|
|
|
4005
4102
|
return value;
|
|
4006
4103
|
};
|
|
4007
4104
|
const onChange = async (value, action) => {
|
|
4008
|
-
var
|
|
4105
|
+
var _a3, _b, _c, _d, _e;
|
|
4009
4106
|
if (onChangeValue) onChangeValue(value);
|
|
4010
4107
|
if ((action == null ? void 0 : action.action) === "select-option") {
|
|
4011
4108
|
if (clearAfterSelect) {
|
|
4012
4109
|
setInputValue("");
|
|
4013
|
-
(
|
|
4110
|
+
(_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
4014
4111
|
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.onMenuClose();
|
|
4015
4112
|
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.focus();
|
|
4016
4113
|
field.onChange(null);
|
|
@@ -4248,7 +4345,7 @@ function PaginationSelect({
|
|
|
4248
4345
|
pageSizeOptions,
|
|
4249
4346
|
table
|
|
4250
4347
|
}) {
|
|
4251
|
-
var
|
|
4348
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4252
4349
|
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
4253
4350
|
const pagesArray = pageCount ? [...Array(pageCount)] : [];
|
|
4254
4351
|
const options = pagesArray == null ? void 0 : pagesArray.map((item, index) => ({
|
|
@@ -4256,7 +4353,7 @@ function PaginationSelect({
|
|
|
4256
4353
|
name: index
|
|
4257
4354
|
}));
|
|
4258
4355
|
const [pageSizeSelected, setPageSizeSelected] = useState({
|
|
4259
|
-
id: ((
|
|
4356
|
+
id: ((_a2 = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _a2.id) || 20,
|
|
4260
4357
|
name: ((_b = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _b.name) || 20
|
|
4261
4358
|
});
|
|
4262
4359
|
const [pageSelected, setPageSelected] = useState({
|
|
@@ -4303,8 +4400,8 @@ function PaginationSelect({
|
|
|
4303
4400
|
);
|
|
4304
4401
|
}, [table == null ? void 0 : table.getPageCount()]);
|
|
4305
4402
|
useEffect(() => {
|
|
4306
|
-
var
|
|
4307
|
-
if (((_b2 = (
|
|
4403
|
+
var _a3, _b2, _c2, _d2, _e2, _f2;
|
|
4404
|
+
if (((_b2 = (_a3 = table == null ? void 0 : table.getState()) == null ? void 0 : _a3.pagination) == null ? void 0 : _b2.pageIndex) >= 0) {
|
|
4308
4405
|
setPageSelected({
|
|
4309
4406
|
id: (_d2 = (_c2 = table == null ? void 0 : table.getState()) == null ? void 0 : _c2.pagination) == null ? void 0 : _d2.pageIndex,
|
|
4310
4407
|
name: (_f2 = (_e2 = table == null ? void 0 : table.getState()) == null ? void 0 : _e2.pagination) == null ? void 0 : _f2.pageIndex
|
|
@@ -4376,8 +4473,8 @@ function PaginationSelect({
|
|
|
4376
4473
|
{
|
|
4377
4474
|
as: "input",
|
|
4378
4475
|
onKeyDown: (e) => {
|
|
4379
|
-
var
|
|
4380
|
-
const val = Number((
|
|
4476
|
+
var _a3;
|
|
4477
|
+
const val = Number((_a3 = e.target) == null ? void 0 : _a3.value);
|
|
4381
4478
|
if (e.key == "Enter" && val && val <= pageCount) {
|
|
4382
4479
|
setPageSelected({
|
|
4383
4480
|
id: val - 1,
|
|
@@ -4513,8 +4610,8 @@ function DataTablePagination({
|
|
|
4513
4610
|
paginationScroll,
|
|
4514
4611
|
pageSizeOptions = []
|
|
4515
4612
|
}) {
|
|
4516
|
-
var
|
|
4517
|
-
const selectedPage = (
|
|
4613
|
+
var _a2, _b, _c, _d, _e;
|
|
4614
|
+
const selectedPage = (_a2 = table == null ? void 0 : table.getState()) == null ? void 0 : _a2.pagination.pageIndex;
|
|
4518
4615
|
const results = totalData;
|
|
4519
4616
|
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
4520
4617
|
const limitPagePositive = ((_b = table == null ? void 0 : table.getState()) == null ? void 0 : _b.pagination.pageIndex) + 2;
|
|
@@ -4714,7 +4811,7 @@ function DataTable({
|
|
|
4714
4811
|
pageSizeOptions,
|
|
4715
4812
|
onFinishFetch
|
|
4716
4813
|
}) {
|
|
4717
|
-
var
|
|
4814
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4718
4815
|
const tableRef = useRef(null);
|
|
4719
4816
|
const [columnVisibility, setColumnVisibility] = useState({});
|
|
4720
4817
|
const [columnFilters, setColumnFilters] = useState([]);
|
|
@@ -4738,12 +4835,12 @@ function DataTable({
|
|
|
4738
4835
|
[pageIndex, pageSize]
|
|
4739
4836
|
);
|
|
4740
4837
|
const fetch = () => {
|
|
4741
|
-
var
|
|
4838
|
+
var _a3, _b2;
|
|
4742
4839
|
if (fetchData && !autoPagination) {
|
|
4743
4840
|
fetchData({
|
|
4744
4841
|
pageSize,
|
|
4745
4842
|
pageIndex,
|
|
4746
|
-
order: (
|
|
4843
|
+
order: (_a3 = sorting[0]) == null ? void 0 : _a3.id,
|
|
4747
4844
|
orderDir: ((_b2 = sorting[0]) == null ? void 0 : _b2.desc) ? "DESC" : "ASC"
|
|
4748
4845
|
}).then((response) => {
|
|
4749
4846
|
setDataTable(response.rows);
|
|
@@ -4788,8 +4885,8 @@ function DataTable({
|
|
|
4788
4885
|
useEffect(() => {
|
|
4789
4886
|
if (!(tableContainerRef == null ? void 0 : tableContainerRef.current)) return;
|
|
4790
4887
|
const resizeObserver = new ResizeObserver(() => {
|
|
4791
|
-
var
|
|
4792
|
-
setPaginationScroll((
|
|
4888
|
+
var _a3;
|
|
4889
|
+
setPaginationScroll((_a3 = tableContainerRef == null ? void 0 : tableContainerRef.current) == null ? void 0 : _a3.scrollWidth);
|
|
4793
4890
|
});
|
|
4794
4891
|
resizeObserver.observe(tableContainerRef == null ? void 0 : tableContainerRef.current);
|
|
4795
4892
|
return () => resizeObserver.disconnect();
|
|
@@ -4878,10 +4975,10 @@ function DataTable({
|
|
|
4878
4975
|
setRowSelection({});
|
|
4879
4976
|
return;
|
|
4880
4977
|
};
|
|
4881
|
-
const hideTableData = dataTable && (dataTable == null ? void 0 : dataTable.length) == 0 && !loading && !hideBlankState || !dataTable || ((_b = (
|
|
4978
|
+
const hideTableData = dataTable && (dataTable == null ? void 0 : dataTable.length) == 0 && !loading && !hideBlankState || !dataTable || ((_b = (_a2 = table == null ? void 0 : table.getRowModel()) == null ? void 0 : _a2.rows) == null ? void 0 : _b.length) == 0;
|
|
4882
4979
|
const canShowTableData = !hidePagination && totalData > 0 && table;
|
|
4883
4980
|
function renderBottomTable() {
|
|
4884
|
-
var
|
|
4981
|
+
var _a3;
|
|
4885
4982
|
if (hideTableData && totalData !== null) {
|
|
4886
4983
|
if (emptyState) {
|
|
4887
4984
|
return emptyState;
|
|
@@ -4898,7 +4995,7 @@ function DataTable({
|
|
|
4898
4995
|
tableRef: tableContainerRef,
|
|
4899
4996
|
selectAllOption,
|
|
4900
4997
|
onSelectAll,
|
|
4901
|
-
rowsSelected: (
|
|
4998
|
+
rowsSelected: (_a3 = Object.keys(rowSelection || {})) == null ? void 0 : _a3.length,
|
|
4902
4999
|
onRemoveAll,
|
|
4903
5000
|
paginationScroll,
|
|
4904
5001
|
pageSizeOptions
|
|
@@ -4912,21 +5009,21 @@ function DataTable({
|
|
|
4912
5009
|
if (rowSelection && Object.keys(rowSelection).length == 0) {
|
|
4913
5010
|
const elements = document.getElementsByClassName("th-shadow");
|
|
4914
5011
|
Object.keys(elements).forEach((index) => {
|
|
4915
|
-
var
|
|
4916
|
-
(_b2 = (
|
|
5012
|
+
var _a3, _b2;
|
|
5013
|
+
(_b2 = (_a3 = elements[index]) == null ? void 0 : _a3.classList) == null ? void 0 : _b2.add("with-shadow");
|
|
4917
5014
|
});
|
|
4918
5015
|
} else if (rowSelection && Object.keys(rowSelection).length == 1) {
|
|
4919
5016
|
const elements = document.getElementsByClassName("th-shadow");
|
|
4920
5017
|
Object.keys(elements).forEach((index) => {
|
|
4921
|
-
var
|
|
4922
|
-
(_b2 = (
|
|
5018
|
+
var _a3, _b2;
|
|
5019
|
+
(_b2 = (_a3 = elements[index]) == null ? void 0 : _a3.classList) == null ? void 0 : _b2.remove("with-shadow");
|
|
4923
5020
|
});
|
|
4924
5021
|
}
|
|
4925
5022
|
}, [rowSelection]);
|
|
4926
5023
|
const stylesRow = (row) => {
|
|
4927
|
-
var
|
|
5024
|
+
var _a3, _b2;
|
|
4928
5025
|
const tb = table;
|
|
4929
|
-
return rowClassName ? (_b2 = (
|
|
5026
|
+
return rowClassName ? (_b2 = (_a3 = tb == null ? void 0 : tb.options) == null ? void 0 : _a3.meta) == null ? void 0 : _b2.getRowStyles(row) : {};
|
|
4930
5027
|
};
|
|
4931
5028
|
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col", children: [
|
|
4932
5029
|
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: [
|
|
@@ -4973,7 +5070,7 @@ function DataTable({
|
|
|
4973
5070
|
] }),
|
|
4974
5071
|
/* @__PURE__ */ jsxs("div", { className: "table w-full mr-[2px]", ref: tableRef, children: [
|
|
4975
5072
|
/* @__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) => {
|
|
4976
|
-
var
|
|
5073
|
+
var _a3, _b2, _c2;
|
|
4977
5074
|
const classes = header.column.columnDef.meta;
|
|
4978
5075
|
return /* @__PURE__ */ jsx(
|
|
4979
5076
|
TableHead,
|
|
@@ -4995,7 +5092,7 @@ function DataTable({
|
|
|
4995
5092
|
header.column.columnDef.header,
|
|
4996
5093
|
header.getContext()
|
|
4997
5094
|
),
|
|
4998
|
-
((
|
|
5095
|
+
((_a3 = sorting[0]) == null ? void 0 : _a3.id) == header.column.id ? /* @__PURE__ */ jsx(
|
|
4999
5096
|
"i",
|
|
5000
5097
|
{
|
|
5001
5098
|
className: clsx9(
|
|
@@ -5382,10 +5479,10 @@ var EditableTextSelect = ({
|
|
|
5382
5479
|
};
|
|
5383
5480
|
const fuse = new Fuse(optionsList, optionsFuse);
|
|
5384
5481
|
const filter = () => {
|
|
5385
|
-
var
|
|
5482
|
+
var _a2;
|
|
5386
5483
|
let results = [...options];
|
|
5387
5484
|
if (inputSearch) {
|
|
5388
|
-
results = (
|
|
5485
|
+
results = (_a2 = fuse.search(inputSearch)) == null ? void 0 : _a2.map((result) => result.item);
|
|
5389
5486
|
}
|
|
5390
5487
|
setOptionsList(results);
|
|
5391
5488
|
};
|
|
@@ -5401,7 +5498,7 @@ var EditableTextSelect = ({
|
|
|
5401
5498
|
control,
|
|
5402
5499
|
name,
|
|
5403
5500
|
render: ({ field }) => {
|
|
5404
|
-
var
|
|
5501
|
+
var _a2;
|
|
5405
5502
|
return /* @__PURE__ */ jsxs(Menu$1, { children: [
|
|
5406
5503
|
/* @__PURE__ */ jsx(Menu$1.Button, { children: /* @__PURE__ */ jsxs(
|
|
5407
5504
|
"div",
|
|
@@ -5409,7 +5506,7 @@ var EditableTextSelect = ({
|
|
|
5409
5506
|
className: "group flex gap-[5px] cursor-pointer z-[500] items-center",
|
|
5410
5507
|
onClick: () => setShowModal(!showModal),
|
|
5411
5508
|
children: [
|
|
5412
|
-
field.value ? valueStyle ? valueStyle(field.value) : (
|
|
5509
|
+
field.value ? valueStyle ? valueStyle(field.value) : (_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.name : /* @__PURE__ */ jsx(
|
|
5413
5510
|
"label",
|
|
5414
5511
|
{
|
|
5415
5512
|
className: clsx9(
|
|
@@ -5449,8 +5546,8 @@ var EditableTextSelect = ({
|
|
|
5449
5546
|
}
|
|
5450
5547
|
) }),
|
|
5451
5548
|
optionsList == null ? void 0 : optionsList.map((opt) => {
|
|
5452
|
-
var
|
|
5453
|
-
const selected = (opt == null ? void 0 : opt.id) === ((
|
|
5549
|
+
var _a3;
|
|
5550
|
+
const selected = (opt == null ? void 0 : opt.id) === ((_a3 = field == null ? void 0 : field.value) == null ? void 0 : _a3.id);
|
|
5454
5551
|
return /* @__PURE__ */ jsx(
|
|
5455
5552
|
Menu$1.Item,
|
|
5456
5553
|
{
|
|
@@ -5701,7 +5798,7 @@ var initialState = {
|
|
|
5701
5798
|
files: []
|
|
5702
5799
|
};
|
|
5703
5800
|
function reducer(state, action) {
|
|
5704
|
-
var
|
|
5801
|
+
var _a2, _b;
|
|
5705
5802
|
switch (action.type) {
|
|
5706
5803
|
case "UPLOAD_START":
|
|
5707
5804
|
return {
|
|
@@ -5718,7 +5815,7 @@ function reducer(state, action) {
|
|
|
5718
5815
|
};
|
|
5719
5816
|
case "UPLOAD_END":
|
|
5720
5817
|
return {
|
|
5721
|
-
files: (
|
|
5818
|
+
files: (_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.map((file) => {
|
|
5722
5819
|
if (file.name === action.payload.name) {
|
|
5723
5820
|
return {
|
|
5724
5821
|
...file,
|
|
@@ -5806,7 +5903,7 @@ var FileUpload = ({
|
|
|
5806
5903
|
name,
|
|
5807
5904
|
limitMessage
|
|
5808
5905
|
}) => {
|
|
5809
|
-
var
|
|
5906
|
+
var _a2;
|
|
5810
5907
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
5811
5908
|
const [dragging, setDragging] = useState(false);
|
|
5812
5909
|
const [loading, setLoading] = useState(false);
|
|
@@ -5816,8 +5913,8 @@ var FileUpload = ({
|
|
|
5816
5913
|
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
5817
5914
|
};
|
|
5818
5915
|
useEffect(() => {
|
|
5819
|
-
var
|
|
5820
|
-
if ((
|
|
5916
|
+
var _a3;
|
|
5917
|
+
if ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.some((file) => file.loading === true)) {
|
|
5821
5918
|
setLoading(true);
|
|
5822
5919
|
} else {
|
|
5823
5920
|
setLoading(false);
|
|
@@ -5829,8 +5926,8 @@ var FileUpload = ({
|
|
|
5829
5926
|
}
|
|
5830
5927
|
}, [files]);
|
|
5831
5928
|
useEffect(() => {
|
|
5832
|
-
var
|
|
5833
|
-
if (!multiple && ((
|
|
5929
|
+
var _a3;
|
|
5930
|
+
if (!multiple && ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.length) === 0 || multiple) {
|
|
5834
5931
|
window.addEventListener("dragover", handleDragOver);
|
|
5835
5932
|
window.addEventListener("drop", handleDrop);
|
|
5836
5933
|
window.addEventListener("dragleave", handleDragLeave);
|
|
@@ -5842,21 +5939,21 @@ var FileUpload = ({
|
|
|
5842
5939
|
};
|
|
5843
5940
|
}, [multiple, state.files]);
|
|
5844
5941
|
const handleDragOver = (event) => {
|
|
5845
|
-
var
|
|
5942
|
+
var _a3;
|
|
5846
5943
|
event.preventDefault();
|
|
5847
5944
|
event.stopPropagation();
|
|
5848
|
-
if (!multiple && ((
|
|
5945
|
+
if (!multiple && ((_a3 = state.files) == null ? void 0 : _a3.length) === 1) {
|
|
5849
5946
|
setDragging(false);
|
|
5850
5947
|
} else {
|
|
5851
5948
|
setDragging(true);
|
|
5852
5949
|
}
|
|
5853
5950
|
};
|
|
5854
5951
|
const handleDrop = (event) => {
|
|
5855
|
-
var
|
|
5952
|
+
var _a3, _b, _c;
|
|
5856
5953
|
event.preventDefault();
|
|
5857
5954
|
event.stopPropagation();
|
|
5858
5955
|
setDragging(false);
|
|
5859
|
-
let files2 = [...(
|
|
5956
|
+
let files2 = [...(_a3 = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a3.files];
|
|
5860
5957
|
if (!multiple && (files2 == null ? void 0 : files2.length) === 1 || multiple && (files2 == null ? void 0 : files2.length) > 0) {
|
|
5861
5958
|
const existingFiles = (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.map((f) => f.name);
|
|
5862
5959
|
files2 = files2.filter((f) => !(existingFiles == null ? void 0 : existingFiles.includes(f.name)));
|
|
@@ -5962,12 +6059,12 @@ var FileUpload = ({
|
|
|
5962
6059
|
});
|
|
5963
6060
|
};
|
|
5964
6061
|
const renderContent = () => {
|
|
5965
|
-
var
|
|
6062
|
+
var _a3;
|
|
5966
6063
|
if (loading) {
|
|
5967
6064
|
return /* @__PURE__ */ jsx(LoadingContent, {});
|
|
5968
6065
|
} else if (dragging) {
|
|
5969
6066
|
return /* @__PURE__ */ jsx(DraggingContent, {});
|
|
5970
|
-
} else if (!multiple && ((
|
|
6067
|
+
} else if (!multiple && ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.length) > 0) {
|
|
5971
6068
|
return /* @__PURE__ */ jsx(BlockedContent, {});
|
|
5972
6069
|
}
|
|
5973
6070
|
return /* @__PURE__ */ jsx(
|
|
@@ -6028,7 +6125,7 @@ var FileUpload = ({
|
|
|
6028
6125
|
"flex gap-[6px]": direction === "horizontal" && !isImage
|
|
6029
6126
|
}
|
|
6030
6127
|
),
|
|
6031
|
-
children: (
|
|
6128
|
+
children: (_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.map((file) => /* @__PURE__ */ jsx(
|
|
6032
6129
|
FileStatus,
|
|
6033
6130
|
{
|
|
6034
6131
|
name: file == null ? void 0 : file.name,
|
|
@@ -6729,20 +6826,20 @@ var MultiSelectBottom = ({
|
|
|
6729
6826
|
control,
|
|
6730
6827
|
defaultValue,
|
|
6731
6828
|
render: ({ field }) => {
|
|
6732
|
-
var
|
|
6829
|
+
var _a2, _b;
|
|
6733
6830
|
const { DropdownIndicator, Option } = components;
|
|
6734
6831
|
const DropdownIndicatorCustom = (props) => {
|
|
6735
6832
|
return /* @__PURE__ */ jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx("i", { className: "uil uil-angle-down text-[20px]" }) });
|
|
6736
6833
|
};
|
|
6737
6834
|
const NoOptionsMessage = (props) => {
|
|
6738
|
-
var
|
|
6835
|
+
var _a3;
|
|
6739
6836
|
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
6740
6837
|
return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
6741
6838
|
"Digite ",
|
|
6742
6839
|
debounce2,
|
|
6743
6840
|
" ou mais caracteres para pesquisar"
|
|
6744
6841
|
] });
|
|
6745
|
-
} else if (props.selectProps.inputValue.length > 0 && ((
|
|
6842
|
+
} else if (props.selectProps.inputValue.length > 0 && ((_a3 = props == null ? void 0 : props.options) == null ? void 0 : _a3.length) == 0) {
|
|
6746
6843
|
return /* @__PURE__ */ jsx("div", { className: "p-2 text-neutral-300", children: "Nenhum dado encontrado" });
|
|
6747
6844
|
}
|
|
6748
6845
|
};
|
|
@@ -6842,7 +6939,7 @@ var MultiSelectBottom = ({
|
|
|
6842
6939
|
},
|
|
6843
6940
|
index
|
|
6844
6941
|
)),
|
|
6845
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: ((
|
|
6942
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: ((_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((item) => /* @__PURE__ */ jsxs("div", { className: "text-p-sm bg-neutral-100 rounded-[20px] py-2 px-3 flex items-center justify-between mt-3", children: [
|
|
6846
6943
|
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: item.label }),
|
|
6847
6944
|
/* @__PURE__ */ jsx(
|
|
6848
6945
|
"button",
|
|
@@ -7417,7 +7514,7 @@ var variants6 = {
|
|
|
7417
7514
|
};
|
|
7418
7515
|
var Timeline = ({ data }) => {
|
|
7419
7516
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: (data == null ? void 0 : data.length) > 0 && (data == null ? void 0 : data.map((item, index) => {
|
|
7420
|
-
var
|
|
7517
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
7421
7518
|
return /* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
7422
7519
|
/* @__PURE__ */ jsxs("div", { className: "mr-3 relative", children: [
|
|
7423
7520
|
index !== data.length - 1 && /* @__PURE__ */ jsx("div", { className: "w-[2px] bg-neutral-200 ml-[5px] h-full absolute mt-8" }),
|
|
@@ -7427,7 +7524,7 @@ var Timeline = ({ data }) => {
|
|
|
7427
7524
|
{
|
|
7428
7525
|
className: clsx9(
|
|
7429
7526
|
{
|
|
7430
|
-
[(
|
|
7527
|
+
[(_a2 = variants6[item == null ? void 0 : item.variant]) == null ? void 0 : _a2.big]: !(item == null ? void 0 : item.color)
|
|
7431
7528
|
},
|
|
7432
7529
|
"h-3 w-3 rounded-full"
|
|
7433
7530
|
),
|