@bison-lab/ui 3.3.0 → 3.7.0

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.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { t as cn } from "./utils-DPv8mMhD.mjs";
3
3
  import * as React from "react";
4
- import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateDestructiveScaleCSS, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
4
+ import { contrastLevelLabel, contrastVerdict, defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateDestructiveScaleCSS, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, typeScale, zIndexTokens } from "@bison-lab/tokens";
5
+ import { fontFaceCss, fontPreloads, fontStack, isFontId } from "@bison-lab/fonts";
5
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
7
  import { AnimatePresence, motion } from "motion/react";
7
8
  import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, unstable_PasswordToggleField } from "radix-ui";
@@ -235,42 +236,57 @@ function buildGoogleFontsUrl(fonts) {
235
236
  return `family=${font.family.replace(/ /g, "+")}:wght@${sortedWeights.join(";")}`;
236
237
  }).join("&")}&display=swap`;
237
238
  }
239
+ /**
240
+ * The `font-family` value: the catalogue stack for an id, the quoted family
241
+ * for the Google form. A bare string that is not an id is a family name
242
+ * from before the catalogue (a CMS row, an older config) and is quoted the
243
+ * way `buildThemeCss` quotes it, so it never renders as `"undefined"`.
244
+ */
238
245
  function fontFamilyValue(font, fallback) {
239
- return `"${font.family}", ${fallback}`;
240
- }
241
- function BisonProvider({ children, brandColors, radius = "rounded", shadow = "subtle", motion = "smooth", density = "default", attribute = "data-theme", defaultTheme = "system", storageKey = "bison-theme", bodyFont = {
242
- family: "Inter",
243
- weights: [
244
- 400,
245
- 500,
246
- 600,
247
- 700
248
- ]
249
- }, headingFont, monoFont = {
250
- family: "JetBrains Mono",
251
- weights: [
252
- 400,
253
- 500,
254
- 600,
255
- 700
256
- ]
257
- }, fontWeights = defaultFontWeights }) {
246
+ if (isFontId(font)) return fontStack(font);
247
+ return `"${typeof font === "string" ? font : font.family}", ${fallback}`;
248
+ }
249
+ function isGoogleFont(font) {
250
+ return typeof font === "object" && font !== null;
251
+ }
252
+ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "subtle", motion = "smooth", density = "default", attribute = "data-theme", defaultTheme = "system", storageKey = "bison-theme", bodyFont = "inter", headingFont, monoFont = "jetbrains-mono", fontsBaseUrl = "/fonts", fontWeights = defaultFontWeights }) {
258
253
  const resolvedHeadingFont = headingFont ?? bodyFont;
259
254
  const lightPalette = React.useMemo(() => deriveLightPalette(brandColors), [brandColors]);
260
255
  const darkPalette = React.useMemo(() => deriveDarkPalette(brandColors), [brandColors]);
261
256
  const scaleCSS = React.useMemo(() => {
262
257
  return `${generateScaleCSS(generateBrandScales(brandColors))}\n${generateDestructiveScaleCSS()}`;
263
258
  }, [brandColors]);
259
+ const catalogueIds = React.useMemo(() => [
260
+ bodyFont,
261
+ resolvedHeadingFont,
262
+ monoFont
263
+ ].filter(isFontId), [
264
+ bodyFont,
265
+ resolvedHeadingFont,
266
+ monoFont
267
+ ]);
264
268
  const fontsUrl = React.useMemo(() => {
265
- const fonts = [bodyFont];
266
- if (headingFont && headingFont.family !== bodyFont.family) fonts.push(headingFont);
267
- if (monoFont.family !== bodyFont.family) fonts.push(monoFont);
268
- return buildGoogleFontsUrl(fonts);
269
+ const seen = /* @__PURE__ */ new Set();
270
+ const fonts = [
271
+ bodyFont,
272
+ resolvedHeadingFont,
273
+ monoFont
274
+ ].filter(isGoogleFont).filter((font) => {
275
+ if (seen.has(font.family)) return false;
276
+ seen.add(font.family);
277
+ return true;
278
+ });
279
+ return fonts.length > 0 ? buildGoogleFontsUrl(fonts) : null;
269
280
  }, [
270
281
  bodyFont,
271
- headingFont,
282
+ resolvedHeadingFont,
272
283
  monoFont
273
284
  ]);
285
+ const preloads = React.useMemo(() => fontPreloads([bodyFont, resolvedHeadingFont].filter(isFontId), fontsBaseUrl), [
286
+ bodyFont,
287
+ resolvedHeadingFont,
288
+ fontsBaseUrl
289
+ ]);
274
290
  const styleContent = React.useMemo(() => {
275
291
  const radiusVars = radiusPresets[radius];
276
292
  const shadowVars = shadowPresets[shadow];
@@ -289,13 +305,16 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
289
305
  const lightColorVars = Object.entries(lightPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
290
306
  const darkColorVars = Object.entries(darkPalette).map(([key, value]) => ` --${key}: ${value};`).join("\n");
291
307
  const zIndexVars = Object.entries(zIndexTokens).map(([key, value]) => ` ${key}: ${value};`).join("\n");
292
- return `:root {\n${lightColorVars}\n\n${scaleCSS}\n${[
308
+ const presetVars = [
293
309
  ...Object.entries(radiusVars),
294
310
  ...Object.entries(shadowVars),
295
311
  ...Object.entries(motionVars),
296
312
  ...Object.entries(densityVars),
297
313
  ...Object.entries(fontVars)
298
- ].map(([key, value]) => ` ${key}: ${value};`).join("\n")}\n${zIndexVars}\n font-family: var(--font-body);\n}\n\n${attribute === "class" ? ".dark" : "[data-theme=\"dark\"]"} {\n${darkColorVars}\n}`;
314
+ ].map(([key, value]) => ` ${key}: ${value};`).join("\n");
315
+ const darkSelector = attribute === "class" ? ".dark" : "[data-theme=\"dark\"]";
316
+ const fontFaces = fontFaceCss(catalogueIds, fontsBaseUrl);
317
+ return `${fontFaces ? `${fontFaces}\n\n` : ""}:root {\n${lightColorVars}\n\n${scaleCSS}\n${presetVars}\n${zIndexVars}\n font-family: var(--font-body);\n}\n\n${darkSelector} {\n${darkColorVars}\n}`;
299
318
  }, [
300
319
  radius,
301
320
  shadow,
@@ -308,22 +327,33 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
308
327
  fontWeights,
309
328
  lightPalette,
310
329
  darkPalette,
311
- scaleCSS
330
+ scaleCSS,
331
+ catalogueIds,
332
+ fontsBaseUrl
312
333
  ]);
313
334
  return /* @__PURE__ */ jsxs(Fragment, { children: [
314
- /* @__PURE__ */ jsx("link", {
315
- rel: "preconnect",
316
- href: "https://fonts.googleapis.com"
317
- }),
318
- /* @__PURE__ */ jsx("link", {
319
- rel: "preconnect",
320
- href: "https://fonts.gstatic.com",
335
+ preloads.map((preload) => /* @__PURE__ */ jsx("link", {
336
+ rel: "preload",
337
+ as: "font",
338
+ type: preload.type,
339
+ href: preload.href,
321
340
  crossOrigin: "anonymous"
322
- }),
323
- /* @__PURE__ */ jsx("link", {
324
- rel: "stylesheet",
325
- href: fontsUrl
326
- }),
341
+ }, preload.href)),
342
+ fontsUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
343
+ /* @__PURE__ */ jsx("link", {
344
+ rel: "preconnect",
345
+ href: "https://fonts.googleapis.com"
346
+ }),
347
+ /* @__PURE__ */ jsx("link", {
348
+ rel: "preconnect",
349
+ href: "https://fonts.gstatic.com",
350
+ crossOrigin: "anonymous"
351
+ }),
352
+ /* @__PURE__ */ jsx("link", {
353
+ rel: "stylesheet",
354
+ href: fontsUrl
355
+ })
356
+ ] }),
327
357
  /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styleContent } }),
328
358
  /* @__PURE__ */ jsx(ThemeProvider, {
329
359
  defaultTheme,
@@ -8342,6 +8372,584 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
8342
8372
  });
8343
8373
  }
8344
8374
  //#endregion
8345
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FieldGroupScope, FieldProvider, FloatingNavBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, InputGroup, JsonLd, Label, MaintenanceBlock, MediaCard, MegaMenuPanel, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ResourcesBlock, ReviewsBlock, RotatingBadge, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialFeedBlock, SocialProviders, Spinner, StatsBandBlock, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TestimonialCarousel, TestimonialMasonry, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, TimePicker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, formatUsPhone, megaMenuGridColumns, megaMenuToFloatingNavItems, napRecordToJsonLd, navigationMenuTriggerStyle, newTabAttributes, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, renderPlainLink, spinnerVariants, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, switchVariants, testimonialInitials, toast, useCarousel, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFormContext, useHideOnScroll, useIsMobile, useScrollReveal, useSidebar, useTheme };
8375
+ //#region src/blocks/showcase/theme-showcase.tsx
8376
+ /** Every section, in the order the showcase renders them. */
8377
+ const themeShowcaseSections = [
8378
+ "typography",
8379
+ "buttons",
8380
+ "forms",
8381
+ "surfaces",
8382
+ "brand"
8383
+ ];
8384
+ const SECTION_TITLES = {
8385
+ typography: "Typography",
8386
+ buttons: "Buttons",
8387
+ forms: "Form controls",
8388
+ surfaces: "Surfaces",
8389
+ brand: "Brand band"
8390
+ };
8391
+ const SAMPLE = "The quick brown fox jumps over the lazy dog";
8392
+ const HEADING_STEPS = [
8393
+ "heading-2xl",
8394
+ "heading-xl",
8395
+ "heading-lg",
8396
+ "heading-md",
8397
+ "heading-sm"
8398
+ ];
8399
+ const BODY_STEPS = [
8400
+ "text-xl",
8401
+ "text-lg",
8402
+ "text-base",
8403
+ "text-sm",
8404
+ "text-xs"
8405
+ ];
8406
+ const BUTTON_VARIANTS = [
8407
+ "default",
8408
+ "secondary",
8409
+ "accent",
8410
+ "highlight",
8411
+ "destructive",
8412
+ "outline",
8413
+ "ghost",
8414
+ "link",
8415
+ "actionNeutral",
8416
+ "actionPositive",
8417
+ "actionNegative"
8418
+ ];
8419
+ const BUTTON_LABELS = {
8420
+ default: "Default",
8421
+ secondary: "Secondary",
8422
+ accent: "Accent",
8423
+ highlight: "Highlight",
8424
+ destructive: "Destructive",
8425
+ outline: "Outline",
8426
+ ghost: "Ghost",
8427
+ link: "Link",
8428
+ actionNeutral: "Neutral action",
8429
+ actionPositive: "Positive action",
8430
+ actionNegative: "Negative action"
8431
+ };
8432
+ const BADGE_VARIANTS = [
8433
+ "default",
8434
+ "secondary",
8435
+ "accent",
8436
+ "highlight",
8437
+ "destructive",
8438
+ "outline",
8439
+ "success",
8440
+ "warning",
8441
+ "error",
8442
+ "info"
8443
+ ];
8444
+ /** Every non-deprecated tone. `info` is the one driven by the brand primary, so it is the one a theme change restyles. */
8445
+ const ALERT_VARIANTS = [
8446
+ "default",
8447
+ "info",
8448
+ "success",
8449
+ "warning",
8450
+ "destructive"
8451
+ ];
8452
+ const ORDERS = [
8453
+ {
8454
+ id: "BL-1042",
8455
+ item: "Field guide, hardback",
8456
+ status: "Shipped",
8457
+ total: "$48.00"
8458
+ },
8459
+ {
8460
+ id: "BL-1043",
8461
+ item: "Trail map set",
8462
+ status: "Packed",
8463
+ total: "$22.50"
8464
+ },
8465
+ {
8466
+ id: "BL-1044",
8467
+ item: "Annual membership",
8468
+ status: "Paid",
8469
+ total: "$120.00"
8470
+ },
8471
+ {
8472
+ id: "BL-1045",
8473
+ item: "Workshop seat",
8474
+ status: "Pending",
8475
+ total: "$65.00"
8476
+ }
8477
+ ];
8478
+ const PROSE = `<p>Bison Lab ships a <strong>moderately opinionated</strong> design system: the spacing grid and the type scale are locked, the presets are <em>curated</em>, and the brand is yours. Every token is a CSS custom property such as <code>--primary</code>, and the <a href="#theme-showcase-typography">inline link</a> takes the primary colour.</p>`;
8479
+ function Section({ id, title, children }) {
8480
+ const headingId = `theme-showcase-${id}-heading`;
8481
+ return /* @__PURE__ */ jsxs("section", {
8482
+ id: `theme-showcase-${id}`,
8483
+ "aria-labelledby": headingId,
8484
+ className: "space-y-6",
8485
+ children: [/* @__PURE__ */ jsx("h2", {
8486
+ id: headingId,
8487
+ className: "font-heading text-xl font-semibold tracking-tight",
8488
+ children: title
8489
+ }), children]
8490
+ });
8491
+ }
8492
+ function Typography() {
8493
+ return /* @__PURE__ */ jsxs("div", {
8494
+ className: "space-y-8",
8495
+ children: [
8496
+ /* @__PURE__ */ jsx("div", {
8497
+ className: "space-y-3",
8498
+ children: HEADING_STEPS.map((step) => {
8499
+ const scale = typeScale[step];
8500
+ return /* @__PURE__ */ jsxs("div", {
8501
+ className: "flex flex-col gap-1 sm:flex-row sm:items-baseline sm:gap-6",
8502
+ children: [/* @__PURE__ */ jsx("span", {
8503
+ className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
8504
+ children: step
8505
+ }), /* @__PURE__ */ jsx("p", {
8506
+ className: "font-heading font-bold",
8507
+ style: {
8508
+ fontSize: scale.fontSize,
8509
+ lineHeight: scale.lineHeight,
8510
+ letterSpacing: scale.letterSpacing
8511
+ },
8512
+ children: SAMPLE
8513
+ })]
8514
+ }, step);
8515
+ })
8516
+ }),
8517
+ /* @__PURE__ */ jsx("div", {
8518
+ className: "space-y-2",
8519
+ children: BODY_STEPS.map((step) => {
8520
+ const scale = typeScale[step];
8521
+ return /* @__PURE__ */ jsxs("div", {
8522
+ className: "flex flex-col gap-1 sm:flex-row sm:items-baseline sm:gap-6",
8523
+ children: [/* @__PURE__ */ jsx("span", {
8524
+ className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
8525
+ children: step
8526
+ }), /* @__PURE__ */ jsx("p", {
8527
+ style: {
8528
+ fontSize: scale.fontSize,
8529
+ lineHeight: scale.lineHeight
8530
+ },
8531
+ children: SAMPLE
8532
+ })]
8533
+ }, step);
8534
+ })
8535
+ }),
8536
+ /* @__PURE__ */ jsx(TextContent, {
8537
+ content: PROSE,
8538
+ className: "max-w-prose"
8539
+ }),
8540
+ /* @__PURE__ */ jsx("p", {
8541
+ className: "text-sm text-muted-foreground",
8542
+ children: "Supporting copy in muted-foreground: captions, hints, table labels and the footer line."
8543
+ })
8544
+ ]
8545
+ });
8546
+ }
8547
+ function Buttons() {
8548
+ return /* @__PURE__ */ jsxs("div", {
8549
+ className: "space-y-6",
8550
+ children: [
8551
+ /* @__PURE__ */ jsx("div", {
8552
+ className: "flex flex-wrap gap-3",
8553
+ children: BUTTON_VARIANTS.map((variant) => /* @__PURE__ */ jsx(Button, {
8554
+ variant,
8555
+ children: BUTTON_LABELS[variant]
8556
+ }, variant))
8557
+ }),
8558
+ /* @__PURE__ */ jsxs("div", {
8559
+ className: "flex flex-wrap items-center gap-3",
8560
+ children: [
8561
+ /* @__PURE__ */ jsx(Button, {
8562
+ size: "sm",
8563
+ children: "Small"
8564
+ }),
8565
+ /* @__PURE__ */ jsx(Button, {
8566
+ size: "md",
8567
+ children: "Medium"
8568
+ }),
8569
+ /* @__PURE__ */ jsx(Button, {
8570
+ size: "lg",
8571
+ children: "Large"
8572
+ }),
8573
+ /* @__PURE__ */ jsx(Button, {
8574
+ size: "icon",
8575
+ "aria-label": "Icon button",
8576
+ children: /* @__PURE__ */ jsx("span", {
8577
+ "aria-hidden": "true",
8578
+ children: "+"
8579
+ })
8580
+ }),
8581
+ /* @__PURE__ */ jsx(Button, {
8582
+ disabled: true,
8583
+ children: "Disabled"
8584
+ })
8585
+ ]
8586
+ }),
8587
+ /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: "On a card" }), /* @__PURE__ */ jsx(CardDescription, { children: "Outline and ghost read against the card surface, not the page." })] }), /* @__PURE__ */ jsxs(CardContent, {
8588
+ className: "flex flex-wrap gap-3",
8589
+ children: [
8590
+ /* @__PURE__ */ jsx(Button, { children: "Default" }),
8591
+ /* @__PURE__ */ jsx(Button, {
8592
+ variant: "outline",
8593
+ children: "Outline"
8594
+ }),
8595
+ /* @__PURE__ */ jsx(Button, {
8596
+ variant: "ghost",
8597
+ children: "Ghost"
8598
+ })
8599
+ ]
8600
+ })] })
8601
+ ]
8602
+ });
8603
+ }
8604
+ function Forms() {
8605
+ const id = React.useId();
8606
+ return /* @__PURE__ */ jsxs("div", {
8607
+ className: "grid gap-6 md:grid-cols-2",
8608
+ children: [
8609
+ /* @__PURE__ */ jsx(InputGroup, {
8610
+ label: "Full name",
8611
+ hint: "As it appears on your membership card.",
8612
+ children: /* @__PURE__ */ jsx(Input, { placeholder: "Ada Lovelace" })
8613
+ }),
8614
+ /* @__PURE__ */ jsx(InputGroup, {
8615
+ label: "Plan",
8616
+ children: /* @__PURE__ */ jsxs(Select, {
8617
+ defaultValue: "team",
8618
+ children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Choose a plan" }) }), /* @__PURE__ */ jsxs(SelectContent, { children: [
8619
+ /* @__PURE__ */ jsx(SelectItem, {
8620
+ value: "starter",
8621
+ children: "Starter"
8622
+ }),
8623
+ /* @__PURE__ */ jsx(SelectItem, {
8624
+ value: "team",
8625
+ children: "Team"
8626
+ }),
8627
+ /* @__PURE__ */ jsx(SelectItem, {
8628
+ value: "enterprise",
8629
+ children: "Enterprise"
8630
+ })
8631
+ ] })]
8632
+ })
8633
+ }),
8634
+ /* @__PURE__ */ jsxs("div", {
8635
+ className: "space-y-3",
8636
+ children: [
8637
+ /* @__PURE__ */ jsxs("div", {
8638
+ className: "flex items-center gap-2",
8639
+ children: [/* @__PURE__ */ jsx(Checkbox, {
8640
+ id: `${id}-updates`,
8641
+ defaultChecked: true
8642
+ }), /* @__PURE__ */ jsx(Label, {
8643
+ htmlFor: `${id}-updates`,
8644
+ layout: "inline",
8645
+ children: "Email me about updates"
8646
+ })]
8647
+ }),
8648
+ /* @__PURE__ */ jsxs("div", {
8649
+ className: "flex items-center gap-2",
8650
+ children: [/* @__PURE__ */ jsx(Checkbox, { id: `${id}-terms` }), /* @__PURE__ */ jsx(Label, {
8651
+ htmlFor: `${id}-terms`,
8652
+ layout: "inline",
8653
+ children: "I agree to the terms"
8654
+ })]
8655
+ }),
8656
+ /* @__PURE__ */ jsxs("div", {
8657
+ className: "flex items-center gap-2",
8658
+ children: [/* @__PURE__ */ jsx(Switch, {
8659
+ id: `${id}-notify`,
8660
+ defaultChecked: true
8661
+ }), /* @__PURE__ */ jsx(Label, {
8662
+ htmlFor: `${id}-notify`,
8663
+ layout: "inline",
8664
+ children: "Notifications"
8665
+ })]
8666
+ })
8667
+ ]
8668
+ }),
8669
+ /* @__PURE__ */ jsx(RadioGroup, {
8670
+ defaultValue: "monthly",
8671
+ "aria-label": "Billing period",
8672
+ className: "space-y-2",
8673
+ children: [
8674
+ ["monthly", "Monthly"],
8675
+ ["yearly", "Yearly"],
8676
+ ["lifetime", "Lifetime"]
8677
+ ].map(([value, label]) => /* @__PURE__ */ jsxs("div", {
8678
+ className: "flex items-center gap-2",
8679
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
8680
+ value,
8681
+ id: `${id}-${value}`
8682
+ }), /* @__PURE__ */ jsx(Label, {
8683
+ htmlFor: `${id}-${value}`,
8684
+ layout: "inline",
8685
+ children: label
8686
+ })]
8687
+ }, value))
8688
+ }),
8689
+ /* @__PURE__ */ jsx(InputGroup, {
8690
+ label: "Email",
8691
+ error: "Enter a valid email address.",
8692
+ children: /* @__PURE__ */ jsx(Input, {
8693
+ type: "email",
8694
+ defaultValue: "ada@example"
8695
+ })
8696
+ })
8697
+ ]
8698
+ });
8699
+ }
8700
+ function Surfaces() {
8701
+ return /* @__PURE__ */ jsxs("div", {
8702
+ className: "space-y-6",
8703
+ children: [
8704
+ /* @__PURE__ */ jsxs("div", {
8705
+ className: "grid gap-6 md:grid-cols-2",
8706
+ children: [/* @__PURE__ */ jsxs(Card, { children: [
8707
+ /* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: "Membership" }), /* @__PURE__ */ jsx(CardDescription, { children: "Renews on the first of the month." })] }),
8708
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("p", {
8709
+ className: "text-sm",
8710
+ children: "Card body text sits on the card surface, one step above the page."
8711
+ }) }),
8712
+ /* @__PURE__ */ jsxs(CardFooter, {
8713
+ className: "gap-3",
8714
+ children: [/* @__PURE__ */ jsx(Button, {
8715
+ size: "sm",
8716
+ children: "Renew"
8717
+ }), /* @__PURE__ */ jsx(Button, {
8718
+ size: "sm",
8719
+ variant: "outline",
8720
+ children: "Manage"
8721
+ })]
8722
+ })
8723
+ ] }), /* @__PURE__ */ jsx("div", {
8724
+ className: "space-y-3",
8725
+ children: ALERT_VARIANTS.map((variant) => /* @__PURE__ */ jsxs(Alert, {
8726
+ variant,
8727
+ showIcon: true,
8728
+ children: [/* @__PURE__ */ jsx(AlertTitle, {
8729
+ className: "capitalize",
8730
+ children: variant
8731
+ }), /* @__PURE__ */ jsxs(AlertDescription, { children: [
8732
+ "An alert in the ",
8733
+ variant,
8734
+ " tone, with its icon."
8735
+ ] })]
8736
+ }, variant))
8737
+ })]
8738
+ }),
8739
+ /* @__PURE__ */ jsx("div", {
8740
+ className: "flex flex-wrap gap-2",
8741
+ children: BADGE_VARIANTS.map((variant) => /* @__PURE__ */ jsx(Badge, {
8742
+ variant,
8743
+ className: "capitalize",
8744
+ children: variant
8745
+ }, variant))
8746
+ }),
8747
+ /* @__PURE__ */ jsxs(Tabs, {
8748
+ defaultValue: "overview",
8749
+ children: [
8750
+ /* @__PURE__ */ jsxs(TabsList, { children: [
8751
+ /* @__PURE__ */ jsx(TabsTrigger, {
8752
+ value: "overview",
8753
+ children: "Overview"
8754
+ }),
8755
+ /* @__PURE__ */ jsx(TabsTrigger, {
8756
+ value: "activity",
8757
+ children: "Activity"
8758
+ }),
8759
+ /* @__PURE__ */ jsx(TabsTrigger, {
8760
+ value: "settings",
8761
+ children: "Settings"
8762
+ })
8763
+ ] }),
8764
+ /* @__PURE__ */ jsx(TabsContent, {
8765
+ value: "overview",
8766
+ className: "text-sm text-muted-foreground",
8767
+ children: "The overview tab is selected."
8768
+ }),
8769
+ /* @__PURE__ */ jsx(TabsContent, {
8770
+ value: "activity",
8771
+ className: "text-sm text-muted-foreground",
8772
+ children: "Recent activity would list here."
8773
+ }),
8774
+ /* @__PURE__ */ jsx(TabsContent, {
8775
+ value: "settings",
8776
+ className: "text-sm text-muted-foreground",
8777
+ children: "Settings for this view."
8778
+ })
8779
+ ]
8780
+ }),
8781
+ /* @__PURE__ */ jsxs(Table, { children: [
8782
+ /* @__PURE__ */ jsx(TableCaption, { children: "Recent orders" }),
8783
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
8784
+ /* @__PURE__ */ jsx(TableHead, { children: "Order" }),
8785
+ /* @__PURE__ */ jsx(TableHead, { children: "Item" }),
8786
+ /* @__PURE__ */ jsx(TableHead, { children: "Status" }),
8787
+ /* @__PURE__ */ jsx(TableHead, {
8788
+ className: "text-right",
8789
+ children: "Total"
8790
+ })
8791
+ ] }) }),
8792
+ /* @__PURE__ */ jsx(TableBody, { children: ORDERS.map((order) => /* @__PURE__ */ jsxs(TableRow, { children: [
8793
+ /* @__PURE__ */ jsx(TableCell, {
8794
+ className: "font-medium",
8795
+ children: order.id
8796
+ }),
8797
+ /* @__PURE__ */ jsx(TableCell, { children: order.item }),
8798
+ /* @__PURE__ */ jsx(TableCell, { children: order.status }),
8799
+ /* @__PURE__ */ jsx(TableCell, {
8800
+ className: "text-right tabular-nums",
8801
+ children: order.total
8802
+ })
8803
+ ] }, order.id)) })
8804
+ ] })
8805
+ ]
8806
+ });
8807
+ }
8808
+ function BrandBand() {
8809
+ return /* @__PURE__ */ jsxs("div", {
8810
+ className: "rounded-lg bg-brand-accent px-6 py-10 text-brand-accent-foreground md:px-10",
8811
+ children: [
8812
+ /* @__PURE__ */ jsx("p", {
8813
+ className: "text-xs font-semibold uppercase tracking-wide text-highlight",
8814
+ children: "Built on the brand accent"
8815
+ }),
8816
+ /* @__PURE__ */ jsx("h3", {
8817
+ className: "mt-2 font-heading text-2xl font-bold tracking-tight md:text-3xl",
8818
+ children: "Light copy on the accent fill is where a dark theme shows its mistakes first."
8819
+ }),
8820
+ /* @__PURE__ */ jsx("p", {
8821
+ className: "mt-3 max-w-prose text-base",
8822
+ children: "The eyebrow takes the highlight colour, the copy takes the accent foreground, and the button is the primary fill on top of it all."
8823
+ }),
8824
+ /* @__PURE__ */ jsx("div", {
8825
+ className: "mt-6",
8826
+ children: /* @__PURE__ */ jsx(Button, { children: "Start a project" })
8827
+ })
8828
+ ]
8829
+ });
8830
+ }
8831
+ const SECTION_BODIES = {
8832
+ typography: Typography,
8833
+ buttons: Buttons,
8834
+ forms: Forms,
8835
+ surfaces: Surfaces,
8836
+ brand: BrandBand
8837
+ };
8838
+ /**
8839
+ * A fixed gallery of real components, so a theme is judged on what it
8840
+ * actually restyles. No theme of its own: it renders under whatever tokens
8841
+ * are in scope, and light or dark is the caller's `data-theme`. The
8842
+ * contrast strip is not inside it; the preview and the story put one at
8843
+ * its foot with the audit for the theme they render.
8844
+ */
8845
+ const ThemeShowcase = React.forwardRef(({ className, sections = themeShowcaseSections }, ref) => {
8846
+ const wanted = new Set(sections);
8847
+ return /* @__PURE__ */ jsx("div", {
8848
+ ref,
8849
+ className: cn("space-y-12 bg-background p-6 text-foreground md:p-10", className),
8850
+ children: themeShowcaseSections.filter((section) => wanted.has(section)).map((section) => {
8851
+ const Body = SECTION_BODIES[section];
8852
+ return /* @__PURE__ */ jsx(Section, {
8853
+ id: section,
8854
+ title: SECTION_TITLES[section],
8855
+ children: /* @__PURE__ */ jsx(Body, {})
8856
+ }, section);
8857
+ })
8858
+ });
8859
+ });
8860
+ ThemeShowcase.displayName = "ThemeShowcase";
8861
+ //#endregion
8862
+ //#region src/blocks/showcase/contrast-strip.tsx
8863
+ const LEVEL_ICONS = {
8864
+ aaa: CircleCheck,
8865
+ aa: CircleCheck,
8866
+ "aa-large": Minus,
8867
+ fail: TriangleAlert
8868
+ };
8869
+ const MODE_LABEL = {
8870
+ light: "Light",
8871
+ dark: "Dark"
8872
+ };
8873
+ /**
8874
+ * The contrast audit as swatch pairs. Every row says its verdict in words
8875
+ * and an icon beside the ratio, so colour never carries the meaning alone
8876
+ * (WCAG 1.4.1), and the swatch is drawn in the colours that were measured,
8877
+ * not the tokens currently in scope. A failing row carries `data-failing`
8878
+ * so the admin can count them.
8879
+ */
8880
+ const ContrastStrip = React.forwardRef(({ checks, mode = "both", failingOnly = false, className, ...props }, ref) => {
8881
+ const modes = mode === "both" ? ["light", "dark"] : [mode];
8882
+ const rows = checks.flatMap((check) => modes.map((m) => ({
8883
+ check,
8884
+ mode: m,
8885
+ sample: check[m],
8886
+ failing: check[m].ratio < check.target
8887
+ })));
8888
+ const shown = failingOnly ? rows.filter((row) => row.failing) : rows;
8889
+ return /* @__PURE__ */ jsx("div", {
8890
+ ref,
8891
+ className: cn("text-sm text-foreground", className),
8892
+ ...props,
8893
+ children: shown.length === 0 ? /* @__PURE__ */ jsx("p", {
8894
+ className: "text-muted-foreground",
8895
+ children: "Every pairing meets its target."
8896
+ }) : /* @__PURE__ */ jsx("ul", {
8897
+ className: "divide-y divide-border rounded-lg border border-border bg-card",
8898
+ children: shown.map(({ check, mode: m, sample, failing }) => {
8899
+ const Icon = LEVEL_ICONS[sample.level];
8900
+ const verdict = contrastVerdict(sample, check.target);
8901
+ return /* @__PURE__ */ jsxs("li", {
8902
+ "data-failing": failing ? "" : void 0,
8903
+ className: "flex flex-wrap items-center gap-x-4 gap-y-1 px-3 py-2",
8904
+ children: [
8905
+ /* @__PURE__ */ jsx("span", {
8906
+ "aria-hidden": "true",
8907
+ "data-testid": `contrast-swatch-${check.id}-${m}`,
8908
+ className: "inline-flex h-9 w-12 shrink-0 items-center justify-center rounded border border-border font-semibold",
8909
+ style: {
8910
+ color: `hsl(${sample.foreground})`,
8911
+ backgroundColor: `hsl(${sample.background})`
8912
+ },
8913
+ children: "Aa"
8914
+ }),
8915
+ /* @__PURE__ */ jsxs("span", {
8916
+ className: "w-16 shrink-0 tabular-nums",
8917
+ children: [sample.ratio.toFixed(2), ":1"]
8918
+ }),
8919
+ /* @__PURE__ */ jsxs("span", {
8920
+ className: "inline-flex w-24 shrink-0 items-center gap-1",
8921
+ children: [/* @__PURE__ */ jsx(Icon, {
8922
+ className: "size-4 shrink-0",
8923
+ "aria-hidden": "true"
8924
+ }), contrastLevelLabel(sample.level)]
8925
+ }),
8926
+ /* @__PURE__ */ jsx("span", {
8927
+ className: cn("w-24 shrink-0 font-medium", failing ? "text-destructive-700 dark:text-destructive-300" : "text-success-700 dark:text-success-300"),
8928
+ children: verdict.text
8929
+ }),
8930
+ /* @__PURE__ */ jsxs("span", {
8931
+ className: "min-w-0 flex-1 text-muted-foreground",
8932
+ children: [
8933
+ check.label,
8934
+ " ",
8935
+ /* @__PURE__ */ jsxs("span", {
8936
+ className: "whitespace-nowrap",
8937
+ children: [
8938
+ "(",
8939
+ MODE_LABEL[m],
8940
+ ")"
8941
+ ]
8942
+ })
8943
+ ]
8944
+ })
8945
+ ]
8946
+ }, `${check.id}-${m}`);
8947
+ })
8948
+ })
8949
+ });
8950
+ });
8951
+ ContrastStrip.displayName = "ContrastStrip";
8952
+ //#endregion
8953
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContrastStrip, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FieldGroupScope, FieldProvider, FloatingNavBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, InputGroup, JsonLd, Label, MaintenanceBlock, MediaCard, MegaMenuPanel, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ResourcesBlock, ReviewsBlock, RotatingBadge, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialFeedBlock, SocialProviders, Spinner, StatsBandBlock, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TestimonialCarousel, TestimonialMasonry, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, ThemeShowcase, TimePicker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, formatUsPhone, megaMenuGridColumns, megaMenuToFloatingNavItems, napRecordToJsonLd, navigationMenuTriggerStyle, newTabAttributes, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, renderPlainLink, spinnerVariants, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, switchVariants, testimonialInitials, themeShowcaseSections, toast, useCarousel, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFormContext, useHideOnScroll, useIsMobile, useScrollReveal, useSidebar, useTheme };
8346
8954
 
8347
8955
  //# sourceMappingURL=index.mjs.map