wimui 0.72.0 → 0.73.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/WimProvider.d.ts +5 -0
- package/dist/components/_internal/useAnnounce.d.ts +18 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.js +5 -5
- package/dist/components/data-display/Calendar/Calendar.cjs +1 -1
- package/dist/components/data-display/Calendar/Calendar.js +258 -141
- package/dist/components/data-display/Calendar/calendar.module.cjs +1 -1
- package/dist/components/data-display/Calendar/calendar.module.js +16 -13
- package/dist/components/data-display/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/data-display/InfiniteScroll/InfiniteScroll.js +4 -4
- package/dist/components/data-display/Kanban/Kanban.cjs +1 -1
- package/dist/components/data-display/Kanban/Kanban.d.ts +4 -1
- package/dist/components/data-display/Kanban/Kanban.js +142 -97
- package/dist/components/data-display/Kanban/kanban.module.cjs +1 -1
- package/dist/components/data-display/Kanban/kanban.module.js +7 -6
- package/dist/components/data-display/Table/useTableSort.d.ts +9 -3
- package/dist/components/feedback/Notification/Notification.d.ts +13 -0
- package/dist/components/feedback/Snackbar/Snackbar.d.ts +14 -0
- package/dist/components/feedback/Toast/Toast.d.ts +13 -0
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.d.ts +0 -13
- package/dist/components/media/Lightbox/Lightbox.js +1 -1
- package/dist/components/overlay/Dialog/Dialog.cjs +1 -1
- package/dist/components/overlay/Dialog/Dialog.d.ts +0 -9
- package/dist/components/overlay/Dialog/Dialog.js +1 -1
- package/dist/components/overlay/Drawer/Drawer.cjs +1 -1
- package/dist/components/overlay/Drawer/Drawer.d.ts +0 -10
- package/dist/components/overlay/Drawer/Drawer.js +1 -1
- package/dist/hooks/useAutoResize.d.ts +8 -2
- package/dist/i18n/generated/data-display.cjs +1 -1
- package/dist/i18n/generated/data-display.d.ts +1 -1
- package/dist/i18n/generated/data-display.js +36 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +232 -231
- package/dist/llms/Calendar.md +1 -1
- package/dist/llms/Kanban.md +2 -2
- package/dist/llms-full.txt +93 -2
- package/dist/llms.txt +17 -1
- package/dist/locales/en/data-display.json +12 -1
- package/dist/locales/ja/data-display.json +12 -1
- package/dist/locales/pt/data-display.json +12 -1
- package/dist/media.cjs +1 -1
- package/dist/media.js +4 -4
- package/dist/overlay.cjs +1 -1
- package/dist/overlay.js +11 -11
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +7 -5
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/Calendar/calendar.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_vhqlf_3", t = "_disabled_vhqlf_13", n = "_header_vhqlf_16", r = "_day_vhqlf_17", i = "_title_vhqlf_26", a = "_titleBtn_vhqlf_31", o = "_levelGrid_vhqlf_50", s = "_levelCell_vhqlf_58", c = "_selected_vhqlf_71", l = "_navBtn_vhqlf_92", u = "_grid_vhqlf_116", d = "_weekday_vhqlf_124", f = "_sunday_vhqlf_134", p = "_saturday_vhqlf_137", m = "_otherMonth_vhqlf_170", h = "_today_vhqlf_173", g = "_inRange_vhqlf_186", _ = "_rangeStart_vhqlf_196", v = "_rangeEnd_vhqlf_200", y = {
|
|
4
4
|
root: e,
|
|
5
5
|
disabled: t,
|
|
6
6
|
header: n,
|
|
7
7
|
day: r,
|
|
8
8
|
title: i,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
titleBtn: a,
|
|
10
|
+
levelGrid: o,
|
|
11
|
+
levelCell: s,
|
|
12
|
+
selected: c,
|
|
13
|
+
navBtn: l,
|
|
14
|
+
grid: u,
|
|
15
|
+
weekday: d,
|
|
16
|
+
sunday: f,
|
|
17
|
+
saturday: p,
|
|
18
|
+
otherMonth: m,
|
|
19
|
+
today: h,
|
|
20
|
+
inRange: g,
|
|
21
|
+
rangeStart: _,
|
|
22
|
+
rangeEnd: v
|
|
20
23
|
};
|
|
21
24
|
//#endregion
|
|
22
|
-
export { r as day,
|
|
25
|
+
export { r as day, y as default, t as disabled, u as grid, n as header, g as inRange, s as levelCell, o as levelGrid, l as navBtn, m as otherMonth, v as rangeEnd, _ as rangeStart, e as root, p as saturday, c as selected, f as sunday, i as title, a as titleBtn, h as today, d as weekday };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../_internal/useAnnounce.cjs"),r=require("
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../_internal/useAnnounce.cjs"),r=require("../../../i18n/generated/data-display.cjs"),i=require("../../feedback/Spinner/Spinner.cjs"),a=require("./infinite-scroll.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=({children:e,hasMore:l=!1,loading:u=!1,onLoadMore:d,loader:f,threshold:p=250,className:m,container:h})=>{let g=(0,o.useRef)(null),{t:_}=t.useWimTranslation(r.dataDisplayNs),{ref:v,region:y}=n.useAnnounceAppearance(u),b=(0,o.useCallback)(e=>{let[t]=e;t.isIntersecting&&l&&d()},[l,d]);return(0,o.useEffect)(()=>{let e={root:h?.current||null,rootMargin:`0px 0px ${p}px 0px`,threshold:0},t=new IntersectionObserver(b,e),n=g.current;return n&&t.observe(n),()=>{n&&t.unobserve(n)}},[b,h,p]),(0,c.jsxs)(`div`,{className:(0,s.default)(`wim-infinite-scroll`,a.default.root,m),children:[y,e,u&&(0,c.jsx)(`div`,{ref:v,className:a.default.loader,children:(0,c.jsx)(n.AnnouncedByParent.Provider,{value:!0,children:f??(0,c.jsx)(i.Spinner,{size:`sm`,label:_(`infinite_scroll.loading`)})})}),l&&(0,c.jsx)(`div`,{ref:g,className:a.default.loader})]})};exports.InfiniteScroll=l;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { AnnouncedByParent as t, useAnnounceAppearance as n } from "../../_internal/useAnnounce.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { dataDisplayNs as r } from "../../../i18n/generated/data-display.js";
|
|
5
|
+
import { Spinner as i } from "../../feedback/Spinner/Spinner.js";
|
|
6
6
|
import a from "./infinite-scroll.module.js";
|
|
7
7
|
import { useCallback as o, useEffect as s, useRef as c } from "react";
|
|
8
8
|
import l from "classnames";
|
|
9
9
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/data-display/InfiniteScroll/InfiniteScroll.tsx
|
|
11
11
|
var f = ({ children: f, hasMore: p = !1, loading: m = !1, onLoadMore: h, loader: g, threshold: _ = 250, className: v, container: y }) => {
|
|
12
|
-
let b = c(null), { t: x } = e(
|
|
12
|
+
let b = c(null), { t: x } = e(r), { ref: S, region: C } = n(m), w = o((e) => {
|
|
13
13
|
let [t] = e;
|
|
14
14
|
t.isIntersecting && p && h();
|
|
15
15
|
}, [p, h]);
|
|
@@ -36,7 +36,7 @@ var f = ({ children: f, hasMore: p = !1, loading: m = !1, onLoadMore: h, loader:
|
|
|
36
36
|
className: a.loader,
|
|
37
37
|
children: /* @__PURE__ */ u(t.Provider, {
|
|
38
38
|
value: !0,
|
|
39
|
-
children: g ?? /* @__PURE__ */ u(
|
|
39
|
+
children: g ?? /* @__PURE__ */ u(i, {
|
|
40
40
|
size: "sm",
|
|
41
41
|
label: x("infinite_scroll.loading")
|
|
42
42
|
})
|
|
@@ -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("../../../i18n/generated/common.cjs"),i=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),a=require("../../../icon/more-horizontal.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("./kanban.module.cjs");let
|
|
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("../../../i18n/generated/common.cjs"),i=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),a=require("../../../icon/more-horizontal.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../_internal/useAnnounce.cjs"),c=require("../../../i18n/generated/data-display.cjs"),l=require("./kanban.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime"),p=require("@floating-ui/react");var m=(0,u.forwardRef)(({columns:e,onMove:i,onCardMove:a,className:o,forceMobileUI:p=!1,children:m,asChild:g=!1,..._},y)=>{let{t:b}=n.useWimTranslation([r.commonNs,c.dataDisplayNs]),{announce:S,region:C}=s.useAnnounce(),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)(null),[A,j]=(0,u.useState)(null),M=i||a,N=u.default.useMemo(()=>{if(e)return e;let t=[];return u.default.Children.forEach(m,e=>{if(u.default.isValidElement(e)){let n=e.props;typeof n.id==`string`&&typeof n.title==`string`&&t.push({id:n.id,title:n.title,items:[]})}}),t},[m,e]),P=(e,t=0)=>{let n=N.find(t=>t.id===e);n&&S(b(`kanban.moved`,{column:n.title}),{delay:t})},F=(e,t,n)=>{T({itemId:t,columnId:n}),e.dataTransfer.setData(`text/plain`,`${n}:${t}`),e.dataTransfer.effectAllowed=`move`},I=(e,t)=>{e.preventDefault(),D(t)},L=(e,t)=>{e.preventDefault(),D(null);let[n,r]=e.dataTransfer.getData(`text/plain`).split(`:`);M?.(r,n,t),T(null),n!==t&&P(t)},R=(e,t,n)=>{M?.(e,t,n),k(null),j(e),P(n,700)},z=()=>m||(e?e.map(e=>(0,f.jsx)(x,{id:e.id,title:e.title,cardCount:e.items.length,children:e.items.map(e=>(0,f.jsx)(v,{id:e.id,children:e.content},e.id))},e.id)):null),B=g?t.Root:`div`;return(0,f.jsx)(h.Provider,{value:{draggedItem:w,dragOverColumn:E,setDragOverColumn:D,handleDragStart:F,handleDragOver:I,handleDrop:L,handleMobileMove:R,activeMobileMenu:O,setActiveMobileMenu:k,focusAfterMove:A,setFocusAfterMove:j,columns:N},children:(0,f.jsxs)(B,{..._,ref:y,className:(0,d.default)(`wim-kanban`,l.default.root,p&&l.default.touch,o),role:`region`,"aria-label":_[`aria-labelledby`]?void 0:_[`aria-label`]??b(`a11y.kanban_board`),tabIndex:0,children:[(0,f.jsx)(t.Slottable,{children:z()}),C]})})}),h=u.default.createContext(null),g=()=>{let e=u.default.useContext(h);if(!e)throw Error(`Kanban compound components must be used within Kanban`);return e},_=({id:e,title:t,cardCount:a,children:o,className:s})=>{let{dragOverColumn:c,handleDragOver:p,handleDrop:m,setDragOverColumn:h}=g(),{t:_}=n.useWimTranslation(r.commonNs),y=u.default.useId(),x=u.default.Children.toArray(o),S=x.length>0&&x.every(e=>u.default.isValidElement(e)&&e.type===v);return(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.column,{[l.default.dragOver]:c===e},s),role:`group`,"aria-labelledby":t?y:void 0,onDragOver:t=>p(t,e),onDrop:t=>m(t,e),onDragLeave:()=>h(null),children:[(0,f.jsxs)(`div`,{className:l.default.columnHeader,children:[(0,f.jsx)(`div`,{id:y,className:l.default.columnTitle,"aria-hidden":`true`,children:t}),a!==void 0&&(0,f.jsxs)(`div`,{className:l.default.columnCount,children:[(0,f.jsx)(`span`,{"aria-hidden":`true`,children:a}),(0,f.jsx)(i.VisuallyHidden,{children:_(`a11y.kanban_column_count`,{count:a})})]})]}),(0,f.jsx)(`div`,{className:l.default.columnBody,role:S?`list`:void 0,children:(0,f.jsx)(b.Provider,{value:S,children:o})})]})},v=({id:e,children:t,disabled:i,className:s})=>{let{t:c}=n.useWimTranslation(r.commonNs),{draggedItem:m,handleDragStart:h,handleMobileMove:_,activeMobileMenu:v,setActiveMobileMenu:x,focusAfterMove:S,setFocusAfterMove:C,columns:w}=g(),T=u.default.useContext(y),E=u.default.useContext(b),D=u.default.useRef(null),O=u.default.useRef(null),k=u.default.useId(),A=v===e,{refs:{setReference:j,setFloating:M},floatingStyles:N}=(0,p.useFloating)({open:A,strategy:`fixed`,placement:`bottom-end`,whileElementsMounted:p.autoUpdate,middleware:[(0,p.offset)(4),(0,p.flip)(),(0,p.shift)({padding:10})]});return u.default.useEffect(()=>{S===e&&(D.current?.focus(),C(null))},[S,e,C]),u.default.useEffect(()=>{if(!A)return;let e=e=>{O.current?.contains(e.target)||x(null)},t=e=>{e.key===`Escape`&&O.current?.contains(document.activeElement)&&(e.stopPropagation(),x(null),D.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[A,x]),(0,f.jsxs)(`div`,{role:E?`listitem`:void 0,className:(0,d.default)(l.default.card,{[l.default.dragging]:m?.itemId===e,[l.default.disabled]:i,[l.default.menuOpen]:A},s),draggable:!i,onDragStart:t=>T&&h(t,e,T),children:[(0,f.jsx)(`div`,{className:l.default.cardContent,children:t}),(0,f.jsxs)(`div`,{ref:O,className:l.default.cardMove,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&x(null)},children:[(0,f.jsx)(`button`,{ref:e=>{D.current=e,j(e)},type:`button`,className:l.default.cardMoveBtn,onClick:()=>x(A?null:e),"aria-label":c(`a11y.move_card`),"aria-expanded":A,"aria-controls":A?k:void 0,disabled:i,children:(0,f.jsx)(o.Icon,{component:a.default,size:`sm`})}),A&&(0,f.jsx)(`div`,{id:k,ref:M,style:N,className:l.default.cardMoveMenu,role:`group`,"aria-label":c(`a11y.move_to_column`),children:w.filter(e=>e.id!==T).map(t=>(0,f.jsx)(`button`,{type:`button`,className:l.default.cardMoveOption,onClick:()=>T&&_(e,T,t.id),children:t.title},t.id))})]})]})},y=u.default.createContext(null),b=u.default.createContext(!1),x=e=>(0,f.jsx)(y.Provider,{value:e.id,children:(0,f.jsx)(_,{...e})}),S=m;S.Column=x,S.Card=v,m.displayName=`Kanban`,S.displayName=`KanbanBoard`,_.displayName=`KanbanColumn`,v.displayName=`KanbanCard`,x.displayName=`KanbanColumnWrapper`,exports.Kanban=m,exports.KanbanBoard=S,exports.default=S,exports.KanbanCard=v,exports.KanbanColumn=_;
|
|
@@ -15,7 +15,10 @@ export interface KanbanProps extends Omit<React.ComponentPropsWithoutRef<"div">,
|
|
|
15
15
|
onMove?: (itemId: string, fromColumnId: string, toColumnId: string) => void;
|
|
16
16
|
/** Callback when a card is moved (legacy / alternative name). */
|
|
17
17
|
onCardMove?: (itemId: string, fromColumnId: string, toColumnId: string) => void;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Whether to force the touch-device UI (the move button as a full-width bar under each card).
|
|
20
|
+
* Without it, pointer devices show the move button in the card's corner on hover or focus.
|
|
21
|
+
*/
|
|
19
22
|
forceMobileUI?: boolean;
|
|
20
23
|
/** Whether to render as a child element. */
|
|
21
24
|
asChild?: boolean;
|
|
@@ -5,30 +5,20 @@ import { commonNs as r } from "../../../i18n/generated/common.js";
|
|
|
5
5
|
import { VisuallyHidden as i } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
6
6
|
import a from "../../../icon/more-horizontal.js";
|
|
7
7
|
import { Icon as o } from "../../media/Icon/Icon.js";
|
|
8
|
-
import s from "
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
8
|
+
import { useAnnounce as s } from "../../_internal/useAnnounce.js";
|
|
9
|
+
import { dataDisplayNs as c } from "../../../i18n/generated/data-display.js";
|
|
10
|
+
import l from "./kanban.module.js";
|
|
11
|
+
import u, { forwardRef as d, useState as f } from "react";
|
|
12
|
+
import p from "classnames";
|
|
13
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
14
|
+
import { autoUpdate as g, flip as _, offset as v, shift as y, useFloating as b } from "@floating-ui/react";
|
|
12
15
|
//#region src/components/data-display/Kanban/Kanban.tsx
|
|
13
|
-
var
|
|
14
|
-
let { t:
|
|
15
|
-
C({
|
|
16
|
-
itemId: t,
|
|
17
|
-
columnId: n
|
|
18
|
-
}), e.dataTransfer.setData("text/plain", `${n}:${t}`), e.dataTransfer.effectAllowed = "move";
|
|
19
|
-
}, A = (e, t) => {
|
|
20
|
-
e.preventDefault(), T(t);
|
|
21
|
-
}, j = (e, t) => {
|
|
22
|
-
e.preventDefault(), T(null);
|
|
23
|
-
let [n, r] = e.dataTransfer.getData("text/plain").split(":");
|
|
24
|
-
O?.(r, n, t), C(null);
|
|
25
|
-
}, M = (e, t, n) => {
|
|
26
|
-
O?.(e, t, n), D(null);
|
|
27
|
-
}, N = c.useMemo(() => {
|
|
16
|
+
var x = d(({ columns: i, onMove: a, onCardMove: o, className: d, forceMobileUI: g = !1, children: _, asChild: v = !1, ...y }, b) => {
|
|
17
|
+
let { t: x } = n([r, c]), { announce: C, region: w } = s(), [E, D] = f(null), [k, A] = f(null), [j, M] = f(null), [N, P] = f(null), F = a || o, I = u.useMemo(() => {
|
|
28
18
|
if (i) return i;
|
|
29
19
|
let e = [];
|
|
30
|
-
return
|
|
31
|
-
if (
|
|
20
|
+
return u.Children.forEach(_, (t) => {
|
|
21
|
+
if (u.isValidElement(t)) {
|
|
32
22
|
let n = t.props;
|
|
33
23
|
typeof n.id == "string" && typeof n.title == "string" && e.push({
|
|
34
24
|
id: n.id,
|
|
@@ -37,118 +27,173 @@ var m = l(({ columns: i, onMove: a, onCardMove: o, className: l, forceMobileUI:
|
|
|
37
27
|
});
|
|
38
28
|
}
|
|
39
29
|
}), e;
|
|
40
|
-
}, [
|
|
30
|
+
}, [_, i]), L = (e, t = 0) => {
|
|
31
|
+
let n = I.find((t) => t.id === e);
|
|
32
|
+
n && C(x("kanban.moved", { column: n.title }), { delay: t });
|
|
33
|
+
}, R = (e, t, n) => {
|
|
34
|
+
D({
|
|
35
|
+
itemId: t,
|
|
36
|
+
columnId: n
|
|
37
|
+
}), e.dataTransfer.setData("text/plain", `${n}:${t}`), e.dataTransfer.effectAllowed = "move";
|
|
38
|
+
}, z = (e, t) => {
|
|
39
|
+
e.preventDefault(), A(t);
|
|
40
|
+
}, B = (e, t) => {
|
|
41
|
+
e.preventDefault(), A(null);
|
|
42
|
+
let [n, r] = e.dataTransfer.getData("text/plain").split(":");
|
|
43
|
+
F?.(r, n, t), D(null), n !== t && L(t);
|
|
44
|
+
}, V = (e, t, n) => {
|
|
45
|
+
F?.(e, t, n), M(null), P(e), L(n, 700);
|
|
46
|
+
}, H = () => _ || (i ? i.map((e) => /* @__PURE__ */ m(O, {
|
|
41
47
|
id: e.id,
|
|
42
48
|
title: e.title,
|
|
43
49
|
cardCount: e.items.length,
|
|
44
|
-
children: e.items.map((e) => /* @__PURE__ */
|
|
50
|
+
children: e.items.map((e) => /* @__PURE__ */ m(T, {
|
|
45
51
|
id: e.id,
|
|
46
52
|
children: e.content
|
|
47
53
|
}, e.id))
|
|
48
|
-
}, e.id)) : null),
|
|
49
|
-
return /* @__PURE__ */
|
|
54
|
+
}, e.id)) : null), U = v ? e : "div";
|
|
55
|
+
return /* @__PURE__ */ m(S.Provider, {
|
|
50
56
|
value: {
|
|
51
|
-
draggedItem:
|
|
52
|
-
dragOverColumn:
|
|
53
|
-
setDragOverColumn:
|
|
54
|
-
handleDragStart:
|
|
55
|
-
handleDragOver:
|
|
56
|
-
handleDrop:
|
|
57
|
-
handleMobileMove:
|
|
58
|
-
activeMobileMenu:
|
|
59
|
-
setActiveMobileMenu:
|
|
60
|
-
|
|
57
|
+
draggedItem: E,
|
|
58
|
+
dragOverColumn: k,
|
|
59
|
+
setDragOverColumn: A,
|
|
60
|
+
handleDragStart: R,
|
|
61
|
+
handleDragOver: z,
|
|
62
|
+
handleDrop: B,
|
|
63
|
+
handleMobileMove: V,
|
|
64
|
+
activeMobileMenu: j,
|
|
65
|
+
setActiveMobileMenu: M,
|
|
66
|
+
focusAfterMove: N,
|
|
67
|
+
setFocusAfterMove: P,
|
|
68
|
+
columns: I
|
|
61
69
|
},
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
...
|
|
64
|
-
ref:
|
|
65
|
-
className:
|
|
70
|
+
children: /* @__PURE__ */ h(U, {
|
|
71
|
+
...y,
|
|
72
|
+
ref: b,
|
|
73
|
+
className: p("wim-kanban", l.root, g && l.touch, d),
|
|
66
74
|
role: "region",
|
|
67
|
-
"aria-label":
|
|
75
|
+
"aria-label": y["aria-labelledby"] ? void 0 : y["aria-label"] ?? x("a11y.kanban_board"),
|
|
68
76
|
tabIndex: 0,
|
|
69
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ m(t, { children: H() }), w]
|
|
70
78
|
})
|
|
71
79
|
});
|
|
72
|
-
}),
|
|
73
|
-
let e =
|
|
80
|
+
}), S = u.createContext(null), C = () => {
|
|
81
|
+
let e = u.useContext(S);
|
|
74
82
|
if (!e) throw Error("Kanban compound components must be used within Kanban");
|
|
75
83
|
return e;
|
|
76
|
-
},
|
|
77
|
-
let { dragOverColumn:
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
className:
|
|
84
|
+
}, w = ({ id: e, title: t, cardCount: a, children: o, className: s }) => {
|
|
85
|
+
let { dragOverColumn: c, handleDragOver: d, handleDrop: f, setDragOverColumn: g } = C(), { t: _ } = n(r), v = u.useId(), y = u.Children.toArray(o), b = y.length > 0 && y.every((e) => u.isValidElement(e) && e.type === T);
|
|
86
|
+
return /* @__PURE__ */ h("div", {
|
|
87
|
+
className: p(l.column, { [l.dragOver]: c === e }, s),
|
|
80
88
|
role: "group",
|
|
81
|
-
"aria-labelledby": t ?
|
|
82
|
-
onDragOver: (t) =>
|
|
83
|
-
onDrop: (t) =>
|
|
84
|
-
onDragLeave: () =>
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
-
className:
|
|
87
|
-
children: [/* @__PURE__ */
|
|
88
|
-
id:
|
|
89
|
-
className:
|
|
89
|
+
"aria-labelledby": t ? v : void 0,
|
|
90
|
+
onDragOver: (t) => d(t, e),
|
|
91
|
+
onDrop: (t) => f(t, e),
|
|
92
|
+
onDragLeave: () => g(null),
|
|
93
|
+
children: [/* @__PURE__ */ h("div", {
|
|
94
|
+
className: l.columnHeader,
|
|
95
|
+
children: [/* @__PURE__ */ m("div", {
|
|
96
|
+
id: v,
|
|
97
|
+
className: l.columnTitle,
|
|
90
98
|
"aria-hidden": "true",
|
|
91
99
|
children: t
|
|
92
|
-
}), a !== void 0 && /* @__PURE__ */
|
|
93
|
-
className:
|
|
94
|
-
children: [/* @__PURE__ */
|
|
100
|
+
}), a !== void 0 && /* @__PURE__ */ h("div", {
|
|
101
|
+
className: l.columnCount,
|
|
102
|
+
children: [/* @__PURE__ */ m("span", {
|
|
95
103
|
"aria-hidden": "true",
|
|
96
104
|
children: a
|
|
97
|
-
}), /* @__PURE__ */
|
|
105
|
+
}), /* @__PURE__ */ m(i, { children: _("a11y.kanban_column_count", { count: a }) })]
|
|
98
106
|
})]
|
|
99
|
-
}), /* @__PURE__ */
|
|
100
|
-
className:
|
|
101
|
-
role:
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
-
value:
|
|
107
|
+
}), /* @__PURE__ */ m("div", {
|
|
108
|
+
className: l.columnBody,
|
|
109
|
+
role: b ? "list" : void 0,
|
|
110
|
+
children: /* @__PURE__ */ m(D.Provider, {
|
|
111
|
+
value: b,
|
|
104
112
|
children: o
|
|
105
113
|
})
|
|
106
114
|
})]
|
|
107
115
|
});
|
|
108
|
-
},
|
|
109
|
-
let { t:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
}, T = ({ id: e, children: t, disabled: i, className: s }) => {
|
|
117
|
+
let { t: c } = n(r), { draggedItem: d, handleDragStart: f, handleMobileMove: x, activeMobileMenu: S, setActiveMobileMenu: w, focusAfterMove: T, setFocusAfterMove: O, columns: k } = C(), A = u.useContext(E), j = u.useContext(D), M = u.useRef(null), N = u.useRef(null), P = u.useId(), F = S === e, { refs: { setReference: I, setFloating: L }, floatingStyles: R } = b({
|
|
118
|
+
open: F,
|
|
119
|
+
strategy: "fixed",
|
|
120
|
+
placement: "bottom-end",
|
|
121
|
+
whileElementsMounted: g,
|
|
122
|
+
middleware: [
|
|
123
|
+
v(4),
|
|
124
|
+
_(),
|
|
125
|
+
y({ padding: 10 })
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
return u.useEffect(() => {
|
|
129
|
+
T === e && (M.current?.focus(), O(null));
|
|
130
|
+
}, [
|
|
131
|
+
T,
|
|
132
|
+
e,
|
|
133
|
+
O
|
|
134
|
+
]), u.useEffect(() => {
|
|
135
|
+
if (!F) return;
|
|
136
|
+
let e = (e) => {
|
|
137
|
+
N.current?.contains(e.target) || w(null);
|
|
138
|
+
}, t = (e) => {
|
|
139
|
+
e.key === "Escape" && N.current?.contains(document.activeElement) && (e.stopPropagation(), w(null), M.current?.focus());
|
|
140
|
+
};
|
|
141
|
+
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
142
|
+
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
143
|
+
};
|
|
144
|
+
}, [F, w]), /* @__PURE__ */ h("div", {
|
|
145
|
+
role: j ? "listitem" : void 0,
|
|
146
|
+
className: p(l.card, {
|
|
147
|
+
[l.dragging]: d?.itemId === e,
|
|
148
|
+
[l.disabled]: i,
|
|
149
|
+
[l.menuOpen]: F
|
|
150
|
+
}, s),
|
|
116
151
|
draggable: !i,
|
|
117
|
-
onDragStart: (t) =>
|
|
118
|
-
children: [/* @__PURE__ */
|
|
119
|
-
className:
|
|
152
|
+
onDragStart: (t) => A && f(t, e, A),
|
|
153
|
+
children: [/* @__PURE__ */ m("div", {
|
|
154
|
+
className: l.cardContent,
|
|
120
155
|
children: t
|
|
121
|
-
}), /* @__PURE__ */
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
}), /* @__PURE__ */ h("div", {
|
|
157
|
+
ref: N,
|
|
158
|
+
className: l.cardMove,
|
|
159
|
+
onBlur: (e) => {
|
|
160
|
+
F && !e.currentTarget.contains(e.relatedTarget) && w(null);
|
|
161
|
+
},
|
|
162
|
+
children: [/* @__PURE__ */ m("button", {
|
|
163
|
+
ref: (e) => {
|
|
164
|
+
M.current = e, I(e);
|
|
165
|
+
},
|
|
124
166
|
type: "button",
|
|
125
|
-
className:
|
|
126
|
-
onClick: () =>
|
|
127
|
-
"aria-label":
|
|
167
|
+
className: l.cardMoveBtn,
|
|
168
|
+
onClick: () => w(F ? null : e),
|
|
169
|
+
"aria-label": c("a11y.move_card"),
|
|
170
|
+
"aria-expanded": F,
|
|
171
|
+
"aria-controls": F ? P : void 0,
|
|
128
172
|
disabled: i,
|
|
129
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ m(o, {
|
|
130
174
|
component: a,
|
|
131
175
|
size: "sm"
|
|
132
176
|
})
|
|
133
|
-
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
177
|
+
}), F && /* @__PURE__ */ m("div", {
|
|
178
|
+
id: P,
|
|
179
|
+
ref: L,
|
|
180
|
+
style: R,
|
|
181
|
+
className: l.cardMoveMenu,
|
|
182
|
+
role: "group",
|
|
183
|
+
"aria-label": c("a11y.move_to_column"),
|
|
184
|
+
children: k.filter((e) => e.id !== A).map((t) => /* @__PURE__ */ m("button", {
|
|
138
185
|
type: "button",
|
|
139
|
-
className:
|
|
140
|
-
onClick: () =>
|
|
141
|
-
role: "option",
|
|
142
|
-
"aria-selected": !1,
|
|
186
|
+
className: l.cardMoveOption,
|
|
187
|
+
onClick: () => A && x(e, A, t.id),
|
|
143
188
|
children: t.title
|
|
144
189
|
}, t.id))
|
|
145
190
|
})]
|
|
146
191
|
})]
|
|
147
192
|
});
|
|
148
|
-
},
|
|
193
|
+
}, E = u.createContext(null), D = u.createContext(!1), O = (e) => /* @__PURE__ */ m(E.Provider, {
|
|
149
194
|
value: e.id,
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
-
}),
|
|
152
|
-
|
|
195
|
+
children: /* @__PURE__ */ m(w, { ...e })
|
|
196
|
+
}), k = x;
|
|
197
|
+
k.Column = O, k.Card = T, x.displayName = "Kanban", k.displayName = "KanbanBoard", w.displayName = "KanbanColumn", T.displayName = "KanbanCard", O.displayName = "KanbanColumnWrapper";
|
|
153
198
|
//#endregion
|
|
154
|
-
export {
|
|
199
|
+
export { x as Kanban, k as KanbanBoard, k as default, T as KanbanCard, w as KanbanColumn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_root_1p7h9_3`,t=`_column_1p7h9_15`,n=`_dragOver_1p7h9_25`,r=`_columnHeader_1p7h9_29`,i=`_columnTitle_1p7h9_36`,a=`_columnCount_1p7h9_41`,o=`_columnBody_1p7h9_54`,s=`_card_1p7h9_61`,c=`_disabled_1p7h9_71`,l=`_dragging_1p7h9_74`,u=`_cardContent_1p7h9_82`,d=`_cardMove_1p7h9_91`,f=`_menuOpen_1p7h9_98`,p=`_touch_1p7h9_110`,m=`_cardMoveBtn_1p7h9_117`,h=`_cardMoveMenu_1p7h9_166`,g=`_cardMoveOption_1p7h9_175`,_={root:e,column:t,dragOver:n,columnHeader:r,columnTitle:i,columnCount:a,columnBody:o,card:s,disabled:c,dragging:l,cardContent:u,cardMove:d,menuOpen:f,touch:p,cardMoveBtn:m,cardMoveMenu:h,cardMoveOption:g};exports.card=s,exports.cardContent=u,exports.cardMove=d,exports.cardMoveBtn=m,exports.cardMoveMenu=h,exports.cardMoveOption=g,exports.column=t,exports.columnBody=o,exports.columnCount=a,exports.columnHeader=r,exports.columnTitle=i,exports.default=_,exports.disabled=c,exports.dragOver=n,exports.dragging=l,exports.menuOpen=f,exports.root=e,exports.touch=p;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/Kanban/kanban.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_1p7h9_3", t = "_column_1p7h9_15", n = "_dragOver_1p7h9_25", r = "_columnHeader_1p7h9_29", i = "_columnTitle_1p7h9_36", a = "_columnCount_1p7h9_41", o = "_columnBody_1p7h9_54", s = "_card_1p7h9_61", c = "_disabled_1p7h9_71", l = "_dragging_1p7h9_74", u = "_cardContent_1p7h9_82", d = "_cardMove_1p7h9_91", f = "_menuOpen_1p7h9_98", p = "_touch_1p7h9_110", m = "_cardMoveBtn_1p7h9_117", h = "_cardMoveMenu_1p7h9_166", g = "_cardMoveOption_1p7h9_175", _ = {
|
|
4
4
|
root: e,
|
|
5
5
|
column: t,
|
|
6
6
|
dragOver: n,
|
|
@@ -13,10 +13,11 @@ var e = "_root_usqlh_3", t = "_column_usqlh_15", n = "_dragOver_usqlh_25", r = "
|
|
|
13
13
|
dragging: l,
|
|
14
14
|
cardContent: u,
|
|
15
15
|
cardMove: d,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
menuOpen: f,
|
|
17
|
+
touch: p,
|
|
18
|
+
cardMoveBtn: m,
|
|
19
|
+
cardMoveMenu: h,
|
|
20
|
+
cardMoveOption: g
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
22
|
-
export { s as card, u as cardContent, d as cardMove,
|
|
23
|
+
export { s as card, u as cardContent, d as cardMove, m as cardMoveBtn, h as cardMoveMenu, g as cardMoveOption, t as column, o as columnBody, a as columnCount, r as columnHeader, i as columnTitle, _ as default, c as disabled, n as dragOver, l as dragging, f as menuOpen, e as root, p as touch };
|
|
@@ -18,9 +18,15 @@ export interface UseTableSortReturn<T> {
|
|
|
18
18
|
getSortDirection: (key: keyof T) => SortDirection;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Sort rows on the client for `Table`: clicking the same column cycles ascending → descending → unsorted.
|
|
22
|
+
* For server-side sorting, keep the state yourself and pass `onSortChange`.
|
|
23
|
+
*
|
|
22
24
|
* @param data - The data array to sort
|
|
23
|
-
* @param options -
|
|
24
|
-
* @returns
|
|
25
|
+
* @param options - `initialSort` and `onSortChange`
|
|
26
|
+
* @returns `sortedData`, `sortConfig`, `handleSort(key)` and `getSortDirection(key)`
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const { sortedData, handleSort, getSortDirection } = useTableSort(rows);
|
|
30
|
+
* // <Table.Head sortable sortDirection={getSortDirection("name")} onSort={() => handleSort("name")}>
|
|
25
31
|
*/
|
|
26
32
|
export declare function useTableSort<T extends Record<string, unknown>>(data: T[], options?: UseTableSortOptions<T>): UseTableSortReturn<T>;
|
|
@@ -52,5 +52,18 @@ export declare const NotificationProvider: ({ children, placement, }: {
|
|
|
52
52
|
children: React.ReactNode;
|
|
53
53
|
placement?: NotificationPlacement;
|
|
54
54
|
}) => React.JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Show a notification card in a corner of the screen from anywhere under `NotificationProvider`.
|
|
57
|
+
* Notifications stack, carry a title and a body, and suit events that happened elsewhere
|
|
58
|
+
* (a finished export, a new comment) rather than the result of the user's last action.
|
|
59
|
+
*
|
|
60
|
+
* Throws when called outside `NotificationProvider`.
|
|
61
|
+
*
|
|
62
|
+
* @returns `show(notification)` — the `Notification` props without `onClose` — and `remove(id)`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const { show } = useNotification();
|
|
66
|
+
* show({ title: "Export finished", description: "report.csv is ready." });
|
|
67
|
+
*/
|
|
55
68
|
export declare const useNotification: () => NotificationContextType;
|
|
56
69
|
export {};
|
|
@@ -49,5 +49,19 @@ type SnackbarContextType = {
|
|
|
49
49
|
export declare const SnackbarProvider: ({ children, }: {
|
|
50
50
|
children: React.ReactNode;
|
|
51
51
|
}) => React.JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Show a single message bar at the edge of the screen from anywhere under `SnackbarProvider`.
|
|
54
|
+
* One message at a time: showing a new one replaces the current one. Use it when the message
|
|
55
|
+
* may carry one action (for example "Undo").
|
|
56
|
+
*
|
|
57
|
+
* Throws when called outside `SnackbarProvider`.
|
|
58
|
+
*
|
|
59
|
+
* @returns `showMessage(message)` — a string, or the `Snackbar` props without `open` / `onClose` —
|
|
60
|
+
* and `hideMessage()`.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const { showMessage } = useSnackbar();
|
|
64
|
+
* showMessage("Message archived");
|
|
65
|
+
*/
|
|
52
66
|
export declare const useSnackbar: () => SnackbarContextType;
|
|
53
67
|
export {};
|
|
@@ -61,5 +61,18 @@ export declare const ToastProvider: ({ children, position, }: {
|
|
|
61
61
|
children: React.ReactNode;
|
|
62
62
|
position?: ToastPosition;
|
|
63
63
|
}) => React.JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Show a short, self-dismissing message (a toast) from anywhere under `ToastProvider`.
|
|
66
|
+
* Use it for a one-off confirmation of something the user just did; for state that stays
|
|
67
|
+
* true (a limit, an outage), render an inline `Alert` instead.
|
|
68
|
+
*
|
|
69
|
+
* Throws when called outside `ToastProvider`.
|
|
70
|
+
*
|
|
71
|
+
* @returns `show(toast)` — `{ title?, description?, intent?, duration? }` — and `remove(id)`.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const { show } = useToast();
|
|
75
|
+
* show({ title: "Saved", intent: "success" });
|
|
76
|
+
*/
|
|
64
77
|
export declare const useToast: () => ToastContextType;
|
|
65
78
|
export {};
|
|
@@ -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("../../../i18n/generated/components.cjs"),a=require("../../../icon/chevron-left.cjs"),o=require("../../../icon/chevron-right.cjs"),s=require("../../../icon/close.cjs"),c=require("../../../icon/minus.cjs"),l=require("../../../icon/plus.cjs"),u=require("../Icon/Icon.cjs"),d=require("../../_internal/useAnnounce.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:a,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(i.componentsNs),x=e=>{a?.(e),c&&s===void 0?y({src:c,alt:l,caption:u}):(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(i.componentsNs),[D,O]=(0,p.useState)(1),{announce:k,clear:A,region:j}=d.useAnnounce();(0,p.useEffect)(()=>{x||A()},[x,A]);let M=(0,p.useCallback)(e=>{let t=T[e],n=t?.title||t?.alt,r=E(`lightbox.image_status`,{current:e+1,total:T.length});k(n?`${r}: ${n}`:r),w(e),O(1)},[T,w,E,k]),N=(0,p.useCallback)(()=>{M((C-1+T.length)%T.length)},[C,T.length,M]),P=(0,p.useCallback)(()=>{M((C+1)%T.length)},[C,T.length,M]),F=()=>{O(e=>e===1?2:1)};(0,p.useEffect)(()=>{if(!x)return;let e=e=>{e.key===`ArrowLeft`&&N(),e.key===`ArrowRight`&&P(),e.key===`Escape`&&S(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,N,P,S]);let I=T[C];return I?(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`]??(I.title||I.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:[j,(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:F,"aria-label":E(D>1?`lightbox.zoom_out`:`lightbox.zoom_in`),children:D>1?(0,h.jsx)(u.Icon,{component:c.default}):(0,h.jsx)(u.Icon,{component:l.default})}),t&&(0,h.jsx)(`button`,{className:f.default.iconButton,onClick:()=>S(!1),"aria-label":E(`lightbox.close`),children:(0,h.jsx)(u.Icon,{component:s.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:N,"aria-label":E(`lightbox.previous`),children:(0,h.jsx)(u.Icon,{component:a.default})}),(0,h.jsx)(`div`,{className:f.default.mediaWrapper,style:{transform:`scale(${D})`},children:(0,h.jsx)(`img`,{src:I.src,alt:I.alt||``,className:f.default.image})}),g&&T.length>1&&(0,h.jsx)(`button`,{className:(0,m.default)(f.default.navButton,f.default.next),onClick:P,"aria-label":E(`lightbox.next`),children:(0,h.jsx)(u.Icon,{component:o.default})})]}),(I.title||I.caption)&&(0,h.jsxs)(`div`,{className:f.default.footer,children:[I.title&&(0,h.jsx)(`h3`,{className:f.default.title,children:I.title}),I.caption&&(0,h.jsx)(`p`,{className:f.default.caption,children:I.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,C=S;S.Trigger=y,S.Content=b,S.Gallery=x,v.displayName=`Lightbox`,y.displayName=`Lightbox.Trigger`,b.displayName=`Lightbox.Content`,x.displayName=`Lightbox.Gallery`,exports.Lightbox=S,exports.LightboxContent=b,exports.LightboxGallery=x,exports.LightboxRoot=C,exports.default=C,exports.LightboxTrigger=y
|
|
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("../../../i18n/generated/components.cjs"),a=require("../../../icon/chevron-left.cjs"),o=require("../../../icon/chevron-right.cjs"),s=require("../../../icon/close.cjs"),c=require("../../../icon/minus.cjs"),l=require("../../../icon/plus.cjs"),u=require("../Icon/Icon.cjs"),d=require("../../_internal/useAnnounce.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:a,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(i.componentsNs),x=e=>{a?.(e),c&&s===void 0?y({src:c,alt:l,caption:u}):(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(i.componentsNs),[D,O]=(0,p.useState)(1),{announce:k,clear:A,region:j}=d.useAnnounce();(0,p.useEffect)(()=>{x||A()},[x,A]);let M=(0,p.useCallback)(e=>{let t=T[e],n=t?.title||t?.alt,r=E(`lightbox.image_status`,{current:e+1,total:T.length});k(n?`${r}: ${n}`:r),w(e),O(1)},[T,w,E,k]),N=(0,p.useCallback)(()=>{M((C-1+T.length)%T.length)},[C,T.length,M]),P=(0,p.useCallback)(()=>{M((C+1)%T.length)},[C,T.length,M]),F=()=>{O(e=>e===1?2:1)};(0,p.useEffect)(()=>{if(!x)return;let e=e=>{e.key===`ArrowLeft`&&N(),e.key===`ArrowRight`&&P(),e.key===`Escape`&&S(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,N,P,S]);let I=T[C];return I?(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`]??(I.title||I.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:[j,(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:F,"aria-label":E(D>1?`lightbox.zoom_out`:`lightbox.zoom_in`),children:D>1?(0,h.jsx)(u.Icon,{component:c.default}):(0,h.jsx)(u.Icon,{component:l.default})}),t&&(0,h.jsx)(`button`,{className:f.default.iconButton,onClick:()=>S(!1),"aria-label":E(`lightbox.close`),children:(0,h.jsx)(u.Icon,{component:s.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:N,"aria-label":E(`lightbox.previous`),children:(0,h.jsx)(u.Icon,{component:a.default})}),(0,h.jsx)(`div`,{className:f.default.mediaWrapper,style:{transform:`scale(${D})`},children:(0,h.jsx)(`img`,{src:I.src,alt:I.alt||``,className:f.default.image})}),g&&T.length>1&&(0,h.jsx)(`button`,{className:(0,m.default)(f.default.navButton,f.default.next),onClick:P,"aria-label":E(`lightbox.next`),children:(0,h.jsx)(u.Icon,{component:o.default})})]}),(I.title||I.caption)&&(0,h.jsxs)(`div`,{className:f.default.footer,children:[I.title&&(0,h.jsx)(`h3`,{className:f.default.title,children:I.title}),I.caption&&(0,h.jsx)(`p`,{className:f.default.caption,children:I.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,C=S;S.Trigger=y,S.Content=b,S.Gallery=x,v.displayName=`Lightbox`,y.displayName=`Lightbox.Trigger`,b.displayName=`Lightbox.Content`,x.displayName=`Lightbox.Gallery`,exports.Lightbox=S,exports.LightboxContent=b,exports.LightboxGallery=x,exports.LightboxRoot=C,exports.default=C,exports.LightboxTrigger=y;
|
|
@@ -6,19 +6,6 @@ export interface LightboxItem {
|
|
|
6
6
|
caption?: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
}
|
|
9
|
-
interface LightboxContextType {
|
|
10
|
-
open: boolean;
|
|
11
|
-
setOpen: (open: boolean) => void;
|
|
12
|
-
currentIndex: number;
|
|
13
|
-
setCurrentIndex: (index: number | ((prev: number) => number)) => void;
|
|
14
|
-
items: LightboxItem[];
|
|
15
|
-
/** Open on the item with this `src`, adding it when it is not registered yet. */
|
|
16
|
-
openItem: (item: LightboxItem) => void;
|
|
17
|
-
setItems: React.Dispatch<React.SetStateAction<LightboxItem[]>>;
|
|
18
|
-
registerItem: (item: LightboxItem) => number;
|
|
19
|
-
unregisterItem: (index: number) => void;
|
|
20
|
-
}
|
|
21
|
-
export declare const useLightbox: () => LightboxContextType;
|
|
22
9
|
export interface LightboxProps {
|
|
23
10
|
/** Lightbox parts (Lightbox.Trigger, Lightbox.Content, etc.) */
|
|
24
11
|
children: React.ReactNode;
|
|
@@ -198,4 +198,4 @@ var x = p(void 0), S = () => {
|
|
|
198
198
|
}, D = C, O = D;
|
|
199
199
|
D.Trigger = w, D.Content = T, D.Gallery = E, C.displayName = "Lightbox", w.displayName = "Lightbox.Trigger", T.displayName = "Lightbox.Content", E.displayName = "Lightbox.Gallery";
|
|
200
200
|
//#endregion
|
|
201
|
-
export { D as Lightbox, T as LightboxContent, E as LightboxGallery, O as LightboxRoot, O as default, w as LightboxTrigger
|
|
201
|
+
export { D as Lightbox, T as LightboxContent, E as LightboxGallery, O as LightboxRoot, O as default, w as LightboxTrigger };
|
|
@@ -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("../../_internal/OverlayBase.cjs"),r=require("./dialog.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=(0,i.createContext)(void 0),c=()=>{let e=(0,i.useContext)(s);if(!e)throw Error(`Dialog sub-components must be used within Dialog`);return e},l=({children:e,open:t,onOpenChange:n,defaultOpen:r=!1,role:a=`dialog`,closeOnOverlayClick:c=a!==`alertdialog`})=>{let[l,u]=(0,i.useState)(r),d=t!==void 0,f=d?t:l,p=e=>{d||u(e),n?.(e)},m=`wim-dialog-${(0,i.useId)()}`,h=`${m}-title`,g=`${m}-description`;return(0,o.jsx)(s.Provider,{value:{titleId:h,descriptionId:g,open:f,onOpenChange:p,closeOnOverlayClick:c,role:a},children:e})};l.displayName=`Dialog`;var u=({children:e,className:n,onClick:r,asChild:i=!1,...a})=>{let{onOpenChange:s}=c();return(0,o.jsx)(i?t.Root:`button`,{type:`button`,className:n,onClick:e=>{r?.(e),s(!0)},...a,children:(0,o.jsx)(t.Slottable,{children:e})})};u.displayName=`Dialog.Trigger`;var d=({children:e,className:n,onClick:r,asChild:i=!1,...a})=>{let{onOpenChange:s}=c();return(0,o.jsx)(i?t.Root:`button`,{type:`button`,className:n,onClick:e=>{r?.(e),s(!1)},...a,children:(0,o.jsx)(t.Slottable,{children:e})})};d.displayName=`Dialog.Close`;var f=({children:e,className:i,asChild:s=!1,open:l,onOpenChange:u,role:d,...f})=>{let{open:p,onOpenChange:m,titleId:h,descriptionId:g,closeOnOverlayClick:_,role:v}=c(),y=l===void 0?p:l,b=u===void 0?m:u,x=s?t.Root:`div`;return(0,o.jsx)(n.OverlayBase,{...f,open:y,onOpenChange:b,closeOnOverlayClick:_,overlayClassName:r.default.overlay,role:d??v,"aria-labelledby":f[`aria-labelledby`]??h,"aria-describedby":[f[`aria-describedby`],g].filter(Boolean).join(` `),children:(0,o.jsx)(x,{className:(0,a.default)(`wim-dialog`,r.default.content,i),children:(0,o.jsx)(t.Slottable,{children:e})})})};f.displayName=`Dialog.Content`;var p=({children:e,className:t,...n})=>(0,o.jsx)(`div`,{className:(0,a.default)(r.default.header,t),"data-testid":`dialog-header`,...n,children:e});p.displayName=`Dialog.Header`;var m=({children:e,className:t,layout:n,...i})=>(0,o.jsx)(`div`,{className:(0,a.default)(r.default.footer,t),"data-layout":n,"data-testid":`dialog-footer`,...i,children:e});m.displayName=`Dialog.Footer`;var h=({children:e,className:t,...n})=>{let{titleId:i}=c();return(0,o.jsx)(`h2`,{id:i,className:(0,a.default)(r.default.title,t),"data-testid":`dialog-title`,...n,children:e})};h.displayName=`Dialog.Title`;var g=({children:e,className:t,...n})=>{let{descriptionId:i}=c();return(0,o.jsx)(`p`,{id:i,className:(0,a.default)(r.default.description,t),"data-testid":`dialog-description`,...n,children:e})};g.displayName=`Dialog.Description`;var _=e=>(0,o.jsx)(l,{...e});_.displayName=`Dialog`,_.Trigger=u,_.Content=f,_.Close=d,_.Header=p,_.Footer=m,_.Title=h,_.Description=g,exports.Dialog=_,exports.default=_,exports.DialogClose=d,exports.DialogContent=f,exports.DialogDescription=g,exports.DialogFooter=m,exports.DialogHeader=p,exports.DialogTitle=h,exports.DialogTrigger=u
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../_internal/OverlayBase.cjs"),r=require("./dialog.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=(0,i.createContext)(void 0),c=()=>{let e=(0,i.useContext)(s);if(!e)throw Error(`Dialog sub-components must be used within Dialog`);return e},l=({children:e,open:t,onOpenChange:n,defaultOpen:r=!1,role:a=`dialog`,closeOnOverlayClick:c=a!==`alertdialog`})=>{let[l,u]=(0,i.useState)(r),d=t!==void 0,f=d?t:l,p=e=>{d||u(e),n?.(e)},m=`wim-dialog-${(0,i.useId)()}`,h=`${m}-title`,g=`${m}-description`;return(0,o.jsx)(s.Provider,{value:{titleId:h,descriptionId:g,open:f,onOpenChange:p,closeOnOverlayClick:c,role:a},children:e})};l.displayName=`Dialog`;var u=({children:e,className:n,onClick:r,asChild:i=!1,...a})=>{let{onOpenChange:s}=c();return(0,o.jsx)(i?t.Root:`button`,{type:`button`,className:n,onClick:e=>{r?.(e),s(!0)},...a,children:(0,o.jsx)(t.Slottable,{children:e})})};u.displayName=`Dialog.Trigger`;var d=({children:e,className:n,onClick:r,asChild:i=!1,...a})=>{let{onOpenChange:s}=c();return(0,o.jsx)(i?t.Root:`button`,{type:`button`,className:n,onClick:e=>{r?.(e),s(!1)},...a,children:(0,o.jsx)(t.Slottable,{children:e})})};d.displayName=`Dialog.Close`;var f=({children:e,className:i,asChild:s=!1,open:l,onOpenChange:u,role:d,...f})=>{let{open:p,onOpenChange:m,titleId:h,descriptionId:g,closeOnOverlayClick:_,role:v}=c(),y=l===void 0?p:l,b=u===void 0?m:u,x=s?t.Root:`div`;return(0,o.jsx)(n.OverlayBase,{...f,open:y,onOpenChange:b,closeOnOverlayClick:_,overlayClassName:r.default.overlay,role:d??v,"aria-labelledby":f[`aria-labelledby`]??h,"aria-describedby":[f[`aria-describedby`],g].filter(Boolean).join(` `),children:(0,o.jsx)(x,{className:(0,a.default)(`wim-dialog`,r.default.content,i),children:(0,o.jsx)(t.Slottable,{children:e})})})};f.displayName=`Dialog.Content`;var p=({children:e,className:t,...n})=>(0,o.jsx)(`div`,{className:(0,a.default)(r.default.header,t),"data-testid":`dialog-header`,...n,children:e});p.displayName=`Dialog.Header`;var m=({children:e,className:t,layout:n,...i})=>(0,o.jsx)(`div`,{className:(0,a.default)(r.default.footer,t),"data-layout":n,"data-testid":`dialog-footer`,...i,children:e});m.displayName=`Dialog.Footer`;var h=({children:e,className:t,...n})=>{let{titleId:i}=c();return(0,o.jsx)(`h2`,{id:i,className:(0,a.default)(r.default.title,t),"data-testid":`dialog-title`,...n,children:e})};h.displayName=`Dialog.Title`;var g=({children:e,className:t,...n})=>{let{descriptionId:i}=c();return(0,o.jsx)(`p`,{id:i,className:(0,a.default)(r.default.description,t),"data-testid":`dialog-description`,...n,children:e})};g.displayName=`Dialog.Description`;var _=e=>(0,o.jsx)(l,{...e});_.displayName=`Dialog`,_.Trigger=u,_.Content=f,_.Close=d,_.Header=p,_.Footer=m,_.Title=h,_.Description=g,exports.Dialog=_,exports.default=_,exports.DialogClose=d,exports.DialogContent=f,exports.DialogDescription=g,exports.DialogFooter=m,exports.DialogHeader=p,exports.DialogTitle=h,exports.DialogTrigger=u;
|