@motor-hero/ui-kit 0.33.0 → 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/index.cjs +414 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +423 -143
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/src/components/date-picker.tsx +348 -0
- package/src/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -1210,31 +1210,309 @@ function ColorPicker({
|
|
|
1210
1210
|
] });
|
|
1211
1211
|
}
|
|
1212
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
|
+
|
|
1213
1491
|
// src/components/stat-card.tsx
|
|
1214
|
-
import { jsx as
|
|
1492
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1215
1493
|
function StatCard({ label, value, detail, icon, isLoading }) {
|
|
1216
1494
|
if (isLoading) {
|
|
1217
|
-
return /* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__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" })
|
|
1221
1499
|
] }),
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
/* @__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" })
|
|
1224
1502
|
] });
|
|
1225
1503
|
}
|
|
1226
|
-
return /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
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 })
|
|
1230
1508
|
] }),
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
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 })
|
|
1233
1511
|
] });
|
|
1234
1512
|
}
|
|
1235
1513
|
|
|
1236
1514
|
// src/components/data-table-wrapper.tsx
|
|
1237
|
-
import { jsx as
|
|
1515
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1238
1516
|
function DataTableWrapper({
|
|
1239
1517
|
children,
|
|
1240
1518
|
isEmpty,
|
|
@@ -1247,15 +1525,15 @@ function DataTableWrapper({
|
|
|
1247
1525
|
hasNextPage = false,
|
|
1248
1526
|
hasPreviousPage = false
|
|
1249
1527
|
}) {
|
|
1250
|
-
return /* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
1253
|
-
emptyIcon && /* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
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 })
|
|
1256
1534
|
] }),
|
|
1257
|
-
page !== void 0 && onPageChange && /* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1535
|
+
page !== void 0 && onPageChange && /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-end gap-4", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx22(
|
|
1259
1537
|
"button",
|
|
1260
1538
|
{
|
|
1261
1539
|
type: "button",
|
|
@@ -1265,11 +1543,11 @@ function DataTableWrapper({
|
|
|
1265
1543
|
children: "Anterior"
|
|
1266
1544
|
}
|
|
1267
1545
|
),
|
|
1268
|
-
/* @__PURE__ */
|
|
1546
|
+
/* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground", children: [
|
|
1269
1547
|
"P\xE1gina ",
|
|
1270
1548
|
page
|
|
1271
1549
|
] }),
|
|
1272
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ jsx22(
|
|
1273
1551
|
"button",
|
|
1274
1552
|
{
|
|
1275
1553
|
type: "button",
|
|
@@ -1284,8 +1562,8 @@ function DataTableWrapper({
|
|
|
1284
1562
|
}
|
|
1285
1563
|
|
|
1286
1564
|
// src/components/mobile-card-list.tsx
|
|
1287
|
-
import { useRef as
|
|
1288
|
-
import { jsx as
|
|
1565
|
+
import { useRef as useRef3 } from "react";
|
|
1566
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1289
1567
|
var SCROLL_THRESHOLD = 8;
|
|
1290
1568
|
function MobileCardList({
|
|
1291
1569
|
data,
|
|
@@ -1295,8 +1573,8 @@ function MobileCardList({
|
|
|
1295
1573
|
loadingCount = 5,
|
|
1296
1574
|
className
|
|
1297
1575
|
}) {
|
|
1298
|
-
const start =
|
|
1299
|
-
const scrolled =
|
|
1576
|
+
const start = useRef3(null);
|
|
1577
|
+
const scrolled = useRef3(false);
|
|
1300
1578
|
const onTouchStart = (e) => {
|
|
1301
1579
|
const t = e.touches[0];
|
|
1302
1580
|
start.current = { x: t.clientX, y: t.clientY };
|
|
@@ -1316,26 +1594,26 @@ function MobileCardList({
|
|
|
1316
1594
|
}
|
|
1317
1595
|
};
|
|
1318
1596
|
if (isLoading) {
|
|
1319
|
-
return /* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__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" })
|
|
1323
1601
|
] }),
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__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" })
|
|
1328
1606
|
] })
|
|
1329
1607
|
] }) }, i)) });
|
|
1330
1608
|
}
|
|
1331
|
-
return /* @__PURE__ */
|
|
1609
|
+
return /* @__PURE__ */ jsx23(
|
|
1332
1610
|
"div",
|
|
1333
1611
|
{
|
|
1334
1612
|
className: `space-y-3 ${className ?? ""}`,
|
|
1335
1613
|
onTouchStart,
|
|
1336
1614
|
onTouchMove,
|
|
1337
1615
|
onClickCapture,
|
|
1338
|
-
children: data.map((item, index) => /* @__PURE__ */
|
|
1616
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx23(
|
|
1339
1617
|
"div",
|
|
1340
1618
|
{
|
|
1341
1619
|
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
@@ -1348,7 +1626,7 @@ function MobileCardList({
|
|
|
1348
1626
|
}
|
|
1349
1627
|
|
|
1350
1628
|
// src/components/responsive-data-view.tsx
|
|
1351
|
-
import { jsx as
|
|
1629
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1352
1630
|
function ResponsiveDataView({
|
|
1353
1631
|
table,
|
|
1354
1632
|
cards,
|
|
@@ -1359,13 +1637,13 @@ function ResponsiveDataView({
|
|
|
1359
1637
|
emptyDescription,
|
|
1360
1638
|
pagination
|
|
1361
1639
|
}) {
|
|
1362
|
-
return /* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
1366
|
-
emptyIcon && /* @__PURE__ */
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
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 })
|
|
1369
1647
|
] }),
|
|
1370
1648
|
pagination
|
|
1371
1649
|
] });
|
|
@@ -1373,10 +1651,10 @@ function ResponsiveDataView({
|
|
|
1373
1651
|
|
|
1374
1652
|
// src/components/toaster.tsx
|
|
1375
1653
|
import { Toaster as Sonner } from "sonner";
|
|
1376
|
-
import { jsx as
|
|
1654
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1377
1655
|
function Toaster(props) {
|
|
1378
1656
|
const { theme = "system" } = useTheme();
|
|
1379
|
-
return /* @__PURE__ */
|
|
1657
|
+
return /* @__PURE__ */ jsx25(
|
|
1380
1658
|
Sonner,
|
|
1381
1659
|
{
|
|
1382
1660
|
theme,
|
|
@@ -1397,18 +1675,18 @@ function Toaster(props) {
|
|
|
1397
1675
|
}
|
|
1398
1676
|
|
|
1399
1677
|
// src/components/app-shell.tsx
|
|
1400
|
-
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
1401
|
-
import { useState as
|
|
1678
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2, Menu } from "lucide-react";
|
|
1679
|
+
import { useState as useState10 } from "react";
|
|
1402
1680
|
|
|
1403
1681
|
// src/components/sidebar-nav.tsx
|
|
1404
|
-
import { Fragment as
|
|
1682
|
+
import { Fragment as Fragment4 } from "react";
|
|
1405
1683
|
|
|
1406
1684
|
// src/components/types.tsx
|
|
1407
|
-
import { jsx as
|
|
1408
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */
|
|
1685
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1686
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx26("a", { ...props, children });
|
|
1409
1687
|
|
|
1410
1688
|
// src/components/sidebar-nav.tsx
|
|
1411
|
-
import { Fragment as
|
|
1689
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1412
1690
|
function defaultIsActive(item, activePath) {
|
|
1413
1691
|
if (item.href === "/") return activePath === "/";
|
|
1414
1692
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -1423,7 +1701,7 @@ function SidebarNav({
|
|
|
1423
1701
|
onNavigate
|
|
1424
1702
|
}) {
|
|
1425
1703
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
1426
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx27("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
1427
1705
|
const active = isActive(item, activePath);
|
|
1428
1706
|
const link = renderLink({
|
|
1429
1707
|
href: item.href,
|
|
@@ -1435,21 +1713,21 @@ function SidebarNav({
|
|
|
1435
1713
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
1436
1714
|
isCollapsed && "justify-center px-2"
|
|
1437
1715
|
),
|
|
1438
|
-
children: /* @__PURE__ */
|
|
1439
|
-
item.icon && /* @__PURE__ */
|
|
1440
|
-
!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 })
|
|
1441
1719
|
] })
|
|
1442
1720
|
});
|
|
1443
|
-
return /* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ jsx27(Fragment4, { children: link }, item.href);
|
|
1444
1722
|
}) });
|
|
1445
1723
|
}
|
|
1446
1724
|
|
|
1447
1725
|
// src/components/user-menu.tsx
|
|
1448
1726
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
1449
1727
|
import { LogOut, User } from "lucide-react";
|
|
1450
|
-
import { useState as
|
|
1451
|
-
import { Drawer as
|
|
1452
|
-
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";
|
|
1453
1731
|
function initials(user) {
|
|
1454
1732
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
1455
1733
|
if (!source) return "";
|
|
@@ -1468,52 +1746,52 @@ function UserMenu({
|
|
|
1468
1746
|
align = "end"
|
|
1469
1747
|
}) {
|
|
1470
1748
|
const isDesktop = useIsDesktop();
|
|
1471
|
-
const [open, setOpen] =
|
|
1749
|
+
const [open, setOpen] = useState9(false);
|
|
1472
1750
|
const label = initials(user);
|
|
1473
|
-
const trigger = /* @__PURE__ */
|
|
1751
|
+
const trigger = /* @__PURE__ */ jsx28(
|
|
1474
1752
|
"button",
|
|
1475
1753
|
{
|
|
1476
1754
|
type: "button",
|
|
1477
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",
|
|
1478
1756
|
"aria-label": "Menu do usu\xE1rio",
|
|
1479
1757
|
"data-testid": "user-menu",
|
|
1480
|
-
children: user?.avatarUrl ? /* @__PURE__ */
|
|
1758
|
+
children: user?.avatarUrl ? /* @__PURE__ */ jsx28(
|
|
1481
1759
|
"img",
|
|
1482
1760
|
{
|
|
1483
1761
|
src: user.avatarUrl,
|
|
1484
1762
|
alt: user.name ?? user.email ?? "Avatar",
|
|
1485
1763
|
className: "h-full w-full object-cover"
|
|
1486
1764
|
}
|
|
1487
|
-
) : label ? /* @__PURE__ */
|
|
1765
|
+
) : label ? /* @__PURE__ */ jsx28("span", { children: label }) : /* @__PURE__ */ jsx28(User, { className: "h-4 w-4" })
|
|
1488
1766
|
}
|
|
1489
1767
|
);
|
|
1490
|
-
const userInfo = (user?.name || user?.email) && /* @__PURE__ */
|
|
1491
|
-
user.name && /* @__PURE__ */
|
|
1492
|
-
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 })
|
|
1493
1771
|
] });
|
|
1494
1772
|
if (isDesktop) {
|
|
1495
|
-
return /* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__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(
|
|
1498
1776
|
DropdownMenu2.Content,
|
|
1499
1777
|
{
|
|
1500
1778
|
align,
|
|
1501
1779
|
sideOffset: 6,
|
|
1502
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",
|
|
1503
1781
|
children: [
|
|
1504
|
-
userInfo && /* @__PURE__ */
|
|
1782
|
+
userInfo && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1505
1783
|
userInfo,
|
|
1506
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ jsx28(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
1507
1785
|
] }),
|
|
1508
1786
|
items.map(
|
|
1509
|
-
(item) => item.href ? /* @__PURE__ */
|
|
1787
|
+
(item) => item.href ? /* @__PURE__ */ jsx28(DropdownMenu2.Item, { asChild: true, children: renderLink({
|
|
1510
1788
|
href: item.href,
|
|
1511
1789
|
className: itemClass,
|
|
1512
|
-
children: /* @__PURE__ */
|
|
1790
|
+
children: /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1513
1791
|
item.icon,
|
|
1514
1792
|
item.label
|
|
1515
1793
|
] })
|
|
1516
|
-
}) }, item.label) : /* @__PURE__ */
|
|
1794
|
+
}) }, item.label) : /* @__PURE__ */ jsxs24(
|
|
1517
1795
|
DropdownMenu2.Item,
|
|
1518
1796
|
{
|
|
1519
1797
|
className: itemClass,
|
|
@@ -1526,9 +1804,9 @@ function UserMenu({
|
|
|
1526
1804
|
item.label
|
|
1527
1805
|
)
|
|
1528
1806
|
),
|
|
1529
|
-
onLogout && /* @__PURE__ */
|
|
1530
|
-
items.length > 0 && /* @__PURE__ */
|
|
1531
|
-
/* @__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(
|
|
1532
1810
|
DropdownMenu2.Item,
|
|
1533
1811
|
{
|
|
1534
1812
|
className: cn(
|
|
@@ -1537,7 +1815,7 @@ function UserMenu({
|
|
|
1537
1815
|
),
|
|
1538
1816
|
onClick: onLogout,
|
|
1539
1817
|
children: [
|
|
1540
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ jsx28(LogOut, { className: "h-4 w-4" }),
|
|
1541
1819
|
logoutLabel
|
|
1542
1820
|
]
|
|
1543
1821
|
}
|
|
@@ -1548,19 +1826,19 @@ function UserMenu({
|
|
|
1548
1826
|
) })
|
|
1549
1827
|
] });
|
|
1550
1828
|
}
|
|
1551
|
-
return /* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
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: [
|
|
1559
1837
|
userInfo,
|
|
1560
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx28("div", { className: "-mx-1 my-1 h-px bg-border" })
|
|
1561
1839
|
] }),
|
|
1562
1840
|
items.map(
|
|
1563
|
-
(item) => item.href ? /* @__PURE__ */
|
|
1841
|
+
(item) => item.href ? /* @__PURE__ */ jsx28(
|
|
1564
1842
|
"span",
|
|
1565
1843
|
{
|
|
1566
1844
|
onClick: () => setOpen(false),
|
|
@@ -1568,14 +1846,14 @@ function UserMenu({
|
|
|
1568
1846
|
children: renderLink({
|
|
1569
1847
|
href: item.href,
|
|
1570
1848
|
className: sheetItemClass,
|
|
1571
|
-
children: /* @__PURE__ */
|
|
1849
|
+
children: /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
1572
1850
|
item.icon,
|
|
1573
1851
|
item.label
|
|
1574
1852
|
] })
|
|
1575
1853
|
})
|
|
1576
1854
|
},
|
|
1577
1855
|
item.label
|
|
1578
|
-
) : /* @__PURE__ */
|
|
1856
|
+
) : /* @__PURE__ */ jsxs24(
|
|
1579
1857
|
"button",
|
|
1580
1858
|
{
|
|
1581
1859
|
type: "button",
|
|
@@ -1592,9 +1870,9 @@ function UserMenu({
|
|
|
1592
1870
|
item.label
|
|
1593
1871
|
)
|
|
1594
1872
|
),
|
|
1595
|
-
onLogout && /* @__PURE__ */
|
|
1596
|
-
items.length > 0 && /* @__PURE__ */
|
|
1597
|
-
/* @__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(
|
|
1598
1876
|
"button",
|
|
1599
1877
|
{
|
|
1600
1878
|
type: "button",
|
|
@@ -1604,7 +1882,7 @@ function UserMenu({
|
|
|
1604
1882
|
setOpen(false);
|
|
1605
1883
|
},
|
|
1606
1884
|
children: [
|
|
1607
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsx28(LogOut, { className: "h-4 w-4" }),
|
|
1608
1886
|
logoutLabel
|
|
1609
1887
|
]
|
|
1610
1888
|
}
|
|
@@ -1616,7 +1894,7 @@ function UserMenu({
|
|
|
1616
1894
|
}
|
|
1617
1895
|
|
|
1618
1896
|
// src/components/app-shell.tsx
|
|
1619
|
-
import { jsx as
|
|
1897
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1620
1898
|
function AppShell({
|
|
1621
1899
|
brand,
|
|
1622
1900
|
brandCollapsed,
|
|
@@ -1633,9 +1911,9 @@ function AppShell({
|
|
|
1633
1911
|
defaultCollapsed = false,
|
|
1634
1912
|
children
|
|
1635
1913
|
}) {
|
|
1636
|
-
const [collapsed, setCollapsed] =
|
|
1637
|
-
const [mobileOpen, setMobileOpen] =
|
|
1638
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */
|
|
1914
|
+
const [collapsed, setCollapsed] = useState10(defaultCollapsed);
|
|
1915
|
+
const [mobileOpen, setMobileOpen] = useState10(false);
|
|
1916
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx29(
|
|
1639
1917
|
SidebarNav,
|
|
1640
1918
|
{
|
|
1641
1919
|
items: navItems,
|
|
@@ -1647,8 +1925,8 @@ function AppShell({
|
|
|
1647
1925
|
onNavigate
|
|
1648
1926
|
}
|
|
1649
1927
|
);
|
|
1650
|
-
return /* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
1929
|
+
/* @__PURE__ */ jsxs25(
|
|
1652
1930
|
"aside",
|
|
1653
1931
|
{
|
|
1654
1932
|
className: cn(
|
|
@@ -1656,22 +1934,22 @@ function AppShell({
|
|
|
1656
1934
|
collapsed ? "w-16" : "w-60"
|
|
1657
1935
|
),
|
|
1658
1936
|
children: [
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
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(
|
|
1662
1940
|
"button",
|
|
1663
1941
|
{
|
|
1664
1942
|
type: "button",
|
|
1665
1943
|
onClick: () => setCollapsed((v) => !v),
|
|
1666
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",
|
|
1667
1945
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
1668
|
-
children: collapsed ? /* @__PURE__ */
|
|
1946
|
+
children: collapsed ? /* @__PURE__ */ jsx29(ChevronRight2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx29(ChevronLeft2, { className: "h-4 w-4" })
|
|
1669
1947
|
}
|
|
1670
1948
|
) })
|
|
1671
1949
|
]
|
|
1672
1950
|
}
|
|
1673
1951
|
),
|
|
1674
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsxs25(
|
|
1675
1953
|
"div",
|
|
1676
1954
|
{
|
|
1677
1955
|
className: cn(
|
|
@@ -1680,8 +1958,8 @@ function AppShell({
|
|
|
1680
1958
|
),
|
|
1681
1959
|
onClick: () => setMobileOpen(false),
|
|
1682
1960
|
children: [
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsx29("div", { className: "absolute inset-0 bg-black/50" }),
|
|
1962
|
+
/* @__PURE__ */ jsxs25(
|
|
1685
1963
|
"div",
|
|
1686
1964
|
{
|
|
1687
1965
|
className: cn(
|
|
@@ -1690,32 +1968,32 @@ function AppShell({
|
|
|
1690
1968
|
),
|
|
1691
1969
|
onClick: (e) => e.stopPropagation(),
|
|
1692
1970
|
children: [
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__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)) })
|
|
1695
1973
|
]
|
|
1696
1974
|
}
|
|
1697
1975
|
)
|
|
1698
1976
|
]
|
|
1699
1977
|
}
|
|
1700
1978
|
),
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
/* @__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(
|
|
1704
1982
|
"button",
|
|
1705
1983
|
{
|
|
1706
1984
|
type: "button",
|
|
1707
1985
|
onClick: () => setMobileOpen(true),
|
|
1708
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",
|
|
1709
1987
|
"aria-label": "Abrir menu",
|
|
1710
|
-
children: /* @__PURE__ */
|
|
1988
|
+
children: /* @__PURE__ */ jsx29(Menu, { className: "h-4 w-4" })
|
|
1711
1989
|
}
|
|
1712
1990
|
),
|
|
1713
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__PURE__ */ jsxs25("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1714
1992
|
headerActions,
|
|
1715
|
-
(user || onLogout) && /* @__PURE__ */
|
|
1993
|
+
(user || onLogout) && /* @__PURE__ */ jsx29(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
1716
1994
|
] })
|
|
1717
1995
|
] }),
|
|
1718
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsx29("main", { className: "flex-1 overflow-y-auto", children })
|
|
1719
1997
|
] })
|
|
1720
1998
|
] });
|
|
1721
1999
|
}
|
|
@@ -1723,9 +2001,9 @@ function AppShell({
|
|
|
1723
2001
|
// src/components/row-actions-menu.tsx
|
|
1724
2002
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
1725
2003
|
import { MoreVertical } from "lucide-react";
|
|
1726
|
-
import { useState as
|
|
1727
|
-
import { Drawer as
|
|
1728
|
-
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";
|
|
1729
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";
|
|
1730
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";
|
|
1731
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";
|
|
@@ -1737,22 +2015,22 @@ function RowActionsMenu({
|
|
|
1737
2015
|
renderLink = defaultRenderLink
|
|
1738
2016
|
}) {
|
|
1739
2017
|
const isDesktop = useIsDesktop();
|
|
1740
|
-
const [open, setOpen] =
|
|
2018
|
+
const [open, setOpen] = useState11(false);
|
|
1741
2019
|
if (actions.length === 0) return null;
|
|
1742
|
-
const trigger = /* @__PURE__ */
|
|
2020
|
+
const trigger = /* @__PURE__ */ jsx30(
|
|
1743
2021
|
"button",
|
|
1744
2022
|
{
|
|
1745
2023
|
type: "button",
|
|
1746
2024
|
disabled,
|
|
1747
2025
|
"aria-label": label,
|
|
1748
2026
|
className: triggerClass,
|
|
1749
|
-
children: /* @__PURE__ */
|
|
2027
|
+
children: /* @__PURE__ */ jsx30(MoreVertical, { className: "h-4 w-4" })
|
|
1750
2028
|
}
|
|
1751
2029
|
);
|
|
1752
2030
|
if (isDesktop) {
|
|
1753
|
-
return /* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__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(
|
|
1756
2034
|
DropdownMenu3.Content,
|
|
1757
2035
|
{
|
|
1758
2036
|
align,
|
|
@@ -1763,7 +2041,7 @@ function RowActionsMenu({
|
|
|
1763
2041
|
itemClass2,
|
|
1764
2042
|
action.destructive && "text-destructive focus:bg-destructive/10"
|
|
1765
2043
|
);
|
|
1766
|
-
return action.href ? /* @__PURE__ */
|
|
2044
|
+
return action.href ? /* @__PURE__ */ jsx30(
|
|
1767
2045
|
DropdownMenu3.Item,
|
|
1768
2046
|
{
|
|
1769
2047
|
asChild: true,
|
|
@@ -1771,14 +2049,14 @@ function RowActionsMenu({
|
|
|
1771
2049
|
children: renderLink({
|
|
1772
2050
|
href: action.href,
|
|
1773
2051
|
className: cls,
|
|
1774
|
-
children: /* @__PURE__ */
|
|
2052
|
+
children: /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
1775
2053
|
action.icon,
|
|
1776
2054
|
action.label
|
|
1777
2055
|
] })
|
|
1778
2056
|
})
|
|
1779
2057
|
},
|
|
1780
2058
|
action.label
|
|
1781
|
-
) : /* @__PURE__ */
|
|
2059
|
+
) : /* @__PURE__ */ jsxs26(
|
|
1782
2060
|
DropdownMenu3.Item,
|
|
1783
2061
|
{
|
|
1784
2062
|
className: cls,
|
|
@@ -1796,23 +2074,23 @@ function RowActionsMenu({
|
|
|
1796
2074
|
) })
|
|
1797
2075
|
] });
|
|
1798
2076
|
}
|
|
1799
|
-
return /* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__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" }),
|
|
1806
2084
|
actions.map((action) => {
|
|
1807
2085
|
const cls = cn(
|
|
1808
2086
|
sheetItemClass2,
|
|
1809
2087
|
action.destructive && "text-destructive"
|
|
1810
2088
|
);
|
|
1811
|
-
const inner = /* @__PURE__ */
|
|
2089
|
+
const inner = /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
1812
2090
|
action.icon,
|
|
1813
2091
|
action.label
|
|
1814
2092
|
] });
|
|
1815
|
-
return action.href ? /* @__PURE__ */
|
|
2093
|
+
return action.href ? /* @__PURE__ */ jsx30(
|
|
1816
2094
|
"span",
|
|
1817
2095
|
{
|
|
1818
2096
|
onClick: () => setOpen(false),
|
|
@@ -1824,7 +2102,7 @@ function RowActionsMenu({
|
|
|
1824
2102
|
})
|
|
1825
2103
|
},
|
|
1826
2104
|
action.label
|
|
1827
|
-
) : /* @__PURE__ */
|
|
2105
|
+
) : /* @__PURE__ */ jsx30(
|
|
1828
2106
|
"button",
|
|
1829
2107
|
{
|
|
1830
2108
|
type: "button",
|
|
@@ -1854,9 +2132,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
1854
2132
|
}
|
|
1855
2133
|
|
|
1856
2134
|
// src/hooks/use-disclosure.ts
|
|
1857
|
-
import { useCallback, useState as
|
|
2135
|
+
import { useCallback, useState as useState12 } from "react";
|
|
1858
2136
|
function useDisclosure(initial = false) {
|
|
1859
|
-
const [open, setOpen] =
|
|
2137
|
+
const [open, setOpen] = useState12(initial);
|
|
1860
2138
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
1861
2139
|
const onClose = useCallback(() => setOpen(false), []);
|
|
1862
2140
|
const onToggle = useCallback(() => setOpen((v) => !v), []);
|
|
@@ -1896,6 +2174,8 @@ export {
|
|
|
1896
2174
|
Combobox,
|
|
1897
2175
|
ConfirmDialog,
|
|
1898
2176
|
DataTableWrapper,
|
|
2177
|
+
DatePicker,
|
|
2178
|
+
DateTimePicker,
|
|
1899
2179
|
EmptyState,
|
|
1900
2180
|
FormDialog,
|
|
1901
2181
|
FormDialogLayout,
|