@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.cjs CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  var avatar = require('@base-ui/react/avatar');
4
4
  var classVarianceAuthority = require('class-variance-authority');
5
- var react = require('react');
6
5
  var clsx = require('clsx');
7
6
  var tailwindMerge = require('tailwind-merge');
8
7
  var mergeProps = require('@base-ui/react/merge-props');
@@ -140,42 +139,39 @@ var BACKGROUND_COLORS = [
140
139
  function backgroundColor(id) {
141
140
  return BACKGROUND_COLORS[fnv1a32(id) % BACKGROUND_COLORS.length];
142
141
  }
143
- var AvatarColorContext = react.createContext(void 0);
144
- function Avatar({ className = "", size = "md", colorKey, ...props }) {
145
- const resolvedColor = colorKey ? backgroundColor(colorKey) : void 0;
146
- return /* @__PURE__ */ jsxRuntime.jsx(AvatarColorContext.Provider, { value: resolvedColor, children: /* @__PURE__ */ jsxRuntime.jsx(
142
+ var AVATAR_BG_VAR = "--avatar-background";
143
+ function Avatar({ className = "", size = "md", colorKey, style, ...props }) {
144
+ const resolved = colorKey ? backgroundColor(colorKey) : void 0;
145
+ const rootStyle = resolved !== void 0 ? { ...style, [AVATAR_BG_VAR]: resolved } : style;
146
+ return /* @__PURE__ */ jsxRuntime.jsx(
147
147
  avatar.Avatar.Root,
148
148
  {
149
149
  "data-slot": "avatar",
150
150
  "data-size": size,
151
151
  className: cn(avatarVariants({ size }), className),
152
- ...props
152
+ ...props,
153
+ style: rootStyle
153
154
  }
154
- ) });
155
+ );
155
156
  }
156
157
  function AvatarImage({ className = "", style, ...props }) {
157
- const resolvedColor = react.useContext(AvatarColorContext);
158
- const mergedStyle = resolvedColor ? { ...style, backgroundColor: resolvedColor } : style;
159
158
  return /* @__PURE__ */ jsxRuntime.jsx(
160
159
  avatar.Avatar.Image,
161
160
  {
162
161
  "data-slot": "avatar-image",
163
162
  className: cn("mask mask-squircle aspect-square size-full object-cover", className),
164
163
  ...props,
165
- style: mergedStyle
164
+ style: { backgroundColor: `var(${AVATAR_BG_VAR})`, ...style }
166
165
  }
167
166
  );
168
167
  }
169
168
  function AvatarFallback({ className = "", style, ...props }) {
170
- const resolvedColor = react.useContext(AvatarColorContext);
171
- const mergedStyle = resolvedColor ? { ...style, backgroundColor: resolvedColor } : style;
172
169
  return /* @__PURE__ */ jsxRuntime.jsx(
173
170
  avatar.Avatar.Fallback,
174
171
  {
175
172
  "data-slot": "avatar-fallback",
176
173
  className: cn(
177
174
  "mask mask-squircle text-muted-foreground flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs",
178
- resolvedColor ? void 0 : "bg-muted",
179
175
  "group-data-[size=xs]/avatar:text-xs",
180
176
  "group-data-[size=sm]/avatar:text-sm",
181
177
  "group-data-[size=md]/avatar:text-lg",
@@ -185,7 +181,10 @@ function AvatarFallback({ className = "", style, ...props }) {
185
181
  className
186
182
  ),
187
183
  ...props,
188
- style: mergedStyle
184
+ style: {
185
+ backgroundColor: `var(${AVATAR_BG_VAR}, var(--color-muted))`,
186
+ ...style
187
+ }
189
188
  }
190
189
  );
191
190
  }
@@ -495,7 +494,7 @@ var buttonVariants = classVarianceAuthority.cva(
495
494
  variant: "primary",
496
495
  outline: false,
497
496
  theme: "base",
498
- 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"
497
+ 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"
499
498
  },
500
499
  {
501
500
  variant: "primary",
@@ -664,7 +663,8 @@ function Button({
664
663
  {
665
664
  className: cn("transition-opacity group-aria-busy/button:opacity-0", {
666
665
  "opacity-0": loading,
667
- "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed
666
+ "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed,
667
+ "ml-auto": !collapsed
668
668
  }),
669
669
  children: trailing
670
670
  }
@@ -1273,10 +1273,10 @@ var popgridsLogoLg = /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www
1273
1273
  )
1274
1274
  ] });
1275
1275
  function Footer({ theme = "template", logo, tagline, children }) {
1276
- return /* @__PURE__ */ jsxRuntime.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: [
1276
+ return /* @__PURE__ */ jsxRuntime.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: [
1277
1277
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex max-w-[480px] flex-col items-center gap-4 self-stretch", children: [
1278
1278
  theme === "branding" ? popgridsLogoLg : logo != null && logo,
1279
- tagline != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-lg text-primary-foreground", children: tagline })
1279
+ tagline != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-lg", children: tagline })
1280
1280
  ] }),
1281
1281
  /* @__PURE__ */ jsxRuntime.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 }),
