@the12company/ui 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
  import * as React11 from 'react';
4
+ import { useRef, useEffect } from 'react';
4
5
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
5
- import { ChevronDown, X, PanelLeft, ArrowLeft, ArrowRight, Check, Search, ChevronRight, Circle, Dot, ChevronUp, MoreHorizontal, ChevronLeft, GripVertical, CircleX } from 'lucide-react';
6
+ import { ChevronDown, X, PanelLeft, Mail, Lock, EyeOff, Eye, ArrowLeft, ArrowRight, Check, Search, ChevronRight, Circle, Dot, ChevronUp, AlertCircle, CheckCircle2, MoreHorizontal, ChevronLeft, GripVertical, ChevronsUpDown, Loader2, CircleX } from 'lucide-react';
6
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
8
  import { cva } from 'class-variance-authority';
8
9
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
@@ -11,6 +12,7 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
11
12
  import * as SheetPrimitive from '@radix-ui/react-dialog';
12
13
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
13
14
  import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
15
+ import { Renderer, Triangle, Program, Mesh, Color } from 'ogl';
14
16
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
15
17
  import { DayPicker } from 'react-day-picker';
16
18
  import useEmblaCarousel from 'embla-carousel-react';
@@ -398,40 +400,6 @@ var AlertDialogCancel = React11.forwardRef(({ className, ...props }, ref) => /*
398
400
  }
399
401
  ));
400
402
  AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
401
- function AppChromeHeader({
402
- headerRef,
403
- className,
404
- start,
405
- topBar,
406
- children
407
- }) {
408
- return /* @__PURE__ */ jsx(
409
- "header",
410
- {
411
- ref: headerRef,
412
- className: cn(
413
- "absolute left-3.5 right-3.5 top-3.5 z-30 max-w-full rounded-lg shadow-sm",
414
- className
415
- ),
416
- children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
417
- /* @__PURE__ */ jsx(
418
- "div",
419
- {
420
- className: "pointer-events-none absolute inset-0 rounded-lg bg-content-glass",
421
- "aria-hidden": true
422
- }
423
- ),
424
- /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col", children: [
425
- /* @__PURE__ */ jsxs("div", { className: "flex min-h-14 items-center gap-3 rounded-lg border-b border-border/40 px-3 py-2 sm:gap-2 md:min-h-fit", children: [
426
- start,
427
- topBar
428
- ] }),
429
- children
430
- ] })
431
- ] })
432
- }
433
- );
434
- }
435
403
  var inputVariants = cva(
436
404
  "flex h-10 w-full shadow-[0_2px_6px_hsl(var(--foreground)/0.08)] dark:shadow-[0_1px_3px_-1px_rgba(0,0,0,0.28)] hover:shadow-[0_4px_10px_hsl(var(--foreground)/0.12)] dark:hover:shadow-[0_2px_6px_-2px_rgba(0,0,0,0.32)] focus-visible:shadow-lg rounded-md px-3 py-2 text-base outline-none transition-all duration-300 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
437
405
  {
@@ -1191,6 +1159,76 @@ var SidebarMenuSubButton = React11.forwardRef(({ asChild = false, size = "md", i
1191
1159
  );
1192
1160
  });
1193
1161
  SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
1162
+ function AppChromeBrand({
1163
+ logo,
1164
+ title,
1165
+ subtitle,
1166
+ className,
1167
+ collapsed: collapsedProp
1168
+ }) {
1169
+ const { state, isMobile } = useSidebar();
1170
+ const collapsed = collapsedProp ?? (!isMobile && state === "collapsed");
1171
+ return /* @__PURE__ */ jsxs(
1172
+ "div",
1173
+ {
1174
+ className: cn(
1175
+ "flex min-w-0 items-center overflow-hidden transition-all duration-300",
1176
+ collapsed ? "justify-center px-2 py-4" : "gap-2.5 px-4 py-5",
1177
+ className
1178
+ ),
1179
+ children: [
1180
+ logo ? /* @__PURE__ */ jsx(
1181
+ "div",
1182
+ {
1183
+ className: cn(
1184
+ "flex flex-shrink-0 items-center justify-center rounded-lg transition-all duration-500 hover:scale-105 hover:shadow-lg hover:shadow-sidebar-primary/20",
1185
+ collapsed ? "h-9 w-9" : "h-8 w-8"
1186
+ ),
1187
+ children: logo
1188
+ }
1189
+ ) : null,
1190
+ !collapsed && (title || subtitle) ? /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", children: [
1191
+ title ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-base font-bold tracking-tight text-sidebar-accent-foreground", children: title }) : null,
1192
+ subtitle ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-xs text-sidebar-foreground/60", children: subtitle }) : null
1193
+ ] }) : null
1194
+ ]
1195
+ }
1196
+ );
1197
+ }
1198
+ function AppChromeHeader({
1199
+ headerRef,
1200
+ className,
1201
+ start,
1202
+ topBar,
1203
+ children
1204
+ }) {
1205
+ return /* @__PURE__ */ jsx(
1206
+ "header",
1207
+ {
1208
+ ref: headerRef,
1209
+ className: cn(
1210
+ "absolute left-3.5 right-3.5 top-3.5 z-30 max-w-full rounded-lg shadow-sm",
1211
+ className
1212
+ ),
1213
+ children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1214
+ /* @__PURE__ */ jsx(
1215
+ "div",
1216
+ {
1217
+ className: "pointer-events-none absolute inset-0 rounded-lg bg-content-glass",
1218
+ "aria-hidden": true
1219
+ }
1220
+ ),
1221
+ /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col", children: [
1222
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-14 items-center gap-3 rounded-lg border-b border-border/40 px-3 py-2 sm:gap-2 md:min-h-fit", children: [
1223
+ start,
1224
+ topBar
1225
+ ] }),
1226
+ children
1227
+ ] })
1228
+ ] })
1229
+ }
1230
+ );
1231
+ }
1194
1232
  function AppChromeSidebar({
1195
1233
  header,
1196
1234
  children,
@@ -1252,128 +1290,579 @@ function AppChromeSidebar({
1252
1290
  );
1253
1291
  }
1254
1292
  var AspectRatio = AspectRatioPrimitive.Root;
1255
- var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1256
- AvatarPrimitive.Root,
1257
- {
1258
- ref,
1259
- className: cn(
1260
- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
1261
- className
1262
- ),
1263
- ...props
1264
- }
1265
- ));
1266
- Avatar.displayName = AvatarPrimitive.Root.displayName;
1267
- var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1268
- AvatarPrimitive.Image,
1269
- {
1270
- ref,
1271
- className: cn("aspect-square h-full w-full", className),
1272
- ...props
1273
- }
1274
- ));
1275
- AvatarImage.displayName = AvatarPrimitive.Image.displayName;
1276
- var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1277
- AvatarPrimitive.Fallback,
1278
- {
1279
- ref,
1280
- className: cn(
1281
- "flex h-full w-full items-center justify-center rounded-full bg-muted",
1282
- className
1283
- ),
1284
- ...props
1285
- }
1286
- ));
1287
- AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
1288
- var badgeVariants = cva(
1289
- "inline-flex items-center hover:shadow-md rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1293
+ var VERT = `#version 300 es
1294
+ in vec2 position;
1295
+ void main() {
1296
+ gl_Position = vec4(position, 0.0, 1.0);
1297
+ }
1298
+ `;
1299
+ var FRAG = `#version 300 es
1300
+ precision highp float;
1301
+
1302
+ uniform float uTime;
1303
+ uniform float uAmplitude;
1304
+ uniform vec3 uColorStops[3];
1305
+ uniform vec2 uResolution;
1306
+ uniform float uBlend;
1307
+
1308
+ out vec4 fragColor;
1309
+
1310
+ vec3 permute(vec3 x) {
1311
+ return mod(((x * 34.0) + 1.0) * x, 289.0);
1312
+ }
1313
+
1314
+ float snoise(vec2 v){
1315
+ const vec4 C = vec4(
1316
+ 0.211324865405187, 0.366025403784439,
1317
+ -0.577350269189626, 0.024390243902439
1318
+ );
1319
+ vec2 i = floor(v + dot(v, C.yy));
1320
+ vec2 x0 = v - i + dot(i, C.xx);
1321
+ vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
1322
+ vec4 x12 = x0.xyxy + C.xxzz;
1323
+ x12.xy -= i1;
1324
+ i = mod(i, 289.0);
1325
+
1326
+ vec3 p = permute(
1327
+ permute(i.y + vec3(0.0, i1.y, 1.0))
1328
+ + i.x + vec3(0.0, i1.x, 1.0)
1329
+ );
1330
+
1331
+ vec3 m = max(
1332
+ 0.5 - vec3(
1333
+ dot(x0, x0),
1334
+ dot(x12.xy, x12.xy),
1335
+ dot(x12.zw, x12.zw)
1336
+ ),
1337
+ 0.0
1338
+ );
1339
+ m = m * m;
1340
+ m = m * m;
1341
+
1342
+ vec3 x = 2.0 * fract(p * C.www) - 1.0;
1343
+ vec3 h = abs(x) - 0.5;
1344
+ vec3 ox = floor(x + 0.5);
1345
+ vec3 a0 = x - ox;
1346
+ m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
1347
+
1348
+ vec3 g;
1349
+ g.x = a0.x * x0.x + h.x * x0.y;
1350
+ g.yz = a0.yz * x12.xz + h.yz * x12.yw;
1351
+ return 130.0 * dot(m, g);
1352
+ }
1353
+
1354
+ struct ColorStop {
1355
+ vec3 color;
1356
+ float position;
1357
+ };
1358
+
1359
+ #define COLOR_RAMP(colors, factor, finalColor) { int index = 0; for (int i = 0; i < 2; i++) { ColorStop currentColor = colors[i]; bool isInBetween = currentColor.position <= factor; index = int(mix(float(index), float(i), float(isInBetween))); } ColorStop currentColor = colors[index]; ColorStop nextColor = colors[index + 1]; float range = nextColor.position - currentColor.position; float lerpFactor = (factor - currentColor.position) / range; finalColor = mix(currentColor.color, nextColor.color, lerpFactor); }
1360
+
1361
+ void main() {
1362
+ vec2 uv = gl_FragCoord.xy / uResolution;
1363
+
1364
+ ColorStop colors[3];
1365
+ colors[0] = ColorStop(uColorStops[0], 0.0);
1366
+ colors[1] = ColorStop(uColorStops[1], 0.5);
1367
+ colors[2] = ColorStop(uColorStops[2], 1.0);
1368
+
1369
+ vec3 rampColor;
1370
+ COLOR_RAMP(colors, uv.x, rampColor);
1371
+
1372
+ float height = snoise(vec2(uv.x * 2.0 + uTime * 0.1, uTime * 0.25)) * 0.5 * uAmplitude;
1373
+ height = exp(height);
1374
+ height = (uv.y * 2.0 - height + 0.2);
1375
+ float intensity = 0.6 * height;
1376
+
1377
+ float midPoint = 0.20;
1378
+ float auroraAlpha = smoothstep(midPoint - uBlend * 0.5, midPoint + uBlend * 0.5, intensity);
1379
+ /* Steeper alpha at the toe: fewer pixels sit at \u201Cmedium \u03B1 + dark RGB\u201D, which composites
1380
+ to muddy gray on light backgrounds (premultiplied over white). */
1381
+ auroraAlpha = pow(clamp(auroraAlpha, 0.0, 1.0), 1.5);
1382
+ /* Lift low intensities slightly so color doesn\u2019t collapse toward black before the fade. */
1383
+ float tone = pow(clamp(intensity, 0.0, 1.25), 0.2);
1384
+ vec3 auroraColor = tone * rampColor;
1385
+
1386
+ fragColor = vec4(auroraColor * auroraAlpha, auroraAlpha);
1387
+ }
1388
+ `;
1389
+ var DEFAULT_STOPS = [
1390
+ "#5227FF",
1391
+ "#7cff67",
1392
+ "#5227FF"
1393
+ ];
1394
+ function stopsToRgbTriples(hexes) {
1395
+ const padded = [...hexes];
1396
+ while (padded.length < 3) {
1397
+ padded.push(padded[padded.length - 1] ?? DEFAULT_STOPS[0]);
1398
+ }
1399
+ const three = padded.slice(0, 3);
1400
+ return three.map((hex) => {
1401
+ const c = new Color(hex);
1402
+ return [c.r, c.g, c.b];
1403
+ });
1404
+ }
1405
+ function Aurora(props) {
1406
+ const { colorStops = DEFAULT_STOPS, amplitude = 1, blend = 0.5 } = props;
1407
+ const propsRef = useRef(props);
1408
+ propsRef.current = props;
1409
+ const ctnDom = useRef(null);
1410
+ useEffect(() => {
1411
+ const ctn = ctnDom.current;
1412
+ if (!ctn) return;
1413
+ let renderer;
1414
+ let resize;
1415
+ let animateId = 0;
1416
+ let canvas;
1417
+ const cleanup = () => {
1418
+ if (animateId) {
1419
+ cancelAnimationFrame(animateId);
1420
+ }
1421
+ if (resize) {
1422
+ window.removeEventListener("resize", resize);
1423
+ }
1424
+ if (canvas?.parentNode === ctn) {
1425
+ ctn.removeChild(canvas);
1426
+ }
1427
+ renderer?.gl.getExtension("WEBGL_lose_context")?.loseContext();
1428
+ };
1429
+ try {
1430
+ renderer = new Renderer({
1431
+ alpha: true,
1432
+ premultipliedAlpha: true,
1433
+ antialias: true
1434
+ });
1435
+ const gl = renderer.gl;
1436
+ canvas = gl.canvas;
1437
+ gl.clearColor(0, 0, 0, 0);
1438
+ gl.enable(gl.BLEND);
1439
+ gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
1440
+ gl.canvas.style.backgroundColor = "transparent";
1441
+ const geometry = new Triangle(gl);
1442
+ if (geometry.attributes.uv) {
1443
+ delete geometry.attributes.uv;
1444
+ }
1445
+ const initialStops = propsRef.current.colorStops ?? colorStops;
1446
+ const colorStopsArray = stopsToRgbTriples(
1447
+ Array.isArray(initialStops) ? [...initialStops] : [...DEFAULT_STOPS]
1448
+ );
1449
+ const program = new Program(gl, {
1450
+ vertex: VERT,
1451
+ fragment: FRAG,
1452
+ uniforms: {
1453
+ uTime: { value: 0 },
1454
+ uAmplitude: { value: amplitude },
1455
+ uColorStops: { value: colorStopsArray },
1456
+ uResolution: { value: [ctn.offsetWidth, ctn.offsetHeight] },
1457
+ uBlend: { value: blend }
1458
+ }
1459
+ });
1460
+ resize = () => {
1461
+ if (!renderer) return;
1462
+ const width = ctn.offsetWidth;
1463
+ const height = ctn.offsetHeight;
1464
+ renderer.setSize(width, height);
1465
+ program.uniforms.uResolution.value = [width, height];
1466
+ };
1467
+ window.addEventListener("resize", resize);
1468
+ const mesh = new Mesh(gl, { geometry, program });
1469
+ ctn.appendChild(gl.canvas);
1470
+ const update = (t) => {
1471
+ animateId = requestAnimationFrame(update);
1472
+ const p = propsRef.current;
1473
+ const { time = t * 0.01, speed = 1 } = p;
1474
+ program.uniforms.uTime.value = time * speed * 0.1;
1475
+ program.uniforms.uAmplitude.value = p.amplitude ?? 1;
1476
+ program.uniforms.uBlend.value = p.blend ?? 0.5;
1477
+ const stops = p.colorStops ?? DEFAULT_STOPS;
1478
+ program.uniforms.uColorStops.value = stopsToRgbTriples(
1479
+ Array.isArray(stops) ? [...stops] : [...DEFAULT_STOPS]
1480
+ );
1481
+ renderer?.render({ scene: mesh });
1482
+ };
1483
+ animateId = requestAnimationFrame(update);
1484
+ resize();
1485
+ } catch {
1486
+ cleanup();
1487
+ return;
1488
+ }
1489
+ return cleanup;
1490
+ }, []);
1491
+ return /* @__PURE__ */ jsx("div", { ref: ctnDom, className: "h-full w-full" });
1492
+ }
1493
+ var authBannerVariants = cva(
1494
+ "flex items-center gap-3 rounded-lg border px-4 py-3 text-sm",
1290
1495
  {
1291
1496
  variants: {
1292
1497
  variant: {
1293
- default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
1294
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1295
- destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
1296
- warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
1297
- outline: "text-foreground"
1498
+ success: "border-primary/25 bg-primary/15 text-foreground dark:bg-primary/10",
1499
+ destructive: "border-destructive/25 bg-destructive/10 text-destructive dark:bg-destructive/5"
1298
1500
  }
1299
1501
  },
1300
1502
  defaultVariants: {
1301
- variant: "default"
1503
+ variant: "success"
1302
1504
  }
1303
1505
  }
1304
1506
  );
1305
- var Badge = React11.forwardRef(
1306
- ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
1307
- "div",
1308
- {
1309
- ref,
1310
- className: cn(badgeVariants({ variant }), className),
1311
- ...props
1312
- }
1313
- )
1507
+ var AuthBanner = React11.forwardRef(
1508
+ ({ className, variant = "success", icon, children, ...props }, ref) => {
1509
+ const defaultIcon = variant === "destructive" ? /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }) : /* @__PURE__ */ jsx(
1510
+ CheckCircle2,
1511
+ {
1512
+ className: "shrink-0 text-primary",
1513
+ "aria-hidden": true,
1514
+ size: 18
1515
+ }
1516
+ );
1517
+ return /* @__PURE__ */ jsxs(
1518
+ "div",
1519
+ {
1520
+ ref,
1521
+ role: variant === "destructive" ? "alert" : "status",
1522
+ className: cn(authBannerVariants({ variant }), className),
1523
+ ...props,
1524
+ children: [
1525
+ icon ?? defaultIcon,
1526
+ /* @__PURE__ */ jsx(
1527
+ "div",
1528
+ {
1529
+ className: cn(
1530
+ "leading-relaxed",
1531
+ variant === "success" && "text-foreground opacity-80"
1532
+ ),
1533
+ children
1534
+ }
1535
+ )
1536
+ ]
1537
+ }
1538
+ );
1539
+ }
1314
1540
  );
