nexaas-ui-components 1.0.104 → 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 +239 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +241 -155
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -270,7 +270,7 @@ var Button = ({
|
|
|
270
270
|
React6.useEffect(() => {
|
|
271
271
|
if (!hotkey || !props.onClick) return;
|
|
272
272
|
const handleKeyDown = (event) => {
|
|
273
|
-
var
|
|
273
|
+
var _a2, _b;
|
|
274
274
|
if (props.disabled || props.loading) return;
|
|
275
275
|
const keys = hotkey.toLowerCase().split("+").map((k) => k.trim());
|
|
276
276
|
const primaryKey = keys.pop();
|
|
@@ -285,7 +285,7 @@ var Button = ({
|
|
|
285
285
|
space: " ",
|
|
286
286
|
spacebar: " "
|
|
287
287
|
};
|
|
288
|
-
const normalizedPrimary = (
|
|
288
|
+
const normalizedPrimary = (_a2 = keyAliases[primaryKey]) != null ? _a2 : primaryKey;
|
|
289
289
|
const match = event.key.toLowerCase() === normalizedPrimary && event.ctrlKey === requiredCtrl && event.altKey === requiredAlt && event.shiftKey === requiredShift && event.metaKey === requiredMeta;
|
|
290
290
|
if (match) {
|
|
291
291
|
event.preventDefault();
|
|
@@ -447,12 +447,12 @@ var ButtonLink = React6.forwardRef(
|
|
|
447
447
|
iconPosition = "left",
|
|
448
448
|
...props
|
|
449
449
|
}, ref) => {
|
|
450
|
-
var
|
|
450
|
+
var _a2;
|
|
451
451
|
const applyGap = icon;
|
|
452
452
|
React6.useEffect(() => {
|
|
453
453
|
if (!hotkey) return;
|
|
454
454
|
const handleKeyDown = (event) => {
|
|
455
|
-
var
|
|
455
|
+
var _a3;
|
|
456
456
|
if (disabled) return;
|
|
457
457
|
const keys = hotkey.toLowerCase().split("+").map((k) => k.trim());
|
|
458
458
|
const primaryKey = keys.pop();
|
|
@@ -465,7 +465,7 @@ var ButtonLink = React6.forwardRef(
|
|
|
465
465
|
if (match) {
|
|
466
466
|
event.preventDefault();
|
|
467
467
|
if (props.onClick) {
|
|
468
|
-
(
|
|
468
|
+
(_a3 = props.onClick) == null ? void 0 : _a3.call(props, event);
|
|
469
469
|
} else {
|
|
470
470
|
const linkElement = document.querySelector(
|
|
471
471
|
`a[href="${props.href}"]`
|
|
@@ -502,7 +502,7 @@ var ButtonLink = React6.forwardRef(
|
|
|
502
502
|
ref,
|
|
503
503
|
className: clsx9__default.default(
|
|
504
504
|
{
|
|
505
|
-
[(
|
|
505
|
+
[(_a2 = variants2[variant]) == null ? void 0 : _a2.text]: true,
|
|
506
506
|
[sizes2[size].text]: true,
|
|
507
507
|
["pointer-events-none shadow-none text-label"]: disabled,
|
|
508
508
|
["px-2"]: variant !== "link" && variant !== "linkDanger",
|
|
@@ -580,30 +580,19 @@ var Input = ({
|
|
|
580
580
|
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
581
581
|
const [showPassword, setShowPassword] = React6__namespace.default.useState(false);
|
|
582
582
|
const styles = {
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
//
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
wrapper: `relative outline-none rounded-lg border-[0.5px] h-[46px] input-focus-ring-within ${disabled ? "bg-[var(--input-bg-disabled)] border-[var(--input-border-disabled)] shadow-none" : `bg-surface shadow-input ${hasError ? "border-dangerous-500" : "border-stroke"}`}`,
|
|
590
|
-
input: `text-p-md pl-2 peer text-paragraph bg-transparent outline-none block pb-[10px] h-full w-full disabled:text-disabled disabled:cursor-not-allowed ${label ? "pt-[22px]" : "pt-[10px]"}`,
|
|
591
|
-
// `top-0 left-0 h-full`: para um filho absolute, o offset e medido a partir do
|
|
592
|
-
// padding-box do ancestral relative (a borda do wrapper ja fica de fora sozinha, o
|
|
593
|
-
// browser nao soma nada por isso). `top-[0.5px]` + `h-[45px]` (usado antes) somava um
|
|
594
|
-
// inset manual de 0.5px SEM encolher a altura pra compensar, entao o icone ultrapassava
|
|
595
|
-
// o padding-box por baixo em 0.5px e estourava a borda inferior. `h-full` ja cobre
|
|
596
|
-
// exatamente o padding-box (46px do wrapper - 2x0.5px de borda = 45px), sem contas.
|
|
597
|
-
// O raio `7.5px` (8px do wrapper - 0.5px de borda) acompanha a curva INTERNA da borda,
|
|
598
|
-
// que e menor que o raio externo pela espessura da borda.
|
|
599
|
-
icon: `absolute bg-neutral-100 top-0 left-0 h-full w-[38px] rounded-l-[7.5px] text-[20px] ${hasError ? "text-dangerous-500" : "text-label peer-focus:text-blue-500"} peer-focus:border-blue-500`,
|
|
583
|
+
// Focus ring padrao: classe `input-focus-ring` (src/styles/index.css) desenha o anel de
|
|
584
|
+
// 1.5px sobre o proprio contorno do campo. Nao usar `ring-*`/`ring-offset-*` do Tailwind
|
|
585
|
+
// aqui: eles criam um anel por fora do input, fora do padrao do design system.
|
|
586
|
+
input: `text-p-md pl-2 peer text-paragraph bg-surface shadow-input border-[0.5px] rounded-lg outline-none 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 ${label ? "pt-[22px]" : "pt-[10px]"}
|
|
587
|
+
${!hasError ? "border-stroke" : ""}`,
|
|
588
|
+
icon: `absolute bg-neutral-100 h-[43px] top-[1.5px] left-[2px] w-[38px] rounded-l-lg text-[20px] ${hasError ? "text-dangerous-500" : "text-label peer-focus:text-blue-500"} peer-focus:border-blue-500`,
|
|
600
589
|
rightIcon: "absolute h-[44px] top-[1px] right-[1.5px] w-[38px] text-[22px]",
|
|
601
590
|
// `-translate-y-[10px]` (e nao `-translate-y-3`/12px): o label flutuante ficava colado
|
|
602
591
|
// demais no topo do campo. Os 2px a menos de deslocamento aproximam o espaco acima do
|
|
603
592
|
// label do espaco abaixo do conteudo (pb-[10px]). Mesmo valor nos demais inputs.
|
|
604
593
|
label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-[10px] scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-[10px] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0",
|
|
605
594
|
clear: "absolute top-[8.3px] cursor-pointer text-label text-[22px]",
|
|
606
|
-
error: "text-dangerous-500"
|
|
595
|
+
error: "border-dangerous-500 text-dangerous-500"
|
|
607
596
|
};
|
|
608
597
|
const inlineStyles = {
|
|
609
598
|
inputWithIcon: { paddingLeft: "48px" },
|
|
@@ -611,7 +600,7 @@ var Input = ({
|
|
|
611
600
|
};
|
|
612
601
|
const input = name ? document == null ? void 0 : document.getElementById(name) : null;
|
|
613
602
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
614
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative outline-none", children: [
|
|
615
604
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
616
605
|
"input",
|
|
617
606
|
{
|
|
@@ -814,7 +803,65 @@ var useFieldErrorsStore = zustand.create(
|
|
|
814
803
|
}))
|
|
815
804
|
})
|
|
816
805
|
);
|
|
806
|
+
|
|
807
|
+
// src/utils/date-input.ts
|
|
808
|
+
var MASK_SLASH_POSITIONS = [2, 5];
|
|
809
|
+
var MAX_DIGITS = 8;
|
|
810
|
+
var formatDigits = (digits) => {
|
|
811
|
+
let out = digits.slice(0, 2);
|
|
812
|
+
if (digits.length > 2) out += `/${digits.slice(2, 4)}`;
|
|
813
|
+
if (digits.length > 4) out += `/${digits.slice(4, MAX_DIGITS)}`;
|
|
814
|
+
return out;
|
|
815
|
+
};
|
|
816
|
+
var maskDateInput = (raw) => {
|
|
817
|
+
if (!/^[\d/]*$/.test(raw)) return raw;
|
|
818
|
+
for (let i = 0; i < raw.length; i++) {
|
|
819
|
+
if (raw[i] === "/" && !MASK_SLASH_POSITIONS.includes(i)) return raw;
|
|
820
|
+
}
|
|
821
|
+
const digits = raw.replace(/\//g, "").slice(0, MAX_DIGITS);
|
|
822
|
+
let out = formatDigits(digits);
|
|
823
|
+
if (raw.endsWith("/") && (digits.length === 2 || digits.length === 4)) {
|
|
824
|
+
out += "/";
|
|
825
|
+
}
|
|
826
|
+
return out;
|
|
827
|
+
};
|
|
828
|
+
var resolveTwoDigitYear = (yy, maxYear) => {
|
|
829
|
+
const year = 2e3 + yy;
|
|
830
|
+
return year > maxYear ? year - 100 : year;
|
|
831
|
+
};
|
|
832
|
+
var parseDateInput = (value, maxYear, allowTwoDigitYear = false) => {
|
|
833
|
+
const text = value.trim().replace(/[-.]/g, "/");
|
|
834
|
+
const digitsOnly = /^(\d{2})(\d{2})(\d{4})$/.exec(text);
|
|
835
|
+
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);
|
|
836
|
+
const match = digitsOnly != null ? digitsOnly : withSeparators;
|
|
837
|
+
if (!match) return /* @__PURE__ */ new Date(NaN);
|
|
838
|
+
const day = Number(match[1]);
|
|
839
|
+
const month = Number(match[2]);
|
|
840
|
+
const year = match[3].length === 2 ? resolveTwoDigitYear(Number(match[3]), maxYear) : Number(match[3]);
|
|
841
|
+
const date = new Date(2e3, 0, 1);
|
|
842
|
+
date.setFullYear(year, month - 1, day);
|
|
843
|
+
date.setHours(0, 0, 0, 0);
|
|
844
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
845
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
846
|
+
}
|
|
847
|
+
return date;
|
|
848
|
+
};
|
|
817
849
|
var DEFAULT_POPOVER_OFFSET = [0, 8];
|
|
850
|
+
var INVALID_DATE_MESSAGE = "Data inv\xE1lida";
|
|
851
|
+
var OUT_OF_RANGE_MESSAGE = "Data n\xE3o permitida";
|
|
852
|
+
var _a;
|
|
853
|
+
var nativeValueSetter = (_a = Object.getOwnPropertyDescriptor(
|
|
854
|
+
typeof HTMLInputElement !== "undefined" ? HTMLInputElement.prototype : {},
|
|
855
|
+
"value"
|
|
856
|
+
)) == null ? void 0 : _a.set;
|
|
857
|
+
var applyDateMask = (event) => {
|
|
858
|
+
const input = event.target;
|
|
859
|
+
if (input.selectionStart !== input.value.length) return;
|
|
860
|
+
const masked = maskDateInput(input.value);
|
|
861
|
+
if (masked !== input.value && nativeValueSetter) {
|
|
862
|
+
nativeValueSetter.call(input, masked);
|
|
863
|
+
}
|
|
864
|
+
};
|
|
818
865
|
var DatePickerInput = React6.forwardRef(
|
|
819
866
|
({
|
|
820
867
|
icon,
|
|
@@ -835,17 +882,28 @@ var DatePickerInput = React6.forwardRef(
|
|
|
835
882
|
onClear,
|
|
836
883
|
popoverOffset
|
|
837
884
|
}, ref) => {
|
|
838
|
-
var
|
|
839
|
-
const [
|
|
885
|
+
var _a2;
|
|
886
|
+
const [dateError, setDateError] = React6.useState(null);
|
|
840
887
|
const [showCalendar, setShowCalendar] = React6.useState(false);
|
|
841
888
|
const inputContainerRef = React6.useRef(null);
|
|
842
889
|
const dateFnsFormat = "dd/MM/yyyy";
|
|
890
|
+
const effectiveMaxDate = maxDate || new Date((/* @__PURE__ */ new Date()).getFullYear() + 5, 11, 31);
|
|
891
|
+
const maxYear = new Date(effectiveMaxDate).getFullYear();
|
|
892
|
+
const effectiveMinDate = minDate || new Date(1900, 0, 1);
|
|
893
|
+
const maskedInputNodeRef = React6.useRef(null);
|
|
894
|
+
const maskedInputRef = React6.useCallback((node) => {
|
|
895
|
+
var _a3;
|
|
896
|
+
(_a3 = maskedInputNodeRef.current) == null ? void 0 : _a3.removeEventListener("input", applyDateMask);
|
|
897
|
+
maskedInputNodeRef.current = node;
|
|
898
|
+
node == null ? void 0 : node.addEventListener("input", applyDateMask);
|
|
899
|
+
}, []);
|
|
843
900
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
844
901
|
const fieldValidationMessages = [
|
|
845
|
-
(
|
|
902
|
+
(_a2 = fieldValidation[name ? name : registration == null ? void 0 : registration.name]) == null ? void 0 : _a2.message,
|
|
846
903
|
error == null ? void 0 : error.message
|
|
847
904
|
];
|
|
848
905
|
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
906
|
+
const inputBorder = (dateErrorShown) => hasError ? "border-dangerous-500 text-dangerous-500" : dateErrorShown ? "border-dangerous-500 placeholder:text-dangerous-500" : "border-stroke";
|
|
849
907
|
const styles = {
|
|
850
908
|
// Borda e sombra iguais as do Input: `rounded-lg` (era `rounded`, 4px contra os 8px do
|
|
851
909
|
// Input) e o mesmo bloco de disabled, com os tokens `--input-bg-disabled` /
|
|
@@ -854,9 +912,9 @@ var DatePickerInput = React6.forwardRef(
|
|
|
854
912
|
// `border-solid` e obrigatorio aqui (o Input nao precisa): o Blueprint declara
|
|
855
913
|
// `.bp6-input { border: none }`, que vence o `border-style: solid` do preflight do
|
|
856
914
|
// Tailwind (seletor `*`). Sem ele a borda tem largura e cor certas mas nao aparece.
|
|
857
|
-
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
|
|
915
|
+
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`,
|
|
858
916
|
// left-[1.5px] como no Input: cobre a borda de 0.5px sem deixar fiapo aparecendo.
|
|
859
|
-
icon:
|
|
917
|
+
icon: "absolute bg-neutral-100 h-[42px] w-[38px] top-[2px] left-[1.5px] rounded-l-lg rounded-r-none",
|
|
860
918
|
label: "absolute text-label text-sm",
|
|
861
919
|
clear: "absolute top-[8px] right-[8px] cursor-pointer text-label text-[22px]"
|
|
862
920
|
};
|
|
@@ -880,6 +938,41 @@ var DatePickerInput = React6.forwardRef(
|
|
|
880
938
|
return null;
|
|
881
939
|
};
|
|
882
940
|
const normalizedValue = normalizeDate(field.value);
|
|
941
|
+
const dateErrorShown = !normalizedValue && dateError !== null;
|
|
942
|
+
const commitValue = (e) => {
|
|
943
|
+
let value = null;
|
|
944
|
+
if (e) {
|
|
945
|
+
const date = new Date(e);
|
|
946
|
+
date.setUTCHours(23, 59, 59, 0);
|
|
947
|
+
value = date.toISOString();
|
|
948
|
+
}
|
|
949
|
+
field.onChange(value);
|
|
950
|
+
setShowCalendar(false);
|
|
951
|
+
if (onChangeFunction) {
|
|
952
|
+
onChangeFunction(value);
|
|
953
|
+
}
|
|
954
|
+
setDateError(null);
|
|
955
|
+
};
|
|
956
|
+
const handleDateError = (date) => {
|
|
957
|
+
setDateError(
|
|
958
|
+
date && !isNaN(date.getTime()) ? OUT_OF_RANGE_MESSAGE : INVALID_DATE_MESSAGE
|
|
959
|
+
);
|
|
960
|
+
if (field.value) {
|
|
961
|
+
field.onChange(null);
|
|
962
|
+
if (onChangeFunction) {
|
|
963
|
+
onChangeFunction(null);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
const commitTwoDigitYear = (e) => {
|
|
968
|
+
const typed = e.target.value.trim();
|
|
969
|
+
if (!/^\d{1,2}[/.-]\d{1,2}[/.-]\d{2}$/.test(typed)) return;
|
|
970
|
+
const date = parseDateInput(typed, maxYear, true);
|
|
971
|
+
if (isNaN(date.getTime()) || date < dateFns.startOfDay(new Date(effectiveMinDate)) || date > dateFns.endOfDay(new Date(effectiveMaxDate))) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
commitValue(date);
|
|
975
|
+
};
|
|
883
976
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
884
977
|
"div",
|
|
885
978
|
{
|
|
@@ -900,6 +993,7 @@ var DatePickerInput = React6.forwardRef(
|
|
|
900
993
|
id: "icon",
|
|
901
994
|
className: clsx9__default.default(
|
|
902
995
|
styles.icon,
|
|
996
|
+
hasError || dateErrorShown ? "text-dangerous-700" : "text-label",
|
|
903
997
|
"flex justify-center items-center text-[20px]"
|
|
904
998
|
),
|
|
905
999
|
children: icon
|
|
@@ -908,9 +1002,9 @@ var DatePickerInput = React6.forwardRef(
|
|
|
908
1002
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
909
1003
|
datetime2.DateInput3,
|
|
910
1004
|
{
|
|
911
|
-
outOfRangeMessage: "
|
|
912
|
-
invalidDateMessage: "
|
|
913
|
-
onError:
|
|
1005
|
+
outOfRangeMessage: "",
|
|
1006
|
+
invalidDateMessage: "",
|
|
1007
|
+
onError: handleDateError,
|
|
914
1008
|
defaultValue: normalizedValue,
|
|
915
1009
|
inputProps: {
|
|
916
1010
|
// `inputClassName`, nao `className`: o DateInput3 repassa `inputProps` para o
|
|
@@ -918,8 +1012,11 @@ var DatePickerInput = React6.forwardRef(
|
|
|
918
1012
|
// sai so com `bp6-input` e todas as classes daqui viravam letra morta (sem
|
|
919
1013
|
// `shadow-input`, sem `input-focus-ring`, sem os estados de disabled). O
|
|
920
1014
|
// InputGroup aplica `inputClassName` no proprio <input>.
|
|
921
|
-
inputClassName: styles.input,
|
|
922
|
-
|
|
1015
|
+
inputClassName: clsx9__default.default(styles.input, inputBorder(dateErrorShown)),
|
|
1016
|
+
placeholder: dateErrorShown ? dateError : void 0,
|
|
1017
|
+
style: { height: "46px" },
|
|
1018
|
+
inputRef: maskedInputRef,
|
|
1019
|
+
onBlur: commitTwoDigitYear
|
|
923
1020
|
},
|
|
924
1021
|
popoverProps: {
|
|
925
1022
|
placement: "bottom-start",
|
|
@@ -951,18 +1048,7 @@ var DatePickerInput = React6.forwardRef(
|
|
|
951
1048
|
disabled,
|
|
952
1049
|
onChange: (e, isUserChange) => {
|
|
953
1050
|
if (isUserChange) {
|
|
954
|
-
|
|
955
|
-
if (e) {
|
|
956
|
-
const date = new Date(e);
|
|
957
|
-
date.setUTCHours(23, 59, 59, 0);
|
|
958
|
-
value = date.toISOString();
|
|
959
|
-
}
|
|
960
|
-
field.onChange(value);
|
|
961
|
-
setShowCalendar(false);
|
|
962
|
-
if (onChangeFunction) {
|
|
963
|
-
onChangeFunction(value);
|
|
964
|
-
}
|
|
965
|
-
setInvalidDate(false);
|
|
1051
|
+
commitValue(e);
|
|
966
1052
|
}
|
|
967
1053
|
},
|
|
968
1054
|
value: normalizedValue,
|
|
@@ -974,9 +1060,9 @@ var DatePickerInput = React6.forwardRef(
|
|
|
974
1060
|
);
|
|
975
1061
|
return dateFns.format(adjusted, dateFnsFormat);
|
|
976
1062
|
},
|
|
977
|
-
parseDate: (value) =>
|
|
978
|
-
maxDate:
|
|
979
|
-
minDate:
|
|
1063
|
+
parseDate: (value) => parseDateInput(value, maxYear),
|
|
1064
|
+
maxDate: effectiveMaxDate,
|
|
1065
|
+
minDate: effectiveMinDate
|
|
980
1066
|
}
|
|
981
1067
|
),
|
|
982
1068
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -986,7 +1072,7 @@ var DatePickerInput = React6.forwardRef(
|
|
|
986
1072
|
"pointer-events-none ",
|
|
987
1073
|
styles.label,
|
|
988
1074
|
`
|
|
989
|
-
${field.value && field.value[0] !== null ||
|
|
1075
|
+
${field.value && field.value[0] !== null || dateErrorShown ? " scale-75 -translate-y-[10px] " : ""}
|
|
990
1076
|
${icon ? "left-[3rem]" : "left-2.5"}`
|
|
991
1077
|
),
|
|
992
1078
|
style: { top: "13px" },
|
|
@@ -1611,8 +1697,8 @@ var FilterCalendar = ({
|
|
|
1611
1697
|
name,
|
|
1612
1698
|
control,
|
|
1613
1699
|
render: ({ field }) => {
|
|
1614
|
-
var
|
|
1615
|
-
let hasValue = ((
|
|
1700
|
+
var _a2, _b, _c;
|
|
1701
|
+
let hasValue = ((_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.length) > 0 || !!calendarLabel && calendarLabel !== shorcuts[0].label;
|
|
1616
1702
|
const clearValue = () => {
|
|
1617
1703
|
if (!onClear) return;
|
|
1618
1704
|
onClear();
|
|
@@ -1863,13 +1949,13 @@ var FilterOptions = ({
|
|
|
1863
1949
|
} else {
|
|
1864
1950
|
const result = options.filter(
|
|
1865
1951
|
(opt) => {
|
|
1866
|
-
var
|
|
1867
|
-
return (
|
|
1952
|
+
var _a2;
|
|
1953
|
+
return (_a2 = opt == null ? void 0 : opt.label) == null ? void 0 : _a2.toLowerCase().includes(filter.toLowerCase());
|
|
1868
1954
|
}
|
|
1869
1955
|
);
|
|
1870
1956
|
const order = result.sort((a, b) => {
|
|
1871
|
-
var
|
|
1872
|
-
return (
|
|
1957
|
+
var _a2;
|
|
1958
|
+
return (_a2 = a == null ? void 0 : a.label) == null ? void 0 : _a2.toLowerCase();
|
|
1873
1959
|
});
|
|
1874
1960
|
setData(order);
|
|
1875
1961
|
}
|
|
@@ -1956,8 +2042,8 @@ var FilterOptions = ({
|
|
|
1956
2042
|
name,
|
|
1957
2043
|
control,
|
|
1958
2044
|
render: ({ field }) => {
|
|
1959
|
-
var
|
|
1960
|
-
let hasValue = isMulti ? ((
|
|
2045
|
+
var _a2, _b;
|
|
2046
|
+
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);
|
|
1961
2047
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1962
2048
|
react.Popover,
|
|
1963
2049
|
{
|
|
@@ -1966,7 +2052,7 @@ var FilterOptions = ({
|
|
|
1966
2052
|
"relative text-paragraph"
|
|
1967
2053
|
),
|
|
1968
2054
|
children: ({ open }) => {
|
|
1969
|
-
var
|
|
2055
|
+
var _a3, _b2;
|
|
1970
2056
|
return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Float, { composable: true, shift: 8, zIndex: 99, offset: 6, children: [
|
|
1971
2057
|
/* @__PURE__ */ jsxRuntime.jsx(react$1.Float.Reference, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1972
2058
|
react.PopoverButton,
|
|
@@ -2007,7 +2093,7 @@ var FilterOptions = ({
|
|
|
2007
2093
|
},
|
|
2008
2094
|
"truncate cursor-pointer"
|
|
2009
2095
|
),
|
|
2010
|
-
children: isMulti ? label : ((
|
|
2096
|
+
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
|
|
2011
2097
|
}
|
|
2012
2098
|
),
|
|
2013
2099
|
isMulti && field.value && field.value.length > 0 && /* @__PURE__ */ jsxRuntime.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 }),
|
|
@@ -2253,13 +2339,13 @@ var FilterSelect = ({
|
|
|
2253
2339
|
} else {
|
|
2254
2340
|
const result = options.filter(
|
|
2255
2341
|
(opt) => {
|
|
2256
|
-
var
|
|
2257
|
-
return (
|
|
2342
|
+
var _a2;
|
|
2343
|
+
return (_a2 = opt == null ? void 0 : opt.label) == null ? void 0 : _a2.toLowerCase().includes(filter.toLowerCase());
|
|
2258
2344
|
}
|
|
2259
2345
|
);
|
|
2260
2346
|
const order = result.sort((a, b) => {
|
|
2261
|
-
var
|
|
2262
|
-
return (
|
|
2347
|
+
var _a2;
|
|
2348
|
+
return (_a2 = a == null ? void 0 : a.label) == null ? void 0 : _a2.toLowerCase();
|
|
2263
2349
|
});
|
|
2264
2350
|
setData(order);
|
|
2265
2351
|
}
|
|
@@ -2346,8 +2432,8 @@ var FilterSelect = ({
|
|
|
2346
2432
|
name,
|
|
2347
2433
|
control,
|
|
2348
2434
|
render: ({ field }) => {
|
|
2349
|
-
var
|
|
2350
|
-
let hasValue = isMulti ? ((
|
|
2435
|
+
var _a2, _b;
|
|
2436
|
+
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);
|
|
2351
2437
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2352
2438
|
react.Popover,
|
|
2353
2439
|
{
|
|
@@ -2356,7 +2442,7 @@ var FilterSelect = ({
|
|
|
2356
2442
|
"relative text-paragraph"
|
|
2357
2443
|
),
|
|
2358
2444
|
children: ({ open }) => {
|
|
2359
|
-
var
|
|
2445
|
+
var _a3, _b2;
|
|
2360
2446
|
return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Float, { composable: true, shift: 8, zIndex: 99, offset: 6, children: [
|
|
2361
2447
|
/* @__PURE__ */ jsxRuntime.jsx(react$1.Float.Reference, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group", children: [
|
|
2362
2448
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2369,7 +2455,7 @@ var FilterSelect = ({
|
|
|
2369
2455
|
),
|
|
2370
2456
|
children: [
|
|
2371
2457
|
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[18px] leading-none", children: icon }),
|
|
2372
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate cursor-pointer", children: isMulti ? label : ((
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
2373
2459
|
isMulti && field.value && field.value.length > 0 && /* @__PURE__ */ jsxRuntime.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 }),
|
|
2374
2460
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2375
2461
|
"i",
|
|
@@ -3165,7 +3251,7 @@ var ModalDialog = ({
|
|
|
3165
3251
|
headerBorder = false,
|
|
3166
3252
|
closeOnOverlayClick = true
|
|
3167
3253
|
}) => {
|
|
3168
|
-
var
|
|
3254
|
+
var _a2;
|
|
3169
3255
|
const customStyles6 = {
|
|
3170
3256
|
content: {
|
|
3171
3257
|
top: "50%",
|
|
@@ -3186,7 +3272,7 @@ var ModalDialog = ({
|
|
|
3186
3272
|
zIndex: 9999
|
|
3187
3273
|
}
|
|
3188
3274
|
};
|
|
3189
|
-
const hasIcon = React6__namespace.default.isValidElement(icon) && !(icon.type === React6__namespace.default.Fragment && React6__namespace.default.Children.count((
|
|
3275
|
+
const hasIcon = React6__namespace.default.isValidElement(icon) && !(icon.type === React6__namespace.default.Fragment && React6__namespace.default.Children.count((_a2 = icon.props) == null ? void 0 : _a2.children) === 0);
|
|
3190
3276
|
const trigger = triggerButton ? React6.cloneElement(triggerButton, {
|
|
3191
3277
|
onClick: () => {
|
|
3192
3278
|
onOpen();
|
|
@@ -3275,10 +3361,10 @@ var ModalDialog = ({
|
|
|
3275
3361
|
// src/components/Select/Select.styles.ts
|
|
3276
3362
|
var customStyles = {
|
|
3277
3363
|
indicatorSeparator: (provided, props) => {
|
|
3278
|
-
var
|
|
3364
|
+
var _a2;
|
|
3279
3365
|
return {
|
|
3280
3366
|
...provided,
|
|
3281
|
-
backgroundColor: props.hasValue && ((
|
|
3367
|
+
backgroundColor: props.hasValue && ((_a2 = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a2.isSearchable) ? "var(--input)" : "transparent"
|
|
3282
3368
|
};
|
|
3283
3369
|
},
|
|
3284
3370
|
clearIndicator: (provided) => ({
|
|
@@ -3438,7 +3524,7 @@ var SelectField = ({
|
|
|
3438
3524
|
clearOnMenuClose,
|
|
3439
3525
|
showArrow = true
|
|
3440
3526
|
}) => {
|
|
3441
|
-
var
|
|
3527
|
+
var _a2;
|
|
3442
3528
|
const { Option, DropdownIndicator, ClearIndicator, SingleValue } = Select.components;
|
|
3443
3529
|
const selectRef = React6.useRef(null);
|
|
3444
3530
|
const [inputValue, setInputValue] = React6.useState("");
|
|
@@ -3449,8 +3535,8 @@ var SelectField = ({
|
|
|
3449
3535
|
const [isFocused, setIsFocused] = React6.useState(false);
|
|
3450
3536
|
React6.useEffect(() => {
|
|
3451
3537
|
const updateAvailableHeight = () => {
|
|
3452
|
-
var
|
|
3453
|
-
if ((
|
|
3538
|
+
var _a3, _b;
|
|
3539
|
+
if ((_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.getBoundingClientRect) {
|
|
3454
3540
|
const rect = (_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.getBoundingClientRect();
|
|
3455
3541
|
const bottomSpace = window.innerHeight - rect.bottom;
|
|
3456
3542
|
const margin = bottomSpace - 24;
|
|
@@ -3480,7 +3566,7 @@ var SelectField = ({
|
|
|
3480
3566
|
};
|
|
3481
3567
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
3482
3568
|
const fieldValidationMessages = [
|
|
3483
|
-
(
|
|
3569
|
+
(_a2 = fieldValidation[name]) == null ? void 0 : _a2.message,
|
|
3484
3570
|
error == null ? void 0 : error.message
|
|
3485
3571
|
];
|
|
3486
3572
|
const hasError = {
|
|
@@ -3549,7 +3635,7 @@ var SelectField = ({
|
|
|
3549
3635
|
}
|
|
3550
3636
|
};
|
|
3551
3637
|
const NoOptionsMessage = (props) => {
|
|
3552
|
-
var
|
|
3638
|
+
var _a3, _b;
|
|
3553
3639
|
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
3554
3640
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
3555
3641
|
"Digite ",
|
|
@@ -3558,18 +3644,18 @@ var SelectField = ({
|
|
|
3558
3644
|
] });
|
|
3559
3645
|
} else if (initialMessage && !debounce2 && isSearchable && props.selectProps.inputValue.length === 0) {
|
|
3560
3646
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-neutral-300", children: initialMessage });
|
|
3561
|
-
} else if ((props.selectProps.inputValue.length > 0 && isSearchable || !isSearchable || isSearchable && ((
|
|
3647
|
+
} 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) {
|
|
3562
3648
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-neutral-300", children: emptyMessage || "Sem opc\u0327o\u0303es disponi\u0301veis" });
|
|
3563
3649
|
}
|
|
3564
3650
|
};
|
|
3565
3651
|
const DropdownIndicatorCustom = (props) => {
|
|
3566
|
-
var
|
|
3652
|
+
var _a3;
|
|
3567
3653
|
return /* @__PURE__ */ jsxRuntime.jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3568
3654
|
"i",
|
|
3569
3655
|
{
|
|
3570
3656
|
className: clsx9__default.default(
|
|
3571
3657
|
"uil text-[20px]",
|
|
3572
|
-
((
|
|
3658
|
+
((_a3 = props.selectProps) == null ? void 0 : _a3.menuIsOpen) ? "uil-angle-up" : "uil-angle-down",
|
|
3573
3659
|
small ? "h-[20px] -mt-[7px]" : "h-full"
|
|
3574
3660
|
)
|
|
3575
3661
|
}
|
|
@@ -3585,10 +3671,10 @@ var SelectField = ({
|
|
|
3585
3671
|
}
|
|
3586
3672
|
};
|
|
3587
3673
|
const handleKeyDown = async (event) => {
|
|
3588
|
-
var
|
|
3674
|
+
var _a3;
|
|
3589
3675
|
if (event.key === "Enter") {
|
|
3590
3676
|
event.preventDefault();
|
|
3591
|
-
const fetchedOptions = await loadOptions((
|
|
3677
|
+
const fetchedOptions = await loadOptions((_a3 = event == null ? void 0 : event.target) == null ? void 0 : _a3.value);
|
|
3592
3678
|
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
3593
3679
|
onChange2(fetchedOptions[0]);
|
|
3594
3680
|
}
|
|
@@ -3707,10 +3793,10 @@ var ValueContainer = ({ children, ...props }) => {
|
|
|
3707
3793
|
// src/components/SelectFieldBip/SelectFieldBip.styles.tsx
|
|
3708
3794
|
var customStyles2 = {
|
|
3709
3795
|
indicatorSeparator: (provided, props) => {
|
|
3710
|
-
var
|
|
3796
|
+
var _a2;
|
|
3711
3797
|
return {
|
|
3712
3798
|
...provided,
|
|
3713
|
-
backgroundColor: props.hasValue && ((
|
|
3799
|
+
backgroundColor: props.hasValue && ((_a2 = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a2.isSearchable) ? "var(--input)" : "transparent",
|
|
3714
3800
|
padding: "0px"
|
|
3715
3801
|
};
|
|
3716
3802
|
},
|
|
@@ -3722,11 +3808,11 @@ var customStyles2 = {
|
|
|
3722
3808
|
}
|
|
3723
3809
|
}),
|
|
3724
3810
|
dropdownIndicator: (provided, state) => {
|
|
3725
|
-
var
|
|
3811
|
+
var _a2;
|
|
3726
3812
|
return {
|
|
3727
3813
|
...provided,
|
|
3728
3814
|
color: "var(--paragraph)",
|
|
3729
|
-
transform: ((
|
|
3815
|
+
transform: ((_a2 = state == null ? void 0 : state.selectProps) == null ? void 0 : _a2.menuIsOpen) ? "rotate(180deg)" : "rotate(0)",
|
|
3730
3816
|
":hover": {
|
|
3731
3817
|
color: "var(--paragraph)"
|
|
3732
3818
|
}
|
|
@@ -3874,7 +3960,7 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
3874
3960
|
loading: "Carregando..."
|
|
3875
3961
|
}
|
|
3876
3962
|
}, ref) => {
|
|
3877
|
-
var
|
|
3963
|
+
var _a2;
|
|
3878
3964
|
const { Option, SingleValue } = Select.components;
|
|
3879
3965
|
const selectRef = React6.useRef(null);
|
|
3880
3966
|
const [inputValue, setInputValue] = React6.useState("");
|
|
@@ -3882,16 +3968,16 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
3882
3968
|
const [cachedOptions, setCachedOptions] = React6.useState([]);
|
|
3883
3969
|
React6.useImperativeHandle(ref, () => ({
|
|
3884
3970
|
focus: () => {
|
|
3885
|
-
var
|
|
3886
|
-
return (
|
|
3971
|
+
var _a3;
|
|
3972
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.focus();
|
|
3887
3973
|
},
|
|
3888
3974
|
clearValue: () => {
|
|
3889
|
-
var
|
|
3890
|
-
return (
|
|
3975
|
+
var _a3;
|
|
3976
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
3891
3977
|
},
|
|
3892
3978
|
getValue: () => {
|
|
3893
|
-
var
|
|
3894
|
-
return (
|
|
3979
|
+
var _a3;
|
|
3980
|
+
return (_a3 = selectRef.current) == null ? void 0 : _a3.getValue();
|
|
3895
3981
|
},
|
|
3896
3982
|
selectRef: selectRef.current
|
|
3897
3983
|
}));
|
|
@@ -3909,7 +3995,7 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
3909
3995
|
};
|
|
3910
3996
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
3911
3997
|
const fieldValidationMessages = [
|
|
3912
|
-
(
|
|
3998
|
+
(_a2 = fieldValidation[name]) == null ? void 0 : _a2.message,
|
|
3913
3999
|
error == null ? void 0 : error.message
|
|
3914
4000
|
];
|
|
3915
4001
|
const hasError = {
|
|
@@ -3990,7 +4076,7 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
3990
4076
|
}
|
|
3991
4077
|
};
|
|
3992
4078
|
const NoOptionsMessage = (props) => {
|
|
3993
|
-
var
|
|
4079
|
+
var _a3;
|
|
3994
4080
|
if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
|
|
3995
4081
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3996
4082
|
"div",
|
|
@@ -4000,7 +4086,7 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
4000
4086
|
children: messages.debounce.replace("{debounce}", String(debounce2))
|
|
4001
4087
|
}
|
|
4002
4088
|
);
|
|
4003
|
-
} else if (inputValue.length > 0 && ((
|
|
4089
|
+
} else if (inputValue.length > 0 && ((_a3 = props == null ? void 0 : props.options) == null ? void 0 : _a3.length) == 0) {
|
|
4004
4090
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4005
4091
|
"div",
|
|
4006
4092
|
{
|
|
@@ -4015,7 +4101,7 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
4015
4101
|
return null;
|
|
4016
4102
|
};
|
|
4017
4103
|
const handleKeyDown = async (event) => {
|
|
4018
|
-
var
|
|
4104
|
+
var _a3;
|
|
4019
4105
|
if (event.key === "Enter") {
|
|
4020
4106
|
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
4021
4107
|
event.preventDefault();
|
|
@@ -4025,17 +4111,17 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
4025
4111
|
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
4026
4112
|
onChange(fetchedOptions[0]);
|
|
4027
4113
|
setTimeout(() => {
|
|
4028
|
-
var
|
|
4114
|
+
var _a4, _b, _c;
|
|
4029
4115
|
if (clearAfterSelect) {
|
|
4030
4116
|
setInputValue("");
|
|
4031
|
-
(
|
|
4117
|
+
(_a4 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a4.clearValue();
|
|
4032
4118
|
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.focus();
|
|
4033
4119
|
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.onMenuClose();
|
|
4034
4120
|
field.onChange(null);
|
|
4035
4121
|
}
|
|
4036
4122
|
}, 10);
|
|
4037
4123
|
} else {
|
|
4038
|
-
onErrorBip((
|
|
4124
|
+
onErrorBip((_a3 = event == null ? void 0 : event.target) == null ? void 0 : _a3.value);
|
|
4039
4125
|
selectRef.current.inputRef.select();
|
|
4040
4126
|
selectRef.current.onMenuClose();
|
|
4041
4127
|
}
|
|
@@ -4048,12 +4134,12 @@ var SelectFieldBip = React6.forwardRef(
|
|
|
4048
4134
|
return value;
|
|
4049
4135
|
};
|
|
4050
4136
|
const onChange = async (value, action) => {
|
|
4051
|
-
var
|
|
4137
|
+
var _a3, _b, _c, _d, _e;
|
|
4052
4138
|
if (onChangeValue) onChangeValue(value);
|
|
4053
4139
|
if ((action == null ? void 0 : action.action) === "select-option") {
|
|
4054
4140
|
if (clearAfterSelect) {
|
|
4055
4141
|
setInputValue("");
|
|
4056
|
-
(
|
|
4142
|
+
(_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
4057
4143
|
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.onMenuClose();
|
|
4058
4144
|
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.focus();
|
|
4059
4145
|
field.onChange(null);
|
|
@@ -4291,7 +4377,7 @@ function PaginationSelect({
|
|
|
4291
4377
|
pageSizeOptions,
|
|
4292
4378
|
table
|
|
4293
4379
|
}) {
|
|
4294
|
-
var
|
|
4380
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4295
4381
|
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
4296
4382
|
const pagesArray = pageCount ? [...Array(pageCount)] : [];
|
|
4297
4383
|
const options = pagesArray == null ? void 0 : pagesArray.map((item, index) => ({
|
|
@@ -4299,7 +4385,7 @@ function PaginationSelect({
|
|
|
4299
4385
|
name: index
|
|
4300
4386
|
}));
|
|
4301
4387
|
const [pageSizeSelected, setPageSizeSelected] = React6.useState({
|
|
4302
|
-
id: ((
|
|
4388
|
+
id: ((_a2 = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _a2.id) || 20,
|
|
4303
4389
|
name: ((_b = JSON.parse(sessionStorage.getItem("pageSize"))) == null ? void 0 : _b.name) || 20
|
|
4304
4390
|
});
|
|
4305
4391
|
const [pageSelected, setPageSelected] = React6.useState({
|
|
@@ -4346,8 +4432,8 @@ function PaginationSelect({
|
|
|
4346
4432
|
);
|
|
4347
4433
|
}, [table == null ? void 0 : table.getPageCount()]);
|
|
4348
4434
|
React6.useEffect(() => {
|
|
4349
|
-
var
|
|
4350
|
-
if (((_b2 = (
|
|
4435
|
+
var _a3, _b2, _c2, _d2, _e2, _f2;
|
|
4436
|
+
if (((_b2 = (_a3 = table == null ? void 0 : table.getState()) == null ? void 0 : _a3.pagination) == null ? void 0 : _b2.pageIndex) >= 0) {
|
|
4351
4437
|
setPageSelected({
|
|
4352
4438
|
id: (_d2 = (_c2 = table == null ? void 0 : table.getState()) == null ? void 0 : _c2.pagination) == null ? void 0 : _d2.pageIndex,
|
|
4353
4439
|
name: (_f2 = (_e2 = table == null ? void 0 : table.getState()) == null ? void 0 : _e2.pagination) == null ? void 0 : _f2.pageIndex
|
|
@@ -4419,8 +4505,8 @@ function PaginationSelect({
|
|
|
4419
4505
|
{
|
|
4420
4506
|
as: "input",
|
|
4421
4507
|
onKeyDown: (e) => {
|
|
4422
|
-
var
|
|
4423
|
-
const val = Number((
|
|
4508
|
+
var _a3;
|
|
4509
|
+
const val = Number((_a3 = e.target) == null ? void 0 : _a3.value);
|
|
4424
4510
|
if (e.key == "Enter" && val && val <= pageCount) {
|
|
4425
4511
|
setPageSelected({
|
|
4426
4512
|
id: val - 1,
|
|
@@ -4556,8 +4642,8 @@ function DataTablePagination({
|
|
|
4556
4642
|
paginationScroll,
|
|
4557
4643
|
pageSizeOptions = []
|
|
4558
4644
|
}) {
|
|
4559
|
-
var
|
|
4560
|
-
const selectedPage = (
|
|
4645
|
+
var _a2, _b, _c, _d, _e;
|
|
4646
|
+
const selectedPage = (_a2 = table == null ? void 0 : table.getState()) == null ? void 0 : _a2.pagination.pageIndex;
|
|
4561
4647
|
const results = totalData;
|
|
4562
4648
|
const pageCount = table == null ? void 0 : table.getPageCount();
|
|
4563
4649
|
const limitPagePositive = ((_b = table == null ? void 0 : table.getState()) == null ? void 0 : _b.pagination.pageIndex) + 2;
|
|
@@ -4757,7 +4843,7 @@ function DataTable({
|
|
|
4757
4843
|
pageSizeOptions,
|
|
4758
4844
|
onFinishFetch
|
|
4759
4845
|
}) {
|
|
4760
|
-
var
|
|
4846
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4761
4847
|
const tableRef = React6.useRef(null);
|
|
4762
4848
|
const [columnVisibility, setColumnVisibility] = React6.useState({});
|
|
4763
4849
|
const [columnFilters, setColumnFilters] = React6.useState([]);
|
|
@@ -4781,12 +4867,12 @@ function DataTable({
|
|
|
4781
4867
|
[pageIndex, pageSize]
|
|
4782
4868
|
);
|
|
4783
4869
|
const fetch = () => {
|
|
4784
|
-
var
|
|
4870
|
+
var _a3, _b2;
|
|
4785
4871
|
if (fetchData && !autoPagination) {
|
|
4786
4872
|
fetchData({
|
|
4787
4873
|
pageSize,
|
|
4788
4874
|
pageIndex,
|
|
4789
|
-
order: (
|
|
4875
|
+
order: (_a3 = sorting[0]) == null ? void 0 : _a3.id,
|
|
4790
4876
|
orderDir: ((_b2 = sorting[0]) == null ? void 0 : _b2.desc) ? "DESC" : "ASC"
|
|
4791
4877
|
}).then((response) => {
|
|
4792
4878
|
setDataTable(response.rows);
|
|
@@ -4831,8 +4917,8 @@ function DataTable({
|
|
|
4831
4917
|
React6.useEffect(() => {
|
|
4832
4918
|
if (!(tableContainerRef == null ? void 0 : tableContainerRef.current)) return;
|
|
4833
4919
|
const resizeObserver = new ResizeObserver(() => {
|
|
4834
|
-
var
|
|
4835
|
-
setPaginationScroll((
|
|
4920
|
+
var _a3;
|
|
4921
|
+
setPaginationScroll((_a3 = tableContainerRef == null ? void 0 : tableContainerRef.current) == null ? void 0 : _a3.scrollWidth);
|
|
4836
4922
|
});
|
|
4837
4923
|
resizeObserver.observe(tableContainerRef == null ? void 0 : tableContainerRef.current);
|
|
4838
4924
|
return () => resizeObserver.disconnect();
|
|
@@ -4921,10 +5007,10 @@ function DataTable({
|
|
|
4921
5007
|
setRowSelection({});
|
|
4922
5008
|
return;
|
|
4923
5009
|
};
|
|
4924
|
-
const hideTableData = dataTable && (dataTable == null ? void 0 : dataTable.length) == 0 && !loading && !hideBlankState || !dataTable || ((_b = (
|
|
5010
|
+
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;
|
|
4925
5011
|
const canShowTableData = !hidePagination && totalData > 0 && table;
|
|
4926
5012
|
function renderBottomTable() {
|
|
4927
|
-
var
|
|
5013
|
+
var _a3;
|
|
4928
5014
|
if (hideTableData && totalData !== null) {
|
|
4929
5015
|
if (emptyState) {
|
|
4930
5016
|
return emptyState;
|
|
@@ -4941,7 +5027,7 @@ function DataTable({
|
|
|
4941
5027
|
tableRef: tableContainerRef,
|
|
4942
5028
|
selectAllOption,
|
|
4943
5029
|
onSelectAll,
|
|
4944
|
-
rowsSelected: (
|
|
5030
|
+
rowsSelected: (_a3 = Object.keys(rowSelection || {})) == null ? void 0 : _a3.length,
|
|
4945
5031
|
onRemoveAll,
|
|
4946
5032
|
paginationScroll,
|
|
4947
5033
|
pageSizeOptions
|
|
@@ -4955,21 +5041,21 @@ function DataTable({
|
|
|
4955
5041
|
if (rowSelection && Object.keys(rowSelection).length == 0) {
|
|
4956
5042
|
const elements = document.getElementsByClassName("th-shadow");
|
|
4957
5043
|
Object.keys(elements).forEach((index) => {
|
|
4958
|
-
var
|
|
4959
|
-
(_b2 = (
|
|
5044
|
+
var _a3, _b2;
|
|
5045
|
+
(_b2 = (_a3 = elements[index]) == null ? void 0 : _a3.classList) == null ? void 0 : _b2.add("with-shadow");
|
|
4960
5046
|
});
|
|
4961
5047
|
} else if (rowSelection && Object.keys(rowSelection).length == 1) {
|
|
4962
5048
|
const elements = document.getElementsByClassName("th-shadow");
|
|
4963
5049
|
Object.keys(elements).forEach((index) => {
|
|
4964
|
-
var
|
|
4965
|
-
(_b2 = (
|
|
5050
|
+
var _a3, _b2;
|
|
5051
|
+
(_b2 = (_a3 = elements[index]) == null ? void 0 : _a3.classList) == null ? void 0 : _b2.remove("with-shadow");
|
|
4966
5052
|
});
|
|
4967
5053
|
}
|
|
4968
5054
|
}, [rowSelection]);
|
|
4969
5055
|
const stylesRow = (row) => {
|
|
4970
|
-
var
|
|
5056
|
+
var _a3, _b2;
|
|
4971
5057
|
const tb = table;
|
|
4972
|
-
return rowClassName ? (_b2 = (
|
|
5058
|
+
return rowClassName ? (_b2 = (_a3 = tb == null ? void 0 : tb.options) == null ? void 0 : _a3.meta) == null ? void 0 : _b2.getRowStyles(row) : {};
|
|
4973
5059
|
};
|
|
4974
5060
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full flex flex-col", children: [
|
|
4975
5061
|
showFilter && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex justify-between md:items-center flex-col md:flex-row gap-y-2 md:gap-y-0", children: [
|
|
@@ -5016,7 +5102,7 @@ function DataTable({
|
|
|
5016
5102
|
] }),
|
|
5017
5103
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "table w-full mr-[2px]", ref: tableRef, children: [
|
|
5018
5104
|
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: (_d = table == null ? void 0 : table.getHeaderGroups()) == null ? void 0 : _d.map((headerGroup, headerIndex) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header, index) => {
|
|
5019
|
-
var
|
|
5105
|
+
var _a3, _b2, _c2;
|
|
5020
5106
|
const classes = header.column.columnDef.meta;
|
|
5021
5107
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5022
5108
|
TableHead,
|
|
@@ -5038,7 +5124,7 @@ function DataTable({
|
|
|
5038
5124
|
header.column.columnDef.header,
|
|
5039
5125
|
header.getContext()
|
|
5040
5126
|
),
|
|
5041
|
-
((
|
|
5127
|
+
((_a3 = sorting[0]) == null ? void 0 : _a3.id) == header.column.id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5042
5128
|
"i",
|
|
5043
5129
|
{
|
|
5044
5130
|
className: clsx9__default.default(
|
|
@@ -5425,10 +5511,10 @@ var EditableTextSelect = ({
|
|
|
5425
5511
|
};
|
|
5426
5512
|
const fuse = new Fuse__default.default(optionsList, optionsFuse);
|
|
5427
5513
|
const filter = () => {
|
|
5428
|
-
var
|
|
5514
|
+
var _a2;
|
|
5429
5515
|
let results = [...options];
|
|
5430
5516
|
if (inputSearch) {
|
|
5431
|
-
results = (
|
|
5517
|
+
results = (_a2 = fuse.search(inputSearch)) == null ? void 0 : _a2.map((result) => result.item);
|
|
5432
5518
|
}
|
|
5433
5519
|
setOptionsList(results);
|
|
5434
5520
|
};
|
|
@@ -5444,7 +5530,7 @@ var EditableTextSelect = ({
|
|
|
5444
5530
|
control,
|
|
5445
5531
|
name,
|
|
5446
5532
|
render: ({ field }) => {
|
|
5447
|
-
var
|
|
5533
|
+
var _a2;
|
|
5448
5534
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu, { children: [
|
|
5449
5535
|
/* @__PURE__ */ jsxRuntime.jsx(react.Menu.Button, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5450
5536
|
"div",
|
|
@@ -5452,7 +5538,7 @@ var EditableTextSelect = ({
|
|
|
5452
5538
|
className: "group flex gap-[5px] cursor-pointer z-[500] items-center",
|
|
5453
5539
|
onClick: () => setShowModal(!showModal),
|
|
5454
5540
|
children: [
|
|
5455
|
-
field.value ? valueStyle ? valueStyle(field.value) : (
|
|
5541
|
+
field.value ? valueStyle ? valueStyle(field.value) : (_a2 = field == null ? void 0 : field.value) == null ? void 0 : _a2.name : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5456
5542
|
"label",
|
|
5457
5543
|
{
|
|
5458
5544
|
className: clsx9__default.default(
|
|
@@ -5492,8 +5578,8 @@ var EditableTextSelect = ({
|
|
|
5492
5578
|
}
|
|
5493
5579
|
) }),
|
|
5494
5580
|
optionsList == null ? void 0 : optionsList.map((opt) => {
|
|
5495
|
-
var
|
|
5496
|
-
const selected = (opt == null ? void 0 : opt.id) === ((
|
|
5581
|
+
var _a3;
|
|
5582
|
+
const selected = (opt == null ? void 0 : opt.id) === ((_a3 = field == null ? void 0 : field.value) == null ? void 0 : _a3.id);
|
|
5497
5583
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5498
5584
|
react.Menu.Item,
|
|
5499
5585
|
{
|
|
@@ -5744,7 +5830,7 @@ var initialState = {
|
|
|
5744
5830
|
files: []
|
|
5745
5831
|
};
|
|
5746
5832
|
function reducer(state, action) {
|
|
5747
|
-
var
|
|
5833
|
+
var _a2, _b;
|
|
5748
5834
|
switch (action.type) {
|
|
5749
5835
|
case "UPLOAD_START":
|
|
5750
5836
|
return {
|
|
@@ -5761,7 +5847,7 @@ function reducer(state, action) {
|
|
|
5761
5847
|
};
|
|
5762
5848
|
case "UPLOAD_END":
|
|
5763
5849
|
return {
|
|
5764
|
-
files: (
|
|
5850
|
+
files: (_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.map((file) => {
|
|
5765
5851
|
if (file.name === action.payload.name) {
|
|
5766
5852
|
return {
|
|
5767
5853
|
...file,
|
|
@@ -5849,7 +5935,7 @@ var FileUpload = ({
|
|
|
5849
5935
|
name,
|
|
5850
5936
|
limitMessage
|
|
5851
5937
|
}) => {
|
|
5852
|
-
var
|
|
5938
|
+
var _a2;
|
|
5853
5939
|
const [state, dispatch] = React6.useReducer(reducer, initialState);
|
|
5854
5940
|
const [dragging, setDragging] = React6.useState(false);
|
|
5855
5941
|
const [loading, setLoading] = React6.useState(false);
|
|
@@ -5859,8 +5945,8 @@ var FileUpload = ({
|
|
|
5859
5945
|
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
5860
5946
|
};
|
|
5861
5947
|
React6.useEffect(() => {
|
|
5862
|
-
var
|
|
5863
|
-
if ((
|
|
5948
|
+
var _a3;
|
|
5949
|
+
if ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.some((file) => file.loading === true)) {
|
|
5864
5950
|
setLoading(true);
|
|
5865
5951
|
} else {
|
|
5866
5952
|
setLoading(false);
|
|
@@ -5872,8 +5958,8 @@ var FileUpload = ({
|
|
|
5872
5958
|
}
|
|
5873
5959
|
}, [files]);
|
|
5874
5960
|
React6.useEffect(() => {
|
|
5875
|
-
var
|
|
5876
|
-
if (!multiple && ((
|
|
5961
|
+
var _a3;
|
|
5962
|
+
if (!multiple && ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.length) === 0 || multiple) {
|
|
5877
5963
|
window.addEventListener("dragover", handleDragOver);
|
|
5878
5964
|
window.addEventListener("drop", handleDrop);
|
|
5879
5965
|
window.addEventListener("dragleave", handleDragLeave);
|
|
@@ -5885,21 +5971,21 @@ var FileUpload = ({
|
|
|
5885
5971
|
};
|
|
5886
5972
|
}, [multiple, state.files]);
|
|
5887
5973
|
const handleDragOver = (event) => {
|
|
5888
|
-
var
|
|
5974
|
+
var _a3;
|
|
5889
5975
|
event.preventDefault();
|
|
5890
5976
|
event.stopPropagation();
|
|
5891
|
-
if (!multiple && ((
|
|
5977
|
+
if (!multiple && ((_a3 = state.files) == null ? void 0 : _a3.length) === 1) {
|
|
5892
5978
|
setDragging(false);
|
|
5893
5979
|
} else {
|
|
5894
5980
|
setDragging(true);
|
|
5895
5981
|
}
|
|
5896
5982
|
};
|
|
5897
5983
|
const handleDrop = (event) => {
|
|
5898
|
-
var
|
|
5984
|
+
var _a3, _b, _c;
|
|
5899
5985
|
event.preventDefault();
|
|
5900
5986
|
event.stopPropagation();
|
|
5901
5987
|
setDragging(false);
|
|
5902
|
-
let files2 = [...(
|
|
5988
|
+
let files2 = [...(_a3 = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a3.files];
|
|
5903
5989
|
if (!multiple && (files2 == null ? void 0 : files2.length) === 1 || multiple && (files2 == null ? void 0 : files2.length) > 0) {
|
|
5904
5990
|
const existingFiles = (_b = state == null ? void 0 : state.files) == null ? void 0 : _b.map((f) => f.name);
|
|
5905
5991
|
files2 = files2.filter((f) => !(existingFiles == null ? void 0 : existingFiles.includes(f.name)));
|
|
@@ -6005,12 +6091,12 @@ var FileUpload = ({
|
|
|
6005
6091
|
});
|
|
6006
6092
|
};
|
|
6007
6093
|
const renderContent = () => {
|
|
6008
|
-
var
|
|
6094
|
+
var _a3;
|
|
6009
6095
|
if (loading) {
|
|
6010
6096
|
return /* @__PURE__ */ jsxRuntime.jsx(LoadingContent, {});
|
|
6011
6097
|
} else if (dragging) {
|
|
6012
6098
|
return /* @__PURE__ */ jsxRuntime.jsx(DraggingContent, {});
|
|
6013
|
-
} else if (!multiple && ((
|
|
6099
|
+
} else if (!multiple && ((_a3 = state == null ? void 0 : state.files) == null ? void 0 : _a3.length) > 0) {
|
|
6014
6100
|
return /* @__PURE__ */ jsxRuntime.jsx(BlockedContent, {});
|
|
6015
6101
|
}
|
|
6016
6102
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6071,7 +6157,7 @@ var FileUpload = ({
|
|
|
6071
6157
|
"flex gap-[6px]": direction === "horizontal" && !isImage
|
|
6072
6158
|
}
|
|
6073
6159
|
),
|
|
6074
|
-
children: (
|
|
6160
|
+
children: (_a2 = state == null ? void 0 : state.files) == null ? void 0 : _a2.map((file) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6075
6161
|
FileStatus,
|
|
6076
6162
|
{
|
|
6077
6163
|
name: file == null ? void 0 : file.name,
|
|
@@ -6772,20 +6858,20 @@ var MultiSelectBottom = ({
|
|
|
6772
6858
|
control,
|
|
6773
6859
|
defaultValue,
|
|
6774
6860
|
render: ({ field }) => {
|
|
6775
|
-
var
|
|
6861
|
+
var _a2, _b;
|
|
6776
6862
|
const { DropdownIndicator, Option } = Select.components;
|
|
6777
6863
|
const DropdownIndicatorCustom = (props) => {
|
|
6778
6864
|
return /* @__PURE__ */ jsxRuntime.jsx(DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-angle-down text-[20px]" }) });
|
|
6779
6865
|
};
|
|
6780
6866
|
const NoOptionsMessage = (props) => {
|
|
6781
|
-
var
|
|
6867
|
+
var _a3;
|
|
6782
6868
|
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
6783
6869
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
6784
6870
|
"Digite ",
|
|
6785
6871
|
debounce2,
|
|
6786
6872
|
" ou mais caracteres para pesquisar"
|
|
6787
6873
|
] });
|
|
6788
|
-
} else if (props.selectProps.inputValue.length > 0 && ((
|
|
6874
|
+
} else if (props.selectProps.inputValue.length > 0 && ((_a3 = props == null ? void 0 : props.options) == null ? void 0 : _a3.length) == 0) {
|
|
6789
6875
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-neutral-300", children: "Nenhum dado encontrado" });
|
|
6790
6876
|
}
|
|
6791
6877
|
};
|
|
@@ -6885,7 +6971,7 @@ var MultiSelectBottom = ({
|
|
|
6885
6971
|
},
|
|
6886
6972
|
index
|
|
6887
6973
|
)),
|
|
6888
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: ((
|
|
6974
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("div", { className: "text-p-sm bg-neutral-100 rounded-[20px] py-2 px-3 flex items-center justify-between mt-3", children: [
|
|
6889
6975
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap", children: item.label }),
|
|
6890
6976
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6891
6977
|
"button",
|
|
@@ -7460,7 +7546,7 @@ var variants6 = {
|
|
|
7460
7546
|
};
|
|
7461
7547
|
var Timeline = ({ data }) => {
|
|
7462
7548
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: (data == null ? void 0 : data.length) > 0 && (data == null ? void 0 : data.map((item, index) => {
|
|
7463
|
-
var
|
|
7549
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
7464
7550
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
|
|
7465
7551
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mr-3 relative", children: [
|
|
7466
7552
|
index !== data.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[2px] bg-neutral-200 ml-[5px] h-full absolute mt-8" }),
|
|
@@ -7470,7 +7556,7 @@ var Timeline = ({ data }) => {
|
|
|
7470
7556
|
{
|
|
7471
7557
|
className: clsx9__default.default(
|
|
7472
7558
|
{
|
|
7473
|
-
[(
|
|
7559
|
+
[(_a2 = variants6[item == null ? void 0 : item.variant]) == null ? void 0 : _a2.big]: !(item == null ? void 0 : item.color)
|
|
7474
7560
|
},
|
|
7475
7561
|
"h-3 w-3 rounded-full"
|
|
7476
7562
|
),
|