@popgrids/ui 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var button = require('@base-ui/react/button');
4
3
  var classVarianceAuthority = require('class-variance-authority');
5
4
  var clsx = require('clsx');
6
5
  var tailwindMerge = require('tailwind-merge');
7
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var button = require('@base-ui/react/button');
8
8
  var dialog = require('@base-ui/react/dialog');
9
9
  var icons = require('@untitledui/icons');
10
10
  var menu = require('@base-ui/react/menu');
@@ -14,10 +14,49 @@ var useRender = require('@base-ui/react/use-render');
14
14
  var react = require('react');
15
15
  var tooltip = require('@base-ui/react/tooltip');
16
16
 
17
- // src/components/button/button.tsx
17
+ // src/components/banner-notification/banner-notification.tsx
18
18
  function cn(...inputs) {
19
19
  return tailwindMerge.twMerge(clsx.clsx(inputs));
20
20
  }
21
+ var bannerNotificationVariants = classVarianceAuthority.cva(
22
+ "flex items-start gap-3 rounded-[6px] px-4 py-3 w-full w-[360px] border-border border",
23
+ {
24
+ variants: {
25
+ variant: {
26
+ info: ""
27
+ },
28
+ theme: {
29
+ error: "bg-warning-100 dark:bg-warning-200/16",
30
+ highlight: "bg-success-50 dark:bg-white/0"
31
+ }
32
+ },
33
+ defaultVariants: {
34
+ variant: "info",
35
+ theme: "highlight"
36
+ }
37
+ }
38
+ );
39
+ function BannerNotification({
40
+ className,
41
+ children,
42
+ variant = "info",
43
+ theme = "highlight",
44
+ image,
45
+ ...props
46
+ }) {
47
+ return /* @__PURE__ */ jsxRuntime.jsxs(
48
+ "div",
49
+ {
50
+ "data-slot": "banner-notification",
51
+ className: cn(bannerNotificationVariants({ variant, theme }), className),
52
+ ...props,
53
+ children: [
54
+ image && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-start [&>svg]:size-5", children: image }),
55
+ children != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1 text-sm", children })
56
+ ]
57
+ }
58
+ );
59
+ }
21
60
  var loaderVariants = classVarianceAuthority.cva("flex shrink-0 items-center justify-center", {
22
61
  variants: {
23
62
  theme: {
@@ -248,7 +287,7 @@ var buttonVariants = classVarianceAuthority.cva(
248
287
  variant: "primary",
249
288
  outline: true,
250
289
  theme: "base",
251
- class: "ring ring-foreground bg-background/0 text-foreground hover:ring-2 active:ring active:bg-background/1 disabled:outline-none disabled:bg-background/0 focus-visible:ring focus-visible:ring-ring focus-visible:outline-background focus-visible:bg-background/1"
290
+ class: "ring ring-foreground bg-background/0 text-foreground hover:ring-2 active:ring active:bg-background/1 disabled:outline-none disabled:bg-background/0 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-background focus-visible:bg-background/1"
252
291
  },
253
292
  {
254
293
  variant: "primary",
@@ -434,28 +473,45 @@ function ButtonLink({
434
473
  size = "md",
435
474
  theme = "default",
436
475
  trailing,
476
+ href,
437
477
  ...props
438
478
  }) {
439
- return /* @__PURE__ */ jsxRuntime.jsxs(
440
- "a",
479
+ const sharedClassName = cn(
480
+ buttonLinkVariants({
481
+ hasLeading: !!leading,
482
+ hasTrailing: !!trailing,
483
+ primary,
484
+ size,
485
+ theme
486
+ }),
487
+ className
488
+ );
489
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
490
+ leading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: leading }),
491
+ children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate relative", children }),
492
+ trailing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: trailing })
493
+ ] });
494
+ if (href != null) {
495
+ return /* @__PURE__ */ jsxRuntime.jsx(
496
+ "a",
497
+ {
498
+ "data-slot": "button-link",
499
+ className: sharedClassName,
500
+ href,
501
+ ...props,
502
+ children: content
503
+ }
504
+ );
505
+ }
506
+ const { type, ...buttonProps } = props;
507
+ return /* @__PURE__ */ jsxRuntime.jsx(
508
+ "button",
441
509
  {
442
510
  "data-slot": "button-link",
443
- className: cn(
444
- buttonLinkVariants({
445
- hasLeading: !!leading,
446
- hasTrailing: !!trailing,
447
- primary,
448
- size,
449
- theme
450
- }),
451
- className
452
- ),
453
- ...props,
454
- children: [
455
- leading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: leading }),
456
- children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate relative", children }),
457
- trailing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: trailing })
458
- ]
511
+ className: sharedClassName,
512
+ type: type ?? "button",
513
+ ...buttonProps,
514
+ children: content
459
515
  }
