@vjdesigns/vjdesigns-ui 2.2.0 → 2.4.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.
Files changed (87) hide show
  1. package/dist/ai/llms-full.txt +73 -36
  2. package/dist/ai/llms.txt +1 -1
  3. package/dist/ai/registry.json +148 -19
  4. package/dist/components/data-display/Avatar/Avatar.cjs.js +1 -1
  5. package/dist/components/data-display/Avatar/Avatar.d.ts +11 -4
  6. package/dist/components/data-display/Avatar/Avatar.mjs +12 -12
  7. package/dist/components/data-display/Avatar/Avatar.module.css.cjs.js +1 -1
  8. package/dist/components/data-display/Avatar/Avatar.module.css.mjs +19 -18
  9. package/dist/components/data-display/Badge/Badge.cjs.js +1 -1
  10. package/dist/components/data-display/Badge/Badge.d.ts +7 -2
  11. package/dist/components/data-display/Badge/Badge.mjs +2 -1
  12. package/dist/components/data-display/Badge/Badge.module.css.cjs.js +1 -1
  13. package/dist/components/data-display/Badge/Badge.module.css.mjs +33 -32
  14. package/dist/components/navigation/Navbar/Navbar.cjs.js +1 -1
  15. package/dist/components/navigation/Navbar/Navbar.d.ts +65 -2
  16. package/dist/components/navigation/Navbar/Navbar.mjs +309 -169
  17. package/dist/components/navigation/Navbar/Navbar.module.css.cjs.js +1 -1
  18. package/dist/components/navigation/Navbar/Navbar.module.css.mjs +20 -11
  19. package/dist/i18n/en.cjs.js +1 -1
  20. package/dist/i18n/en.mjs +1 -0
  21. package/dist/i18n/types.d.ts +5 -0
  22. package/dist/index.cjs.js +1 -1
  23. package/dist/index.mjs +35 -35
  24. package/dist/locales/ar.cjs.js +1 -1
  25. package/dist/locales/ar.mjs +1 -0
  26. package/dist/locales/bn.cjs.js +1 -1
  27. package/dist/locales/bn.mjs +1 -0
  28. package/dist/locales/cs.cjs.js +1 -1
  29. package/dist/locales/cs.mjs +1 -0
  30. package/dist/locales/da.cjs.js +1 -1
  31. package/dist/locales/da.mjs +1 -0
  32. package/dist/locales/de.cjs.js +1 -1
  33. package/dist/locales/de.mjs +1 -0
  34. package/dist/locales/el.cjs.js +1 -1
  35. package/dist/locales/el.mjs +1 -0
  36. package/dist/locales/es.cjs.js +1 -1
  37. package/dist/locales/es.mjs +1 -0
  38. package/dist/locales/fa.cjs.js +1 -1
  39. package/dist/locales/fa.mjs +1 -0
  40. package/dist/locales/fi.cjs.js +1 -1
  41. package/dist/locales/fi.mjs +1 -0
  42. package/dist/locales/fr.cjs.js +1 -1
  43. package/dist/locales/fr.mjs +1 -0
  44. package/dist/locales/he.cjs.js +1 -1
  45. package/dist/locales/he.mjs +1 -0
  46. package/dist/locales/hi.cjs.js +1 -1
  47. package/dist/locales/hi.mjs +1 -0
  48. package/dist/locales/hu.cjs.js +1 -1
  49. package/dist/locales/hu.mjs +1 -0
  50. package/dist/locales/id.cjs.js +1 -1
  51. package/dist/locales/id.mjs +1 -0
  52. package/dist/locales/it.cjs.js +1 -1
  53. package/dist/locales/it.mjs +1 -0
  54. package/dist/locales/ja.cjs.js +1 -1
  55. package/dist/locales/ja.mjs +1 -0
  56. package/dist/locales/ko.cjs.js +1 -1
  57. package/dist/locales/ko.mjs +1 -0
  58. package/dist/locales/nb.cjs.js +1 -1
  59. package/dist/locales/nb.mjs +1 -0
  60. package/dist/locales/nl.cjs.js +1 -1
  61. package/dist/locales/nl.mjs +1 -0
  62. package/dist/locales/pl.cjs.js +1 -1
  63. package/dist/locales/pl.mjs +1 -0
  64. package/dist/locales/pt-BR.cjs.js +1 -1
  65. package/dist/locales/pt-BR.mjs +1 -0
  66. package/dist/locales/ro.cjs.js +1 -1
  67. package/dist/locales/ro.mjs +1 -0
  68. package/dist/locales/ru.cjs.js +1 -1
  69. package/dist/locales/ru.mjs +1 -0
  70. package/dist/locales/sv.cjs.js +1 -1
  71. package/dist/locales/sv.mjs +1 -0
  72. package/dist/locales/th.cjs.js +1 -1
  73. package/dist/locales/th.mjs +1 -0
  74. package/dist/locales/tr.cjs.js +1 -1
  75. package/dist/locales/tr.mjs +1 -0
  76. package/dist/locales/uk.cjs.js +1 -1
  77. package/dist/locales/uk.mjs +1 -0
  78. package/dist/locales/ur.cjs.js +1 -1
  79. package/dist/locales/ur.mjs +1 -0
  80. package/dist/locales/vi.cjs.js +1 -1
  81. package/dist/locales/vi.mjs +1 -0
  82. package/dist/locales/zh-Hans.cjs.js +1 -1
  83. package/dist/locales/zh-Hans.mjs +1 -0
  84. package/dist/locales/zh-Hant.cjs.js +1 -1
  85. package/dist/locales/zh-Hant.mjs +1 -0
  86. package/dist/vjdesigns-ui.css +1 -1
  87. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- # @vjdesigns/vjdesigns-ui 2.1.0: full reference
1
+ # @vjdesigns/vjdesigns-ui 2.3.0: full reference
2
2
 
3
3
  > Accessible React 19 component library: WCAG 2.2 AA verified (axe on every story, a contrast check on every color pair), 31 languages with right-to-left support, themeable with any brand color (auto-adjusted to stay accessible), tree-shakable, no runtime dependencies besides React.
4
4
 
@@ -607,9 +607,9 @@ import { Avatar } from "@vjdesigns/vjdesigns-ui";
607
607
 
608
608
  Category: data-display · Storybook: Data Display/Avatar
609
609
 
610
- A person's picture, with a fallback chain of image, initials, then a user
611
- icon. Supports a presence status dot, a highlight ring, and stacking in an
612
- `AvatarGroup`.
610
+ A person's photo (`src`), with a fallback chain of image, initials (from
611
+ `name`), then a user icon, so it always shows something. Supports a border,
612
+ a presence status dot, a highlight ring, and stacking in an `AvatarGroup`.
613
613
 
614
614
  ### Props
615
615
 
@@ -623,6 +623,7 @@ icon. Supports a presence status dot, a highlight ring, and stacking in an
623
623
  - `colorFromName`: `boolean`. Pick the fallback tone from a hash of `name`, so lists are colorful but stable.
624
624
  - `status`: `AvatarStatus`. Presence dot at the bottom-end corner. Also appended to the accessible name, e.g. "Dana Hernandez (online)".
