@popgrids/ui 0.0.34 → 0.0.36

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
@@ -88,34 +88,88 @@ var avatarVariants = cva(
88
88
  }
89
89
  }
90
90
  );
91
- function Avatar({ className = "", size = "md", ...props }) {
91
+ function fnv1a32(data) {
92
+ const bytes = new TextEncoder().encode(data);
93
+ let h = 2166136261;
94
+ for (let i = 0; i < bytes.length; i++) {
95
+ h ^= bytes[i];
96
+ h = Math.imul(h, 16777619);
97
+ }
98
+ return h >>> 0;
99
+ }
100
+ var BACKGROUND_COLORS = [
101
+ "#DDD0BE",
102
+ "#E9DCBB",
103
+ "#E9DCBB",
104
+ "#C7D1B0",
105
+ "#C6D0CB",
106
+ "#E9DCBB",
107
+ "#C7D1B0",
108
+ "#E9DCBB",
109
+ "#DFC2C0",
110
+ "#CFD4C6",
111
+ "#D7E3E8",
112
+ "#CFD4C6",
113
+ "#D6B3B3",
114
+ "#E9DCBB",
115
+ "#CFCBDC",
116
+ "#BFD6D7",
117
+ "#E3D2C6",
118
+ "#D1E2E7",
119
+ "#D6B3B3",
120
+ "#BFD6D7",
121
+ "#E9DCBB",
122
+ "#C7D1B0",
123
+ "#DFC2C0",
124
+ "#D1E2E7",
125
+ "#CFD4C6",
126
+ "#E9DCBB",
127
+ "#D7E3E8",
128
+ "#CFD4C6",
129
+ "#C6D0CB",
130
+ "#E9DCBB",
131
+ "#C7D1B0",
132
+ "#E9DCBB",
133
+ "#CFCBDC",
134
+ "#E3D2C6",
135
+ "#E9DCBB"
136
+ ];
137
+ function backgroundColor(id) {
138
+ return BACKGROUND_COLORS[fnv1a32(id) % BACKGROUND_COLORS.length];
139
+ }
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;
92
144
  return /* @__PURE__ */ jsx(
93
145
  Avatar$1.Root,
94
146
  {
95
147
  "data-slot": "avatar",
96
148
  "data-size": size,
97
149
  className: cn(avatarVariants({ size }), className),
98
- ...props
150
+ ...props,
151
+ style: rootStyle
99
152
  }
100
153
  );
101
154
  }
102
- function AvatarImage({ className = "", ...props }) {
155
+ function AvatarImage({ className = "", style, ...props }) {
103
156
  return /* @__PURE__ */ jsx(
104
157
  Avatar$1.Image,
105
158
  {
106
159
  "data-slot": "avatar-image",
107
- className: cn("aspect-square size-full mask mask-squircle object-cover", className),
108
- ...props
160
+ className: cn("mask mask-squircle aspect-square size-full object-cover", className),
161
+ ...props,
162
+ style: { backgroundColor: `var(${AVATAR_BG_VAR})`, ...style }
109
163
  }
110
164
  );
111
165
  }
112
- function AvatarFallback({ className = "", ...props }) {
166
+ function AvatarFallback({ className = "", style, ...props }) {
113
167
  return /* @__PURE__ */ jsx(
114
168
  Avatar$1.Fallback,
115
169
  {
116
170
  "data-slot": "avatar-fallback",
117
171
  className: cn(
118
- "mask mask-squircle flex size-full items-center justify-center bg-muted text-muted-foreground text-sm group-data-[size=sm]/avatar:text-xs",
172
+ "mask mask-squircle text-muted-foreground flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs",
119
173
  "group-data-[size=xs]/avatar:text-xs",
120
174
  "group-data-[size=sm]/avatar:text-sm",
121
175
  "group-data-[size=md]/avatar:text-lg",
@@ -124,7 +178,11 @@ function AvatarFallback({ className = "", ...props }) {
124
178
  "group-data-[size=xxl]/avatar:text-5xl",
125
179
  className
126
180
  ),
127
- ...props
181
+ ...props,
182
+ style: {
183
+ backgroundColor: `var(${AVATAR_BG_VAR}, var(--color-muted))`,
184
+ ...style
185
+ }
128
186
  }
129
187
  );
130
188
  }
@@ -134,7 +192,7 @@ function AvatarBadge({ className = "", ...props }) {
134
192
  {
135
193
  "data-slot": "avatar-badge",
136
194
  className: cn(
137
- "absolute h-[18px] min-w-[18px] z-10 select-none",
195
+ "absolute z-10 h-[18px] min-w-[18px] select-none",
138
196
  "leading-none",
139
197
  "group-data-[size=xs]/avatar:right-[-4px] group-data-[size=xs]/avatar:bottom-[-4px]",
140
198
  "group-data-[size=sm]/avatar:right-[-4px] group-data-[size=sm]/avatar:bottom-[-4px]",
@@ -154,7 +212,7 @@ function AvatarGroup({ className = "", ...props }) {
154
212
  {
155
213
  "data-slot": "avatar-group",
156
214
  className: cn(
157
- "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
215
+ "group/avatar-group *:data-[slot=avatar]:ring-background flex -space-x-2 *:data-[slot=avatar]:ring-2",
158
216
  className
159
217
  ),
160
218
  ...props
@@ -167,7 +225,7 @@ function AvatarGroupCount({ className = "", ...props }) {
167
225
  {
168
226
  "data-slot": "avatar-group-count",
169
227
  className: cn(
170
- "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground text-sm ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
228
+ "bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
171
229
  className
172
230
  ),
173
231
  ...props
@@ -434,7 +492,7 @@ var buttonVariants = cva(
434
492
  variant: "primary",
435
493
  outline: false,
436
494
  theme: "base",
437
- 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"
438
496
  },
439
497
  {
440
498
  variant: "primary",
@@ -603,7 +661,8 @@ function Button({
603
661
  {
604
662
  className: cn("transition-opacity group-aria-busy/button:opacity-0", {
605
663
  "opacity-0": loading,
606
- "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
607
666
  }),
608
667
  children: trailing
609
668
  }
@@ -1212,10 +1271,10 @@ var popgridsLogoLg = /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/200
1212
1271
  )
1213
1272
  ] });
1214
1273
  function Footer({ theme = "template", logo, tagline, children }) {
1215
- 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: [
1216
1275
  /* @__PURE__ */ jsxs("div", { className: "mx-auto flex max-w-[480px] flex-col items-center gap-4 self-stretch", children: [
1217
1276
  theme === "branding" ? popgridsLogoLg : logo != null && logo,
1218
- 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 })
1219
1278
  ] }),
1220
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 }),
1221
1280
  theme === "branding" && /* @__PURE__ */ jsxs(
@@ -1224,7 +1283,7 @@ function Footer({ theme = "template", logo, tagline, children }) {
1224
1283
  className: "relative box-border flex w-full shrink-0 flex-row content-stretch items-center justify-center gap-2 px-0 py-1",
1225
1284
  "data-name": "Footer Info",
1226
1285
  children: [
1227
- /* @__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" }) }),
1228
1287
  /* @__PURE__ */ jsx(
1229
1288
  "div",
1230
1289
  {