@caqophony/ui 0.9.6 → 0.9.8

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
@@ -418,19 +418,32 @@ interface ConfirmDialogProps {
418
418
  confirmVariant?: 'default' | 'destructive';
419
419
  /** Additional class for the dialog container */
420
420
  className?: string;
421
+ /**
422
+ * The confirmed action's failure, drawn inside the panel above the buttons
423
+ * (#7445). The dialog stays open: it closes only when the caller's success
424
+ * handler closes it, so the person sees why nothing happened and can retry or
425
+ * cancel. A failure drawn outside the dialog would sit under its overlay.
426
+ */
427
+ error?: string | null;
421
428
  }
422
- declare function ConfirmDialog({ title, message, confirmLabel, onConfirm, onCancel, isLoading, confirmTestId, cancelTestId, dialogTestId, cancelLabel, confirmVariant, className, }: ConfirmDialogProps): react_jsx_runtime.JSX.Element;
429
+ declare function ConfirmDialog({ title, message, confirmLabel, onConfirm, onCancel, isLoading, confirmTestId, cancelTestId, dialogTestId, cancelLabel, confirmVariant, className, error, }: ConfirmDialogProps): react_jsx_runtime.JSX.Element;
423
430
 
431
+ /**
432
+ * DiceBear avatars drawn in the app, with no request to a third-party host
433
+ * (#7507).
434
+ *
435
+ * Each style is its own package, loaded only when an avatar of that style is
436
+ * drawn, so a page that draws none loads none. `@dicebear/core` builds the
437
+ * SVG from the seed; the same seed and style always give the same image.
438
+ *
439
+ * Authored by Caqophony
440
+ */
424
441
  /** Supported DiceBear avatar styles */
425
442
  type DiceBearStyle = 'adventurer' | 'adventurer-neutral' | 'avataaars' | 'avataaars-neutral' | 'big-ears' | 'big-ears-neutral' | 'bottts' | 'bottts-neutral' | 'croodles' | 'croodles-neutral' | 'fun-emoji' | 'icons' | 'identicon' | 'initials' | 'lorelei' | 'lorelei-neutral' | 'micah' | 'miniavs' | 'notionists' | 'notionists-neutral' | 'open-peeps' | 'personas' | 'pixel-art' | 'pixel-art-neutral' | 'rings' | 'shapes' | 'thumbs';
443
+
426
444
  declare const avatarVariants: (props?: ({
427
445
  size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
428
446
  } & class_variance_authority_types.ClassProp) | undefined) => string;
