@caqophony/ui 0.9.7 → 0.9.9

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/README.md CHANGED
@@ -25,9 +25,11 @@ The package is ESM-only. Subpath types (`@caqophony/ui/charts`) resolve through
25
25
  the `exports` map, so TypeScript needs `moduleResolution` of `bundler` (or
26
26
  `node16`/`nodenext`).
27
27
 
28
- `DiceBearAvatar` renders an image from `api.dicebear.com` at runtime, so it
29
- makes a network request from the user's browser; do not use it where that is
30
- unacceptable.
28
+ `DiceBearAvatar` builds its SVG in the browser with DiceBear's own library
29
+ (`@dicebear/core` and one `@dicebear/<style>` package per style), so it makes
30
+ no request to `api.dicebear.com`. Each style is loaded only when an avatar of
31
+ that style is drawn. Some styles' artwork is licensed CC BY 4.0 and needs
32
+ credit; each style package's header names its licence.
31
33
 
32
34
  ## Styles (Tailwind v4)
33
35
 
package/dist/index.d.mts CHANGED
@@ -433,11 +433,6 @@ type DiceBearStyle = 'adventurer' | 'adventurer-neutral' | 'avataaars' | 'avataa
433
433
  declare const avatarVariants: (props?: ({
434
434
  size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
435
435
  } & class_variance_authority_types.ClassProp) | undefined) => string;