1315
- Badge.displayName = "Badge";
1316
- var Breadcrumb = React11.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", { ref, "aria-label": "breadcrumb", ...props }));
1317
- Breadcrumb.displayName = "Breadcrumb";
1318
- var BreadcrumbList = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1319
- "ol",
1541
+ AuthBanner.displayName = "AuthBanner";
1542
+ var AuthBrand = React11.forwardRef(
1543
+ ({ className, logo, title, description, ...props }, ref) => {
1544
+ return /* @__PURE__ */ jsxs(
1545
+ "header",
1546
+ {
1547
+ ref,
1548
+ className: cn(
1549
+ "mb-8 flex flex-col items-center text-center sm:mb-10",
1550
+ className
1551
+ ),
1552
+ ...props,
1553
+ children: [
1554
+ /* @__PURE__ */ jsx("div", { className: "mb-5 flex h-16 w-16 items-center justify-center rounded-2xl shadow-lg shadow-primary/30 ring-4 ring-primary/10 transition-all duration-500 hover:-translate-y-0.5 hover:shadow-xl hover:shadow-primary/30", children: logo }),
1555
+ /* @__PURE__ */ jsx("h1", { className: "text-balance text-2xl font-bold tracking-tight text-foreground sm:text-[1.75rem]", children: title }),
1556
+ description ? /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-pretty text-sm font-normal leading-relaxed text-foreground opacity-80", children: description }) : null
1557
+ ]
1558
+ }
1559
+ );
1560
+ }
1561
+ );
1562
+ AuthBrand.displayName = "AuthBrand";
1563
+ var AuthCard = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1564
+ "div",
1320
1565
  {
1321
1566
  ref,
1322
1567
  className: cn(
1323
- "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
1568
+ "rounded-2xl bg-content-glass p-7 shadow-xl shadow-black/[0.06] backdrop-blur-md dark:shadow-black/25 sm:p-8",
1324
1569
  className
1325
1570
  ),
1326
1571
  ...props
1327
1572
  }
