teraprox-ui-kit 0.1.1 → 0.1.2

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.mjs CHANGED
@@ -21,9 +21,207 @@ var DeleteButton = ({ title, onDeleteClick }) => {
21
21
  };
22
22
  var DeleteButton_default = DeleteButton;
23
23
 
24
- // src/containers/ResponsiveContainer.tsx
25
- import { Modal, ModalBody } from "react-bootstrap";
24
+ // src/buttons/ActionButtons.tsx
25
+ import { useState as useState2, useRef } from "react";
26
+ import { Button as Button4, Form as Form2, ProgressBar } from "react-bootstrap";
27
+ import { FiSave, FiTrash2, FiRotateCcw, FiCopy, FiChevronLeft } from "react-icons/fi";
28
+
29
+ // src/forms/DeleteConfirm.tsx
30
+ import { useState } from "react";
31
+ import { Button as Button3, Modal, Form } from "react-bootstrap";
26
32
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
33
+ var DeleteConfirm = ({
34
+ show,
35
+ onHide,
36
+ onConfirm,
37
+ title = "Confirma\xE7\xE3o de Exclus\xE3o",
38
+ dialogText,
39
+ payload,
40
+ needExclusionDetails = false
41
+ }) => {
42
+ const [exclusionDetails, setExclusionDetails] = useState("");
43
+ const getDialogContent = () => {
44
+ if (typeof dialogText === "function" && payload) {
45
+ return dialogText(payload);
46
+ }
47
+ return dialogText || "Voc\xEA tem certeza que deseja excluir este item?";
48
+ };
49
+ const isConfirmEnabled = () => {
50
+ if (!needExclusionDetails) return true;
51
+ return exclusionDetails.length >= 8;
52
+ };
53
+ return /* @__PURE__ */ jsxs(Modal, { show, onHide: () => onHide(false), centered: true, children: [
54
+ /* @__PURE__ */ jsx3(Modal.Header, { closeButton: true, children: /* @__PURE__ */ jsx3(Modal.Title, { children: title }) }),
55
+ /* @__PURE__ */ jsx3(Modal.Body, { children: /* @__PURE__ */ jsxs("div", { className: "d-flex flex-column gap-3", children: [
56
+ /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3("strong", { children: getDialogContent() }) }),
57
+ needExclusionDetails && /* @__PURE__ */ jsxs(Form.Group, { children: [
58
+ /* @__PURE__ */ jsx3(Form.Label, { children: "Motivo da Exclus\xE3o (m\xEDn. 8 caracteres)" }),
59
+ /* @__PURE__ */ jsx3(
60
+ Form.Control,
61
+ {
62
+ as: "textarea",
63
+ rows: 3,
64
+ value: exclusionDetails,
65
+ onChange: (e) => setExclusionDetails(e.target.value),
66
+ placeholder: "Descreva o motivo...",
67
+ autoFocus: true
68
+ }
69
+ )
70
+ ] })
71
+ ] }) }),
72
+ /* @__PURE__ */ jsxs(Modal.Footer, { children: [
73
+ /* @__PURE__ */ jsx3(Button3, { variant: "secondary", onClick: () => onHide(false), children: "Cancelar" }),
74
+ /* @__PURE__ */ jsx3(
75
+ Button3,
76
+ {
77
+ variant: "danger",
78
+ disabled: !isConfirmEnabled(),
79
+ onClick: () => {
80
+ onConfirm(exclusionDetails);
81
+ onHide(false);
82
+ },
83
+ children: "Confirmar Exclus\xE3o"
84
+ }
85
+ )
86
+ ] })
87
+ ] });
88
+ };
89
+
90
+ // src/buttons/ActionButtons.tsx
91
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
92
+ var ActionButtons = ({
93
+ onSave,
94
+ saveLabel = "Salvar",
95
+ saveVariant = "primary",
96
+ disabled = false,
97
+ onDelete,
98
+ deleteLabel = "Excluir",
99
+ deleteConfirmMsg,
100
+ needExclusionDetails = false,
101
+ onBack,
102
+ backLabel = "Voltar",
103
+ onCancelEdit,
104
+ cancelEditLabel = "Cancelar",
105
+ onCopy,
106
+ copyLabel = "Copiar Formul\xE1rio",
107
+ isEditing = false,
108
+ useDelayedDelete = false,
109
+ delayedDeleteTimeout = 3e3,
110
+ PermissionWrapper = ({ children }) => /* @__PURE__ */ jsx4(Fragment, { children })
111
+ }) => {
112
+ const [showConfirm, setShowConfirm] = useState2(false);
113
+ const [isHolding, setIsHolding] = useState2(false);
114
+ const [progress, setProgress] = useState2(0);
115
+ const timeoutRef = useRef(null);
116
+ const intervalRef = useRef(null);
117
+ const startHold = () => {
118
+ if (disabled || !onDelete) return;
119
+ setIsHolding(true);
120
+ setProgress(0);
121
+ const step = 2;
122
+ const tickTime = delayedDeleteTimeout / (100 / step);
123
+ intervalRef.current = setInterval(() => {
124
+ setProgress((prev) => prev >= 100 ? 100 : prev + step);
125
+ }, tickTime);
126
+ timeoutRef.current = setTimeout(() => {
127
+ stopHold();
128
+ onDelete();
129
+ }, delayedDeleteTimeout);
130
+ };
131
+ const stopHold = () => {
132
+ setIsHolding(false);
133
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
134
+ if (intervalRef.current) clearInterval(intervalRef.current);
135
+ setProgress(0);
136
+ };
137
+ const renderDeleteButton = () => {
138
+ if (!onDelete || !isEditing) return null;
139
+ if (useDelayedDelete) {
140
+ return /* @__PURE__ */ jsxs2("div", { style: { position: "relative", display: "inline-block", margin: 2 }, children: [
141
+ /* @__PURE__ */ jsxs2(
142
+ Button4,
143
+ {
144
+ variant: "outline-danger",
145
+ onMouseDown: startHold,
146
+ onMouseUp: stopHold,
147
+ onMouseLeave: stopHold,
148
+ onTouchStart: startHold,
149
+ onTouchEnd: stopHold,
150
+ disabled,
151
+ style: { minWidth: "120px" },
152
+ children: [
153
+ /* @__PURE__ */ jsx4(FiTrash2, { className: "me-2" }),
154
+ isHolding ? "Segure..." : deleteLabel
155
+ ]
156
+ }
157
+ ),
158
+ isHolding && /* @__PURE__ */ jsx4(
159
+ ProgressBar,
160
+ {
161
+ now: progress,
162
+ style: {
163
+ position: "absolute",
164
+ bottom: 0,
165
+ left: 0,
166
+ right: 0,
167
+ height: "4px",
168
+ borderRadius: "0 0 4px 4px"
169
+ },
170
+ variant: "danger"
171
+ }
172
+ )
173
+ ] });
174
+ }
175
+ return /* @__PURE__ */ jsxs2(
176
+ Button4,
177
+ {
178
+ variant: "danger",
179
+ onClick: () => setShowConfirm(true),
180
+ disabled,
181
+ style: { margin: 2 },
182
+ children: [
183
+ /* @__PURE__ */ jsx4(FiTrash2, { className: "me-2" }),
184
+ deleteLabel
185
+ ]
186
+ }
187
+ );
188
+ };
189
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
190
+ /* @__PURE__ */ jsx4(
191
+ DeleteConfirm,
192
+ {
193
+ show: showConfirm,
194
+ onHide: setShowConfirm,
195
+ onConfirm: (details) => onDelete && onDelete(details),
196
+ dialogText: deleteConfirmMsg,
197
+ needExclusionDetails
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs2(Form2.Group, { className: "d-flex flex-wrap align-items-center mt-3 gap-1", children: [
201
+ onBack && /* @__PURE__ */ jsxs2(Button4, { variant: "outline-secondary", onClick: onBack, disabled, style: { margin: 2 }, children: [
202
+ /* @__PURE__ */ jsx4(FiChevronLeft, { className: "me-2" }),
203
+ backLabel
204
+ ] }),
205
+ isEditing && onCancelEdit && /* @__PURE__ */ jsxs2(Button4, { variant: "warning", onClick: onCancelEdit, disabled, style: { margin: 2 }, children: [
206
+ /* @__PURE__ */ jsx4(FiRotateCcw, { className: "me-2" }),
207
+ cancelEditLabel
208
+ ] }),
209
+ /* @__PURE__ */ jsx4(PermissionWrapper, { children: renderDeleteButton() }),
210
+ onSave && /* @__PURE__ */ jsxs2(Button4, { variant: saveVariant, onClick: onSave, disabled, style: { margin: 2 }, children: [
211
+ /* @__PURE__ */ jsx4(FiSave, { className: "me-2" }),
212
+ saveLabel
213
+ ] }),
214
+ isEditing && onCopy && /* @__PURE__ */ jsxs2(Button4, { variant: "outline-primary", onClick: onCopy, disabled, style: { margin: 2 }, children: [
215
+ /* @__PURE__ */ jsx4(FiCopy, { className: "me-2" }),
216
+ copyLabel
217
+ ] })
218
+ ] })
219
+ ] });
220
+ };
221
+
222
+ // src/containers/ResponsiveContainer.tsx
223
+ import { Modal as Modal2, ModalBody } from "react-bootstrap";
224
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
27
225
  var ResponsiveContainer = ({
28
226
  title,
29
227
  show,
@@ -36,22 +234,22 @@ var ResponsiveContainer = ({
36
234
  setShow(false);
37
235
  if (onClose) onClose();
38
236
  };
39
- return /* @__PURE__ */ jsxs(Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
40
- /* @__PURE__ */ jsx3(Modal.Header, { closeButton: true, onClick: handleClose }),
41
- /* @__PURE__ */ jsx3(ModalBody, { children })
237
+ return /* @__PURE__ */ jsxs3(Modal2, { size: "lg", show, onHide: handleClose, scrollable, children: [
238
+ /* @__PURE__ */ jsx5(Modal2.Header, { closeButton: true, onClick: handleClose }),
239
+ /* @__PURE__ */ jsx5(ModalBody, { children })
42
240
  ] });
43
241
  };
44
242
  var ResponsiveContainer_default = ResponsiveContainer;
45
243
 
46
244
  // src/displays/UuidPill.tsx
47
- import { useState, useRef } from "react";
245
+ import { useState as useState3, useRef as useRef2 } from "react";
48
246
  import { Badge, Overlay, Tooltip } from "react-bootstrap";
49
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
247
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
50
248
  var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
51
- const [copied, setCopied] = useState(false);
52
- const ref = useRef(null);
53
- const [showTooltip, setShowTooltip] = useState(false);
54
- if (!uuid) return /* @__PURE__ */ jsx4("span", { className: "text-muted", children: "\u2014" });
249
+ const [copied, setCopied] = useState3(false);
250
+ const ref = useRef2(null);
251
+ const [showTooltip, setShowTooltip] = useState3(false);
252
+ if (!uuid) return /* @__PURE__ */ jsx6("span", { className: "text-muted", children: "\u2014" });
55
253
  const shortId = String(uuid).substring(0, short);
56
254
  const handleCopy = async (e) => {
57
255
  e.stopPropagation();
@@ -68,8 +266,8 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
68
266
  setCopied(true);
69
267
  setTimeout(() => setCopied(false), 1500);
70
268
  };
71
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
72
- /* @__PURE__ */ jsxs2(
269
+ return /* @__PURE__ */ jsxs4(Fragment2, { children: [
270
+ /* @__PURE__ */ jsxs4(
73
271
  Badge,
74
272
  {
75
273
  ref,
@@ -90,19 +288,19 @@ var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
90
288
  ]
91
289
  }
92
290
  ),
93
- /* @__PURE__ */ jsx4(Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ jsx4(Tooltip, { ...props, children: copied ? /* @__PURE__ */ jsx4("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ jsxs2("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
291
+ /* @__PURE__ */ jsx6(Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ jsx6(Tooltip, { ...props, children: copied ? /* @__PURE__ */ jsx6("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ jsxs4("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
94
292
  uuid,
95
- /* @__PURE__ */ jsx4("br", {}),
96
- /* @__PURE__ */ jsx4("small", { className: "text-muted", children: "Clique para copiar" })
293
+ /* @__PURE__ */ jsx6("br", {}),
294
+ /* @__PURE__ */ jsx6("small", { className: "text-muted", children: "Clique para copiar" })
97
295
  ] }) }) })
98
296
  ] });
99
297
  };
100
298
  var UuidPill_default = UuidPill;
101
299
 
102
300
  // src/displays/GenericDisplay.tsx
103
- import React2, { useState as useState2, useEffect } from "react";
301
+ import React4, { useState as useState4, useEffect } from "react";
104
302
  import { Col, Container, Row } from "react-bootstrap";
105
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
303
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
106
304
  var ConfigObject = class {
107
305
  constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
108
306
  this.dotNotation = dotNotation;
@@ -152,16 +350,16 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
152
350
  const onClick = getOnClick(innerConfigs);
153
351
  const extraComponents = getAdditionalComponentes(innerConfigs);
154
352
  if (Array.isArray(obj)) {
155
- return /* @__PURE__ */ jsxs3(Container, { onClick, style: { ...styles }, children: [
156
- opn && /* @__PURE__ */ jsx5("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx5("strong", { children: opn }) }),
353
+ return /* @__PURE__ */ jsxs5(Container, { onClick, style: { ...styles }, children: [
354
+ opn && /* @__PURE__ */ jsx7("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx7("strong", { children: opn }) }),
157
355
  obj.map((o, index) => {
158
356
  const mapCopy = [...newPropertiesMap, `[${index}]`];
159
- return /* @__PURE__ */ jsx5(Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
357
+ return /* @__PURE__ */ jsx7(Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
160
358
  })
161
359
  ] });
162
360
  }
163
361
  if (typeof obj === "object" && obj != null) {
164
- return /* @__PURE__ */ jsxs3(
362
+ return /* @__PURE__ */ jsxs5(
165
363
  Container,
166
364
  {
167
365
  onClick,
@@ -174,17 +372,17 @@ var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, i
174
372
  ...styles
175
373
  },
176
374
  children: [
177
- opn && /* @__PURE__ */ jsx5("strong", { children: opn }),
375
+ opn && /* @__PURE__ */ jsx7("strong", { children: opn }),
178
376
  Object.entries(obj).map(
179
377
  ([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
180
378
  ),
181
- extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ jsx5(React2.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
379
+ extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ jsx7(React4.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
182
380
  ]
183
381
  }
184
382
  );
185
383
  }
186
- return /* @__PURE__ */ jsxs3(Col, { children: [
187
- /* @__PURE__ */ jsxs3("strong", { children: [
384
+ return /* @__PURE__ */ jsxs5(Col, { children: [
385
+ /* @__PURE__ */ jsxs5("strong", { children: [
188
386
  opn,
189
387
  ": "
190
388
  ] }),
@@ -200,7 +398,7 @@ var GenericDisplay = ({
200
398
  onRefresh,
201
399
  editButtonRenderer
202
400
  }) => {
203
- const [innerOptions, setInnerOptions] = useState2();
401
+ const [innerOptions, setInnerOptions] = useState4();
204
402
  const refreshFunc = () => {
205
403
  if (loadFunc) {
206
404
  loadFunc().then((res) => {
@@ -221,24 +419,24 @@ var GenericDisplay = ({
221
419
  refreshFunc();
222
420
  }
223
421
  }, [context]);
224
- return /* @__PURE__ */ jsx5(Fragment2, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ jsx5(Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
422
+ return /* @__PURE__ */ jsx7(Fragment3, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ jsx7(Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
225
423
  };
226
424
  var GenericDisplay_default = GenericDisplay;
227
425
 
228
426
  // src/forms/MailSender.tsx
229
- import { useState as useState3 } from "react";
427
+ import { useState as useState5 } from "react";
230
428
  import {
231
- Button as Button3,
429
+ Button as Button5,
232
430
  Card,
233
431
  Col as Col2,
234
- Form,
432
+ Form as Form3,
235
433
  Row as Row2,
236
434
  Spinner,
237
435
  Badge as Badge2,
238
436
  InputGroup
239
437
  } from "react-bootstrap";
240
438
  import { FiMail, FiSearch, FiUser, FiX, FiPlus, FiSend } from "react-icons/fi";
241
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
439
+ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
242
440
  var MailSender = ({
243
441
  htmlContent,
244
442
  companyName,
@@ -247,15 +445,15 @@ var MailSender = ({
247
445
  hide = false,
248
446
  renderTrigger
249
447
  }) => {
250
- const [opened, setOpened] = useState3(false);
251
- const [addingEmail, setAddingEmail] = useState3(false);
252
- const [selectedEmails, setSelectedEmails] = useState3([]);
253
- const [emails, setEmails] = useState3([]);
254
- const [loading, setLoading] = useState3(false);
255
- const [postLoading, setPostLoading] = useState3(false);
256
- const [customEmail, setCustomEmail] = useState3("");
257
- const [emailError, setEmailError] = useState3("");
258
- const [searchFilter, setSearchFilter] = useState3("");
448
+ const [opened, setOpened] = useState5(false);
449
+ const [addingEmail, setAddingEmail] = useState5(false);
450
+ const [selectedEmails, setSelectedEmails] = useState5([]);
451
+ const [emails, setEmails] = useState5([]);
452
+ const [loading, setLoading] = useState5(false);
453
+ const [postLoading, setPostLoading] = useState5(false);
454
+ const [customEmail, setCustomEmail] = useState5("");
455
+ const [emailError, setEmailError] = useState5("");
456
+ const [searchFilter, setSearchFilter] = useState5("");
259
457
  const handleOpen = async () => {
260
458
  setLoading(true);
261
459
  try {
@@ -338,9 +536,9 @@ var MailSender = ({
338
536
  if (renderTrigger) {
339
537
  return renderTrigger({ onClick: handleOpen, loading });
340
538
  }
341
- return /* @__PURE__ */ jsx6(Button3, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
539
+ return /* @__PURE__ */ jsx8(Button5, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
342
540
  }
343
- return /* @__PURE__ */ jsxs4(
541
+ return /* @__PURE__ */ jsxs6(
344
542
  "div",
345
543
  {
346
544
  style: {
@@ -351,7 +549,7 @@ var MailSender = ({
351
549
  boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
352
550
  },
353
551
  children: [
354
- /* @__PURE__ */ jsx6(
552
+ /* @__PURE__ */ jsx8(
355
553
  "div",
356
554
  {
357
555
  style: {
@@ -359,20 +557,20 @@ var MailSender = ({
359
557
  color: "white",
360
558
  padding: "25px"
361
559
  },
362
- children: /* @__PURE__ */ jsxs4("div", { className: "d-flex justify-content-between align-items-center", children: [
363
- /* @__PURE__ */ jsxs4("div", { children: [
364
- /* @__PURE__ */ jsxs4("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
365
- /* @__PURE__ */ jsx6(FiMail, { className: "me-2", size: 20 }),
560
+ children: /* @__PURE__ */ jsxs6("div", { className: "d-flex justify-content-between align-items-center", children: [
561
+ /* @__PURE__ */ jsxs6("div", { children: [
562
+ /* @__PURE__ */ jsxs6("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
563
+ /* @__PURE__ */ jsx8(FiMail, { className: "me-2", size: 20 }),
366
564
  "Enviar Relat\xF3rio por E-mail"
367
565
  ] }),
368
- /* @__PURE__ */ jsxs4("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
566
+ /* @__PURE__ */ jsxs6("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
369
567
  "Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
370
568
  companyName
371
569
  ] })
372
570
  ] }),
373
- /* @__PURE__ */ jsxs4("div", { className: "d-flex gap-2", children: [
374
- /* @__PURE__ */ jsx6(
375
- Button3,
571
+ /* @__PURE__ */ jsxs6("div", { className: "d-flex gap-2", children: [
572
+ /* @__PURE__ */ jsx8(
573
+ Button5,
376
574
  {
377
575
  variant: "light",
378
576
  onClick: sendEmail,
@@ -383,38 +581,38 @@ var MailSender = ({
383
581
  minWidth: "130px",
384
582
  height: "40px"
385
583
  },
386
- children: postLoading ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
387
- /* @__PURE__ */ jsx6(Spinner, { size: "sm", className: "me-2" }),
584
+ children: postLoading ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
585
+ /* @__PURE__ */ jsx8(Spinner, { size: "sm", className: "me-2" }),
388
586
  "Enviando..."
389
- ] }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
390
- /* @__PURE__ */ jsx6(FiSend, { className: "me-2", size: 14 }),
587
+ ] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
588
+ /* @__PURE__ */ jsx8(FiSend, { className: "me-2", size: 14 }),
391
589
  "Enviar E-mail"
392
590
  ] })
393
591
  }
394
592
  ),
395
- /* @__PURE__ */ jsx6(
396
- Button3,
593
+ /* @__PURE__ */ jsx8(
594
+ Button5,
397
595
  {
398
596
  variant: "outline-light",
399
597
  onClick: () => setOpened(false),
400
598
  disabled: postLoading,
401
599
  style: { borderRadius: "8px", width: "40px", height: "40px" },
402
- children: /* @__PURE__ */ jsx6(FiX, { size: 16 })
600
+ children: /* @__PURE__ */ jsx8(FiX, { size: 16 })
403
601
  }
404
602
  )
405
603
  ] })
406
604
  ] })
407
605
  }
408
606
  ),
409
- /* @__PURE__ */ jsxs4("div", { style: { padding: "25px" }, children: [
410
- /* @__PURE__ */ jsx6(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs4(Card.Body, { style: { padding: "20px" }, children: [
411
- /* @__PURE__ */ jsxs4(Row2, { className: "align-items-center", children: [
412
- /* @__PURE__ */ jsxs4(Col2, { md: 6, children: [
413
- /* @__PURE__ */ jsx6("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
414
- /* @__PURE__ */ jsxs4(InputGroup, { style: { maxWidth: "300px" }, children: [
415
- /* @__PURE__ */ jsx6(InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ jsx6(FiSearch, { size: 14, color: "#6c757d" }) }),
416
- /* @__PURE__ */ jsx6(
417
- Form.Control,
607
+ /* @__PURE__ */ jsxs6("div", { style: { padding: "25px" }, children: [
608
+ /* @__PURE__ */ jsx8(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs6(Card.Body, { style: { padding: "20px" }, children: [
609
+ /* @__PURE__ */ jsxs6(Row2, { className: "align-items-center", children: [
610
+ /* @__PURE__ */ jsxs6(Col2, { md: 6, children: [
611
+ /* @__PURE__ */ jsx8("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
612
+ /* @__PURE__ */ jsxs6(InputGroup, { style: { maxWidth: "300px" }, children: [
613
+ /* @__PURE__ */ jsx8(InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ jsx8(FiSearch, { size: 14, color: "#6c757d" }) }),
614
+ /* @__PURE__ */ jsx8(
615
+ Form3.Control,
418
616
  {
419
617
  type: "text",
420
618
  placeholder: "Buscar e-mails...",
@@ -425,25 +623,25 @@ var MailSender = ({
425
623
  )
426
624
  ] })
427
625
  ] }),
428
- /* @__PURE__ */ jsx6(Col2, { md: 6, className: "text-end", children: /* @__PURE__ */ jsx6(
429
- Button3,
626
+ /* @__PURE__ */ jsx8(Col2, { md: 6, className: "text-end", children: /* @__PURE__ */ jsx8(
627
+ Button5,
430
628
  {
431
629
  variant: addingEmail ? "outline-secondary" : "outline-primary",
432
630
  size: "sm",
433
631
  onClick: () => setAddingEmail(!addingEmail),
434
632
  disabled: postLoading,
435
633
  style: { borderRadius: "8px" },
436
- children: addingEmail ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
437
- /* @__PURE__ */ jsx6(FiX, { className: "me-1", size: 14 }),
634
+ children: addingEmail ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
635
+ /* @__PURE__ */ jsx8(FiX, { className: "me-1", size: 14 }),
438
636
  "Cancelar"
439
- ] }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
440
- /* @__PURE__ */ jsx6(FiPlus, { className: "me-1", size: 14 }),
637
+ ] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
638
+ /* @__PURE__ */ jsx8(FiPlus, { className: "me-1", size: 14 }),
441
639
  "E-mail Personalizado"
442
640
  ] })
443
641
  }
444
642
  ) })
445
643
  ] }),
446
- addingEmail && /* @__PURE__ */ jsxs4(
644
+ addingEmail && /* @__PURE__ */ jsxs6(
447
645
  "div",
448
646
  {
449
647
  style: {
@@ -454,12 +652,12 @@ var MailSender = ({
454
652
  border: "1px solid #e3f2fd"
455
653
  },
456
654
  children: [
457
- /* @__PURE__ */ jsx6("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
458
- /* @__PURE__ */ jsxs4(Row2, { className: "align-items-end", children: [
459
- /* @__PURE__ */ jsxs4(Col2, { md: 8, children: [
460
- /* @__PURE__ */ jsx6(Form.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
461
- /* @__PURE__ */ jsx6(
462
- Form.Control,
655
+ /* @__PURE__ */ jsx8("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
656
+ /* @__PURE__ */ jsxs6(Row2, { className: "align-items-end", children: [
657
+ /* @__PURE__ */ jsxs6(Col2, { md: 8, children: [
658
+ /* @__PURE__ */ jsx8(Form3.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
659
+ /* @__PURE__ */ jsx8(
660
+ Form3.Control,
463
661
  {
464
662
  type: "email",
465
663
  placeholder: "exemplo@empresa.com",
@@ -474,17 +672,17 @@ var MailSender = ({
474
672
  onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
475
673
  }
476
674
  ),
477
- /* @__PURE__ */ jsx6(Form.Control.Feedback, { type: "invalid", children: emailError })
675
+ /* @__PURE__ */ jsx8(Form3.Control.Feedback, { type: "invalid", children: emailError })
478
676
  ] }),
479
- /* @__PURE__ */ jsx6(Col2, { md: 4, children: /* @__PURE__ */ jsxs4(
480
- Button3,
677
+ /* @__PURE__ */ jsx8(Col2, { md: 4, children: /* @__PURE__ */ jsxs6(
678
+ Button5,
481
679
  {
482
680
  variant: "success",
483
681
  onClick: handleEmailAdd,
484
682
  disabled: postLoading,
485
683
  style: { borderRadius: "8px", width: "100%" },
486
684
  children: [
487
- /* @__PURE__ */ jsx6(FiPlus, { className: "me-1", size: 14 }),
685
+ /* @__PURE__ */ jsx8(FiPlus, { className: "me-1", size: 14 }),
488
686
  "Adicionar"
489
687
  ]
490
688
  }
@@ -494,16 +692,16 @@ var MailSender = ({
494
692
  }
495
693
  )
496
694
  ] }) }),
497
- selectedEmails.length > 0 && /* @__PURE__ */ jsx6(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs4(Card.Body, { style: { padding: "20px" }, children: [
498
- /* @__PURE__ */ jsxs4("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
499
- /* @__PURE__ */ jsx6("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
500
- /* @__PURE__ */ jsxs4(Badge2, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
695
+ selectedEmails.length > 0 && /* @__PURE__ */ jsx8(Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs6(Card.Body, { style: { padding: "20px" }, children: [
696
+ /* @__PURE__ */ jsxs6("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
697
+ /* @__PURE__ */ jsx8("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
698
+ /* @__PURE__ */ jsxs6(Badge2, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
501
699
  selectedEmails.length,
502
700
  " selecionado",
503
701
  selectedEmails.length > 1 ? "s" : ""
504
702
  ] })
505
703
  ] }),
506
- /* @__PURE__ */ jsx6("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ jsxs4(
704
+ /* @__PURE__ */ jsx8("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ jsxs6(
507
705
  "div",
508
706
  {
509
707
  style: {
@@ -517,10 +715,10 @@ var MailSender = ({
517
715
  fontWeight: "500"
518
716
  },
519
717
  children: [
520
- /* @__PURE__ */ jsx6(FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
521
- /* @__PURE__ */ jsx6("span", { children: email.email || email }),
522
- /* @__PURE__ */ jsx6(
523
- Button3,
718
+ /* @__PURE__ */ jsx8(FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
719
+ /* @__PURE__ */ jsx8("span", { children: email.email || email }),
720
+ /* @__PURE__ */ jsx8(
721
+ Button5,
524
722
  {
525
723
  variant: "link",
526
724
  size: "sm",
@@ -532,7 +730,7 @@ var MailSender = ({
532
730
  textDecoration: "none",
533
731
  fontSize: "16px"
534
732
  },
535
- children: /* @__PURE__ */ jsx6(FiX, { size: 14 })
733
+ children: /* @__PURE__ */ jsx8(FiX, { size: 14 })
536
734
  }
537
735
  )
538
736
  ]
@@ -540,16 +738,16 @@ var MailSender = ({
540
738
  index
541
739
  )) })
542
740
  ] }) }),
543
- /* @__PURE__ */ jsx6(Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs4(Card.Body, { style: { padding: "20px" }, children: [
544
- /* @__PURE__ */ jsxs4("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
545
- /* @__PURE__ */ jsx6(FiUser, { className: "me-2", size: 16 }),
741
+ /* @__PURE__ */ jsx8(Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ jsxs6(Card.Body, { style: { padding: "20px" }, children: [
742
+ /* @__PURE__ */ jsxs6("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
743
+ /* @__PURE__ */ jsx8(FiUser, { className: "me-2", size: 16 }),
546
744
  "E-mails de ",
547
745
  companyName
548
746
  ] }),
549
- loading ? /* @__PURE__ */ jsxs4("div", { className: "text-center py-4", children: [
550
- /* @__PURE__ */ jsx6(Spinner, {}),
551
- /* @__PURE__ */ jsx6("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
552
- ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ jsx6("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx6("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ jsx6(Row2, { children: filteredEmails.map((email) => /* @__PURE__ */ jsx6(Col2, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ jsx6(
747
+ loading ? /* @__PURE__ */ jsxs6("div", { className: "text-center py-4", children: [
748
+ /* @__PURE__ */ jsx8(Spinner, {}),
749
+ /* @__PURE__ */ jsx8("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
750
+ ] }) : filteredEmails.length === 0 ? /* @__PURE__ */ jsx8("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx8("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ jsx8(Row2, { children: filteredEmails.map((email) => /* @__PURE__ */ jsx8(Col2, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ jsx8(
553
751
  Card,
554
752
  {
555
753
  onClick: () => setSelectedEmails([...selectedEmails, email]),
@@ -570,9 +768,9 @@ var MailSender = ({
570
768
  e.currentTarget.style.boxShadow = "none";
571
769
  e.currentTarget.style.borderColor = "#e9ecef";
572
770
  },
573
- children: /* @__PURE__ */ jsxs4(Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
574
- /* @__PURE__ */ jsx6(FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
575
- /* @__PURE__ */ jsx6(
771
+ children: /* @__PURE__ */ jsxs6(Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
772
+ /* @__PURE__ */ jsx8(FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
773
+ /* @__PURE__ */ jsx8(
576
774
  "div",
577
775
  {
578
776
  style: {
@@ -594,13 +792,227 @@ var MailSender = ({
594
792
  );
595
793
  };
596
794
 
795
+ // src/forms/AutoComplete.tsx
796
+ import { useEffect as useEffect2, useMemo, useState as useState6 } from "react";
797
+ import { FloatingLabel, Form as Form4, InputGroup as InputGroup2, ListGroup, Spinner as Spinner2 } from "react-bootstrap";
798
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
799
+ var AutoComplete = ({
800
+ className,
801
+ ops = [],
802
+ sortKey,
803
+ displayKey,
804
+ displayKeys,
805
+ onValueChanged,
806
+ onSelectedClick,
807
+ value,
808
+ actionButton,
809
+ actionButton2,
810
+ placeH,
811
+ title,
812
+ filter,
813
+ filterField,
814
+ loadFunc,
815
+ loadCondition,
816
+ onBlurEvent,
817
+ formatationFunc,
818
+ onEscKeyDown,
819
+ onEnterKeyDown,
820
+ margT,
821
+ margB,
822
+ hideComponent,
823
+ disableComponent = false,
824
+ disableSelect = false,
825
+ autoFocusConfig,
826
+ onLoad,
827
+ cacheKey,
828
+ minChars = 0,
829
+ maxItems,
830
+ showListOnFocus = true,
831
+ lazyLoad = false
832
+ }) => {
833
+ const [liItem, setListItem] = useState6([]);
834
+ const [options, setOptions] = useState6([]);
835
+ const [input, setInput] = useState6("");
836
+ const [hide, setHide] = useState6(true);
837
+ const [onLoaded, setOnLoaded] = useState6(false);
838
+ const [loading, setLoading] = useState6(false);
839
+ const cacheStore = useMemo(() => {
840
+ const win = window;
841
+ if (!win.__AUTO_COMPLETE_CACHE__) {
842
+ win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
843
+ }
844
+ return win.__AUTO_COMPLETE_CACHE__;
845
+ }, []);
846
+ const sortOptions = (data, key) => {
847
+ if (!key || !Array.isArray(data)) return data;
848
+ return [...data].sort((a, b) => String(a[key]).localeCompare(String(b[key])));
849
+ };
850
+ useEffect2(() => {
851
+ setInput(value || "");
852
+ }, [value]);
853
+ useEffect2(() => {
854
+ const sortedOptions = sortOptions(ops, sortKey);
855
+ setListItem(sortedOptions);
856
+ setOptions(sortedOptions);
857
+ }, [ops, sortKey]);
858
+ useEffect2(() => {
859
+ const loadData = async () => {
860
+ if (!(loadCondition && loadFunc)) return;
861
+ if (lazyLoad && minChars > 0 && !showListOnFocus && (!value || String(value).length < minChars)) {
862
+ return;
863
+ }
864
+ const key = cacheKey ? `${cacheKey}${filter ? `:${filterField}:${filter}` : ""}` : null;
865
+ if (key && cacheStore.has(key)) {
866
+ const cacheEntry = cacheStore.get(key);
867
+ const data = cacheEntry.promise ? await cacheEntry.promise : cacheEntry.data || cacheEntry;
868
+ setListItem(data);
869
+ setOptions(data);
870
+ triggerOnLoad(data);
871
+ return;
872
+ }
873
+ setLoading(true);
874
+ try {
875
+ const requestPromise = loadFunc().then((res) => {
876
+ let newOps = (res == null ? void 0 : res.content) || res;
877
+ newOps = Array.isArray(newOps) ? newOps.filter((op) => op != null) : [];
878
+ if (filter && filterField) {
879
+ newOps = newOps.filter((op) => op[filterField] === filter);
880
+ }
881
+ return sortOptions(newOps, sortKey);
882
+ });
883
+ if (key) cacheStore.set(key, { promise: requestPromise });
884
+ const sortedOptions = await requestPromise;
885
+ setListItem(sortedOptions);
886
+ setOptions(sortedOptions);
887
+ if (key) cacheStore.set(key, { data: sortedOptions });
888
+ triggerOnLoad(sortedOptions);
889
+ } catch (error) {
890
+ if (key) cacheStore.delete(key);
891
+ setListItem([]);
892
+ } finally {
893
+ setLoading(false);
894
+ }
895
+ };
896
+ loadData();
897
+ }, [loadCondition, filter, filterField, sortKey, cacheKey, lazyLoad, minChars, showListOnFocus]);
898
+ const triggerOnLoad = (data) => {
899
+ if (onLoad && !onLoaded) {
900
+ setOnLoaded(true);
901
+ onLoad(data);
902
+ }
903
+ };
904
+ const keysJoinner = (li) => {
905
+ if (!displayKeys || !Array.isArray(displayKeys)) return "";
906
+ return displayKeys.map((key) => `${li[key]} `).join("").trim();
907
+ };
908
+ const getDisplayText = (item) => {
909
+ if (formatationFunc) return formatationFunc(item);
910
+ if (displayKey) return item[displayKey];
911
+ if (displayKeys) return keysJoinner(item);
912
+ return String(item);
913
+ };
914
+ const onFieldUpdate = (val) => {
915
+ const search = val.toLowerCase();
916
+ const canSearch = search.length >= minChars;
917
+ if (canSearch && Array.isArray(options)) {
918
+ const filtered = options.filter((item) => {
919
+ const text = getDisplayText(item);
920
+ return String(text).toLowerCase().includes(search);
921
+ });
922
+ setListItem(filtered);
923
+ } else {
924
+ setListItem(options || []);
925
+ }
926
+ onValueChanged == null ? void 0 : onValueChanged(val);
927
+ setInput(val);
928
+ setHide(!canSearch && options.length === 0);
929
+ };
930
+ return /* @__PURE__ */ jsxs7(
931
+ "div",
932
+ {
933
+ className,
934
+ style: { marginTop: margT != null ? margT : 4, marginBottom: margB != null ? margB : 4, position: "relative" },
935
+ onBlur: (e) => {
936
+ setTimeout(() => {
937
+ onBlurEvent == null ? void 0 : onBlurEvent(e, input);
938
+ setHide(true);
939
+ }, 200);
940
+ },
941
+ onKeyDown: (e) => {
942
+ if (e.key === "Escape") {
943
+ setHide(true);
944
+ onEscKeyDown == null ? void 0 : onEscKeyDown();
945
+ }
946
+ if (e.key === "Enter" && onEnterKeyDown) {
947
+ onEnterKeyDown(input);
948
+ }
949
+ },
950
+ onMouseLeave: () => setHide(true),
951
+ children: [
952
+ !hideComponent && /* @__PURE__ */ jsxs7(InputGroup2, { children: [
953
+ /* @__PURE__ */ jsx9(FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ jsx9(
954
+ Form4.Control,
955
+ {
956
+ autoFocus: autoFocusConfig,
957
+ disabled: disableComponent || disableSelect,
958
+ placeholder: placeH,
959
+ autoComplete: "off",
960
+ value: input,
961
+ onClickCapture: () => {
962
+ const canOpen = showListOnFocus && input.length >= minChars;
963
+ setHide(!canOpen);
964
+ },
965
+ onChange: (e) => onFieldUpdate(e.currentTarget.value),
966
+ type: "text"
967
+ }
968
+ ) }),
969
+ loading && /* @__PURE__ */ jsx9(InputGroup2.Text, { children: /* @__PURE__ */ jsx9(Spinner2, { animation: "border", size: "sm" }) }),
970
+ !disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
971
+ !disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
972
+ ] }),
973
+ /* @__PURE__ */ jsx9(
974
+ ListGroup,
975
+ {
976
+ className: "listgroup-autocomplete shadow-sm",
977
+ hidden: hide || liItem.length === 0,
978
+ style: {
979
+ position: "absolute",
980
+ top: "100%",
981
+ left: 0,
982
+ width: "100%",
983
+ maxHeight: "250px",
984
+ overflowY: "auto",
985
+ zIndex: 1050,
986
+ backgroundColor: "#fff"
987
+ },
988
+ children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ jsx9(
989
+ ListGroup.Item,
990
+ {
991
+ action: true,
992
+ onClick: () => {
993
+ const text = getDisplayText(li);
994
+ setInput(text);
995
+ onSelectedClick(li, index, liItem);
996
+ setHide(true);
997
+ },
998
+ children: getDisplayText(li)
999
+ },
1000
+ index
1001
+ ))
1002
+ }
1003
+ )
1004
+ ]
1005
+ }
1006
+ );
1007
+ };
1008
+
597
1009
  // src/forms/GenericForm.tsx
598
- import { useState as useState4 } from "react";
599
- import { Button as Button4, Form as Form2 } from "react-bootstrap";
600
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1010
+ import { useState as useState7 } from "react";
1011
+ import { Button as Button6, Form as Form5 } from "react-bootstrap";
1012
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
601
1013
  var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
602
- const [formValues, setFormValues] = useState4({});
603
- const [errors, setErrors] = useState4({});
1014
+ const [formValues, setFormValues] = useState7({});
1015
+ const [errors, setErrors] = useState7({});
604
1016
  const handleChange = (key, value) => {
605
1017
  setFormValues({
606
1018
  ...formValues,
@@ -629,10 +1041,10 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
629
1041
  switch (type) {
630
1042
  case "text":
631
1043
  case "number":
632
- return /* @__PURE__ */ jsxs5(Form2.Group, { className: "mb-3", children: [
633
- /* @__PURE__ */ jsx7(Form2.Label, { children: label }),
634
- /* @__PURE__ */ jsx7(
635
- Form2.Control,
1044
+ return /* @__PURE__ */ jsxs8(Form5.Group, { className: "mb-3", children: [
1045
+ /* @__PURE__ */ jsx10(Form5.Label, { children: label }),
1046
+ /* @__PURE__ */ jsx10(
1047
+ Form5.Control,
636
1048
  {
637
1049
  type,
638
1050
  placeholder,
@@ -641,30 +1053,30 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
641
1053
  isInvalid: !!errors[key]
642
1054
  }
643
1055
  ),
644
- /* @__PURE__ */ jsx7(Form2.Control.Feedback, { type: "invalid", children: errors[key] })
1056
+ /* @__PURE__ */ jsx10(Form5.Control.Feedback, { type: "invalid", children: errors[key] })
645
1057
  ] }, key);
646
1058
  case "select": {
647
1059
  const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
648
- return /* @__PURE__ */ jsxs5(Form2.Group, { className: "mb-3", children: [
649
- /* @__PURE__ */ jsx7(Form2.Label, { children: label }),
650
- /* @__PURE__ */ jsxs5(
651
- Form2.Select,
1060
+ return /* @__PURE__ */ jsxs8(Form5.Group, { className: "mb-3", children: [
1061
+ /* @__PURE__ */ jsx10(Form5.Label, { children: label }),
1062
+ /* @__PURE__ */ jsxs8(
1063
+ Form5.Select,
652
1064
  {
653
1065
  value,
654
1066
  onChange: (e) => handleChange(key, e.target.value),
655
1067
  isInvalid: !!errors[key],
656
1068
  children: [
657
- /* @__PURE__ */ jsx7("option", { value: "", children: "Selecione..." }),
658
- orderedOptions.map((option) => /* @__PURE__ */ jsx7("option", { value: option.value, children: option.label }, String(option.value)))
1069
+ /* @__PURE__ */ jsx10("option", { value: "", children: "Selecione..." }),
1070
+ orderedOptions.map((option) => /* @__PURE__ */ jsx10("option", { value: option.value, children: option.label }, String(option.value)))
659
1071
  ]
660
1072
  }
661
1073
  ),
662
- /* @__PURE__ */ jsx7(Form2.Control.Feedback, { type: "invalid", children: errors[key] })
1074
+ /* @__PURE__ */ jsx10(Form5.Control.Feedback, { type: "invalid", children: errors[key] })
663
1075
  ] }, key);
664
1076
  }
665
1077
  case "custom-select":
666
1078
  if (renderCustomSelect) {
667
- return /* @__PURE__ */ jsxs5("div", { children: [
1079
+ return /* @__PURE__ */ jsxs8("div", { children: [
668
1080
  renderCustomSelect({
669
1081
  label,
670
1082
  value,
@@ -672,15 +1084,15 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
672
1084
  onChange: (v) => handleChange(key, v),
673
1085
  placeholder
674
1086
  }),
675
- errors[key] && /* @__PURE__ */ jsx7("div", { className: "invalid-feedback d-block", children: errors[key] })
1087
+ errors[key] && /* @__PURE__ */ jsx10("div", { className: "invalid-feedback d-block", children: errors[key] })
676
1088
  ] }, key);
677
1089
  }
678
1090
  return null;
679
1091
  case "date":
680
- return /* @__PURE__ */ jsxs5(Form2.Group, { className: "mb-3", children: [
681
- /* @__PURE__ */ jsx7(Form2.Label, { children: label }),
682
- /* @__PURE__ */ jsx7(
683
- Form2.Control,
1092
+ return /* @__PURE__ */ jsxs8(Form5.Group, { className: "mb-3", children: [
1093
+ /* @__PURE__ */ jsx10(Form5.Label, { children: label }),
1094
+ /* @__PURE__ */ jsx10(
1095
+ Form5.Control,
684
1096
  {
685
1097
  type: "date",
686
1098
  value,
@@ -688,23 +1100,23 @@ var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
688
1100
  isInvalid: !!errors[key]
689
1101
  }
690
1102
  ),
691
- /* @__PURE__ */ jsx7(Form2.Control.Feedback, { type: "invalid", children: errors[key] })
1103
+ /* @__PURE__ */ jsx10(Form5.Control.Feedback, { type: "invalid", children: errors[key] })
692
1104
  ] }, key);
693
1105
  default:
694
1106
  return null;
695
1107
  }
696
1108
  };
697
- return /* @__PURE__ */ jsxs5(Form2, { onSubmit: handleSubmit, children: [
1109
+ return /* @__PURE__ */ jsxs8(Form5, { onSubmit: handleSubmit, children: [
698
1110
  fields.map((field) => renderField(field)),
699
- /* @__PURE__ */ jsx7("div", { className: "d-grid", children: /* @__PURE__ */ jsx7(Button4, { variant: "primary", type: "submit", children: "Salvar" }) })
1111
+ /* @__PURE__ */ jsx10("div", { className: "d-grid", children: /* @__PURE__ */ jsx10(Button6, { variant: "primary", type: "submit", children: "Salvar" }) })
700
1112
  ] });
701
1113
  };
702
1114
  var GenericForm_default = GenericForm;
703
1115
 
704
1116
  // src/forms/GenericSelect.tsx
705
- import { useEffect as useEffect2, useState as useState5 } from "react";
706
- import { Form as Form3, InputGroup as InputGroup2 } from "react-bootstrap";
707
- import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1117
+ import { useEffect as useEffect3, useState as useState8 } from "react";
1118
+ import { Form as Form6, InputGroup as InputGroup3 } from "react-bootstrap";
1119
+ import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
708
1120
  var GenericSelectOps = class {
709
1121
  constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
710
1122
  this.noLabel = noLabel;
@@ -741,8 +1153,8 @@ var GenericSelect = ({
741
1153
  isBold,
742
1154
  ...restProps
743
1155
  }) => {
744
- const [options, setOptions] = useState5(ops || []);
745
- useEffect2(() => {
1156
+ const [options, setOptions] = useState8(ops || []);
1157
+ useEffect3(() => {
746
1158
  const loadFunction = async () => {
747
1159
  if (loadCondition && loadFunc) {
748
1160
  loadFunc().then((res) => {
@@ -767,15 +1179,15 @@ var GenericSelect = ({
767
1179
  }
768
1180
  };
769
1181
  const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
770
- const selectContent = /* @__PURE__ */ jsxs6(
771
- Form3.Control,
1182
+ const selectContent = /* @__PURE__ */ jsxs9(
1183
+ Form6.Control,
772
1184
  {
773
1185
  disabled: locked,
774
1186
  as: "select",
775
1187
  value: selection,
776
1188
  onChange: (event) => getTrueValue(event.target.selectedIndex),
777
1189
  children: [
778
- /* @__PURE__ */ jsxs6("option", { value: void 0, children: [
1190
+ /* @__PURE__ */ jsxs9("option", { value: void 0, children: [
779
1191
  "-- ",
780
1192
  defaultPlaceholder,
781
1193
  " --"
@@ -784,30 +1196,33 @@ var GenericSelect = ({
784
1196
  const val = valueType && op[valueType] || op.id || op;
785
1197
  let fill = displayType && op[displayType] || op;
786
1198
  if (typeof fill == "object") fill = "";
787
- return /* @__PURE__ */ jsx8("option", { value: val, children: fill }, op.id || index);
1199
+ return /* @__PURE__ */ jsx11("option", { value: val, children: fill }, op.id || index);
788
1200
  })
789
1201
  ]
790
1202
  }
791
1203
  );
792
1204
  if (actionClick) {
793
- return /* @__PURE__ */ jsxs6(Fragment4, { children: [
794
- /* @__PURE__ */ jsx8(Form3.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
795
- /* @__PURE__ */ jsxs6(InputGroup2, { children: [
1205
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1206
+ /* @__PURE__ */ jsx11(Form6.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1207
+ /* @__PURE__ */ jsxs9(InputGroup3, { children: [
796
1208
  selectContent,
797
1209
  actionClick()
798
1210
  ] })
799
1211
  ] });
800
1212
  }
801
- return /* @__PURE__ */ jsxs6(Fragment4, { children: [
802
- /* @__PURE__ */ jsx8(Form3.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
1213
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1214
+ /* @__PURE__ */ jsx11(Form6.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
803
1215
  selectContent
804
1216
  ] });
805
1217
  };
806
1218
  var GenericSelect_default = GenericSelect;
807
1219
  export {
1220
+ ActionButtons,
808
1221
  AddButton_default as AddButton,
1222
+ AutoComplete,
809
1223
  ConfigObject,
810
1224
  DeleteButton_default as DeleteButton,
1225
+ DeleteConfirm,
811
1226
  GenericDisplay_default as GenericDisplay,
812
1227
  GenericForm_default as GenericForm,
813
1228
  GenericSelect_default as GenericSelect,