wimui 0.51.2 → 0.52.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/FeedbackCloseButton.cjs +1 -1
- package/dist/components/_internal/FeedbackCloseButton.js +14 -13
- package/dist/components/_internal/FieldLabelContent.cjs +1 -1
- package/dist/components/_internal/FieldLabelContent.js +18 -17
- package/dist/components/ai/AIResponseFeedback/AIResponseFeedback.cjs +1 -1
- package/dist/components/ai/AIResponseFeedback/AIResponseFeedback.js +46 -45
- package/dist/components/ai/AgentStatus/AgentStatus.cjs +1 -1
- package/dist/components/ai/AgentStatus/AgentStatus.js +24 -23
- package/dist/components/ai/ArtifactsOverlay/ArtifactsOverlay.cjs +1 -1
- package/dist/components/ai/ArtifactsOverlay/ArtifactsOverlay.js +47 -45
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.js +82 -81
- package/dist/components/ai/CodeBlock/CodeBlock.cjs +3 -3
- package/dist/components/ai/CodeBlock/CodeBlock.js +53 -52
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.cjs +2 -2
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.js +105 -104
- package/dist/components/ai/MarkdownRenderer/MarkdownRenderer.cjs +1 -1
- package/dist/components/ai/MarkdownRenderer/MarkdownRenderer.js +60 -59
- package/dist/components/ai/ModelSelector/ModelSelector.cjs +1 -1
- package/dist/components/ai/ModelSelector/ModelSelector.js +83 -82
- package/dist/components/ai/ModelSelector/model-selector.module.cjs +1 -1
- package/dist/components/ai/ModelSelector/model-selector.module.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.cjs +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +76 -75
- package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
- package/dist/components/ai/SourceCitation/SourceCitation.js +39 -38
- package/dist/components/ai/Terminal/Terminal.cjs +2 -2
- package/dist/components/ai/Terminal/Terminal.js +65 -64
- package/dist/components/ai/ThreadList/ThreadList.cjs +1 -1
- package/dist/components/ai/ThreadList/ThreadList.js +58 -57
- package/dist/components/data-display/Barcode/Barcode.cjs +1 -1
- package/dist/components/data-display/Barcode/Barcode.js +76 -75
- package/dist/components/data-display/Calendar/Calendar.cjs +1 -1
- package/dist/components/data-display/Calendar/Calendar.js +75 -74
- package/dist/components/data-display/CalendarHeatmap/CalendarHeatmap.cjs +1 -1
- package/dist/components/data-display/CalendarHeatmap/CalendarHeatmap.js +54 -52
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +62 -61
- package/dist/components/data-display/Chip/Chip.cjs +1 -1
- package/dist/components/data-display/Chip/Chip.js +36 -35
- package/dist/components/data-display/Comment/Comment.cjs +1 -1
- package/dist/components/data-display/Comment/Comment.js +58 -57
- package/dist/components/data-display/Countdown/Countdown.cjs +1 -1
- package/dist/components/data-display/Countdown/Countdown.js +56 -55
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +128 -127
- package/dist/components/data-display/JsonViewer/JsonViewer.cjs +1 -1
- package/dist/components/data-display/JsonViewer/JsonViewer.js +153 -152
- package/dist/components/data-display/Kanban/Kanban.cjs +1 -1
- package/dist/components/data-display/Kanban/Kanban.js +95 -94
- package/dist/components/data-display/NodeGraph/NodeGraph.cjs +1 -1
- package/dist/components/data-display/NodeGraph/NodeGraph.js +62 -61
- package/dist/components/data-display/PivotTable/PivotTable.cjs +1 -1
- package/dist/components/data-display/PivotTable/PivotTable.js +153 -152
- package/dist/components/data-display/Presence/Presence.cjs +1 -1
- package/dist/components/data-display/Presence/Presence.js +28 -27
- package/dist/components/data-display/PullToRefresh/PullToRefresh.cjs +1 -1
- package/dist/components/data-display/PullToRefresh/PullToRefresh.js +73 -72
- package/dist/components/data-display/Reaction/Reaction.cjs +1 -1
- package/dist/components/data-display/Reaction/Reaction.js +31 -30
- package/dist/components/data-display/ScheduleView/ScheduleView.cjs +1 -1
- package/dist/components/data-display/ScheduleView/ScheduleView.js +49 -48
- package/dist/components/data-display/SortableList/SortableList.cjs +1 -1
- package/dist/components/data-display/SortableList/SortableList.js +44 -43
- package/dist/components/data-display/Tag/Tag.cjs +1 -1
- package/dist/components/data-display/Tag/Tag.js +29 -28
- package/dist/components/data-display/TreeDiagram/TreeDiagram.cjs +1 -1
- package/dist/components/data-display/TreeDiagram/TreeDiagram.js +85 -84
- package/dist/components/data-display/TreeView/TreeView.cjs +1 -1
- package/dist/components/data-display/TreeView/TreeView.js +123 -122
- package/dist/components/feedback/Autosave/Autosave.cjs +1 -1
- package/dist/components/feedback/Autosave/Autosave.js +32 -31
- package/dist/components/feedback/ErrorBoundary/ErrorBoundary.cjs +1 -1
- package/dist/components/feedback/ErrorBoundary/ErrorBoundary.js +35 -34
- package/dist/components/feedback/ScrollProgress/ScrollProgress.cjs +1 -1
- package/dist/components/feedback/ScrollProgress/ScrollProgress.js +21 -20
- package/dist/components/feedback/Tour/Tour.cjs +1 -1
- package/dist/components/feedback/Tour/Tour.js +98 -97
- package/dist/components/form/Button/Button.cjs +1 -1
- package/dist/components/form/Button/Button.js +55 -54
- package/dist/components/form/ColorInput/ColorInput.cjs +1 -1
- package/dist/components/form/ColorInput/ColorInput.js +30 -29
- package/dist/components/form/ColorPicker/color-picker.module.cjs +1 -1
- package/dist/components/form/ColorPicker/color-picker.module.js +1 -1
- package/dist/components/form/CopyButton/CopyButton.cjs +1 -1
- package/dist/components/form/CopyButton/CopyButton.js +27 -26
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +47 -46
- package/dist/components/form/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/form/DateRangePicker/DateRangePicker.js +36 -35
- package/dist/components/form/Dropzone/Dropzone.cjs +1 -1
- package/dist/components/form/Dropzone/Dropzone.js +56 -55
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +47 -46
- package/dist/components/form/FloatButton/FloatButton.cjs +1 -1
- package/dist/components/form/FloatButton/FloatButton.d.ts +4 -1
- package/dist/components/form/FloatButton/FloatButton.js +6 -6
- package/dist/components/form/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/form/ImageCropper/ImageCropper.js +101 -99
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +66 -65
- package/dist/components/form/Input/Input.cjs +1 -1
- package/dist/components/form/Input/Input.js +45 -44
- package/dist/components/form/InputBase/InputBase.cjs +1 -1
- package/dist/components/form/InputBase/InputBase.js +51 -50
- package/dist/components/form/InputBase/input-base.module.cjs +1 -1
- package/dist/components/form/InputBase/input-base.module.js +1 -1
- package/dist/components/form/MultiSelect/multiselect.module.cjs +1 -1
- package/dist/components/form/MultiSelect/multiselect.module.js +1 -1
- package/dist/components/form/PasswordStrength/PasswordStrength.cjs +1 -1
- package/dist/components/form/PasswordStrength/PasswordStrength.js +27 -26
- package/dist/components/form/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.js +10 -10
- package/dist/components/form/QueryBuilder/QueryBuilder.cjs +1 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.js +90 -89
- package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.js +30 -29
- package/dist/components/form/RichTextEditor/RichTextEditor.cjs +1 -1
- package/dist/components/form/RichTextEditor/RichTextEditor.js +223 -222
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.js +7 -7
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +112 -111
- package/dist/components/form/SignaturePad/SignaturePad.cjs +1 -1
- package/dist/components/form/SignaturePad/SignaturePad.js +86 -79
- package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
- package/dist/components/form/SmartSearchInput/SmartSearchInput.js +63 -62
- package/dist/components/form/TagInput/TagInput.cjs +1 -1
- package/dist/components/form/TagInput/TagInput.js +68 -67
- package/dist/components/form/ThemeToggle/ThemeToggle.cjs +1 -1
- package/dist/components/form/ThemeToggle/ThemeToggle.js +68 -67
- package/dist/components/form/ThemeToggle/theme-toggle.module.cjs +1 -1
- package/dist/components/form/ThemeToggle/theme-toggle.module.js +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.js +6 -6
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.js +127 -126
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +6 -6
- package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
- package/dist/components/layout/Dashboard/Dashboard.js +90 -89
- package/dist/components/layout/Navbar/Navbar.cjs +1 -1
- package/dist/components/layout/Navbar/Navbar.d.ts +1 -1
- package/dist/components/layout/Navbar/Navbar.js +1 -1
- package/dist/components/layout/Sidebar/Sidebar.d.ts +1 -1
- package/dist/components/layout/Splitter/Splitter.cjs +1 -1
- package/dist/components/layout/Splitter/Splitter.js +40 -39
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.js +66 -39
- package/dist/components/media/Audio/Audio.cjs +1 -1
- package/dist/components/media/Audio/Audio.js +90 -89
- package/dist/components/media/Audio/components/AudioCustomControls.cjs +1 -1
- package/dist/components/media/Audio/components/AudioCustomControls.js +115 -114
- package/dist/components/media/Gallery/Gallery.cjs +1 -1
- package/dist/components/media/Gallery/Gallery.js +132 -131
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +72 -71
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +128 -127
- package/dist/components/media/Video/Video.cjs +1 -1
- package/dist/components/media/Video/Video.js +56 -55
- package/dist/components/media/Video/components/VideoAdvancedMenu.cjs +1 -1
- package/dist/components/media/Video/components/VideoAdvancedMenu.js +136 -135
- package/dist/components/media/Video/components/VideoControls.cjs +1 -1
- package/dist/components/media/Video/components/VideoControls.js +103 -102
- package/dist/components/navigation/BackTop/BackTop.cjs +1 -1
- package/dist/components/navigation/BackTop/BackTop.js +37 -36
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +41 -40
- package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.js +100 -99
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.cjs +1 -1
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.d.ts +6 -0
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.js +32 -22
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +39 -38
- package/dist/components/navigation/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/navigation/SpeedDial/SpeedDial.js +44 -43
- package/dist/components/overlay/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/overlay/ContextMenu/ContextMenu.js +4 -4
- package/dist/components/overlay/Popover/Popover.cjs +1 -1
- package/dist/components/overlay/Popover/Popover.js +63 -62
- package/dist/components/typography/Spoiler/Spoiler.cjs +1 -1
- package/dist/components/typography/Spoiler/Spoiler.js +38 -37
- package/dist/i18n/generated/common.cjs +2 -0
- package/dist/i18n/generated/common.d.ts +3 -0
- package/dist/i18n/generated/common.js +570 -0
- package/dist/i18n/generated/components.cjs +2 -0
- package/dist/i18n/generated/components.d.ts +3 -0
- package/dist/i18n/generated/components.js +399 -0
- package/dist/i18n/generated/data-display.cjs +2 -0
- package/dist/i18n/generated/data-display.d.ts +3 -0
- package/dist/i18n/generated/data-display.js +12 -0
- package/dist/i18n/generated/form.cjs +2 -0
- package/dist/i18n/generated/form.d.ts +3 -0
- package/dist/i18n/generated/form.js +321 -0
- package/dist/i18n/generated/keys.d.ts +5 -1
- package/dist/i18n/generated/locales.cjs +2 -0
- package/dist/i18n/generated/locales.d.ts +1 -0
- package/dist/i18n/generated/locales.js +9 -0
- package/dist/i18n/instance.cjs +1 -1
- package/dist/i18n/instance.d.ts +18 -3
- package/dist/i18n/instance.js +24 -26
- package/dist/i18n/useWimTranslation.cjs +1 -1
- package/dist/i18n/useWimTranslation.d.ts +7 -8
- package/dist/i18n/useWimTranslation.js +6 -5
- package/dist/llms-full.txt +7 -3
- 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 +10 -10
- package/dist/i18n/generated/resources.cjs +0 -2
- package/dist/i18n/generated/resources.d.ts +0 -4
- package/dist/i18n/generated/resources.js +0 -1283
|
@@ -1,76 +1,77 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import t from "../../../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import a from "
|
|
8
|
-
import o
|
|
9
|
-
import m from "
|
|
10
|
-
import
|
|
3
|
+
import { componentsNs as t } from "../../../i18n/generated/components.js";
|
|
4
|
+
import n from "../../../icon/close.js";
|
|
5
|
+
import { Icon as r } from "../Icon/Icon.js";
|
|
6
|
+
import { Button as i } from "../../form/Button/Button.js";
|
|
7
|
+
import { Checkbox as a } from "../../form/Checkbox/Checkbox.js";
|
|
8
|
+
import o from "./gallery.module.js";
|
|
9
|
+
import s, { createContext as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
10
|
+
import h from "classnames";
|
|
11
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/media/Gallery/Gallery.tsx
|
|
12
|
-
var
|
|
13
|
-
let e =
|
|
13
|
+
var v = c(null), y = () => {
|
|
14
|
+
let e = u(v);
|
|
14
15
|
if (!e) throw Error("Gallery subcomponents must be used within Gallery");
|
|
15
16
|
return e;
|
|
16
|
-
},
|
|
17
|
-
let { t:
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
|
|
21
|
-
let e =
|
|
17
|
+
}, b = s.forwardRef(({ items: a, columns: s = 3, gap: c = "md", aspect: u = "square", selectable: y = !1, selected: b, defaultSelected: S = [], onSelectionChange: C, onItemClick: w, renderActions: T, className: E, style: D, ...O }, k) => {
|
|
18
|
+
let { t: A } = e(t), j = b !== void 0, [M, N] = m(() => new Set(S)), [P, F] = m(0), I = p(null), L = p(null), [R, z] = m(s), B = l((e) => {
|
|
19
|
+
L.current = e, typeof k == "function" ? k(e) : k && (k.current = e);
|
|
20
|
+
}, [k]);
|
|
21
|
+
d(() => {
|
|
22
|
+
let e = L.current;
|
|
22
23
|
if (!e) return;
|
|
23
24
|
let t = new ResizeObserver((e) => {
|
|
24
25
|
let t = e[0].contentRect.width;
|
|
25
|
-
|
|
26
|
+
z(t < 480 ? 1 : t < 576 ? 2 : s);
|
|
26
27
|
});
|
|
27
28
|
return t.observe(e), () => t.disconnect();
|
|
28
|
-
}, [
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
let r = new Set(
|
|
37
|
-
if (n &&
|
|
38
|
-
let n = Math.min(
|
|
39
|
-
for (let e = n; e <=
|
|
40
|
-
} else r.has(e) ? r.delete(e) : r.add(e),
|
|
41
|
-
|
|
29
|
+
}, [s]);
|
|
30
|
+
let V = f(() => j ? new Set(b) : M, [
|
|
31
|
+
j,
|
|
32
|
+
b,
|
|
33
|
+
M
|
|
34
|
+
]), H = l((e) => {
|
|
35
|
+
j || N(e), C?.(Array.from(e));
|
|
36
|
+
}, [j, C]), U = l((e, t, n) => {
|
|
37
|
+
let r = new Set(V);
|
|
38
|
+
if (n && I.current !== null) {
|
|
39
|
+
let n = Math.min(I.current, t), i = Math.max(I.current, t), o = !V.has(e);
|
|
40
|
+
for (let e = n; e <= i; e++) o ? r.add(a[e].id) : r.delete(a[e].id);
|
|
41
|
+
} else r.has(e) ? r.delete(e) : r.add(e), I.current = t;
|
|
42
|
+
H(r);
|
|
42
43
|
}, [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]),
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
44
|
+
V,
|
|
45
|
+
a,
|
|
46
|
+
H
|
|
47
|
+
]), W = l(() => {
|
|
48
|
+
H(new Set(a.map((e) => e.id)));
|
|
49
|
+
}, [a, H]), G = l(() => {
|
|
50
|
+
H(/* @__PURE__ */ new Set());
|
|
51
|
+
}, [H]), K = f(() => {
|
|
51
52
|
let e = [];
|
|
52
|
-
for (let t = 0; t <
|
|
53
|
-
rowItems:
|
|
53
|
+
for (let t = 0; t < a.length; t += R) e.push({
|
|
54
|
+
rowItems: a.slice(t, t + R),
|
|
54
55
|
startIndex: t
|
|
55
56
|
});
|
|
56
57
|
return e;
|
|
57
|
-
}, [
|
|
58
|
-
"--gallery-columns":
|
|
59
|
-
...
|
|
60
|
-
},
|
|
61
|
-
let t =
|
|
58
|
+
}, [a, R]), q = Array.from(V), J = q.length > 0, Y = {
|
|
59
|
+
"--gallery-columns": R,
|
|
60
|
+
...D
|
|
61
|
+
}, X = (e) => {
|
|
62
|
+
let t = R, n = a.length, r = P;
|
|
62
63
|
switch (e.key) {
|
|
63
64
|
case "ArrowRight":
|
|
64
|
-
e.preventDefault(), r = Math.min(
|
|
65
|
+
e.preventDefault(), r = Math.min(P + 1, n - 1);
|
|
65
66
|
break;
|
|
66
67
|
case "ArrowLeft":
|
|
67
|
-
e.preventDefault(), r = Math.max(
|
|
68
|
+
e.preventDefault(), r = Math.max(P - 1, 0);
|
|
68
69
|
break;
|
|
69
70
|
case "ArrowDown":
|
|
70
|
-
e.preventDefault(), r = Math.min(
|
|
71
|
+
e.preventDefault(), r = Math.min(P + t, n - 1);
|
|
71
72
|
break;
|
|
72
73
|
case "ArrowUp":
|
|
73
|
-
e.preventDefault(), r = Math.max(
|
|
74
|
+
e.preventDefault(), r = Math.max(P - t, 0);
|
|
74
75
|
break;
|
|
75
76
|
case "Home":
|
|
76
77
|
e.preventDefault(), r = 0;
|
|
@@ -79,69 +80,69 @@ var _ = s(null), v = () => {
|
|
|
79
80
|
e.preventDefault(), r = n - 1;
|
|
80
81
|
break;
|
|
81
82
|
case "Escape":
|
|
82
|
-
|
|
83
|
+
y && (e.preventDefault(), G());
|
|
83
84
|
break;
|
|
84
85
|
case "a":
|
|
85
86
|
case "A":
|
|
86
|
-
|
|
87
|
+
y && (e.ctrlKey || e.metaKey) && (e.preventDefault(), W());
|
|
87
88
|
break;
|
|
88
89
|
default: return;
|
|
89
90
|
}
|
|
90
|
-
r !==
|
|
91
|
+
r !== P && (F(r), e.currentTarget.querySelectorAll("[data-gallery-item]")[r]?.focus());
|
|
91
92
|
};
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ g(v.Provider, {
|
|
93
94
|
value: {
|
|
94
|
-
selectable:
|
|
95
|
-
selectedIds:
|
|
96
|
-
lastClickedIndex:
|
|
97
|
-
items:
|
|
98
|
-
toggleSelect:
|
|
99
|
-
focusedIndex:
|
|
100
|
-
setFocusedIndex:
|
|
101
|
-
selectAll:
|
|
102
|
-
clearSelection:
|
|
103
|
-
onItemClick:
|
|
95
|
+
selectable: y,
|
|
96
|
+
selectedIds: V,
|
|
97
|
+
lastClickedIndex: I,
|
|
98
|
+
items: a,
|
|
99
|
+
toggleSelect: U,
|
|
100
|
+
focusedIndex: P,
|
|
101
|
+
setFocusedIndex: F,
|
|
102
|
+
selectAll: W,
|
|
103
|
+
clearSelection: G,
|
|
104
|
+
onItemClick: w
|
|
104
105
|
},
|
|
105
|
-
children: /* @__PURE__ */
|
|
106
|
-
ref:
|
|
107
|
-
className:
|
|
108
|
-
...
|
|
109
|
-
children: [
|
|
110
|
-
className:
|
|
106
|
+
children: /* @__PURE__ */ _("div", {
|
|
107
|
+
ref: B,
|
|
108
|
+
className: h("wim-gallery", o.root, E),
|
|
109
|
+
...O,
|
|
110
|
+
children: [y && J && /* @__PURE__ */ _("div", {
|
|
111
|
+
className: o.toolbar,
|
|
111
112
|
role: "toolbar",
|
|
112
|
-
"aria-label":
|
|
113
|
-
children: [/* @__PURE__ */
|
|
114
|
-
className:
|
|
115
|
-
children:
|
|
116
|
-
}), /* @__PURE__ */
|
|
117
|
-
className:
|
|
118
|
-
children: [
|
|
119
|
-
selectedIds:
|
|
120
|
-
clearSelection:
|
|
121
|
-
}), /* @__PURE__ */
|
|
113
|
+
"aria-label": A("gallery.toolbar_label"),
|
|
114
|
+
children: [/* @__PURE__ */ g("span", {
|
|
115
|
+
className: o.toolbarCount,
|
|
116
|
+
children: A("gallery.selected_count", { count: q.length })
|
|
117
|
+
}), /* @__PURE__ */ _("div", {
|
|
118
|
+
className: o.toolbarActions,
|
|
119
|
+
children: [T?.({
|
|
120
|
+
selectedIds: q,
|
|
121
|
+
clearSelection: G
|
|
122
|
+
}), /* @__PURE__ */ g(i, {
|
|
122
123
|
size: "sm",
|
|
123
124
|
variant: "ghost",
|
|
124
|
-
className:
|
|
125
|
-
onClick:
|
|
126
|
-
"aria-label":
|
|
127
|
-
icon: /* @__PURE__ */
|
|
128
|
-
component:
|
|
125
|
+
className: o.toolbarClear,
|
|
126
|
+
onClick: G,
|
|
127
|
+
"aria-label": A("gallery.clear_selection"),
|
|
128
|
+
icon: /* @__PURE__ */ g(r, {
|
|
129
|
+
component: n,
|
|
129
130
|
size: "sm"
|
|
130
131
|
})
|
|
131
132
|
})]
|
|
132
133
|
})]
|
|
133
|
-
}), /* @__PURE__ */
|
|
134
|
-
className:
|
|
135
|
-
style:
|
|
134
|
+
}), /* @__PURE__ */ g("div", {
|
|
135
|
+
className: h(o.grid, o[`gap-${c}`], o[`aspect-${u}`]),
|
|
136
|
+
style: Y,
|
|
136
137
|
role: "grid",
|
|
137
|
-
"aria-multiselectable":
|
|
138
|
-
"aria-label":
|
|
139
|
-
onKeyDown:
|
|
138
|
+
"aria-multiselectable": y || void 0,
|
|
139
|
+
"aria-label": A("gallery.grid_label"),
|
|
140
|
+
onKeyDown: X,
|
|
140
141
|
tabIndex: 0,
|
|
141
|
-
children:
|
|
142
|
+
children: K.map(({ rowItems: e, startIndex: t }, n) => /* @__PURE__ */ g("div", {
|
|
142
143
|
role: "row",
|
|
143
144
|
style: { display: "contents" },
|
|
144
|
-
children: e.map((e, n) => /* @__PURE__ */
|
|
145
|
+
children: e.map((e, n) => /* @__PURE__ */ g(x, {
|
|
145
146
|
item: e,
|
|
146
147
|
index: t + n
|
|
147
148
|
}, e.id))
|
|
@@ -150,60 +151,60 @@ var _ = s(null), v = () => {
|
|
|
150
151
|
})
|
|
151
152
|
});
|
|
152
153
|
});
|
|
153
|
-
|
|
154
|
-
var
|
|
155
|
-
let { selectable:
|
|
156
|
-
|
|
157
|
-
}, y = (e) => {
|
|
158
|
-
e.stopPropagation(), s(t.id, n, e.shiftKey);
|
|
154
|
+
b.displayName = "Gallery";
|
|
155
|
+
var x = ({ item: n, index: r }) => {
|
|
156
|
+
let { selectable: i, selectedIds: s, toggleSelect: c, focusedIndex: l, setFocusedIndex: u, onItemClick: d } = y(), { t: f } = e(t), p = s.has(n.id), m = l === r, v = () => {
|
|
157
|
+
d?.(n, r), u(r);
|
|
159
158
|
}, b = (e) => {
|
|
160
|
-
|
|
159
|
+
e.stopPropagation(), c(n.id, r, e.shiftKey);
|
|
160
|
+
}, x = (e) => {
|
|
161
|
+
(e.key === " " || e.key === "Enter") && (e.preventDefault(), i && e.key === " " ? c(n.id, r, e.shiftKey) : d?.(n, r));
|
|
161
162
|
};
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
className:
|
|
163
|
+
return /* @__PURE__ */ _("div", {
|
|
164
|
+
className: h(o.item, { [o.selected]: p }),
|
|
164
165
|
role: "gridcell",
|
|
165
|
-
"aria-selected":
|
|
166
|
-
tabIndex:
|
|
167
|
-
onClick:
|
|
168
|
-
onKeyDown:
|
|
169
|
-
onFocus: () =>
|
|
166
|
+
"aria-selected": i ? p : void 0,
|
|
167
|
+
tabIndex: m ? 0 : -1,
|
|
168
|
+
onClick: v,
|
|
169
|
+
onKeyDown: x,
|
|
170
|
+
onFocus: () => u(r),
|
|
170
171
|
"data-gallery-item": !0,
|
|
171
|
-
children: [/* @__PURE__ */
|
|
172
|
-
className:
|
|
172
|
+
children: [/* @__PURE__ */ _("div", {
|
|
173
|
+
className: o.imageWrapper,
|
|
173
174
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
src:
|
|
176
|
-
alt:
|
|
177
|
-
className:
|
|
175
|
+
/* @__PURE__ */ g("img", {
|
|
176
|
+
src: n.src,
|
|
177
|
+
alt: n.alt ?? n.title ?? "",
|
|
178
|
+
className: o.image,
|
|
178
179
|
draggable: !1
|
|
179
180
|
}),
|
|
180
|
-
|
|
181
|
-
className:
|
|
182
|
-
children: /* @__PURE__ */
|
|
183
|
-
checked:
|
|
181
|
+
i && /* @__PURE__ */ g("div", {
|
|
182
|
+
className: o.checkboxOverlay,
|
|
183
|
+
children: /* @__PURE__ */ g(a, {
|
|
184
|
+
checked: p,
|
|
184
185
|
onChange: () => {},
|
|
185
|
-
onClick:
|
|
186
|
-
"aria-label":
|
|
186
|
+
onClick: b,
|
|
187
|
+
"aria-label": f(p ? "gallery.deselect_item" : "gallery.select_item", { title: n.title ?? n.alt ?? String(r + 1) }),
|
|
187
188
|
tabIndex: -1,
|
|
188
|
-
className:
|
|
189
|
+
className: o.checkbox
|
|
189
190
|
})
|
|
190
191
|
}),
|
|
191
|
-
|
|
192
|
-
className:
|
|
192
|
+
p && /* @__PURE__ */ g("div", {
|
|
193
|
+
className: o.selectedRing,
|
|
193
194
|
"aria-hidden": !0
|
|
194
195
|
})
|
|
195
196
|
]
|
|
196
|
-
}), (
|
|
197
|
-
className:
|
|
198
|
-
children: [
|
|
199
|
-
className:
|
|
200
|
-
children:
|
|
201
|
-
}),
|
|
202
|
-
className:
|
|
203
|
-
children:
|
|
197
|
+
}), (n.title || n.caption) && /* @__PURE__ */ _("div", {
|
|
198
|
+
className: o.caption,
|
|
199
|
+
children: [n.title && /* @__PURE__ */ g("span", {
|
|
200
|
+
className: o.captionTitle,
|
|
201
|
+
children: n.title
|
|
202
|
+
}), n.caption && /* @__PURE__ */ g("span", {
|
|
203
|
+
className: o.captionText,
|
|
204
|
+
children: n.caption
|
|
204
205
|
})]
|
|
205
206
|
})]
|
|
206
207
|
});
|
|
207
208
|
};
|
|
208
209
|
//#endregion
|
|
209
|
-
export {
|
|
210
|
+
export { b as Gallery };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/chevron-left.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../../icon/chevron-left.cjs"),i=require("../../../icon/chevron-right.cjs"),a=require("../Icon/Icon.cjs"),o=require("./image-compare.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=e=>Math.max(0,Math.min(100,e)),d=s.default.forwardRef(({before:e,after:d,beforeAlt:f=``,afterAlt:p=``,beforeLabel:m,afterLabel:h,defaultPosition:g=50,position:_,onPositionChange:v,orientation:y=`horizontal`,width:b,height:x,radius:S=`md`,labels:C,className:w,...T},E)=>{let{t:D}=t.useWimTranslation(n.commonNs),{handleAriaLabel:O=D(`imageCompare.handle`)}=C??{},k=_!==void 0,[A,j]=(0,s.useState)(u(g)),M=u(k?_:A),N=y===`vertical`,P=(0,s.useRef)(null),F=(0,s.useRef)(!1),I=(0,s.useCallback)(e=>{P.current=e,typeof E==`function`?E(e):E&&(E.current=e)},[E]),L=(0,s.useCallback)(e=>{let t=u(e);k||j(t),v?.(t)},[k,v]),R=(0,s.useCallback)((e,t)=>{let n=P.current?.getBoundingClientRect();if(!n)return;let r=N?(t-n.top)/n.height*100:(e-n.left)/n.width*100;L(r)},[N,L]),z=e=>{F.current=!0,e.currentTarget.setPointerCapture(e.pointerId),R(e.clientX,e.clientY)},B=e=>{F.current&&R(e.clientX,e.clientY)},V=e=>{F.current=!1,e.currentTarget.releasePointerCapture?.(e.pointerId)},H=e=>{let t=e.shiftKey?10:2,n=N?`ArrowUp`:`ArrowLeft`,r=N?`ArrowDown`:`ArrowRight`;e.key===n?(e.preventDefault(),L(M-t)):e.key===r?(e.preventDefault(),L(M+t)):e.key===`Home`?(e.preventDefault(),L(0)):e.key===`End`&&(e.preventDefault(),L(100))},U=N?{clipPath:`inset(0 0 ${100-M}% 0)`}:{clipPath:`inset(0 ${100-M}% 0 0)`},W=N?{top:`${M}%`}:{left:`${M}%`};return(0,l.jsxs)(`div`,{ref:I,className:(0,c.default)(`wim-image-compare`,o.default.root,N&&o.default.vertical,o.default[`radius-${S}`],w),style:{width:b,height:x},onPointerDown:z,onPointerMove:B,onPointerUp:V,...T,children:[(0,l.jsx)(`img`,{className:o.default.image,src:d,alt:p,draggable:!1}),h&&(0,l.jsx)(`span`,{className:(0,c.default)(o.default.label,o.default.afterLabel),children:h}),(0,l.jsxs)(`div`,{className:o.default.beforeLayer,style:U,children:[(0,l.jsx)(`img`,{className:o.default.image,src:e,alt:f,draggable:!1}),m&&(0,l.jsx)(`span`,{className:(0,c.default)(o.default.label,o.default.beforeLabel),children:m})]}),(0,l.jsxs)(`div`,{className:o.default.divider,style:W,children:[(0,l.jsx)(`span`,{className:o.default.line,"aria-hidden":`true`}),(0,l.jsxs)(`button`,{type:`button`,className:o.default.handle,role:`slider`,"aria-label":O,"aria-orientation":y,"aria-valuenow":Math.round(M),"aria-valuemin":0,"aria-valuemax":100,onKeyDown:H,onPointerDown:z,children:[(0,l.jsx)(a.Icon,{component:r.default,size:`sm`,className:o.default.arrow}),(0,l.jsx)(a.Icon,{component:i.default,size:`sm`,className:o.default.arrow})]})]})]})});d.displayName=`ImageCompare`,exports.ImageCompare=d;
|
|
@@ -1,100 +1,101 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import t from "../../../
|
|
4
|
-
import n from "../../../icon/chevron-
|
|
5
|
-
import
|
|
6
|
-
import i from "
|
|
7
|
-
import a
|
|
8
|
-
import l from "
|
|
9
|
-
import
|
|
3
|
+
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
+
import n from "../../../icon/chevron-left.js";
|
|
5
|
+
import r from "../../../icon/chevron-right.js";
|
|
6
|
+
import { Icon as i } from "../Icon/Icon.js";
|
|
7
|
+
import a from "./image-compare.module.js";
|
|
8
|
+
import o, { useCallback as s, useRef as c, useState as l } from "react";
|
|
9
|
+
import u from "classnames";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/media/ImageCompare/ImageCompare.tsx
|
|
11
|
-
var
|
|
12
|
-
let { t:
|
|
13
|
-
|
|
14
|
-
}, [
|
|
15
|
-
let t =
|
|
16
|
-
|
|
17
|
-
}, [
|
|
18
|
-
let n =
|
|
12
|
+
var p = (e) => Math.max(0, Math.min(100, e)), m = o.forwardRef(({ before: o, after: m, beforeAlt: h = "", afterAlt: g = "", beforeLabel: _, afterLabel: v, defaultPosition: y = 50, position: b, onPositionChange: x, orientation: S = "horizontal", width: C, height: w, radius: T = "md", labels: E, className: D, ...O }, k) => {
|
|
13
|
+
let { t: A } = e(t), { handleAriaLabel: j = A("imageCompare.handle") } = E ?? {}, M = b !== void 0, [N, P] = l(p(y)), F = p(M ? b : N), I = S === "vertical", L = c(null), R = c(!1), z = s((e) => {
|
|
14
|
+
L.current = e, typeof k == "function" ? k(e) : k && (k.current = e);
|
|
15
|
+
}, [k]), B = s((e) => {
|
|
16
|
+
let t = p(e);
|
|
17
|
+
M || P(t), x?.(t);
|
|
18
|
+
}, [M, x]), V = s((e, t) => {
|
|
19
|
+
let n = L.current?.getBoundingClientRect();
|
|
19
20
|
if (!n) return;
|
|
20
|
-
let r =
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
}, H = (e) => {
|
|
25
|
-
L.current && B(e.clientX, e.clientY);
|
|
21
|
+
let r = I ? (t - n.top) / n.height * 100 : (e - n.left) / n.width * 100;
|
|
22
|
+
B(r);
|
|
23
|
+
}, [I, B]), H = (e) => {
|
|
24
|
+
R.current = !0, e.currentTarget.setPointerCapture(e.pointerId), V(e.clientX, e.clientY);
|
|
26
25
|
}, U = (e) => {
|
|
27
|
-
|
|
26
|
+
R.current && V(e.clientX, e.clientY);
|
|
28
27
|
}, W = (e) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
R.current = !1, e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
29
|
+
}, G = (e) => {
|
|
30
|
+
let t = e.shiftKey ? 10 : 2, n = I ? "ArrowUp" : "ArrowLeft", r = I ? "ArrowDown" : "ArrowRight";
|
|
31
|
+
e.key === n ? (e.preventDefault(), B(F - t)) : e.key === r ? (e.preventDefault(), B(F + t)) : e.key === "Home" ? (e.preventDefault(), B(0)) : e.key === "End" && (e.preventDefault(), B(100));
|
|
32
|
+
}, K = I ? { clipPath: `inset(0 0 ${100 - F}% 0)` } : { clipPath: `inset(0 ${100 - F}% 0 0)` }, q = I ? { top: `${F}%` } : { left: `${F}%` };
|
|
33
|
+
return /* @__PURE__ */ f("div", {
|
|
34
|
+
ref: z,
|
|
35
|
+
className: u("wim-image-compare", a.root, I && a.vertical, a[`radius-${T}`], D),
|
|
35
36
|
style: {
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
37
|
+
width: C,
|
|
38
|
+
height: w
|
|
38
39
|
},
|
|
39
|
-
onPointerDown:
|
|
40
|
-
onPointerMove:
|
|
41
|
-
onPointerUp:
|
|
42
|
-
...
|
|
40
|
+
onPointerDown: H,
|
|
41
|
+
onPointerMove: U,
|
|
42
|
+
onPointerUp: W,
|
|
43
|
+
...O,
|
|
43
44
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
className:
|
|
46
|
-
src:
|
|
47
|
-
alt:
|
|
45
|
+
/* @__PURE__ */ d("img", {
|
|
46
|
+
className: a.image,
|
|
47
|
+
src: m,
|
|
48
|
+
alt: g,
|
|
48
49
|
draggable: !1
|
|
49
50
|
}),
|
|
50
|
-
|
|
51
|
-
className:
|
|
52
|
-
children:
|
|
51
|
+
v && /* @__PURE__ */ d("span", {
|
|
52
|
+
className: u(a.label, a.afterLabel),
|
|
53
|
+
children: v
|
|
53
54
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
className:
|
|
56
|
-
style:
|
|
57
|
-
children: [/* @__PURE__ */
|
|
58
|
-
className:
|
|
59
|
-
src:
|
|
60
|
-
alt:
|
|
55
|
+
/* @__PURE__ */ f("div", {
|
|
56
|
+
className: a.beforeLayer,
|
|
57
|
+
style: K,
|
|
58
|
+
children: [/* @__PURE__ */ d("img", {
|
|
59
|
+
className: a.image,
|
|
60
|
+
src: o,
|
|
61
|
+
alt: h,
|
|
61
62
|
draggable: !1
|
|
62
|
-
}),
|
|
63
|
-
className:
|
|
64
|
-
children:
|
|
63
|
+
}), _ && /* @__PURE__ */ d("span", {
|
|
64
|
+
className: u(a.label, a.beforeLabel),
|
|
65
|
+
children: _
|
|
65
66
|
})]
|
|
66
67
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
className:
|
|
69
|
-
style:
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
className:
|
|
68
|
+
/* @__PURE__ */ f("div", {
|
|
69
|
+
className: a.divider,
|
|
70
|
+
style: q,
|
|
71
|
+
children: [/* @__PURE__ */ d("span", {
|
|
72
|
+
className: a.line,
|
|
72
73
|
"aria-hidden": "true"
|
|
73
|
-
}), /* @__PURE__ */
|
|
74
|
+
}), /* @__PURE__ */ f("button", {
|
|
74
75
|
type: "button",
|
|
75
|
-
className:
|
|
76
|
+
className: a.handle,
|
|
76
77
|
role: "slider",
|
|
77
|
-
"aria-label":
|
|
78
|
-
"aria-orientation":
|
|
79
|
-
"aria-valuenow": Math.round(
|
|
78
|
+
"aria-label": j,
|
|
79
|
+
"aria-orientation": S,
|
|
80
|
+
"aria-valuenow": Math.round(F),
|
|
80
81
|
"aria-valuemin": 0,
|
|
81
82
|
"aria-valuemax": 100,
|
|
82
|
-
onKeyDown:
|
|
83
|
-
onPointerDown:
|
|
84
|
-
children: [/* @__PURE__ */
|
|
85
|
-
component: t,
|
|
86
|
-
size: "sm",
|
|
87
|
-
className: i.arrow
|
|
88
|
-
}), /* @__PURE__ */ u(r, {
|
|
83
|
+
onKeyDown: G,
|
|
84
|
+
onPointerDown: H,
|
|
85
|
+
children: [/* @__PURE__ */ d(i, {
|
|
89
86
|
component: n,
|
|
90
87
|
size: "sm",
|
|
91
|
-
className:
|
|
88
|
+
className: a.arrow
|
|
89
|
+
}), /* @__PURE__ */ d(i, {
|
|
90
|
+
component: r,
|
|
91
|
+
size: "sm",
|
|
92
|
+
className: a.arrow
|
|
92
93
|
})]
|
|
93
94
|
})]
|
|
94
95
|
})
|
|
95
96
|
]
|
|
96
97
|
});
|
|
97
98
|
});
|
|
98
|
-
|
|
99
|
+
m.displayName = "ImageCompare";
|
|
99
100
|
//#endregion
|
|
100
|
-
export {
|
|
101
|
+
export { m as ImageCompare };
|
|
@@ -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("../../../icon/chevron-left.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("../../_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("./lightbox.module.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.createContext)(void 0),g=()=>{let e=(0,f.useContext)(h);if(!e)throw Error(`Lightbox components must be used within Lightbox`);return e},_=({children:e,open:t,onOpenChange:n,defaultOpen:r=!1,defaultIndex:i=0})=>{let[a,o]=(0,f.useState)(r),[s,c]=(0,f.useState)(i),[l,u]=(0,f.useState)([]),d=t!==void 0,p=d?t:a,g=(0,f.useCallback)(e=>{d||o(e),n?.(e)},[d,n]),_=(0,f.useCallback)(e=>{let t=-1;return u(n=>(t=n.length,[...n,e])),t},[]),v=(0,f.useCallback)(e=>{},[]);return(0,m.jsx)(h.Provider,{value:{open:p,setOpen:g,currentIndex:s,setCurrentIndex:c,items:l,setItems:u,registerItem:_,unregisterItem:v},children:e})},v=({children:e,className:r,onClick:a,asChild:o=!1,index:s,src:c,alt:l,caption:u,...f})=>{let{setOpen:h,setCurrentIndex:_,items:v,setItems:y}=g(),{t:b}=n.useWimTranslation(i.componentsNs),x=e=>{if(a?.(e),s!==void 0)_(s);else if(c){let e=v.findIndex(e=>e.src===c);if(e!==-1)_(e);else{let e=v.length;y(e=>[...e,{src:c,alt:l,caption:u}]),_(e)}}h(!0)},S=o?t.Root:`button`,C=s===void 0?void 0:v[s]?.alt,w=f[`aria-label`]!==void 0||f[`aria-labelledby`]!==void 0,T=l??C,E=w?void 0:T?b(`lightbox.open_named`,{name:T}):b(`lightbox.open`);return(0,m.jsx)(S,{type:`button`,className:(0,p.default)(d.default.trigger,r),onClick:x,"aria-label":E,...f,children:(0,m.jsx)(t.Slottable,{children:e})})},y=({className:e,showCloseButton:t=!0,showNavigation:h=!0,showCounter:_=!0,closeOnOverlayClick:v=!0,...y})=>{let{open:b,setOpen:x,currentIndex:S,setCurrentIndex:C,items:w}=g(),{t:T}=n.useWimTranslation(i.componentsNs),[E,D]=(0,f.useState)(1),O=(0,f.useCallback)(()=>{C((S-1+w.length)%w.length),D(1)},[S,w.length,C]),k=(0,f.useCallback)(()=>{C((S+1)%w.length),D(1)},[S,w.length,C]),A=()=>{D(e=>e===1?2:1)};(0,f.useEffect)(()=>{if(!b)return;let e=e=>{e.key===`ArrowLeft`&&O(),e.key===`ArrowRight`&&k(),e.key===`Escape`&&x(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,O,k,x]);let j=w[S];return j?(0,m.jsx)(r.OverlayBase,{...y,open:b,onOpenChange:x,closeOnOverlayClick:v,overlayClassName:d.default.overlay,className:(0,p.default)(`wim-lightbox`,d.default.contentRoot,e),"aria-label":y[`aria-labelledby`]?void 0:y[`aria-label`]??(j.title||j.alt||T(`lightbox.dialog`)),transitionProps:{preset:`fade`,enter:d.default.contentEnter,enterFrom:d.default.contentEnterFrom,enterTo:d.default.contentEnterTo},children:(0,m.jsxs)(`div`,{className:d.default.container,children:[(0,m.jsxs)(`div`,{className:d.default.header,children:[_&&w.length>1&&(0,m.jsx)(`div`,{className:d.default.counter,children:T(`lightbox.counter`,{current:S+1,total:w.length})}),(0,m.jsxs)(`div`,{className:d.default.controls,children:[(0,m.jsx)(`button`,{className:d.default.iconButton,onClick:A,"aria-label":T(E>1?`lightbox.zoom_out`:`lightbox.zoom_in`),children:E>1?(0,m.jsx)(u.Icon,{component:c.default}):(0,m.jsx)(u.Icon,{component:l.default})}),t&&(0,m.jsx)(`button`,{className:d.default.iconButton,onClick:()=>x(!1),"aria-label":T(`lightbox.close`),children:(0,m.jsx)(u.Icon,{component:s.default})})]})]}),(0,m.jsxs)(`div`,{className:d.default.viewport,children:[h&&w.length>1&&(0,m.jsx)(`button`,{className:(0,p.default)(d.default.navButton,d.default.prev),onClick:O,"aria-label":T(`lightbox.previous`),children:(0,m.jsx)(u.Icon,{component:a.default})}),(0,m.jsx)(`div`,{className:d.default.mediaWrapper,style:{transform:`scale(${E})`},children:(0,m.jsx)(`img`,{src:j.src,alt:j.alt||``,className:d.default.image})}),h&&w.length>1&&(0,m.jsx)(`button`,{className:(0,p.default)(d.default.navButton,d.default.next),onClick:k,"aria-label":T(`lightbox.next`),children:(0,m.jsx)(u.Icon,{component:o.default})})]}),(j.title||j.caption)&&(0,m.jsxs)(`div`,{className:d.default.footer,children:[j.title&&(0,m.jsx)(`h3`,{className:d.default.title,children:j.title}),j.caption&&(0,m.jsx)(`p`,{className:d.default.caption,children:j.caption})]})]})}):null},b=({items:e,children:t})=>{let{setItems:n}=g();return(0,f.useEffect)(()=>{n(e)},[e,n]),(0,m.jsx)(`div`,{className:d.default.gallery,children:t})},x=_;x.Trigger=v,x.Content=y,x.Gallery=b,x.displayName=`Lightbox`,v.displayName=`Lightbox.Trigger`,y.displayName=`Lightbox.Content`,b.displayName=`Lightbox.Gallery`,exports.Lightbox=_,exports.LightboxContent=y,exports.LightboxGallery=b,exports.LightboxRoot=x,exports.default=x,exports.LightboxTrigger=v,exports.useLightbox=g;
|