1282
1282
  theme === "branding" && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1285,7 +1285,7 @@ function Footer({ theme = "template", logo, tagline, children }) {
1285
1285
  className: "relative box-border flex w-full shrink-0 flex-row content-stretch items-center justify-center gap-2 px-0 py-1",
1286
1286
  "data-name": "Footer Info",
1287
1287
  children: [
1288
- /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("p", { className: "block whitespace-pre text-sm leading-6", children: "Powered by" }) }),
1288
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("p", { className: "block text-sm leading-6 whitespace-pre", children: "Powered by" }) }),
1289
1289
  /* @__PURE__ */ jsxRuntime.jsx(
1290
1290
  "div",
1291
1291
  {
@@ -1466,6 +1466,87 @@ function InputGroupTextarea({ className, ...props }) {
1466
1466
  }
1467
1467
  );
1468
1468
  }
1469
+ var inputStatusVariants = classVarianceAuthority.cva(
1470
+ "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",
1471
+ {
1472
+ variants: {
1473
+ theme: {
1474
+ approve: "text-success-700 dark:text-success-200",
1475
+ publish: "text-success-700 dark:text-success-200",
1476
+ feedback: "text-success-700 dark:text-success-200",
1477
+ flagged: "text-warning-700 dark:text-warning-200",
1478
+ review: "text-warning-700 dark:text-warning-200",
1479
+ delete: "text-error-600 dark:text-error-300",
1480
+ blocked: "text-error-600 dark:text-error-300",
1481
+ reject: "text-error-600 dark:text-error-300"
1482
+ },
1483
+ variant: {
1484
+ community: "",
1485
+ content: ""
1486
+ }
1487
+ },
1488
+ defaultVariants: {
1489
+ theme: "approve",
1490
+ variant: "community"
1491
+ }
1492
+ }
1493
+ );
1494
+ var inputStatusInnerVariants = classVarianceAuthority.cva(
1495
+ "flex flex-1 items-center gap-0.5 overflow-hidden rounded-sm py-2.5 pr-1.5 pl-[10px]",
1496
+ {
1497
+ variants: {
1498
+ theme: {
1499
+ approve: "bg-success-100 dark:bg-success-200/16",
1500
+ publish: "bg-success-100 dark:bg-success-200/16",
1501
+ feedback: "bg-success-100 dark:bg-success-200/16",
1502
+ flagged: "bg-warning-100 dark:bg-warning-200/16",
1503
+ review: "bg-warning-100 dark:bg-warning-200/16",
1504
+ delete: "bg-error-100 dark:bg-error-300/16",
1505
+ blocked: "bg-error-100 dark:bg-error-300/16",
1506
+ reject: "bg-error-100 dark:bg-error-300/16"
1507
+ }
1508
+ },
1509
+ defaultVariants: {
1510
+ theme: "approve"
1511
+ }
1512
+ }
1513
+ );
1514
+ var STATUS_ICON = {
1515
+ flagged: icons.Hourglass03,
1516
+ review: icons.Hourglass03,
1517
+ approve: icons.ThumbsUp,
1518
+ publish: icons.CheckCircle,
1519
+ feedback: icons.MessageAlertSquare,
1520
+ delete: icons.ThumbsDown,
1521
+ blocked: icons.SlashCircle01,
1522
+ reject: icons.ThumbsDown
1523
+ };
1524
+ function InputStatus({
1525
+ className,
1526
+ theme = "approve",
1527
+ variant = "community",
1528
+ open = false,
1529
+ "aria-expanded": ariaExpanded,
1530
+ type = "button",
1531
+ ...props
1532
+ }) {
1533
+ const Icon = STATUS_ICON[theme];
1534
+ const expanded = ariaExpanded !== void 0 ? ariaExpanded : open;
1535
+ return /* @__PURE__ */ jsxRuntime.jsx(
1536
+ button.Button,
1537
+ {
1538
+ "data-slot": "input-status",
1539
+ type,
1540
+ "aria-expanded": expanded,
1541
+ className: cn(inputStatusVariants({ theme, variant }), className),
1542
+ ...props,
1543
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: inputStatusInnerVariants({ theme }), children: [
1544
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-5", "aria-hidden": true }),
1545
+ open ? /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronUp, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, { className: "size-4", "aria-hidden": true })
1546
+ ] })
1547
+ }
1548
+ );
1549
+ }
1469
1550
  function Label({ className, render, ...props }) {
1470
1551
  const defaultProps = {
1471
1552
  "data-slot": "label",
@@ -2090,6 +2171,7 @@ exports.InputGroupButton = InputGroupButton;
2090
2171
  exports.InputGroupInput = InputGroupInput;
2091
2172
  exports.InputGroupText = InputGroupText;
2092
2173
  exports.InputGroupTextarea = InputGroupTextarea;
2174
+ exports.InputStatus = InputStatus;
2093
2175
  exports.Label = Label;
2094
2176
  exports.Loader = Loader;
2095
2177
  exports.Logo = Logo;