460
516
  );
461
517
  }
@@ -472,24 +528,25 @@ function ContentBlock({ className, children, title, subhead, cta }) {
472
528
  ] });
473
529
  }
474
530
  function DialogRoot(props) {
475
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Root, { ...props });
531
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Root, { "data-slot": "dialog", ...props });
476
532
  }
477
533
  function DialogPortal(props) {
478
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Portal, { ...props });
534
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
479
535
  }
480
536
  function DialogTrigger(props) {
481
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { ...props });
537
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
482
538
  }
483
539
  function DialogClose(props) {
484
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Close, { ...props });
540
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
485
541
  }
486
- function DialogBackdrop({
542
+ function DialogOverlay({
487
543
  className,
488
544
  ...props
489
545
  }) {
490
546
  return /* @__PURE__ */ jsxRuntime.jsx(
491
547
  dialog.Dialog.Backdrop,
492
548
  {
549
+ "data-slot": "dialog-overlay",
493
550
  className: cn(
494
551
  "fixed inset-0 min-h-dvh bg-[rgb(0_0_32/0.01)] opacity-0 backdrop-blur-sm transition-[opacity,backdrop-filter] duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-[-webkit-touch-callout:none]:absolute dark:bg-[rgb(255_255_255/0.01)] dark:opacity-70",
495
552
  "data-closed:opacity-0 data-open:opacity-100",
@@ -506,6 +563,7 @@ function DialogViewport({
506
563
  return /* @__PURE__ */ jsxRuntime.jsx(
507
564
  dialog.Dialog.Viewport,
508
565
  {
566
+ "data-slot": "dialog-viewport",
509
567
  className: cn(
510
568
  "fixed inset-0 flex items-center justify-center overflow-hidden py-6 [@media(min-height:600px)]:pt-8 [@media(min-height:600px)]:pb-12",
511
569
  className
@@ -514,55 +572,87 @@ function DialogViewport({
514
572
  }
515
573
  );
516
574
  }
517
- function DialogPopup({
575
+ function DialogContent({
518
576
  className,
519
577
  children,
520
578
  bottom = false,
521
579
  showCloseButton = true,
580
+ closePosition = "top-left",
522
581
  ...props
523
582
  }) {
524
- return /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { children: [
525
- /* @__PURE__ */ jsxRuntime.jsx(DialogBackdrop, {}),
526
- /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Popup, { className: "group/popup pointer-events-none flex h-full max-h-full min-h-0 w-full max-w-full justify-center overflow-hidden transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0", children: [
527
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
528
- DialogClose,
529
- {
530
- className: "pointer-events-auto fixed top-[15px] left-5 z-50",
531
- "aria-label": "Close",
532
- children: [
533
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" }),
534
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "before:bg-tint-700-reversed relative block before:absolute before:-inset-1.5 before:rounded-full before:backdrop-blur-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary-foreground text-background relative z-10 flex size-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(icons.XClose, { className: "size-[18px]" }) }) })
535
- ]
536
- }
537
- ),
538
- /* @__PURE__ */ jsxRuntime.jsx(
539
- "div",
540
- {
541
- className: cn(
542
- "bg-background pointer-events-auto fixed top-1/2 left-1/2 flex h-full max-h-[calc(100%-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl shadow-2xl transition-all",
583
+ return /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { "data-slot": "dialog-portal", children: [
584
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
585
+ /* @__PURE__ */ jsxRuntime.jsxs(
586
+ dialog.Dialog.Popup,
587
+ {
588
+ "data-slot": "dialog-content",
589
+ className: "group/popup pointer-events-none flex h-full max-h-full min-h-0 w-full max-w-full justify-center overflow-hidden transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0",
590
+ children: [
591
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
592
+ DialogClose,
543
593
  {
544
- "group-data-closed/popup:duration-pop-hover group-data-open/popup:duration-pop-hover group-data-open/popup:ease-pop-hover group-data-closed/popup:ease-out group-data-ending-style/popup:scale-[0.96] group-data-ending-style/popup:opacity-0 group-data-starting-style/popup:scale-[0.96] group-data-starting-style/popup:opacity-0": !bottom,
545
- "group-data-open/popup:slide-in-from-bottom group-data-closed/popup:slide-out-to-bottom group-data-starting-style/popup-scale-100 group-data-ending-style/popup-scale-100 group-data-open/popup:animate-in group-data-closed/popup:animate-out top-auto bottom-0 h-full translate-y-0 rounded-b-none group-data-closed/popup:duration-200 group-data-closed/popup:ease-[cubic-bezier(1,0,0.72,0.32)] group-data-ending-style/popup:translate-y-full group-data-open/popup:duration-300 group-data-open/popup:ease-[cubic-bezier(0.32,0.72,0,1)] group-data-starting-style/popup:translate-y-full": bottom
546
- },
547
- className
594
+ className: cn("pointer-events-auto fixed top-[15px] z-50 transition-all", { "left-5": closePosition === "top-left", "right-5": closePosition === "top-right", "group-data-closed/popup:duration-pop-hover group-data-open/popup:duration-pop-hover group-data-open/popup:ease-pop-hover group-data-closed/popup:ease-out group-data-ending-style/popup:scale-[0.96] group-data-ending-style/popup:opacity-0 group-data-starting-style/popup:scale-[0.96] group-data-starting-style/popup:opacity-0": !bottom, " group-data-starting-style/popup-scale-[0.96] group-data-ending-style/popup-scale-100 group-data-open/popup:animate-in group-data-closed/popup:animate-out group-data-closed/popup:duration-200 group-data-closed/popup:ease-[cubic-bezier(1,0,0.72,0.32)] group-data-ending-style/popup:translate-y-1/2 group-data-open/popup:duration-pop-hover group-data-open/popup:ease-[cubic-bezier(0.32,0.72,0,1)] group-data-starting-style/popup:translate-y-1/2": bottom }),
595
+ "aria-label": "Close",
596
+ children: [
597
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" }),
598
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "before:bg-tint-700-reversed relative block before:absolute before:-inset-1.5 before:rounded-full before:backdrop-blur-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary-foreground text-background relative z-10 flex size-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(icons.XClose, { className: "size-[18px]" }) }) })
599
+ ]
600
+ }
548
601
  ),
549
- ...props,
550
- children
551
- }
552
- )
553
- ] })
602
+ /* @__PURE__ */ jsxRuntime.jsx(
603
+ "div",
604
+ {
605
+ className: cn(
606
+ "bg-background pointer-events-auto fixed top-1/2 left-1/2 flex h-full max-h-[calc(100%-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl shadow-2xl transition-all",
607
+ {
608
+ "group-data-closed/popup:duration-pop-hover group-data-open/popup:duration-pop-hover group-data-open/popup:ease-pop-hover group-data-closed/popup:ease-out group-data-ending-style/popup:scale-[0.96] group-data-ending-style/popup:opacity-0 group-data-starting-style/popup:scale-[0.96] group-data-starting-style/popup:opacity-0": !bottom,
609
+ "group-data-open/popup:slide-in-from-bottom group-data-closed/popup:slide-out-to-bottom group-data-starting-style/popup-scale-100 group-data-ending-style/popup-scale-100 group-data-open/popup:animate-in group-data-closed/popup:animate-out top-auto bottom-0 h-full translate-y-0 rounded-b-none group-data-closed/popup:duration-200 group-data-closed/popup:ease-[cubic-bezier(1,0,0.72,0.32)] group-data-ending-style/popup:translate-y-full group-data-open/popup:duration-300 group-data-open/popup:ease-[cubic-bezier(0.32,0.72,0,1)] group-data-starting-style/popup:translate-y-full": bottom
610
+ },
611
+ className
612
+ ),
613
+ ...props,
614
+ children
615
+ }
616
+ )
617
+ ]
618
+ }
619
+ )
554
620
  ] });
555
621
  }
556
622
  function DialogHeader({ className, ...props }) {
557
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props });
623
+ return /* @__PURE__ */ jsxRuntime.jsx(
624
+ "div",
625
+ {
626
+ "data-slot": "dialog-header",
627
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
628
+ ...props
629
+ }
630
+ );
558
631
  }
559
- function DialogFooter({ className, ...props }) {
560
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col-reverse gap-2 sm:flex-row", className), ...props });
632
+ function DialogFooter({
633
+ className,
634
+ showCloseButton = false,
635
+ children,
636
+ ...props
637
+ }) {
638
+ return /* @__PURE__ */ jsxRuntime.jsxs(
639
+ "div",
640
+ {
641
+ "data-slot": "dialog-footer",
642
+ className: cn("flex flex-col-reverse gap-2 sm:flex-row", className),
643
+ ...props,
644
+ children: [
645
+ children,
646
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(DialogClose, { render: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "tertiary", theme: "base" }), children: "Close" })
647
+ ]
648
+ }
649
+ );
561
650
  }
562
651
  function DialogTitle({ className, ...props }) {
563
652
  return /* @__PURE__ */ jsxRuntime.jsx(
564
653
  dialog.Dialog.Title,
565
654
  {
655
+ "data-slot": "dialog-title",
566
656
  className: cn("text-lg leading-none font-semibold", className),
567
657
  ...props
568
658
  }
@@ -575,6 +665,7 @@ function DialogDescription({
575
665
  return /* @__PURE__ */ jsxRuntime.jsx(
576
666
  dialog.Dialog.Description,
577
667
  {
668
+ "data-slot": "dialog-description",
578
669
  className: cn("text-muted-foreground text-sm", className),
579
670
  ...props
580
671
  }
@@ -584,6 +675,7 @@ function DialogBody({ className, children, ...props }) {
584
675
  return /* @__PURE__ */ jsxRuntime.jsx(
585
676
  "div",
586
677
  {
678
+ "data-slot": "dialog-body",
587
679
  className: cn("flex shrink-0 grow basis-0 flex-col items-start self-stretch", className),
588
680
  ...props,
589
681
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 grow basis-0 flex-col items-start gap-10 self-stretch overflow-auto p-4", children })
@@ -980,7 +1072,7 @@ function Input({ className, type, ...props }) {
980
1072
  "data-slot": "input",
981
1073
  className: cn(
982
1074
  "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
983
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
1075
+ "focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-[3px]",
984
1076
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
985
1077
  className
986
1078
  ),
@@ -1188,7 +1280,7 @@ function SectionHeader({
1188
1280
  }
1189
1281
  var tagVariants = classVarianceAuthority.cva(
1190
1282
  // Base styles
1191
- "inline-flex items-center justify-center rounded-full box-border relative transition-all duration-150 ease-in-out font-medium text-sm leading-5 text-center whitespace-nowrap appearance-none focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[rgba(21,94,239,0.6)] focus-visible:ring-offset-0",
1283
+ "inline-flex items-center justify-center rounded-full box-border relative font-medium text-sm leading-5 text-center whitespace-nowrap appearance-none focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/60 focus-visible:ring-offset-0",
1192
1284
  {
1193
1285
  variants: {
1194
1286
  selected: {
@@ -1269,6 +1361,8 @@ function Tag({
1269
1361
  children,
1270
1362
  leading,
1271
1363
  trailing,
1364
+ interactive,
1365
+ type,
1272
1366
  onClick,
1273
1367
  className = ""
1274
1368
  }) {
@@ -1285,7 +1379,8 @@ function Tag({
1285
1379
  };
1286
1380
  const showLeading = leading && !collapsed;
1287
1381
  const showTrailing = trailing && !collapsed;
1288
- const TagElement = onClick ? "button" : "div";
1382
+ const isInteractive = interactive ?? typeof onClick === "function";
1383
+ const TagElement = isInteractive ? "button" : "div";
1289
1384
  return /* @__PURE__ */ jsxRuntime.jsxs(
1290
1385
  TagElement,
1291
1386
  {
@@ -1294,13 +1389,13 @@ function Tag({
1294
1389
  size,
1295
1390
  selected,
1296
1391
  collapsed,
1297
- interactive: !!onClick
1392
+ interactive: isInteractive
1298
1393
  }),
1299
1394
  className
1300
1395
  ),
1301
1396
  onClick: handleClick,
1302
1397
  onKeyDown: handleKeyDown,
1303
- type: onClick ? "button" : void 0,
1398
+ type: isInteractive ? type ?? "button" : void 0,
1304
1399
  children: [
1305
1400
  !collapsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1306
1401
  showLeading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden text-inherit", children: leading }),
@@ -1313,17 +1408,18 @@ function Tag({
1313
1408
  );
1314
1409
  }
1315
1410
 
1411
+ exports.BannerNotification = BannerNotification;
1316
1412
  exports.Button = Button;
1317
1413
  exports.ButtonLink = ButtonLink;
1318
1414
  exports.ContentBlock = ContentBlock;
1319
1415
  exports.Dialog = DialogRoot;
1320
- exports.DialogBackdrop = DialogBackdrop;
1321
1416
  exports.DialogBody = DialogBody;
1322
1417
  exports.DialogClose = DialogClose;
1418
+ exports.DialogContent = DialogContent;
1323
1419
  exports.DialogDescription = DialogDescription;
1324
1420
  exports.DialogFooter = DialogFooter;
1325
1421
  exports.DialogHeader = DialogHeader;
1326
- exports.DialogPopup = DialogPopup;
1422
+ exports.DialogOverlay = DialogOverlay;
1327
1423
  exports.DialogPortal = DialogPortal;
1328
1424
  exports.DialogTitle = DialogTitle;
1329
1425
  exports.DialogTrigger = DialogTrigger;