wimui 0.67.0 → 0.69.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/components/_internal/InlineDisclosure.cjs +2 -0
- package/dist/components/_internal/InlineDisclosure.d.ts +22 -0
- package/dist/components/_internal/InlineDisclosure.js +47 -0
- package/dist/components/_internal/inline-disclosure.module.cjs +2 -0
- package/dist/components/_internal/inline-disclosure.module.js +9 -0
- package/dist/components/_internal/useAnnounce.cjs +2 -0
- package/dist/components/_internal/useAnnounce.d.ts +39 -0
- package/dist/components/_internal/useAnnounce.js +41 -0
- package/dist/components/data-display/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.d.ts +10 -3
- package/dist/components/data-display/AvatarGroup/AvatarGroup.js +55 -27
- package/dist/components/data-display/AvatarGroup/avatar-group.module.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/avatar-group.module.js +8 -6
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +61 -65
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +78 -74
- package/dist/components/data-display/DataGrid/useFixedColumns.cjs +1 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.d.ts +6 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.js +22 -17
- package/dist/components/data-display/SelectionBar/SelectionBar.cjs +2 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.d.ts +77 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.js +68 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.cjs +2 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.js +10 -0
- package/dist/components/data-display/Table/table.module.cjs +1 -1
- package/dist/components/data-display/Table/table.module.js +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.js +8 -9
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.js +60 -71
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +4 -4
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +11 -11
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +4 -4
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +13 -18
- package/dist/components/form/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/form/MultiSelect/MultiSelect.js +66 -66
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +114 -114
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.js +84 -88
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +4 -4
- package/dist/components/layout/OverflowList/OverflowList.cjs +2 -0
- package/dist/components/layout/OverflowList/OverflowList.d.ts +81 -0
- package/dist/components/layout/OverflowList/OverflowList.js +85 -0
- package/dist/components/layout/OverflowList/getVisibleCount.cjs +2 -0
- package/dist/components/layout/OverflowList/getVisibleCount.d.ts +30 -0
- package/dist/components/layout/OverflowList/getVisibleCount.js +26 -0
- package/dist/components/layout/OverflowList/overflow-list.module.cjs +2 -0
- package/dist/components/layout/OverflowList/overflow-list.module.js +10 -0
- package/dist/components/layout/SimpleGrid/SimpleGrid.cjs +1 -1
- package/dist/components/layout/SimpleGrid/SimpleGrid.js +1 -1
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.d.ts +15 -0
- package/dist/components/layout/Toolbar/Toolbar.js +85 -60
- package/dist/components/layout/Toolbar/toolbar.module.cjs +1 -1
- package/dist/components/layout/Toolbar/toolbar.module.js +8 -6
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +46 -47
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +88 -53
- package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
- package/dist/components/navigation/Menubar/Menubar.js +10 -10
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +110 -112
- package/dist/data-display-core.d.ts +1 -0
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +2 -1
- package/dist/i18n/generated/components.d.ts +1 -1
- 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 +30 -3
- package/dist/i18n/generated/keys.d.ts +3 -1
- package/dist/i18n/generated/layout.cjs +2 -0
- package/dist/i18n/generated/layout.d.ts +3 -0
- package/dist/i18n/generated/layout.js +12 -0
- package/dist/i18n/generated/navigation.cjs +2 -0
- package/dist/i18n/generated/navigation.d.ts +3 -0
- package/dist/i18n/generated/navigation.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +173 -171
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1 -0
- package/dist/layout.js +3 -2
- package/dist/llms-full.txt +58 -3
- package/dist/llms.txt +3 -1
- package/dist/locales/en/components.json +3 -1
- package/dist/locales/en/data-display.json +9 -0
- package/dist/locales/ja/components.json +3 -1
- package/dist/locales/ja/data-display.json +9 -0
- package/dist/locales/pt/components.json +3 -1
- package/dist/locales/pt/data-display.json +9 -0
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +38 -35
|
@@ -15,6 +15,21 @@ export type ToolbarProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
|
15
15
|
* @default "horizontal"
|
|
16
16
|
*/
|
|
17
17
|
orientation?: "horizontal" | "vertical";
|
|
18
|
+
/**
|
|
19
|
+
* How the controls that do not fit on one line are handled. `"wrap"` wraps them onto the next
|
|
20
|
+
* line; `"collapse"` keeps one line and moves the trailing children that do not fit behind a
|
|
21
|
+
* "…" button, which opens them in a panel next to it. Each direct child (a whole
|
|
22
|
+
* `Toolbar.Group`) is collapsed as one unit. Horizontal toolbars only, and not with `asChild`.
|
|
23
|
+
*
|
|
24
|
+
* A control remounts when it moves into the panel, so keep its state controlled.
|
|
25
|
+
* @default "wrap"
|
|
26
|
+
*/
|
|
27
|
+
overflow?: "wrap" | "collapse";
|
|
28
|
+
/**
|
|
29
|
+
* Accessible name of the "…" button with `overflow="collapse"`, from the number of hidden
|
|
30
|
+
* children. Defaults to the built-in "Show hidden tools (n)" (en / ja / pt).
|
|
31
|
+
*/
|
|
32
|
+
moreLabel?: (count: number) => string;
|
|
18
33
|
};
|
|
19
34
|
export type ToolbarGroupProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
20
35
|
/**
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import r from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import { useWimTranslation as t } from "../../../i18n/useWimTranslation.js";
|
|
4
|
+
import { useMergedRef as n } from "../../../hooks/useMergedRef.js";
|
|
5
|
+
import r from "../../../icon/more-horizontal.js";
|
|
6
|
+
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
7
|
+
import { layoutNs as a } from "../../../i18n/generated/layout.js";
|
|
8
|
+
import { getRovingIndex as o } from "../../_internal/rovingIndex.js";
|
|
9
|
+
import { InlineDisclosure as s } from "../../_internal/InlineDisclosure.js";
|
|
10
|
+
import { OverflowList as c } from "../OverflowList/OverflowList.js";
|
|
11
|
+
import l from "./toolbar.module.js";
|
|
12
|
+
import u, { useCallback as d, useEffect as f, useLayoutEffect as p, useRef as m } from "react";
|
|
13
|
+
import h from "classnames";
|
|
14
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
9
15
|
//#region src/components/layout/Toolbar/Toolbar.tsx
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
var _ = "button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]", v = {
|
|
17
|
+
sm: "2xs",
|
|
18
|
+
md: "xs",
|
|
19
|
+
lg: "sm"
|
|
20
|
+
}, y = (e) => u.isValidElement(e) && e.type === E, b = "data-wim-toolbar-roving", x = /^(button|checkbox|radio|submit|reset|image|file|color)$/, S = (e) => e.tagName === "TEXTAREA" || e.tagName === "SELECT" || e.isContentEditable || e.tagName === "INPUT" && !x.test(e.type), C = (e) => Array.from(e.querySelectorAll(_)).filter((e) => !S(e) && !e.closest("[aria-hidden=\"true\"]") && (e.getAttribute("tabindex") !== "-1" || e.hasAttribute(b))), w = u.forwardRef(({ asChild: _ = !1, size: x = "md", orientation: S = "horizontal", overflow: w = "wrap", moreLabel: T, className: E, children: D, onKeyDownCapture: O, onFocus: k, ...A }, j) => {
|
|
21
|
+
let { t: M } = t(a), N = m(null), P = n(j, N), F = m(null), I = m(null), L = d(() => {
|
|
22
|
+
let e = N.current;
|
|
13
23
|
if (!e) return;
|
|
14
|
-
let t =
|
|
15
|
-
|
|
16
|
-
for (let e of t) e === r ? e.hasAttribute(
|
|
17
|
-
|
|
24
|
+
let t = C(e), n = document.activeElement, r = n && t.includes(n) ? n : F.current && t.includes(F.current) ? F.current : t[0];
|
|
25
|
+
F.current = r ?? null;
|
|
26
|
+
for (let e of t) e === r ? e.hasAttribute(b) && (e.removeAttribute(b), e.setAttribute("tabindex", "0")) : e.getAttribute("tabindex") !== "-1" && (e.setAttribute("tabindex", "-1"), e.setAttribute(b, ""));
|
|
27
|
+
I.current?.takeRecords();
|
|
18
28
|
}, []);
|
|
19
|
-
|
|
20
|
-
let e =
|
|
29
|
+
p(L), f(() => {
|
|
30
|
+
let e = N.current;
|
|
21
31
|
if (!e) return;
|
|
22
|
-
let t = new MutationObserver(() =>
|
|
32
|
+
let t = new MutationObserver(() => L());
|
|
23
33
|
return t.observe(e, {
|
|
24
34
|
subtree: !0,
|
|
25
35
|
childList: !0,
|
|
@@ -29,59 +39,74 @@ var d = "button:not([disabled]), [href], input:not([disabled]), select:not([disa
|
|
|
29
39
|
"tabindex",
|
|
30
40
|
"aria-hidden"
|
|
31
41
|
]
|
|
32
|
-
}),
|
|
33
|
-
t.disconnect(),
|
|
42
|
+
}), I.current = t, () => {
|
|
43
|
+
t.disconnect(), I.current = null;
|
|
34
44
|
};
|
|
35
|
-
}, [
|
|
36
|
-
|
|
45
|
+
}, [L]);
|
|
46
|
+
let R = (e) => {
|
|
47
|
+
k?.(e);
|
|
48
|
+
let t = N.current, n = e.target;
|
|
49
|
+
t && n !== F.current && C(t).includes(n) && (F.current = n, L());
|
|
50
|
+
}, z = (e) => {
|
|
51
|
+
if (O?.(e), e.defaultPrevented) return;
|
|
52
|
+
let t = N.current;
|
|
53
|
+
if (!t) return;
|
|
54
|
+
let n = C(t);
|
|
55
|
+
if (n.length === 0) return;
|
|
56
|
+
let r = n.indexOf(document.activeElement);
|
|
57
|
+
if (r < 0) return;
|
|
58
|
+
let i = o({
|
|
59
|
+
key: e.key,
|
|
60
|
+
current: r,
|
|
61
|
+
count: n.length,
|
|
62
|
+
orientation: S
|
|
63
|
+
});
|
|
64
|
+
i !== null && (e.preventDefault(), e.stopPropagation(), n[i]?.focus());
|
|
65
|
+
}, B = _ ? e : "div", V = w === "collapse" && S === "horizontal" && !_, H = V ? /* @__PURE__ */ g(c, {
|
|
66
|
+
gap: v[x],
|
|
67
|
+
items: u.Children.toArray(D),
|
|
68
|
+
renderItem: (e) => e,
|
|
69
|
+
renderOverflow: (e) => /* @__PURE__ */ g(s, {
|
|
70
|
+
trigger: /* @__PURE__ */ g(i, {
|
|
71
|
+
component: r,
|
|
72
|
+
size: "sm"
|
|
73
|
+
}),
|
|
74
|
+
label: (T ?? ((e) => M("a11y.toolbar_more", { count: e })))(e.length),
|
|
75
|
+
triggerClassName: l.more,
|
|
76
|
+
children: e.filter((e) => !y(e)).map((e, t) => /* @__PURE__ */ g("li", { children: e }, t))
|
|
77
|
+
})
|
|
78
|
+
}) : D;
|
|
79
|
+
return /* @__PURE__ */ g(B, {
|
|
80
|
+
ref: P,
|
|
37
81
|
role: "toolbar",
|
|
38
|
-
"aria-orientation":
|
|
39
|
-
"data-size":
|
|
40
|
-
"data-orientation":
|
|
41
|
-
className:
|
|
42
|
-
onKeyDownCapture:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let r = h(t);
|
|
47
|
-
if (r.length === 0) return;
|
|
48
|
-
let i = r.indexOf(document.activeElement);
|
|
49
|
-
if (i < 0) return;
|
|
50
|
-
let a = n({
|
|
51
|
-
key: e.key,
|
|
52
|
-
current: i,
|
|
53
|
-
count: r.length,
|
|
54
|
-
orientation: p
|
|
55
|
-
});
|
|
56
|
-
a !== null && (e.preventDefault(), e.stopPropagation(), r[a]?.focus());
|
|
57
|
-
},
|
|
58
|
-
onFocus: (e) => {
|
|
59
|
-
v?.(e);
|
|
60
|
-
let t = x.current, n = e.target;
|
|
61
|
-
t && n !== C.current && h(t).includes(n) && (C.current = n, T());
|
|
62
|
-
},
|
|
63
|
-
...y,
|
|
64
|
-
children: g
|
|
82
|
+
"aria-orientation": S,
|
|
83
|
+
"data-size": x,
|
|
84
|
+
"data-orientation": S,
|
|
85
|
+
className: h("wim-toolbar", l.root, l[`size-${x}`], l[S], V && l.collapse, E),
|
|
86
|
+
onKeyDownCapture: z,
|
|
87
|
+
onFocus: R,
|
|
88
|
+
...A,
|
|
89
|
+
children: H
|
|
65
90
|
});
|
|
66
91
|
});
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
ref:
|
|
92
|
+
w.displayName = "Toolbar";
|
|
93
|
+
var T = u.forwardRef(({ asChild: t = !1, className: n, children: r, ...i }, a) => /* @__PURE__ */ g(t ? e : "div", {
|
|
94
|
+
ref: a,
|
|
70
95
|
role: "group",
|
|
71
|
-
className: l
|
|
72
|
-
...
|
|
73
|
-
children:
|
|
96
|
+
className: h(l.group, n),
|
|
97
|
+
...i,
|
|
98
|
+
children: r
|
|
74
99
|
}));
|
|
75
|
-
|
|
76
|
-
var
|
|
100
|
+
T.displayName = "Toolbar.Group";
|
|
101
|
+
var E = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ g("div", {
|
|
77
102
|
ref: n,
|
|
78
103
|
role: "separator",
|
|
79
104
|
"aria-hidden": "true",
|
|
80
|
-
className: l
|
|
105
|
+
className: h(l.separator, e),
|
|
81
106
|
...t
|
|
82
107
|
}));
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
|
|
108
|
+
E.displayName = "Toolbar.Separator";
|
|
109
|
+
var D = w;
|
|
110
|
+
D.Group = T, D.Separator = E;
|
|
86
111
|
//#endregion
|
|
87
|
-
export {
|
|
112
|
+
export { D as Toolbar, D as default, T as ToolbarGroup, E as ToolbarSeparator };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_root_avk5e_4`,t=`_horizontal_avk5e_13`,n=`_vertical_avk5e_16`,r=`_group_avk5e_32`,i=`_separator_avk5e_42`,a=`_collapse_avk5e_58`,o=`_more_avk5e_66`,s={root:e,horizontal:t,vertical:n,"size-sm":`_size-sm_avk5e_20`,"size-md":`_size-md_avk5e_24`,"size-lg":`_size-lg_avk5e_28`,group:r,separator:i,collapse:a,more:o};exports.collapse=a,exports.default=s,exports.group=r,exports.horizontal=t,exports.more=o,exports.root=e,exports.separator=i,exports.vertical=n;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/layout/Toolbar/toolbar.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_avk5e_4", t = "_horizontal_avk5e_13", n = "_vertical_avk5e_16", r = "_group_avk5e_32", i = "_separator_avk5e_42", a = "_collapse_avk5e_58", o = "_more_avk5e_66", s = {
|
|
4
4
|
root: e,
|
|
5
5
|
horizontal: t,
|
|
6
6
|
vertical: n,
|
|
7
|
-
"size-sm": "_size-
|
|
8
|
-
"size-md": "_size-
|
|
9
|
-
"size-lg": "_size-
|
|
7
|
+
"size-sm": "_size-sm_avk5e_20",
|
|
8
|
+
"size-md": "_size-md_avk5e_24",
|
|
9
|
+
"size-lg": "_size-lg_avk5e_28",
|
|
10
10
|
group: r,
|
|
11
|
-
separator: i
|
|
11
|
+
separator: i,
|
|
12
|
+
collapse: a,
|
|
13
|
+
more: o
|
|
12
14
|
};
|
|
13
15
|
//#endregion
|
|
14
|
-
export { a as default, r as group, t as horizontal, e as root, i as separator, n as vertical };
|
|
16
|
+
export { a as collapse, s as default, r as group, t as horizontal, o as more, e as root, i as separator, n as vertical };
|
|
@@ -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("
|
|
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;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=_;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
4
4
|
import { OverlayBase as r } from "../../_internal/OverlayBase.js";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import o from "../../../icon/chevron-
|
|
8
|
-
import s from "../../../icon/
|
|
9
|
-
import c from "../../../icon/
|
|
10
|
-
import l from "../../../icon/
|
|
11
|
-
import u from "
|
|
12
|
-
import {
|
|
5
|
+
import { componentsNs as i } from "../../../i18n/generated/components.js";
|
|
6
|
+
import a from "../../../icon/chevron-left.js";
|
|
7
|
+
import o from "../../../icon/chevron-right.js";
|
|
8
|
+
import s from "../../../icon/close.js";
|
|
9
|
+
import c from "../../../icon/minus.js";
|
|
10
|
+
import l from "../../../icon/plus.js";
|
|
11
|
+
import { Icon as u } from "../Icon/Icon.js";
|
|
12
|
+
import { useAnnounce as d } from "../../_internal/useAnnounce.js";
|
|
13
13
|
import f from "./lightbox.module.js";
|
|
14
14
|
import { createContext as p, useCallback as m, useContext as h, useEffect as g, useState as _ } from "react";
|
|
15
15
|
import v from "classnames";
|
|
@@ -47,8 +47,8 @@ var x = p(void 0), S = () => {
|
|
|
47
47
|
},
|
|
48
48
|
children: e
|
|
49
49
|
});
|
|
50
|
-
}, w = ({ children: r, className:
|
|
51
|
-
let { setOpen: m, setCurrentIndex: h, items: g, openItem: _ } = S(), { t: b } = n(
|
|
50
|
+
}, w = ({ children: r, className: a, onClick: o, asChild: s = !1, index: c, src: l, alt: u, caption: d, ...p }) => {
|
|
51
|
+
let { setOpen: m, setCurrentIndex: h, items: g, openItem: _ } = S(), { t: b } = n(i), x = (e) => {
|
|
52
52
|
o?.(e), l && c === void 0 ? _({
|
|
53
53
|
src: l,
|
|
54
54
|
alt: u,
|
|
@@ -57,61 +57,64 @@ var x = p(void 0), S = () => {
|
|
|
57
57
|
}, 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");
|
|
58
58
|
return /* @__PURE__ */ y(C, {
|
|
59
59
|
type: "button",
|
|
60
|
-
className: v(f.trigger,
|
|
60
|
+
className: v(f.trigger, a),
|
|
61
61
|
onClick: x,
|
|
62
62
|
"aria-label": D,
|
|
63
63
|
...p,
|
|
64
64
|
children: /* @__PURE__ */ y(t, { children: r })
|
|
65
65
|
});
|
|
66
66
|
}, T = ({ className: e, showCloseButton: t = !0, showNavigation: p = !0, showCounter: h = !0, closeOnOverlayClick: x = !0, ...C }) => {
|
|
67
|
-
let { open: w, setOpen: T, currentIndex: E, setCurrentIndex: D, items: O } = S(), { t: k } = n(
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
let { open: w, setOpen: T, currentIndex: E, setCurrentIndex: D, items: O } = S(), { t: k } = n(i), [A, j] = _(1), { announce: M, clear: N, region: P } = d();
|
|
68
|
+
g(() => {
|
|
69
|
+
w || N();
|
|
70
|
+
}, [w, N]);
|
|
71
|
+
let F = m((e) => {
|
|
70
72
|
let t = O[e], n = t?.title || t?.alt, r = k("lightbox.image_status", {
|
|
71
73
|
current: e + 1,
|
|
72
74
|
total: O.length
|
|
73
75
|
});
|
|
74
|
-
|
|
76
|
+
M(n ? `${r}: ${n}` : r), D(e), j(1);
|
|
75
77
|
}, [
|
|
76
78
|
O,
|
|
77
79
|
D,
|
|
78
|
-
k
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
k,
|
|
81
|
+
M
|
|
82
|
+
]), I = m(() => {
|
|
83
|
+
F((E - 1 + O.length) % O.length);
|
|
81
84
|
}, [
|
|
82
85
|
E,
|
|
83
86
|
O.length,
|
|
84
|
-
|
|
85
|
-
]),
|
|
86
|
-
|
|
87
|
+
F
|
|
88
|
+
]), L = m(() => {
|
|
89
|
+
F((E + 1) % O.length);
|
|
87
90
|
}, [
|
|
88
91
|
E,
|
|
89
92
|
O.length,
|
|
90
|
-
|
|
91
|
-
]),
|
|
93
|
+
F
|
|
94
|
+
]), R = () => {
|
|
92
95
|
j((e) => e === 1 ? 2 : 1);
|
|
93
96
|
};
|
|
94
97
|
g(() => {
|
|
95
98
|
if (!w) return;
|
|
96
99
|
let e = (e) => {
|
|
97
|
-
e.key === "ArrowLeft" &&
|
|
100
|
+
e.key === "ArrowLeft" && I(), e.key === "ArrowRight" && L(), e.key === "Escape" && T(!1);
|
|
98
101
|
};
|
|
99
102
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
100
103
|
}, [
|
|
101
104
|
w,
|
|
102
|
-
F,
|
|
103
105
|
I,
|
|
106
|
+
L,
|
|
104
107
|
T
|
|
105
108
|
]);
|
|
106
|
-
let
|
|
107
|
-
return
|
|
109
|
+
let z = O[E];
|
|
110
|
+
return z ? /* @__PURE__ */ y(r, {
|
|
108
111
|
...C,
|
|
109
112
|
open: w,
|
|
110
113
|
onOpenChange: T,
|
|
111
114
|
closeOnOverlayClick: x,
|
|
112
115
|
overlayClassName: f.overlay,
|
|
113
116
|
className: v("wim-lightbox", f.contentRoot, e),
|
|
114
|
-
"aria-label": C["aria-labelledby"] ? void 0 : C["aria-label"] ?? (
|
|
117
|
+
"aria-label": C["aria-labelledby"] ? void 0 : C["aria-label"] ?? (z.title || z.alt || k("lightbox.dialog")),
|
|
115
118
|
transitionProps: {
|
|
116
119
|
preset: "fade",
|
|
117
120
|
enter: f.contentEnter,
|
|
@@ -121,11 +124,7 @@ var x = p(void 0), S = () => {
|
|
|
121
124
|
children: /* @__PURE__ */ b("div", {
|
|
122
125
|
className: f.container,
|
|
123
126
|
children: [
|
|
124
|
-
|
|
125
|
-
role: "status",
|
|
126
|
-
"aria-atomic": "true",
|
|
127
|
-
children: M
|
|
128
|
-
}),
|
|
127
|
+
P,
|
|
129
128
|
/* @__PURE__ */ b("div", {
|
|
130
129
|
className: f.header,
|
|
131
130
|
children: [h && O.length > 1 && /* @__PURE__ */ y("div", {
|
|
@@ -138,14 +137,14 @@ var x = p(void 0), S = () => {
|
|
|
138
137
|
className: f.controls,
|
|
139
138
|
children: [/* @__PURE__ */ y("button", {
|
|
140
139
|
className: f.iconButton,
|
|
141
|
-
onClick:
|
|
140
|
+
onClick: R,
|
|
142
141
|
"aria-label": k(A > 1 ? "lightbox.zoom_out" : "lightbox.zoom_in"),
|
|
143
|
-
children: A > 1 ? /* @__PURE__ */ y(
|
|
142
|
+
children: A > 1 ? /* @__PURE__ */ y(u, { component: c }) : /* @__PURE__ */ y(u, { component: l })
|
|
144
143
|
}), t && /* @__PURE__ */ y("button", {
|
|
145
144
|
className: f.iconButton,
|
|
146
145
|
onClick: () => T(!1),
|
|
147
146
|
"aria-label": k("lightbox.close"),
|
|
148
|
-
children: /* @__PURE__ */ y(
|
|
147
|
+
children: /* @__PURE__ */ y(u, { component: s })
|
|
149
148
|
})]
|
|
150
149
|
})]
|
|
151
150
|
}),
|
|
@@ -154,35 +153,35 @@ var x = p(void 0), S = () => {
|
|
|
154
153
|
children: [
|
|
155
154
|
p && O.length > 1 && /* @__PURE__ */ y("button", {
|
|
156
155
|
className: v(f.navButton, f.prev),
|
|
157
|
-
onClick:
|
|
156
|
+
onClick: I,
|
|
158
157
|
"aria-label": k("lightbox.previous"),
|
|
159
|
-
children: /* @__PURE__ */ y(
|
|
158
|
+
children: /* @__PURE__ */ y(u, { component: a })
|
|
160
159
|
}),
|
|
161
160
|
/* @__PURE__ */ y("div", {
|
|
162
161
|
className: f.mediaWrapper,
|
|
163
162
|
style: { transform: `scale(${A})` },
|
|
164
163
|
children: /* @__PURE__ */ y("img", {
|
|
165
|
-
src:
|
|
166
|
-
alt:
|
|
164
|
+
src: z.src,
|
|
165
|
+
alt: z.alt || "",
|
|
167
166
|
className: f.image
|
|
168
167
|
})
|
|
169
168
|
}),
|
|
170
169
|
p && O.length > 1 && /* @__PURE__ */ y("button", {
|
|
171
170
|
className: v(f.navButton, f.next),
|
|
172
|
-
onClick:
|
|
171
|
+
onClick: L,
|
|
173
172
|
"aria-label": k("lightbox.next"),
|
|
174
|
-
children: /* @__PURE__ */ y(
|
|
173
|
+
children: /* @__PURE__ */ y(u, { component: o })
|
|
175
174
|
})
|
|
176
175
|
]
|
|
177
176
|
}),
|
|
178
|
-
(
|
|
177
|
+
(z.title || z.caption) && /* @__PURE__ */ b("div", {
|
|
179
178
|
className: f.footer,
|
|
180
|
-
children: [
|
|
179
|
+
children: [z.title && /* @__PURE__ */ y("h3", {
|
|
181
180
|
className: f.title,
|
|
182
|
-
children:
|
|
183
|
-
}),
|
|
181
|
+
children: z.title
|
|
182
|
+
}), z.caption && /* @__PURE__ */ y("p", {
|
|
184
183
|
className: f.caption,
|
|
185
|
-
children:
|
|
184
|
+
children: z.caption
|
|
186
185
|
})]
|
|
187
186
|
})
|
|
188
187
|
]
|
|
@@ -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("../../../icon/chevron-right.cjs"),a=require("../../media/Icon/Icon.cjs"),
|
|
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("../../../icon/chevron-right.cjs"),a=require("../../../icon/more-horizontal.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../_internal/InlineDisclosure.cjs"),c=require("../../layout/OverflowList/OverflowList.cjs"),l=require("../../../i18n/generated/navigation.cjs"),u=require("./breadcrumb.module.cjs"),d=require("../Link/Link.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("classnames");p=e.__toESM(p,1);let m=require("react/jsx-runtime");var h=(0,f.forwardRef)(({items:e,separator:f,size:h=`md`,overflow:g=`wrap`,moreLabel:_,className:v,ariaLabel:y,asChild:b,children:x,...S},C)=>{let{t:w}=n.useWimTranslation([r.commonNs,l.navigationNs]),T=y??w(`a11y.breadcrumb`),E=b?t.Root:`nav`,D=(0,m.jsx)(o.Icon,{component:i.default,size:h,className:u.default.separatorIcon}),O=(t,n)=>{let r=n===e.length-1;return(0,m.jsxs)(`li`,{className:u.default.item,children:[(0,m.jsx)(`div`,{className:u.default.content,children:t.href&&!r?(0,m.jsx)(d.Link,{href:t.href,size:h,priority:`secondary`,iconName:t.iconName,className:u.default.link,styles:{label:u.default.linkLabel},children:t.label}):(0,m.jsxs)(`span`,{className:(0,p.default)(u.default.label,r&&u.default.current),"aria-current":r?`page`:void 0,tabIndex:r?0:void 0,role:r?`link`:void 0,children:[t.iconName&&(0,m.jsx)(o.Icon,{name:t.iconName,size:h,className:u.default.labelIcon}),t.label]})}),!r&&(0,m.jsx)(`span`,{className:u.default.separator,"aria-hidden":`true`,children:f||D})]},n)};return(0,m.jsxs)(E,{ref:C,"aria-label":T,className:(0,p.default)(`wim-breadcrumb`,u.default.root,u.default[h],v),onKeyDown:e=>{let t=e.currentTarget,n=Array.from(t.querySelectorAll(`.${u.default.link}, .${u.default.label}.${u.default.current}, button[aria-expanded]`)).filter(e=>!e.closest(`[aria-hidden="true"]`)),r=n.indexOf(document.activeElement);r!==-1&&(e.key===`ArrowRight`?(e.preventDefault(),n[(r+1)%n.length].focus()):e.key===`ArrowLeft`&&(e.preventDefault(),n[(r-1+n.length)%n.length].focus()))},...S,children:[g===`collapse`?(0,m.jsx)(c.OverflowList,{listElement:`ol`,collapseFrom:`middle`,minVisibleItems:Math.min(e.length,2),gap:`0`,items:e,renderItem:(e,t)=>O(e,t),renderOverflow:e=>(0,m.jsxs)(`li`,{className:u.default.item,children:[(0,m.jsx)(s.InlineDisclosure,{trigger:(0,m.jsx)(o.Icon,{component:a.default,size:h}),label:(_??(e=>w(`a11y.breadcrumb_more`,{count:e})))(e.length),children:e.map((e,t)=>(0,m.jsx)(`li`,{children:e.href?(0,m.jsx)(d.Link,{href:e.href,size:h,priority:`secondary`,iconName:e.iconName,children:e.label}):(0,m.jsx)(`span`,{className:u.default.label,children:e.label})},t))}),(0,m.jsx)(`span`,{className:u.default.separator,"aria-hidden":`true`,children:f||D})]})}):(0,m.jsx)(`ol`,{className:u.default.list,children:e.map((e,t)=>O(e,t))}),b?(0,m.jsx)(t.Slottable,{children:x}):null]})});h.displayName=`Breadcrumb`,exports.Breadcrumb=h;
|
|
@@ -20,6 +20,18 @@ type BreadcrumbProps = {
|
|
|
20
20
|
* @default "md"
|
|
21
21
|
*/
|
|
22
22
|
size?: ComponentSizeBasic;
|
|
23
|
+
/**
|
|
24
|
+
* What happens when the items do not fit on one line. `"wrap"` moves them onto more lines;
|
|
25
|
+
* `"collapse"` keeps the first item and the current page and folds the levels in between
|
|
26
|
+
* into a "…" button that lists them.
|
|
27
|
+
* @default "wrap"
|
|
28
|
+
*/
|
|
29
|
+
overflow?: "wrap" | "collapse";
|
|
30
|
+
/**
|
|
31
|
+
* Accessible name of the "…" button, from the number of hidden levels. Defaults to a localized
|
|
32
|
+
* "Show hidden levels (n)".
|
|
33
|
+
*/
|
|
34
|
+
moreLabel?: (count: number) => string;
|
|
23
35
|
/**
|
|
24
36
|
* Additional CSS class name for the container.
|
|
25
37
|
*/
|