@popgrids/ui 0.0.35 → 0.0.37

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.d.cts CHANGED
@@ -10,6 +10,7 @@ export { D as DropdownMenu, a as DropdownMenuCheckboxItem, b as DropdownMenuCont
10
10
  export { Footer } from './footer.cjs';
11
11
  export { Input } from './input.cjs';
12
12
  export { InputGroup, InputGroupAddon, InputGroupAddonAlign, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupButtonSize, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps } from './input-group.cjs';
13
+ export { InputStatus, InputStatusProps, InputStatusTheme, InputStatusVariant } from './input-status.cjs';
13
14
  export { Label } from './label.cjs';
14
15
  export { Loader, LoaderProps } from './loader.cjs';
15
16
  export { Logo, LogoProps, LogoTheme, LogoVariant } from './logo.cjs';
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { D as DropdownMenu, a as DropdownMenuCheckboxItem, b as DropdownMenuCont
10
10
  export { Footer } from './footer.js';
11
11
  export { Input } from './input.js';
12
12
  export { InputGroup, InputGroupAddon, InputGroupAddonAlign, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupButtonSize, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps } from './input-group.js';
13
+ export { InputStatus, InputStatusProps, InputStatusTheme, InputStatusVariant } from './input-status.js';
13
14
  export { Label } from './label.js';
14
15
  export { Loader, LoaderProps } from './loader.js';
15
16
  export { Logo, LogoProps, LogoTheme, LogoVariant } from './logo.js';
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
2
2
  import { cva } from 'class-variance-authority';
3
- import { createContext, useContext } from 'react';
4
3
  import { clsx } from 'clsx';
5
4
  import { twMerge } from 'tailwind-merge';
6
5
  import { mergeProps } from '@base-ui/react/merge-props';
@@ -8,7 +7,7 @@ import { useRender } from '@base-ui/react/use-render';
8
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
8
  import { Button as Button$1 } from '@base-ui/react/button';
10
9
  import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
11
- import { Check, XClose, ChevronRight, InfoCircle } from '@untitledui/icons';
10
+ import { Check, XClose, ChevronRight, ThumbsDown, SlashCircle01, MessageAlertSquare, CheckCircle, ThumbsUp, Hourglass03, ChevronUp, ChevronDown, InfoCircle } from '@untitledui/icons';
12
11
  import { Dialog } from '@base-ui/react/dialog';
13
12
  import { Menu } from '@base-ui/react/menu';
14
13
  import { Input as Input$1 } from '@base-ui/react/input';
@@ -138,42 +137,39 @@ var BACKGROUND_COLORS = [
138
137
  function backgroundColor(id) {
139
138
  return BACKGROUND_COLORS[fnv1a32(id) % BACKGROUND_COLORS.length];
140
139
  }
141
- var AvatarColorContext = createContext(void 0);
142
- function Avatar({ className = "", size = "md", colorKey, ...props }) {
143
- const resolvedColor = colorKey ? backgroundColor(colorKey) : void 0;
144
- return /* @__PURE__ */ jsx(AvatarColorContext.Provider, { value: resolvedColor, children: /* @__PURE__ */ jsx(
140
+ var AVATAR_BG_VAR = "--avatar-background";
141
+ function Avatar({ className = "", size = "md", colorKey, style, ...props }) {
142
+ const resolved = colorKey ? backgroundColor(colorKey) : void 0;
143
+ const rootStyle = resolved !== void 0 ? { ...style, [AVATAR_BG_VAR]: resolved } : style;
144
+ return /* @__PURE__ */ jsx(
145
145
  Avatar$1.Root,
146
146
  {
147
147
  "data-slot": "avatar",
148
148
  "data-size": size,
149
149
  className: cn(avatarVariants({ size }), className),
150
- ...props
150
+ ...props,
151
+ style: rootStyle
151
152
  }
152
- ) });
153
+ );
153
154
  }
154
155
  function AvatarImage({ className = "", style, ...props }) {
155
- const resolvedColor = useContext(AvatarColorContext);
156
- const mergedStyle = resolvedColor ? { ...style, backgroundColor: resolvedColor } : style;
157
156
  return /* @__PURE__ */ jsx(
158
157
  Avatar$1.Image,
159
158
  {
160
159
  "data-slot": "avatar-image",
161
160
  className: cn("mask mask-squircle aspect-square size-full object-cover", className),
162
161
  ...props,
163
- style: mergedStyle
162
+ style: { backgroundColor: `var(${AVATAR_BG_VAR})`, ...style }
164
163
  }
165
164
  );
166
165
  }
167
166
  function AvatarFallback({ className = "", style, ...props }) {
168
- const resolvedColor = useContext(AvatarColorContext);
169
- const mergedStyle = resolvedColor ? { ...style, backgroundColor: resolvedColor } : style;
170
167
  return /* @__PURE__ */ jsx(
171
168
  Avatar$1.Fallback,
172
169
  {
173
170
  "data-slot": "avatar-fallback",
174
171
  className: cn(
175
172
  "mask mask-squircle text-muted-foreground flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs",
176
- resolvedColor ? void 0 : "bg-muted",
177
173
  "group-data-[size=xs]/avatar:text-xs",
178
174
  "group-data-[size=sm]/avatar:text-sm",
179
175
  "group-data-[size=md]/avatar:text-lg",
@@ -183,7 +179,10 @@ function AvatarFallback({ className = "", style, ...props }) {
183
179
  className
184
180
  ),
185
181
  ...props,
186
- style: mergedStyle
182
+ style: {
183
+ backgroundColor: `var(${AVATAR_BG_VAR}, var(--color-muted))`,
184
+ ...style
185
+ }
187
186
  }
188
187
  );
189
188
  }
@@ -493,7 +492,7 @@ var buttonVariants = cva(
493
492
  variant: "primary",
494
493
  outline: false,
495
494
  theme: "base",
496
- class: "bg-foreground text-background hover:ring-2 active:ring active:bg-background disabled:outline-none disabled:bg-black/0 disabled:text-black-alpha-600 focus-visible:ring-3 focus-visible:ring-ring focus-visible:outline-background focus-visible:bg-foreground focus-visible:text-background"
495
+ class: "bg-foreground text-background hover:ring-2 active:bg-foreground active:text-background disabled:outline-none disabled:bg-black/0 disabled:text-black-alpha-600 focus-visible:ring-3 focus-visible:ring-ring focus-visible:outline-background focus-visible:bg-foreground focus-visible:text-background"
497
496
  },
498
497
  {
499
498
  variant: "primary",
@@ -662,7 +661,8 @@ function Button({
662
661
  {
663
662
  className: cn("transition-opacity group-aria-busy/button:opacity-0", {
664
663
  "opacity-0": loading,
665
- "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed
664
+ "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed,
665
+ "ml-auto": !collapsed
666
666
  }),
667
667
  children: trailing
668
668
  }
@@ -1271,10 +1271,10 @@ var popgridsLogoLg = /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/200
1271
1271
  )
1272
1272
  ] });
1273
1273
  function Footer({ theme = "template", logo, tagline, children }) {
1274
- return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full flex-col items-center gap-8 self-stretch border-t border-t-foreground/10 px-10 py-20 lg:px-8", children: [
1274
+ return /* @__PURE__ */ jsxs("div", { className: "border-t-foreground/10 mx-auto flex w-full flex-col items-center gap-8 self-stretch border-t px-10 py-20 lg:px-8", children: [
1275
1275
  /* @__PURE__ */ jsxs("div", { className: "mx-auto flex max-w-[480px] flex-col items-center gap-4 self-stretch", children: [
1276
1276
  theme === "branding" ? popgridsLogoLg : logo != null && logo,
1277
- tagline != null && /* @__PURE__ */ jsx("div", { className: "text-center text-lg text-primary-foreground", children: tagline })
1277
+ tagline != null && /* @__PURE__ */ jsx("div", { className: "text-center text-lg", children: tagline })
1278
1278
  ] }),
1279
1279
  /* @__PURE__ */ jsx("div", { className: "mx-auto flex max-w-[320px] flex-col items-center justify-center gap-1.5 self-stretch lg:max-w-none lg:flex-row lg:gap-1 lg:space-x-1", children }),
1280
1280
  theme === "branding" && /* @__PURE__ */ jsxs(
@@ -1283,7 +1283,7 @@ function Footer({ theme = "template", logo, tagline, children }) {
1283
1283
  className: "relative box-border flex w-full shrink-0 flex-row content-stretch items-center justify-center gap-2 px-0 py-1",
1284
1284
  "data-name": "Footer Info",
1285
1285
  children: [
1286
- /* @__PURE__ */ jsx("div", { className: "relative flex shrink-0 flex-col justify-center text-nowrap text-center font-display font-normal text-base text-foreground not-italic leading-0", children: /* @__PURE__ */ jsx("p", { className: "block whitespace-pre text-sm leading-6", children: "Powered by" }) }),
1286
+ /* @__PURE__ */ jsx("div", { className: "font-display text-foreground relative flex shrink-0 flex-col justify-center text-center text-base leading-0 font-normal text-nowrap not-italic", children: /* @__PURE__ */ jsx("p", { className: "block text-sm leading-6 whitespace-pre", children: "Powered by" }) }),
1287
1287
  /* @__PURE__ */ jsx(
1288
1288
  "div",
1289
1289
  {
@@ -1464,6 +1464,87 @@ function InputGroupTextarea({ className, ...props }) {
1464
1464
  }
1465
1465
  );
1466
1466
  }
1467
+ var inputStatusVariants = cva(
1468
+ "inline-flex h-10 min-w-[54px] cursor-pointer items-stretch rounded-sm border-0 bg-transparent p-0 outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/60 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
1469
+ {
1470
+ variants: {
1471
+ theme: {
1472
+ approve: "text-success-700 dark:text-success-200",
1473
+ publish: "text-success-700 dark:text-success-200",
1474
+ feedback: "text-success-700 dark:text-success-200",
1475
+ flagged: "text-warning-700 dark:text-warning-200",
1476
+ review: "text-warning-700 dark:text-warning-200",
1477
+ delete: "text-error-600 dark:text-error-300",
1478
+ blocked: "text-error-600 dark:text-error-300",
1479
+ reject: "text-error-600 dark:text-error-300"
1480
+ },
1481
+ variant: {
1482
+ community: "",
1483
+ content: ""
1484
+ }
1485
+ },
1486
+ defaultVariants: {
1487
+ theme: "approve",
1488
+ variant: "community"
1489
+ }
1490
+ }
1491
+ );
1492
+ var inputStatusInnerVariants = cva(
1493
+ "flex flex-1 items-center gap-0.5 overflow-hidden rounded-sm py-2.5 pr-1.5 pl-[10px]",
1494
+ {
1495
+ variants: {
1496
+ theme: {
1497
+ approve: "bg-success-100 dark:bg-success-200/16",
1498
+ publish: "bg-success-100 dark:bg-success-200/16",
1499
+ feedback: "bg-success-100 dark:bg-success-200/16",
1500
+ flagged: "bg-warning-100 dark:bg-warning-200/16",
1501
+ review: "bg-warning-100 dark:bg-warning-200/16",
1502
+ delete: "bg-error-100 dark:bg-error-300/16",
1503
+ blocked: "bg-error-100 dark:bg-error-300/16",
1504
+ reject: "bg-error-100 dark:bg-error-300/16"
1505
+ }
1506
+ },
1507
+ defaultVariants: {
1508
+ theme: "approve"
1509
+ }
1510
+ }
1511
+ );
1512
+ var STATUS_ICON = {
1513
+ flagged: Hourglass03,
1514
+ review: Hourglass03,
1515
+ approve: ThumbsUp,
1516
+ publish: CheckCircle,
1517
+ feedback: MessageAlertSquare,
1518
+ delete: ThumbsDown,
1519
+ blocked: SlashCircle01,
1520
+ reject: ThumbsDown
1521
+ };
1522
+ function InputStatus({
1523
+ className,
1524
+ theme = "approve",
1525
+ variant = "community",
1526
+ open = false,
1527
+ "aria-expanded": ariaExpanded,
1528
+ type = "button",
1529
+ ...props
1530
+ }) {
1531
+ const Icon = STATUS_ICON[theme];
1532
+ const expanded = ariaExpanded !== void 0 ? ariaExpanded : open;
1533
+ return /* @__PURE__ */ jsx(
1534
+ Button$1,
1535
+ {
1536
+ "data-slot": "input-status",
1537
+ type,
1538
+ "aria-expanded": expanded,
1539
+ className: cn(inputStatusVariants({ theme, variant }), className),
1540
+ ...props,
1541
+ children: /* @__PURE__ */ jsxs("span", { className: inputStatusInnerVariants({ theme }), children: [
1542
+ /* @__PURE__ */ jsx(Icon, { className: "size-5", "aria-hidden": true }),
1543
+ open ? /* @__PURE__ */ jsx(ChevronUp, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsx(ChevronDown, { className: "size-4", "aria-hidden": true })
1544
+ ] })
1545
+ }
1546
+ );
1547
+ }
1467
1548
  function Label({ className, render, ...props }) {
1468
1549
  const defaultProps = {
1469
1550
  "data-slot": "label",
@@ -2041,6 +2122,6 @@ function TemplateHeader({ className, image }) {
2041
2122
  );
2042
2123
  }
2043
2124
 
2044
- export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, BannerNotification, Button, ButtonLink, Checkbox, ContentBlock, DefaultHeader, 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, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Loader, Logo, NotificationBadge, SectionFlourish, SectionHeader, Tag, TemplateHeader, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger };
2125
+ export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, BannerNotification, Button, ButtonLink, Checkbox, ContentBlock, DefaultHeader, 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, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputStatus, Label, Loader, Logo, NotificationBadge, SectionFlourish, SectionHeader, Tag, TemplateHeader, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger };
2045
2126
  //# sourceMappingURL=index.js.map
2046
2127
  //# sourceMappingURL=index.js.map