@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.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Button as Button$1 } from '@base-ui/react/button';
2
1
  import { cva } from 'class-variance-authority';
3
2
  import { clsx } from 'clsx';
4
3
  import { twMerge } from 'tailwind-merge';
5
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
+ import { Button as Button$1 } from '@base-ui/react/button';
6
6
  import { Dialog } from '@base-ui/react/dialog';
7
7
  import { XClose, CheckCircle, Circle, ChevronRight, Check, InfoCircle } from '@untitledui/icons';
8
8
  import { Menu } from '@base-ui/react/menu';
@@ -12,10 +12,49 @@ import { useRender } from '@base-ui/react/use-render';
12
12
  import { useState, useCallback, useEffect } from 'react';
13
13
  import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
14
14
 
15
- // src/components/button/button.tsx
15
+ // src/components/banner-notification/banner-notification.tsx
16
16
  function cn(...inputs) {
17
17
  return twMerge(clsx(inputs));
18
18
  }
19
+ var bannerNotificationVariants = cva(
20
+ "flex items-start gap-3 rounded-[6px] px-4 py-3 w-full w-[360px] border-border border",
21
+ {
22
+ variants: {
23
+ variant: {
24
+ info: ""
25
+ },
26
+ theme: {
27
+ error: "bg-warning-100 dark:bg-warning-200/16",
28
+ highlight: "bg-success-50 dark:bg-white/0"
29
+ }
30
+ },
31
+ defaultVariants: {
32
+ variant: "info",
33
+ theme: "highlight"
34
+ }
35
+ }
36
+ );
37
+ function BannerNotification({
38
+ className,
39
+ children,
40
+ variant = "info",
41
+ theme = "highlight",
42
+ image,
43
+ ...props
44
+ }) {
45
+ return /* @__PURE__ */ jsxs(
46
+ "div",
47
+ {
48
+ "data-slot": "banner-notification",
49
+ className: cn(bannerNotificationVariants({ variant, theme }), className),
50
+ ...props,
51
+ children: [
52
+ image && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-start [&>svg]:size-5", children: image }),
53
+ children != null && /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 text-sm", children })
54
+ ]
55
+ }
56
+ );
57
+ }
19
58
  var loaderVariants = cva("flex shrink-0 items-center justify-center", {
20
59
  variants: {
21
60
  theme: {
@@ -246,7 +285,7 @@ var buttonVariants = cva(
246
285
  variant: "primary",
247
286
  outline: true,
248
287
  theme: "base",
249
- 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"
288
+ 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"
250
289
  },
251
290
  {
252
291
  variant: "primary",
@@ -432,28 +471,45 @@ function ButtonLink({
432
471
  size = "md",
433
472
  theme = "default",
434
473
  trailing,
474
+ href,
435
475
  ...props
436
476
  }) {
437
- return /* @__PURE__ */ jsxs(
438
- "a",
477
+ const sharedClassName = cn(
478
+ buttonLinkVariants({
479
+ hasLeading: !!leading,
480
+ hasTrailing: !!trailing,
481
+ primary,
482
+ size,
483
+ theme
484
+ }),
485
+ className
486
+ );
487
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
488
+ leading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: leading }),
489
+ children != null && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate relative", children }),
490
+ trailing && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: trailing })
491
+ ] });
492
+ if (href != null) {
493
+ return /* @__PURE__ */ jsx(
494
+ "a",
495
+ {
496
+ "data-slot": "button-link",
497
+ className: sharedClassName,
498
+ href,
499
+ ...props,
500
+ children: content
501
+ }
502
+ );
503
+ }
504
+ const { type, ...buttonProps } = props;
505
+ return /* @__PURE__ */ jsx(
506
+ "button",
439
507
  {
440
508
  "data-slot": "button-link",
441
- className: cn(
442
- buttonLinkVariants({
443
- hasLeading: !!leading,
444
- hasTrailing: !!trailing,
445
- primary,
446
- size,
447
- theme
448
- }),
449
- className
450
- ),
451
- ...props,
452
- children: [
453
- leading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: leading }),
454
- children != null && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate relative", children }),
455
- trailing && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center text-inherit [&_svg]:size-inherit", children: trailing })
456
- ]
509
+ className: sharedClassName,
510
+ type: type ?? "button",
511
+ ...buttonProps,
512
+ children: content
457
513
  }
458
514
  );
459
515
  }
@@ -470,24 +526,25 @@ function ContentBlock({ className, children, title, subhead, cta }) {
470
526
  ] });
471
527
  }
