@motor-hero/ui-kit 0.32.1 → 0.34.0
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/components/date-picker.d.ts +21 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/pagination.d.ts +9 -3
- package/dist/components/pagination.d.ts.map +1 -1
- package/dist/index.cjs +475 -159
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +484 -170
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/src/components/date-picker.tsx +348 -0
- package/src/components/pagination.tsx +67 -20
- package/src/index.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -576,33 +576,67 @@ function AuthCard({ title, description, children, footer }) {
|
|
|
576
576
|
|
|
577
577
|
// src/components/pagination.tsx
|
|
578
578
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
579
|
+
var navButtonClass = "inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50";
|
|
580
|
+
function Pagination({
|
|
581
|
+
page,
|
|
582
|
+
onPageChange,
|
|
583
|
+
hasNextPage,
|
|
584
|
+
hasPreviousPage,
|
|
585
|
+
totalPages,
|
|
586
|
+
showPageSizeSelector = false,
|
|
587
|
+
pageSize,
|
|
588
|
+
onPageSizeChange,
|
|
589
|
+
pageSizeOptions,
|
|
590
|
+
className
|
|
591
|
+
}) {
|
|
592
|
+
return /* @__PURE__ */ jsxs12(
|
|
593
|
+
"div",
|
|
594
|
+
{
|
|
595
|
+
className: `flex items-center ${showPageSizeSelector ? "justify-between" : "justify-end"} gap-4 ${className ?? ""}`,
|
|
596
|
+
children: [
|
|
597
|
+
showPageSizeSelector && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
598
|
+
/* @__PURE__ */ jsx13("label", { htmlFor: "pagination-page-size", className: "text-sm text-muted-foreground", children: "Itens por p\xE1gina" }),
|
|
599
|
+
/* @__PURE__ */ jsx13(
|
|
600
|
+
"select",
|
|
601
|
+
{
|
|
602
|
+
id: "pagination-page-size",
|
|
603
|
+
value: pageSize,
|
|
604
|
+
onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
|
|
605
|
+
className: "h-8 rounded-md border border-input bg-background px-2 text-xs font-medium shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring cursor-pointer",
|
|
606
|
+
children: (pageSizeOptions ?? []).map((size) => /* @__PURE__ */ jsx13("option", { value: size, children: size }, size))
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
] }),
|
|
610
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-4", children: [
|
|
611
|
+
/* @__PURE__ */ jsx13(
|
|
612
|
+
"button",
|
|
613
|
+
{
|
|
614
|
+
type: "button",
|
|
615
|
+
onClick: () => onPageChange(page - 1),
|
|
616
|
+
disabled: !hasPreviousPage,
|
|
617
|
+
className: navButtonClass,
|
|
618
|
+
children: "Anterior"
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ jsxs12("span", { className: "text-sm text-muted-foreground", children: [
|
|
622
|
+
"P\xE1gina ",
|
|
623
|
+
page,
|
|
624
|
+
totalPages ? ` de ${totalPages}` : ""
|
|
625
|
+
] }),
|
|
626
|
+
/* @__PURE__ */ jsx13(
|
|
627
|
+
"button",
|
|
628
|
+
{
|
|
629
|
+
type: "button",
|
|
630
|
+
onClick: () => onPageChange(page + 1),
|
|
631
|
+
disabled: !hasNextPage,
|
|
632
|
+
className: navButtonClass,
|
|
633
|
+
children: "Pr\xF3ximo"
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
] })
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
);
|
|
606
640
|
}
|
|
607
641
|
|
|
608
642
|
// src/components/table-skeleton.tsx
|
|
@@ -1176,31 +1210,309 @@ function ColorPicker({
|
|
|
1176
1210
|
] });
|
|
1177
1211
|
}
|
|
1178
1212
|
|
|
1213
|
+
// src/components/date-picker.tsx
|
|
1214
|
+
import * as PopoverPrimitive4 from "@radix-ui/react-popover";
|
|
1215
|
+
import { InputMask } from "@react-input/mask";
|
|
1216
|
+
import { format, isValid, parse } from "date-fns";
|
|
1217
|
+
import { ptBR } from "date-fns/locale";
|
|
1218
|
+
import { CalendarIcon, ChevronLeft, ChevronRight, Clock } from "lucide-react";
|
|
1219
|
+
import * as React9 from "react";
|
|
1220
|
+
import { DayPicker } from "react-day-picker";
|
|
1221
|
+
import { Drawer as DrawerPrimitive3 } from "vaul";
|
|
1222
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1223
|
+
var DATE_MASK = "__/__/____";
|
|
1224
|
+
var TIME_MASK = "__:__";
|
|
1225
|
+
var MASK_REPLACEMENT = { _: /\d/ };
|
|
1226
|
+
var DATE_FORMAT = "dd/MM/yyyy";
|
|
1227
|
+
var TIME_FORMAT = "HH:mm";
|
|
1228
|
+
var DATE_VALUE_FORMAT = "yyyy-MM-dd";
|
|
1229
|
+
function pad(n) {
|
|
1230
|
+
return String(n).padStart(2, "0");
|
|
1231
|
+
}
|
|
1232
|
+
function parseStrict(text, fmt) {
|
|
1233
|
+
const parsed = parse(text, fmt, /* @__PURE__ */ new Date());
|
|
1234
|
+
if (!isValid(parsed)) return null;
|
|
1235
|
+
return format(parsed, fmt) === text ? parsed : null;
|
|
1236
|
+
}
|
|
1237
|
+
function dateOnlyToDate(value) {
|
|
1238
|
+
if (!value) return void 0;
|
|
1239
|
+
const parsed = parse(value, DATE_VALUE_FORMAT, /* @__PURE__ */ new Date());
|
|
1240
|
+
return isValid(parsed) ? parsed : void 0;
|
|
1241
|
+
}
|
|
1242
|
+
function dateTimeToDate(value) {
|
|
1243
|
+
if (!value) return void 0;
|
|
1244
|
+
const parsed = new Date(value);
|
|
1245
|
+
return Number.isNaN(parsed.getTime()) ? void 0 : parsed;
|
|
1246
|
+
}
|
|
1247
|
+
function displayFor(value, withTime) {
|
|
1248
|
+
const date = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
1249
|
+
if (!date) return "";
|
|
1250
|
+
const datePart = format(date, DATE_FORMAT);
|
|
1251
|
+
return withTime ? `${datePart} ${pad(date.getHours())}:${pad(date.getMinutes())}` : datePart;
|
|
1252
|
+
}
|
|
1253
|
+
function toMatchers(minDate, maxDate, disabledDates) {
|
|
1254
|
+
const matchers = [];
|
|
1255
|
+
const min = dateOnlyToDate(minDate);
|
|
1256
|
+
const max = dateOnlyToDate(maxDate);
|
|
1257
|
+
if (min) matchers.push({ before: min });
|
|
1258
|
+
if (max) matchers.push({ after: max });
|
|
1259
|
+
if (disabledDates) matchers.push(disabledDates);
|
|
1260
|
+
return matchers;
|
|
1261
|
+
}
|
|
1262
|
+
var triggerInputClass = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 pr-10 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive";
|
|
1263
|
+
var fieldInputClass = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
1264
|
+
var calendarClassNames = {
|
|
1265
|
+
months: "flex flex-col",
|
|
1266
|
+
month: "flex flex-col gap-4",
|
|
1267
|
+
month_caption: "flex justify-center pt-1 relative items-center h-7",
|
|
1268
|
+
caption_label: "text-sm font-medium",
|
|
1269
|
+
nav: "flex items-center gap-1 absolute inset-x-0 top-0 justify-between px-1",
|
|
1270
|
+
button_previous: "inline-flex size-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
1271
|
+
button_next: "inline-flex size-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
1272
|
+
month_grid: "w-full border-collapse space-y-1",
|
|
1273
|
+
weekdays: "flex",
|
|
1274
|
+
weekday: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
|
|
1275
|
+
week: "flex w-full mt-2",
|
|
1276
|
+
day: "relative p-0 text-center text-sm focus-within:relative focus-within:z-20",
|
|
1277
|
+
day_button: "inline-flex size-8 items-center justify-center rounded-md p-0 font-normal hover:bg-accent hover:text-accent-foreground aria-selected:opacity-100",
|
|
1278
|
+
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground rounded-md [&>button]:bg-primary [&>button]:text-primary-foreground",
|
|
1279
|
+
today: "bg-accent text-accent-foreground rounded-md",
|
|
1280
|
+
outside: "text-muted-foreground opacity-50",
|
|
1281
|
+
disabled: "text-muted-foreground opacity-50 pointer-events-none",
|
|
1282
|
+
hidden: "invisible"
|
|
1283
|
+
};
|
|
1284
|
+
var calendarComponents = {
|
|
1285
|
+
Chevron: ({ orientation }) => orientation === "left" ? /* @__PURE__ */ jsx20(ChevronLeft, { className: "size-4" }) : /* @__PURE__ */ jsx20(ChevronRight, { className: "size-4" })
|
|
1286
|
+
};
|
|
1287
|
+
function DatePickerImpl({
|
|
1288
|
+
value,
|
|
1289
|
+
onChange,
|
|
1290
|
+
placeholder,
|
|
1291
|
+
disabled,
|
|
1292
|
+
minDate,
|
|
1293
|
+
maxDate,
|
|
1294
|
+
disabledDates,
|
|
1295
|
+
withTime = false,
|
|
1296
|
+
id,
|
|
1297
|
+
className,
|
|
1298
|
+
"aria-invalid": ariaInvalid,
|
|
1299
|
+
"aria-describedby": ariaDescribedby
|
|
1300
|
+
}) {
|
|
1301
|
+
const isDesktop = useIsDesktop();
|
|
1302
|
+
const triggerRef = React9.useRef(null);
|
|
1303
|
+
const [open, setOpenRaw] = React9.useState(false);
|
|
1304
|
+
const [focused, setFocused] = React9.useState(false);
|
|
1305
|
+
const [editText, setEditText] = React9.useState("");
|
|
1306
|
+
const [pendingDate, setPendingDate] = React9.useState();
|
|
1307
|
+
const [pendingTime, setPendingTime] = React9.useState("");
|
|
1308
|
+
const committedDate = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
1309
|
+
const displayValue = displayFor(value, withTime);
|
|
1310
|
+
const matchers = toMatchers(minDate, maxDate, disabledDates);
|
|
1311
|
+
const setOpen = (next) => {
|
|
1312
|
+
setOpenRaw(next);
|
|
1313
|
+
if (next) {
|
|
1314
|
+
setEditText(displayValue);
|
|
1315
|
+
setPendingDate(committedDate);
|
|
1316
|
+
setPendingTime(
|
|
1317
|
+
committedDate ? `${pad(committedDate.getHours())}:${pad(committedDate.getMinutes())}` : ""
|
|
1318
|
+
);
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
const commitDateOnly = (date) => {
|
|
1322
|
+
onChange(format(date, DATE_VALUE_FORMAT));
|
|
1323
|
+
setOpen(false);
|
|
1324
|
+
};
|
|
1325
|
+
const commitDateTime = (date, timeText) => {
|
|
1326
|
+
const time = parseStrict(timeText, TIME_FORMAT);
|
|
1327
|
+
if (!time) return;
|
|
1328
|
+
const combined = new Date(date);
|
|
1329
|
+
combined.setHours(time.getHours(), time.getMinutes(), 0, 0);
|
|
1330
|
+
onChange(combined.toISOString());
|
|
1331
|
+
setOpen(false);
|
|
1332
|
+
};
|
|
1333
|
+
const handleCalendarSelect = (date) => {
|
|
1334
|
+
if (!withTime) {
|
|
1335
|
+
commitDateOnly(date);
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
setPendingDate(date);
|
|
1339
|
+
setEditText(`${format(date, DATE_FORMAT)} ${pendingTime}`.trim());
|
|
1340
|
+
};
|
|
1341
|
+
const handleTriggerChange = (event) => {
|
|
1342
|
+
const text = event.target.value;
|
|
1343
|
+
setEditText(text);
|
|
1344
|
+
if (!withTime) {
|
|
1345
|
+
const parsed = parseStrict(text, DATE_FORMAT);
|
|
1346
|
+
if (parsed) commitDateOnly(parsed);
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
const [datePart, timePart] = [text.slice(0, 10), text.slice(11)];
|
|
1350
|
+
const parsedDate = parseStrict(datePart, DATE_FORMAT);
|
|
1351
|
+
if (parsedDate) {
|
|
1352
|
+
setPendingDate(parsedDate);
|
|
1353
|
+
if (timePart) setPendingTime(timePart);
|
|
1354
|
+
}
|
|
1355
|
+
if (parsedDate && timePart && parseStrict(timePart, TIME_FORMAT)) {
|
|
1356
|
+
commitDateTime(parsedDate, timePart);
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
const handleTimeFieldChange = (event) => {
|
|
1360
|
+
setPendingTime(event.target.value);
|
|
1361
|
+
if (pendingDate) {
|
|
1362
|
+
setEditText(`${format(pendingDate, DATE_FORMAT)} ${event.target.value}`.trim());
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
const canApply = withTime && !!pendingDate && !!parseStrict(pendingTime, TIME_FORMAT);
|
|
1366
|
+
const trigger = /* @__PURE__ */ jsxs18("div", { ref: triggerRef, className: "relative", children: [
|
|
1367
|
+
/* @__PURE__ */ jsx20(
|
|
1368
|
+
InputMask,
|
|
1369
|
+
{
|
|
1370
|
+
id,
|
|
1371
|
+
mask: withTime ? `${DATE_MASK} ${TIME_MASK}` : DATE_MASK,
|
|
1372
|
+
replacement: MASK_REPLACEMENT,
|
|
1373
|
+
value: focused ? editText : displayValue,
|
|
1374
|
+
onChange: handleTriggerChange,
|
|
1375
|
+
onFocus: () => {
|
|
1376
|
+
setFocused(true);
|
|
1377
|
+
setOpen(true);
|
|
1378
|
+
},
|
|
1379
|
+
onBlur: () => setFocused(false),
|
|
1380
|
+
placeholder: placeholder ?? (withTime ? "dd/mm/aaaa hh:mm" : "dd/mm/aaaa"),
|
|
1381
|
+
disabled,
|
|
1382
|
+
"aria-invalid": ariaInvalid,
|
|
1383
|
+
"aria-describedby": ariaDescribedby,
|
|
1384
|
+
className: cn(triggerInputClass, className)
|
|
1385
|
+
}
|
|
1386
|
+
),
|
|
1387
|
+
/* @__PURE__ */ jsx20(
|
|
1388
|
+
"button",
|
|
1389
|
+
{
|
|
1390
|
+
type: "button",
|
|
1391
|
+
disabled,
|
|
1392
|
+
"aria-label": withTime ? "Abrir calend\xE1rio e hor\xE1rio" : "Abrir calend\xE1rio",
|
|
1393
|
+
"aria-haspopup": "dialog",
|
|
1394
|
+
"aria-expanded": open,
|
|
1395
|
+
onClick: () => setOpen(!open),
|
|
1396
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
|
|
1397
|
+
children: withTime ? /* @__PURE__ */ jsx20(Clock, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx20(CalendarIcon, { className: "h-4 w-4" })
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
] });
|
|
1401
|
+
const content = /* @__PURE__ */ jsxs18("div", { className: withTime ? "p-3" : "", children: [
|
|
1402
|
+
/* @__PURE__ */ jsx20(
|
|
1403
|
+
DayPicker,
|
|
1404
|
+
{
|
|
1405
|
+
mode: "single",
|
|
1406
|
+
locale: ptBR,
|
|
1407
|
+
selected: withTime ? pendingDate : committedDate,
|
|
1408
|
+
defaultMonth: (withTime ? pendingDate : committedDate) ?? /* @__PURE__ */ new Date(),
|
|
1409
|
+
onSelect: (date) => date && handleCalendarSelect(date),
|
|
1410
|
+
disabled: matchers,
|
|
1411
|
+
className: withTime ? "p-0" : "p-3",
|
|
1412
|
+
classNames: calendarClassNames,
|
|
1413
|
+
components: calendarComponents
|
|
1414
|
+
}
|
|
1415
|
+
),
|
|
1416
|
+
withTime && /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
1417
|
+
/* @__PURE__ */ jsxs18("div", { className: "mt-2 flex items-center gap-2 border-t pt-3", children: [
|
|
1418
|
+
/* @__PURE__ */ jsx20("span", { className: "text-sm text-muted-foreground", children: "Hor\xE1rio" }),
|
|
1419
|
+
/* @__PURE__ */ jsx20(
|
|
1420
|
+
InputMask,
|
|
1421
|
+
{
|
|
1422
|
+
mask: TIME_MASK,
|
|
1423
|
+
replacement: MASK_REPLACEMENT,
|
|
1424
|
+
value: pendingTime,
|
|
1425
|
+
onChange: handleTimeFieldChange,
|
|
1426
|
+
placeholder: "hh:mm",
|
|
1427
|
+
"aria-label": "Hor\xE1rio",
|
|
1428
|
+
className: cn(fieldInputClass, "flex-1")
|
|
1429
|
+
}
|
|
1430
|
+
)
|
|
1431
|
+
] }),
|
|
1432
|
+
/* @__PURE__ */ jsx20(
|
|
1433
|
+
"button",
|
|
1434
|
+
{
|
|
1435
|
+
type: "button",
|
|
1436
|
+
disabled: !canApply,
|
|
1437
|
+
onClick: () => pendingDate && commitDateTime(pendingDate, pendingTime),
|
|
1438
|
+
className: "mt-3 flex h-9 w-full items-center justify-center rounded-md bg-primary text-sm font-medium text-primary-foreground shadow-sm transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",
|
|
1439
|
+
children: "Aplicar"
|
|
1440
|
+
}
|
|
1441
|
+
)
|
|
1442
|
+
] })
|
|
1443
|
+
] });
|
|
1444
|
+
if (isDesktop) {
|
|
1445
|
+
return /* @__PURE__ */ jsxs18(PopoverPrimitive4.Root, { open, onOpenChange: setOpen, children: [
|
|
1446
|
+
/* @__PURE__ */ jsx20(PopoverPrimitive4.Anchor, { asChild: true, children: trigger }),
|
|
1447
|
+
/* @__PURE__ */ jsx20(PopoverPrimitive4.Portal, { children: /* @__PURE__ */ jsx20(
|
|
1448
|
+
PopoverPrimitive4.Content,
|
|
1449
|
+
{
|
|
1450
|
+
align: "start",
|
|
1451
|
+
sideOffset: 4,
|
|
1452
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
1453
|
+
onInteractOutside: (event) => {
|
|
1454
|
+
if (triggerRef.current?.contains(event.target)) event.preventDefault();
|
|
1455
|
+
},
|
|
1456
|
+
className: "pointer-events-auto z-50 w-auto overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
1457
|
+
children: content
|
|
1458
|
+
}
|
|
1459
|
+
) })
|
|
1460
|
+
] });
|
|
1461
|
+
}
|
|
1462
|
+
return /* @__PURE__ */ jsxs18(DrawerPrimitive3.Root, { open, onOpenChange: setOpen, children: [
|
|
1463
|
+
trigger,
|
|
1464
|
+
/* @__PURE__ */ jsxs18(DrawerPrimitive3.Portal, { children: [
|
|
1465
|
+
/* @__PURE__ */ jsx20(DrawerPrimitive3.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
|
|
1466
|
+
/* @__PURE__ */ jsxs18(
|
|
1467
|
+
DrawerPrimitive3.Content,
|
|
1468
|
+
{
|
|
1469
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
1470
|
+
onInteractOutside: (event) => {
|
|
1471
|
+
if (triggerRef.current?.contains(event.target)) event.preventDefault();
|
|
1472
|
+
},
|
|
1473
|
+
className: "fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85vh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none",
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ jsx20(DrawerPrimitive3.Title, { className: "sr-only", children: withTime ? "Selecione a data e o hor\xE1rio" : "Selecione a data" }),
|
|
1476
|
+
/* @__PURE__ */ jsx20("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1477
|
+
/* @__PURE__ */ jsx20("div", { className: "flex justify-center overflow-y-auto pb-4", children: content })
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
)
|
|
1481
|
+
] })
|
|
1482
|
+
] });
|
|
1483
|
+
}
|
|
1484
|
+
function DatePicker(props) {
|
|
1485
|
+
return /* @__PURE__ */ jsx20(DatePickerImpl, { ...props });
|
|
1486
|
+
}
|
|
1487
|
+
function DateTimePicker(props) {
|
|
1488
|
+
return /* @__PURE__ */ jsx20(DatePickerImpl, { ...props, withTime: true });
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1179
1491
|
// src/components/stat-card.tsx
|
|
1180
|
-
import { jsx as
|
|
1492
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1181
1493
|
function StatCard({ label, value, detail, icon, isLoading }) {
|
|
1182
1494
|
if (isLoading) {
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
/* @__PURE__ */
|
|
1186
|
-
/* @__PURE__ */
|
|
1495
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
1496
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between pb-2", children: [
|
|
1497
|
+
/* @__PURE__ */ jsx21("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
1498
|
+
/* @__PURE__ */ jsx21("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" })
|
|
1187
1499
|
] }),
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1500
|
+
/* @__PURE__ */ jsx21("div", { className: "mt-2 h-7 w-16 animate-pulse rounded bg-muted" }),
|
|
1501
|
+
/* @__PURE__ */ jsx21("div", { className: "mt-1 h-4 w-20 animate-pulse rounded bg-muted" })
|
|
1190
1502
|
] });
|
|
1191
1503
|
}
|
|
1192
|
-
return /* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
icon && /* @__PURE__ */
|
|
1504
|
+
return /* @__PURE__ */ jsxs19("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
1505
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between pb-2", children: [
|
|
1506
|
+
/* @__PURE__ */ jsx21("span", { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
1507
|
+
icon && /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: icon })
|
|
1196
1508
|
] }),
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
detail && /* @__PURE__ */
|
|
1509
|
+
/* @__PURE__ */ jsx21("div", { className: "text-2xl font-bold", children: value }),
|
|
1510
|
+
detail && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: detail })
|
|
1199
1511
|
] });
|
|
1200
1512
|
}
|
|
1201
1513
|
|
|
1202
1514
|
// src/components/data-table-wrapper.tsx
|
|
1203
|
-
import { jsx as
|
|
1515
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1204
1516
|
function DataTableWrapper({
|
|
1205
1517
|
children,
|
|
1206
1518
|
isEmpty,
|
|
@@ -1213,15 +1525,15 @@ function DataTableWrapper({
|
|
|
1213
1525
|
hasNextPage = false,
|
|
1214
1526
|
hasPreviousPage = false
|
|
1215
1527
|
}) {
|
|
1216
|
-
return /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
1219
|
-
emptyIcon && /* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
emptyDescription && /* @__PURE__ */
|
|
1528
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-4", children: [
|
|
1529
|
+
/* @__PURE__ */ jsx22("div", { className: "overflow-x-auto rounded-md border", children }),
|
|
1530
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
1531
|
+
emptyIcon && /* @__PURE__ */ jsx22("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
1532
|
+
/* @__PURE__ */ jsx22("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
1533
|
+
emptyDescription && /* @__PURE__ */ jsx22("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
1222
1534
|
] }),
|
|
1223
|
-
page !== void 0 && onPageChange && /* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */
|
|
1535
|
+
page !== void 0 && onPageChange && /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-end gap-4", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx22(
|
|
1225
1537
|
"button",
|
|
1226
1538
|
{
|
|
1227
1539
|
type: "button",
|
|
@@ -1231,11 +1543,11 @@ function DataTableWrapper({
|
|
|
1231
1543
|
children: "Anterior"
|
|
1232
1544
|
}
|
|
1233
1545
|
),
|
|
1234
|
-
/* @__PURE__ */
|
|
1546
|
+
/* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground", children: [
|
|
1235
1547
|
"P\xE1gina ",
|
|
1236
1548
|
page
|
|
1237
1549
|
] }),
|
|
1238
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ jsx22(
|
|
1239
1551
|
"button",
|
|
1240
1552
|
{
|
|
1241
1553
|
type: "button",
|
|
@@ -1250,8 +1562,8 @@ function DataTableWrapper({
|
|
|
1250
1562
|
}
|
|
1251
1563
|
|
|
1252
1564
|
// src/components/mobile-card-list.tsx
|
|
1253
|
-
import { useRef as
|
|
1254
|
-
import { jsx as
|
|
1565
|
+
import { useRef as useRef3 } from "react";
|
|
1566
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1255
1567
|
var SCROLL_THRESHOLD = 8;
|
|
1256
1568
|
function MobileCardList({
|
|
1257
1569
|
data,
|
|
@@ -1261,8 +1573,8 @@ function MobileCardList({
|
|
|
1261
1573
|
loadingCount = 5,
|
|
1262
1574
|
className
|
|
1263
1575
|
}) {
|
|
1264
|
-
const start =
|
|
1265
|
-
const scrolled =
|
|
1576
|
+
const start = useRef3(null);
|
|
1577
|
+
const scrolled = useRef3(false);
|
|
1266
1578
|
const onTouchStart = (e) => {
|
|
1267
1579
|
const t = e.touches[0];
|
|
1268
1580
|
start.current = { x: t.clientX, y: t.clientY };
|
|
@@ -1282,26 +1594,26 @@ function MobileCardList({
|
|
|
1282
1594
|
}
|
|
1283
1595
|
};
|
|
1284
1596
|
if (isLoading) {
|
|
1285
|
-
return /* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1288
|
-
/* @__PURE__ */
|
|
1597
|
+
return /* @__PURE__ */ jsx23("div", { className: `space-y-3 ${className ?? ""}`, children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ jsx23("div", { className: "rounded-xl border p-4", children: /* @__PURE__ */ jsxs21("div", { className: "space-y-3", children: [
|
|
1598
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between", children: [
|
|
1599
|
+
/* @__PURE__ */ jsx23("div", { className: "h-5 w-32 animate-pulse rounded bg-muted" }),
|
|
1600
|
+
/* @__PURE__ */ jsx23("div", { className: "h-5 w-16 animate-pulse rounded bg-muted" })
|
|
1289
1601
|
] }),
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1293
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ jsx23("div", { className: "h-4 w-48 animate-pulse rounded bg-muted" }),
|
|
1603
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex justify-between", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx23("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
1605
|
+
/* @__PURE__ */ jsx23("div", { className: "h-4 w-20 animate-pulse rounded bg-muted" })
|
|
1294
1606
|
] })
|
|
1295
1607
|
] }) }, i)) });
|
|
1296
1608
|
}
|
|
1297
|
-
return /* @__PURE__ */
|
|
1609
|
+
return /* @__PURE__ */ jsx23(
|
|
1298
1610
|
"div",
|
|
1299
1611
|
{
|
|
1300
1612
|
className: `space-y-3 ${className ?? ""}`,
|
|
1301
1613
|
onTouchStart,
|
|
1302
1614
|
onTouchMove,
|
|
1303
1615
|
onClickCapture,
|
|
1304
|
-
children: data.map((item, index) => /* @__PURE__ */
|
|
1616
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx23(
|
|
1305
1617
|
"div",
|
|
1306
1618
|
{
|
|
1307
1619
|
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
@@ -1314,7 +1626,7 @@ function MobileCardList({
|
|
|
1314
1626
|
}
|
|
1315
1627
|
|
|
1316
1628
|
// src/components/responsive-data-view.tsx
|
|
1317
|
-
import { jsx as
|
|
1629
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1318
1630
|
function ResponsiveDataView({
|
|
1319
1631
|
table,
|
|
1320
1632
|
cards,
|
|
@@ -1325,13 +1637,13 @@ function ResponsiveDataView({
|
|
|
1325
1637
|
emptyDescription,
|
|
1326
1638
|
pagination
|
|
1327
1639
|
}) {
|
|
1328
|
-
return /* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
1332
|
-
emptyIcon && /* @__PURE__ */
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
emptyDescription && /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
|
|
1641
|
+
/* @__PURE__ */ jsx24("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
|
|
1642
|
+
/* @__PURE__ */ jsx24("div", { className: "md:hidden", children: cards }),
|
|
1643
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
1644
|
+
emptyIcon && /* @__PURE__ */ jsx24("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
1645
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
1646
|
+
emptyDescription && /* @__PURE__ */ jsx24("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
1335
1647
|
] }),
|
|
1336
1648
|
pagination
|
|
1337
1649
|
] });
|
|
@@ -1339,10 +1651,10 @@ function ResponsiveDataView({
|
|
|
1339
1651
|
|
|
1340
1652
|
// src/components/toaster.tsx
|
|
1341
1653
|
import { Toaster as Sonner } from "sonner";
|
|
1342
|
-
import { jsx as
|
|
1654
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1343
1655
|
function Toaster(props) {
|
|
1344
1656
|
const { theme = "system" } = useTheme();
|
|
1345
|
-
return /* @__PURE__ */
|
|
1657
|
+
return /* @__PURE__ */ jsx25(
|
|
1346
1658
|
Sonner,
|
|
1347
1659
|
{
|
|
1348
1660
|
theme,
|
|
@@ -1363,18 +1675,18 @@ function Toaster(props) {
|
|
|
1363
1675
|
}
|
|
1364
1676
|
|
|
1365
1677
|
// src/components/app-shell.tsx
|
|
1366
|
-
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
1367
|
-
import { useState as
|
|
1678
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2, Menu } from "lucide-react";
|
|
1679
|
+
import { useState as useState10 } from "react";
|
|
1368
1680
|
|
|
1369
1681
|
// src/components/sidebar-nav.tsx
|
|
1370
|
-
import { Fragment as
|
|
1682
|
+
import { Fragment as Fragment4 } from "react";
|
|
1371
1683
|
|
|
1372
1684
|
// src/components/types.tsx
|
|
1373
|
-
import { jsx as
|
|
1374
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */
|
|
1685
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1686
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx26("a", { ...props, children });
|
|
1375
1687
|
|
|
1376
1688
|
// src/components/sidebar-nav.tsx
|
|
1377
|
-
import { Fragment as
|
|
1689
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1378
1690
|
function defaultIsActive(item, activePath) {
|
|
1379
1691
|
if (item.href === "/") return activePath === "/";
|
|
1380
1692
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -1389,7 +1701,7 @@ function SidebarNav({
|
|
|
1389
1701
|
onNavigate
|
|
1390
1702
|
}) {
|
|
1391
1703
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
1392
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx27("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
1393
1705
|
const active = isActive(item, activePath);
|
|
1394
1706
|
const link = renderLink({
|
|
1395
1707
|
href: item.href,
|
|
@@ -1401,21 +1713,21 @@ function SidebarNav({
|
|
|
1401
1713
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
1402
1714
|
isCollapsed && "justify-center px-2"
|
|
1403
1715
|
),
|
|
1404
|
-
children: /* @__PURE__ */
|
|
1405
|
-
item.icon && /* @__PURE__ */
|
|
1406
|
-
!isCollapsed && /* @__PURE__ */
|
|
1716
|
+
children: /* @__PURE__ */ jsxs23(Fragment5, { children: [
|
|
1717
|
+
item.icon && /* @__PURE__ */ jsx27("span", { className: "shrink-0", children: item.icon }),
|
|
1718
|
+
!isCollapsed && /* @__PURE__ */ jsx27("span", { className: "truncate", children: item.label })
|
|
1407
1719
|
] })
|
|
1408
1720
|
});
|
|
1409
|
-
return /* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ jsx27(Fragment4, { children: link }, item.href);
|
|
1410
1722
|
}) });
|
|
1411
1723
|
}
|
|
1412
1724
|
|
|
1413
1725
|
// src/components/user-menu.tsx
|
|
1414
1726
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
1415
1727
|
import { LogOut, User } from "lucide-react";
|
|
1416
|
-
import { useState as
|
|
1417
|
-
import { Drawer as
|
|
1418
|
-
import { Fragment as
|
|
1728
|
+
import { useState as useState9 } from "react";
|
|
1729
|
+
import { Drawer as DrawerPrimitive4 } from "vaul";
|
|
1730
|
+
import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1419
1731
|
function initials(user) {
|
|
1420
1732
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
1421
1733
|
if (!source) return "";
|
|
@@ -1434,52 +1746,52 @@ function UserMenu({
|
|
|
1434
1746
|
align = "end"
|
|
1435
1747
|
}) {
|
|
1436
1748
|
const isDesktop = useIsDesktop();
|
|
1437
|
-
const [open, setOpen] =
|
|
1749
|
+
const [open, setOpen] = useState9(false);
|
|
1438
1750
|
const label = initials(user);
|
|
1439
|
-
const trigger = /* @__PURE__ */
|
|
1751
|
+
const trigger = /* @__PURE__ */ jsx28(
|
|
1440
1752
|
"button",
|
|
1441
1753
|
{
|
|
1442
1754
|
type: "button",
|
|
1443
1755
|
className: "inline-flex h-9 w-9 items-center justify-center overflow-hidden rounded-full border border-input bg-background text-xs font-semibold shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1444
1756
|
"aria-label": "Menu do usu\xE1rio",
|
|
1445
1757
|
"data-testid": "user-menu",
|
|
1446
|
-
children: user?.avatarUrl ? /* @__PURE__ */
|
|
1758
|
+
children: user?.avatarUrl ? /* @__PURE__ */ jsx28(
|
|
1447
1759
|
"img",
|
|
1448
1760
|
{
|
|
1449
1761
|
src: user.avatarUrl,
|
|
1450
1762
|
alt: user.name ?? user.email ?? "Avatar",
|
|
1451
1763
|
className: "h-full w-full object-cover"
|
|
1452
1764
|
}
|
|
1453
|
-
) : label ? /* @__PURE__ */
|
|
1765
|
+
) : label ? /* @__PURE__ */ jsx28("span", { children: label }) : /* @__PURE__ */ jsx28(User, { className: "h-4 w-4" })
|
|
1454
1766
|
}
|
|
1455
1767
|
);
|
|
1456
|
-
const userInfo = (user?.name || user?.email) && /* @__PURE__ */
|
|
1457
|
-
user.name && /* @__PURE__ */
|
|
1458
|
-
user.email && /* @__PURE__ */
|
|
1768
|
+
const userInfo = (user?.name || user?.email) && /* @__PURE__ */ jsxs24("div", { className: "px-2 py-1.5", children: [
|
|
1769
|
+
user.name && /* @__PURE__ */ jsx28("p", { className: "truncate text-sm font-medium", children: user.name }),
|
|
1770
|
+
user.email && /* @__PURE__ */ jsx28("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
1459
1771
|
] });
|
|
1460
1772
|
if (isDesktop) {
|
|
1461
|
-
return /* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ jsxs24(DropdownMenu2.Root, { open, onOpenChange: setOpen, children: [
|
|
1774
|
+
/* @__PURE__ */ jsx28(DropdownMenu2.Trigger, { asChild: true, children: trigger }),
|
|
1775
|
+
/* @__PURE__ */ jsx28(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs24(
|
|
1464
1776
|
DropdownMenu2.Content,
|
|
1465
1777
|
{
|
|
1466
1778
|
align,
|
|
1467
1779
|
sideOffset: 6,
|
|
1468
1780
|
className: "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
1469
1781
|
children: [
|
|
1470
|
-
userInfo && /* @__PURE__ */
|
|
1782
|
+
userInfo && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1471
1783
|
userInfo,
|
|
1472
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ jsx28(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
1473
1785
|
] }),
|
|
1474
1786
|
items.map(
|
|
1475
|
-
(item) => item.href ? /* @__PURE__ */
|
|
1787
|
+
(item) => item.href ? /* @__PURE__ */ jsx28(DropdownMenu2.Item, { asChild: true, children: renderLink({
|
|
1476
1788
|
href: item.href,
|
|
1477
1789
|
className: itemClass,
|
|
1478
|
-
children: /* @__PURE__ */
|
|
1790
|
+
children: /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1479
1791
|
item.icon,
|
|
1480
1792
|
item.label
|
|
1481
1793
|
] })
|
|
1482
|
-
}) }, item.label) : /* @__PURE__ */
|
|
1794
|
+
}) }, item.label) : /* @__PURE__ */ jsxs24(
|
|
1483
1795
|
DropdownMenu2.Item,
|
|
1484
1796
|
{
|
|
1485
1797
|
className: itemClass,
|
|
@@ -1492,9 +1804,9 @@ function UserMenu({
|
|
|
1492
1804
|
item.label
|
|
1493
1805
|
)
|
|
1494
1806
|
),
|
|
1495
|
-
onLogout && /* @__PURE__ */
|
|
1496
|
-
items.length > 0 && /* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1807
|
+
onLogout && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1808
|
+
items.length > 0 && /* @__PURE__ */ jsx28(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
|
|
1809
|
+
/* @__PURE__ */ jsxs24(
|
|
1498
1810
|
DropdownMenu2.Item,
|
|
1499
1811
|
{
|
|
1500
1812
|
className: cn(
|
|
@@ -1503,7 +1815,7 @@ function UserMenu({
|
|
|
1503
1815
|
),
|
|
1504
1816
|
onClick: onLogout,
|
|
1505
1817
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ jsx28(LogOut, { className: "h-4 w-4" }),
|
|
1507
1819
|
logoutLabel
|
|
1508
1820
|
]
|
|
1509
1821
|
}
|
|
@@ -1514,19 +1826,19 @@ function UserMenu({
|
|
|
1514
1826
|
) })
|
|
1515
1827
|
] });
|
|
1516
1828
|
}
|
|
1517
|
-
return /* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
userInfo && /* @__PURE__ */
|
|
1829
|
+
return /* @__PURE__ */ jsxs24(DrawerPrimitive4.Root, { open, onOpenChange: setOpen, children: [
|
|
1830
|
+
/* @__PURE__ */ jsx28(DrawerPrimitive4.Trigger, { asChild: true, children: trigger }),
|
|
1831
|
+
/* @__PURE__ */ jsxs24(DrawerPrimitive4.Portal, { children: [
|
|
1832
|
+
/* @__PURE__ */ jsx28(DrawerPrimitive4.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
|
|
1833
|
+
/* @__PURE__ */ jsxs24(DrawerPrimitive4.Content, { className: "fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl border bg-popover p-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-popover-foreground outline-none", children: [
|
|
1834
|
+
/* @__PURE__ */ jsx28(DrawerPrimitive4.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
|
|
1835
|
+
/* @__PURE__ */ jsx28("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1836
|
+
userInfo && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1525
1837
|
userInfo,
|
|
1526
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx28("div", { className: "-mx-1 my-1 h-px bg-border" })
|
|
1527
1839
|
] }),
|
|
1528
1840
|
items.map(
|
|
1529
|
-
(item) => item.href ? /* @__PURE__ */
|
|
1841
|
+
(item) => item.href ? /* @__PURE__ */ jsx28(
|
|
1530
1842
|
"span",
|
|
1531
1843
|
{
|
|
1532
1844
|
onClick: () => setOpen(false),
|
|
@@ -1534,14 +1846,14 @@ function UserMenu({
|
|
|
1534
1846
|
children: renderLink({
|
|
1535
1847
|
href: item.href,
|
|
1536
1848
|
className: sheetItemClass,
|
|
1537
|
-
children: /* @__PURE__ */
|
|
1849
|
+
children: /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1538
1850
|
item.icon,
|
|
1539
1851
|
item.label
|
|
1540
1852
|
] })
|
|
1541
1853
|
})
|
|
1542
1854
|
},
|
|
1543
1855
|
item.label
|
|
1544
|
-
) : /* @__PURE__ */
|
|
1856
|
+
) : /* @__PURE__ */ jsxs24(
|
|
1545
1857
|
"button",
|
|
1546
1858
|
{
|
|
1547
1859
|
type: "button",
|
|
@@ -1558,9 +1870,9 @@ function UserMenu({
|
|
|
1558
1870
|
item.label
|
|
1559
1871
|
)
|
|
1560
1872
|
),
|
|
1561
|
-
onLogout && /* @__PURE__ */
|
|
1562
|
-
items.length > 0 && /* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1873
|
+
onLogout && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1874
|
+
items.length > 0 && /* @__PURE__ */ jsx28("div", { className: "-mx-1 my-1 h-px bg-border" }),
|
|
1875
|
+
/* @__PURE__ */ jsxs24(
|
|
1564
1876
|
"button",
|
|
1565
1877
|
{
|
|
1566
1878
|
type: "button",
|
|
@@ -1570,7 +1882,7 @@ function UserMenu({
|
|
|
1570
1882
|
setOpen(false);
|
|
1571
1883
|
},
|
|
1572
1884
|
children: [
|
|
1573
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsx28(LogOut, { className: "h-4 w-4" }),
|
|
1574
1886
|
logoutLabel
|
|
1575
1887
|
]
|
|
1576
1888
|
}
|
|
@@ -1582,7 +1894,7 @@ function UserMenu({
|
|
|
1582
1894
|
}
|
|
1583
1895
|
|
|
1584
1896
|
// src/components/app-shell.tsx
|
|
1585
|
-
import { jsx as
|
|
1897
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1586
1898
|
function AppShell({
|
|
1587
1899
|
brand,
|
|
1588
1900
|
brandCollapsed,
|
|
@@ -1599,9 +1911,9 @@ function AppShell({
|
|
|
1599
1911
|
defaultCollapsed = false,
|
|
1600
1912
|
children
|
|
1601
1913
|
}) {
|
|
1602
|
-
const [collapsed, setCollapsed] =
|
|
1603
|
-
const [mobileOpen, setMobileOpen] =
|
|
1604
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */
|
|
1914
|
+
const [collapsed, setCollapsed] = useState10(defaultCollapsed);
|
|
1915
|
+
const [mobileOpen, setMobileOpen] = useState10(false);
|
|
1916
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx29(
|
|
1605
1917
|
SidebarNav,
|
|
1606
1918
|
{
|
|
1607
1919
|
items: navItems,
|
|
@@ -1613,8 +1925,8 @@ function AppShell({
|
|
|
1613
1925
|
onNavigate
|
|
1614
1926
|
}
|
|
1615
1927
|
);
|
|
1616
|
-
return /* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
1929
|
+
/* @__PURE__ */ jsxs25(
|
|
1618
1930
|
"aside",
|
|
1619
1931
|
{
|
|
1620
1932
|
className: cn(
|
|
@@ -1622,22 +1934,22 @@ function AppShell({
|
|
|
1622
1934
|
collapsed ? "w-16" : "w-60"
|
|
1623
1935
|
),
|
|
1624
1936
|
children: [
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
collapsible && /* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx29("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: collapsed ? brandCollapsed ?? brand : brand }),
|
|
1938
|
+
/* @__PURE__ */ jsx29("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(collapsed) }),
|
|
1939
|
+
collapsible && /* @__PURE__ */ jsx29("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx29(
|
|
1628
1940
|
"button",
|
|
1629
1941
|
{
|
|
1630
1942
|
type: "button",
|
|
1631
1943
|
onClick: () => setCollapsed((v) => !v),
|
|
1632
1944
|
className: "flex w-full items-center justify-center rounded-md px-2 py-2 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
1633
1945
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
1634
|
-
children: collapsed ? /* @__PURE__ */
|
|
1946
|
+
children: collapsed ? /* @__PURE__ */ jsx29(ChevronRight2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx29(ChevronLeft2, { className: "h-4 w-4" })
|
|
1635
1947
|
}
|
|
1636
1948
|
) })
|
|
1637
1949
|
]
|
|
1638
1950
|
}
|
|
1639
1951
|
),
|
|
1640
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsxs25(
|
|
1641
1953
|
"div",
|
|
1642
1954
|
{
|
|
1643
1955
|
className: cn(
|
|
@@ -1646,8 +1958,8 @@ function AppShell({
|
|
|
1646
1958
|
),
|
|
1647
1959
|
onClick: () => setMobileOpen(false),
|
|
1648
1960
|
children: [
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsx29("div", { className: "absolute inset-0 bg-black/50" }),
|
|
1962
|
+
/* @__PURE__ */ jsxs25(
|
|
1651
1963
|
"div",
|
|
1652
1964
|
{
|
|
1653
1965
|
className: cn(
|
|
@@ -1656,32 +1968,32 @@ function AppShell({
|
|
|
1656
1968
|
),
|
|
1657
1969
|
onClick: (e) => e.stopPropagation(),
|
|
1658
1970
|
children: [
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx29("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: brand }),
|
|
1972
|
+
/* @__PURE__ */ jsx29("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(false, () => setMobileOpen(false)) })
|
|
1661
1973
|
]
|
|
1662
1974
|
}
|
|
1663
1975
|
)
|
|
1664
1976
|
]
|
|
1665
1977
|
}
|
|
1666
1978
|
),
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
1980
|
+
/* @__PURE__ */ jsxs25("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", children: [
|
|
1981
|
+
/* @__PURE__ */ jsx29(
|
|
1670
1982
|
"button",
|
|
1671
1983
|
{
|
|
1672
1984
|
type: "button",
|
|
1673
1985
|
onClick: () => setMobileOpen(true),
|
|
1674
1986
|
className: "inline-flex h-9 w-9 items-center justify-center rounded-md border border-input bg-background shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground md:hidden",
|
|
1675
1987
|
"aria-label": "Abrir menu",
|
|
1676
|
-
children: /* @__PURE__ */
|
|
1988
|
+
children: /* @__PURE__ */ jsx29(Menu, { className: "h-4 w-4" })
|
|
1677
1989
|
}
|
|
1678
1990
|
),
|
|
1679
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__PURE__ */ jsxs25("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1680
1992
|
headerActions,
|
|
1681
|
-
(user || onLogout) && /* @__PURE__ */
|
|
1993
|
+
(user || onLogout) && /* @__PURE__ */ jsx29(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
1682
1994
|
] })
|
|
1683
1995
|
] }),
|
|
1684
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsx29("main", { className: "flex-1 overflow-y-auto", children })
|
|
1685
1997
|
] })
|
|
1686
1998
|
] });
|
|
1687
1999
|
}
|
|
@@ -1689,9 +2001,9 @@ function AppShell({
|
|
|
1689
2001
|
// src/components/row-actions-menu.tsx
|
|
1690
2002
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
1691
2003
|
import { MoreVertical } from "lucide-react";
|
|
1692
|
-
import { useState as
|
|
1693
|
-
import { Drawer as
|
|
1694
|
-
import { Fragment as
|
|
2004
|
+
import { useState as useState11 } from "react";
|
|
2005
|
+
import { Drawer as DrawerPrimitive5 } from "vaul";
|
|
2006
|
+
import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1695
2007
|
var triggerClass = "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
|
|
1696
2008
|
var itemClass2 = "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent focus:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
1697
2009
|
var sheetItemClass2 = "flex w-full cursor-pointer select-none items-center gap-3 rounded-md px-3 py-3 text-base outline-none transition-colors hover:bg-accent active:bg-accent disabled:pointer-events-none disabled:opacity-50";
|
|
@@ -1703,22 +2015,22 @@ function RowActionsMenu({
|
|
|
1703
2015
|
renderLink = defaultRenderLink
|
|
1704
2016
|
}) {
|
|
1705
2017
|
const isDesktop = useIsDesktop();
|
|
1706
|
-
const [open, setOpen] =
|
|
2018
|
+
const [open, setOpen] = useState11(false);
|
|
1707
2019
|
if (actions.length === 0) return null;
|
|
1708
|
-
const trigger = /* @__PURE__ */
|
|
2020
|
+
const trigger = /* @__PURE__ */ jsx30(
|
|
1709
2021
|
"button",
|
|
1710
2022
|
{
|
|
1711
2023
|
type: "button",
|
|
1712
2024
|
disabled,
|
|
1713
2025
|
"aria-label": label,
|
|
1714
2026
|
className: triggerClass,
|
|
1715
|
-
children: /* @__PURE__ */
|
|
2027
|
+
children: /* @__PURE__ */ jsx30(MoreVertical, { className: "h-4 w-4" })
|
|
1716
2028
|
}
|
|
1717
2029
|
);
|
|
1718
2030
|
if (isDesktop) {
|
|
1719
|
-
return /* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
2031
|
+
return /* @__PURE__ */ jsxs26(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
2032
|
+
/* @__PURE__ */ jsx30(DropdownMenu3.Trigger, { asChild: true, children: trigger }),
|
|
2033
|
+
/* @__PURE__ */ jsx30(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx30(
|
|
1722
2034
|
DropdownMenu3.Content,
|
|
1723
2035
|
{
|
|
1724
2036
|
align,
|
|
@@ -1729,7 +2041,7 @@ function RowActionsMenu({
|
|
|
1729
2041
|
itemClass2,
|
|
1730
2042
|
action.destructive && "text-destructive focus:bg-destructive/10"
|
|
1731
2043
|
);
|
|
1732
|
-
return action.href ? /* @__PURE__ */
|
|
2044
|
+
return action.href ? /* @__PURE__ */ jsx30(
|
|
1733
2045
|
DropdownMenu3.Item,
|
|
1734
2046
|
{
|
|
1735
2047
|
asChild: true,
|
|
@@ -1737,14 +2049,14 @@ function RowActionsMenu({
|
|
|
1737
2049
|
children: renderLink({
|
|
1738
2050
|
href: action.href,
|
|
1739
2051
|
className: cls,
|
|
1740
|
-
children: /* @__PURE__ */
|
|
2052
|
+
children: /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
1741
2053
|
action.icon,
|
|
1742
2054
|
action.label
|
|
1743
2055
|
] })
|
|
1744
2056
|
})
|
|
1745
2057
|
},
|
|
1746
2058
|
action.label
|
|
1747
|
-
) : /* @__PURE__ */
|
|
2059
|
+
) : /* @__PURE__ */ jsxs26(
|
|
1748
2060
|
DropdownMenu3.Item,
|
|
1749
2061
|
{
|
|
1750
2062
|
className: cls,
|
|
@@ -1762,23 +2074,23 @@ function RowActionsMenu({
|
|
|
1762
2074
|
) })
|
|
1763
2075
|
] });
|
|
1764
2076
|
}
|
|
1765
|
-
return /* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsxs26(DrawerPrimitive5.Root, { open, onOpenChange: setOpen, children: [
|
|
2078
|
+
/* @__PURE__ */ jsx30(DrawerPrimitive5.Trigger, { asChild: true, children: trigger }),
|
|
2079
|
+
/* @__PURE__ */ jsxs26(DrawerPrimitive5.Portal, { children: [
|
|
2080
|
+
/* @__PURE__ */ jsx30(DrawerPrimitive5.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
|
|
2081
|
+
/* @__PURE__ */ jsxs26(DrawerPrimitive5.Content, { className: "fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl border bg-popover p-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-popover-foreground outline-none", children: [
|
|
2082
|
+
/* @__PURE__ */ jsx30(DrawerPrimitive5.Title, { className: "sr-only", children: label }),
|
|
2083
|
+
/* @__PURE__ */ jsx30("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1772
2084
|
actions.map((action) => {
|
|
1773
2085
|
const cls = cn(
|
|
1774
2086
|
sheetItemClass2,
|
|
1775
2087
|
action.destructive && "text-destructive"
|
|
1776
2088
|
);
|
|
1777
|
-
const inner = /* @__PURE__ */
|
|
2089
|
+
const inner = /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
1778
2090
|
action.icon,
|
|
1779
2091
|
action.label
|
|
1780
2092
|
] });
|
|
1781
|
-
return action.href ? /* @__PURE__ */
|
|
2093
|
+
return action.href ? /* @__PURE__ */ jsx30(
|
|
1782
2094
|
"span",
|
|
1783
2095
|
{
|
|
1784
2096
|
onClick: () => setOpen(false),
|
|
@@ -1790,7 +2102,7 @@ function RowActionsMenu({
|
|
|
1790
2102
|
})
|
|
1791
2103
|
},
|
|
1792
2104
|
action.label
|
|
1793
|
-
) : /* @__PURE__ */
|
|
2105
|
+
) : /* @__PURE__ */ jsx30(
|
|
1794
2106
|
"button",
|
|
1795
2107
|
{
|
|
1796
2108
|
type: "button",
|
|
@@ -1820,9 +2132,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
1820
2132
|
}
|
|
1821
2133
|
|
|
1822
2134
|
// src/hooks/use-disclosure.ts
|
|
1823
|
-
import { useCallback, useState as
|
|
2135
|
+
import { useCallback, useState as useState12 } from "react";
|
|
1824
2136
|
function useDisclosure(initial = false) {
|
|
1825
|
-
const [open, setOpen] =
|
|
2137
|
+
const [open, setOpen] = useState12(initial);
|
|
1826
2138
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
1827
2139
|
const onClose = useCallback(() => setOpen(false), []);
|
|
1828
2140
|
const onToggle = useCallback(() => setOpen((v) => !v), []);
|
|
@@ -1862,6 +2174,8 @@ export {
|
|
|
1862
2174
|
Combobox,
|
|
1863
2175
|
ConfirmDialog,
|
|
1864
2176
|
DataTableWrapper,
|
|
2177
|
+
DatePicker,
|
|
2178
|
+
DateTimePicker,
|
|
1865
2179
|
EmptyState,
|
|
1866
2180
|
FormDialog,
|
|
1867
2181
|
FormDialogLayout,
|