1328
1573
  ));
1329
- BreadcrumbList.displayName = "BreadcrumbList";
1330
- var BreadcrumbItem = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1331
- "li",
1574
+ AuthCard.displayName = "AuthCard";
1575
+ var AuthCardHeader = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-6", className), ...props }));
1576
+ AuthCardHeader.displayName = "AuthCardHeader";
1577
+ var AuthCardTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1578
+ "h2",
1332
1579
  {
1333
1580
  ref,
1334
- className: cn("inline-flex items-center gap-1.5", className),
1581
+ className: cn(
1582
+ "text-lg font-semibold tracking-tight text-foreground",
1583
+ className
1584
+ ),
1335
1585
  ...props
1336
1586
  }
1337
1587
  ));
1338
- BreadcrumbItem.displayName = "BreadcrumbItem";
1339
- var BreadcrumbLink = React11.forwardRef(({ asChild, className, ...props }, ref) => {
1340
- const Comp = asChild ? Slot : "a";
1341
- return /* @__PURE__ */ jsx(
1342
- Comp,
1343
- {
1344
- ref,
1345
- className: cn("transition-colors hover:text-foreground", className),
1346
- ...props
1347
- }
1348
- );
1349
- });
1350
- BreadcrumbLink.displayName = "BreadcrumbLink";
1351
- var BreadcrumbPage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1352
- "span",
1588
+ AuthCardTitle.displayName = "AuthCardTitle";
1589
+ var AuthCardDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1590
+ "p",
1353
1591
  {
1354
1592
  ref,
1355
- role: "link",
1356
- "aria-disabled": "true",
1357
- "aria-current": "page",
1358
- className: cn("font-normal text-foreground", className),
1593
+ className: cn("mt-0 text-sm text-muted-foreground", className),
1359
1594
  ...props
1360
1595
  }
1361
1596
  ));