625
625
  - `statusLabel`: `string`. Text for the status in the accessible name. Defaults to the status value ("online", "away", ...).
626
+ - `bordered`: `boolean`. Draws a border around the avatar, e.g. to set a photo apart from a busy background or a cover image. Decorative. Its color is the `--avatar-border-color` CSS variable (default `--color-border-strong`); set it to `var(--color-surface)` for a light frame on a photo banner.
626
627
  - `ring`: `boolean`. Highlight ring (e.g. the active player). Visual only: also convey the state in text nearby or in `aria-label`.
627
628
  - `ringTone`: `Tone`. Color of the highlight ring. Uses the tone's `--color-*-border` token.
628
629
  - `decorative`: `boolean`. Hide the avatar from assistive technology. Use when the person's name is already visible next to the avatar.
@@ -633,7 +634,7 @@ icon. Supports a presence status dot, a highlight ring, and stacking in an
633
634
 
634
635
  ### Examples (Storybook stories)
635
636
 
636
- - Playground
637
+ - Playground: A photo by default. Pick "None" under `src` to see initials (from `name`), and clear `name` too for the icon.
637
638
  - Sizes
638
639
  - Shapes
639
640
  - Image vs initials vs icon
@@ -642,6 +643,7 @@ icon. Supports a presence status dot, a highlight ring, and stacking in an
642
643
  - Color from name (team list)
643
644
  - Status
644
645
  - Ring (active player)
646
+ - Bordered: `bordered` draws a border on a single avatar: for a photo, initials, or the icon. Change its color with the `--avatar-border-color` CSS variable, e.g. a light frame on a cover image (profile header). It stacks with the highlight ring and inside a group.
645
647
  - AvatarGroup
646
648
  - With name (decorative)
647
649
  - Both themes
