wimui 0.64.0 → 0.64.3
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/components/feedback/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.d.ts +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.js +81 -79
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.js +85 -66
- package/dist/components/feedback/Toast/toast.module.cjs +1 -1
- package/dist/components/feedback/Toast/toast.module.js +27 -26
- package/dist/components/form/RichTextEditor/RichTextEditor.cjs +1 -1
- package/dist/components/form/RichTextEditor/RichTextEditor.js +5 -1
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.d.ts +2 -0
- package/dist/components/media/Lightbox/Lightbox.js +25 -22
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../_internal/OverlayBase.cjs"),i=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),a=require("../../../i18n/generated/components.cjs"),o=require("../../../icon/chevron-left.cjs"),s=require("../../../icon/chevron-right.cjs"),c=require("../../../icon/close.cjs"),l=require("../../../icon/minus.cjs"),u=require("../../../icon/plus.cjs"),d=require("../Icon/Icon.cjs"),f=require("./lightbox.module.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("classnames");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=(0,p.createContext)(void 0),_=()=>{let e=(0,p.useContext)(g);if(!e)throw Error(`Lightbox components must be used within Lightbox`);return e},v=({children:e,open:t,onOpenChange:n,defaultOpen:r=!1,defaultIndex:i=0})=>{let[a,o]=(0,p.useState)(r),[s,c]=(0,p.useState)(i),[l,u]=(0,p.useState)([]),d=t!==void 0,
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../_internal/OverlayBase.cjs"),i=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),a=require("../../../i18n/generated/components.cjs"),o=require("../../../icon/chevron-left.cjs"),s=require("../../../icon/chevron-right.cjs"),c=require("../../../icon/close.cjs"),l=require("../../../icon/minus.cjs"),u=require("../../../icon/plus.cjs"),d=require("../Icon/Icon.cjs"),f=require("./lightbox.module.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("classnames");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=(0,p.createContext)(void 0),_=()=>{let e=(0,p.useContext)(g);if(!e)throw Error(`Lightbox components must be used within Lightbox`);return e},v=({children:e,open:t,onOpenChange:n,defaultOpen:r=!1,defaultIndex:i=0})=>{let[a,o]=(0,p.useState)(r),[s,c]=(0,p.useState)(i),[l,u]=(0,p.useState)([]),[d,f]=(0,p.useState)(null);if(d!==null){let e=l.findIndex(e=>e.src===d);e!==-1&&(f(null),e!==s&&c(e))}let m=t!==void 0,_=m?t:a,v=(0,p.useCallback)(e=>{m||o(e),n?.(e)},[m,n]),y=(0,p.useCallback)(e=>{let t=-1;return u(n=>(t=n.length,[...n,e])),t},[]),b=(0,p.useCallback)(e=>{u(t=>t.some(t=>t.src===e.src)?t:[...t,e]),f(e.src),v(!0)},[v]),x=(0,p.useCallback)(e=>{},[]);return(0,h.jsx)(g.Provider,{value:{open:_,setOpen:v,currentIndex:s,setCurrentIndex:c,items:l,openItem:b,setItems:u,registerItem:y,unregisterItem:x},children:e})},y=({children:e,className:r,onClick:i,asChild:o=!1,index:s,src:c,alt:l,caption:u,...d})=>{let{setOpen:p,setCurrentIndex:g,items:v,openItem:y}=_(),{t:b}=n.useWimTranslation(a.componentsNs),x=e=>{if(i?.(e),c&&s===void 0){y({src:c,alt:l,caption:u});return}s!==void 0&&g(s),p(!0)},S=o?t.Root:`button`,C=s===void 0?void 0:v[s]?.alt,w=d[`aria-label`]!==void 0||d[`aria-labelledby`]!==void 0,T=l??C,E=w?void 0:T?b(`lightbox.open_named`,{name:T}):b(`lightbox.open`);return(0,h.jsx)(S,{type:`button`,className:(0,m.default)(f.default.trigger,r),onClick:x,"aria-label":E,...d,children:(0,h.jsx)(t.Slottable,{children:e})})},b=({className:e,showCloseButton:t=!0,showNavigation:g=!0,showCounter:v=!0,closeOnOverlayClick:y=!0,...b})=>{let{open:x,setOpen:S,currentIndex:C,setCurrentIndex:w,items:T}=_(),{t:E}=n.useWimTranslation(a.componentsNs),[D,O]=(0,p.useState)(1),[k,A]=(0,p.useState)(``);!x&&k&&A(``);let j=(0,p.useCallback)(e=>{let t=T[e],n=t?.title||t?.alt,r=E(`lightbox.image_status`,{current:e+1,total:T.length});A(n?`${r}: ${n}`:r),w(e),O(1)},[T,w,E]),M=(0,p.useCallback)(()=>{j((C-1+T.length)%T.length)},[C,T.length,j]),N=(0,p.useCallback)(()=>{j((C+1)%T.length)},[C,T.length,j]),P=()=>{O(e=>e===1?2:1)};(0,p.useEffect)(()=>{if(!x)return;let e=e=>{e.key===`ArrowLeft`&&M(),e.key===`ArrowRight`&&N(),e.key===`Escape`&&S(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,M,N,S]);let F=T[C];return F?(0,h.jsx)(r.OverlayBase,{...b,open:x,onOpenChange:S,closeOnOverlayClick:y,overlayClassName:f.default.overlay,className:(0,m.default)(`wim-lightbox`,f.default.contentRoot,e),"aria-label":b[`aria-labelledby`]?void 0:b[`aria-label`]??(F.title||F.alt||E(`lightbox.dialog`)),transitionProps:{preset:`fade`,enter:f.default.contentEnter,enterFrom:f.default.contentEnterFrom,enterTo:f.default.contentEnterTo},children:(0,h.jsxs)(`div`,{className:f.default.container,children:[(0,h.jsx)(i.VisuallyHidden,{role:`status`,"aria-atomic":`true`,children:k}),(0,h.jsxs)(`div`,{className:f.default.header,children:[v&&T.length>1&&(0,h.jsx)(`div`,{className:f.default.counter,children:E(`lightbox.counter`,{current:C+1,total:T.length})}),(0,h.jsxs)(`div`,{className:f.default.controls,children:[(0,h.jsx)(`button`,{className:f.default.iconButton,onClick:P,"aria-label":E(D>1?`lightbox.zoom_out`:`lightbox.zoom_in`),children:D>1?(0,h.jsx)(d.Icon,{component:l.default}):(0,h.jsx)(d.Icon,{component:u.default})}),t&&(0,h.jsx)(`button`,{className:f.default.iconButton,onClick:()=>S(!1),"aria-label":E(`lightbox.close`),children:(0,h.jsx)(d.Icon,{component:c.default})})]})]}),(0,h.jsxs)(`div`,{className:f.default.viewport,children:[g&&T.length>1&&(0,h.jsx)(`button`,{className:(0,m.default)(f.default.navButton,f.default.prev),onClick:M,"aria-label":E(`lightbox.previous`),children:(0,h.jsx)(d.Icon,{component:o.default})}),(0,h.jsx)(`div`,{className:f.default.mediaWrapper,style:{transform:`scale(${D})`},children:(0,h.jsx)(`img`,{src:F.src,alt:F.alt||``,className:f.default.image})}),g&&T.length>1&&(0,h.jsx)(`button`,{className:(0,m.default)(f.default.navButton,f.default.next),onClick:N,"aria-label":E(`lightbox.next`),children:(0,h.jsx)(d.Icon,{component:s.default})})]}),(F.title||F.caption)&&(0,h.jsxs)(`div`,{className:f.default.footer,children:[F.title&&(0,h.jsx)(`h3`,{className:f.default.title,children:F.title}),F.caption&&(0,h.jsx)(`p`,{className:f.default.caption,children:F.caption})]})]})}):null},x=({items:e,children:t})=>{let{setItems:n}=_();return(0,p.useEffect)(()=>{n(e)},[e,n]),(0,h.jsx)(`div`,{className:f.default.gallery,children:t})},S=v;S.Trigger=y,S.Content=b,S.Gallery=x,S.displayName=`Lightbox`,y.displayName=`Lightbox.Trigger`,b.displayName=`Lightbox.Content`,x.displayName=`Lightbox.Gallery`,exports.Lightbox=v,exports.LightboxContent=b,exports.LightboxGallery=x,exports.LightboxRoot=S,exports.default=S,exports.LightboxTrigger=y,exports.useLightbox=_;
|
|
@@ -12,6 +12,8 @@ interface LightboxContextType {
|
|
|
12
12
|
currentIndex: number;
|
|
13
13
|
setCurrentIndex: (index: number | ((prev: number) => number)) => void;
|
|
14
14
|
items: LightboxItem[];
|
|
15
|
+
/** Open on the item with this `src`, adding it when it is not registered yet. */
|
|
16
|
+
openItem: (item: LightboxItem) => void;
|
|
15
17
|
setItems: React.Dispatch<React.SetStateAction<LightboxItem[]>>;
|
|
16
18
|
registerItem: (item: LightboxItem) => number;
|
|
17
19
|
unregisterItem: (index: number) => void;
|
|
@@ -20,41 +20,44 @@ var x = p(void 0), S = () => {
|
|
|
20
20
|
if (!e) throw Error("Lightbox components must be used within Lightbox");
|
|
21
21
|
return e;
|
|
22
22
|
}, C = ({ children: e, open: t, onOpenChange: n, defaultOpen: r = !1, defaultIndex: i = 0 }) => {
|
|
23
|
-
let [a, o] = _(r), [s, c] = _(i), [l, u] = _([]), d
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
let [a, o] = _(r), [s, c] = _(i), [l, u] = _([]), [d, f] = _(null);
|
|
24
|
+
if (d !== null) {
|
|
25
|
+
let e = l.findIndex((e) => e.src === d);
|
|
26
|
+
e !== -1 && (f(null), e !== s && c(e));
|
|
27
|
+
}
|
|
28
|
+
let p = t !== void 0, h = p ? t : a, g = m((e) => {
|
|
29
|
+
p || o(e), n?.(e);
|
|
30
|
+
}, [p, n]), v = m((e) => {
|
|
26
31
|
let t = -1;
|
|
27
32
|
return u((n) => (t = n.length, [...n, e])), t;
|
|
28
|
-
}, []),
|
|
33
|
+
}, []), b = m((e) => {
|
|
34
|
+
u((t) => t.some((t) => t.src === e.src) ? t : [...t, e]), f(e.src), g(!0);
|
|
35
|
+
}, [g]), S = m((e) => {}, []);
|
|
29
36
|
return /* @__PURE__ */ y(x.Provider, {
|
|
30
37
|
value: {
|
|
31
|
-
open:
|
|
32
|
-
setOpen:
|
|
38
|
+
open: h,
|
|
39
|
+
setOpen: g,
|
|
33
40
|
currentIndex: s,
|
|
34
41
|
setCurrentIndex: c,
|
|
35
42
|
items: l,
|
|
43
|
+
openItem: b,
|
|
36
44
|
setItems: u,
|
|
37
|
-
registerItem:
|
|
38
|
-
unregisterItem:
|
|
45
|
+
registerItem: v,
|
|
46
|
+
unregisterItem: S
|
|
39
47
|
},
|
|
40
48
|
children: e
|
|
41
49
|
});
|
|
42
50
|
}, w = ({ children: r, className: i, onClick: o, asChild: s = !1, index: c, src: l, alt: u, caption: d, ...p }) => {
|
|
43
|
-
let { setOpen: m, setCurrentIndex: h, items: g,
|
|
44
|
-
if (o?.(e), c
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
src: l,
|
|
52
|
-
alt: u,
|
|
53
|
-
caption: d
|
|
54
|
-
}]), h(e);
|
|
55
|
-
}
|
|
51
|
+
let { setOpen: m, setCurrentIndex: h, items: g, openItem: _ } = S(), { t: b } = n(a), x = (e) => {
|
|
52
|
+
if (o?.(e), l && c === void 0) {
|
|
53
|
+
_({
|
|
54
|
+
src: l,
|
|
55
|
+
alt: u,
|
|
56
|
+
caption: d
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
56
59
|
}
|
|
57
|
-
m(!0);
|
|
60
|
+
c !== void 0 && h(c), m(!0);
|
|
58
61
|
}, C = s ? e : "button", w = c === void 0 ? void 0 : g[c]?.alt, T = p["aria-label"] !== void 0 || p["aria-labelledby"] !== void 0, E = u ?? w, D = T ? void 0 : E ? b("lightbox.open_named", { name: E }) : b("lightbox.open");
|
|
59
62
|
return /* @__PURE__ */ y(C, {
|
|
60
63
|
type: "button",
|
package/dist/llms-full.txt
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## What this is
|
|
6
6
|
|
|
7
|
-
**wimui** v0.64.
|
|
7
|
+
**wimui** v0.64.3 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
|
|
8
8
|
|
|
9
9
|
## Install & required setup
|
|
10
10
|
|
package/dist/llms.txt
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## What this is
|
|
6
6
|
|
|
7
|
-
**wimui** v0.64.
|
|
7
|
+
**wimui** v0.64.3 — a React 19 component library: 228 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
|
|
8
8
|
|
|
9
9
|
## Install & required setup
|
|
10
10
|
|