1362
- BreadcrumbPage.displayName = "BreadcrumbPage";
1363
- var BreadcrumbSeparator = ({
1364
- children,
1365
- className,
1366
- ...props
1367
- }) => /* @__PURE__ */ jsx(
1368
- "li",
1597
+ AuthCardDescription.displayName = "AuthCardDescription";
1598
+ var AuthFieldError = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1599
+ "p",
1369
1600
  {
1370
- role: "presentation",
1371
- "aria-hidden": "true",
1372
- className: cn("[&>svg]:size-3.5", className),
1373
- ...props,
1374
- children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
1601
+ ref,
1602
+ className: cn("mt-2 text-xs text-destructive/80", className),
1603
+ ...props
1375
1604
  }
1376
- );
1605
+ ));
1606
+ AuthFieldError.displayName = "AuthFieldError";
1607
+ var AuthFooter = React11.forwardRef(
1608
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1609
+ "p",
1610
+ {
1611
+ ref,
1612
+ className: cn(
1613
+ "mx-auto mt-6 max-w-sm text-center text-sm text-muted-foreground",
1614
+ className
1615
+ ),
1616
+ ...props
1617
+ }
1618
+ )
1619
+ );
1620
+ AuthFooter.displayName = "AuthFooter";
1621
+ var AuthFooterLink = React11.forwardRef(
1622
+ ({ className, asChild = false, ...props }, ref) => {
1623
+ const Comp = asChild ? Slot : "a";
1624
+ return /* @__PURE__ */ jsx(
1625
+ Comp,
1626
+ {
1627
+ ref,
1628
+ className: cn("font-medium text-primary hover-underline", className),
1629
+ ...props
1630
+ }
1631
+ );
1632
+ }
1633
+ );
1634
+ AuthFooterLink.displayName = "AuthFooterLink";
1635
+ var AuthShell = React11.forwardRef(
1636
+ ({ className, background, backgroundClassName, children, ...props }, ref) => {
1637
+ return /* @__PURE__ */ jsxs(
1638
+ "div",
1639
+ {
1640
+ ref,
1641
+ className: cn(
1642
+ "relative flex min-h-screen flex-col items-center justify-center overflow-hidden px-4 py-10 sm:py-14",
1643
+ className
1644
+ ),
1645
+ ...props,
1646
+ children: [
1647
+ background ? /* @__PURE__ */ jsx(
1648
+ "div",
1649
+ {
1650
+ className: cn(
1651
+ "pointer-events-none absolute inset-0 z-0 min-h-full opacity-80 dark:opacity-40",
1652
+ backgroundClassName
1653
+ ),
1654
+ "aria-hidden": true,
1655
+ children: background
1656
+ }
1657
+ ) : null,
1658
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-[1]", "aria-hidden": true }),
1659
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 w-full max-w-[440px]", children })
1660
+ ]
1661
+ }
1662
+ );
1663
+ }
1664
+ );
1665
+ AuthShell.displayName = "AuthShell";
1666
+ var EmailInput = React11.forwardRef(
1667
+ ({
1668
+ className,
1669
+ variant = "outline",
1670
+ autoComplete = "email",
1671
+ placeholder = "Insira seu e-mail",
1672
+ ...props
1673
+ }, ref) => {
1674
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1675
+ /* @__PURE__ */ jsx(
1676
+ Mail,
1677
+ {
1678
+ className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70",
1679
+ "aria-hidden": true
1680
+ }
1681
+ ),
1682
+ /* @__PURE__ */ jsx(
1683
+ Input,
1684
+ {
1685
+ ref,
1686
+ type: "email",
1687
+ variant,
1688
+ autoComplete,
1689
+ placeholder,
1690
+ className: cn("h-11 pl-10 text-[15px]", className),
1691
+ ...props
1692
+ }
1693
+ )
1694
+ ] });
1695
+ }
1696
+ );
1697
+ EmailInput.displayName = "EmailInput";
1698
+ var toggleIconClass = "text-muted-foreground/70 hover:text-muted-foreground/90 hover:scale-[1.05] transition-all duration-300";
1699
+ var PasswordInput = React11.forwardRef(
1700
+ ({
1701
+ className,
1702
+ variant = "outline",
1703
+ autoComplete = "current-password",
1704
+ placeholder = "Insira sua senha",
1705
+ defaultVisible = false,
1706
+ ...props
1707
+ }, ref) => {
1708
+ const [visible, setVisible] = React11.useState(defaultVisible);
1709
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1710
+ /* @__PURE__ */ jsx(
1711
+ Lock,
1712
+ {
1713
+ className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70",
1714
+ "aria-hidden": true
1715
+ }
1716
+ ),
1717
+ /* @__PURE__ */ jsx(
1718
+ Input,
1719
+ {
1720
+ ref,
1721
+ type: visible ? "text" : "password",
1722
+ variant,
1723
+ autoComplete,
1724
+ placeholder,
1725
+ className: cn("h-11 px-10 text-[15px]", className),
1726
+ ...props
1727
+ }
1728
+ ),
1729
+ /* @__PURE__ */ jsx(
1730
+ "button",
1731
+ {
1732
+ type: "button",
1733
+ tabIndex: -1,
1734
+ className: "absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer",
1735
+ "aria-label": visible ? "Ocultar senha" : "Mostrar senha",
1736
+ onClick: () => setVisible((v) => !v),
1737
+ children: visible ? /* @__PURE__ */ jsx(EyeOff, { className: toggleIconClass, "aria-hidden": true, size: 18 }) : /* @__PURE__ */ jsx(Eye, { className: toggleIconClass, "aria-hidden": true, size: 18 })
1738
+ }
1739
+ )
1740
+ ] });
1741
+ }
1742
+ );
1743
+ PasswordInput.displayName = "PasswordInput";
1744
+ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1745
+ AvatarPrimitive.Root,
1746
+ {
1747
+ ref,
1748
+ className: cn(
1749
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
1750
+ className
1751
+ ),
1752
+ ...props
1753
+ }
1754
+ ));
1755
+ Avatar.displayName = AvatarPrimitive.Root.displayName;
1756
+ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1757
+ AvatarPrimitive.Image,
1758
+ {
1759
+ ref,
1760
+ className: cn("aspect-square h-full w-full", className),
1761
+ ...props
1762
+ }
1763
+ ));
1764
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName;
1765
+ var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1766
+ AvatarPrimitive.Fallback,
1767
+ {
1768
+ ref,
1769
+ className: cn(
1770
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
1771
+ className
1772
+ ),
1773
+ ...props
1774
+ }
1775
+ ));
1776
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
1777
+ var badgeVariants = cva(
1778
+ "inline-flex items-center hover:shadow-md rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1779
+ {
1780
+ variants: {
1781
+ variant: {
1782
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
1783
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
1784
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
1785
+ warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
1786
+ outline: "text-foreground"
1787
+ }
1788
+ },
1789
+ defaultVariants: {
1790
+ variant: "default"
1791
+ }
1792
+ }
1793
+ );
1794
+ var Badge = React11.forwardRef(
1795
+ ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
1796
+ "div",
1797
+ {
1798
+ ref,
1799
+ className: cn(badgeVariants({ variant }), className),
1800
+ ...props
1801
+ }
1802
+ )
1803
+ );
1804
+ Badge.displayName = "Badge";
1805
+ var Breadcrumb = React11.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", { ref, "aria-label": "breadcrumb", ...props }));
1806
+ Breadcrumb.displayName = "Breadcrumb";
1807
+ var BreadcrumbList = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1808
+ "ol",
1809
+ {
1810
+ ref,
1811
+ className: cn(
1812
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
1813
+ className
1814
+ ),
1815
+ ...props
1816
+ }
1817
+ ));
1818
+ BreadcrumbList.displayName = "BreadcrumbList";
1819
+ var BreadcrumbItem = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1820
+ "li",
1821
+ {
1822
+ ref,
1823
+ className: cn("inline-flex items-center gap-1.5", className),
1824
+ ...props
1825
+ }
1826
+ ));
1827
+ BreadcrumbItem.displayName = "BreadcrumbItem";
1828
+ var BreadcrumbLink = React11.forwardRef(({ asChild, className, ...props }, ref) => {
1829
+ const Comp = asChild ? Slot : "a";
1830
+ return /* @__PURE__ */ jsx(
1831
+ Comp,
1832
+ {
1833
+ ref,
1834
+ className: cn("transition-colors hover:text-foreground", className),
1835
+ ...props
1836
+ }
1837
+ );
1838
+ });
1839
+ BreadcrumbLink.displayName = "BreadcrumbLink";
1840
+ var BreadcrumbPage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1841
+ "span",
1842
+ {
1843
+ ref,
1844
+ role: "link",
1845
+ "aria-disabled": "true",
1846
+ "aria-current": "page",
1847
+ className: cn("font-normal text-foreground", className),
1848
+ ...props
1849
+ }
1850
+ ));
1851
+ BreadcrumbPage.displayName = "BreadcrumbPage";
1852
+ var BreadcrumbSeparator = ({
1853
+ children,
1854
+ className,
1855
+ ...props
1856
+ }) => /* @__PURE__ */ jsx(
1857
+ "li",
1858
+ {
1859
+ role: "presentation",
1860
+ "aria-hidden": "true",
1861
+ className: cn("[&>svg]:size-3.5", className),
1862
+ ...props,
1863
+ children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
1864
+ }
1865
+ );
1377
1866
  BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
1378
1867
  var BreadcrumbEllipsis = ({
1379
1868
  className,
@@ -1903,6 +2392,49 @@ function getPayloadConfigFromPayload(config, payload, key) {
1903
2392
  }
1904
2393
  return configLabelKey in config ? config[configLabelKey] : config[key];
1905
2394
  }
2395
+ function ChartCard({
2396
+ title,
2397
+ subtitle,
2398
+ children,
2399
+ action,
2400
+ titleInfo,
2401
+ titleClassName,
2402
+ glass = false,
2403
+ className
2404
+ }) {
2405
+ return /* @__PURE__ */ jsxs(
2406
+ "div",
2407
+ {
2408
+ className: cn(
2409
+ "rounded-lg p-4 shadow-md sm:p-5",
2410
+ className,
2411
+ glass ? "bg-content-glass" : "bg-card border border-border"
2412
+ ),
2413
+ children: [
2414
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
2415
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2416
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
2417
+ /* @__PURE__ */ jsx(
2418
+ "h3",
2419
+ {
2420
+ className: cn(
2421
+ "text-base font-semibold leading-snug text-foreground",
2422
+ titleClassName
2423
+ ),
2424
+ children: title
2425
+ }
2426
+ ),
2427
+ titleInfo ? /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 -translate-y-0.5 items-center justify-center", children: titleInfo }) : null
2428
+ ] }),
2429
+ subtitle ? /* @__PURE__ */ jsx("p", { className: "text-xs leading-snug text-muted-foreground", children: subtitle }) : null
2430
+ ] }),
2431
+ action ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center self-center", children: action }) : null
2432
+ ] }),
2433
+ children
2434
+ ]
2435
+ }
2436
+ );
2437
+ }
1906
2438
  var Checkbox = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1907
2439
  CheckboxPrimitive.Root,
1908
2440
  {
@@ -2261,71 +2793,92 @@ var Drawer = ({
2261
2793
  }
2262
2794
  );
2263
2795
  Drawer.displayName = "Drawer";
2264
- var DrawerTrigger = Drawer$1.Trigger;
2265
- var DrawerPortal = Drawer$1.Portal;
2266
- var DrawerClose = Drawer$1.Close;
2267
- var DrawerOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2268
- Drawer$1.Overlay,
2269
- {
2270
- ref,
2271
- className: cn("fixed inset-0 z-50 bg-black/80", className),
2272
- ...props
2273
- }
2274
- ));
2275
- DrawerOverlay.displayName = Drawer$1.Overlay.displayName;
2276
- var DrawerContent = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DrawerPortal, { children: [
2277
- /* @__PURE__ */ jsx(DrawerOverlay, {}),
2278
- /* @__PURE__ */ jsxs(
2279
- Drawer$1.Content,
2796
+ function DrawerTrigger({
2797
+ ...props
2798
+ }) {
2799
+ return /* @__PURE__ */ jsx(Drawer$1.Trigger, { ...props });
2800
+ }
2801
+ DrawerTrigger.displayName = "DrawerTrigger";
2802
+ function DrawerPortal({
2803
+ ...props
2804
+ }) {
2805
+ return /* @__PURE__ */ jsx(Drawer$1.Portal, { ...props });
2806
+ }
2807
+ DrawerPortal.displayName = "DrawerPortal";
2808
+ function DrawerClose({
2809
+ ...props
2810
+ }) {
2811
+ return /* @__PURE__ */ jsx(Drawer$1.Close, { ...props });
2812
+ }
2813
+ DrawerClose.displayName = "DrawerClose";
2814
+ var DrawerOverlay = React11.forwardRef(
2815
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2816
+ Drawer$1.Overlay,
2280
2817
  {
2281
2818
  ref,
2282
- className: cn(
2283
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
2284
- className
2285
- ),
2286
- ...props,
2287
- children: [
2288
- /* @__PURE__ */ jsx("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
2289
- children
2290
- ]
2819
+ className: cn("fixed inset-0 z-50 bg-black/80", className),
2820
+ ...props
2291
2821
  }
2292
2822
  )
2293
- ] }));
2294
- DrawerContent.displayName = "DrawerContent";
2295
- var DrawerHeader = ({
2296
- className,
2297
- ...props
2298
- }) => /* @__PURE__ */ jsx(
2299
- "div",
2300
- {
2301
- className: cn("grid gap-1.5 p-4 text-center sm:text-left", className),
2302
- ...props
2303
- }
2304
2823
  );
