wimui 0.62.2 → 0.63.1
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 +2 -0
- package/dist/components/_internal/observeMove.d.ts +16 -0
- package/dist/components/_internal/observeMove.js +44 -0
- 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/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/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/Textarea/Textarea.cjs +1 -1
- package/dist/components/form/Textarea/Textarea.js +4 -4
- package/dist/components/form/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/form/TimePicker/TimePicker.js +31 -30
- package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
- package/dist/components/layout/Dashboard/Dashboard.js +3 -2
- 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 -66
- 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 -73
- package/dist/components/media/Video/Video.cjs +1 -1
- package/dist/components/media/Video/Video.js +114 -113
- 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/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/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/overlay/Dropdown/Dropdown.js +42 -36
- package/dist/components/overlay/Popover/Popover.cjs +1 -1
- package/dist/components/overlay/Popover/Popover.js +1 -1
- 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
|
@@ -1,112 +1,113 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import n from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import u from "
|
|
8
|
-
import
|
|
3
|
+
import { composeEventHandlers as t } from "../../_internal/composeEventHandlers.js";
|
|
4
|
+
import { Icon as n } from "../../media/Icon/Icon.js";
|
|
5
|
+
import r from "./swipe-action.module.js";
|
|
6
|
+
import { useSwipeableList as i } from "./SwipeableList.js";
|
|
7
|
+
import a, { useEffect as o, useId as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
|
|
8
|
+
import d from "classnames";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/data-display/SwipeAction/SwipeAction.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var m = a.forwardRef(({ as: a = "div", leftActions: m = [], rightActions: h = [], children: g, asChild: _ = !1, id: v, closeOnAction: y = !0, fullSwipe: b, className: x, ...S }, C) => {
|
|
12
|
+
let w = s(), T = v || w, E = i(), [D, O] = u(0), [k, A] = u(!1), j = l(0), M = l(0), N = l(null);
|
|
13
|
+
c(C, () => ({ close: () => {
|
|
14
|
+
O(0), E?.reportClose(T);
|
|
14
15
|
} }));
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
16
|
+
let P = l(!1);
|
|
17
|
+
o(() => {
|
|
18
|
+
if (k) {
|
|
19
|
+
P.current = !0;
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
if (
|
|
22
|
+
if (P.current) {
|
|
22
23
|
let e = setTimeout(() => {
|
|
23
|
-
|
|
24
|
+
P.current = !1;
|
|
24
25
|
}, 100);
|
|
25
26
|
return () => clearTimeout(e);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
E?.openedId && E.openedId !== T && O(0);
|
|
28
29
|
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
E?.openedId,
|
|
31
|
+
T,
|
|
32
|
+
k
|
|
32
33
|
]);
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
if (!
|
|
37
|
-
let t = ("touches" in e ? e.touches[0].clientX : e.clientX) -
|
|
38
|
-
Math.abs(t) > 5 &&
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
41
|
-
if (
|
|
42
|
-
let t =
|
|
34
|
+
let F = m.length * 80, I = h.length * 80, L = F > 0 && (b === "left" || b === "both"), R = I > 0 && (b === "right" || b === "both"), z = N.current?.offsetWidth ?? 0, B = (e) => Math.max(e + 40, z / 2), V = k && L && D >= B(F) ? "left" : k && R && -D >= B(I) ? "right" : null, H = (e) => {
|
|
35
|
+
j.current = "touches" in e ? e.touches[0].clientX : e.clientX, M.current = D, A(!0);
|
|
36
|
+
}, U = (e) => {
|
|
37
|
+
if (!k) return;
|
|
38
|
+
let t = ("touches" in e ? e.touches[0].clientX : e.clientX) - j.current, n = M.current + t;
|
|
39
|
+
Math.abs(t) > 5 && E?.openedId !== T && E?.reportOpen(T), n > F && !L && (n = F + (n - F) * .3), n < -I && !R && (n = -I + (n + I) * .3), O(n);
|
|
40
|
+
}, W = (e = !0) => {
|
|
41
|
+
if (k) {
|
|
42
|
+
if (A(!1), V) {
|
|
43
|
+
let t = V === "left" ? m[0] : h[h.length - 1];
|
|
43
44
|
if (e) {
|
|
44
|
-
|
|
45
|
+
X(t), y || (O(V === "left" ? F : -I), E?.reportOpen(T));
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
D > F / 2 ? (O(F), E?.reportOpen(T)) : D < -I / 2 ? (O(-I), E?.reportOpen(T)) : (O(0), E?.reportClose(T));
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
-
let t = e === "left" ?
|
|
52
|
-
|
|
53
|
-
},
|
|
51
|
+
}, G = _ ? e : "div", K = l(null), q = F > 0 || I > 0, J = (e) => {
|
|
52
|
+
let t = e === "left" ? F : -I;
|
|
53
|
+
D !== t && O(t), E?.reportOpen(T);
|
|
54
|
+
}, Y = (e) => {
|
|
54
55
|
let t = e.relatedTarget;
|
|
55
|
-
t &&
|
|
56
|
-
},
|
|
57
|
-
e.onClick(),
|
|
58
|
-
},
|
|
59
|
-
let a = e === "left" ?
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
className:
|
|
56
|
+
t && N.current?.contains(t) || D !== 0 && !k && (O(0), E?.reportClose(T));
|
|
57
|
+
}, X = (e, t) => {
|
|
58
|
+
e.onClick(), y && (O(0), E?.reportClose(T), t && document.activeElement === t && K.current?.focus());
|
|
59
|
+
}, Z = (e, t, i) => {
|
|
60
|
+
let a = e === "left" ? L : R, o = e === "left" ? Math.max(0, D) : Math.max(0, -D), s = e === "left" ? 0 : t.length - 1;
|
|
61
|
+
return /* @__PURE__ */ f("div", {
|
|
62
|
+
className: d(r.actions, r[e], a && o > i && r.stretched, V === e && r.armed),
|
|
62
63
|
style: {
|
|
63
64
|
width: a ? Math.max(i, o) : i,
|
|
64
65
|
"--_action-w": "80px"
|
|
65
66
|
},
|
|
66
|
-
children:
|
|
67
|
-
className:
|
|
68
|
-
style: { backgroundColor:
|
|
69
|
-
onFocus: () =>
|
|
70
|
-
onClick: (e) =>
|
|
67
|
+
children: t.map((t, i) => /* @__PURE__ */ p("button", {
|
|
68
|
+
className: d(r.action, t.intent && r[t.intent], a && i === s && r.outer),
|
|
69
|
+
style: { backgroundColor: t.color },
|
|
70
|
+
onFocus: () => J(e),
|
|
71
|
+
onClick: (e) => X(t, e.currentTarget),
|
|
71
72
|
type: "button",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
name:
|
|
73
|
+
children: [/* @__PURE__ */ f(n, {
|
|
74
|
+
name: t.icon,
|
|
74
75
|
size: "md"
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
className:
|
|
77
|
-
children:
|
|
76
|
+
}), /* @__PURE__ */ f("span", {
|
|
77
|
+
className: r.label,
|
|
78
|
+
children: t.label
|
|
78
79
|
})]
|
|
79
80
|
}, i))
|
|
80
81
|
});
|
|
81
82
|
};
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
ref:
|
|
84
|
-
className:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
return /* @__PURE__ */ p(a, {
|
|
84
|
+
ref: N,
|
|
85
|
+
className: d("wim-swipe-action", r.container, x),
|
|
86
|
+
...S,
|
|
87
|
+
onMouseLeave: t(S.onMouseLeave, () => W(!1)),
|
|
88
|
+
onBlur: t(S.onBlur, Y),
|
|
88
89
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
ref:
|
|
91
|
-
className:
|
|
92
|
-
tabIndex:
|
|
90
|
+
/* @__PURE__ */ f(G, {
|
|
91
|
+
ref: K,
|
|
92
|
+
className: r.content,
|
|
93
|
+
tabIndex: q ? -1 : void 0,
|
|
93
94
|
style: {
|
|
94
|
-
transform: `translateX(${
|
|
95
|
-
transition:
|
|
95
|
+
transform: `translateX(${D}px)`,
|
|
96
|
+
transition: k ? "none" : "transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
96
97
|
},
|
|
97
|
-
onTouchStart:
|
|
98
|
-
onTouchMove:
|
|
99
|
-
onTouchEnd: () =>
|
|
100
|
-
onMouseDown:
|
|
101
|
-
onMouseMove:
|
|
102
|
-
onMouseUp: () =>
|
|
103
|
-
children:
|
|
98
|
+
onTouchStart: H,
|
|
99
|
+
onTouchMove: U,
|
|
100
|
+
onTouchEnd: () => W(),
|
|
101
|
+
onMouseDown: H,
|
|
102
|
+
onMouseMove: U,
|
|
103
|
+
onMouseUp: () => W(),
|
|
104
|
+
children: g
|
|
104
105
|
}),
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
F > 0 && Z("left", m, F),
|
|
107
|
+
I > 0 && Z("right", h, I)
|
|
107
108
|
]
|
|
108
109
|
});
|
|
109
110
|
});
|
|
110
|
-
|
|
111
|
+
m.displayName = "SwipeAction";
|
|
111
112
|
//#endregion
|
|
112
|
-
export {
|
|
113
|
+
export { m as SwipeAction };
|
|
@@ -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
|
});
|