wimui 0.63.0 → 0.63.2
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/OverlayBase.cjs +1 -1
- package/dist/components/_internal/OverlayBase.js +31 -30
- package/dist/components/_internal/composeEventHandlers.cjs +2 -0
- package/dist/components/_internal/composeEventHandlers.d.ts +25 -0
- package/dist/components/_internal/composeEventHandlers.js +8 -0
- package/dist/components/_internal/observeMove.cjs +1 -1
- package/dist/components/_internal/observeMove.js +3 -1
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.js +83 -82
- package/dist/components/data-display/Accordion/Accordion.cjs +1 -1
- package/dist/components/data-display/Accordion/Accordion.js +79 -78
- 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/SortableList/SortableList.cjs +1 -1
- package/dist/components/data-display/SortableList/SortableList.js +54 -53
- package/dist/components/data-display/SwipeAction/SwipeAction.cjs +1 -1
- package/dist/components/data-display/SwipeAction/SwipeAction.js +77 -76
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +99 -98
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +53 -52
- package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.js +109 -108
- package/dist/components/form/Rating/Rating.cjs +1 -1
- package/dist/components/form/Rating/Rating.js +75 -74
- package/dist/components/form/Slider/Slider.cjs +1 -1
- package/dist/components/form/Slider/Slider.js +58 -57
- package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
- package/dist/components/form/SmartSearchInput/SmartSearchInput.js +65 -64
- package/dist/components/form/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/form/TimePicker/TimePicker.js +31 -30
- package/dist/components/layout/AppShell/AppShell.cjs +1 -1
- package/dist/components/layout/AppShell/AppShell.js +4 -1
- package/dist/components/layout/InteractiveArea/InteractiveArea.cjs +1 -1
- package/dist/components/layout/InteractiveArea/InteractiveArea.js +1 -1
- package/dist/components/layout/Navbar/Navbar.cjs +1 -1
- package/dist/components/layout/Navbar/Navbar.js +68 -67
- package/dist/components/layout/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/layout/Sidebar/Sidebar.js +4 -1
- package/dist/components/layout/Splitter/Splitter.cjs +1 -1
- package/dist/components/layout/Splitter/Splitter.js +47 -46
- package/dist/components/layout/Transition/Transition.cjs +1 -1
- package/dist/components/layout/Transition/Transition.js +25 -24
- package/dist/components/media/Audio/Audio.cjs +1 -1
- package/dist/components/media/Audio/Audio.js +39 -38
- package/dist/components/media/Image/Image.cjs +2 -2
- package/dist/components/media/Image/Image.js +96 -95
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +75 -74
- package/dist/components/media/Video/Video.cjs +1 -1
- package/dist/components/media/Video/Video.js +114 -113
- package/dist/components/navigation/Anchor/Anchor.cjs +1 -1
- package/dist/components/navigation/Anchor/Anchor.js +77 -72
- package/dist/components/navigation/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/navigation/SpeedDial/SpeedDial.js +47 -46
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +87 -86
- package/dist/components/overlay/Popover/Popover.cjs +1 -1
- package/dist/components/overlay/Popover/Popover.js +1 -1
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +4 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "
|
|
3
|
-
import
|
|
4
|
-
import o from "
|
|
5
|
-
import
|
|
2
|
+
import { observeMove as e } from "../../_internal/observeMove.js";
|
|
3
|
+
import t from "./anchor.module.js";
|
|
4
|
+
import { useCallback as n, useEffect as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import s from "classnames";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/navigation/Anchor/Anchor.tsx
|
|
7
|
-
var
|
|
8
|
-
let [
|
|
8
|
+
var u = ({ items: u = [], bounds: d = 5, offset: f = 0, direction: p = "vertical", className: m, style: h, "aria-label": g, "aria-labelledby": _ }) => {
|
|
9
|
+
let [v, y] = o(""), [b, x] = o({}), S = a(null), C = (e, t) => {
|
|
9
10
|
e.preventDefault();
|
|
10
11
|
let n = t.replace("#", ""), r = document.getElementById(n);
|
|
11
12
|
r && (window.scrollTo({
|
|
12
|
-
top: r.offsetTop -
|
|
13
|
+
top: r.offsetTop - f,
|
|
13
14
|
behavior: "smooth"
|
|
14
|
-
}),
|
|
15
|
+
}), y(t));
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
let
|
|
17
|
+
i(() => {
|
|
18
|
+
let t = () => {
|
|
18
19
|
let e = (t, n) => {
|
|
19
20
|
let r = [];
|
|
20
21
|
return t.forEach((t) => {
|
|
@@ -23,99 +24,103 @@ var l = ({ items: l = [], bounds: u = 5, offset: d = 0, direction: f = "vertical
|
|
|
23
24
|
parentHref: n
|
|
24
25
|
}), t.children && (r = r.concat(e(t.children, n || t.href)));
|
|
25
26
|
}), r;
|
|
26
|
-
}, t = e(
|
|
27
|
+
}, t = e(u), n = "", r = window.scrollY || document.documentElement.scrollTop, i = document.documentElement.scrollHeight, a = document.documentElement.clientHeight;
|
|
27
28
|
if (r > 0 && Math.ceil(r + a) >= i && t.length > 0) {
|
|
28
29
|
let e = t[t.length - 1];
|
|
29
|
-
n =
|
|
30
|
+
n = p === "horizontal" && e.parentHref ? e.parentHref : e.href;
|
|
30
31
|
} else for (let e of t) {
|
|
31
32
|
let t = e.href.replace("#", ""), r = document.getElementById(t);
|
|
32
33
|
if (r) {
|
|
33
|
-
if (r.getBoundingClientRect().top <=
|
|
34
|
+
if (r.getBoundingClientRect().top <= f + d) n = p === "horizontal" && e.parentHref ? e.parentHref : e.href;
|
|
34
35
|
else break;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
n && n !==
|
|
38
|
+
n && n !== v && y(n);
|
|
39
|
+
};
|
|
40
|
+
window.addEventListener("scroll", t), window.addEventListener("resize", t);
|
|
41
|
+
let n = (e) => e.flatMap((e) => [e.href, ...e.children ? n(e.children) : []]), r = n(u).map((e) => document.getElementById(e.replace("#", ""))).filter((e) => e !== null).map((n) => e(n, t));
|
|
42
|
+
return t(), () => {
|
|
43
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), r.forEach((e) => e());
|
|
38
44
|
};
|
|
39
|
-
return window.addEventListener("scroll", e), e(), () => window.removeEventListener("scroll", e);
|
|
40
45
|
}, [
|
|
41
|
-
l,
|
|
42
|
-
d,
|
|
43
46
|
u,
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
f,
|
|
48
|
+
d,
|
|
49
|
+
v,
|
|
50
|
+
p
|
|
46
51
|
]);
|
|
47
|
-
let
|
|
48
|
-
if (!
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
let n =
|
|
52
|
-
if (
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
top:
|
|
56
|
-
height:
|
|
52
|
+
let w = n(() => {
|
|
53
|
+
if (!v || !S.current) return;
|
|
54
|
+
let e = S.current.querySelector(`a[href="${v}"]`);
|
|
55
|
+
if (e) {
|
|
56
|
+
let n = S.current.getBoundingClientRect();
|
|
57
|
+
if (p === "vertical") {
|
|
58
|
+
let t = e.getBoundingClientRect();
|
|
59
|
+
x({
|
|
60
|
+
top: t.top - n.top,
|
|
61
|
+
height: t.height,
|
|
57
62
|
opacity: 1
|
|
58
63
|
});
|
|
59
64
|
} else {
|
|
60
|
-
let r =
|
|
65
|
+
let r = S.current.querySelector(`.${t.list}`);
|
|
61
66
|
if (r) {
|
|
62
|
-
let
|
|
63
|
-
|
|
67
|
+
let t = e.getBoundingClientRect(), i = r.getBoundingClientRect(), a = t.left - i.left + r.scrollLeft, o = a - i.width / 2 + t.width / 2, s = r.scrollWidth - i.width, c = Math.max(0, Math.min(o, s)), l = a - c + (i.left - n.left);
|
|
68
|
+
x({
|
|
64
69
|
left: l,
|
|
65
|
-
width:
|
|
70
|
+
width: t.width,
|
|
66
71
|
opacity: 1
|
|
67
72
|
}), r.scrollTo({
|
|
68
73
|
left: c,
|
|
69
74
|
behavior: "smooth"
|
|
70
75
|
});
|
|
71
76
|
} else {
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
left:
|
|
75
|
-
width:
|
|
77
|
+
let t = e.getBoundingClientRect();
|
|
78
|
+
x({
|
|
79
|
+
left: t.left - S.current.getBoundingClientRect().left,
|
|
80
|
+
width: t.width,
|
|
76
81
|
opacity: 1
|
|
77
82
|
});
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
|
-
} else
|
|
81
|
-
}, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
let e =
|
|
85
|
+
} else x({ opacity: 0 });
|
|
86
|
+
}, [v, p]);
|
|
87
|
+
i(() => {
|
|
88
|
+
w();
|
|
89
|
+
}, [w]), r(() => {
|
|
90
|
+
let e = S.current;
|
|
86
91
|
if (!e || typeof ResizeObserver > "u") return;
|
|
87
|
-
let t = new ResizeObserver(() =>
|
|
92
|
+
let t = new ResizeObserver(() => w());
|
|
88
93
|
return t.observe(e), e.querySelectorAll("a").forEach((e) => t.observe(e)), () => t.disconnect();
|
|
89
|
-
}, [
|
|
90
|
-
let
|
|
91
|
-
className:
|
|
92
|
-
children:
|
|
93
|
-
className:
|
|
94
|
-
children: [/* @__PURE__ */
|
|
95
|
-
href:
|
|
96
|
-
className:
|
|
97
|
-
"aria-current":
|
|
98
|
-
onClick: (
|
|
99
|
-
title: typeof
|
|
100
|
-
children:
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
94
|
+
}, [w, u]);
|
|
95
|
+
let T = (e) => /* @__PURE__ */ c("ul", {
|
|
96
|
+
className: s(t.list, t[p]),
|
|
97
|
+
children: e.map((e) => /* @__PURE__ */ l("li", {
|
|
98
|
+
className: s(t.item, v === e.href && t.active),
|
|
99
|
+
children: [/* @__PURE__ */ c("a", {
|
|
100
|
+
href: e.href,
|
|
101
|
+
className: t.link,
|
|
102
|
+
"aria-current": v === e.href ? "location" : void 0,
|
|
103
|
+
onClick: (t) => C(t, e.href),
|
|
104
|
+
title: typeof e.title == "string" ? e.title : void 0,
|
|
105
|
+
children: e.title
|
|
106
|
+
}), e.children && p === "vertical" && T(e.children)]
|
|
107
|
+
}, e.key))
|
|
103
108
|
});
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
-
className:
|
|
106
|
-
style:
|
|
107
|
-
ref:
|
|
108
|
-
role:
|
|
109
|
-
"aria-label":
|
|
110
|
-
"aria-labelledby":
|
|
111
|
-
children: [/* @__PURE__ */
|
|
112
|
-
className:
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
className:
|
|
115
|
-
style:
|
|
109
|
+
return /* @__PURE__ */ l("div", {
|
|
110
|
+
className: s("wim-anchor", t.root, t[p], m),
|
|
111
|
+
style: h,
|
|
112
|
+
ref: S,
|
|
113
|
+
role: g || _ ? "navigation" : void 0,
|
|
114
|
+
"aria-label": _ ? void 0 : g,
|
|
115
|
+
"aria-labelledby": _,
|
|
116
|
+
children: [/* @__PURE__ */ c("div", {
|
|
117
|
+
className: t.ink,
|
|
118
|
+
children: /* @__PURE__ */ c("span", {
|
|
119
|
+
className: t.inkBall,
|
|
120
|
+
style: b
|
|
116
121
|
})
|
|
117
|
-
}),
|
|
122
|
+
}), T(u)]
|
|
118
123
|
});
|
|
119
124
|
};
|
|
120
125
|
//#endregion
|
|
121
|
-
export {
|
|
126
|
+
export { u as Anchor, u as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../form/FloatButton/FloatButton.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../_internal/composeEventHandlers.cjs"),i=require("../../form/FloatButton/FloatButton.cjs"),a=require("./speed-dial.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=o.default.forwardRef(({actions:e,icon:l=`PlusIcon`,activeIcon:u=`CloseIcon`,direction:d=`up`,trigger:f=`hover`,open:p,onOpenChange:m,className:h,"aria-label":g,..._},v)=>{let{t:y}=t.useWimTranslation(n.commonNs),[b,x]=(0,o.useState)(!1),S=p??b,C=(0,o.useRef)(null),w=(0,o.useRef)(!1),T=e=>{x(e),m?.(e)},E=()=>{f===`hover`&&T(!0)},D=()=>{f===`hover`&&T(!1)},O=()=>{f===`click`&&T(!S)},k=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),w.current=!S,T(!S))},A=e=>{e.key===`Escape`&&S&&(e.preventDefault(),w.current=!1,T(!1),e.currentTarget.querySelector(`[aria-haspopup]`)?.focus())},j=e=>{w.current&&(e.currentTarget.contains(e.relatedTarget)||(w.current=!1,T(!1)))},M=()=>{(f===`click`||w.current)&&(w.current=!1,C.current?.contains(document.activeElement)&&C.current.parentElement?.querySelector(`[aria-haspopup]`)?.focus(),T(!1))};return(0,o.useEffect)(()=>{S&&w.current&&C.current?.querySelector(`button`)?.focus()},[S]),(0,c.jsxs)(`div`,{ref:v,className:(0,s.default)(`wim-speed-dial`,a.default.root,a.default[d],S&&a.default.open,h),..._,onMouseEnter:r.composeEventHandlers(_.onMouseEnter,E),onMouseLeave:r.composeEventHandlers(_.onMouseLeave,D),onKeyDown:r.composeEventHandlers(_.onKeyDown,A),onBlur:r.composeEventHandlers(_.onBlur,j),children:[(0,c.jsx)(`div`,{ref:C,className:a.default.actions,inert:!S,children:e.map((e,t)=>(0,c.jsx)(`div`,{className:a.default.actionWrapper,style:{transitionDelay:S?`${t*50}ms`:`0ms`},children:(0,c.jsx)(i.FloatButton,{iconName:e.icon,label:e.label,size:`sm`,intent:e.intent,className:e.className,onClick:()=>{e.onClick?.(),M()},position:`inline`})},t))}),(0,c.jsx)(i.FloatButton,{iconName:S?u:l,onClick:O,className:a.default.trigger,position:`inline`,"aria-expanded":S,"aria-haspopup":`true`,"aria-label":g??y(S?`a11y.close_menu`:`a11y.open_menu`),onKeyDown:k})]})});l.displayName=`SpeedDial`,exports.SpeedDial=l;
|
|
@@ -1,71 +1,72 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
-
import {
|
|
5
|
-
import r from "
|
|
6
|
-
import i
|
|
7
|
-
import c from "
|
|
8
|
-
import
|
|
4
|
+
import { composeEventHandlers as n } from "../../_internal/composeEventHandlers.js";
|
|
5
|
+
import { FloatButton as r } from "../../form/FloatButton/FloatButton.js";
|
|
6
|
+
import i from "./speed-dial.module.js";
|
|
7
|
+
import a, { useEffect as o, useRef as s, useState as c } from "react";
|
|
8
|
+
import l from "classnames";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/navigation/SpeedDial/SpeedDial.tsx
|
|
10
|
-
var
|
|
11
|
-
let { t:
|
|
12
|
-
|
|
13
|
-
}, O = () => {
|
|
14
|
-
m === "hover" && D(!0);
|
|
11
|
+
var f = a.forwardRef(({ actions: a, icon: f = "PlusIcon", activeIcon: p = "CloseIcon", direction: m = "up", trigger: h = "hover", open: g, onOpenChange: _, className: v, "aria-label": y, ...b }, x) => {
|
|
12
|
+
let { t: S } = e(t), [C, w] = c(!1), T = g ?? C, E = s(null), D = s(!1), O = (e) => {
|
|
13
|
+
w(e), _?.(e);
|
|
15
14
|
}, k = () => {
|
|
16
|
-
|
|
15
|
+
h === "hover" && O(!0);
|
|
17
16
|
}, A = () => {
|
|
18
|
-
|
|
19
|
-
}, j = (
|
|
20
|
-
|
|
17
|
+
h === "hover" && O(!1);
|
|
18
|
+
}, j = () => {
|
|
19
|
+
h === "click" && O(!T);
|
|
21
20
|
}, M = (e) => {
|
|
22
|
-
e.key === "
|
|
21
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), D.current = !T, O(!T));
|
|
23
22
|
}, N = (e) => {
|
|
24
|
-
|
|
25
|
-
}, P = () => {
|
|
26
|
-
|
|
23
|
+
e.key === "Escape" && T && (e.preventDefault(), D.current = !1, O(!1), e.currentTarget.querySelector("[aria-haspopup]")?.focus());
|
|
24
|
+
}, P = (e) => {
|
|
25
|
+
D.current && (e.currentTarget.contains(e.relatedTarget) || (D.current = !1, O(!1)));
|
|
26
|
+
}, F = () => {
|
|
27
|
+
(h === "click" || D.current) && (D.current = !1, E.current?.contains(document.activeElement) && E.current.parentElement?.querySelector("[aria-haspopup]")?.focus(), O(!1));
|
|
27
28
|
};
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
ref:
|
|
32
|
-
className:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children: [/* @__PURE__ */
|
|
39
|
-
ref:
|
|
40
|
-
className:
|
|
41
|
-
inert: !
|
|
42
|
-
children:
|
|
43
|
-
className:
|
|
44
|
-
style: { transitionDelay:
|
|
45
|
-
children: /* @__PURE__ */
|
|
29
|
+
return o(() => {
|
|
30
|
+
T && D.current && E.current?.querySelector("button")?.focus();
|
|
31
|
+
}, [T]), /* @__PURE__ */ d("div", {
|
|
32
|
+
ref: x,
|
|
33
|
+
className: l("wim-speed-dial", i.root, i[m], T && i.open, v),
|
|
34
|
+
...b,
|
|
35
|
+
onMouseEnter: n(b.onMouseEnter, k),
|
|
36
|
+
onMouseLeave: n(b.onMouseLeave, A),
|
|
37
|
+
onKeyDown: n(b.onKeyDown, N),
|
|
38
|
+
onBlur: n(b.onBlur, P),
|
|
39
|
+
children: [/* @__PURE__ */ u("div", {
|
|
40
|
+
ref: E,
|
|
41
|
+
className: i.actions,
|
|
42
|
+
inert: !T,
|
|
43
|
+
children: a.map((e, t) => /* @__PURE__ */ u("div", {
|
|
44
|
+
className: i.actionWrapper,
|
|
45
|
+
style: { transitionDelay: T ? `${t * 50}ms` : "0ms" },
|
|
46
|
+
children: /* @__PURE__ */ u(r, {
|
|
46
47
|
iconName: e.icon,
|
|
47
48
|
label: e.label,
|
|
48
49
|
size: "sm",
|
|
49
50
|
intent: e.intent,
|
|
50
51
|
className: e.className,
|
|
51
52
|
onClick: () => {
|
|
52
|
-
e.onClick?.(),
|
|
53
|
+
e.onClick?.(), F();
|
|
53
54
|
},
|
|
54
55
|
position: "inline"
|
|
55
56
|
})
|
|
56
57
|
}, t))
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
-
iconName:
|
|
59
|
-
onClick:
|
|
60
|
-
className:
|
|
58
|
+
}), /* @__PURE__ */ u(r, {
|
|
59
|
+
iconName: T ? p : f,
|
|
60
|
+
onClick: j,
|
|
61
|
+
className: i.trigger,
|
|
61
62
|
position: "inline",
|
|
62
|
-
"aria-expanded":
|
|
63
|
+
"aria-expanded": T,
|
|
63
64
|
"aria-haspopup": "true",
|
|
64
|
-
"aria-label":
|
|
65
|
-
onKeyDown:
|
|
65
|
+
"aria-label": y ?? S(T ? "a11y.close_menu" : "a11y.open_menu"),
|
|
66
|
+
onKeyDown: M
|
|
66
67
|
})]
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
+
f.displayName = "SpeedDial";
|
|
70
71
|
//#endregion
|
|
71
|
-
export {
|
|
72
|
+
export { f as SpeedDial };
|
|
@@ -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("../../../hooks/useMergedRef.cjs"),r=require("../../_internal/
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("../../_internal/composeEventHandlers.cjs"),i=require("../../_internal/useIndicator.cjs"),a=require("./tabs.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=(0,o.createContext)(null),u=()=>{let e=(0,o.useContext)(l);if(!e)throw Error(`Tabs components must be used within a Tabs`);return e},d=o.default.forwardRef(({asChild:e=!1,defaultValue:n,value:r,onChange:i,orientation:u=`horizontal`,className:d,children:f,...p},m)=>{let[h,g]=(0,o.useState)(n),[_,v]=(0,o.useState)([]),[y,b]=(0,o.useState)([]),x=(0,o.useId)(),S=r!==void 0,C=S?r:h,w=(0,o.useCallback)(e=>{S||g(e),i?.(e)},[S,i]),T=(0,o.useCallback)(e=>{v(t=>t.includes(e)?t:[...t,e])},[]),E=(0,o.useCallback)(e=>{v(t=>t.filter(t=>t!==e))},[]),D=(0,o.useCallback)(e=>{b(t=>t.includes(e)?t:[...t,e])},[]),O=(0,o.useCallback)(e=>{b(t=>t.filter(t=>t!==e))},[]),k=e?t.Root:`div`;return(0,c.jsx)(l.Provider,{value:{value:C,onValueChange:w,orientation:u,id:x,items:_,registerItem:T,unregisterItem:E,panels:y,registerPanel:D,unregisterPanel:O},children:(0,c.jsx)(`div`,{className:a.default.container,children:(0,c.jsx)(k,{ref:m,className:(0,s.default)(`wim-tabs`,a.default.root,a.default[u],d),...p,children:(0,c.jsx)(t.Slottable,{children:f})})})})}),f=o.default.forwardRef(({asChild:e=!1,className:l,children:d,...f},p)=>{let{orientation:m,value:h,items:g,onValueChange:_}=u(),[v,y]=o.default.useState(!1),[b,x]=o.default.useState(0),[S,C]=o.default.useState(0),{containerRef:w,sliderStyle:T,isReady:E}=i.useIndicator({activeSelector:`.${a.default.trigger}.${a.default.active}`,orientation:m,dependence:h}),D=n.useMergedRef(w,p),O=e=>{m!==`vertical`&&(y(!0),x(e.pageX-(w.current?.offsetLeft||0)),C(w.current?.scrollLeft||0))},k=()=>{y(!1)},A=e=>{if(!v||m===`vertical`)return;e.preventDefault();let t=(e.pageX-(w.current?.offsetLeft||0)-b)*1.5;w.current&&(w.current.scrollLeft=S-t)},j=e=>{let t=h?g.indexOf(h):-1,n=-1;if(m===`horizontal`?(e.key===`ArrowRight`&&(n=(t+1)%g.length),e.key===`ArrowLeft`&&(n=(t-1+g.length)%g.length)):(e.key===`ArrowDown`&&(n=(t+1)%g.length),e.key===`ArrowUp`&&(n=(t-1+g.length)%g.length)),e.key===`Home`&&(n=0),e.key===`End`&&(n=g.length-1),n!==-1){e.preventDefault();let t=g[n];t&&(_(t),(w.current?.querySelector(`[data-value="${t}"]`))?.focus())}};return(0,c.jsxs)(e?t.Root:`div`,{ref:D,role:`tablist`,"aria-orientation":m,tabIndex:0,className:(0,s.default)(a.default.list,v&&a.default.dragging,E&&a.default.ready,l),...f,onMouseDown:e=>r.composeEventHandlers(f.onMouseDown,O)(e),onMouseUp:r.composeEventHandlers(f.onMouseUp,k),onMouseLeave:r.composeEventHandlers(f.onMouseLeave,k),onMouseMove:e=>r.composeEventHandlers(f.onMouseMove,A)(e),onKeyDown:e=>r.composeEventHandlers(f.onKeyDown,j)(e),children:[(0,c.jsx)(`div`,{className:a.default.slider,style:T,"aria-hidden":`true`}),(0,c.jsx)(t.Slottable,{children:d})]})}),p=o.default.forwardRef(({asChild:e=!1,value:n,disabled:i=!1,className:l,children:d,...f},p)=>{let{value:m,onValueChange:h,id:g,registerItem:_,unregisterItem:v,panels:y}=u(),b=m===n;return o.default.useEffect(()=>(_(n),()=>v(n)),[n,_,v]),(0,c.jsx)(e?t.Root:`button`,{ref:p,type:e?void 0:`button`,role:`tab`,"aria-selected":b,"aria-controls":y.includes(n)?`wim-tabs-${g}-panel-${n}`:void 0,id:`wim-tabs-${g}-tab-${n}`,"data-value":n,disabled:i,tabIndex:b?0:-1,className:(0,s.default)(a.default.trigger,b&&a.default.active,l),...f,onClick:r.composeEventHandlers(f.onClick,()=>h(n)),children:(0,c.jsx)(t.Slottable,{children:d})})}),m=o.default.forwardRef(({asChild:e=!1,value:n,className:r,children:i,...l},d)=>{let{value:f,id:p,registerPanel:m,unregisterPanel:h}=u(),g=f===n;return o.default.useEffect(()=>(m(n),()=>h(n)),[n,m,h]),g?(0,c.jsx)(e?t.Root:`div`,{ref:d,role:`tabpanel`,id:`wim-tabs-${p}-panel-${n}`,"aria-labelledby":`wim-tabs-${p}-tab-${n}`,tabIndex:0,className:(0,s.default)(a.default.content,r),...l,children:(0,c.jsx)(t.Slottable,{children:i})}):null});d.displayName=`Tabs`,f.displayName=`Tabs.List`,p.displayName=`Tabs.Trigger`,m.displayName=`Tabs.Content`;var h=d;h.List=f,h.Trigger=p,h.Content=m,exports.Tabs=h,exports.default=h,exports.TabsContent=m,exports.TabsList=f,exports.TabsTrigger=p;
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useMergedRef as n } from "../../../hooks/useMergedRef.js";
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
import a
|
|
7
|
-
import d from "
|
|
8
|
-
import
|
|
4
|
+
import { composeEventHandlers as r } from "../../_internal/composeEventHandlers.js";
|
|
5
|
+
import { useIndicator as i } from "../../_internal/useIndicator.js";
|
|
6
|
+
import a from "./tabs.module.js";
|
|
7
|
+
import o, { createContext as s, useCallback as c, useContext as l, useId as u, useState as d } from "react";
|
|
8
|
+
import f from "classnames";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/navigation/Tabs/Tabs.tsx
|
|
10
|
-
var
|
|
11
|
-
let e =
|
|
11
|
+
var h = s(null), g = () => {
|
|
12
|
+
let e = l(h);
|
|
12
13
|
if (!e) throw Error("Tabs components must be used within a Tabs");
|
|
13
14
|
return e;
|
|
14
|
-
},
|
|
15
|
-
let [v, y] =
|
|
15
|
+
}, _ = o.forwardRef(({ asChild: n = !1, defaultValue: r, value: i, onChange: o, orientation: s = "horizontal", className: l, children: m, ...g }, _) => {
|
|
16
|
+
let [v, y] = d(r), [b, x] = d([]), [S, C] = d([]), w = u(), T = i !== void 0, E = T ? i : v, D = c((e) => {
|
|
16
17
|
T || y(e), o?.(e);
|
|
17
|
-
}, [T, o]), O =
|
|
18
|
+
}, [T, o]), O = c((e) => {
|
|
18
19
|
x((t) => t.includes(e) ? t : [...t, e]);
|
|
19
|
-
}, []), k =
|
|
20
|
+
}, []), k = c((e) => {
|
|
20
21
|
x((t) => t.filter((t) => t !== e));
|
|
21
|
-
}, []), A =
|
|
22
|
+
}, []), A = c((e) => {
|
|
22
23
|
C((t) => t.includes(e) ? t : [...t, e]);
|
|
23
|
-
}, []), j =
|
|
24
|
+
}, []), j = c((e) => {
|
|
24
25
|
C((t) => t.filter((t) => t !== e));
|
|
25
26
|
}, []), M = n ? e : "div";
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ p(h.Provider, {
|
|
27
28
|
value: {
|
|
28
29
|
value: E,
|
|
29
30
|
onValueChange: D,
|
|
30
|
-
orientation:
|
|
31
|
+
orientation: s,
|
|
31
32
|
id: w,
|
|
32
33
|
items: b,
|
|
33
34
|
registerItem: O,
|
|
@@ -36,96 +37,96 @@ var m = o(null), h = () => {
|
|
|
36
37
|
registerPanel: A,
|
|
37
38
|
unregisterPanel: j
|
|
38
39
|
},
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
className:
|
|
41
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ p("div", {
|
|
41
|
+
className: a.container,
|
|
42
|
+
children: /* @__PURE__ */ p(M, {
|
|
42
43
|
ref: _,
|
|
43
|
-
className:
|
|
44
|
+
className: f("wim-tabs", a.root, a[s], l),
|
|
44
45
|
...g,
|
|
45
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ p(t, { children: m })
|
|
46
47
|
})
|
|
47
48
|
})
|
|
48
49
|
});
|
|
49
|
-
}),
|
|
50
|
-
let { orientation:
|
|
51
|
-
activeSelector: `.${
|
|
52
|
-
orientation:
|
|
53
|
-
dependence:
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
50
|
+
}), v = o.forwardRef(({ asChild: s = !1, className: c, children: l, ...u }, d) => {
|
|
51
|
+
let { orientation: h, value: _, items: v, onValueChange: y } = g(), [b, x] = o.useState(!1), [S, C] = o.useState(0), [w, T] = o.useState(0), { containerRef: E, sliderStyle: D, isReady: O } = i({
|
|
52
|
+
activeSelector: `.${a.trigger}.${a.active}`,
|
|
53
|
+
orientation: h,
|
|
54
|
+
dependence: _
|
|
55
|
+
}), k = n(E, d), A = (e) => {
|
|
56
|
+
h !== "vertical" && (x(!0), C(e.pageX - (E.current?.offsetLeft || 0)), T(E.current?.scrollLeft || 0));
|
|
57
|
+
}, j = () => {
|
|
58
|
+
x(!1);
|
|
59
|
+
}, M = (e) => {
|
|
60
|
+
if (!b || h === "vertical") return;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
let t = (e.pageX - (E.current?.offsetLeft || 0) - S) * 1.5;
|
|
63
|
+
E.current && (E.current.scrollLeft = w - t);
|
|
64
|
+
}, N = (e) => {
|
|
65
|
+
let t = _ ? v.indexOf(_) : -1, n = -1;
|
|
66
|
+
if (h === "horizontal" ? (e.key === "ArrowRight" && (n = (t + 1) % v.length), e.key === "ArrowLeft" && (n = (t - 1 + v.length) % v.length)) : (e.key === "ArrowDown" && (n = (t + 1) % v.length), e.key === "ArrowUp" && (n = (t - 1 + v.length) % v.length)), e.key === "Home" && (n = 0), e.key === "End" && (n = v.length - 1), n !== -1) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
let t = v[n];
|
|
69
|
+
t && (y(t), (E.current?.querySelector(`[data-value="${t}"]`))?.focus());
|
|
70
|
+
}
|
|
58
71
|
};
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
ref:
|
|
72
|
+
return /* @__PURE__ */ m(s ? e : "div", {
|
|
73
|
+
ref: k,
|
|
61
74
|
role: "tablist",
|
|
62
|
-
"aria-orientation":
|
|
75
|
+
"aria-orientation": h,
|
|
63
76
|
tabIndex: 0,
|
|
64
|
-
className:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onKeyDown: (e) => {
|
|
75
|
-
let t = g ? _.indexOf(g) : -1, n = -1;
|
|
76
|
-
if (m === "horizontal" ? (e.key === "ArrowRight" && (n = (t + 1) % _.length), e.key === "ArrowLeft" && (n = (t - 1 + _.length) % _.length)) : (e.key === "ArrowDown" && (n = (t + 1) % _.length), e.key === "ArrowUp" && (n = (t - 1 + _.length) % _.length)), e.key === "Home" && (n = 0), e.key === "End" && (n = _.length - 1), n !== -1) {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
let t = _[n];
|
|
79
|
-
t && (v(t), (T.current?.querySelector(`[data-value="${t}"]`))?.focus());
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
...l,
|
|
83
|
-
children: [/* @__PURE__ */ f("div", {
|
|
84
|
-
className: i.slider,
|
|
85
|
-
style: E,
|
|
77
|
+
className: f(a.list, b && a.dragging, O && a.ready, c),
|
|
78
|
+
...u,
|
|
79
|
+
onMouseDown: (e) => r(u.onMouseDown, A)(e),
|
|
80
|
+
onMouseUp: r(u.onMouseUp, j),
|
|
81
|
+
onMouseLeave: r(u.onMouseLeave, j),
|
|
82
|
+
onMouseMove: (e) => r(u.onMouseMove, M)(e),
|
|
83
|
+
onKeyDown: (e) => r(u.onKeyDown, N)(e),
|
|
84
|
+
children: [/* @__PURE__ */ p("div", {
|
|
85
|
+
className: a.slider,
|
|
86
|
+
style: D,
|
|
86
87
|
"aria-hidden": "true"
|
|
87
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ p(t, { children: l })]
|
|
88
89
|
});
|
|
89
|
-
}),
|
|
90
|
-
let { value:
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
]), /* @__PURE__ */
|
|
96
|
-
ref:
|
|
90
|
+
}), y = o.forwardRef(({ asChild: n = !1, value: i, disabled: s = !1, className: c, children: l, ...u }, d) => {
|
|
91
|
+
let { value: m, onValueChange: h, id: _, registerItem: v, unregisterItem: y, panels: b } = g(), x = m === i;
|
|
92
|
+
return o.useEffect(() => (v(i), () => y(i)), [
|
|
93
|
+
i,
|
|
94
|
+
v,
|
|
95
|
+
y
|
|
96
|
+
]), /* @__PURE__ */ p(n ? e : "button", {
|
|
97
|
+
ref: d,
|
|
97
98
|
type: n ? void 0 : "button",
|
|
98
99
|
role: "tab",
|
|
99
|
-
"aria-selected":
|
|
100
|
-
"aria-controls":
|
|
101
|
-
id: `wim-tabs-${
|
|
102
|
-
"data-value":
|
|
103
|
-
disabled:
|
|
104
|
-
tabIndex:
|
|
105
|
-
className:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
children: /* @__PURE__ */
|
|
100
|
+
"aria-selected": x,
|
|
101
|
+
"aria-controls": b.includes(i) ? `wim-tabs-${_}-panel-${i}` : void 0,
|
|
102
|
+
id: `wim-tabs-${_}-tab-${i}`,
|
|
103
|
+
"data-value": i,
|
|
104
|
+
disabled: s,
|
|
105
|
+
tabIndex: x ? 0 : -1,
|
|
106
|
+
className: f(a.trigger, x && a.active, c),
|
|
107
|
+
...u,
|
|
108
|
+
onClick: r(u.onClick, () => h(i)),
|
|
109
|
+
children: /* @__PURE__ */ p(t, { children: l })
|
|
109
110
|
});
|
|
110
|
-
}),
|
|
111
|
-
let { value: u, id:
|
|
112
|
-
return
|
|
111
|
+
}), b = o.forwardRef(({ asChild: n = !1, value: r, className: i, children: s, ...c }, l) => {
|
|
112
|
+
let { value: u, id: d, registerPanel: m, unregisterPanel: h } = g(), _ = u === r;
|
|
113
|
+
return o.useEffect(() => (m(r), () => h(r)), [
|
|
113
114
|
r,
|
|
114
115
|
m,
|
|
115
|
-
|
|
116
|
-
]), _ ? /* @__PURE__ */
|
|
116
|
+
h
|
|
117
|
+
]), _ ? /* @__PURE__ */ p(n ? e : "div", {
|
|
117
118
|
ref: l,
|
|
118
119
|
role: "tabpanel",
|
|
119
|
-
id: `wim-tabs-${
|
|
120
|
-
"aria-labelledby": `wim-tabs-${
|
|
120
|
+
id: `wim-tabs-${d}-panel-${r}`,
|
|
121
|
+
"aria-labelledby": `wim-tabs-${d}-tab-${r}`,
|
|
121
122
|
tabIndex: 0,
|
|
122
|
-
className:
|
|
123
|
+
className: f(a.content, i),
|
|
123
124
|
...c,
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ p(t, { children: s })
|
|
125
126
|
}) : null;
|
|
126
127
|
});
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
|
|
128
|
+
_.displayName = "Tabs", v.displayName = "Tabs.List", y.displayName = "Tabs.Trigger", b.displayName = "Tabs.Content";
|
|
129
|
+
var x = _;
|
|
130
|
+
x.List = v, x.Trigger = y, x.Content = b;
|
|
130
131
|
//#endregion
|
|
131
|
-
export {
|
|
132
|
+
export { x as Tabs, x as default, b as TabsContent, v as TabsList, y as TabsTrigger };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../layout/Transition/Transition.cjs"),i=require("../../../icon/close.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("./popover.module.cjs"),s=require("../../_internal/useFloatingElement.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime"),d=require("@floating-ui/react");var f=c.default.createContext(null),p=({children:e,className:t,defaultOpen:n=!1,open:r,onOpenChange:i,placement:a=`bottom-start`,variant:d=`default`})=>{let{isOpen:p,setOpen:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y}=s.useFloatingElement({placement:a,open:r,defaultOpen:n,onOpenChange:i,trigger:`click`}),b=()=>m(!1),x=c.default.useId(),[S,C]=c.default.useState(`wim-popover-trigger-${x}`);return(0,u.jsx)(f.Provider,{value:{open:p,onOpenChange:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y,close:b,variant:d,triggerId:S,setTriggerId:C},children:(0,u.jsx)(`div`,{className:(0,l.default)(`wim-popover`,o.default.root,t),children:e})})},m=c.default.forwardRef(({children:e,className:t,asChild:n,...r},i)=>{let a=c.default.useContext(f);if(a==null)throw Error(`Popover components must be wrapped in <Popover />`);let s=e.ref,p=(0,d.useMergeRefs)([a.refs.setReference,i,s??null]),m=n&&c.default.isValidElement(e)?e.props.id:void 0,h=r.id??m??a.triggerId,{setTriggerId:g}=a;if(c.default.useLayoutEffect(()=>{g(h)},[h,g]),n&&c.default.isValidElement(e)){let n=e.props,i=a.getReferenceProps({ref:p,...r,...n,id:h,className:(0,l.default)(t,n.className)});return c.default.cloneElement(e,{...i,"data-state":a.open?`open`:`closed`})}return(0,u.jsx)(`button`,{ref:p,type:`button`,className:(0,l.default)(o.default.trigger,t),"data-state":a.open?`open`:`closed`,...a.getReferenceProps({...r,id:h}),children:e})});m.displayName=`PopoverTrigger`;var h=c.default.forwardRef(({children:e,className:t,align:n,side:i,style:a,modal:s=!1,...p},m)=>{let h=c.default.useContext(f);if(h==null)throw Error(`Popover components must be wrapped in <Popover />`);let{open:g,refs:_,floatingStyles:v,getFloatingProps:y,context:b,triggerId:x}=h,S=p[`aria-label`]!=null||p[`aria-labelledby`]!=null?p[`aria-labelledby`]:x,C=(0,d.useMergeRefs)([_.setFloating,m]);return(0,u.jsx)(d.FloatingPortal,{children:(0,u.jsx)(r.Transition,{show:g,preset:`fade`,children:(0,u.jsx)(d.FloatingFocusManager,{context:b,modal:s,children:(0,u.jsx)(`div`,{ref:C,style:{...v,...a},className:(0,l.default)(o.default.content,o.default[h.variant],t),role:`dialog`,...y(p),"aria-labelledby":S,children:e})})})})});h.displayName=`PopoverContent`;var g=({children:e,className:r,asChild:s,ariaLabel:d,...p})=>{let{t:m}=t.useWimTranslation(n.commonNs),h=d??m(`a11y.close`),g=c.default.useContext(f);if(!g)return null;let{close:_}=g,v=e=>{_(),p.onClick?.(e)};return s&&c.default.isValidElement(e)?c.default.cloneElement(e,{onClick:t=>{e.props.onClick?.(t),v(t)},className:(0,l.default)(r,e.props.className)}):(0,u.jsx)(`button`,{type:`button`,className:(0,l.default)(o.default.close,r),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../layout/Transition/Transition.cjs"),i=require("../../../icon/close.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("./popover.module.cjs"),s=require("../../_internal/useFloatingElement.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime"),d=require("@floating-ui/react");var f=c.default.createContext(null),p=({children:e,className:t,defaultOpen:n=!1,open:r,onOpenChange:i,placement:a=`bottom-start`,variant:d=`default`})=>{let{isOpen:p,setOpen:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y}=s.useFloatingElement({placement:a,open:r,defaultOpen:n,onOpenChange:i,trigger:`click`}),b=()=>m(!1),x=c.default.useId(),[S,C]=c.default.useState(`wim-popover-trigger-${x}`);return(0,u.jsx)(f.Provider,{value:{open:p,onOpenChange:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y,close:b,variant:d,triggerId:S,setTriggerId:C},children:(0,u.jsx)(`div`,{className:(0,l.default)(`wim-popover`,o.default.root,t),children:e})})},m=c.default.forwardRef(({children:e,className:t,asChild:n,...r},i)=>{let a=c.default.useContext(f);if(a==null)throw Error(`Popover components must be wrapped in <Popover />`);let s=e.ref,p=(0,d.useMergeRefs)([a.refs.setReference,i,s??null]),m=n&&c.default.isValidElement(e)?e.props.id:void 0,h=r.id??m??a.triggerId,{setTriggerId:g}=a;if(c.default.useLayoutEffect(()=>{g(h)},[h,g]),n&&c.default.isValidElement(e)){let n=e.props,i=a.getReferenceProps({ref:p,...r,...n,id:h,className:(0,l.default)(t,n.className)});return c.default.cloneElement(e,{...i,"data-state":a.open?`open`:`closed`})}return(0,u.jsx)(`button`,{ref:p,type:`button`,className:(0,l.default)(o.default.trigger,t),"data-state":a.open?`open`:`closed`,...a.getReferenceProps({...r,id:h}),children:e})});m.displayName=`PopoverTrigger`;var h=c.default.forwardRef(({children:e,className:t,align:n,side:i,style:a,modal:s=!1,...p},m)=>{let h=c.default.useContext(f);if(h==null)throw Error(`Popover components must be wrapped in <Popover />`);let{open:g,refs:_,floatingStyles:v,getFloatingProps:y,context:b,triggerId:x}=h,S=p[`aria-label`]!=null||p[`aria-labelledby`]!=null?p[`aria-labelledby`]:x,C=(0,d.useMergeRefs)([_.setFloating,m]);return(0,u.jsx)(d.FloatingPortal,{children:(0,u.jsx)(r.Transition,{show:g,preset:`fade`,children:(0,u.jsx)(d.FloatingFocusManager,{context:b,modal:s,children:(0,u.jsx)(`div`,{ref:C,style:{...v,...a},className:(0,l.default)(o.default.content,o.default[h.variant],t),role:`dialog`,...y(p),"aria-labelledby":S,children:e})})})})});h.displayName=`PopoverContent`;var g=({children:e,className:r,asChild:s,ariaLabel:d,...p})=>{let{t:m}=t.useWimTranslation(n.commonNs),h=d??m(`a11y.close`),g=c.default.useContext(f);if(!g)return null;let{close:_}=g,v=e=>{_(),p.onClick?.(e)};return s&&c.default.isValidElement(e)?c.default.cloneElement(e,{onClick:t=>{e.props.onClick?.(t),v(t)},className:(0,l.default)(r,e.props.className)}):(0,u.jsx)(`button`,{type:`button`,className:(0,l.default)(o.default.close,r),"aria-label":h,...p,onClick:v,children:e||(0,u.jsx)(a.Icon,{component:i.default,size:`sm`})})};exports.Popover=p,exports.PopoverClose=g,exports.PopoverContent=h,exports.PopoverTrigger=m;
|
|
@@ -114,9 +114,9 @@ var _ = ({ children: n, className: o, asChild: u, ariaLabel: d, ...f }) => {
|
|
|
114
114
|
}) : /* @__PURE__ */ l("button", {
|
|
115
115
|
type: "button",
|
|
116
116
|
className: c(a.close, o),
|
|
117
|
-
onClick: v,
|
|
118
117
|
"aria-label": h,
|
|
119
118
|
...f,
|
|
119
|
+
onClick: v,
|
|
120
120
|
children: n || /* @__PURE__ */ l(i, {
|
|
121
121
|
component: r,
|
|
122
122
|
size: "sm"
|