2305
- DrawerHeader.displayName = "DrawerHeader";
2306
- var DrawerFooter = ({
2824
+ DrawerOverlay.displayName = "DrawerOverlay";
2825
+ var DrawerContent = React11.forwardRef(
2826
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DrawerPortal, { children: [
2827
+ /* @__PURE__ */ jsx(DrawerOverlay, {}),
2828
+ /* @__PURE__ */ jsxs(
2829
+ Drawer$1.Content,
2830
+ {
2831
+ ref,
2832
+ className: cn(
2833
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
2834
+ className
2835
+ ),
2836
+ ...props,
2837
+ children: [
2838
+ /* @__PURE__ */ jsx("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
2839
+ children
2840
+ ]
2841
+ }
2842
+ )
2843
+ ] })
2844
+ );
2845
+ DrawerContent.displayName = "DrawerContent";
2846
+ var DrawerHeader = ({
2307
2847
  className,
2308
2848
  ...props
2309
2849
  }) => /* @__PURE__ */ jsx(
2310
2850
  "div",
2311
2851
  {
2312
- className: cn("mt-auto flex flex-col gap-2 p-4", className),
2852
+ className: cn("grid gap-1.5 p-4 text-center sm:text-left", className),
2313
2853
  ...props
2314
2854
  }
2315
2855
  );
2316
- DrawerFooter.displayName = "DrawerFooter";
2317
- var DrawerTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2318
- Drawer$1.Title,
2856
+ DrawerHeader.displayName = "DrawerHeader";
2857
+ var DrawerFooter = ({
2858
+ className,
2859
+ ...props
2860
+ }) => /* @__PURE__ */ jsx(
2861
+ "div",
2319
2862
  {
2320
- ref,
2321
- className: cn(
2322
- "text-lg font-semibold leading-none tracking-tight",
2323
- className
2324
- ),
2863
+ className: cn("mt-auto flex flex-col gap-2 p-4", className),
2325
2864
  ...props
2326
2865
  }
2327
- ));
2328
- DrawerTitle.displayName = Drawer$1.Title.displayName;
2866
+ );
2867
+ DrawerFooter.displayName = "DrawerFooter";
2868
+ var DrawerTitle = React11.forwardRef(
2869
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2870
+ Drawer$1.Title,
2871
+ {
2872
+ ref,
2873
+ className: cn(
2874
+ "text-lg font-semibold leading-none tracking-tight",
2875
+ className
2876
+ ),
2877
+ ...props
2878
+ }
2879
+ )
2880
+ );
2881
+ DrawerTitle.displayName = "DrawerTitle";
2329
2882
  var DrawerDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2330
2883
  Drawer$1.Description,
