wimui 0.62.2 → 0.63.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/observeMove.cjs +2 -0
- package/dist/components/_internal/observeMove.d.ts +16 -0
- package/dist/components/_internal/observeMove.js +44 -0
- package/dist/components/feedback/Tour/Tour.cjs +1 -1
- package/dist/components/feedback/Tour/Tour.js +91 -88
- package/dist/components/form/Button/Button.cjs +1 -1
- package/dist/components/form/Button/Button.d.ts +2 -2
- package/dist/components/form/Button/Button.js +14 -12
- package/dist/components/form/Textarea/Textarea.cjs +1 -1
- package/dist/components/form/Textarea/Textarea.js +4 -4
- package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
- package/dist/components/layout/Dashboard/Dashboard.js +3 -2
- package/dist/components/layout/Navbar/Navbar.cjs +1 -1
- package/dist/components/layout/Navbar/Navbar.js +1 -0
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +5 -4
- package/dist/components/navigation/Affix/Affix.cjs +1 -1
- package/dist/components/navigation/Affix/Affix.js +39 -36
- package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
- package/dist/components/navigation/Menubar/Menubar.js +67 -61
- package/dist/components/overlay/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/overlay/Dropdown/Dropdown.js +42 -36
- package/dist/llms-full.txt +3 -3
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e=(e,t)=>{if(typeof IntersectionObserver>`u`)return()=>{};let n=e.ownerDocument.documentElement,r=null,i,a=()=>{clearTimeout(i),r?.disconnect(),r=null},o=(s,c=1)=>{a();let{left:l,top:u,width:d,height:f}=e.getBoundingClientRect();if(s&&t(),!d||!f)return;let p=[-Math.floor(u),-Math.floor(n.clientWidth-(l+d)),-Math.floor(n.clientHeight-(u+f)),-Math.floor(l)].map(e=>`${e}px`).join(` `),m=!0;r=new IntersectionObserver(t=>{let n=t[0].intersectionRatio;if(typeof n!=`number`){a();return}let r=e.getBoundingClientRect();if(m&&(Math.abs(r.left-l)>=1||Math.abs(r.top-u)>=1)){o(!0);return}if(n!==c){if(!m){o(!0);return}n?o(!1,n):i=setTimeout(()=>o(!1,1e-7),1e3)}m=!1},{rootMargin:p,threshold:Math.max(0,Math.min(1,c))||1}),r.observe(e)};return o(!1),a};exports.observeMove=e;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 要素が「動いた」ことを拾う(T344)。
|
|
3
|
+
*
|
|
4
|
+
* 要素の位置を読んで、別の要素を `position: fixed` で置く部品(Affix・Tour)は、scroll と resize を
|
|
5
|
+
* 聞いて測り直す。だが、位置はスクロールしなくても変わる ── 上にある中身の高さが変わったとき
|
|
6
|
+
* (遅れて読み込まれる画像・開いたアコーディオン・足された行)。そのとき、要素の**大きさは変わらない**
|
|
7
|
+
* ので、`ResizeObserver` では拾えない(試して、直らなかった。2026-10-12)。
|
|
8
|
+
*
|
|
9
|
+
* ここでは `IntersectionObserver` を使う: 要素のいまの矩形にぴったり合わせた `rootMargin` で見張ると、
|
|
10
|
+
* 要素が少しでも動いた時点で、交差の割合が 1 から外れる。外れたら `onMove` を呼び、新しい矩形で
|
|
11
|
+
* 張り直す。floating-ui の `autoUpdate`(`layoutShift`)と同じ考え方で、こちらは依存を増やさないために
|
|
12
|
+
* 自前で持つ(T342 で、入力系が floating-ui を読むと束が 7.9 kB 増えた)。
|
|
13
|
+
*
|
|
14
|
+
* 戻り値は、見張りをやめる関数。`IntersectionObserver` の無い環境(jsdom)では、何もしない。
|
|
15
|
+
*/
|
|
16
|
+
export declare const observeMove: (element: Element, onMove: () => void) => (() => void);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/_internal/observeMove.ts
|
|
3
|
+
var e = (e, t) => {
|
|
4
|
+
if (typeof IntersectionObserver > "u") return () => {};
|
|
5
|
+
let n = e.ownerDocument.documentElement, r = null, i, a = () => {
|
|
6
|
+
clearTimeout(i), r?.disconnect(), r = null;
|
|
7
|
+
}, o = (s, c = 1) => {
|
|
8
|
+
a();
|
|
9
|
+
let { left: l, top: u, width: d, height: f } = e.getBoundingClientRect();
|
|
10
|
+
if (s && t(), !d || !f) return;
|
|
11
|
+
let p = [
|
|
12
|
+
-Math.floor(u),
|
|
13
|
+
-Math.floor(n.clientWidth - (l + d)),
|
|
14
|
+
-Math.floor(n.clientHeight - (u + f)),
|
|
15
|
+
-Math.floor(l)
|
|
16
|
+
].map((e) => `${e}px`).join(" "), m = !0;
|
|
17
|
+
r = new IntersectionObserver((t) => {
|
|
18
|
+
let n = t[0].intersectionRatio;
|
|
19
|
+
if (typeof n != "number") {
|
|
20
|
+
a();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let r = e.getBoundingClientRect();
|
|
24
|
+
if (m && (Math.abs(r.left - l) >= 1 || Math.abs(r.top - u) >= 1)) {
|
|
25
|
+
o(!0);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (n !== c) {
|
|
29
|
+
if (!m) {
|
|
30
|
+
o(!0);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
n ? o(!1, n) : i = setTimeout(() => o(!1, 1e-7), 1e3);
|
|
34
|
+
}
|
|
35
|
+
m = !1;
|
|
36
|
+
}, {
|
|
37
|
+
rootMargin: p,
|
|
38
|
+
threshold: Math.max(0, Math.min(1, c)) || 1
|
|
39
|
+
}), r.observe(e);
|
|
40
|
+
};
|
|
41
|
+
return o(!1), a;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { e as observeMove };
|
|
@@ -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("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs"),s=require("../../_internal/observeMove.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");var d=16;function f(e){let t=getComputedStyle(e);return`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`}async function p(e){let t=document.fonts;if(t&&typeof t.load==`function`){try{await t.load(f(e))}catch{}for(;t.status===`loading`;)await new Promise(e=>{t.addEventListener(`loadingdone`,()=>e(),{once:!0})})}}function m(e){let t=document.fonts;return!t||typeof t.load!=`function`?!1:t.status===`loading`||typeof t.check==`function`&&!t.check(f(e))}function h(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.width)===Math.round(t.width)&&Math.round(e.height)===Math.round(t.height)}function g(e){return e.top>=d&&e.bottom<=window.innerHeight-d&&e.left>=d&&e.right<=window.innerWidth-d}var _=({steps:e,open:d,onClose:f,onFinish:_})=>{let{t:v}=t.useWimTranslation(n.commonNs),[y,b]=(0,c.useState)(0),[x,S]=(0,c.useState)(null),C=e[y],w=C?.target;(0,c.useLayoutEffect)(()=>{if(!d||!w){S(null);return}let e=!1,t=t=>{e||S(e=>t?e&&h(e,t)?e:t:null)},n=()=>{let e=document.querySelector(w);if(!e){t(null);return}g(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`nearest`}),t(e.getBoundingClientRect())},r=()=>{let e=document.querySelector(w);t(e?e.getBoundingClientRect():null)},i,a=()=>{window.addEventListener(`resize`,r),window.addEventListener(`scroll`,r,!0);let e=document.querySelector(w);e&&(i=s.observeMove(e,r))},o=async()=>{let t=document.querySelector(w);t&&await p(t),!e&&(n(),a())},c=document.querySelector(w);return c&&m(c)?o():(n(),a()),()=>{e=!0,window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,r,!0),i?.()}},[d,y,w]);let T=(0,c.useId)(),E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=d&&!!C&&!!x;if((0,c.useEffect)(()=>{if(!O)return;let e=E.current;e&&!e.contains(document.activeElement)&&D.current?.focus()},[O,y]),(0,c.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),f())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,f]),!d||!C)return null;let k=()=>{y<e.length-1?b(y+1):(_?_():f(),b(0))},A=()=>{y>0&&b(y-1)},j={},M=C.placement||`bottom`;if(x){let e=window.innerWidth,t=Math.min(300,e-32),n=M;if(e<640&&(n===`left`||n===`right`)&&(n=`bottom`),M=n,n===`top`||n===`bottom`){let r=x.left+x.width/2,i=t/2+16,a=e-t/2-16;r=i>a?e/2:Math.max(i,Math.min(a,r)),j.left=r,n===`top`?(j.top=x.top-12,j.transform=`translate(-50%, -100%)`):(j.top=x.bottom+12,j.transform=`translateX(-50%)`)}else n===`left`?(j.left=x.left-12,j.top=x.top+x.height/2,j.transform=`translate(-100%, -50%)`):n===`right`&&(j.left=x.right+12,j.top=x.top+x.height/2,j.transform=`translateY(-50%)`)}return(0,u.jsx)(r.Portal,{children:(0,u.jsx)(i.FocusTrap,{initialFocus:!1,children:(0,u.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":C.title,"aria-describedby":x?T:void 0,children:[x&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:o.default.highlight,style:{top:x.top-4,left:x.left-4,width:x.width+8,height:x.height+8}}),(0,u.jsx)(`div`,{ref:E,className:(0,l.default)(`wim-tour`,o.default.bubble),"data-placement":M,style:j,children:(0,u.jsxs)(`div`,{className:o.default.inner,children:[(0,u.jsx)(`h3`,{className:o.default.title,children:C.title}),(0,u.jsx)(`p`,{id:T,className:o.default.description,children:C.description}),(0,u.jsxs)(`div`,{className:o.default.footer,children:[(0,u.jsxs)(`span`,{className:o.default.progress,children:[y+1,` / `,e.length]}),(0,u.jsxs)(`div`,{className:o.default.buttons,children:[y>0&&(0,u.jsx)(a.Button,{size:`sm`,variant:`outline`,onClick:A,children:v(`action.back`)}),(0,u.jsx)(a.Button,{ref:D,size:`sm`,variant:`solid`,onClick:k,children:y===e.length-1?v(`action.finish`):v(`action.next`)})]})]})]})})]}),(0,u.jsx)(`div`,{className:o.default.mask,onClick:f,role:`button`,tabIndex:0,"aria-label":v(`a11y.close_tour`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f()}})]})})})};exports.Tour=_;
|
|
@@ -5,167 +5,170 @@ import { Portal as n } from "../../overlay/Portal/Portal.js";
|
|
|
5
5
|
import { FocusTrap as r } from "../../overlay/FocusTrap/FocusTrap.js";
|
|
6
6
|
import { Button as i } from "../../form/Button/Button.js";
|
|
7
7
|
import a from "./tour.module.js";
|
|
8
|
-
import {
|
|
9
|
-
import d from "
|
|
10
|
-
import
|
|
8
|
+
import { observeMove as o } from "../../_internal/observeMove.js";
|
|
9
|
+
import { useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
|
|
10
|
+
import f from "classnames";
|
|
11
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/feedback/Tour/Tour.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
13
|
+
var g = 16;
|
|
14
|
+
function _(e) {
|
|
14
15
|
let t = getComputedStyle(e);
|
|
15
16
|
return `${t.fontWeight} ${t.fontSize} ${t.fontFamily}`;
|
|
16
17
|
}
|
|
17
|
-
async function
|
|
18
|
+
async function v(e) {
|
|
18
19
|
let t = document.fonts;
|
|
19
20
|
if (t && typeof t.load == "function") {
|
|
20
21
|
try {
|
|
21
|
-
await t.load(
|
|
22
|
+
await t.load(_(e));
|
|
22
23
|
} catch {}
|
|
23
24
|
for (; t.status === "loading";) await new Promise((e) => {
|
|
24
25
|
t.addEventListener("loadingdone", () => e(), { once: !0 });
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function y(e) {
|
|
29
30
|
let t = document.fonts;
|
|
30
|
-
return !t || typeof t.load != "function" ? !1 : t.status === "loading" || typeof t.check == "function" && !t.check(
|
|
31
|
+
return !t || typeof t.load != "function" ? !1 : t.status === "loading" || typeof t.check == "function" && !t.check(_(e));
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function b(e, t) {
|
|
33
34
|
return Math.round(e.top) === Math.round(t.top) && Math.round(e.left) === Math.round(t.left) && Math.round(e.width) === Math.round(t.width) && Math.round(e.height) === Math.round(t.height);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
return e.top >=
|
|
36
|
+
function x(e) {
|
|
37
|
+
return e.top >= g && e.bottom <= window.innerHeight - g && e.left >= g && e.right <= window.innerWidth - g;
|
|
37
38
|
}
|
|
38
|
-
var
|
|
39
|
-
let { t:
|
|
40
|
-
|
|
41
|
-
if (!
|
|
42
|
-
|
|
39
|
+
var S = ({ steps: g, open: _, onClose: S, onFinish: C }) => {
|
|
40
|
+
let { t: w } = e(t), [T, E] = d(0), [D, O] = d(null), k = g[T], A = k?.target;
|
|
41
|
+
l(() => {
|
|
42
|
+
if (!_ || !A) {
|
|
43
|
+
O(null);
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
let e = !1, t = (t) => {
|
|
46
|
-
e ||
|
|
47
|
+
e || O((e) => t ? e && b(e, t) ? e : t : null);
|
|
47
48
|
}, n = () => {
|
|
48
|
-
let e = document.querySelector(
|
|
49
|
+
let e = document.querySelector(A);
|
|
49
50
|
if (!e) {
|
|
50
51
|
t(null);
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
x(e.getBoundingClientRect()) || e.scrollIntoView({
|
|
54
55
|
block: "center",
|
|
55
56
|
inline: "nearest"
|
|
56
57
|
}), t(e.getBoundingClientRect());
|
|
57
58
|
}, r = () => {
|
|
58
|
-
let e = document.querySelector(
|
|
59
|
+
let e = document.querySelector(A);
|
|
59
60
|
t(e ? e.getBoundingClientRect() : null);
|
|
60
|
-
}, i = () => {
|
|
61
|
+
}, i, a = () => {
|
|
61
62
|
window.addEventListener("resize", r), window.addEventListener("scroll", r, !0);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
let e = document.querySelector(A);
|
|
64
|
+
e && (i = o(e, r));
|
|
65
|
+
}, s = async () => {
|
|
66
|
+
let t = document.querySelector(A);
|
|
67
|
+
t && await v(t), !e && (n(), a());
|
|
68
|
+
}, c = document.querySelector(A);
|
|
69
|
+
return c && y(c) ? s() : (n(), a()), () => {
|
|
70
|
+
e = !0, window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0), i?.();
|
|
68
71
|
};
|
|
69
72
|
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
_,
|
|
74
|
+
T,
|
|
75
|
+
A
|
|
73
76
|
]);
|
|
74
|
-
let
|
|
75
|
-
if (
|
|
76
|
-
if (!
|
|
77
|
-
let e =
|
|
78
|
-
e && !e.contains(document.activeElement) &&
|
|
79
|
-
}, [
|
|
80
|
-
if (!
|
|
77
|
+
let j = c(), M = u(null), N = u(null), P = _ && !!k && !!D;
|
|
78
|
+
if (s(() => {
|
|
79
|
+
if (!P) return;
|
|
80
|
+
let e = M.current;
|
|
81
|
+
e && !e.contains(document.activeElement) && N.current?.focus();
|
|
82
|
+
}, [P, T]), s(() => {
|
|
83
|
+
if (!_) return;
|
|
81
84
|
let e = (e) => {
|
|
82
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
85
|
+
e.key === "Escape" && (e.preventDefault(), S());
|
|
83
86
|
};
|
|
84
87
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
85
|
-
}, [
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
if (
|
|
92
|
-
let e = window.innerWidth, t = Math.min(300, e - 32), n =
|
|
93
|
-
if (e < 640 && (n === "left" || n === "right") && (n = "bottom"),
|
|
94
|
-
let r =
|
|
95
|
-
r = i > a ? e / 2 : Math.max(i, Math.min(a, r)),
|
|
96
|
-
} else n === "left" ? (
|
|
88
|
+
}, [_, S]), !_ || !k) return null;
|
|
89
|
+
let F = () => {
|
|
90
|
+
T < g.length - 1 ? E(T + 1) : (C ? C() : S(), E(0));
|
|
91
|
+
}, I = () => {
|
|
92
|
+
T > 0 && E(T - 1);
|
|
93
|
+
}, L = {}, R = k.placement || "bottom";
|
|
94
|
+
if (D) {
|
|
95
|
+
let e = window.innerWidth, t = Math.min(300, e - 32), n = R;
|
|
96
|
+
if (e < 640 && (n === "left" || n === "right") && (n = "bottom"), R = n, n === "top" || n === "bottom") {
|
|
97
|
+
let r = D.left + D.width / 2, i = t / 2 + 16, a = e - t / 2 - 16;
|
|
98
|
+
r = i > a ? e / 2 : Math.max(i, Math.min(a, r)), L.left = r, n === "top" ? (L.top = D.top - 12, L.transform = "translate(-50%, -100%)") : (L.top = D.bottom + 12, L.transform = "translateX(-50%)");
|
|
99
|
+
} else n === "left" ? (L.left = D.left - 12, L.top = D.top + D.height / 2, L.transform = "translate(-100%, -50%)") : n === "right" && (L.left = D.right + 12, L.top = D.top + D.height / 2, L.transform = "translateY(-50%)");
|
|
97
100
|
}
|
|
98
|
-
return /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ m(n, { children: /* @__PURE__ */ m(r, {
|
|
99
102
|
initialFocus: !1,
|
|
100
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ h("div", {
|
|
101
104
|
role: "dialog",
|
|
102
105
|
"aria-modal": "true",
|
|
103
|
-
"aria-label":
|
|
104
|
-
"aria-describedby":
|
|
105
|
-
children: [
|
|
106
|
+
"aria-label": k.title,
|
|
107
|
+
"aria-describedby": D ? j : void 0,
|
|
108
|
+
children: [D && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
|
|
106
109
|
className: a.highlight,
|
|
107
110
|
style: {
|
|
108
|
-
top:
|
|
109
|
-
left:
|
|
110
|
-
width:
|
|
111
|
-
height:
|
|
111
|
+
top: D.top - 4,
|
|
112
|
+
left: D.left - 4,
|
|
113
|
+
width: D.width + 8,
|
|
114
|
+
height: D.height + 8
|
|
112
115
|
}
|
|
113
|
-
}), /* @__PURE__ */
|
|
114
|
-
ref:
|
|
115
|
-
className:
|
|
116
|
-
"data-placement":
|
|
117
|
-
style:
|
|
118
|
-
children: /* @__PURE__ */
|
|
116
|
+
}), /* @__PURE__ */ m("div", {
|
|
117
|
+
ref: M,
|
|
118
|
+
className: f("wim-tour", a.bubble),
|
|
119
|
+
"data-placement": R,
|
|
120
|
+
style: L,
|
|
121
|
+
children: /* @__PURE__ */ h("div", {
|
|
119
122
|
className: a.inner,
|
|
120
123
|
children: [
|
|
121
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ m("h3", {
|
|
122
125
|
className: a.title,
|
|
123
|
-
children:
|
|
126
|
+
children: k.title
|
|
124
127
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
id:
|
|
128
|
+
/* @__PURE__ */ m("p", {
|
|
129
|
+
id: j,
|
|
127
130
|
className: a.description,
|
|
128
|
-
children:
|
|
131
|
+
children: k.description
|
|
129
132
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ h("div", {
|
|
131
134
|
className: a.footer,
|
|
132
|
-
children: [/* @__PURE__ */
|
|
135
|
+
children: [/* @__PURE__ */ h("span", {
|
|
133
136
|
className: a.progress,
|
|
134
137
|
children: [
|
|
135
|
-
|
|
138
|
+
T + 1,
|
|
136
139
|
" / ",
|
|
137
|
-
|
|
140
|
+
g.length
|
|
138
141
|
]
|
|
139
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ h("div", {
|
|
140
143
|
className: a.buttons,
|
|
141
|
-
children: [
|
|
144
|
+
children: [T > 0 && /* @__PURE__ */ m(i, {
|
|
142
145
|
size: "sm",
|
|
143
146
|
variant: "outline",
|
|
144
|
-
onClick:
|
|
145
|
-
children:
|
|
146
|
-
}), /* @__PURE__ */
|
|
147
|
-
ref:
|
|
147
|
+
onClick: I,
|
|
148
|
+
children: w("action.back")
|
|
149
|
+
}), /* @__PURE__ */ m(i, {
|
|
150
|
+
ref: N,
|
|
148
151
|
size: "sm",
|
|
149
152
|
variant: "solid",
|
|
150
|
-
onClick:
|
|
151
|
-
children:
|
|
153
|
+
onClick: F,
|
|
154
|
+
children: T === g.length - 1 ? w("action.finish") : w("action.next")
|
|
152
155
|
})]
|
|
153
156
|
})]
|
|
154
157
|
})
|
|
155
158
|
]
|
|
156
159
|
})
|
|
157
|
-
})] }), /* @__PURE__ */
|
|
160
|
+
})] }), /* @__PURE__ */ m("div", {
|
|
158
161
|
className: a.mask,
|
|
159
|
-
onClick:
|
|
162
|
+
onClick: S,
|
|
160
163
|
role: "button",
|
|
161
164
|
tabIndex: 0,
|
|
162
|
-
"aria-label":
|
|
165
|
+
"aria-label": w("a11y.close_tour"),
|
|
163
166
|
onKeyDown: (e) => {
|
|
164
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
167
|
+
(e.key === "Enter" || e.key === " ") && S();
|
|
165
168
|
}
|
|
166
169
|
})]
|
|
167
170
|
})
|
|
168
171
|
}) });
|
|
169
172
|
};
|
|
170
173
|
//#endregion
|
|
171
|
-
export {
|
|
174
|
+
export { S as Tour };
|
|
@@ -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("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../../icon/loading.cjs"),s=require("../../media/Icon/Icon.cjs"),c=require("./button.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=l.default.forwardRef(({asChild:e=!1,size:f=`md`,variant:p=`outline`,intent:m=`default`,icon:h,iconPosition:g=`left`,loading:_=!1,backgroundColor:v,justify:y=`center`,animateWidth:b=!1,fullWidth:x=!1,styles:S,"aria-label":C,className:w,disabled:T,children:E,...D},O)=>{let k=l.default.useRef(null),A=a.useMergedRef(k,O),[j,M]=l.default.useState(`auto`),N=l.default.useRef(!0);l.default.useLayoutEffect(()=>{if(!b||!k.current)return;if(N.current){N.current=!1;return}let e=k.current,t=e.getBoundingClientRect().width;M(t);let n=e.style.width,r=e.style.minWidth;e.style.width=`auto`,e.style.minWidth=`0`;let i=Math.ceil(e.getBoundingClientRect().width)+2;e.style.width=n,e.style.minWidth=r;let a=requestAnimationFrame(()=>{M(i)});return()=>cancelAnimationFrame(a)},[E,b]);let{t:P}=r.useWimTranslation(i.commonNs),F=T,I;typeof C==`string`?I=C:C!==!1&&(
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../../icon/loading.cjs"),s=require("../../media/Icon/Icon.cjs"),c=require("./button.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=l.default.forwardRef(({asChild:e=!1,size:f=`md`,variant:p=`outline`,intent:m=`default`,icon:h,iconPosition:g=`left`,loading:_=!1,backgroundColor:v,justify:y=`center`,animateWidth:b=!1,fullWidth:x=!1,styles:S,"aria-label":C,className:w,disabled:T,children:E,...D},O)=>{let k=l.default.useRef(null),A=a.useMergedRef(k,O),[j,M]=l.default.useState(`auto`),N=l.default.useRef(!0);l.default.useLayoutEffect(()=>{if(!b||!k.current)return;if(N.current){N.current=!1;return}let e=k.current,t=e.getBoundingClientRect().width;M(t);let n=e.style.width,r=e.style.minWidth;e.style.width=`auto`,e.style.minWidth=`0`;let i=Math.ceil(e.getBoundingClientRect().width)+2;e.style.width=n,e.style.minWidth=r;let a=requestAnimationFrame(()=>{M(i)});return()=>cancelAnimationFrame(a)},[E,b]);let{t:P}=r.useWimTranslation(i.commonNs),F=T,I;typeof C==`string`?I=C:C!==!1&&_&&(E||typeof h!=`string`)&&(I=P(`a11y.loading`));let L=!e&&!E&&!!h&&typeof C!=`string`&&!D[`aria-labelledby`]&&!D.title;l.default.useEffect(()=>{},[L]);let R=y===`start`?`flex-start`:y===`end`?`flex-end`:y===`between`?`space-between`:y,z=_?(0,d.jsx)(`span`,{className:(0,u.default)(c.default.loader,S?.loader),children:(0,d.jsx)(s.Icon,{component:o.default,spin:!0,size:f})}):h?typeof h==`string`?(0,d.jsx)(s.Icon,{name:h,size:f,className:S?.icon}):h:null;return(0,d.jsxs)(e?t.Root:`button`,{ref:A,type:e?void 0:`button`,className:(0,u.default)(`wim-button`,c.default.root,c.default[f],c.default[p],c.default[m],_&&c.default.loading,b&&c.default.animatedWidth,x&&c.default.fullWidth,!E&&!!h&&c.default.iconOnly,w,S?.root),disabled:(F||_)&&!e?!0:void 0,"aria-label":I,"aria-busy":_||void 0,...e?D:{...D},style:{...D.style,justifyContent:R,...v?{backgroundColor:n.getColorValue(v)}:{},...b&&j!==`auto`?{width:`${j}px`,transitionProperty:D.style?.transitionProperty||`width, background-color, border-color, box-shadow, transform`,transitionDuration:D.style?.transitionDuration||`var(--wim-duration-base)`,transitionTimingFunction:D.style?.transitionTimingFunction||`var(--wim-easing-standard)`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`clip`}:{}},children:[e&&z&&g===`left`?z:null,e?(0,d.jsx)(t.Slottable,{children:E}):(0,d.jsxs)(`span`,{className:c.default.content,children:[z&&g===`left`&&z,E,z&&g===`right`&&z]}),e&&z&&g===`right`?z:null]})});f.displayName=`Button`,exports.Button=f;
|
|
@@ -15,7 +15,7 @@ export type ButtonProps = React.ComponentPropsWithoutRef<"button"> & {
|
|
|
15
15
|
variant?: ButtonVariant;
|
|
16
16
|
/** Design intent of the button (visual / semantic state). Unrelated to the ARIA role attribute. */
|
|
17
17
|
intent?: ButtonIntent;
|
|
18
|
-
/** Icon name or custom icon element */
|
|
18
|
+
/** Icon name or custom icon element. An icon-only button (no children) needs `aria-label` or `aria-labelledby`: the icon name is not used as the accessible name. */
|
|
19
19
|
icon?: React.ComponentProps<typeof Icon>["name"] | React.ReactNode;
|
|
20
20
|
/** Position of the icon relative to the label */
|
|
21
21
|
iconPosition?: "left" | "right";
|
|
@@ -48,7 +48,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<React.Detailed
|
|
|
48
48
|
variant?: ButtonVariant;
|
|
49
49
|
/** Design intent of the button (visual / semantic state). Unrelated to the ARIA role attribute. */
|
|
50
50
|
intent?: ButtonIntent;
|
|
51
|
-
/** Icon name or custom icon element */
|
|
51
|
+
/** Icon name or custom icon element. An icon-only button (no children) needs `aria-label` or `aria-labelledby`: the icon name is not used as the accessible name. */
|
|
52
52
|
icon?: React.ComponentProps<typeof Icon>["name"] | React.ReactNode;
|
|
53
53
|
/** Position of the icon relative to the label */
|
|
54
54
|
iconPosition?: "left" | "right";
|
|
@@ -31,8 +31,10 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
|
|
|
31
31
|
return () => cancelAnimationFrame(a);
|
|
32
32
|
}, [O, S]);
|
|
33
33
|
let { t: I } = r(i), L = D, R;
|
|
34
|
-
typeof T == "string" ? R = T : T !== !1 && (
|
|
35
|
-
let z =
|
|
34
|
+
typeof T == "string" ? R = T : T !== !1 && y && (O || typeof _ != "string") && (R = I("a11y.loading"));
|
|
35
|
+
let z = !p && !O && !!_ && typeof T != "string" && !k["aria-labelledby"] && !k.title;
|
|
36
|
+
l.useEffect(() => {}, [z]);
|
|
37
|
+
let B = x === "start" ? "flex-start" : x === "end" ? "flex-end" : x === "between" ? "space-between" : x, V = y ? /* @__PURE__ */ d("span", {
|
|
36
38
|
className: u(c.loader, w?.loader),
|
|
37
39
|
children: /* @__PURE__ */ d(s, {
|
|
38
40
|
component: o,
|
|
@@ -47,9 +49,14 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
|
|
|
47
49
|
return /* @__PURE__ */ f(p ? e : "button", {
|
|
48
50
|
ref: M,
|
|
49
51
|
type: p ? void 0 : "button",
|
|
52
|
+
className: u("wim-button", c.root, c[m], c[h], c[g], y && c.loading, S && c.animatedWidth, C && c.fullWidth, !O && !!_ && c.iconOnly, E, w?.root),
|
|
53
|
+
disabled: (L || y) && !p ? !0 : void 0,
|
|
54
|
+
"aria-label": R,
|
|
55
|
+
"aria-busy": y || void 0,
|
|
56
|
+
...p ? k : { ...k },
|
|
50
57
|
style: {
|
|
51
58
|
...k.style,
|
|
52
|
-
justifyContent:
|
|
59
|
+
justifyContent: B,
|
|
53
60
|
...b ? { backgroundColor: n(b) } : {},
|
|
54
61
|
...S && N !== "auto" ? {
|
|
55
62
|
width: `${N}px`,
|
|
@@ -61,22 +68,17 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
|
|
|
61
68
|
textOverflow: "clip"
|
|
62
69
|
} : {}
|
|
63
70
|
},
|
|
64
|
-
className: u("wim-button", c.root, c[m], c[h], c[g], y && c.loading, S && c.animatedWidth, C && c.fullWidth, !O && !!_ && c.iconOnly, E, w?.root),
|
|
65
|
-
disabled: (L || y) && !p ? !0 : void 0,
|
|
66
|
-
"aria-label": R,
|
|
67
|
-
"aria-busy": y || void 0,
|
|
68
|
-
...p ? k : { ...k },
|
|
69
71
|
children: [
|
|
70
|
-
p &&
|
|
72
|
+
p && V && v === "left" ? V : null,
|
|
71
73
|
p ? /* @__PURE__ */ d(t, { children: O }) : /* @__PURE__ */ f("span", {
|
|
72
74
|
className: c.content,
|
|
73
75
|
children: [
|
|
74
|
-
|
|
76
|
+
V && v === "left" && V,
|
|
75
77
|
O,
|
|
76
|
-
|
|
78
|
+
V && v === "right" && V
|
|
77
79
|
]
|
|
78
80
|
}),
|
|
79
|
-
p &&
|
|
81
|
+
p && V && v === "right" ? V : null
|
|
80
82
|
]
|
|
81
83
|
});
|
|
82
84
|
});
|
|
@@ -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("../FieldTemplate/FieldTemplate.cjs"),r=require("./textarea.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=i.default.forwardRef(({asChild:e=!1,children:s,intent:c=`default`,variant:l=`outline`,fullWidth:u=!1,fieldSizing:d=`fixed`,className:f,disabled:p,label:m,error:h,required:g,layout:_,id:v,width:y,...b},x)=>{let S=p,C=h?`danger`:c,w=i.default.useId(),T=v||`wim-textarea-${w}`,E=h?`${T}-error`:void 0,D=m?`${T}-label`:void 0,O=typeof y==`string`&&[`xs`,`sm`,`md`,`lg`,`xl`].includes(y),k=y!==void 0&&!O&&!u,A=O&&!u?y:void 0,j=A?r.default[`width${A.charAt(0).toUpperCase()}${A.slice(1)}`]:void 0;return(0,o.jsx)(n.FieldTemplate,{label:m,error:h,required:g,layout:_,labelId:D,errorId:E,className:f,children:(0,o.jsx)(e?t.Root:`textarea`,{id:T,ref:x,className:(0,a.default)(`wim-textarea`,r.default.root,r.default[C],S&&r.default.disabled,r.default[l],u&&r.default.fullWidth,k&&r.default.hasCustomWidth,j,d===`content`&&r.default.fieldSizingContent),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),r=require("./textarea.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=i.default.forwardRef(({asChild:e=!1,children:s,intent:c=`default`,variant:l=`outline`,fullWidth:u=!1,fieldSizing:d=`fixed`,className:f,disabled:p,label:m,error:h,required:g,layout:_,id:v,width:y,...b},x)=>{let S=p,C=h?`danger`:c,w=i.default.useId(),T=v||`wim-textarea-${w}`,E=h?`${T}-error`:void 0,D=m?`${T}-label`:void 0,O=typeof y==`string`&&[`xs`,`sm`,`md`,`lg`,`xl`].includes(y),k=y!==void 0&&!O&&!u,A=O&&!u?y:void 0,j=A?r.default[`width${A.charAt(0).toUpperCase()}${A.slice(1)}`]:void 0;return(0,o.jsx)(n.FieldTemplate,{label:m,error:h,required:g,layout:_,labelId:D,errorId:E,className:f,children:(0,o.jsx)(e?t.Root:`textarea`,{id:T,ref:x,className:(0,a.default)(`wim-textarea`,r.default.root,r.default[C],S&&r.default.disabled,r.default[l],u&&r.default.fullWidth,k&&r.default.hasCustomWidth,j,d===`content`&&r.default.fieldSizingContent),disabled:S,"aria-invalid":C===`danger`,"aria-describedby":E,"aria-labelledby":m?D:void 0,"aria-required":g,...b,style:{...k?{"--wim-input-width":typeof y==`number`?`${y}px`:y}:{},...b.style},placeholder:b.placeholder,"aria-label":b[`aria-label`],children:e?(0,o.jsx)(t.Slottable,{children:s}):s})})});s.displayName=`Textarea`,exports.Textarea=s;
|
|
@@ -26,16 +26,16 @@ var s = i.forwardRef(({ asChild: s = !1, children: c, intent: l = "default", var
|
|
|
26
26
|
id: E,
|
|
27
27
|
ref: S,
|
|
28
28
|
className: a("wim-textarea", r.root, r[w], C && r.disabled, r[u], d && r.fullWidth, A && r.hasCustomWidth, M, f === "content" && r.fieldSizingContent),
|
|
29
|
-
style: {
|
|
30
|
-
...A ? { "--wim-input-width": typeof b == "number" ? `${b}px` : b } : {},
|
|
31
|
-
...x.style
|
|
32
|
-
},
|
|
33
29
|
disabled: C,
|
|
34
30
|
"aria-invalid": w === "danger",
|
|
35
31
|
"aria-describedby": D,
|
|
36
32
|
"aria-labelledby": h ? O : void 0,
|
|
37
33
|
"aria-required": _,
|
|
38
34
|
...x,
|
|
35
|
+
style: {
|
|
36
|
+
...A ? { "--wim-input-width": typeof b == "number" ? `${b}px` : b } : {},
|
|
37
|
+
...x.style
|
|
38
|
+
},
|
|
39
39
|
placeholder: x.placeholder,
|
|
40
40
|
"aria-label": x["aria-label"],
|
|
41
41
|
children: s ? /* @__PURE__ */ o(t, { children: c }) : c
|
|
@@ -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/components.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/edit.cjs"),a=require("../../../icon/plus.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../data-display/Card/Card.cjs"),c=require("../../form/Button/Button.cjs"),l=require("./dashboard.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=(0,u.createContext)(null),m=()=>{let e=(0,u.useContext)(p);if(!e)throw Error(`Dashboard subcomponents must be used within Dashboard`);return e},h=u.default.forwardRef(({widgets:e,editable:r,defaultEditable:s=!1,onEditChange:m,onRemove:h,onAdd:_,columns:v=3,gap:y=`md`,showEditToggle:b,titleLevel:x=3,label:S,className:C,style:w,children:T,...E},D)=>{let{t:O}=t.useWimTranslation(n.componentsNs),k=r!==void 0,[A,j]=(0,u.useState)(s),M=k?r:A,N=(0,u.useCallback)(()=>{let e=!M;k||j(e),m?.(e)},[M,k,m]),P={"--dashboard-columns":v,...w},F=b??(r!==void 0||s||h!==void 0||_!==void 0),I=(0,u.useMemo)(()=>({editable:M??!1,onRemove:h,titleLevel:x}),[M,h,x]),L=`h${Math.max(2,x-1)}`;return(0,f.jsx)(p.Provider,{value:I,children:(0,f.jsxs)(`div`,{ref:D,className:(0,d.default)(`wim-dashboard`,l.default.root,C),role:`group`,"aria-label":S??O(`dashboard_widget.label`),...E,children:[(S||F)&&(0,f.jsxs)(`div`,{className:l.default.header,children:[S&&(0,f.jsx)(L,{className:l.default.heading,children:S}),F&&(0,f.jsx)(c.Button,{size:`sm`,variant:M?`solid`:`outline`,intent:`default`,className:void 0,onClick:N,"aria-pressed":M,"aria-label":O(M?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`),icon:(0,f.jsx)(o.Icon,{component:i.default,size:`sm`}),children:O(M?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`)})]}),(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.grid,l.default[`gap-${y}`]),style:P,role:`region`,"aria-label":O(`dashboard_widget.grid_label`),children:[e?e.map(e=>(0,f.jsx)(g,{widget:e},e.id)):T,M&&_&&(0,f.jsx)(c.Button,{asChild:!0,className:l.default.addButton,onClick:_,"aria-label":O(`dashboard_widget.add_widget`),children:(0,f.jsxs)(`button`,{type:`button`,children:[(0,f.jsx)(o.Icon,{component:a.default,size:`md`}),(0,f.jsx)(`span`,{children:O(`dashboard_widget.add_widget`)})]})})]})]})})});h.displayName=`Dashboard`;var g=({widget:e,className:i,...a})=>{let{editable:u,onRemove:p,titleLevel:h}=m(),g=`h${h}`,{t:_}=t.useWimTranslation(n.componentsNs),{id:v,title:y,description:b,content:x,span:S=1,rowSpan:C=1}=e;return(0,f.jsxs)(s.Card,{variant:`outline`,padding:`md`,radius:`md`,className:(0,d.default)(l.default.widget,l.default[`span-${S}`],l.default[`row-${C}`],{[l.default.editMode]:u},i),style:{"--widget-span":S,"--widget-row-span":C
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/components.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/edit.cjs"),a=require("../../../icon/plus.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../data-display/Card/Card.cjs"),c=require("../../form/Button/Button.cjs"),l=require("./dashboard.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=(0,u.createContext)(null),m=()=>{let e=(0,u.useContext)(p);if(!e)throw Error(`Dashboard subcomponents must be used within Dashboard`);return e},h=u.default.forwardRef(({widgets:e,editable:r,defaultEditable:s=!1,onEditChange:m,onRemove:h,onAdd:_,columns:v=3,gap:y=`md`,showEditToggle:b,titleLevel:x=3,label:S,className:C,style:w,children:T,...E},D)=>{let{t:O}=t.useWimTranslation(n.componentsNs),k=r!==void 0,[A,j]=(0,u.useState)(s),M=k?r:A,N=(0,u.useCallback)(()=>{let e=!M;k||j(e),m?.(e)},[M,k,m]),P={"--dashboard-columns":v,...w},F=b??(r!==void 0||s||h!==void 0||_!==void 0),I=(0,u.useMemo)(()=>({editable:M??!1,onRemove:h,titleLevel:x}),[M,h,x]),L=`h${Math.max(2,x-1)}`;return(0,f.jsx)(p.Provider,{value:I,children:(0,f.jsxs)(`div`,{ref:D,className:(0,d.default)(`wim-dashboard`,l.default.root,C),role:`group`,"aria-label":S??O(`dashboard_widget.label`),...E,children:[(S||F)&&(0,f.jsxs)(`div`,{className:l.default.header,children:[S&&(0,f.jsx)(L,{className:l.default.heading,children:S}),F&&(0,f.jsx)(c.Button,{size:`sm`,variant:M?`solid`:`outline`,intent:`default`,className:void 0,onClick:N,"aria-pressed":M,"aria-label":O(M?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`),icon:(0,f.jsx)(o.Icon,{component:i.default,size:`sm`}),children:O(M?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`)})]}),(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.grid,l.default[`gap-${y}`]),style:P,role:`region`,"aria-label":O(`dashboard_widget.grid_label`),children:[e?e.map(e=>(0,f.jsx)(g,{widget:e},e.id)):T,M&&_&&(0,f.jsx)(c.Button,{asChild:!0,className:l.default.addButton,onClick:_,"aria-label":O(`dashboard_widget.add_widget`),children:(0,f.jsxs)(`button`,{type:`button`,children:[(0,f.jsx)(o.Icon,{component:a.default,size:`md`}),(0,f.jsx)(`span`,{children:O(`dashboard_widget.add_widget`)})]})})]})]})})});h.displayName=`Dashboard`;var g=({widget:e,className:i,...a})=>{let{editable:u,onRemove:p,titleLevel:h}=m(),g=`h${h}`,{t:_}=t.useWimTranslation(n.componentsNs),{id:v,title:y,description:b,content:x,span:S=1,rowSpan:C=1}=e;return(0,f.jsxs)(s.Card,{variant:`outline`,padding:`md`,radius:`md`,className:(0,d.default)(l.default.widget,l.default[`span-${S}`],l.default[`row-${C}`],{[l.default.editMode]:u},i),...a,style:{"--widget-span":S,"--widget-row-span":C,...a.style},children:[(0,f.jsxs)(`div`,{className:l.default.widgetHeader,children:[(0,f.jsxs)(`div`,{className:l.default.widgetMeta,children:[(0,f.jsx)(g,{className:l.default.widgetTitle,children:y}),b&&(0,f.jsx)(`p`,{className:l.default.widgetDescription,children:b})]}),u&&p&&(0,f.jsx)(c.Button,{size:`sm`,variant:`ghost`,intent:`danger`,className:l.default.removeButton,onClick:()=>p(v),"aria-label":_(`dashboard_widget.remove_widget`,{title:y}),icon:(0,f.jsx)(o.Icon,{component:r.default,size:`sm`})})]}),(0,f.jsx)(`div`,{className:l.default.widgetContent,children:x})]})};g.displayName=`DashboardWidgetCard`,exports.Dashboard=h,exports.DashboardWidgetCard=g;
|
|
@@ -93,11 +93,12 @@ var x = ({ widget: r, className: i, ...l }) => {
|
|
|
93
93
|
padding: "md",
|
|
94
94
|
radius: "md",
|
|
95
95
|
className: h(c.widget, c[`span-${C}`], c[`row-${w}`], { [c.editMode]: u }, i),
|
|
96
|
+
...l,
|
|
96
97
|
style: {
|
|
97
98
|
"--widget-span": C,
|
|
98
|
-
"--widget-row-span": w
|
|
99
|
+
"--widget-row-span": w,
|
|
100
|
+
...l.style
|
|
99
101
|
},
|
|
100
|
-
...l,
|
|
101
102
|
children: [/* @__PURE__ */ _("div", {
|
|
102
103
|
className: c.widgetHeader,
|
|
103
104
|
children: [/* @__PURE__ */ _("div", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../navigation/HamburgerMenu/HamburgerMenu.cjs"),n=require("../../overlay/Drawer/Drawer.cjs"),r=require("./navbar.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=(0,i.createContext)(void 0),c=i.default.forwardRef(({className:e,children:t,fixed:n,sticky:c,transparent:l,glass:u,bordered:d,fluid:f,defaultMenuOpen:p=!1,isMenuOpen:m,onMenuOpenChange:h,...g},_)=>{let[v,y]=(0,i.useState)(p),b=m??v;return(0,o.jsx)(s.Provider,{value:{isMenuOpen:b,setIsMenuOpen:e=>{y(e),h?.(e)}},children:(0,o.jsx)(`nav`,{ref:_,className:(0,a.default)(`wim-navbar`,r.default.root,n&&r.default.fixed,c&&r.default.sticky,l&&r.default.transparent,u&&r.default.glass,d&&r.default.bordered,e),...g,children:(0,o.jsx)(`div`,{className:(0,a.default)(r.default.container,f&&r.default.fluid),children:t})})})});c.displayName=`Navbar`;var l=i.default.forwardRef(({className:e,children:t,...n},i)=>(0,o.jsx)(`div`,{ref:i,className:(0,a.default)(r.default.brand,e),...n,children:t}));l.displayName=`Navbar.Brand`;var u=i.default.forwardRef(({className:e,children:t,justify:n=`end`,hiddenOnMobile:i,...s},c)=>(0,o.jsx)(`div`,{ref:c,className:(0,a.default)(r.default.content,r.default[n],i&&r.default.hiddenMobile,e),...s,children:t}));u.displayName=`Navbar.Content`;var d=i.default.forwardRef(({className:e,children:t,active:n,...i},s)=>(0,o.jsx)(`div`,{ref:s,className:(0,a.default)(r.default.item,n&&r.default.active,e),...i,children:t}));d.displayName=`Navbar.Item`;var f=i.default.forwardRef(({className:e,children:t,active:n,...i},s)=>(0,o.jsx)(`a`,{ref:s,className:(0,a.default)(r.default.link,n&&r.default.active,e),...i,children:t}));f.displayName=`Navbar.Link`;var p=i.default.forwardRef(({className:e,...n},a)=>{let c=(0,i.useContext)(s);if(!c)throw Error(`NavbarToggle must be used within a Navbar`);let{isMenuOpen:l,setIsMenuOpen:u}=c;return(0,o.jsx)(`div`,{className:r.default.toggle,children:(0,o.jsx)(t.HamburgerMenu,{ref:a,open:l,onOpenChange:u,className:e,...n})})});p.displayName=`Navbar.Toggle`;var m=i.default.forwardRef(({className:e,children:t,position:c=`top`,...l},u)=>{let d=(0,i.useContext)(s);if(!d)throw Error(`NavbarMenu must be used within a Navbar`);let{isMenuOpen:f,setIsMenuOpen:p}=d;return(0,o.jsx)(n.Drawer,{open:f,onOpenChange:p,side:c,children:(0,o.jsx)(n.DrawerContent,{className:(0,a.default)(r.default.menu,e),children:t})})});m.displayName=`Navbar.Menu`;var h=i.default.forwardRef(({className:e,children:t,active:n,...c},l)=>{let{setIsMenuOpen:u}=(0,i.useContext)(s)||{};return(0,o.jsx)(`div`,{ref:l,className:(0,a.default)(r.default.menuItem,n&&r.default.active,e),onClick:e=>{u?.(!1),c.onClick?.(e)},role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.currentTarget.click()},...c,children:t})});h.displayName=`Navbar.MenuItem`;var g=Object.assign(c,{Brand:l,Content:u,Item:d,Link:f,Toggle:p,Menu:m,MenuItem:h});exports.Navbar=g,exports.default=g,exports.NavbarBrand=l,exports.NavbarContent=u,exports.NavbarItem=d,exports.NavbarLink=f,exports.NavbarMenu=m,exports.NavbarMenuItem=h,exports.NavbarToggle=p;
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../navigation/HamburgerMenu/HamburgerMenu.cjs"),n=require("../../overlay/Drawer/Drawer.cjs"),r=require("./navbar.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=(0,i.createContext)(void 0),c=i.default.forwardRef(({className:e,children:t,fixed:n,sticky:c,transparent:l,glass:u,bordered:d,fluid:f,defaultMenuOpen:p=!1,isMenuOpen:m,onMenuOpenChange:h,...g},_)=>{let[v,y]=(0,i.useState)(p),b=m??v;return(0,o.jsx)(s.Provider,{value:{isMenuOpen:b,setIsMenuOpen:e=>{y(e),h?.(e)}},children:(0,o.jsx)(`nav`,{ref:_,className:(0,a.default)(`wim-navbar`,r.default.root,n&&r.default.fixed,c&&r.default.sticky,l&&r.default.transparent,u&&r.default.glass,d&&r.default.bordered,e),...g,children:(0,o.jsx)(`div`,{className:(0,a.default)(r.default.container,f&&r.default.fluid),children:t})})})});c.displayName=`Navbar`;var l=i.default.forwardRef(({className:e,children:t,...n},i)=>(0,o.jsx)(`div`,{ref:i,className:(0,a.default)(r.default.brand,e),...n,children:t}));l.displayName=`Navbar.Brand`;var u=i.default.forwardRef(({className:e,children:t,justify:n=`end`,hiddenOnMobile:i,...s},c)=>(0,o.jsx)(`div`,{ref:c,className:(0,a.default)(r.default.content,r.default[n],i&&r.default.hiddenMobile,e),...s,children:t}));u.displayName=`Navbar.Content`;var d=i.default.forwardRef(({className:e,children:t,active:n,...i},s)=>(0,o.jsx)(`div`,{ref:s,className:(0,a.default)(r.default.item,n&&r.default.active,e),...i,children:t}));d.displayName=`Navbar.Item`;var f=i.default.forwardRef(({className:e,children:t,active:n,...i},s)=>(0,o.jsx)(`a`,{ref:s,className:(0,a.default)(r.default.link,n&&r.default.active,e),...i,children:t}));f.displayName=`Navbar.Link`;var p=i.default.forwardRef(({className:e,...n},a)=>{let c=(0,i.useContext)(s);if(!c)throw Error(`NavbarToggle must be used within a Navbar`);let{isMenuOpen:l,setIsMenuOpen:u}=c;return(0,o.jsx)(`div`,{className:r.default.toggle,children:(0,o.jsx)(t.HamburgerMenu,{ref:a,open:l,onOpenChange:u,className:e,...n})})});p.displayName=`Navbar.Toggle`;var m=i.default.forwardRef(({className:e,children:t,position:c=`top`,...l},u)=>{let d=(0,i.useContext)(s);if(!d)throw Error(`NavbarMenu must be used within a Navbar`);let{isMenuOpen:f,setIsMenuOpen:p}=d;return(0,o.jsx)(n.Drawer,{open:f,onOpenChange:p,side:c,children:(0,o.jsx)(n.DrawerContent,{...l,className:(0,a.default)(r.default.menu,e),children:t})})});m.displayName=`Navbar.Menu`;var h=i.default.forwardRef(({className:e,children:t,active:n,...c},l)=>{let{setIsMenuOpen:u}=(0,i.useContext)(s)||{};return(0,o.jsx)(`div`,{ref:l,className:(0,a.default)(r.default.menuItem,n&&r.default.active,e),onClick:e=>{u?.(!1),c.onClick?.(e)},role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.currentTarget.click()},...c,children:t})});h.displayName=`Navbar.MenuItem`;var g=Object.assign(c,{Brand:l,Content:u,Item:d,Link:f,Toggle:p,Menu:m,MenuItem:h});exports.Navbar=g,exports.default=g,exports.NavbarBrand=l,exports.NavbarContent=u,exports.NavbarItem=d,exports.NavbarLink=f,exports.NavbarMenu=m,exports.NavbarMenuItem=h,exports.NavbarToggle=p;
|
|
@@ -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("../../../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,"aria-label":T,"aria-labelledby":E,"aria-describedby":D,...O},k)=>{let{t:A}=t.useWimTranslation(n.commonNs),{handleAriaLabel:j=A(`imageCompare.handle`)}=C??{},M=_!==void 0,[N,P]=(0,s.useState)(u(g)),F=u(M?_:N),I=y===`vertical`,L=(0,s.useRef)(null),R=(0,s.useRef)(!1),z=(0,s.useCallback)(e=>{L.current=e,typeof k==`function`?k(e):k&&(k.current=e)},[k]),B=(0,s.useCallback)(e=>{let t=u(e);M||P(t),v?.(t)},[M,v]),V=(0,s.useCallback)((e,t)=>{let n=L.current?.getBoundingClientRect();if(!n)return;let r=I?(t-n.top)/n.height*100:(e-n.left)/n.width*100;B(r)},[I,B]),H=e=>{R.current=!0,e.currentTarget.setPointerCapture(e.pointerId),V(e.clientX,e.clientY)},U=e=>{R.current&&V(e.clientX,e.clientY)},W=e=>{R.current=!1,e.currentTarget.releasePointerCapture?.(e.pointerId)},G=e=>{let t=e.shiftKey?10:2,n=I?`ArrowUp`:`ArrowLeft`,r=I?`ArrowDown`:`ArrowRight`;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))},K=I?{clipPath:`inset(0 0 ${100-F}% 0)`}:{clipPath:`inset(0 ${100-F}% 0 0)`},q=I?{top:`${F}%`}:{left:`${F}%`};return(0,l.jsxs)(`div`,{ref:z,className:(0,c.default)(`wim-image-compare`,o.default.root,I&&o.default.vertical,o.default[`radius-${S}`],w),
|
|
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,"aria-label":T,"aria-labelledby":E,"aria-describedby":D,...O},k)=>{let{t:A}=t.useWimTranslation(n.commonNs),{handleAriaLabel:j=A(`imageCompare.handle`)}=C??{},M=_!==void 0,[N,P]=(0,s.useState)(u(g)),F=u(M?_:N),I=y===`vertical`,L=(0,s.useRef)(null),R=(0,s.useRef)(!1),z=(0,s.useCallback)(e=>{L.current=e,typeof k==`function`?k(e):k&&(k.current=e)},[k]),B=(0,s.useCallback)(e=>{let t=u(e);M||P(t),v?.(t)},[M,v]),V=(0,s.useCallback)((e,t)=>{let n=L.current?.getBoundingClientRect();if(!n)return;let r=I?(t-n.top)/n.height*100:(e-n.left)/n.width*100;B(r)},[I,B]),H=e=>{R.current=!0,e.currentTarget.setPointerCapture(e.pointerId),V(e.clientX,e.clientY)},U=e=>{R.current&&V(e.clientX,e.clientY)},W=e=>{R.current=!1,e.currentTarget.releasePointerCapture?.(e.pointerId)},G=e=>{let t=e.shiftKey?10:2,n=I?`ArrowUp`:`ArrowLeft`,r=I?`ArrowDown`:`ArrowRight`;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))},K=I?{clipPath:`inset(0 0 ${100-F}% 0)`}:{clipPath:`inset(0 ${100-F}% 0 0)`},q=I?{top:`${F}%`}:{left:`${F}%`};return(0,l.jsxs)(`div`,{ref:z,className:(0,c.default)(`wim-image-compare`,o.default.root,I&&o.default.vertical,o.default[`radius-${S}`],w),onPointerDown:H,onPointerMove:U,onPointerUp:W,...O,style:{width:b,height:x,...O.style},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:K,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:q,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":E?void 0:T??j,"aria-labelledby":E,"aria-describedby":D,"aria-orientation":y,"aria-valuenow":Math.round(F),"aria-valuemin":0,"aria-valuemax":100,onKeyDown:G,onPointerDown:H,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;
|
|
@@ -33,14 +33,15 @@ var p = (e) => Math.max(0, Math.min(100, e)), m = o.forwardRef(({ before: o, aft
|
|
|
33
33
|
return /* @__PURE__ */ f("div", {
|
|
34
34
|
ref: H,
|
|
35
35
|
className: u("wim-image-compare", a.root, z && a.vertical, a[`radius-${T}`], D),
|
|
36
|
-
style: {
|
|
37
|
-
width: C,
|
|
38
|
-
height: w
|
|
39
|
-
},
|
|
40
36
|
onPointerDown: G,
|
|
41
37
|
onPointerMove: K,
|
|
42
38
|
onPointerUp: q,
|
|
43
39
|
...j,
|
|
40
|
+
style: {
|
|
41
|
+
width: C,
|
|
42
|
+
height: w,
|
|
43
|
+
...j.style
|
|
44
|
+
},
|
|
44
45
|
children: [
|
|
45
46
|
/* @__PURE__ */ d("img", {
|
|
46
47
|
className: a.image,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../_internal/mergeRefs.cjs"),n=require("./affix.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../_internal/mergeRefs.cjs"),n=require("../../_internal/observeMove.cjs"),r=require("./affix.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=i.default.forwardRef(function({offsetTop:e,offsetBottom:s,onChange:c,target:l=()=>window,children:u,className:d,style:f},p){let[m,h]=(0,i.useState)({isAffixed:!1}),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=(0,i.useRef)(null),y=(0,i.useRef)(!1),b=(0,i.useCallback)(()=>{if(!g.current)return;let t=l();if(!t)return;let n=g.current.getBoundingClientRect(),r=t===window||t instanceof Window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect(),i=!1,a,o;e!==void 0&&n.top<r.top+e?(i=!0,a={position:`fixed`,top:r.top+e,width:n.width,height:n.height,zIndex:1e3},o={width:n.width,height:n.height}):s!==void 0&&n.bottom>r.bottom-s&&(i=!0,a={position:`fixed`,bottom:window.innerHeight-r.bottom+s,width:n.width,height:n.height,zIndex:1e3},o={width:n.width,height:n.height}),i!==y.current&&(y.current=i,c?.(i)),h(e=>e.isAffixed===i&&JSON.stringify(e.affixStyle)===JSON.stringify(a)&&JSON.stringify(e.placeholderStyle)===JSON.stringify(o)?e:{isAffixed:i,affixStyle:a,placeholderStyle:o})},[e,s,l,c]);return(0,i.useEffect)(()=>{let e=l();if(!e)return;let t=()=>{v.current&&window.cancelAnimationFrame(v.current),v.current=window.requestAnimationFrame(b)};e.addEventListener(`scroll`,t),window.addEventListener(`resize`,t);let r=g.current?n.observeMove(g.current,t):void 0;return b(),()=>{e.removeEventListener(`scroll`,t),window.removeEventListener(`resize`,t),r?.(),v.current&&window.cancelAnimationFrame(v.current)}},[l,b]),(0,o.jsx)(`div`,{ref:t.mergeRefs(g,p),style:{...m.placeholderStyle,...f},className:(0,a.default)(d),children:(0,o.jsx)(`div`,{ref:_,className:(0,a.default)(`wim-affix`,r.default.root,m.isAffixed&&r.default.affixed),style:m.affixStyle,children:u})})});s.displayName=`Affix`,exports.Affix=s,exports.default=s;
|