@@ -709,6 +711,7 @@ Renders a `<span>` with no role. For counts, pass `label` (e.g.
709
711
  - Counts
710
712
  - Anchored
711
713
  - In text
714
+ - Inverse: `inverse` swaps the solid colors, for a badge on a solid tone surface: a solid Navbar, a Banner, a primary card.
712
715
  - On surfaces (both themes)
713
716
 
714
717
  ## BadgeAnchor
@@ -5450,22 +5453,22 @@ import { Navbar } from "@vjdesigns/vjdesigns-ui";
5450
5453
 
5451
5454
  Category: navigation · Storybook: Navigation/Navbar
5452
5455
 
5453
- The top header of an app or site. Renders a `<header>` (a `banner`
5454
- landmark when it isn't inside `main`, `article`, `aside`, `nav`, or
5455
- `section`) with brand, navigation, and actions. Below `collapseBelow`
5456
- the navigation moves into a modal drawer opened by a menu button.
5457
-
5458
- ```tsx
5459
- <Navbar>
5460
- <Navbar.Brand href="/">Hoops</Navbar.Brand>
5461
- <Navbar.Nav>
5462
- <Navbar.Link href="/" active>Home</Navbar.Link>
5463
- <Navbar.Link href="/teams">Teams</Navbar.Link>
5464
- </Navbar.Nav>
5465
- <Navbar.Actions>
5466
- <Button size="sm">Sign in</Button>
5467
- </Navbar.Actions>
5468
- </Navbar>
5456
+ The top header of an app or site. Renders a `<header>` (a `banner`
5457
+ landmark when it isn't inside `main`, `article`, `aside`, `nav`, or
5458
+ `section`) with brand, navigation, and actions. Below `collapseBelow`
5459
+ the navigation moves into a modal drawer opened by a menu button.
5460
+
5461
+ ```tsx
5462
+ <Navbar>
5463
+ <Navbar.Brand href="/">Hoops</Navbar.Brand>
5464
+ <Navbar.Nav>
5465
+ <Navbar.Link href="/" active>Home</Navbar.Link>
5466
+ <Navbar.Link href="/teams">Teams</Navbar.Link>
5467
+ </Navbar.Nav>
5468
+ <Navbar.Actions>
5469
+ <Button size="sm">Sign in</Button>
5470
+ </Navbar.Actions>
5471
+ </Navbar>
5469
5472
  ```
5470
5473
 
5471
5474
  ### Props
@@ -5503,12 +5506,12 @@ The logo or product name at the start of the bar, usually a link home.
5503
5506
 
5504
5507
  Also exported as `NavbarNav`.
5505
5508
 
5506
- The primary links: a `<nav>` landmark around a `<ul>`. Above the
5507
- `collapseBelow` breakpoint they sit in the bar; below it they are hidden
5508
- (`display: none`) and the same links render vertically in a drawer that the
5509
- menu button opens. Only one copy is ever exposed to assistive technology.
5510
-
5511
- Other props go on the inline `<nav>` only. The drawer copy gets the same
5509
+ The primary links: a `<nav>` landmark around a `<ul>`. Above the
5510
+ `collapseBelow` breakpoint they sit in the bar; below it they are hidden
5511
+ (`display: none`) and the same links render vertically in a drawer that the
5512
+ menu button opens. Only one copy is ever exposed to assistive technology.
5513
+
5514
+ Other props go on the inline `<nav>` only. The drawer copy gets the same
5512
5515
  `aria-label` / `aria-labelledby`.
5513
5516
 
5514
5517
  - `children`: `ReactNode`. `Navbar.Link`s (each is wrapped in an `<li>` for you) and/or `Navbar.Item`s.
@@ -5521,9 +5524,9 @@ Other props go on the inline `<nav>` only. The drawer copy gets the same
5521
5524
 
5522
5525
  Also exported as `NavbarItem`.
5523
5526
 
5524
- A list item in `Navbar.Nav`. `Navbar.Link` adds its own `<li>`, so you
5525
- only need this to wrap something else, to put props on the `<li>`, or to
5526
- show an item only in the bar or only in the drawer (`showIn`). A `ref`
5527
+ A list item in `Navbar.Nav`. `Navbar.Link` adds its own `<li>`, so you
5528
+ only need this to wrap something else, to put props on the `<li>`, or to
5529
+ show an item only in the bar or only in the drawer (`showIn`). A `ref`
5527
5530
  attaches to the bar's copy.
5528
5531
 
5529
5532
  - `children`: `ReactNode`. A `Navbar.Link`, or any other control (e.g. a `Button`) that belongs in the list.
@@ -5534,18 +5537,47 @@ attaches to the bar's copy.
5534
5537
 
5535
5538
  Also exported as `NavbarLink`.
5536
5539
 
5537
- A primary navigation link. Wraps itself in an `<li>` unless it's already
5538
- inside `Navbar.Item`. In the mobile drawer, clicking it closes the drawer
5539
- (even if a router prevents the default navigation).
5540
-
5541
- It renders once in the bar and once in the drawer (only one is ever
5540
+ A primary navigation link. Wraps itself in an `<li>` unless it's already
5541
+ inside `Navbar.Item`. In the mobile drawer, clicking it closes the drawer
5542
+ (even if a router prevents the default navigation).
5543
+
5544
+ It renders once in the bar and once in the drawer (only one is ever
5542
5545
  exposed), so don't give it an `id`. A `ref` attaches to the bar's copy.
5543
5546
 
5544
5547
  - `as`: `C`. Component or element to render. Defaults to `a`. Pass a router link (e.g. React Router or Next.js `Link`) and its props (such as `to`) are accepted and typed. It must forward `className`, `onClick`, and ARIA props to its `<a>`.
5545
5548
  - `active`: `boolean` (default false). Marks the link as the current page: sets `aria-current="page"` and shows a filled pill with an indicator bar, so the state never relies on color alone.
5546
5549
  - `icon`: `ReactNode`. Decorative icon before the label. Hidden from assistive technology.
5550
+ - `badge`: `NavbarBadgeValue`. A count (rendered with `Badge` `count`, capped at 99+, hidden at 0) or a short text such as "New", after the label. It's part of the link's name ("Messages 3"), in the bar and the mobile menu.
5551
+ - `badgeLabel`: `string`. Screen-reader text for the badge, e.g. "3 unread messages". Replaces the visible badge text in the accessible name.
5552
+ - `badgeTone`: `Tone`. Badge color. By default `accent`, except in the `solid` bar, where the badge takes the bar's own colors swapped (a `Badge` `variant="inverse"`) so it stands out from the bar in both themes. Setting it always gives a solid badge in that tone.
5547
5553
  - `children`: `ReactNode`. The visible label.
5548
5554
 
5555
+ ### Navbar.Group
5556
+
5557
+ Also exported as `NavbarGroup`.
5558
+
5559
+ A group of links under one button, following the WAI-ARIA disclosure
5560
+ navigation pattern (not a `menu`): the button has `aria-expanded`, and the
5561
+ links stay ordinary links in the Tab order.
5562
+
5563
+ - In the bar: the button opens a dropdown below it. Escape closes it and
5564
+ returns focus to the button; so do a press outside, Tab moving focus out
5565
+ of the group, and activating a link. Opening one group closes the others.
5566
+ - In the mobile menu: an expandable section with the links indented below.
5567
+
5568
+ - `label`: `ReactNode` (required). The group button's visible label, and its accessible name.
5569
+ - `icon`: `ReactNode`. Decorative icon before the label.
5570
+ - `children`: `ReactNode`. The group's `Navbar.Link`s.
5571
+ - `active`: `boolean` (default false). One of the group's links is the current page. The button then shows the active look (it doesn't set `aria-current`; the link does), and the group starts open in the mobile menu.
5572
+ - `badge`: `NavbarBadgeValue`. A count or short text on the group button, like `Navbar.Link`'s `badge`.
5573
+ - `badgeLabel`: `string`. Screen-reader text for the badge.
5574
+ - `badgeTone`: `Tone`. Badge color. Same default as `Navbar.Link`'s `badgeTone` (inverse on the solid bar).
5575
+ - `open`: `boolean`. Controlled open state of the dropdown in the bar.
5576
+ - `defaultOpen`: `boolean` (default false). Initial open state of the dropdown when uncontrolled.
5577
+ - `onOpenChange`: `(open: boolean) => void`. Called with the next open state of the dropdown in the bar.
5578
+ - `disabled`: `boolean` (default false). Disables the group button.
5579
+ - Plus every native `<li>` attribute.
5580
+
5549
5581
  ### Navbar.Actions
5550
5582
 
5551
5583
  Also exported as `NavbarActions`.
@@ -5565,7 +5597,12 @@ The end of the bar: actions that stay visible at every width, before the menu bu
5565
5597
  - Sizes: `sm` 56px, `md` 64px, `lg` 80px tall. Links and the menu button scale with it.
5566
5598
  - With Actions: The actions area holds anything that should stay visible at every width.
5567
5599
  - Active Link: `active` sets `aria-current="page"` and draws an accent-tinted pill with an indicator bar, so the current page is marked by shape as well as color. Links can carry a decorative `icon`.
5568
- - Mobile: On a phone-sized viewport the links collapse into a menu button ("Open menu", with `aria-expanded` and `aria-controls`) that opens them in a drawer. The inline nav is `display: none`, so only one "Main" navigation is ever exposed. Choosing a link closes the drawer.
5600
+ - Link Badges: `badge` on `Navbar.Link` (and `Navbar.Group`) shows a count or short text after the label, in the bar and the mobile menu. `badgeLabel` gives screen readers the full meaning ("Messages, 3 unread messages"). On the solid bar, a badge without a `badgeTone` swaps the bar's colors (`Badge` `variant="inverse"`), so it stands out in both themes.
5601
+ - Link Groups: `Navbar.Group` puts links under one button (the WAI-ARIA disclosure navigation pattern, not a menu). The button opens a dropdown; Escape, a press outside, Tab moving out, or choosing a link closes it, and opening one group closes the other. `active` marks the group holding the current page.
5602
+ - Link group, last on the page: A group as the last focusable thing on the page: Tab past its last link leaves the page, and the dropdown still closes. A press on the panel's padding (nothing focusable) keeps it open.
5603
+ - Link Groups Mobile: In the mobile menu, a group is an expandable section; the one holding the current page starts open.
5604
+ - Link Groups Right To Left: Right-to-left: the dropdown lines up with the button's right edge.
5605
+ - Mobile
5569
5606
  - Mobile Solid: The solid bar on a phone, with the menu sliding in from the start edge.
5570
5607
  - Router Links: Pass a router link component with `as` (on `Navbar.Link` and `Navbar.Brand`); its own props, such as `to`, are typed. Track the current route yourself and set `active` on the matching link.
5571
5608
  - Sticky on a long page: `position="sticky"` (the default) with `elevateOnScroll`: the soft shadow appears once the page scrolls. Scroll the canvas to see it.
package/dist/ai/llms.txt CHANGED
@@ -19,7 +19,7 @@
19
19
  ## Data-display
20
20
 
21
21
  - [Accordion](llms-full.txt#accordion): A vertically stacked set of headings that each reveal a section of content.
22
- - [Avatar](llms-full.txt#avatar): A person's picture, with a fallback chain of image, initials, then a user icon.
22
+ - [Avatar](llms-full.txt#avatar): A person's photo (`src`), with a fallback chain of image, initials (from `name`), then a user icon, so it always shows something.
23
23
  - [AvatarGroup](llms-full.txt#avatargroup): Overlapping stack of avatars in a labelled `role="group"`.
24
24
  - [Badge](llms-full.txt#badge): A small, non-interactive status or label pill.
25
25
  - [BadgeAnchor](llms-full.txt#badgeanchor): Pins a count, dot, or short label to a corner of its child.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vjdesigns/vjdesigns-ui",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "summary": "Accessible React 19 component library: WCAG 2.2 AA verified (axe on every story, a contrast check on every color pair), 31 languages with right-to-left support, themeable with any brand color (auto-adjusted to stay accessible), tree-shakable, no runtime dependencies besides React.",
5
5
  "install": "npm install @vjdesigns/vjdesigns-ui",
6
6
  "stylesheet": "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css",
@@ -325,7 +325,7 @@
325
325
  "category": "data-display",
326
326
  "folder": "Avatar",
327
327
  "import": "import { Avatar } from \"@vjdesigns/vjdesigns-ui\";",
328
- "description": "A person's picture, with a fallback chain of image, initials, then a user\r\nicon. Supports a presence status dot, a highlight ring, and stacking in an\r\n`AvatarGroup`.",
328
+ "description": "A person's photo (`src`), with a fallback chain of image, initials (from\r\n`name`), then a user icon, so it always shows something. Supports a border,\r\na presence status dot, a highlight ring, and stacking in an `AvatarGroup`.",
329
329
  "nativeElement": "span",
330
330
  "props": [
331
331
  {
@@ -388,6 +388,12 @@
388
388
  "required": false,
389
389
  "description": "Text for the status in the accessible name. Defaults to the status value (\"online\", \"away\", ...)."
390
390
  },
391
+ {
392
+ "name": "bordered",
393
+ "type": "boolean",
394
+ "required": false,
395
+ "description": "Draws a border around the avatar, e.g. to set a photo apart from a busy\r\nbackground or a cover image. Decorative. Its color is the\r\n`--avatar-border-color` CSS variable (default `--color-border-strong`);\r\nset it to `var(--color-surface)` for a light frame on a photo banner."
396
+ },
391
397
  {
392
398
  "name": "ring",
393
399
  "type": "boolean",
@@ -430,7 +436,7 @@
430
436
  "stories": [
431
437
  {
432
438
  "name": "Playground",
433
- "description": ""
439
+ "description": "A photo by default. Pick \"None\" under `src` to see initials (from `name`), and clear `name` too for the icon."
434
440
  },
435
441
  {
436
442
  "name": "Sizes",
@@ -464,6 +470,10 @@
464
470
  "name": "Ring (active player)",
465
471
  "description": ""
466
472
  },
473
+ {
474
+ "name": "Bordered",
475
+ "description": "`bordered` draws a border on a single avatar: for a photo, initials, or\r\nthe icon. Change its color with the `--avatar-border-color` CSS variable,\r\ne.g. a light frame on a cover image (profile header). It stacks with the\r\nhighlight ring and inside a group."
476
+ },
467
477
  {
468
478
  "name": "AvatarGroup",
469
479
  "description": ""
@@ -677,6 +687,10 @@
677
687
  "name": "In text",
678
688
  "description": ""
679
689
  },
690
+ {
691
+ "name": "Inverse",
692
+ "description": "`inverse` swaps the solid colors, for a badge on a solid tone surface: a solid Navbar, a Banner, a primary card."
693
+ },
680
694
  {
681
695
  "name": "On surfaces (both themes)",
682
696
  "description": ""
@@ -15302,7 +15316,7 @@
15302
15316
  "category": "navigation",
15303
15317
  "folder": "Navbar",
15304
15318
  "import": "import { Navbar } from \"@vjdesigns/vjdesigns-ui\";",
15305
- "description": "The top header of an app or site. Renders a `<header>` (a `banner`\r\nlandmark when it isn't inside `main`, `article`, `aside`, `nav`, or\r\n`section`) with brand, navigation, and actions. Below `collapseBelow`\r\nthe navigation moves into a modal drawer opened by a menu button.\r\n\r\n```tsx\r\n<Navbar>\r\n <Navbar.Brand href=\"/\">Hoops</Navbar.Brand>\r\n <Navbar.Nav>\r\n <Navbar.Link href=\"/\" active>Home</Navbar.Link>\r\n <Navbar.Link href=\"/teams\">Teams</Navbar.Link>\r\n </Navbar.Nav>\r\n <Navbar.Actions>\r\n <Button size=\"sm\">Sign in</Button>\r\n </Navbar.Actions>\r\n</Navbar>\r\n```",
15319
+ "description": "The top header of an app or site. Renders a `<header>` (a `banner`\nlandmark when it isn't inside `main`, `article`, `aside`, `nav`, or\n`section`) with brand, navigation, and actions. Below `collapseBelow`\nthe navigation moves into a modal drawer opened by a menu button.\n\n```tsx\n<Navbar>\n <Navbar.Brand href=\"/\">Hoops</Navbar.Brand>\n <Navbar.Nav>\n <Navbar.Link href=\"/\" active>Home</Navbar.Link>\n <Navbar.Link href=\"/teams\">Teams</Navbar.Link>\n </Navbar.Nav>\n <Navbar.Actions>\n <Button size=\"sm\">Sign in</Button>\n </Navbar.Actions>\n</Navbar>\n```",
15306
15320
  "nativeElement": "header",
15307
15321
  "props": [
15308
15322
  {
@@ -15337,7 +15351,7 @@
15337
15351
  "type": "boolean",
15338
15352
  "required": false,
15339
15353
  "default": "true",
15340
- "description": "Keeps focused and scrolled-to content clear of a `sticky` or `fixed`\r\nbar (WCAG 2.4.11): while mounted, sets `scroll-padding-top` on the bar's\r\nscroll container to the bar's height, and restores it on unmount. Set\r\n`false` to manage it yourself, e.g. `html { scroll-padding-top:\r\nvar(--header-height) }` (the md bar's height). Inside the bar,\r\n`--navbar-height` holds its height."
15354
+ "description": "Keeps focused and scrolled-to content clear of a `sticky` or `fixed`\nbar (WCAG 2.4.11): while mounted, sets `scroll-padding-top` on the bar's\nscroll container to the bar's height, and restores it on unmount. Set\n`false` to manage it yourself, e.g. `html { scroll-padding-top:\nvar(--header-height) }` (the md bar's height). Inside the bar,\n`--navbar-height` holds its height."
15341
15355
  },
15342
15356
  {
15343
15357
  "name": "bordered",
@@ -15358,14 +15372,14 @@
15358
15372
  "type": "boolean",
15359
15373
  "required": false,
15360
15374
  "default": "false",
15361
- "description": "Shows the soft shadow only once the window has scrolled (a passive,\r\nframe-throttled listener). A `transparent` bar also fills with the\r\nsurface color so links stay readable over content."
15375
+ "description": "Shows the soft shadow only once the window has scrolled (a passive,\nframe-throttled listener). A `transparent` bar also fills with the\nsurface color so links stay readable over content."
15362
15376
  },
15363
15377
  {
15364
15378
  "name": "contained",
15365
15379
  "type": "boolean",
15366
15380
  "required": false,
15367
15381
  "default": "true",
15368
- "description": "Centers the content in a max-width `Container` with responsive gutters.\r\nWhen `false`, the content spans the full width (gutters are kept). To\r\ncompose your own layout instead, set `contained={false}`."
15382
+ "description": "Centers the content in a max-width `Container` with responsive gutters.\nWhen `false`, the content spans the full width (gutters are kept). To\ncompose your own layout instead, set `contained={false}`."
15369
15383
  },
15370
15384
  {
15371
15385
  "name": "maxWidth",
@@ -15379,7 +15393,7 @@
15379
15393
  "type": "NavbarCollapseBreakpoint",
15380
15394
  "required": false,
15381
15395
  "default": "\"md\"",
15382
- "description": "Below this breakpoint (sm 640px, md 768px, lg 1024px), `Navbar.Nav`\r\nis hidden and a menu button opens the links in a drawer instead."
15396
+ "description": "Below this breakpoint (sm 640px, md 768px, lg 1024px), `Navbar.Nav`\nis hidden and a menu button opens the links in a drawer instead."
15383
15397
  },
15384
15398
  {
15385
15399
  "name": "open",
@@ -15426,7 +15440,7 @@
15426
15440
  "type": "NavbarActiveTone",
15427
15441
  "required": false,
15428
15442
  "default": "\"accent\"",
15429
- "description": "Color of the active link's pill and indicator bar, in the bar and the\r\nmobile menu: `accent` (the theme's accent), `primary` (the brand color), or\r\n`neutral`. The `solid` variant always marks the active link with the\r\non-primary color."
15443
+ "description": "Color of the active link's pill and indicator bar, in the bar and the\nmobile menu: `accent` (the theme's accent), `primary` (the brand color), or\n`neutral`. The `solid` variant always marks the active link with the\non-primary color."
15430
15444
  }
15431
15445
  ],
15432
15446
  "subcomponents": [
@@ -15439,7 +15453,7 @@
15439
15453
  "name": "as",
15440
15454
  "type": "C",
15441
15455
  "required": false,
15442
- "description": "Component or element to render. Defaults to `a` when `href` is set,\r\notherwise `div`. Pass a router link (e.g. React Router or Next.js `Link`)\r\nand its props (such as `to`) are accepted; it must forward `className`\r\nand ARIA props to its `<a>`."
15456
+ "description": "Component or element to render. Defaults to `a` when `href` is set,\notherwise `div`. Pass a router link (e.g. React Router or Next.js `Link`)\nand its props (such as `to`) are accepted; it must forward `className`\nand ARIA props to its `<a>`."
15443
15457
  },
15444
15458
  {
15445
15459
  "name": "children",
@@ -15452,7 +15466,7 @@
15452
15466
  {
15453
15467
  "name": "Navbar.Nav",
15454
15468
  "exportedAs": "NavbarNav",
15455
- "description": "The primary links: a `<nav>` landmark around a `<ul>`. Above the\r\n`collapseBelow` breakpoint they sit in the bar; below it they are hidden\r\n(`display: none`) and the same links render vertically in a drawer that the\r\nmenu button opens. Only one copy is ever exposed to assistive technology.\r\n\r\nOther props go on the inline `<nav>` only. The drawer copy gets the same\r\n`aria-label` / `aria-labelledby`.",
15469
+ "description": "The primary links: a `<nav>` landmark around a `<ul>`. Above the\n`collapseBelow` breakpoint they sit in the bar; below it they are hidden\n(`display: none`) and the same links render vertically in a drawer that the\nmenu button opens. Only one copy is ever exposed to assistive technology.\n\nOther props go on the inline `<nav>` only. The drawer copy gets the same\n`aria-label` / `aria-labelledby`.",
15456
15470
  "nativeElement": "nav",
15457
15471
  "props": [
15458
15472
  {
@@ -15466,14 +15480,14 @@
15466
15480
  "type": "NavbarNavAlign",
15467
15481
  "required": false,
15468
15482
  "default": "\"start\"",
15469
- "description": "Where the links sit in the bar, between the brand and the actions:\r\n`start` (next to the brand; left in left-to-right layouts), `center`,\r\nor `end` (next to the actions; right in left-to-right layouts). Logical,\r\nso it flips in right-to-left layouts. The mobile drawer always lists\r\nthem vertically."
15483
+ "description": "Where the links sit in the bar, between the brand and the actions:\n`start` (next to the brand; left in left-to-right layouts), `center`,\nor `end` (next to the actions; right in left-to-right layouts). Logical,\nso it flips in right-to-left layouts. The mobile drawer always lists\nthem vertically."
15470
15484
  },
15471
15485
  {
15472
15486
  "name": "gap",
15473
15487
  "type": "Responsive<Space>",
15474
15488
  "required": false,
15475
15489
  "default": "1",
15476
- "description": "Space between the links in the bar, as a spacing step (`4` is\r\n`--space-4`, 16px). Accepts one value or one per breakpoint, e.g.\r\n`{ base: 2, xl: 6 }`. The mobile drawer keeps its own vertical spacing."
15490
+ "description": "Space between the links in the bar, as a spacing step (`4` is\n`--space-4`, 16px). Accepts one value or one per breakpoint, e.g.\n`{ base: 2, xl: 6 }`. The mobile drawer keeps its own vertical spacing."
15477
15491
  },
15478
15492
  {
15479
15493
  "name": "aria-label",
@@ -15487,7 +15501,7 @@
15487
15501
  {
15488
15502
  "name": "Navbar.Item",
15489
15503
  "exportedAs": "NavbarItem",
15490
- "description": "A list item in `Navbar.Nav`. `Navbar.Link` adds its own `<li>`, so you\r\nonly need this to wrap something else, to put props on the `<li>`, or to\r\nshow an item only in the bar or only in the drawer (`showIn`). A `ref`\r\nattaches to the bar's copy.",
15504
+ "description": "A list item in `Navbar.Nav`. `Navbar.Link` adds its own `<li>`, so you\nonly need this to wrap something else, to put props on the `<li>`, or to\nshow an item only in the bar or only in the drawer (`showIn`). A `ref`\nattaches to the bar's copy.",
15491
15505
  "nativeElement": "li",
15492
15506
  "props": [
15493
15507
  {
@@ -15501,27 +15515,27 @@
15501
15515
  "type": "NavbarItemShowIn",
15502
15516
  "required": false,
15503
15517
  "default": "\"both\"",
15504
- "description": "Where the item appears. `Navbar.Nav` renders its children twice (in the\r\nbar and in the drawer), so a stateful child (a Menu, a toggle) is\r\nmounted twice and its drawer copy resets each time the drawer opens.\r\nShow such an item in one place only, or put it in `Navbar.Actions`."
15518
+ "description": "Where the item appears. `Navbar.Nav` renders its children twice (in the\nbar and in the drawer), so a stateful child (a Menu, a toggle) is\nmounted twice and its drawer copy resets each time the drawer opens.\nShow such an item in one place only, or put it in `Navbar.Actions`."
15505
15519
  }
15506
15520
  ]
15507
15521
  },
15508
15522
  {
15509
15523
  "name": "Navbar.Link",
15510
15524
  "exportedAs": "NavbarLink",
15511
- "description": "A primary navigation link. Wraps itself in an `<li>` unless it's already\r\ninside `Navbar.Item`. In the mobile drawer, clicking it closes the drawer\r\n(even if a router prevents the default navigation).\r\n\r\nIt renders once in the bar and once in the drawer (only one is ever\r\nexposed), so don't give it an `id`. A `ref` attaches to the bar's copy.",
15525
+ "description": "A primary navigation link. Wraps itself in an `<li>` unless it's already\ninside `Navbar.Item`. In the mobile drawer, clicking it closes the drawer\n(even if a router prevents the default navigation).\n\nIt renders once in the bar and once in the drawer (only one is ever\nexposed), so don't give it an `id`. A `ref` attaches to the bar's copy.",
15512
15526
  "props": [
15513
15527
  {
15514
15528
  "name": "as",
15515
15529
  "type": "C",
15516
15530
  "required": false,
15517
- "description": "Component or element to render. Defaults to `a`. Pass a router link\r\n(e.g. React Router or Next.js `Link`) and its props (such as `to`) are\r\naccepted and typed. It must forward `className`, `onClick`, and ARIA\r\nprops to its `<a>`."
15531
+ "description": "Component or element to render. Defaults to `a`. Pass a router link\n(e.g. React Router or Next.js `Link`) and its props (such as `to`) are\naccepted and typed. It must forward `className`, `onClick`, and ARIA\nprops to its `<a>`."
15518
15532
  },
15519
15533
  {
15520
15534
  "name": "active",
15521
15535
  "type": "boolean",
15522
15536
  "required": false,
15523
15537
  "default": "false",
15524
- "description": "Marks the link as the current page: sets `aria-current=\"page\"` and shows\r\na filled pill with an indicator bar, so the state never relies on color\r\nalone."
15538
+ "description": "Marks the link as the current page: sets `aria-current=\"page\"` and shows\na filled pill with an indicator bar, so the state never relies on color\nalone."
15525
15539
  },
15526
15540
  {
15527
15541
  "name": "icon",
@@ -15529,6 +15543,24 @@
15529
15543
  "required": false,
15530
15544
  "description": "Decorative icon before the label. Hidden from assistive technology."
15531
15545
  },
15546
+ {
15547
+ "name": "badge",
15548
+ "type": "NavbarBadgeValue",
15549
+ "required": false,
15550
+ "description": "A count (rendered with `Badge` `count`, capped at 99+, hidden at 0) or a\nshort text such as \"New\", after the label. It's part of the link's name\n(\"Messages 3\"), in the bar and the mobile menu."
15551
+ },
15552
+ {
15553
+ "name": "badgeLabel",
15554
+ "type": "string",
15555
+ "required": false,
15556
+ "description": "Screen-reader text for the badge, e.g. \"3 unread messages\". Replaces the visible badge text in the accessible name."
15557
+ },
15558
+ {
15559
+ "name": "badgeTone",
15560
+ "type": "Tone",
15561
+ "required": false,
15562
+ "description": "Badge color. By default `accent`, except in the `solid` bar, where the\nbadge takes the bar's own colors swapped (a `Badge` `variant=\"inverse\"`)\nso it stands out from the bar in both themes. Setting it always gives a\nsolid badge in that tone."
15563
+ },
15532
15564
  {
15533
15565
  "name": "children",
15534
15566
  "type": "ReactNode",
@@ -15537,6 +15569,83 @@
15537
15569
  }
15538
15570
  ]
15539
15571
  },
15572
+ {
15573
+ "name": "Navbar.Group",
15574
+ "exportedAs": "NavbarGroup",
15575
+ "description": "A group of links under one button, following the WAI-ARIA disclosure\nnavigation pattern (not a `menu`): the button has `aria-expanded`, and the\nlinks stay ordinary links in the Tab order.\n\n- In the bar: the button opens a dropdown below it. Escape closes it and\n returns focus to the button; so do a press outside, Tab moving focus out\n of the group, and activating a link. Opening one group closes the others.\n- In the mobile menu: an expandable section with the links indented below.",
15576
+ "nativeElement": "li",
15577
+ "props": [
15578
+ {
15579
+ "name": "label",
15580
+ "type": "ReactNode",
15581
+ "required": true,
15582
+ "description": "The group button's visible label, and its accessible name."
15583
+ },
15584
+ {
15585
+ "name": "icon",
15586
+ "type": "ReactNode",
15587
+ "required": false,
15588
+ "description": "Decorative icon before the label."
15589
+ },
15590
+ {
15591
+ "name": "children",
15592
+ "type": "ReactNode",
15593
+ "required": false,
15594
+ "description": "The group's `Navbar.Link`s."
15595
+ },
15596
+ {
15597
+ "name": "active",
15598
+ "type": "boolean",
15599
+ "required": false,
15600
+ "default": "false",
15601
+ "description": "One of the group's links is the current page. The button then shows the\nactive look (it doesn't set `aria-current`; the link does), and the\ngroup starts open in the mobile menu."
15602
+ },
15603
+ {
15604
+ "name": "badge",
15605
+ "type": "NavbarBadgeValue",
15606
+ "required": false,
15607
+ "description": "A count or short text on the group button, like `Navbar.Link`'s `badge`."
15608
+ },
15609
+ {
15610
+ "name": "badgeLabel",
15611
+ "type": "string",
15612
+ "required": false,
15613
+ "description": "Screen-reader text for the badge."
15614
+ },
15615
+ {
15616
+ "name": "badgeTone",
15617
+ "type": "Tone",
15618
+ "required": false,
15619
+ "description": "Badge color. Same default as `Navbar.Link`'s `badgeTone` (inverse on the solid bar)."
15620
+ },
15621
+ {
15622
+ "name": "open",
15623
+ "type": "boolean",
15624
+ "required": false,
15625
+ "description": "Controlled open state of the dropdown in the bar."
15626
+ },
15627
+ {
15628
+ "name": "defaultOpen",
15629
+ "type": "boolean",
15630
+ "required": false,
15631
+ "default": "false",
15632
+ "description": "Initial open state of the dropdown when uncontrolled."
15633
+ },
15634
+ {
15635
+ "name": "onOpenChange",
15636
+ "type": "(open: boolean) => void",
15637
+ "required": false,
15638
+ "description": "Called with the next open state of the dropdown in the bar."
15639
+ },
15640
+ {
15641
+ "name": "disabled",
15642
+ "type": "boolean",
15643
+ "required": false,
15644
+ "default": "false",
15645
+ "description": "Disables the group button."
15646
+ }
15647
+ ]
15648
+ },
15540
15649
  {
15541
15650
  "name": "Navbar.Actions",
15542
15651
  "exportedAs": "NavbarActions",
@@ -15586,9 +15695,29 @@
15586
15695
  "name": "Active Link",
15587
15696
  "description": "`active` sets `aria-current=\"page\"` and draws an accent-tinted pill with an\r\nindicator bar, so the current page is marked by shape as well as color.\r\nLinks can carry a decorative `icon`."
15588
15697
  },
15698
+ {
15699
+ "name": "Link Badges",
15700
+ "description": "`badge` on `Navbar.Link` (and `Navbar.Group`) shows a count or short text\r\nafter the label, in the bar and the mobile menu. `badgeLabel` gives screen\r\nreaders the full meaning (\"Messages, 3 unread messages\"). On the solid bar,\r\na badge without a `badgeTone` swaps the bar's colors (`Badge`\r\n`variant=\"inverse\"`), so it stands out in both themes."
15701
+ },
15702
+ {
15703
+ "name": "Link Groups",
15704
+ "description": "`Navbar.Group` puts links under one button (the WAI-ARIA disclosure\r\nnavigation pattern, not a menu). The button opens a dropdown; Escape, a\r\npress outside, Tab moving out, or choosing a link closes it, and opening\r\none group closes the other. `active` marks the group holding the current page."
15705
+ },
15706
+ {
15707
+ "name": "Link group, last on the page",
15708
+ "description": "A group as the last focusable thing on the page: Tab past its last link\r\nleaves the page, and the dropdown still closes. A press on the panel's\r\npadding (nothing focusable) keeps it open."
15709
+ },
15710
+ {
15711
+ "name": "Link Groups Mobile",
15712
+ "description": "In the mobile menu, a group is an expandable section; the one holding the current page starts open."
15713
+ },
15714
+ {
15715
+ "name": "Link Groups Right To Left",
15716
+ "description": "Right-to-left: the dropdown lines up with the button's right edge."
15717
+ },
15589
15718
  {
15590
15719
  "name": "Mobile",
15591
- "description": "On a phone-sized viewport the links collapse into a menu button\r\n(\"Open menu\", with `aria-expanded` and `aria-controls`) that opens them\r\nin a drawer. The inline nav is `display: none`, so only one \"Main\"\r\nnavigation is ever exposed. Choosing a link closes the drawer."
15720
+ "description": ""
15592
15721
  },
15593
15722
  {
15594
15723
  "name": "Mobile Solid",
@@ -1 +1 @@
1
- const e=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../primitives/Icon/icons.cjs.js"),r=require("./Avatar.module.css.cjs.js");let i=require("react"),a=require("react/jsx-runtime");function o(e){let t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:`grapheme`}).segment(e),e=>e.segment):Array.from(e)}var s=/[\p{L}\p{N}]/u;function c(e){let t=o(e).find(e=>s.test(e));return t?t.toLocaleUpperCase():``}function l(e){if(!e)return``;let t=e.trim().split(/\s+/u).filter(e=>s.test(e));if(t.length===0)return``;let n=c(t[0]);return t.length===1?n:n+c(t[t.length-1])}var u=Object.freeze([`primary`,`accent`,`success`,`info`,`neutral`]);function d(e){let t=5381;for(let n of e.trim().toLocaleLowerCase())t=(t<<5)+t+(n.codePointAt(0)??0)|0;return u[Math.abs(t)%u.length]}var f={xs:r.default.xs,sm:r.default.sm,md:r.default.md,lg:r.default.lg,xl:r.default.xl,"2xl":r.default.size2xl},p={circle:r.default.circle,rounded:r.default.rounded,square:r.default.square},m={soft:r.default.soft,solid:r.default.solid},h={neutral:r.default.toneNeutral,primary:r.default.tonePrimary,accent:r.default.toneAccent,success:r.default.toneSuccess,warning:r.default.toneWarning,danger:r.default.toneDanger,info:r.default.toneInfo},g={neutral:r.default.ringNeutral,primary:r.default.ringPrimary,accent:r.default.ringAccent,success:r.default.ringSuccess,warning:r.default.ringWarning,danger:r.default.ringDanger,info:r.default.ringInfo},_={online:r.default.statusOnline,away:r.default.statusAway,busy:r.default.statusBusy,offline:r.default.statusOffline},v={sm:r.default.spacingSm,md:r.default.spacingMd,lg:r.default.spacingLg},y=(0,i.createContext)(null);function b({src:o,alt:s,name:c,size:u,shape:v,tone:b=`neutral`,variant:x=`soft`,colorFromName:S=!1,status:C,statusLabel:w,ring:T=!1,ringTone:E=`accent`,decorative:D=!1,icon:O,imgProps:ee,onImageStatusChange:te,className:k,"aria-label":A,"aria-labelledby":j,...M}){let N=e.useMessages(),P=(0,i.useContext)(y),ne=P?.size??u??`md`,re=v??P?.shape??`circle`,[F,I]=(0,i.useState)(null),L=o?F?.src===o?F.status:`loading`:void 0,R=e=>{!o||F?.src===o&&F.status===e||(I({src:o,status:e}),te?.(e))},{onLoad:z,onError:B,className:V,ref:H,...U}=ee??{},W=e=>{e&&e.complete&&F?.src!==o&&R(e.naturalWidth>0?`loaded`:`error`),typeof H==`function`?H(e):H&&(H.current=e)},G=e=>{R(`loaded`),z?.(e)},K=e=>{R(`error`),B?.(e)},q=l(c),J=S&&c?.trim()?d(c):b,Y=!!o&&L!==`error`,X=D||s===``&&!c,Z=s||c?.trim()||N.avatar.fallbackName,Q=C?w??N.avatar.status[C]:void 0,ie=Q?`${Z} (${Q})`:Z,ae=X&&!Q?{"aria-hidden":!0}:X?{role:`img`,"aria-label":Q}:{role:`img`,"aria-label":j?A:A===void 0?ie:(e=>Q?`${e} (${Q})`:e)(A),"aria-labelledby":j},$;return $=Y?(0,a.jsx)(`img`,{...U,ref:W,src:o,alt:``,className:t.cx(r.default.image,L===`loaded`&&r.default.imageLoaded,V),onLoad:G,onError:K}):q?(0,a.jsx)(`span`,{className:r.default.initials,children:q}):O??(0,a.jsx)(n.UserIcon,{className:r.default.icon}),(0,a.jsxs)(`span`,{...M,...ae,"data-status":C,"data-image-status":L,className:t.cx(r.default.root,f[ne],p[re],m[x],h[J],P&&r.default.inGroup,T&&r.default.ring,T&&g[E],k),children:[(0,a.jsx)(`span`,{className:r.default.face,children:$}),C&&(0,a.jsx)(`span`,{className:t.cx(r.default.status,_[C]),"aria-hidden":`true`})]})}function x({size:n=`md`,shape:o,max:s,spacing:c=`md`,surplusLabel:l,renderSurplus:u,className:d,children:m,...h}){let g=e.useMessages(),_=l??g.avatar.surplus,b=i.Children.toArray(m).filter(i.isValidElement),x=s!==void 0&&s>=0&&s<b.length?Math.floor(s):b.length,S=b.slice(0,x),C=b.slice(x),w=C.length;return(0,a.jsx)(y.Provider,{value:{size:n,shape:o},children:(0,a.jsxs)(`div`,{role:`group`,...h,className:t.cx(r.default.group,f[n],v[c],d),children:[S,w>0&&(u?u(w,C):(0,a.jsx)(`span`,{role:`img`,"aria-label":_(w),className:t.cx(r.default.root,f[n],p[o??`circle`],r.default.soft,r.default.toneNeutral,r.default.inGroup),children:(0,a.jsx)(`span`,{className:r.default.face,children:(0,a.jsxs)(`span`,{className:t.cx(r.default.initials,r.default.surplus),"aria-hidden":`true`,children:[`+`,w]})})}))]})})}exports.Avatar=b,exports.AvatarGroup=x,exports.avatarNameTones=u,exports.avatarToneFromName=d,exports.getInitials=l;
1
+ const e=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../primitives/Icon/icons.cjs.js"),r=require("./Avatar.module.css.cjs.js");let i=require("react"),a=require("react/jsx-runtime");function o(e){let t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:`grapheme`}).segment(e),e=>e.segment):Array.from(e)}var s=/[\p{L}\p{N}]/u;function c(e){let t=o(e).find(e=>s.test(e));return t?t.toLocaleUpperCase():``}function l(e){if(!e)return``;let t=e.trim().split(/\s+/u).filter(e=>s.test(e));if(t.length===0)return``;let n=c(t[0]);return t.length===1?n:n+c(t[t.length-1])}var u=Object.freeze([`primary`,`accent`,`success`,`info`,`neutral`]);function d(e){let t=5381;for(let n of e.trim().toLocaleLowerCase())t=(t<<5)+t+(n.codePointAt(0)??0)|0;return u[Math.abs(t)%u.length]}var f={xs:r.default.xs,sm:r.default.sm,md:r.default.md,lg:r.default.lg,xl:r.default.xl,"2xl":r.default.size2xl},p={circle:r.default.circle,rounded:r.default.rounded,square:r.default.square},m={soft:r.default.soft,solid:r.default.solid},h={neutral:r.default.toneNeutral,primary:r.default.tonePrimary,accent:r.default.toneAccent,success:r.default.toneSuccess,warning:r.default.toneWarning,danger:r.default.toneDanger,info:r.default.toneInfo},g={neutral:r.default.ringNeutral,primary:r.default.ringPrimary,accent:r.default.ringAccent,success:r.default.ringSuccess,warning:r.default.ringWarning,danger:r.default.ringDanger,info:r.default.ringInfo},_={online:r.default.statusOnline,away:r.default.statusAway,busy:r.default.statusBusy,offline:r.default.statusOffline},v={sm:r.default.spacingSm,md:r.default.spacingMd,lg:r.default.spacingLg},y=(0,i.createContext)(null);function b({src:o,alt:s,name:c,size:u,shape:v,tone:b=`neutral`,variant:x=`soft`,colorFromName:S=!1,status:C,statusLabel:w,bordered:T=!1,ring:E=!1,ringTone:D=`accent`,decorative:ee=!1,icon:te,imgProps:O,onImageStatusChange:k,className:A,"aria-label":j,"aria-labelledby":M,...N}){let P=e.useMessages(),F=(0,i.useContext)(y),ne=F?.size??u??`md`,re=v??F?.shape??`circle`,[I,L]=(0,i.useState)(null),R=o?I?.src===o?I.status:`loading`:void 0,z=e=>{!o||I?.src===o&&I.status===e||(L({src:o,status:e}),k?.(e))},{onLoad:B,onError:V,className:H,ref:U,...W}=O??{},G=e=>{e&&e.complete&&I?.src!==o&&z(e.naturalWidth>0?`loaded`:`error`),typeof U==`function`?U(e):U&&(U.current=e)},K=e=>{z(`loaded`),B?.(e)},q=e=>{z(`error`),V?.(e)},J=l(c),Y=S&&c?.trim()?d(c):b,ie=!!o&&R!==`error`,X=ee||s===``&&!c,Z=s||c?.trim()||P.avatar.fallbackName,Q=C?w??P.avatar.status[C]:void 0,ae=Q?`${Z} (${Q})`:Z,oe=X&&!Q?{"aria-hidden":!0}:X?{role:`img`,"aria-label":Q}:{role:`img`,"aria-label":M?j:j===void 0?ae:(e=>Q?`${e} (${Q})`:e)(j),"aria-labelledby":M},$;return $=ie?(0,a.jsx)(`img`,{...W,ref:G,src:o,alt:``,className:t.cx(r.default.image,R===`loaded`&&r.default.imageLoaded,H),onLoad:K,onError:q}):J?(0,a.jsx)(`span`,{className:r.default.initials,children:J}):te??(0,a.jsx)(n.UserIcon,{className:r.default.icon}),(0,a.jsxs)(`span`,{...N,...oe,"data-status":C,"data-image-status":R,className:t.cx(r.default.root,f[ne],p[re],m[x],h[Y],F&&r.default.inGroup,T&&r.default.bordered,E&&r.default.ring,E&&g[D],A),children:[(0,a.jsx)(`span`,{className:r.default.face,children:$}),C&&(0,a.jsx)(`span`,{className:t.cx(r.default.status,_[C]),"aria-hidden":`true`})]})}function x({size:n=`md`,shape:o,max:s,spacing:c=`md`,surplusLabel:l,renderSurplus:u,className:d,children:m,...h}){let g=e.useMessages(),_=l??g.avatar.surplus,b=i.Children.toArray(m).filter(i.isValidElement),x=s!==void 0&&s>=0&&s<b.length?Math.floor(s):b.length,S=b.slice(0,x),C=b.slice(x),w=C.length;return(0,a.jsx)(y.Provider,{value:{size:n,shape:o},children:(0,a.jsxs)(`div`,{role:`group`,...h,className:t.cx(r.default.group,f[n],v[c],d),children:[S,w>0&&(u?u(w,C):(0,a.jsx)(`span`,{role:`img`,"aria-label":_(w),className:t.cx(r.default.root,f[n],p[o??`circle`],r.default.soft,r.default.toneNeutral,r.default.inGroup),children:(0,a.jsx)(`span`,{className:r.default.face,children:(0,a.jsxs)(`span`,{className:t.cx(r.default.initials,r.default.surplus),"aria-hidden":`true`,children:[`+`,w]})})}))]})})}exports.Avatar=b,exports.AvatarGroup=x,exports.avatarNameTones=u,exports.avatarToneFromName=d,exports.getInitials=l;
@@ -54,6 +54,13 @@ export interface AvatarProps extends Omit<ComponentPropsWithRef<"span">, "childr
54
54
  status?: AvatarStatus;
55
55
  /** Text for the status in the accessible name. Defaults to the status value ("online", "away", ...). */
56
56
  statusLabel?: string;
57
+ /**
58
+ * Draws a border around the avatar, e.g. to set a photo apart from a busy
59
+ * background or a cover image. Decorative. Its color is the
60
+ * `--avatar-border-color` CSS variable (default `--color-border-strong`);
61
+ * set it to `var(--color-surface)` for a light frame on a photo banner.
62
+ */
63
+ bordered?: boolean;
57
64
  /**
58
65
  * Highlight ring (e.g. the active player). Visual only: also convey the
59
66
  * state in text nearby or in `aria-label`.
@@ -74,11 +81,11 @@ export interface AvatarProps extends Omit<ComponentPropsWithRef<"span">, "childr
74
81
  onImageStatusChange?: (status: AvatarImageStatus) => void;
75
82
  }
76
83
  /**
77
- * A person's picture, with a fallback chain of image, initials, then a user
78
- * icon. Supports a presence status dot, a highlight ring, and stacking in an
79
- * `AvatarGroup`.
84
+ * A person's photo (`src`), with a fallback chain of image, initials (from
85
+ * `name`), then a user icon, so it always shows something. Supports a border,
86
+ * a presence status dot, a highlight ring, and stacking in an `AvatarGroup`.
80
87
  */
81
- export declare function Avatar({ src, alt, name, size, shape, tone, variant, colorFromName, status, statusLabel, ring, ringTone, decorative, icon, imgProps, onImageStatusChange, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: AvatarProps): import("react").JSX.Element;
88
+ export declare function Avatar({ src, alt, name, size, shape, tone, variant, colorFromName, status, statusLabel, bordered, ring, ringTone, decorative, icon, imgProps, onImageStatusChange, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: AvatarProps): import("react").JSX.Element;
82
89
  type AvatarGroupName = {
83
90
  /** Accessible name for the group, e.g. "Starting lineup". */
84
91
  "aria-label": string;