2331
2884
  {
@@ -2334,7 +2887,7 @@ var DrawerDescription = React11.forwardRef(({ className, ...props }, ref) => /*
2334
2887
  ...props
2335
2888
  }
2336
2889
  ));
2337
- DrawerDescription.displayName = Drawer$1.Description.displayName;
2890
+ DrawerDescription.displayName = "DrawerDescription";
2338
2891
  var Dropdown = React11.forwardRef(function Dropdown2({ open, isFiltered = false, className, ...props }, ref) {
2339
2892
  return /* @__PURE__ */ jsx(
2340
2893
  Button,
@@ -2641,6 +3194,313 @@ var InputOTPSlot = React11.forwardRef(({ index, className, ...props }, ref) => {
2641
3194
  InputOTPSlot.displayName = "InputOTPSlot";
2642
3195
  var InputOTPSeparator = React11.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "separator", ...props, children: /* @__PURE__ */ jsx(Dot, {}) }));
2643
3196
  InputOTPSeparator.displayName = "InputOTPSeparator";
3197
+
3198
+ // src/lib/pagination.ts
3199
+ function buildVisiblePages(current, totalPages) {
3200
+ if (totalPages <= 7) {
3201
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
3202
+ }
3203
+ const pages = [1];
3204
+ if (current > 3) {
3205
+ pages.push("ellipsis");
3206
+ }
3207
+ const start = Math.max(2, current - 1);
3208
+ const end = Math.min(totalPages - 1, current + 1);
3209
+ for (let i = start; i <= end; i++) {
3210
+ pages.push(i);
3211
+ }
3212
+ if (current < totalPages - 2) {
3213
+ pages.push("ellipsis");
3214
+ }
3215
+ pages.push(totalPages);
3216
+ return pages;
3217
+ }
3218
+ function buildRangeLabel(page, pageSize, total, itemLabel = "itens", formatTotal = (n) => n.toLocaleString("pt-BR")) {
3219
+ if (total === 0) return `0 ${itemLabel}`;
3220
+ const from = (page - 1) * pageSize + 1;
3221
+ const to = Math.min(page * pageSize, total);
3222
+ return `${from.toLocaleString("pt-BR")} \u2013 ${to.toLocaleString("pt-BR")} de ${formatTotal(total)} ${itemLabel}`;
3223
+ }
3224
+ var Pagination = ({ className, ...props }) => /* @__PURE__ */ jsx(
3225
+ "nav",
3226
+ {
3227
+ role: "navigation",
3228
+ "aria-label": "pagination",
3229
+ className: cn("mx-auto flex w-full justify-center", className),
3230
+ ...props
3231
+ }
3232
+ );
3233
+ Pagination.displayName = "Pagination";
3234
+ var PaginationContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3235
+ "ul",
3236
+ {
3237
+ ref,
3238
+ className: cn("flex flex-row items-center gap-1", className),
3239
+ ...props
3240
+ }
3241
+ ));
3242
+ PaginationContent.displayName = "PaginationContent";
3243
+ var PaginationItem = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, className: cn("", className), ...props }));
3244
+ PaginationItem.displayName = "PaginationItem";
3245
+ var PaginationLink = ({
3246
+ className,
3247
+ isActive,
3248
+ size = "icon",
3249
+ ...props
3250
+ }) => /* @__PURE__ */ jsx(
3251
+ "a",
3252
+ {
3253
+ "aria-current": isActive ? "page" : void 0,
3254
+ className: cn(
3255
+ buttonVariants({
3256
+ variant: isActive ? "outline" : "ghost",
3257
+ size
3258
+ }),
3259
+ className
3260
+ ),
3261
+ ...props
3262
+ }
3263
+ );
3264
+ PaginationLink.displayName = "PaginationLink";
3265
+ var PaginationPrevious = ({
3266
+ className,
3267
+ ...props
3268
+ }) => /* @__PURE__ */ jsxs(
3269
+ PaginationLink,
3270
+ {
3271
+ "aria-label": "Go to previous page",
3272
+ size: "default",
3273
+ className: cn("gap-1 pl-2.5", className),
3274
+ ...props,
3275
+ children: [
3276
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
3277
+ /* @__PURE__ */ jsx("span", { children: "Previous" })
3278
+ ]
3279
+ }
3280
+ );
3281
+ PaginationPrevious.displayName = "PaginationPrevious";
3282
+ var PaginationNext = ({
3283
+ className,
3284
+ ...props
3285
+ }) => /* @__PURE__ */ jsxs(
3286
+ PaginationLink,
3287
+ {
3288
+ "aria-label": "Go to next page",
3289
+ size: "default",
3290
+ className: cn("gap-1 pr-2.5", className),
3291
+ ...props,
3292
+ children: [
3293
+ /* @__PURE__ */ jsx("span", { children: "Next" }),
3294
+ /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
3295
+ ]
3296
+ }
3297
+ );
3298
+ PaginationNext.displayName = "PaginationNext";
3299
+ var PaginationEllipsis = ({
3300
+ className,
3301
+ ...props
3302
+ }) => /* @__PURE__ */ jsxs(
3303
+ "span",
3304
+ {
3305
+ "aria-hidden": true,
3306
+ className: cn("flex h-9 w-9 items-center justify-center", className),
3307
+ ...props,
3308
+ children: [
3309
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }),
3310
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "More pages" })
3311
+ ]
3312
+ }
3313
+ );
3314
+ PaginationEllipsis.displayName = "PaginationEllipsis";
3315
+ function MinimalPageNumbers({
3316
+ page,
3317
+ totalPages,
3318
+ disabled,
3319
+ onPageChange,
3320
+ pageAria
3321
+ }) {
3322
+ const visiblePages = buildVisiblePages(page, totalPages);
3323
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 tabular-nums", "aria-live": "polite", children: visiblePages.map(
3324
+ (item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx(
3325
+ "span",
3326
+ {
3327
+ className: "select-none text-sm text-muted-foreground",
3328
+ "aria-hidden": true,
3329
+ children: "\u2026"
3330
+ },
3331
+ `ellipsis-${index}`
3332
+ ) : /* @__PURE__ */ jsx(
3333
+ "button",
3334
+ {
3335
+ type: "button",
3336
+ disabled,
3337
+ "aria-label": pageAria(item),
3338
+ "aria-current": item === page ? "page" : void 0,
3339
+ onClick: () => {
3340
+ if (!disabled && item !== page) onPageChange(item);
3341
+ },
3342
+ className: cn(
3343
+ "min-w-[1.25rem] text-sm transition-colors",
3344
+ item === page ? "font-medium text-primary" : "text-muted-foreground hover:text-foreground",
3345
+ disabled && "pointer-events-none opacity-50"
3346
+ ),
3347
+ children: item
3348
+ },
3349
+ item
3350
+ )
3351
+ ) });
3352
+ }
3353
+ function ListingPagination({
3354
+ page,
3355
+ totalPages,
3356
+ total,
3357
+ pageSize,
3358
+ itemLabel,
3359
+ disabled = false,
3360
+ variant = "default",
3361
+ className,
3362
+ onPageChange,
3363
+ formatTotal,
3364
+ labels
3365
+ }) {
3366
+ if (totalPages <= 1) return null;
3367
+ const previous = labels?.previous ?? "Anterior";
3368
+ const next = labels?.next ?? "Pr\xF3xima";
3369
+ const previousAria = labels?.previousAria ?? "P\xE1gina anterior";
3370
+ const nextAria = labels?.nextAria ?? "Pr\xF3xima p\xE1gina";
3371
+ const pageAria = labels?.pageAria ?? ((p) => `P\xE1gina ${p}`);
3372
+ const rangeLabel = total != null && pageSize != null ? buildRangeLabel(page, pageSize, total, itemLabel, formatTotal) : `P\xE1gina ${page} de ${totalPages}`;
3373
+ if (variant === "minimal") {
3374
+ const canGoPrev = !disabled && page > 1;
3375
+ const canGoNext = !disabled && page < totalPages;
3376
+ return /* @__PURE__ */ jsxs(
3377
+ "div",
3378
+ {
3379
+ className: cn(
3380
+ "flex items-center justify-between gap-4 text-xs text-muted-foreground",
3381
+ className
3382
+ ),
3383
+ children: [
3384
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3385
+ /* @__PURE__ */ jsx(
3386
+ Button,
3387
+ {
3388
+ type: "button",
3389
+ variant: "ghost",
3390
+ size: "icon",
3391
+ className: "h-7 w-7 shrink-0 rounded-full text-foreground shadow-none hover:translate-y-0 hover:bg-muted hover:text-foreground hover:shadow-none disabled:opacity-40",
3392
+ "aria-label": previousAria,
3393
+ disabled: !canGoPrev,
3394
+ onClick: () => {
3395
+ if (canGoPrev) onPageChange(page - 1);
3396
+ },
3397
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
3398
+ }
3399
+ ),
3400
+ /* @__PURE__ */ jsx(
3401
+ MinimalPageNumbers,
3402
+ {
3403
+ page,
3404
+ totalPages,
3405
+ disabled,
3406
+ onPageChange,
3407
+ pageAria
3408
+ }
3409
+ ),
3410
+ /* @__PURE__ */ jsx(
3411
+ Button,
3412
+ {
3413
+ type: "button",
3414
+ variant: "ghost",
3415
+ size: "icon",
3416
+ className: "h-7 w-7 shrink-0 rounded-full text-foreground shadow-none hover:translate-y-0 hover:bg-muted hover:text-foreground hover:shadow-none disabled:opacity-40",
3417
+ "aria-label": nextAria,
3418
+ disabled: !canGoNext,
3419
+ onClick: () => {
3420
+ if (canGoNext) onPageChange(page + 1);
3421
+ },
3422
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
3423
+ }
3424
+ )
3425
+ ] }),
3426
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: rangeLabel })
3427
+ ]
3428
+ }
3429
+ );
3430
+ }
3431
+ const visiblePages = buildVisiblePages(page, totalPages);
3432
+ return /* @__PURE__ */ jsxs(
3433
+ "div",
3434
+ {
3435
+ className: cn(
3436
+ "flex flex-col gap-3 rounded-lg border border-border bg-card px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",
3437
+ className
3438
+ ),
3439
+ children: [
3440
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: rangeLabel }),
3441
+ /* @__PURE__ */ jsx(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
3442
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsxs(
3443
+ PaginationLink,
3444
+ {
3445
+ href: "#",
3446
+ size: "default",
3447
+ "aria-label": previousAria,
3448
+ className: cn(
3449
+ "gap-1 pl-2.5",
3450
+ (disabled || page <= 1) && "pointer-events-none opacity-50"
3451
+ ),
3452
+ onClick: (event) => {
3453
+ event.preventDefault();
3454
+ if (!disabled && page > 1) onPageChange(page - 1);
3455
+ },
3456
+ children: [
3457
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
3458
+ /* @__PURE__ */ jsx("span", { children: previous })
3459
+ ]
3460
+ }
3461
+ ) }),
3462
+ visiblePages.map(
3463
+ (item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
3464
+ PaginationLink,
3465
+ {
3466
+ href: "#",
3467
+ isActive: item === page,
3468
+ "aria-label": pageAria(item),
3469
+ "aria-current": item === page ? "page" : void 0,
3470
+ className: cn(disabled && "pointer-events-none opacity-50"),
3471
+ onClick: (event) => {
3472
+ event.preventDefault();
3473
+ if (!disabled && item !== page) onPageChange(item);
3474
+ },
3475
+ children: item
3476
+ }
3477
+ ) }, item)
3478
+ ),
3479
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsxs(
3480
+ PaginationLink,
3481
+ {
3482
+ href: "#",
3483
+ size: "default",
3484
+ "aria-label": nextAria,
3485
+ className: cn(
3486
+ "gap-1 pr-2.5",
3487
+ (disabled || page >= totalPages) && "pointer-events-none opacity-50"
3488
+ ),
3489
+ onClick: (event) => {
3490
+ event.preventDefault();
3491
+ if (!disabled && page < totalPages) onPageChange(page + 1);
3492
+ },
3493
+ children: [
3494
+ /* @__PURE__ */ jsx("span", { children: next }),
3495
+ /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
3496
+ ]
3497
+ }
3498
+ ) })
3499
+ ] }) })
3500
+ ]
3501
+ }
3502
+ );
3503
+ }
2644
3504
  var MenubarMenu = MenubarPrimitive.Menu;
2645
3505
  var MenubarGroup = MenubarPrimitive.Group;
2646
3506
  var MenubarPortal = MenubarPrimitive.Portal;
@@ -2890,97 +3750,84 @@ var NavigationMenuIndicator = React11.forwardRef(({ className, ...props }, ref)
2890
3750
  }
2891
3751
  ));
2892
3752
  NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
