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,37 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import t from "
|
|
4
|
-
import
|
|
5
|
-
import r from "
|
|
6
|
-
import i
|
|
7
|
-
import f from "
|
|
8
|
-
import
|
|
3
|
+
import { composeEventHandlers as t } from "../../_internal/composeEventHandlers.js";
|
|
4
|
+
import n from "../../../icon/chevron-down.js";
|
|
5
|
+
import { Icon as r } from "../../media/Icon/Icon.js";
|
|
6
|
+
import i from "./accordion.module.js";
|
|
7
|
+
import a, { createContext as o, forwardRef as s, useCallback as c, useContext as l, useId as u, useMemo as d, useState as f } from "react";
|
|
8
|
+
import p from "classnames";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/data-display/Accordion/Accordion.tsx
|
|
10
|
-
var
|
|
11
|
-
let e =
|
|
11
|
+
var g = o(null), _ = () => {
|
|
12
|
+
let e = l(g);
|
|
12
13
|
if (!e) throw Error("Accordion components must be used within an Accordion");
|
|
13
14
|
return e;
|
|
14
|
-
},
|
|
15
|
-
let x =
|
|
15
|
+
}, v = s(function({ type: t = "single", defaultValue: n, value: r, onChange: o, collapsible: s = !0, className: l, children: h, id: _, asChild: v, ...y }, b) {
|
|
16
|
+
let x = u(), S = _ || x, [C, w] = f(() => n ? Array.isArray(n) ? n : [n] : []), T = a.useRef(null), E = (e) => {
|
|
16
17
|
T.current = e, typeof b == "function" ? b(e) : b && (b.current = e);
|
|
17
|
-
}, D =
|
|
18
|
-
let e = D ?
|
|
18
|
+
}, D = r !== void 0, O = d(() => {
|
|
19
|
+
let e = D ? r : C;
|
|
19
20
|
return Array.isArray(e) ? e : e ? [e] : [];
|
|
20
21
|
}, [
|
|
21
22
|
D,
|
|
22
|
-
|
|
23
|
+
r,
|
|
23
24
|
C
|
|
24
|
-
]), k =
|
|
25
|
+
]), k = c((e) => {
|
|
25
26
|
let n;
|
|
26
|
-
n = t === "single" ? O.includes(e) &&
|
|
27
|
+
n = t === "single" ? O.includes(e) && s ? [] : [e] : O.includes(e) ? O.filter((t) => t !== e) : [...O, e], D || w(n), o?.(t === "single" ? n[0] ?? "" : n);
|
|
27
28
|
}, [
|
|
28
29
|
O,
|
|
29
|
-
|
|
30
|
+
s,
|
|
30
31
|
D,
|
|
31
32
|
o,
|
|
32
33
|
t
|
|
33
34
|
]), A = v ? e : "div";
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ m(g.Provider, {
|
|
35
36
|
value: {
|
|
36
37
|
value: O,
|
|
37
38
|
onValueChange: k,
|
|
@@ -39,95 +40,95 @@ var h = a(null), g = () => {
|
|
|
39
40
|
accordionId: S,
|
|
40
41
|
containerRef: T
|
|
41
42
|
},
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ m(A, {
|
|
43
44
|
ref: E,
|
|
44
|
-
className:
|
|
45
|
+
className: p("wim-accordion", i.root, l),
|
|
45
46
|
...y,
|
|
46
|
-
children:
|
|
47
|
+
children: h
|
|
47
48
|
})
|
|
48
49
|
});
|
|
49
|
-
}),
|
|
50
|
-
let { value: l, accordionId: u } =
|
|
51
|
-
return /* @__PURE__ */
|
|
50
|
+
}), y = o(null), b = s(function({ value: t, disabled: n = !1, className: r, children: a, asChild: o, ...s }, c) {
|
|
51
|
+
let { value: l, accordionId: u } = _(), d = l.includes(t), f = `wim-accordion-trigger-${u}-${t}`, h = `wim-accordion-content-${u}-${t}`, g = o ? e : "div";
|
|
52
|
+
return /* @__PURE__ */ m(y.Provider, {
|
|
52
53
|
value: {
|
|
53
54
|
value: t,
|
|
54
55
|
disabled: n,
|
|
55
56
|
isLogicOpen: d,
|
|
56
|
-
triggerId:
|
|
57
|
+
triggerId: f,
|
|
57
58
|
contentId: h
|
|
58
59
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ m(g, {
|
|
60
61
|
ref: c,
|
|
61
|
-
className:
|
|
62
|
+
className: p(i.item, n && i.disabled, d && i.open, r),
|
|
62
63
|
...s,
|
|
63
64
|
children: a
|
|
64
65
|
})
|
|
65
66
|
});
|
|
66
|
-
}),
|
|
67
|
-
let { onValueChange:
|
|
68
|
-
if (!
|
|
69
|
-
let
|
|
70
|
-
if (
|
|
67
|
+
}), x = s(function({ children: a, className: o, asChild: s, ...c }, u) {
|
|
68
|
+
let { onValueChange: d } = _(), f = l(y);
|
|
69
|
+
if (!f) throw Error("AccordionTrigger must be used within AccordionItem");
|
|
70
|
+
let g = (e) => {
|
|
71
|
+
if (f.disabled) {
|
|
71
72
|
e.preventDefault();
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
-
}, { containerRef:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
-
className:
|
|
106
|
-
children:
|
|
107
|
-
}), /* @__PURE__ */
|
|
108
|
-
component:
|
|
109
|
-
className:
|
|
75
|
+
d(f.value);
|
|
76
|
+
}, { containerRef: v } = _(), b = (e) => {
|
|
77
|
+
if (f.disabled) return;
|
|
78
|
+
let t = Array.from(v.current?.querySelectorAll(`.${i.trigger}:not(:disabled)`) || []), n = t.indexOf(e.currentTarget);
|
|
79
|
+
switch (e.key) {
|
|
80
|
+
case "ArrowDown":
|
|
81
|
+
e.preventDefault(), t[(n + 1) % t.length]?.focus();
|
|
82
|
+
break;
|
|
83
|
+
case "ArrowUp":
|
|
84
|
+
e.preventDefault(), t[(n - 1 + t.length) % t.length]?.focus();
|
|
85
|
+
break;
|
|
86
|
+
case "Home":
|
|
87
|
+
e.preventDefault(), t[0]?.focus();
|
|
88
|
+
break;
|
|
89
|
+
case "End": e.preventDefault(), t[t.length - 1]?.focus();
|
|
90
|
+
}
|
|
91
|
+
c.onKeyDown?.(e);
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ h(s ? e : "button", {
|
|
94
|
+
ref: u,
|
|
95
|
+
type: s ? void 0 : "button",
|
|
96
|
+
id: f.triggerId,
|
|
97
|
+
className: p(i.trigger, o),
|
|
98
|
+
"aria-expanded": f.isLogicOpen,
|
|
99
|
+
"aria-controls": f.contentId,
|
|
100
|
+
"aria-disabled": f.disabled,
|
|
101
|
+
disabled: f.disabled,
|
|
102
|
+
...c,
|
|
103
|
+
onKeyDown: b,
|
|
104
|
+
onClick: t(c.onClick, g),
|
|
105
|
+
children: [/* @__PURE__ */ m("span", {
|
|
106
|
+
className: i.triggerContent,
|
|
107
|
+
children: a
|
|
108
|
+
}), /* @__PURE__ */ m(r, {
|
|
109
|
+
component: n,
|
|
110
|
+
className: p(i.chevron, f.isLogicOpen && i.open)
|
|
110
111
|
})]
|
|
111
112
|
});
|
|
112
|
-
}),
|
|
113
|
-
let s =
|
|
113
|
+
}), S = s(function({ children: t, className: n, asChild: r, ...a }, o) {
|
|
114
|
+
let s = l(y);
|
|
114
115
|
if (!s) throw Error("AccordionContent must be used within AccordionItem");
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ m(r ? e : "div", {
|
|
116
117
|
ref: o,
|
|
117
118
|
id: s.contentId,
|
|
118
119
|
role: "region",
|
|
119
120
|
"aria-labelledby": s.triggerId,
|
|
120
|
-
className:
|
|
121
|
+
className: p(i.content, s.isLogicOpen && i.open, n),
|
|
121
122
|
...a,
|
|
122
|
-
children: /* @__PURE__ */
|
|
123
|
-
className:
|
|
124
|
-
children: /* @__PURE__ */
|
|
125
|
-
className:
|
|
123
|
+
children: /* @__PURE__ */ m("div", {
|
|
124
|
+
className: i.contentInner,
|
|
125
|
+
children: /* @__PURE__ */ m("div", {
|
|
126
|
+
className: i.contentBody,
|
|
126
127
|
children: t
|
|
127
128
|
})
|
|
128
129
|
})
|
|
129
130
|
});
|
|
130
|
-
}),
|
|
131
|
-
|
|
131
|
+
}), C = v;
|
|
132
|
+
C.Item = b, C.Trigger = x, C.Content = S, C.displayName = "Accordion", b.displayName = "Accordion.Item", x.displayName = "Accordion.Trigger", S.displayName = "Accordion.Content";
|
|
132
133
|
//#endregion
|
|
133
|
-
export {
|
|
134
|
+
export { C as Accordion, C as default, S as AccordionContent, b as AccordionItem, x as AccordionTrigger };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../../icon/chevron-down.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../_internal/composeEventHandlers.cjs"),a=require("../../../icon/chevron-down.cjs"),o=require("../../../icon/loading.cjs"),s=require("../../media/Icon/Icon.cjs"),c=require("./pull-to-refresh.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(({onRefresh:e,refreshing:f,threshold:p=60,maxDistance:m=120,children:h,asChild:g=!1,className:_,...v},y)=>{let{t:b}=n.useWimTranslation(r.commonNs),[x,S]=(0,l.useState)(0),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(`idle`),k=(0,l.useRef)(0),A=(0,l.useRef)(!1),j=(0,l.useRef)(!1),M=(0,l.useRef)(void 0);(0,l.useEffect)(()=>()=>clearTimeout(M.current),[]);let N=f??C;(0,l.useEffect)(()=>{N?(O(`refreshing`),S(p)):(O(`idle`),S(0))},[N,p]);let P=(0,l.useCallback)(e=>{if(!A.current||N)return;let t=(`touches`in e?e.touches[0].clientY:e.clientY)-k.current;if(t>0){e.cancelable&&e.preventDefault();let n=Math.min(t*.4,m);S(n),O(n>p?`releasing`:`pulling`)}else t<-10&&(A.current=!1,j.current=!1,E(!1),S(0),O(`idle`))},[m,p,N]),F=(0,l.useCallback)(async()=>{if(!A.current)return;let t=x>=p;if(A.current=!1,j.current=!1,E(!1),t&&!N){w(!0),O(`refreshing`),S(p);try{await e()}finally{clearTimeout(M.current),M.current=setTimeout(()=>{w(!1),f===void 0&&(O(`idle`),S(0))},50)}}else N||(S(0),O(`idle`))},[x,p,N,e,f]),I=e=>{e.currentTarget.scrollTop>0||N||(k.current=`touches`in e?e.touches[0].clientY:e.clientY,A.current=!0,j.current=!0,E(!0))};(0,l.useEffect)(()=>{if(!T)return;let e=e=>P(e),t=()=>F();return window.addEventListener(`mousemove`,e,{passive:!1}),window.addEventListener(`mouseup`,t),window.addEventListener(`touchmove`,e,{passive:!1}),window.addEventListener(`touchend`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t),window.removeEventListener(`touchmove`,e),window.removeEventListener(`touchend`,t)}},[T,P,F]);let L=g?t.Root:`div`;return(0,d.jsxs)(`div`,{className:(0,u.default)(`wim-pull-to-refresh`,c.default.container,_),role:`none`,...v,onTouchStart:i.composeEventHandlers(v.onTouchStart,I),onMouseDown:i.composeEventHandlers(v.onMouseDown,I),children:[(0,d.jsx)(`div`,{className:(0,u.default)(c.default.indicator,c.default[D]),style:{height:x,opacity:+(x>0),transition:T?`none`:`all 0.3s cubic-bezier(0.16, 1, 0.3, 1)`},children:(0,d.jsxs)(`div`,{className:c.default.indicatorContent,children:[D===`refreshing`?(0,d.jsx)(s.Icon,{component:o.default,spin:!0,className:c.default.spinner}):(0,d.jsx)(s.Icon,{component:a.default,className:(0,u.default)(c.default.arrow,D===`releasing`&&c.default.rotate)}),(0,d.jsx)(`span`,{className:c.default.text,children:b(D===`refreshing`?`pullToRefresh.loading`:D===`releasing`?`pullToRefresh.release`:`pullToRefresh.pull`)})]})}),(0,d.jsx)(L,{ref:y,className:c.default.content,children:h})]})});f.displayName=`PullToRefresh`,exports.PullToRefresh=f;
|
|
@@ -2,101 +2,102 @@
|
|
|
2
2
|
import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useWimTranslation as t } from "../../../i18n/useWimTranslation.js";
|
|
4
4
|
import { commonNs as n } from "../../../i18n/generated/common.js";
|
|
5
|
-
import r from "
|
|
6
|
-
import i from "../../../icon/
|
|
7
|
-
import
|
|
8
|
-
import o from "
|
|
9
|
-
import s
|
|
10
|
-
import f from "
|
|
11
|
-
import
|
|
5
|
+
import { composeEventHandlers as r } from "../../_internal/composeEventHandlers.js";
|
|
6
|
+
import i from "../../../icon/chevron-down.js";
|
|
7
|
+
import a from "../../../icon/loading.js";
|
|
8
|
+
import { Icon as o } from "../../media/Icon/Icon.js";
|
|
9
|
+
import s from "./pull-to-refresh.module.js";
|
|
10
|
+
import c, { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
|
|
11
|
+
import p from "classnames";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/data-display/PullToRefresh/PullToRefresh.tsx
|
|
13
|
-
var
|
|
14
|
-
let { t:
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
let
|
|
21
|
-
if (!
|
|
22
|
-
let t = ("touches" in e ? e.touches[0].clientY : e.clientY) -
|
|
14
|
+
var g = c.forwardRef(({ onRefresh: c, refreshing: g, threshold: _ = 60, maxDistance: v = 120, children: y, asChild: b = !1, className: x, ...S }, C) => {
|
|
15
|
+
let { t: w } = t(n), [T, E] = f(0), [D, O] = f(!1), [k, A] = f(!1), [j, M] = f("idle"), N = d(0), P = d(!1), F = d(!1), I = d(void 0);
|
|
16
|
+
u(() => () => clearTimeout(I.current), []);
|
|
17
|
+
let L = g ?? D;
|
|
18
|
+
u(() => {
|
|
19
|
+
L ? (M("refreshing"), E(_)) : (M("idle"), E(0));
|
|
20
|
+
}, [L, _]);
|
|
21
|
+
let R = l((e) => {
|
|
22
|
+
if (!P.current || L) return;
|
|
23
|
+
let t = ("touches" in e ? e.touches[0].clientY : e.clientY) - N.current;
|
|
23
24
|
if (t > 0) {
|
|
24
25
|
e.cancelable && e.preventDefault();
|
|
25
|
-
let n = Math.min(t * .4,
|
|
26
|
-
|
|
27
|
-
} else t < -10 && (
|
|
26
|
+
let n = Math.min(t * .4, v);
|
|
27
|
+
E(n), M(n > _ ? "releasing" : "pulling");
|
|
28
|
+
} else t < -10 && (P.current = !1, F.current = !1, A(!1), E(0), M("idle"));
|
|
28
29
|
}, [
|
|
30
|
+
v,
|
|
29
31
|
_,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
D(!0), j("refreshing"), T(g);
|
|
32
|
+
L
|
|
33
|
+
]), z = l(async () => {
|
|
34
|
+
if (!P.current) return;
|
|
35
|
+
let e = T >= _;
|
|
36
|
+
if (P.current = !1, F.current = !1, A(!1), e && !L) {
|
|
37
|
+
O(!0), M("refreshing"), E(_);
|
|
37
38
|
try {
|
|
38
|
-
await
|
|
39
|
+
await c();
|
|
39
40
|
} finally {
|
|
40
|
-
clearTimeout(
|
|
41
|
-
|
|
41
|
+
clearTimeout(I.current), I.current = setTimeout(() => {
|
|
42
|
+
O(!1), g === void 0 && (M("idle"), E(0));
|
|
42
43
|
}, 50);
|
|
43
44
|
}
|
|
44
|
-
} else
|
|
45
|
+
} else L || (E(0), M("idle"));
|
|
45
46
|
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]),
|
|
52
|
-
e.currentTarget.scrollTop > 0 ||
|
|
47
|
+
T,
|
|
48
|
+
_,
|
|
49
|
+
L,
|
|
50
|
+
c,
|
|
51
|
+
g
|
|
52
|
+
]), B = (e) => {
|
|
53
|
+
e.currentTarget.scrollTop > 0 || L || (N.current = "touches" in e ? e.touches[0].clientY : e.clientY, P.current = !0, F.current = !0, A(!0));
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
if (!
|
|
56
|
-
let e = (e) =>
|
|
55
|
+
u(() => {
|
|
56
|
+
if (!k) return;
|
|
57
|
+
let e = (e) => R(e), t = () => z();
|
|
57
58
|
return window.addEventListener("mousemove", e, { passive: !1 }), window.addEventListener("mouseup", t), window.addEventListener("touchmove", e, { passive: !1 }), window.addEventListener("touchend", t), () => {
|
|
58
59
|
window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t), window.removeEventListener("touchmove", e), window.removeEventListener("touchend", t);
|
|
59
60
|
};
|
|
60
61
|
}, [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
k,
|
|
63
|
+
R,
|
|
64
|
+
z
|
|
64
65
|
]);
|
|
65
|
-
let
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
className:
|
|
66
|
+
let V = b ? e : "div";
|
|
67
|
+
return /* @__PURE__ */ h("div", {
|
|
68
|
+
className: p("wim-pull-to-refresh", s.container, x),
|
|
68
69
|
role: "none",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
className:
|
|
70
|
+
...S,
|
|
71
|
+
onTouchStart: r(S.onTouchStart, B),
|
|
72
|
+
onMouseDown: r(S.onMouseDown, B),
|
|
73
|
+
children: [/* @__PURE__ */ m("div", {
|
|
74
|
+
className: p(s.indicator, s[j]),
|
|
74
75
|
style: {
|
|
75
|
-
height:
|
|
76
|
-
opacity: +(
|
|
77
|
-
transition:
|
|
76
|
+
height: T,
|
|
77
|
+
opacity: +(T > 0),
|
|
78
|
+
transition: k ? "none" : "all 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
78
79
|
},
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
className:
|
|
81
|
-
children: [
|
|
82
|
-
component:
|
|
80
|
+
children: /* @__PURE__ */ h("div", {
|
|
81
|
+
className: s.indicatorContent,
|
|
82
|
+
children: [j === "refreshing" ? /* @__PURE__ */ m(o, {
|
|
83
|
+
component: a,
|
|
83
84
|
spin: !0,
|
|
84
|
-
className:
|
|
85
|
-
}) : /* @__PURE__ */
|
|
86
|
-
component:
|
|
87
|
-
className:
|
|
88
|
-
}), /* @__PURE__ */
|
|
89
|
-
className:
|
|
90
|
-
children:
|
|
85
|
+
className: s.spinner
|
|
86
|
+
}) : /* @__PURE__ */ m(o, {
|
|
87
|
+
component: i,
|
|
88
|
+
className: p(s.arrow, j === "releasing" && s.rotate)
|
|
89
|
+
}), /* @__PURE__ */ m("span", {
|
|
90
|
+
className: s.text,
|
|
91
|
+
children: w(j === "refreshing" ? "pullToRefresh.loading" : j === "releasing" ? "pullToRefresh.release" : "pullToRefresh.pull")
|
|
91
92
|
})]
|
|
92
93
|
})
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
-
ref:
|
|
95
|
-
className:
|
|
96
|
-
children:
|
|
94
|
+
}), /* @__PURE__ */ m(V, {
|
|
95
|
+
ref: C,
|
|
96
|
+
className: s.content,
|
|
97
|
+
children: y
|
|
97
98
|
})]
|
|
98
99
|
});
|
|
99
100
|
});
|
|
100
|
-
|
|
101
|
+
g.displayName = "PullToRefresh";
|
|
101
102
|
//#endregion
|
|
102
|
-
export {
|
|
103
|
+
export { g as PullToRefresh };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/components.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../_internal/composeEventHandlers.cjs"),i=require("../../../i18n/generated/components.cjs"),a=require("../../../icon/grip-vertical.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../_internal/mergeRefs.cjs"),c=require("./sortable-list.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=(0,l.createContext)(null),p=()=>{let e=(0,l.useContext)(f);if(!e)throw Error(`SortableList compound components must be used within SortableList`);return e},m=l.default.forwardRef(({asChild:e=!1,className:n,children:r,onSortEnd:i,disabled:a=!1,...o},s)=>{let[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),_=(0,l.useCallback)((e,t)=>{e!==t&&i?.(e,t)},[i]),v=e?t.Root:`ul`;return(0,d.jsx)(f.Provider,{value:{draggingIndex:p,overIndex:h,setDraggingIndex:m,setOverIndex:g,onMove:_,disabled:a},children:(0,d.jsx)(v,{ref:s,className:(0,u.default)(`wim-sortable-list`,c.default.root,n),...o,children:(0,d.jsx)(t.Slottable,{children:r})})})});m.displayName=`SortableList`;var h=l.default.forwardRef(({asChild:e=!1,index:a,disabled:o=!1,className:f,children:m,...h},g)=>{let{draggingIndex:_,overIndex:v,setDraggingIndex:y,setOverIndex:b,onMove:x,disabled:S}=p(),C=(0,l.useRef)(null),{t:w}=n.useWimTranslation(i.componentsNs),T=S||o,E=_===a,D=v===a,O=e=>{T||(y(a),e.dataTransfer.effectAllowed=`move`,C.current&&e.dataTransfer.setDragImage(C.current,20,20))},k=e=>{e.preventDefault(),!(T||_===null||_===a)&&b(a)},A=()=>{y(null),b(null)},j=e=>{e.preventDefault(),_!==null&&_!==a&&x(_,a),y(null),b(null)},M=e=>{T||(e.key===`ArrowUp`?(e.preventDefault(),a>0&&x(a,a-1)):e.key===`ArrowDown`&&(e.preventDefault(),x(a,a+1)))};return(0,d.jsx)(e?t.Root:`li`,{ref:s.mergeRefs(g,C),className:(0,u.default)(c.default.item,E&&c.default.dragging,D&&c.default.over,T&&c.default.disabled,f),draggable:!T,tabIndex:T?-1:0,role:`listitem`,"aria-label":w(`sortable_list.drag_handle_label`),...h,onDragStart:e=>r.composeEventHandlers(h.onDragStart,O)(e),onDragOver:r.composeEventHandlers(h.onDragOver,k),onDragEnd:r.composeEventHandlers(h.onDragEnd,A),onDrop:r.composeEventHandlers(h.onDrop,j),onKeyDown:r.composeEventHandlers(h.onKeyDown,M),children:(0,d.jsx)(t.Slottable,{children:m})})}),g=l.default.forwardRef(({asChild:e=!1,className:n,...r},i)=>(0,d.jsx)(e?t.Root:`div`,{ref:i,className:(0,u.default)(c.default.dragHandle,n),...r,children:(0,d.jsx)(o.Icon,{component:a.default,size:`sm`})})),_=m;_.Item=h,_.DragHandle=g,_.displayName=`SortableList`,h.displayName=`SortableList.Item`,g.displayName=`SortableList.DragHandle`,exports.SortableList=_,exports.default=_,exports.SortableListDragHandle=g,exports.SortableListItem=h;
|
|
@@ -1,77 +1,78 @@
|
|
|
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 { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
4
|
-
import {
|
|
5
|
-
import i from "../../../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import s from "
|
|
9
|
-
import c
|
|
10
|
-
import m from "
|
|
11
|
-
import
|
|
4
|
+
import { composeEventHandlers as r } from "../../_internal/composeEventHandlers.js";
|
|
5
|
+
import { componentsNs as i } from "../../../i18n/generated/components.js";
|
|
6
|
+
import a from "../../../icon/grip-vertical.js";
|
|
7
|
+
import { Icon as o } from "../../media/Icon/Icon.js";
|
|
8
|
+
import { mergeRefs as s } from "../../_internal/mergeRefs.js";
|
|
9
|
+
import c from "./sortable-list.module.js";
|
|
10
|
+
import l, { createContext as u, useCallback as d, useContext as f, useRef as p, useState as m } from "react";
|
|
11
|
+
import h from "classnames";
|
|
12
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/data-display/SortableList/SortableList.tsx
|
|
13
|
-
var
|
|
14
|
-
let e =
|
|
14
|
+
var _ = u(null), v = () => {
|
|
15
|
+
let e = f(_);
|
|
15
16
|
if (!e) throw Error("SortableList compound components must be used within SortableList");
|
|
16
17
|
return e;
|
|
17
|
-
},
|
|
18
|
-
let [
|
|
18
|
+
}, y = l.forwardRef(({ asChild: n = !1, className: r, children: i, onSortEnd: a, disabled: o = !1, ...s }, l) => {
|
|
19
|
+
let [u, f] = m(null), [p, v] = m(null), y = d((e, t) => {
|
|
19
20
|
e !== t && a?.(e, t);
|
|
20
21
|
}, [a]), b = n ? e : "ul";
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ g(_.Provider, {
|
|
22
23
|
value: {
|
|
23
|
-
draggingIndex:
|
|
24
|
-
overIndex:
|
|
24
|
+
draggingIndex: u,
|
|
25
|
+
overIndex: p,
|
|
25
26
|
setDraggingIndex: f,
|
|
26
27
|
setOverIndex: v,
|
|
27
28
|
onMove: y,
|
|
28
29
|
disabled: o
|
|
29
30
|
},
|
|
30
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ g(b, {
|
|
31
32
|
ref: l,
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
children: /* @__PURE__ */
|
|
33
|
+
className: h("wim-sortable-list", c.root, r),
|
|
34
|
+
...s,
|
|
35
|
+
children: /* @__PURE__ */ g(t, { children: i })
|
|
35
36
|
})
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
let { draggingIndex:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
onKeyDown: (e) => {
|
|
58
|
-
T || (e.key === "ArrowUp" ? (e.preventDefault(), a > 0 && x(a, a - 1)) : e.key === "ArrowDown" && (e.preventDefault(), x(a, a + 1)));
|
|
59
|
-
},
|
|
60
|
-
tabIndex: T ? -1 : 0,
|
|
39
|
+
y.displayName = "SortableList";
|
|
40
|
+
var b = l.forwardRef(({ asChild: a = !1, index: o, disabled: l = !1, className: u, children: d, ...f }, m) => {
|
|
41
|
+
let { draggingIndex: _, overIndex: y, setDraggingIndex: b, setOverIndex: x, onMove: S, disabled: C } = v(), w = p(null), { t: T } = n(i), E = C || l, D = _ === o, O = y === o, k = (e) => {
|
|
42
|
+
E || (b(o), e.dataTransfer.effectAllowed = "move", w.current && e.dataTransfer.setDragImage(w.current, 20, 20));
|
|
43
|
+
}, A = (e) => {
|
|
44
|
+
e.preventDefault(), !(E || _ === null || _ === o) && x(o);
|
|
45
|
+
}, j = () => {
|
|
46
|
+
b(null), x(null);
|
|
47
|
+
}, M = (e) => {
|
|
48
|
+
e.preventDefault(), _ !== null && _ !== o && S(_, o), b(null), x(null);
|
|
49
|
+
}, N = (e) => {
|
|
50
|
+
E || (e.key === "ArrowUp" ? (e.preventDefault(), o > 0 && S(o, o - 1)) : e.key === "ArrowDown" && (e.preventDefault(), S(o, o + 1)));
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ g(a ? e : "li", {
|
|
53
|
+
ref: s(m, w),
|
|
54
|
+
className: h(c.item, D && c.dragging, O && c.over, E && c.disabled, u),
|
|
55
|
+
draggable: !E,
|
|
56
|
+
tabIndex: E ? -1 : 0,
|
|
61
57
|
role: "listitem",
|
|
62
|
-
"aria-label":
|
|
63
|
-
...
|
|
64
|
-
|
|
58
|
+
"aria-label": T("sortable_list.drag_handle_label"),
|
|
59
|
+
...f,
|
|
60
|
+
onDragStart: (e) => r(f.onDragStart, k)(e),
|
|
61
|
+
onDragOver: r(f.onDragOver, A),
|
|
62
|
+
onDragEnd: r(f.onDragEnd, j),
|
|
63
|
+
onDrop: r(f.onDrop, M),
|
|
64
|
+
onKeyDown: r(f.onKeyDown, N),
|
|
65
|
+
children: /* @__PURE__ */ g(t, { children: d })
|
|
65
66
|
});
|
|
66
|
-
}),
|
|
67
|
-
ref:
|
|
68
|
-
className:
|
|
67
|
+
}), x = l.forwardRef(({ asChild: t = !1, className: n, ...r }, i) => /* @__PURE__ */ g(t ? e : "div", {
|
|
68
|
+
ref: i,
|
|
69
|
+
className: h(c.dragHandle, n),
|
|
69
70
|
...r,
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
component:
|
|
71
|
+
children: /* @__PURE__ */ g(o, {
|
|
72
|
+
component: a,
|
|
72
73
|
size: "sm"
|
|
73
74
|
})
|
|
74
|
-
})),
|
|
75
|
-
|
|
75
|
+
})), S = y;
|
|
76
|
+
S.Item = b, S.DragHandle = x, S.displayName = "SortableList", b.displayName = "SortableList.Item", x.displayName = "SortableList.DragHandle";
|
|
76
77
|
//#endregion
|
|
77
|
-
export {
|
|
78
|
+
export { S as SortableList, S as default, x as SortableListDragHandle, b as SortableListItem };
|
|
@@ -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("../../media/Icon/Icon.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../_internal/composeEventHandlers.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("./swipe-action.module.cjs"),a=require("./SwipeableList.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(({as:e=`div`,leftActions:l=[],rightActions:u=[],children:d,asChild:f=!1,id:p,closeOnAction:m=!0,fullSwipe:h,className:g,..._},v)=>{let y=(0,o.useId)(),b=p||y,x=a.useSwipeableList(),[S,C]=(0,o.useState)(0),[w,T]=(0,o.useState)(!1),E=(0,o.useRef)(0),D=(0,o.useRef)(0),O=(0,o.useRef)(null);(0,o.useImperativeHandle)(v,()=>({close:()=>{C(0),x?.reportClose(b)}}));let k=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(w){k.current=!0;return}if(k.current){let e=setTimeout(()=>{k.current=!1},100);return()=>clearTimeout(e)}x?.openedId&&x.openedId!==b&&C(0)},[x?.openedId,b,w]);let A=l.length*80,j=u.length*80,M=A>0&&(h===`left`||h===`both`),N=j>0&&(h===`right`||h===`both`),P=O.current?.offsetWidth??0,F=e=>Math.max(e+40,P/2),I=w&&M&&S>=F(A)?`left`:w&&N&&-S>=F(j)?`right`:null,L=e=>{E.current=`touches`in e?e.touches[0].clientX:e.clientX,D.current=S,T(!0)},R=e=>{if(!w)return;let t=(`touches`in e?e.touches[0].clientX:e.clientX)-E.current,n=D.current+t;Math.abs(t)>5&&x?.openedId!==b&&x?.reportOpen(b),n>A&&!M&&(n=A+(n-A)*.3),n<-j&&!N&&(n=-j+(n+j)*.3),C(n)},z=(e=!0)=>{if(w){if(T(!1),I){let t=I===`left`?l[0]:u[u.length-1];if(e){G(t),m||(C(I===`left`?A:-j),x?.reportOpen(b));return}}S>A/2?(C(A),x?.reportOpen(b)):S<-j/2?(C(-j),x?.reportOpen(b)):(C(0),x?.reportClose(b))}},B=f?t.Root:`div`,V=(0,o.useRef)(null),H=A>0||j>0,U=e=>{let t=e===`left`?A:-j;S!==t&&C(t),x?.reportOpen(b)},W=e=>{let t=e.relatedTarget;t&&O.current?.contains(t)||S!==0&&!w&&(C(0),x?.reportClose(b))},G=(e,t)=>{e.onClick(),m&&(C(0),x?.reportClose(b),t&&document.activeElement===t&&V.current?.focus())},K=(e,t,n)=>{let a=e===`left`?M:N,o=e===`left`?Math.max(0,S):Math.max(0,-S),l=e===`left`?0:t.length-1;return(0,c.jsx)(`div`,{className:(0,s.default)(i.default.actions,i.default[e],a&&o>n&&i.default.stretched,I===e&&i.default.armed),style:{width:a?Math.max(n,o):n,"--_action-w":`80px`},children:t.map((t,n)=>(0,c.jsxs)(`button`,{className:(0,s.default)(i.default.action,t.intent&&i.default[t.intent],a&&n===l&&i.default.outer),style:{backgroundColor:t.color},onFocus:()=>U(e),onClick:e=>G(t,e.currentTarget),type:`button`,children:[(0,c.jsx)(r.Icon,{name:t.icon,size:`md`}),(0,c.jsx)(`span`,{className:i.default.label,children:t.label})]},n))})};return(0,c.jsxs)(e,{ref:O,className:(0,s.default)(`wim-swipe-action`,i.default.container,g),..._,onMouseLeave:n.composeEventHandlers(_.onMouseLeave,()=>z(!1)),onBlur:n.composeEventHandlers(_.onBlur,W),children:[(0,c.jsx)(B,{ref:V,className:i.default.content,tabIndex:H?-1:void 0,style:{transform:`translateX(${S}px)`,transition:w?`none`:`transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)`},onTouchStart:L,onTouchMove:R,onTouchEnd:()=>z(),onMouseDown:L,onMouseMove:R,onMouseUp:()=>z(),children:d}),A>0&&K(`left`,l,A),j>0&&K(`right`,u,j)]})});l.displayName=`SwipeAction`,exports.SwipeAction=l;
|