436
- /**
437
- * Build a DiceBear avatar URL from a seed and style.
438
- * Deterministic — same seed + style always produces the same avatar.
439
- */
440
- declare function buildDiceBearUrl(seed: string, style?: DiceBearStyle): string;
441
436
  interface DiceBearAvatarProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof avatarVariants> {
442
437
  /** Seed string for deterministic avatar generation (e.g. agent ID or name) */
443
438
  seed: string;
@@ -2316,4 +2311,4 @@ declare function cn(...inputs: ClassValue[]): string;
2316
2311
 
2317
2312
  declare function useDebounce<T>(value: T, ms: number): T;
2318
2313
 
2319
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionCard, type ActionCardProps, ActionPanel, type ActionPanelProps, ActivityFeed, ActivityFeedItem, type ActivityFeedItemProps, type ActivityFeedProps, Alert, type AlertProps, AppShell, type AppShellProps, AvatarGroup, AvatarGroupItem, type AvatarGroupItemProps, type AvatarGroupProps, Button, ButtonGroup, ButtonGroupItem, type ButtonGroupItemProps, type ButtonGroupProps, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, ClampedList, type ClampedListProps, CollapsibleSidebar, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteProps, type CommandPaletteResult, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, DataTable, type DataTableProps, DatePicker, type DatePickerProps, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListProps, DiceBearAvatar, type DiceBearAvatarProps, type DiceBearStyle, DistributionChip, type DistributionChipProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerFooter, DrawerHeader, type DrawerProps, EMPTY_VALUE_GLYPH, EmptyState, type EmptyStateProps, EmptyValue, type EmptyValueProps, type FieldSize, FilterChip, type FilterChipProps, FormError, type FormErrorProps, FormField, FormFieldGroup, type FormFieldGroupProps, type FormFieldProps, FormLayout, type FormLayoutProps, FormLayoutSection, type FormLayoutSectionProps, FormSection, type FormSectionProps, FormSuccess, type FormSuccessProps, GlobalErrorContent, type GlobalErrorContentProps, GridList, GridListItem, type GridListItemProps, type GridListProps, HorizontalCard, type HorizontalCardProps, HoverCard, type HoverCardProps, INTENT_SUBTLE_STYLES, IconName, IconSize, ImageCard, type ImageCardProps, Input, InputGroup, type InputGroupProps, type InputProps, IntentBadge, type IntentBadgeIntent, type IntentBadgeProps, IntentIcon, type IntentIconProps, Label, type LabelProps, MediaObject, type MediaObjectProps, ModalBody, ModalDialog, type ModalDialogProps, ModalFooter, ModalHeader, type NavItem, Navbar, NavbarLink, type NavbarLinkProps, type NavbarProps, NotificationBanner, type NotificationBannerProps, NotificationPanel, NotificationPanelItem, type NotificationPanelItemProps, type NotificationPanelProps, OverflowMenu, type OverflowMenuItem, type OverflowMenuProps, PageContent, type PageContentProps, PageGutter, type PageGutterProps, PageHeading, type PageHeadingProps, Pagination, PaginationButton, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressIntent, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, SCROLL_HINT_X, SectionCard, type SectionCardProps, SectionHeading, type SectionHeadingProps, Select, type SelectOption, type SelectProps, SidePanelLayout, type SidePanelLayoutProps, type NavItem as SidebarNavItem, SimpleAccordion, SkeletonBar, type SkeletonBarProps, SkeletonCard, SkeletonCardGrid, type SkeletonCardGridProps, type SkeletonCardProps, SkeletonDetail, type SkeletonDetailProps, SkeletonRow, type SkeletonRowProps, SkeletonTable, type SkeletonTableProps, Spinner, type SpinnerProps, StackedList, StackedListItem, type StackedListItemProps, type StackedListProps, type Stage, StageList, type StageListProps, StatCardExtended, type StatCardExtendedProps, StatGroup, type StatGroupProps, Stepper, type StepperProps, StepperStep, type StepperStepProps, StickyActionBar, type StickyActionBarProps, Switch, type SwitchProps, TabBar, TabBarItem, type TabBarItemProps, type TabBarProps, TabbedCard, type TabbedCardProps, TableBody, TableCaption, TableCell, type TableCellProps, TableHeader, TableRow, type TableRowProps, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, avatarVariants, buildDiceBearUrl, buttonVariants, cn, fieldVariants, getPageRange, isEmptyValue, useDebounce, useSidebar };
2314
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionCard, type ActionCardProps, ActionPanel, type ActionPanelProps, ActivityFeed, ActivityFeedItem, type ActivityFeedItemProps, type ActivityFeedProps, Alert, type AlertProps, AppShell, type AppShellProps, AvatarGroup, AvatarGroupItem, type AvatarGroupItemProps, type AvatarGroupProps, Button, ButtonGroup, ButtonGroupItem, type ButtonGroupItemProps, type ButtonGroupProps, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, ClampedList, type ClampedListProps, CollapsibleSidebar, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteProps, type CommandPaletteResult, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, DataTable, type DataTableProps, DatePicker, type DatePickerProps, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListProps, DiceBearAvatar, type DiceBearAvatarProps, type DiceBearStyle, DistributionChip, type DistributionChipProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerFooter, DrawerHeader, type DrawerProps, EMPTY_VALUE_GLYPH, EmptyState, type EmptyStateProps, EmptyValue, type EmptyValueProps, type FieldSize, FilterChip, type FilterChipProps, FormError, type FormErrorProps, FormField, FormFieldGroup, type FormFieldGroupProps, type FormFieldProps, FormLayout, type FormLayoutProps, FormLayoutSection, type FormLayoutSectionProps, FormSection, type FormSectionProps, FormSuccess, type FormSuccessProps, GlobalErrorContent, type GlobalErrorContentProps, GridList, GridListItem, type GridListItemProps, type GridListProps, HorizontalCard, type HorizontalCardProps, HoverCard, type HoverCardProps, INTENT_SUBTLE_STYLES, IconName, IconSize, ImageCard, type ImageCardProps, Input, InputGroup, type InputGroupProps, type InputProps, IntentBadge, type IntentBadgeIntent, type IntentBadgeProps, IntentIcon, type IntentIconProps, Label, type LabelProps, MediaObject, type MediaObjectProps, ModalBody, ModalDialog, type ModalDialogProps, ModalFooter, ModalHeader, type NavItem, Navbar, NavbarLink, type NavbarLinkProps, type NavbarProps, NotificationBanner, type NotificationBannerProps, NotificationPanel, NotificationPanelItem, type NotificationPanelItemProps, type NotificationPanelProps, OverflowMenu, type OverflowMenuItem, type OverflowMenuProps, PageContent, type PageContentProps, PageGutter, type PageGutterProps, PageHeading, type PageHeadingProps, Pagination, PaginationButton, type PaginationProps, Popover, type PopoverProps, Progress, type ProgressIntent, type ProgressProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, SCROLL_HINT_X, SectionCard, type SectionCardProps, SectionHeading, type SectionHeadingProps, Select, type SelectOption, type SelectProps, SidePanelLayout, type SidePanelLayoutProps, type NavItem as SidebarNavItem, SimpleAccordion, SkeletonBar, type SkeletonBarProps, SkeletonCard, SkeletonCardGrid, type SkeletonCardGridProps, type SkeletonCardProps, SkeletonDetail, type SkeletonDetailProps, SkeletonRow, type SkeletonRowProps, SkeletonTable, type SkeletonTableProps, Spinner, type SpinnerProps, StackedList, StackedListItem, type StackedListItemProps, type StackedListProps, type Stage, StageList, type StageListProps, StatCardExtended, type StatCardExtendedProps, StatGroup, type StatGroupProps, Stepper, type StepperProps, StepperStep, type StepperStepProps, StickyActionBar, type StickyActionBarProps, Switch, type SwitchProps, TabBar, TabBarItem, type TabBarItemProps, type TabBarProps, TabbedCard, type TabbedCardProps, TableBody, TableCaption, TableCell, type TableCellProps, TableHeader, TableRow, type TableRowProps, Textarea, type TextareaProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, avatarVariants, buttonVariants, cn, fieldVariants, getPageRange, isEmptyValue, useDebounce, useSidebar };
package/dist/index.js CHANGED
@@ -1239,6 +1239,44 @@ function ConfirmDialog({
1239
1239
  // src/dicebear-avatar.tsx
1240
1240
  import * as React7 from "react";
1241
1241
  import { cva as cva2 } from "class-variance-authority";
1242
+
1243
+ // src/dicebear-svg.ts
1244
+ import { createAvatar } from "@dicebear/core";
1245
+ var STYLE_LOADERS = {
1246
+ adventurer: () => import("@dicebear/adventurer"),
1247
+ "adventurer-neutral": () => import("@dicebear/adventurer-neutral"),
1248
+ avataaars: () => import("@dicebear/avataaars"),
1249
+ "avataaars-neutral": () => import("@dicebear/avataaars-neutral"),
1250
+ "big-ears": () => import("@dicebear/big-ears"),
1251
+ "big-ears-neutral": () => import("@dicebear/big-ears-neutral"),
1252
+ bottts: () => import("@dicebear/bottts"),
1253
+ "bottts-neutral": () => import("@dicebear/bottts-neutral"),
1254
+ croodles: () => import("@dicebear/croodles"),
1255
+ "croodles-neutral": () => import("@dicebear/croodles-neutral"),
1256
+ "fun-emoji": () => import("@dicebear/fun-emoji"),
1257
+ icons: () => import("@dicebear/icons"),
1258
+ identicon: () => import("@dicebear/identicon"),
1259
+ initials: () => import("@dicebear/initials"),
1260
+ lorelei: () => import("@dicebear/lorelei"),
1261
+ "lorelei-neutral": () => import("@dicebear/lorelei-neutral"),
1262
+ micah: () => import("@dicebear/micah"),
1263
+ miniavs: () => import("@dicebear/miniavs"),
1264
+ notionists: () => import("@dicebear/notionists"),
1265
+ "notionists-neutral": () => import("@dicebear/notionists-neutral"),
1266
+ "open-peeps": () => import("@dicebear/open-peeps"),
1267
+ personas: () => import("@dicebear/personas"),
1268
+ "pixel-art": () => import("@dicebear/pixel-art"),
1269
+ "pixel-art-neutral": () => import("@dicebear/pixel-art-neutral"),
1270
+ rings: () => import("@dicebear/rings"),
1271
+ shapes: () => import("@dicebear/shapes"),
1272
+ thumbs: () => import("@dicebear/thumbs")
1273
+ };
1274
+ async function diceBearDataUri(seed, style) {
1275
+ const loaded = await STYLE_LOADERS[style]();
1276
+ return createAvatar(loaded, { seed }).toDataUri();
1277
+ }
1278
+
1279
+ // src/dicebear-avatar.tsx
1242
1280
  import { jsx as jsx11 } from "react/jsx-runtime";
1243
1281
  var avatarVariants = cva2(
1244
1282
  "relative inline-flex shrink-0 overflow-hidden rounded-full bg-muted dark:bg-muted",
@@ -1258,11 +1296,6 @@ var avatarVariants = cva2(
1258
1296
  }
1259
1297
  }
1260
1298
  );
1261
- var DICEBEAR_BASE_URL = "https://api.dicebear.com/9.x";
1262
- function buildDiceBearUrl(seed, style = "adventurer-neutral") {
1263
- const encodedSeed = encodeURIComponent(seed);
1264
- return `${DICEBEAR_BASE_URL}/${style}/svg?seed=${encodedSeed}`;
1265
- }
1266
1299
  var DiceBearAvatar = React7.forwardRef(
1267
1300
  ({
1268
1301
  seed,
@@ -1273,10 +1306,24 @@ var DiceBearAvatar = React7.forwardRef(
1273
1306
  className,
1274
1307
  ...props
1275
1308
  }, ref) => {
1309
+ const [src, setSrc] = React7.useState(null);
1276
1310
  const [hasError, setHasError] = React7.useState(false);
1277
- const url = buildDiceBearUrl(seed, avatarStyle);
1278
1311
  React7.useEffect(() => {
1312
+ let live = true;
1313
+ setSrc(null);
1279
1314
  setHasError(false);
1315
+ const style = avatarStyle;
1316
+ diceBearDataUri(seed, style).then(
1317
+ (uri) => {
1318
+ if (live) setSrc(uri);
1319
+ },
1320
+ () => {
1321
+ if (live) setHasError(true);
1322
+ }
1323
+ );
1324
+ return () => {
1325
+ live = false;
1326
+ };
1280
1327
  }, [seed, avatarStyle]);
1281
1328
  return /* @__PURE__ */ jsx11(
1282
1329
  "div",
@@ -1284,10 +1331,10 @@ var DiceBearAvatar = React7.forwardRef(
1284
1331
  ref,
1285
1332
  className: cn(avatarVariants({ size }), className),
1286
1333
  ...props,
1287
- children: hasError ? fallback ? /* @__PURE__ */ jsx11("div", { className: "flex h-full w-full items-center justify-center text-xs font-medium text-muted-foreground dark:text-muted-foreground", children: fallback }) : /* @__PURE__ */ jsx11("div", { className: "text-primary-text dark:text-primary-text flex h-full w-full items-center justify-center bg-primary/10 text-xs font-medium dark:bg-primary/10", children: seed.charAt(0).toUpperCase() }) : /* @__PURE__ */ jsx11(
1334
+ children: hasError ? fallback ? /* @__PURE__ */ jsx11("div", { className: "flex h-full w-full items-center justify-center text-xs font-medium text-muted-foreground dark:text-muted-foreground", children: fallback }) : /* @__PURE__ */ jsx11("div", { className: "text-primary-text dark:text-primary-text flex h-full w-full items-center justify-center bg-primary/10 text-xs font-medium dark:bg-primary/10", children: seed.charAt(0).toUpperCase() }) : src === null ? null : /* @__PURE__ */ jsx11(
1288
1335
  "img",
1289
1336
  {
1290
- src: url,
1337
+ src,
1291
1338
  alt,
1292
1339
  className: "h-full w-full object-cover",
1293
1340
  onError: () => setHasError(true)
@@ -1587,8 +1634,8 @@ var StackedListItem = React8.forwardRef(
1587
1634
  ...props,
1588
1635
  children: [
1589
1636
  avatar && /* @__PURE__ */ jsx19("div", { className: "col-start-1 mr-4", children: avatar }),
1590
- /* @__PURE__ */ jsxs13("div", { className: "col-start-2 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1", children: [
1591
- /* @__PURE__ */ jsxs13("div", { className: "min-w-0 grow basis-40", children: [
1637
+ /* @__PURE__ */ jsxs13("div", { className: "col-start-2 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 [container-type:inline-size]", children: [
1638
+ /* @__PURE__ */ jsxs13("div", { className: "min-w-0 grow basis-full [@container(min-width:28rem)]:basis-40", children: [
1592
1639
  /* @__PURE__ */ jsx19(
1593
1640
  "p",
1594
1641
  {
@@ -1610,8 +1657,10 @@ var StackedListItem = React8.forwardRef(
1610
1657
  }
1611
1658
  )
1612
1659
  ] }),
1613
- meta && /* @__PURE__ */ jsx19("span", { className: "min-w-0 max-w-full break-words text-sm text-muted-foreground", children: meta }),
1614
- action && /* @__PURE__ */ jsx19("div", { className: "flex-shrink-0", children: action })
1660
+ (meta || action) && /* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 max-w-full flex-wrap items-center gap-x-4 gap-y-1", children: [
1661
+ meta && /* @__PURE__ */ jsx19("span", { className: "min-w-0 max-w-full break-words text-sm text-muted-foreground", children: meta }),
1662
+ action && /* @__PURE__ */ jsx19("div", { className: "flex-shrink-0", children: action })
1663
+ ] })
1615
1664
  ] })
1616
1665
  ]
1617
1666
  }
@@ -2240,6 +2289,11 @@ var ALIGN_CLASSES = {
2240
2289
  center: "left-1/2 -translate-x-1/2",
2241
2290
  end: "right-0"
2242
2291
  };
2292
+ var SIDE_ALIGN_CLASSES = {
2293
+ start: "top-0",
2294
+ center: "top-1/2 -translate-y-1/2",
2295
+ end: "bottom-0"
2296
+ };
2243
2297
  var Popover = React14.forwardRef(
2244
2298
  ({
2245
2299
  className,
@@ -2284,7 +2338,7 @@ var Popover = React14.forwardRef(
2284
2338
  className: cn(
2285
2339
  "z-popover absolute w-72 rounded-lg border border-border bg-card p-4 shadow-lg",
2286
2340
  SIDE_CLASSES[side],
2287
- (side === "top" || side === "bottom") && ALIGN_CLASSES[align]
2341
+ side === "top" || side === "bottom" ? ALIGN_CLASSES[align] : SIDE_ALIGN_CLASSES[align]
2288
2342
  ),
2289
2343
  children
2290
2344
  }
@@ -5673,7 +5727,6 @@ export {
5673
5727
  TooltipProvider,
5674
5728
  TooltipTrigger,
5675
5729
  avatarVariants,
5676
- buildDiceBearUrl,
5677
5730
  buttonVariants,
5678
5731
  cn,
5679
5732
  fieldVariants,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caqophony/ui",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Generic, optional React UI reuse library (Gossamer tokens). Centrally maintained by Caqophony.",
5
5
  "license": "MIT",
6
6
  "author": "Caqophony",
@@ -62,6 +62,34 @@
62
62
  "LICENSE"
63
63
  ],
64
64
  "dependencies": {
65
+ "@dicebear/adventurer": "9.4.3",
66
+ "@dicebear/adventurer-neutral": "9.4.3",
67
+ "@dicebear/avataaars": "9.4.3",
68
+ "@dicebear/avataaars-neutral": "9.4.3",
69
+ "@dicebear/big-ears": "9.4.3",
70
+ "@dicebear/big-ears-neutral": "9.4.3",
71
+ "@dicebear/bottts": "9.4.3",
72
+ "@dicebear/bottts-neutral": "9.4.3",
73
+ "@dicebear/core": "9.4.3",
74
+ "@dicebear/croodles": "9.4.3",
75
+ "@dicebear/croodles-neutral": "9.4.3",
76
+ "@dicebear/fun-emoji": "9.4.3",
77
+ "@dicebear/icons": "9.4.3",
78
+ "@dicebear/identicon": "9.4.3",
79
+ "@dicebear/initials": "9.4.3",
80
+ "@dicebear/lorelei": "9.4.3",
81
+ "@dicebear/lorelei-neutral": "9.4.3",
82
+ "@dicebear/micah": "9.4.3",
83
+ "@dicebear/miniavs": "9.4.3",
84
+ "@dicebear/notionists": "9.4.3",
85
+ "@dicebear/notionists-neutral": "9.4.3",
86
+ "@dicebear/open-peeps": "9.4.3",
87
+ "@dicebear/personas": "9.4.3",
88
+ "@dicebear/pixel-art": "9.4.3",
89
+ "@dicebear/pixel-art-neutral": "9.4.3",
90
+ "@dicebear/rings": "9.4.3",
91
+ "@dicebear/shapes": "9.4.3",
92
+ "@dicebear/thumbs": "9.4.3",
65
93
  "@radix-ui/react-slot": "^1.1.0",
66
94
  "@radix-ui/react-switch": "^1.1.1",
67
95
  "@radix-ui/react-tooltip": "^1.1.3",