2893
- var Pagination = ({ className, ...props }) => /* @__PURE__ */ jsx(
2894
- "nav",
2895
- {
2896
- role: "navigation",
2897
- "aria-label": "pagination",
2898
- className: cn("mx-auto flex w-full justify-center", className),
2899
- ...props
2900
- }
2901
- );
2902
- Pagination.displayName = "Pagination";
2903
- var PaginationContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2904
- "ul",
2905
- {
2906
- ref,
2907
- className: cn("flex flex-row items-center gap-1", className),
2908
- ...props
2909
- }
2910
- ));
2911
- PaginationContent.displayName = "PaginationContent";
2912
- var PaginationItem = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, className: cn("", className), ...props }));
2913
- PaginationItem.displayName = "PaginationItem";
2914
- var PaginationLink = ({
2915
- className,
2916
- isActive,
2917
- size = "icon",
2918
- ...props
2919
- }) => /* @__PURE__ */ jsx(
2920
- "a",
2921
- {
2922
- "aria-current": isActive ? "page" : void 0,
2923
- className: cn(
2924
- buttonVariants({
2925
- variant: isActive ? "outline" : "ghost",
2926
- size
2927
- }),
2928
- className
2929
- ),
2930
- ...props
2931
- }
2932
- );
2933
- PaginationLink.displayName = "PaginationLink";
2934
- var PaginationPrevious = ({
2935
- className,
2936
- ...props
2937
- }) => /* @__PURE__ */ jsxs(
2938
- PaginationLink,
2939
- {
2940
- "aria-label": "Go to previous page",
2941
- size: "default",
2942
- className: cn("gap-1 pl-2.5", className),
2943
- ...props,
2944
- children: [
2945
- /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
2946
- /* @__PURE__ */ jsx("span", { children: "Previous" })
2947
- ]
2948
- }
2949
- );
2950
- PaginationPrevious.displayName = "PaginationPrevious";
2951
- var PaginationNext = ({
2952
- className,
2953
- ...props
2954
- }) => /* @__PURE__ */ jsxs(
2955
- PaginationLink,
2956
- {
2957
- "aria-label": "Go to next page",
2958
- size: "default",
2959
- className: cn("gap-1 pr-2.5", className),
2960
- ...props,
2961
- children: [
2962
- /* @__PURE__ */ jsx("span", { children: "Next" }),
2963
- /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
2964
- ]
2965
- }
2966
- );
2967
- PaginationNext.displayName = "PaginationNext";
2968
- var PaginationEllipsis = ({
3753
+ function PageHeader({
3754
+ label,
3755
+ title,
3756
+ description,
3757
+ titleLoading = false,
3758
+ badge,
3759
+ meta,
3760
+ back,
3761
+ children,
2969
3762
  className,
2970
- ...props
2971
- }) => /* @__PURE__ */ jsxs(
2972
- "span",
2973
- {
2974
- "aria-hidden": true,
2975
- className: cn("flex h-9 w-9 items-center justify-center", className),
2976
- ...props,
2977
- children: [
2978
- /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }),
2979
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "More pages" })
2980
- ]
2981
- }
2982
- );
2983
- PaginationEllipsis.displayName = "PaginationEllipsis";
3763
+ titleClassName,
3764
+ descriptionClassName,
3765
+ titleSkeletonClassName
3766
+ }) {
3767
+ const titleBlock = titleLoading ? /* @__PURE__ */ jsx(
3768
+ Skeleton,
3769
+ {
3770
+ className: cn(
3771
+ "h-7 w-48 max-w-full",
3772
+ label && "mt-1",
3773
+ titleSkeletonClassName
3774
+ ),
3775
+ "aria-label": "Loading"
3776
+ }
3777
+ ) : /* @__PURE__ */ jsxs(
3778
+ "div",
3779
+ {
3780
+ className: cn(
3781
+ "flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1",
3782
+ label && "mt-1"
3783
+ ),
3784
+ children: [
3785
+ /* @__PURE__ */ jsx(
3786
+ "h1",
3787
+ {
3788
+ className: cn(
3789
+ "text-xl font-bold tracking-tight",
3790
+ titleClassName
3791
+ ),
3792
+ children: title
3793
+ }
3794
+ ),
3795
+ badge
3796
+ ]
3797
+ }
3798
+ );
3799
+ const primary = /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3800
+ back,
3801
+ label ? /* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: label }) : null,
3802
+ meta ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-4", children: [
3803
+ titleBlock,
3804
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: meta })
3805
+ ] }) : titleBlock,
3806
+ description ? /* @__PURE__ */ jsx(
3807
+ "p",
3808
+ {
3809
+ className: cn(
3810
+ "mt-1 max-w-2xl text-sm text-muted-foreground",
3811
+ descriptionClassName
3812
+ ),
3813
+ children: description
3814
+ }
3815
+ ) : null
3816
+ ] });
3817
+ return /* @__PURE__ */ jsxs(
3818
+ "header",
3819
+ {
3820
+ className: cn(
3821
+ children ? "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between" : "w-full",
3822
+ className
3823
+ ),
3824
+ children: [
3825
+ primary,
3826
+ children ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children }) : null
3827
+ ]
3828
+ }
3829
+ );
3830
+ }
2984
3831
  var Popover = PopoverPrimitive.Root;
2985
3832
  var PopoverTrigger = PopoverPrimitive.Trigger;
2986
3833
  var PopoverContent = React11.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
@@ -3108,6 +3955,330 @@ var ScrollBar = React11.forwardRef(({ className, orientation = "vertical", ...pr
3108
3955
  }
3109
3956
  ));
3110
3957
  ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
