@vjdesigns/vjdesigns-ui 2.1.0 → 2.2.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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @vjdesigns/vjdesigns-ui 2.
|
|
1
|
+
# @vjdesigns/vjdesigns-ui 2.1.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
|
|
|
@@ -2411,6 +2411,7 @@ announce it yourself if needed.
|
|
|
2411
2411
|
- Update (progressive upload)
|
|
2412
2412
|
- Placements
|
|
2413
2413
|
- Queue and max
|
|
2414
|
+
- 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
2415
|
- Hotkey focus (F8)
|
|
2415
2416
|
- Pause on hover and focus
|
|
2416
2417
|
- 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 +2426,10 @@ import { ToastProvider } from "@vjdesigns/vjdesigns-ui";
|
|
|
2425
2426
|
Category: feedback · Storybook: Feedback/Toast
|
|
2426
2427
|
|
|
2427
2428
|
Renders the toast viewport (in a portal) and provides `useToast()`.
|
|
2428
|
-
Place it once near the root of your app
|
|
2429
|
+
Place it once near the root of your app, inside your `LocaleProvider` so
|
|
2430
|
+
its built-in text (like "+2 more notifications") is in the app's language.
|
|
2431
|
+
Each store gets one viewport: a second provider on the same store (nested
|
|
2432
|
+
or not) only provides `useToast()`, so toasts are never drawn twice.
|
|
2429
2433
|
|
|
2430
2434
|
Accessibility:
|
|
2431
2435
|
- The viewport is a labelled region ("Notifications (F8)"). The hotkey
|
package/dist/ai/registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vjdesigns/vjdesigns-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.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",
|
|
@@ -5706,6 +5706,10 @@
|
|
|
5706
5706
|
"name": "Queue and max",
|
|
5707
5707
|
"description": ""
|
|
5708
5708
|
},
|
|
5709
|
+
{
|
|
5710
|
+
"name": "One viewport per store",
|
|
5711
|
+
"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."
|
|
5712
|
+
},
|
|
5709
5713
|
{
|
|
5710
5714
|
"name": "Hotkey focus (F8)",
|
|
5711
5715
|
"description": ""
|
|
@@ -5737,7 +5741,7 @@
|
|
|
5737
5741
|
"category": "feedback",
|
|
5738
5742
|
"folder": "Toast",
|
|
5739
5743
|
"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.",
|
|
5744
|
+
"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
5745
|
"props": [
|
|
5742
5746
|
{
|
|
5743
5747
|
"name": "children",
|
|
@@ -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 };
|