@vjdesigns/vjdesigns-ui 2.1.0 → 2.3.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/ai/llms-full.txt +12 -6
- package/dist/ai/llms.txt +1 -1
- package/dist/ai/registry.json +18 -4
- package/dist/components/data-display/Avatar/Avatar.cjs.js +1 -1
- package/dist/components/data-display/Avatar/Avatar.d.ts +11 -4
- package/dist/components/data-display/Avatar/Avatar.mjs +12 -12
- package/dist/components/data-display/Avatar/Avatar.module.css.cjs.js +1 -1
- package/dist/components/data-display/Avatar/Avatar.module.css.mjs +19 -18
- package/dist/components/feedback/Toast/ToastProvider.cjs.js +1 -1
- package/dist/components/feedback/Toast/ToastProvider.d.ts +4 -1
- package/dist/components/feedback/Toast/ToastProvider.mjs +44 -26
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +1 -1
package/dist/ai/llms-full.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @vjdesigns/vjdesigns-ui 2.
|
|
1
|
+
# @vjdesigns/vjdesigns-ui 2.2.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
|
|
611
|
-
|
|
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
|
|
@@ -2411,6 +2413,7 @@ announce it yourself if needed.
|
|
|
2411
2413
|
- Update (progressive upload)
|
|
2412
2414
|
- Placements
|
|
2413
2415
|
- Queue and max
|
|
2416
|
+
- One viewport per store: Two providers on one store (here, one at the "app root" and one inside a Japanese `LocaleProvider`) share a single viewport: the first one mounted draws it, so toasts and the "+N more" note never appear twice. Use one provider near the root, inside your `LocaleProvider`, or give a provider its own `store={createToastStore()}` to keep separate toasts.
|
|
2414
2417
|
- Hotkey focus (F8)
|
|
2415
2418
|
- Pause on hover and focus
|
|
2416
2419
|
- Announcements: Announcements go through two persistent live regions inside the viewport: `role="status"` (polite) for most tones and `role="alert"` for errors, with the tone said in words ("Success:").
|
|
@@ -2425,7 +2428,10 @@ import { ToastProvider } from "@vjdesigns/vjdesigns-ui";
|
|
|
2425
2428
|
Category: feedback · Storybook: Feedback/Toast
|
|
2426
2429
|
|
|
2427
2430
|
Renders the toast viewport (in a portal) and provides `useToast()`.
|
|
2428
|
-
Place it once near the root of your app
|
|
2431
|
+
Place it once near the root of your app, inside your `LocaleProvider` so
|
|
2432
|
+
its built-in text (like "+2 more notifications") is in the app's language.
|
|
2433
|
+
Each store gets one viewport: a second provider on the same store (nested
|
|
2434
|
+
or not) only provides `useToast()`, so toasts are never drawn twice.
|
|
2429
2435
|
|
|
2430
2436
|
Accessibility:
|
|
2431
2437
|
- The viewport is a labelled region ("Notifications (F8)"). The hotkey
|
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
|
|
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.
|
package/dist/ai/registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vjdesigns/vjdesigns-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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
|
|
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": ""
|
|
@@ -5706,6 +5716,10 @@
|
|
|
5706
5716
|
"name": "Queue and max",
|
|
5707
5717
|
"description": ""
|
|
5708
5718
|
},
|
|
5719
|
+
{
|
|
5720
|
+
"name": "One viewport per store",
|
|
5721
|
+
"description": "Two providers on one store (here, one at the \"app root\" and one inside a\r\nJapanese `LocaleProvider`) share a single viewport: the first one mounted\r\ndraws it, so toasts and the \"+N more\" note never appear twice. Use one\r\nprovider near the root, inside your `LocaleProvider`, or give a provider\r\nits own `store={createToastStore()}` to keep separate toasts."
|
|
5722
|
+
},
|
|
5709
5723
|
{
|
|
5710
5724
|
"name": "Hotkey focus (F8)",
|
|
5711
5725
|
"description": ""
|
|
@@ -5737,7 +5751,7 @@
|
|
|
5737
5751
|
"category": "feedback",
|
|
5738
5752
|
"folder": "Toast",
|
|
5739
5753
|
"import": "import { ToastProvider } from \"@vjdesigns/vjdesigns-ui\";",
|
|
5740
|
-
"description": "Renders the toast viewport (in a portal) and provides `useToast()`.\r\nPlace it once near the root of your app.\r\n\r\nAccessibility:\r\n- The viewport is a labelled region (\"Notifications (F8)\"). The hotkey\r\n moves focus to the newest toast; Tab moves through toasts and their\r\n buttons; Escape closes the focused toast; focus then moves to the next\r\n toast, or back to where it was before.\r\n- Announcements go through persistent live regions that exist before any\r\n toast appears: `role=\"status\"` for most tones and `role=\"alert\"` for\r\n `danger`.\r\n- Timers pause while the viewport is hovered or focused and while the\r\n window is blurred or hidden. Toasts with an action, and `loading`\r\n toasts, stay until dismissed by default.",
|
|
5754
|
+
"description": "Renders the toast viewport (in a portal) and provides `useToast()`.\r\nPlace it once near the root of your app, inside your `LocaleProvider` so\r\nits built-in text (like \"+2 more notifications\") is in the app's language.\r\nEach store gets one viewport: a second provider on the same store (nested\r\nor not) only provides `useToast()`, so toasts are never drawn twice.\r\n\r\nAccessibility:\r\n- The viewport is a labelled region (\"Notifications (F8)\"). The hotkey\r\n moves focus to the newest toast; Tab moves through toasts and their\r\n buttons; Escape closes the focused toast; focus then moves to the next\r\n toast, or back to where it was before.\r\n- Announcements go through persistent live regions that exist before any\r\n toast appears: `role=\"status\"` for most tones and `role=\"alert\"` for\r\n `danger`.\r\n- Timers pause while the viewport is hovered or focused and while the\r\n window is blurred or hidden. Toasts with an action, and `loading`\r\n toasts, stay until dismissed by default.",
|
|
5741
5755
|
"props": [
|
|
5742
5756
|
{
|
|
5743
5757
|
"name": "children",
|
|
@@ -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,
|
|
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
|
|
78
|
-
*
|
|
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;
|
|
@@ -73,27 +73,27 @@ var _ = {
|
|
|
73
73
|
md: r.spacingMd,
|
|
74
74
|
lg: r.spacingLg
|
|
75
75
|
}, w = a(null);
|
|
76
|
-
function T({ src: i, alt: a, name: o, size: d, shape: f, tone: p = "neutral", variant: h = "soft", colorFromName: C = !1, status: T, statusLabel: E,
|
|
77
|
-
let F = e(), I = s(w),
|
|
76
|
+
function T({ src: i, alt: a, name: o, size: d, shape: f, tone: p = "neutral", variant: h = "soft", colorFromName: C = !1, status: T, statusLabel: E, bordered: D = !1, ring: O = !1, ringTone: k = "accent", decorative: ee = !1, icon: te, imgProps: A, onImageStatusChange: j, className: M, "aria-label": N, "aria-labelledby": P, ...ne }) {
|
|
77
|
+
let F = e(), I = s(w), re = I?.size ?? d ?? "md", ie = f ?? I?.shape ?? "circle", [L, R] = c(null), z = i ? L?.src === i ? L.status : "loading" : void 0, B = (e) => {
|
|
78
78
|
!i || L?.src === i && L.status === e || (R({
|
|
79
79
|
src: i,
|
|
80
80
|
status: e
|
|
81
|
-
}),
|
|
82
|
-
}, { onLoad: V, onError: H, className: U, ref: W, ...G } =
|
|
81
|
+
}), j?.(e));
|
|
82
|
+
}, { onLoad: V, onError: H, className: U, ref: W, ...G } = A ?? {}, K = (e) => {
|
|
83
83
|
e && e.complete && L?.src !== i && B(e.naturalWidth > 0 ? "loaded" : "error"), typeof W == "function" ? W(e) : W && (W.current = e);
|
|
84
84
|
}, q = (e) => {
|
|
85
85
|
B("loaded"), V?.(e);
|
|
86
86
|
}, J = (e) => {
|
|
87
87
|
B("error"), H?.(e);
|
|
88
|
-
}, Y = m(o),
|
|
88
|
+
}, Y = m(o), ae = C && o?.trim() ? g(o) : p, oe = !!i && z !== "error", X = ee || a === "" && !o, Z = a || o?.trim() || F.avatar.fallbackName, Q = T ? E ?? F.avatar.status[T] : void 0, se = Q ? `${Z} (${Q})` : Z, ce = X && !Q ? { "aria-hidden": !0 } : X ? {
|
|
89
89
|
role: "img",
|
|
90
90
|
"aria-label": Q
|
|
91
91
|
} : {
|
|
92
92
|
role: "img",
|
|
93
|
-
"aria-label":
|
|
94
|
-
"aria-labelledby":
|
|
93
|
+
"aria-label": P ? N : N === void 0 ? se : ((e) => Q ? `${e} (${Q})` : e)(N),
|
|
94
|
+
"aria-labelledby": P
|
|
95
95
|
}, $;
|
|
96
|
-
return $ =
|
|
96
|
+
return $ = oe ? /* @__PURE__ */ l("img", {
|
|
97
97
|
...G,
|
|
98
98
|
ref: K,
|
|
99
99
|
src: i,
|
|
@@ -104,12 +104,12 @@ function T({ src: i, alt: a, name: o, size: d, shape: f, tone: p = "neutral", va
|
|
|
104
104
|
}) : Y ? /* @__PURE__ */ l("span", {
|
|
105
105
|
className: r.initials,
|
|
106
106
|
children: Y
|
|
107
|
-
}) :
|
|
108
|
-
...
|
|
109
|
-
...
|
|
107
|
+
}) : te ?? /* @__PURE__ */ l(n, { className: r.icon }), /* @__PURE__ */ u("span", {
|
|
108
|
+
...ne,
|
|
109
|
+
...ce,
|
|
110
110
|
"data-status": T,
|
|
111
111
|
"data-image-status": z,
|
|
112
|
-
className: t(r.root, _[
|
|
112
|
+
className: t(r.root, _[re], v[ie], y[h], b[ae], I && r.inGroup, D && r.bordered, O && r.ring, O && x[k], M),
|
|
113
113
|
children: [/* @__PURE__ */ l("span", {
|
|
114
114
|
className: r.face,
|
|
115
115
|
children: $
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`
|
|
1
|
+
var e=`_root_1mppz_29`,t=`_face_1mppz_65`,n=`_xs_1mppz_93`,r=`_sm_1mppz_101`,i=`_md_1mppz_109`,a=`_lg_1mppz_117`,o=`_xl_1mppz_125`,s=`_size2xl_1mppz_133`,c=`_circle_1mppz_145`,l=`_rounded_1mppz_151`,u=`_square_1mppz_157`,d=`_soft_1mppz_169`,f=`_toneNeutral_1mppz_169`,p=`_tonePrimary_1mppz_171`,m=`_toneAccent_1mppz_173`,h=`_toneSuccess_1mppz_175`,g=`_toneWarning_1mppz_177`,_=`_toneDanger_1mppz_179`,v=`_toneInfo_1mppz_181`,y=`_solid_1mppz_185`,b=`_image_1mppz_217`,x=`_imageLoaded_1mppz_237`,S=`_initials_1mppz_245`,C=`_surplus_1mppz_263`,w=`_icon_1mppz_273`,T=`_inGroup_1mppz_287`,E=`_ring_1mppz_295`,D=`_bordered_1mppz_313`,O=`_ringNeutral_1mppz_349`,k=`_ringPrimary_1mppz_351`,A=`_ringAccent_1mppz_353`,j=`_ringSuccess_1mppz_355`,M=`_ringWarning_1mppz_357`,N=`_ringDanger_1mppz_359`,P=`_ringInfo_1mppz_361`,F=`_status_1mppz_379`,I=`_statusOnline_1mppz_421`,L=`_statusAway_1mppz_429`,R=`_statusBusy_1mppz_461`,z=`_statusOffline_1mppz_491`,B=`_group_1mppz_511`,V=`_spacingSm_1mppz_539`,H=`_spacingMd_1mppz_545`,U=`_spacingLg_1mppz_551`,W={root:e,face:t,xs:n,sm:r,md:i,lg:a,xl:o,size2xl:s,circle:c,rounded:l,square:u,soft:d,toneNeutral:f,tonePrimary:p,toneAccent:m,toneSuccess:h,toneWarning:g,toneDanger:_,toneInfo:v,solid:y,image:b,imageLoaded:x,initials:S,surplus:C,icon:w,inGroup:T,ring:E,bordered:D,ringNeutral:O,ringPrimary:k,ringAccent:A,ringSuccess:j,ringWarning:M,ringDanger:N,ringInfo:P,status:F,statusOnline:I,statusAway:L,statusBusy:R,statusOffline:z,group:B,spacingSm:V,spacingMd:H,spacingLg:U};exports.bordered=D,exports.circle=c,exports.default=W,exports.face=t,exports.group=B,exports.icon=w,exports.image=b,exports.imageLoaded=x,exports.inGroup=T,exports.initials=S,exports.lg=a,exports.md=i,exports.ring=E,exports.ringAccent=A,exports.ringDanger=N,exports.ringInfo=P,exports.ringNeutral=O,exports.ringPrimary=k,exports.ringSuccess=j,exports.ringWarning=M,exports.root=e,exports.rounded=l,exports.size2xl=s,exports.sm=r,exports.soft=d,exports.solid=y,exports.spacingLg=U,exports.spacingMd=H,exports.spacingSm=V,exports.square=u,exports.status=F,exports.statusAway=L,exports.statusBusy=R,exports.statusOffline=z,exports.statusOnline=I,exports.surplus=C,exports.toneAccent=m,exports.toneDanger=_,exports.toneInfo=v,exports.toneNeutral=f,exports.tonePrimary=p,exports.toneSuccess=h,exports.toneWarning=g,exports.xl=o,exports.xs=n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/data-display/Avatar/Avatar.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_root_1mppz_29", t = "_face_1mppz_65", n = "_xs_1mppz_93", r = "_sm_1mppz_101", i = "_md_1mppz_109", a = "_lg_1mppz_117", o = "_xl_1mppz_125", s = "_size2xl_1mppz_133", c = "_circle_1mppz_145", l = "_rounded_1mppz_151", u = "_square_1mppz_157", d = "_soft_1mppz_169", f = "_toneNeutral_1mppz_169", p = "_tonePrimary_1mppz_171", m = "_toneAccent_1mppz_173", h = "_toneSuccess_1mppz_175", g = "_toneWarning_1mppz_177", _ = "_toneDanger_1mppz_179", v = "_toneInfo_1mppz_181", y = "_solid_1mppz_185", b = "_image_1mppz_217", x = "_imageLoaded_1mppz_237", S = "_initials_1mppz_245", C = "_surplus_1mppz_263", w = "_icon_1mppz_273", T = "_inGroup_1mppz_287", E = "_ring_1mppz_295", D = "_bordered_1mppz_313", O = "_ringNeutral_1mppz_349", k = "_ringPrimary_1mppz_351", A = "_ringAccent_1mppz_353", j = "_ringSuccess_1mppz_355", M = "_ringWarning_1mppz_357", N = "_ringDanger_1mppz_359", P = "_ringInfo_1mppz_361", F = "_status_1mppz_379", I = "_statusOnline_1mppz_421", L = "_statusAway_1mppz_429", R = "_statusBusy_1mppz_461", z = "_statusOffline_1mppz_491", B = "_group_1mppz_511", V = "_spacingSm_1mppz_539", H = "_spacingMd_1mppz_545", U = "_spacingLg_1mppz_551", W = {
|
|
3
3
|
root: e,
|
|
4
4
|
face: t,
|
|
5
5
|
xs: n,
|
|
@@ -27,22 +27,23 @@ var e = "_root_qebz0_25", t = "_face_qebz0_61", n = "_xs_qebz0_89", r = "_sm_qeb
|
|
|
27
27
|
icon: w,
|
|
28
28
|
inGroup: T,
|
|
29
29
|
ring: E,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
bordered: D,
|
|
31
|
+
ringNeutral: O,
|
|
32
|
+
ringPrimary: k,
|
|
33
|
+
ringAccent: A,
|
|
34
|
+
ringSuccess: j,
|
|
35
|
+
ringWarning: M,
|
|
36
|
+
ringDanger: N,
|
|
37
|
+
ringInfo: P,
|
|
38
|
+
status: F,
|
|
39
|
+
statusOnline: I,
|
|
40
|
+
statusAway: L,
|
|
41
|
+
statusBusy: R,
|
|
42
|
+
statusOffline: z,
|
|
43
|
+
group: B,
|
|
44
|
+
spacingSm: V,
|
|
45
|
+
spacingMd: H,
|
|
46
|
+
spacingLg: U
|
|
46
47
|
};
|
|
47
48
|
//#endregion
|
|
48
|
-
export { c as circle,
|
|
49
|
+
export { D as bordered, c as circle, W as default, t as face, B as group, w as icon, b as image, x as imageLoaded, T as inGroup, S as initials, a as lg, i as md, E as ring, A as ringAccent, N as ringDanger, P as ringInfo, O as ringNeutral, k as ringPrimary, j as ringSuccess, M as ringWarning, e as root, l as rounded, s as size2xl, r as sm, d as soft, y as solid, U as spacingLg, H as spacingMd, V as spacingSm, u as square, F as status, L as statusAway, R as statusBusy, z as statusOffline, I as statusOnline, C as surplus, m as toneAccent, _ as toneDanger, v as toneInfo, f as toneNeutral, p as tonePrimary, h as toneSuccess, g as toneWarning, o as xl, n as xs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),t=require("./toastStore.cjs.js"),n=require("./useToast.cjs.js"),r=require("./ToastViewport.cjs.js");let i=require("react"),a=require("react/jsx-runtime");var o=[`F8`],s=({children:s,store:c=t.toastStore,placement:l=`bottom-end`,max:u=3,duration:d=5e3,gap:f=3,label:
|
|
1
|
+
const e=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),t=require("./toastStore.cjs.js"),n=require("./useToast.cjs.js"),r=require("./ToastViewport.cjs.js");let i=require("react"),a=require("react/jsx-runtime");var o=[`F8`],s=globalThis.process?.env?.NODE_ENV!==`production`,c=typeof window<`u`?i.useLayoutEffect:i.useEffect,l=new Map,u=new Set,d=e=>(u.add(e),()=>{u.delete(e)}),f=()=>u.forEach(e=>e());function p(e,t){let[n]=(0,i.useState)(()=>Symbol(`ToastProvider`));return c(()=>{if(t)return;let r=l.get(e)??[];return s&&r.length>0&&console.warn("[ToastProvider] Another ToastProvider already shows this store's toasts, so this one won't draw a second viewport. Use one ToastProvider near the root of your app (inside your LocaleProvider), or pass `store={createToastStore()}` to keep separate toasts."),l.set(e,[...r,n]),f(),()=>{let t=(l.get(e)??[]).filter(e=>e!==n);t.length>0?l.set(e,t):l.delete(e),f()}},[e,t,n]),(0,i.useSyncExternalStore)(d,()=>!t&&l.get(e)?.[0]===n,()=>!t)}var m=({children:s,store:c=t.toastStore,placement:l=`bottom-end`,max:u=3,duration:d=5e3,gap:f=3,label:m,hotkey:h=o,showProgress:g=!1,toneLabels:_,closeLabel:v,queuedLabel:y,className:b})=>{let x=e.useMessages(),S=p(c,(0,i.useContext)(n.ToastContext)?.store===c),C=m??x.toast.region,w=v??x.toast.dismiss,T=y??x.toast.queued,E=(0,i.useMemo)(()=>({store:c,api:c===t.toastStore?t.toast:t.createToastApi(c)}),[c]),D=(0,i.useMemo)(()=>({neutral:``,...x.toast.tone,..._}),[x.toast.tone,_]);return(0,a.jsxs)(n.ToastContext.Provider,{value:E,children:[s,S&&(0,a.jsx)(r.ToastViewport,{store:c,placement:l,max:u,duration:d,gap:f,label:C,hotkey:h,showProgress:g,toneLabels:D,closeLabel:w,queuedLabel:T,className:b})]})};exports.ToastProvider=m;
|
|
@@ -45,7 +45,10 @@ export interface ToastProviderProps {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Renders the toast viewport (in a portal) and provides `useToast()`.
|
|
48
|
-
* Place it once near the root of your app
|
|
48
|
+
* Place it once near the root of your app, inside your `LocaleProvider` so
|
|
49
|
+
* its built-in text (like "+2 more notifications") is in the app's language.
|
|
50
|
+
* Each store gets one viewport: a second provider on the same store (nested
|
|
51
|
+
* or not) only provides `useToast()`, so toasts are never drawn twice.
|
|
49
52
|
*
|
|
50
53
|
* Accessibility:
|
|
51
54
|
* - The viewport is a labelled region ("Notifications (F8)"). The hotkey
|
|
@@ -2,35 +2,53 @@ import { useMessages as e } from "../../utilities/LocaleProvider/LocaleProvider.
|
|
|
2
2
|
import { createToastApi as t, toast as n, toastStore as r } from "./toastStore.mjs";
|
|
3
3
|
import { ToastContext as i } from "./useToast.mjs";
|
|
4
4
|
import { ToastViewport as a } from "./ToastViewport.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
5
|
+
import { useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useState as u, useSyncExternalStore as d } from "react";
|
|
6
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/feedback/Toast/ToastProvider.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var m = ["F8"], h = globalThis.process?.env?.NODE_ENV !== "production", g = typeof window < "u" ? c : s, _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), y = (e) => (v.add(e), () => {
|
|
9
|
+
v.delete(e);
|
|
10
|
+
}), b = () => v.forEach((e) => e());
|
|
11
|
+
function x(e, t) {
|
|
12
|
+
let [n] = u(() => Symbol("ToastProvider"));
|
|
13
|
+
return g(() => {
|
|
14
|
+
if (t) return;
|
|
15
|
+
let r = _.get(e) ?? [];
|
|
16
|
+
return h && r.length > 0 && console.warn("[ToastProvider] Another ToastProvider already shows this store's toasts, so this one won't draw a second viewport. Use one ToastProvider near the root of your app (inside your LocaleProvider), or pass `store={createToastStore()}` to keep separate toasts."), _.set(e, [...r, n]), b(), () => {
|
|
17
|
+
let t = (_.get(e) ?? []).filter((e) => e !== n);
|
|
18
|
+
t.length > 0 ? _.set(e, t) : _.delete(e), b();
|
|
19
|
+
};
|
|
20
|
+
}, [
|
|
21
|
+
e,
|
|
22
|
+
t,
|
|
23
|
+
n
|
|
24
|
+
]), d(y, () => !t && _.get(e)?.[0] === n, () => !t);
|
|
25
|
+
}
|
|
26
|
+
var S = ({ children: s, store: c = r, placement: u = "bottom-end", max: d = 3, duration: h = 5e3, gap: g = 3, label: _, hotkey: v = m, showProgress: y = !1, toneLabels: b, closeLabel: S, queuedLabel: C, className: w }) => {
|
|
27
|
+
let T = e(), E = x(c, o(i)?.store === c), D = _ ?? T.toast.region, O = S ?? T.toast.dismiss, k = C ?? T.toast.queued, A = l(() => ({
|
|
28
|
+
store: c,
|
|
29
|
+
api: c === r ? n : t(c)
|
|
30
|
+
}), [c]), j = l(() => ({
|
|
13
31
|
neutral: "",
|
|
14
|
-
...
|
|
15
|
-
...
|
|
16
|
-
}), [
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
value:
|
|
19
|
-
children: [
|
|
20
|
-
store:
|
|
21
|
-
placement:
|
|
22
|
-
max:
|
|
23
|
-
duration:
|
|
24
|
-
gap:
|
|
25
|
-
label:
|
|
26
|
-
hotkey:
|
|
27
|
-
showProgress:
|
|
28
|
-
toneLabels:
|
|
29
|
-
closeLabel:
|
|
30
|
-
queuedLabel:
|
|
31
|
-
className:
|
|
32
|
+
...T.toast.tone,
|
|
33
|
+
...b
|
|
34
|
+
}), [T.toast.tone, b]);
|
|
35
|
+
return /* @__PURE__ */ p(i.Provider, {
|
|
36
|
+
value: A,
|
|
37
|
+
children: [s, E && /* @__PURE__ */ f(a, {
|
|
38
|
+
store: c,
|
|
39
|
+
placement: u,
|
|
40
|
+
max: d,
|
|
41
|
+
duration: h,
|
|
42
|
+
gap: g,
|
|
43
|
+
label: D,
|
|
44
|
+
hotkey: v,
|
|
45
|
+
showProgress: y,
|
|
46
|
+
toneLabels: j,
|
|
47
|
+
closeLabel: O,
|
|
48
|
+
queuedLabel: k,
|
|
49
|
+
className: w
|
|
32
50
|
})]
|
|
33
51
|
});
|
|
34
52
|
};
|
|
35
53
|
//#endregion
|
|
36
|
-
export {
|
|
54
|
+
export { S as ToastProvider };
|