3958
+ function mergeItems(prev, next) {
3959
+ if (next.length === 0) return prev;
3960
+ const seen = new Set(prev.map((item) => item.id));
3961
+ const out = [...prev];
3962
+ for (const item of next) {
3963
+ if (seen.has(item.id)) continue;
3964
+ seen.add(item.id);
3965
+ out.push(item);
3966
+ }
3967
+ return out;
3968
+ }
3969
+ function SearchableSelect({
3970
+ value,
3971
+ onChange,
3972
+ allValue = "all",
3973
+ allLabel,
3974
+ searchPlaceholder,
3975
+ loadItems,
3976
+ resolveLabel,
3977
+ pageSize = 50,
3978
+ triggerClassName,
3979
+ icon,
3980
+ nestedInPopover = false,
3981
+ disabled = false,
3982
+ resetKey,
3983
+ emptyLabel = "Nenhum resultado.",
3984
+ loadingLabel = "Buscando\u2026",
3985
+ loadingMoreLabel = "Carregando...",
3986
+ debounceMs = 300
3987
+ }) {
3988
+ const [open, setOpen] = React11.useState(false);
3989
+ const [search, setSearch] = React11.useState("");
3990
+ const [debouncedSearch, setDebouncedSearch] = React11.useState("");
3991
+ const [items, setItems] = React11.useState([]);
3992
+ const [loading, setLoading] = React11.useState(false);
3993
+ const [loadingMore, setLoadingMore] = React11.useState(false);
3994
+ const [hasMore, setHasMore] = React11.useState(false);
3995
+ const [labelById, setLabelById] = React11.useState({});
3996
+ const listRef = React11.useRef(null);
3997
+ const loadMoreSentinelRef = React11.useRef(null);
3998
+ const fetchOffsetRef = React11.useRef(0);
3999
+ const loadMoreLockRef = React11.useRef(false);
4000
+ const loadItemsRef = React11.useRef(loadItems);
4001
+ const resolveLabelRef = React11.useRef(resolveLabel);
4002
+ React11.useEffect(() => {
4003
+ loadItemsRef.current = loadItems;
4004
+ }, [loadItems]);
4005
+ React11.useEffect(() => {
4006
+ resolveLabelRef.current = resolveLabel;
4007
+ }, [resolveLabel]);
4008
+ React11.useEffect(() => {
4009
+ const t = window.setTimeout(() => setDebouncedSearch(search), debounceMs);
4010
+ return () => window.clearTimeout(t);
4011
+ }, [search, debounceMs]);
4012
+ const loadInitialItems = React11.useCallback(async (q) => {
4013
+ setLoading(true);
4014
+ setHasMore(false);
4015
+ fetchOffsetRef.current = 0;
4016
+ loadMoreLockRef.current = false;
4017
+ try {
4018
+ const { items: list, hasMore: more } = await loadItemsRef.current({
4019
+ query: q,
4020
+ limit: pageSize,
4021
+ offset: 0
4022
+ });
4023
+ fetchOffsetRef.current = list.length;
4024
+ setItems(list);
4025
+ setHasMore(more);
4026
+ } finally {
4027
+ setLoading(false);
4028
+ }
4029
+ }, [pageSize]);
4030
+ const loadMoreItems = React11.useCallback(async () => {
4031
+ if (loadMoreLockRef.current || loading || loadingMore || !hasMore) return;
4032
+ loadMoreLockRef.current = true;
4033
+ setLoadingMore(true);
4034
+ try {
4035
+ const { items: next, hasMore: more } = await loadItemsRef.current({
4036
+ query: debouncedSearch,
4037
+ limit: pageSize,
4038
+ offset: fetchOffsetRef.current
4039
+ });
4040
+ setItems((prev) => {
4041
+ const merged = mergeItems(prev, next);
4042
+ fetchOffsetRef.current = merged.length;
4043
+ if (merged.length === prev.length) {
4044
+ setHasMore(false);
4045
+ } else {
4046
+ setHasMore(more);
4047
+ }
4048
+ return merged;
4049
+ });
4050
+ } finally {
4051
+ setLoadingMore(false);
4052
+ loadMoreLockRef.current = false;
4053
+ }
4054
+ }, [debouncedSearch, hasMore, loading, loadingMore, pageSize]);
4055
+ React11.useEffect(() => {
4056
+ if (!open) return;
4057
+ void loadInitialItems(debouncedSearch);
4058
+ }, [open, debouncedSearch, loadInitialItems]);
4059
+ React11.useEffect(() => {
4060
+ if (!open || loading || loadingMore || !hasMore) return;
4061
+ const root = listRef.current;
4062
+ const sentinel = loadMoreSentinelRef.current;
4063
+ if (!root || !sentinel) return;
4064
+ const observer = new IntersectionObserver(
4065
+ (entries) => {
4066
+ if (entries.some((entry) => entry.isIntersecting)) {
4067
+ void loadMoreItems();
4068
+ }
4069
+ },
4070
+ { root, rootMargin: "64px" }
4071
+ );
4072
+ observer.observe(sentinel);
4073
+ return () => observer.disconnect();
4074
+ }, [open, loading, loadingMore, hasMore, loadMoreItems, items.length]);
4075
+ React11.useEffect(() => {
4076
+ if (!open || loading || loadingMore || !hasMore) return;
4077
+ const root = listRef.current;
4078
+ if (!root) return;
4079
+ const frame = requestAnimationFrame(() => {
4080
+ if (root.scrollHeight <= root.clientHeight + 8) {
4081
+ void loadMoreItems();
4082
+ }
4083
+ });
4084
+ return () => cancelAnimationFrame(frame);
4085
+ }, [open, loading, loadingMore, hasMore, loadMoreItems, items.length]);
4086
+ React11.useEffect(() => {
4087
+ setItems([]);
4088
+ setLabelById({});
4089
+ setSearch("");
4090
+ setDebouncedSearch("");
4091
+ }, [resetKey]);
4092
+ React11.useEffect(() => {
4093
+ if (value === allValue) return;
4094
+ let cancelled = false;
4095
+ void (async () => {
4096
+ const resolver = resolveLabelRef.current;
4097
+ if (resolver) {
4098
+ const label = await resolver(value);
4099
+ if (cancelled || !label) return;
4100
+ setLabelById(
4101
+ (prev) => prev[value] ? prev : { ...prev, [value]: label }
4102
+ );
4103
+ return;
4104
+ }
4105
+ const { items: list } = await loadItemsRef.current({
4106
+ query: value,
4107
+ limit: 30,
4108
+ offset: 0
4109
+ });
4110
+ if (cancelled) return;
4111
+ const hit = list.find((i) => i.id === value);
4112
+ if (hit?.label) {
4113
+ setLabelById(
4114
+ (prev) => prev[value] ? prev : { ...prev, [value]: hit.label }
4115
+ );
4116
+ }
4117
+ })();
4118
+ return () => {
4119
+ cancelled = true;
4120
+ };
4121
+ }, [value, allValue, resetKey]);
4122
+ const triggerLabel = React11.useMemo(() => {
4123
+ if (value === allValue) return allLabel;
4124
+ const fromCache = labelById[value];
4125
+ if (fromCache) return fromCache;
4126
+ const fromList = items.find((i) => i.id === value);
4127
+ if (fromList?.label) return fromList.label;
4128
+ return value;
4129
+ }, [value, allValue, allLabel, labelById, items]);
4130
+ const listRows = React11.useMemo(() => {
4131
+ if (value === allValue) return items;
4132
+ const has = items.some((i) => i.id === value);
4133
+ if (has) return items;
4134
+ const label = labelById[value] || value;
4135
+ return [{ id: value, label, secondary: value }, ...items];
4136
+ }, [items, value, allValue, labelById]);
4137
+ React11.useEffect(() => {
4138
+ if (disabled) setOpen(false);
4139
+ }, [disabled]);
4140
+ const isFiltered = value !== allValue && value.trim() !== "";
4141
+ return /* @__PURE__ */ jsxs(
4142
+ Popover,
4143
+ {
4144
+ modal: false,
4145
+ open: disabled ? false : open,
4146
+ onOpenChange: (v) => {
4147
+ if (disabled) return;
4148
+ setOpen(v);
4149
+ if (!v) setSearch("");
4150
+ },
4151
+ children: [
4152
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
4153
+ Dropdown,
4154
+ {
4155
+ open,
4156
+ isFiltered,
4157
+ disabled,
4158
+ className: cn(
4159
+ triggerClassName,
4160
+ disabled && "cursor-not-allowed opacity-50 hover:translate-y-0"
4161
+ ),
4162
+ children: [
4163
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2 text-[14px]", children: [
4164
+ icon ? /* @__PURE__ */ jsx(
4165
+ "span",
4166
+ {
4167
+ className: cn(
4168
+ "h-4 w-4 shrink-0",
4169
+ isFiltered ? "text-primary" : "text-muted-foreground"
4170
+ ),
4171
+ "aria-hidden": true,
4172
+ children: icon
4173
+ }
4174
+ ) : null,
4175
+ /* @__PURE__ */ jsx(
4176
+ "span",
4177
+ {
4178
+ className: cn("truncate", isFiltered && "text-foreground"),
4179
+ title: value !== allValue ? triggerLabel : void 0,
4180
+ children: triggerLabel
4181
+ }
4182
+ )
4183
+ ] }),
4184
+ /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-3.5 w-3.5 shrink-0 opacity-50" })
4185
+ ]
4186
+ }
4187
+ ) }),
4188
+ /* @__PURE__ */ jsx(
4189
+ PopoverContent,
4190
+ {
4191
+ className: cn(
4192
+ "w-[max(var(--radix-popover-trigger-width),280px)] max-w-[min(90vw,420px)] p-0",
4193
+ nestedInPopover && "z-[100]"
4194
+ ),
4195
+ align: "start",
4196
+ onOpenAutoFocus: nestedInPopover ? (e) => e.preventDefault() : void 0,
4197
+ children: /* @__PURE__ */ jsxs(Command, { shouldFilter: false, children: [
4198
+ /* @__PURE__ */ jsx(
4199
+ CommandInput,
4200
+ {
4201
+ placeholder: searchPlaceholder,
4202
+ value: search,
4203
+ onValueChange: setSearch,
4204
+ className: "h-9 text-xs"
4205
+ }
4206
+ ),
4207
+ /* @__PURE__ */ jsx(CommandList, { ref: listRef, children: loading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground", children: [
4208
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
4209
+ loadingLabel
4210
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4211
+ /* @__PURE__ */ jsx(CommandEmpty, { className: "text-sm", children: emptyLabel }),
4212
+ /* @__PURE__ */ jsxs(CommandGroup, { children: [
4213
+ /* @__PURE__ */ jsxs(
4214
+ CommandItem,
4215
+ {
4216
+ value: "__all__",
4217
+ className: "text-xs",
4218
+ onSelect: () => {
4219
+ onChange(allValue);
4220
+ setOpen(false);
4221
+ },
4222
+ children: [
4223
+ value === allValue ? /* @__PURE__ */ jsx(Check, { className: "mr-1 h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx("span", { className: "mr-1 h-3.5 w-3.5 shrink-0" }),
4224
+ allLabel
4225
+ ]
4226
+ }
4227
+ ),
4228
+ listRows.map((item) => /* @__PURE__ */ jsxs(
4229
+ CommandItem,
4230
+ {
4231
+ value: `${item.id} ${item.label}`,
4232
+ className: cn(
4233
+ "mt-0.5 items-start gap-1.5 text-xs",
4234
+ value === item.id && "bg-primary/45"
4235
+ ),
4236
+ onSelect: () => {
4237
+ onChange(item.id);
4238
+ setLabelById((prev) => ({
4239
+ ...prev,
4240
+ [item.id]: item.label || item.id
4241
+ }));
4242
+ setOpen(false);
4243
+ },
4244
+ children: [
4245
+ value === item.id ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 shrink-0" }),
4246
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-start gap-2", children: item.label ? /* @__PURE__ */ jsxs(Fragment, { children: [
4247
+ /* @__PURE__ */ jsx(
4248
+ "span",
4249
+ {
4250
+ className: "min-w-0 flex-1 break-words font-medium leading-snug",
4251
+ title: item.label,
4252
+ children: item.label
4253
+ }
4254
+ ),
4255
+ item.secondary ?? item.id ? /* @__PURE__ */ jsx("span", { className: "shrink-0 self-start text-right font-mono text-[11px] opacity-80", children: item.secondary ?? item.id }) : null
4256
+ ] }) : /* @__PURE__ */ jsx("span", { className: "font-mono", children: item.id }) })
4257
+ ]
4258
+ },
4259
+ item.id
4260
+ )),
4261
+ hasMore ? /* @__PURE__ */ jsx(
4262
+ "div",
4263
+ {
4264
+ ref: loadMoreSentinelRef,
4265
+ className: "h-px w-full shrink-0",
4266
+ "aria-hidden": true
4267
+ }
4268
+ ) : null,
4269
+ loadingMore ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-xs text-muted-foreground", children: [
4270
+ /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
4271
+ loadingMoreLabel
4272
+ ] }) : null
4273
+ ] })
4274
+ ] }) })
4275
+ ] })
4276
+ }
4277
+ )
4278
+ ]
4279
+ }
4280
+ );
4281
+ }
3111
4282
  var Select = SelectPrimitive.Root;
3112
4283
  var SelectGroup = SelectPrimitive.Group;
3113
4284
  var SelectValue = SelectPrimitive.Value;
@@ -3618,6 +4789,6 @@ var ToggleGroupItem = React11.forwardRef(({ className, children, variant, size,
3618
4789
  });
3619
4790
  ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
3620
4791
 
3621
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppChromeHeader, AppChromeSidebar, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label3 as Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup4 as RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster as SonnerToaster, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster2 as Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, inputVariants, navigationMenuTriggerStyle, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useToast };
4792
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppChromeBrand, AppChromeHeader, AppChromeSidebar, AspectRatio, Aurora, AuthBanner, AuthBrand, AuthCard, AuthCardDescription, AuthCardHeader, AuthCardTitle, AuthFieldError, AuthFooter, AuthFooterLink, AuthShell, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartCard, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmailInput, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label3 as Label, ListingPagination, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, PageHeader, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup4 as RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, SearchableSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster as SonnerToaster, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster2 as Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, authBannerVariants, badgeVariants, buildRangeLabel, buildVisiblePages, buttonVariants, cn, inputVariants, navigationMenuTriggerStyle, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useToast };
3622
4793
  //# sourceMappingURL=index.js.map
3623
4794
  //# sourceMappingURL=index.js.map