429
- /**
430
- * Build a DiceBear avatar URL from a seed and style.
431
- * Deterministic — same seed + style always produces the same avatar.
432
- */
433
- declare function buildDiceBearUrl(seed: string, style?: DiceBearStyle): string;
434
447
  interface DiceBearAvatarProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof avatarVariants> {
435
448
  /** Seed string for deterministic avatar generation (e.g. agent ID or name) */
436
449
  seed: string;
@@ -2309,4 +2322,4 @@ declare function cn(...inputs: ClassValue[]): string;
2309
2322
 
2310
2323
  declare function useDebounce<T>(value: T, ms: number): T;
2311
2324
 
2312
- 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 };
2325
+ 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
@@ -1162,7 +1162,8 @@ function ConfirmDialog({
1162
1162
  dialogTestId,
1163
1163
  cancelLabel = "Cancel",
1164
1164
  confirmVariant = "default",
1165
- className
1165
+ className,
1166
+ error = null
1166
1167
  }) {
1167
1168
  const panel = React6.useRef(null);
1168
1169
  useModalSurface(true, panel, isLoading ? void 0 : onCancel);
@@ -1201,6 +1202,7 @@ function ConfirmDialog({
1201
1202
  children: message
1202
1203
  }
1203
1204
  ),
1205
+ /* @__PURE__ */ jsx10(FormError, { error, className: "mt-4" }),
1204
1206
  /* @__PURE__ */ jsxs7("div", { className: "mt-6 flex justify-end gap-3", children: [
1205
1207
  /* @__PURE__ */ jsx10(
1206
1208
  Button,
@@ -1237,6 +1239,44 @@ function ConfirmDialog({
1237
1239
  // src/dicebear-avatar.tsx
1238
1240
  import * as React7 from "react";
1239
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
1240
1280
  import { jsx as jsx11 } from "react/jsx-runtime";
1241
1281
  var avatarVariants = cva2(
1242
1282
  "relative inline-flex shrink-0 overflow-hidden rounded-full bg-muted dark:bg-muted",
@@ -1256,11 +1296,6 @@ var avatarVariants = cva2(
1256
1296
  }
1257
1297
  }
1258
1298
  );
1259
- var DICEBEAR_BASE_URL = "https://api.dicebear.com/9.x";
1260
- function buildDiceBearUrl(seed, style = "adventurer-neutral") {
1261
- const encodedSeed = encodeURIComponent(seed);
1262
- return `${DICEBEAR_BASE_URL}/${style}/svg?seed=${encodedSeed}`;
1263
- }
1264
1299
  var DiceBearAvatar = React7.forwardRef(
1265
1300
  ({
1266
1301
  seed,
@@ -1271,10 +1306,23 @@ var DiceBearAvatar = React7.forwardRef(
1271
1306
  className,
1272
1307
  ...props
1273
1308
  }, ref) => {
1309
+ const [src, setSrc] = React7.useState(null);
1274
1310
  const [hasError, setHasError] = React7.useState(false);
1275
- const url = buildDiceBearUrl(seed, avatarStyle);
1276
1311
  React7.useEffect(() => {
1312
+ let live = true;
1313
+ setSrc(null);
1277
1314
  setHasError(false);
1315
+ diceBearDataUri(seed, avatarStyle).then(
1316
+ (uri) => {
1317
+ if (live) setSrc(uri);
1318
+ },
1319
+ () => {
1320
+ if (live) setHasError(true);
1321
+ }
1322
+ );
1323
+ return () => {
1324
+ live = false;
1325
+ };
1278
1326
  }, [seed, avatarStyle]);
1279
1327
  return /* @__PURE__ */ jsx11(
1280
1328
  "div",
@@ -1282,10 +1330,10 @@ var DiceBearAvatar = React7.forwardRef(
1282
1330
  ref,
1283
1331
  className: cn(avatarVariants({ size }), className),
1284
1332
  ...props,
1285
- 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(
1333
+ 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(
1286
1334
  "img",
1287
1335
  {
1288
- src: url,
1336
+ src,
1289
1337
  alt,
1290
1338
  className: "h-full w-full object-cover",
1291
1339
  onError: () => setHasError(true)
@@ -2238,6 +2286,11 @@ var ALIGN_CLASSES = {
2238
2286
  center: "left-1/2 -translate-x-1/2",
2239
2287
  end: "right-0"
2240
2288
  };
2289
+ var SIDE_ALIGN_CLASSES = {
2290
+ start: "top-0",
2291
+ center: "top-1/2 -translate-y-1/2",
2292
+ end: "bottom-0"
2293
+ };
2241
2294
  var Popover = React14.forwardRef(
2242
2295
  ({
2243
2296
  className,
@@ -2282,7 +2335,7 @@ var Popover = React14.forwardRef(
2282
2335
  className: cn(
2283
2336
  "z-popover absolute w-72 rounded-lg border border-border bg-card p-4 shadow-lg",
2284
2337
  SIDE_CLASSES[side],
2285
- (side === "top" || side === "bottom") && ALIGN_CLASSES[align]
2338
+ side === "top" || side === "bottom" ? ALIGN_CLASSES[align] : SIDE_ALIGN_CLASSES[align]
2286
2339
  ),
2287
2340
  children
2288
2341
  }
@@ -5671,7 +5724,6 @@ export {
5671
5724
  TooltipProvider,
5672
5725
  TooltipTrigger,
5673
5726
  avatarVariants,
5674
- buildDiceBearUrl,
5675
5727
  buttonVariants,
5676
5728
  cn,
5677
5729
  fieldVariants,
@@ -590,7 +590,12 @@ interface TextProps {
590
590
  align?: 'start' | 'center';
591
591
  /** Cap the line length for reading. */
592
592
  measure?: boolean;
593
- as?: 'p' | 'span' | 'div';
593
+ /**
594
+ * The element. `h3` and `h4` make a small heading on the body face: a
595
+ * feature or card title under a band's `Display` heading, sized by `size`
596
+ * and `weight` like any running text (#6958 item 8).
597
+ */
598
+ as?: 'p' | 'span' | 'div' | 'h3' | 'h4';
594
599
  children: ReactNode;
595
600
  }
596
601
  /** Running text on the theme's body face. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caqophony/ui",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
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",