472
528
  function DialogRoot(props) {
473
- return /* @__PURE__ */ jsx(Dialog.Root, { ...props });
529
+ return /* @__PURE__ */ jsx(Dialog.Root, { "data-slot": "dialog", ...props });
474
530
  }
475
531
  function DialogPortal(props) {
476
- return /* @__PURE__ */ jsx(Dialog.Portal, { ...props });
532
+ return /* @__PURE__ */ jsx(Dialog.Portal, { "data-slot": "dialog-portal", ...props });
477
533
  }
478
534
  function DialogTrigger(props) {
479
- return /* @__PURE__ */ jsx(Dialog.Trigger, { ...props });
535
+ return /* @__PURE__ */ jsx(Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
480
536
  }
481
537
  function DialogClose(props) {
482
- return /* @__PURE__ */ jsx(Dialog.Close, { ...props });
538
+ return /* @__PURE__ */ jsx(Dialog.Close, { "data-slot": "dialog-close", ...props });
483
539
  }
484
- function DialogBackdrop({
540
+ function DialogOverlay({
485
541
  className,
486
542
  ...props
487
543
  }) {
488
544
  return /* @__PURE__ */ jsx(
489
545
  Dialog.Backdrop,
490
546
  {
547
+ "data-slot": "dialog-overlay",
491
548
  className: cn(
492
549
  "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",
493
550
  "data-closed:opacity-0 data-open:opacity-100",
@@ -504,6 +561,7 @@ function DialogViewport({
504
561
  return /* @__PURE__ */ jsx(
505
562
  Dialog.Viewport,
506
563
  {
564
+ "data-slot": "dialog-viewport",
507
565
  className: cn(
508
566
  "fixed inset-0 flex items-center justify-center overflow-hidden py-6 [@media(min-height:600px)]:pt-8 [@media(min-height:600px)]:pb-12",
509
567
  className
@@ -512,55 +570,87 @@ function DialogViewport({
512
570
  }
513
571
  );
514
572
  }
515
- function DialogPopup({
573
+ function DialogContent({
516
574
  className,
517
575
  children,
518
576
  bottom = false,
519
577
  showCloseButton = true,
578
+ closePosition = "top-left",
520
579
  ...props
521
580
  }) {
522
- return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
523
- /* @__PURE__ */ jsx(DialogBackdrop, {}),
524
- /* @__PURE__ */ jsxs(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: [
525
- showCloseButton && /* @__PURE__ */ jsxs(
526
- DialogClose,
527
- {
528
- className: "pointer-events-auto fixed top-[15px] left-5 z-50",
529
- "aria-label": "Close",
530
- children: [
531
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" }),
532
- /* @__PURE__ */ 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__ */ jsx("span", { className: "bg-primary-foreground text-background relative z-10 flex size-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(XClose, { className: "size-[18px]" }) }) })
533
- ]
534
- }
535
- ),
536
- /* @__PURE__ */ jsx(
537
- "div",
538
- {
539
- className: cn(
540
- "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",
581
+ return /* @__PURE__ */ jsxs(Dialog.Portal, { "data-slot": "dialog-portal", children: [
582
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
583
+ /* @__PURE__ */ jsxs(
584
+ Dialog.Popup,
585
+ {
586
+ "data-slot": "dialog-content",
587
+ 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",
588
+ children: [
589
+ showCloseButton && /* @__PURE__ */ jsxs(
590
+ DialogClose,
541
591
  {
542
- "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,
543
- "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
544
- },
545
- className
592
+ 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 }),
593
+ "aria-label": "Close",
594
+ children: [
595
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" }),
596
+ /* @__PURE__ */ 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__ */ jsx("span", { className: "bg-primary-foreground text-background relative z-10 flex size-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(XClose, { className: "size-[18px]" }) }) })
597
+ ]
598
+ }
546
599
  ),
547
- ...props,
548
- children
549
- }
550
- )
551
- ] })
600
+ /* @__PURE__ */ jsx(
601
+ "div",
602
+ {
603
+ className: cn(
604
+ "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",
605
+ {
606
+ "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,
607
+ "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
608
+ },
609
+ className
610
+ ),
611
+ ...props,
612
+ children
613
+ }
614
+ )
615
+ ]
616
+ }
617
+ )
552
618
  ] });
553
619
  }
554
620
  function DialogHeader({ className, ...props }) {
555
- return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props });
621
+ return /* @__PURE__ */ jsx(
622
+ "div",
623
+ {
624
+ "data-slot": "dialog-header",
625
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
626
+ ...props
627
+ }
628
+ );
556
629
  }
557
- function DialogFooter({ className, ...props }) {
558
- return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col-reverse gap-2 sm:flex-row", className), ...props });
630
+ function DialogFooter({
631
+ className,
632
+ showCloseButton = false,
633
+ children,
634
+ ...props
635
+ }) {
636
+ return /* @__PURE__ */ jsxs(
637
+ "div",
638
+ {
639
+ "data-slot": "dialog-footer",
640
+ className: cn("flex flex-col-reverse gap-2 sm:flex-row", className),
641
+ ...props,
642
+ children: [
643
+ children,
644
+ showCloseButton && /* @__PURE__ */ jsx(DialogClose, { render: /* @__PURE__ */ jsx(Button, { variant: "tertiary", theme: "base" }), children: "Close" })
645
+ ]
646
+ }
647
+ );
559
648
  }
560
649
  function DialogTitle({ className, ...props }) {
561
650
  return /* @__PURE__ */ jsx(
562
651
  Dialog.Title,
563
652
  {
653
+ "data-slot": "dialog-title",
564
654
  className: cn("text-lg leading-none font-semibold", className),
565
655
  ...props
566
656
  }
@@ -573,6 +663,7 @@ function DialogDescription({
573
663
  return /* @__PURE__ */ jsx(
574
664
  Dialog.Description,
575
665
  {
666
+ "data-slot": "dialog-description",
576
667
  className: cn("text-muted-foreground text-sm", className),
577
668
  ...props
578
669
  }
@@ -582,6 +673,7 @@ function DialogBody({ className, children, ...props }) {
582
673
  return /* @__PURE__ */ jsx(
583
674
  "div",
584
675
  {
676
+ "data-slot": "dialog-body",
585
677
  className: cn("flex shrink-0 grow basis-0 flex-col items-start self-stretch", className),
586
678
  ...props,
587
679
  children: /* @__PURE__ */ jsx("div", { className: "flex shrink-0 grow basis-0 flex-col items-start gap-10 self-stretch overflow-auto p-4", children })
@@ -978,7 +1070,7 @@ function Input({ className, type, ...props }) {
978
1070
  "data-slot": "input",
979
1071
  className: cn(
980
1072
  "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",
981
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
1073
+ "focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-[3px]",
982
1074
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
983
1075
  className
984
1076
  ),
@@ -1186,7 +1278,7 @@ function SectionHeader({
1186
1278
  }
1187
1279
  var tagVariants = cva(
1188
1280
  // Base styles
1189
- "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",
1281
+ "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",
1190
1282
  {
1191
1283
  variants: {
1192
1284
  selected: {
@@ -1267,6 +1359,8 @@ function Tag({
1267
1359
  children,
1268
1360
  leading,
1269
1361
  trailing,
1362
+ interactive,
1363
+ type,
1270
1364
  onClick,
1271
1365
  className = ""
1272
1366
  }) {
@@ -1283,7 +1377,8 @@ function Tag({
1283
1377
  };
1284
1378
  const showLeading = leading && !collapsed;
1285
1379
  const showTrailing = trailing && !collapsed;
1286
- const TagElement = onClick ? "button" : "div";
1380
+ const isInteractive = interactive ?? typeof onClick === "function";
1381
+ const TagElement = isInteractive ? "button" : "div";
1287
1382
  return /* @__PURE__ */ jsxs(
1288
1383
  TagElement,
1289
1384
  {
@@ -1292,13 +1387,13 @@ function Tag({
1292
1387
  size,
1293
1388
  selected,
1294
1389
  collapsed,
1295
- interactive: !!onClick
1390
+ interactive: isInteractive
1296
1391
  }),
1297
1392
  className
1298
1393
  ),
1299
1394
  onClick: handleClick,
1300
1395
  onKeyDown: handleKeyDown,
1301
- type: onClick ? "button" : void 0,
1396
+ type: isInteractive ? type ?? "button" : void 0,
1302
1397
  children: [
1303
1398
  !collapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
1304
1399
  showLeading && /* @__PURE__ */ jsx("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden text-inherit", children: leading }),
@@ -1311,6 +1406,6 @@ function Tag({
1311
1406
  );
1312
1407
  }
1313
1408
 
1314
- export { Button, ButtonLink, ContentBlock, DialogRoot as Dialog, DialogBackdrop, DialogBody, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Footer, Input, Label, Loader, NotificationBadge, SectionFlourish, SectionHeader, Tag, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger };
1409
+ export { BannerNotification, Button, ButtonLink, ContentBlock, DialogRoot as Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Footer, Input, Label, Loader, NotificationBadge, SectionFlourish, SectionHeader, Tag, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger };
1315
1410
  //# sourceMappingURL=index.js.map
1316
1411
  //# sourceMappingURL=index.js.map