wimui 0.63.0 → 0.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/_internal/OverlayBase.cjs +1 -1
- package/dist/components/_internal/OverlayBase.js +31 -30
- package/dist/components/_internal/composeEventHandlers.cjs +2 -0
- package/dist/components/_internal/composeEventHandlers.d.ts +25 -0
- package/dist/components/_internal/composeEventHandlers.js +8 -0
- package/dist/components/_internal/observeMove.cjs +1 -1
- package/dist/components/_internal/observeMove.js +3 -1
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.js +83 -82
- package/dist/components/data-display/Accordion/Accordion.cjs +1 -1
- package/dist/components/data-display/Accordion/Accordion.js +79 -78
- package/dist/components/data-display/PullToRefresh/PullToRefresh.cjs +1 -1
- package/dist/components/data-display/PullToRefresh/PullToRefresh.js +73 -72
- package/dist/components/data-display/SortableList/SortableList.cjs +1 -1
- package/dist/components/data-display/SortableList/SortableList.js +54 -53
- package/dist/components/data-display/SwipeAction/SwipeAction.cjs +1 -1
- package/dist/components/data-display/SwipeAction/SwipeAction.js +77 -76
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +99 -98
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +53 -52
- package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.js +109 -108
- package/dist/components/form/Rating/Rating.cjs +1 -1
- package/dist/components/form/Rating/Rating.js +75 -74
- package/dist/components/form/Slider/Slider.cjs +1 -1
- package/dist/components/form/Slider/Slider.js +58 -57
- package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
- package/dist/components/form/SmartSearchInput/SmartSearchInput.js +65 -64
- package/dist/components/form/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/form/TimePicker/TimePicker.js +31 -30
- package/dist/components/layout/AppShell/AppShell.cjs +1 -1
- package/dist/components/layout/AppShell/AppShell.js +4 -1
- package/dist/components/layout/InteractiveArea/InteractiveArea.cjs +1 -1
- package/dist/components/layout/InteractiveArea/InteractiveArea.js +1 -1
- package/dist/components/layout/Navbar/Navbar.cjs +1 -1
- package/dist/components/layout/Navbar/Navbar.js +68 -67
- package/dist/components/layout/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/layout/Sidebar/Sidebar.js +4 -1
- package/dist/components/layout/Splitter/Splitter.cjs +1 -1
- package/dist/components/layout/Splitter/Splitter.js +47 -46
- package/dist/components/layout/Transition/Transition.cjs +1 -1
- package/dist/components/layout/Transition/Transition.js +25 -24
- package/dist/components/media/Audio/Audio.cjs +1 -1
- package/dist/components/media/Audio/Audio.js +39 -38
- package/dist/components/media/Image/Image.cjs +2 -2
- package/dist/components/media/Image/Image.js +96 -95
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +75 -74
- package/dist/components/media/Video/Video.cjs +1 -1
- package/dist/components/media/Video/Video.js +114 -113
- package/dist/components/navigation/Anchor/Anchor.cjs +1 -1
- package/dist/components/navigation/Anchor/Anchor.js +77 -72
- package/dist/components/navigation/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/navigation/SpeedDial/SpeedDial.js +47 -46
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +87 -86
- package/dist/components/overlay/Popover/Popover.cjs +1 -1
- package/dist/components/overlay/Popover/Popover.js +1 -1
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +4 -1
|
@@ -1,103 +1,104 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import a from "
|
|
7
|
-
import
|
|
8
|
-
import l from "
|
|
9
|
-
import
|
|
3
|
+
import { composeEventHandlers as n } from "../../_internal/composeEventHandlers.js";
|
|
4
|
+
import r from "../../../icon/star.js";
|
|
5
|
+
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
6
|
+
import { FieldTemplate as a } from "../FieldTemplate/FieldTemplate.js";
|
|
7
|
+
import o from "./rating.module.js";
|
|
8
|
+
import { useId as s, useRef as c, useState as l } from "react";
|
|
9
|
+
import u from "classnames";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/form/Rating/Rating.tsx
|
|
11
|
-
var
|
|
12
|
-
let { star:
|
|
13
|
-
if (
|
|
12
|
+
var p = ({ value: p, defaultValue: m = 0, count: h = 5, allowHalf: g = !1, disabled: _ = !1, readOnly: v = !1, size: y = "md", onChange: b, className: x, label: S, error: C, required: w, layout: T = "vertical", labels: E = {}, asChild: D = !1, children: O, ...k }) => {
|
|
13
|
+
let { star: A = (e) => `${e} star${e === 1 ? "" : "s"}`, readonly: j = (e, t) => `Rating: ${e} out of ${t}` } = E, M = p !== void 0, [N, P] = l(m), [F, I] = l(null), L = s(), R = `wim-rating-label-${L}`, z = `wim-rating-error-${L}`, B = c([]), V = M ? p : N, H = F === null ? V : F, U = (e, t) => {
|
|
14
|
+
if (_ || v) return;
|
|
14
15
|
let n = e + 1;
|
|
15
|
-
if (
|
|
16
|
+
if (g) {
|
|
16
17
|
let e = t.currentTarget.getBoundingClientRect();
|
|
17
18
|
t.clientX - e.left <= e.width / 2 && (n -= .5);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
if (
|
|
26
|
-
for (let e = 0; e <
|
|
20
|
+
I(n);
|
|
21
|
+
}, W = () => {
|
|
22
|
+
_ || v || I(null);
|
|
23
|
+
}, G = (e) => {
|
|
24
|
+
_ || v || (M || P(e), b?.(e));
|
|
25
|
+
}, K = (() => {
|
|
26
|
+
if (V === 0) return 0;
|
|
27
|
+
for (let e = 0; e < h; e++) {
|
|
27
28
|
let t = e + 1;
|
|
28
|
-
if (
|
|
29
|
+
if (V === t || g && V === t - .5) return e;
|
|
29
30
|
}
|
|
30
31
|
return 0;
|
|
31
|
-
})(),
|
|
32
|
-
if (
|
|
33
|
-
let n =
|
|
32
|
+
})(), q = (e, t) => {
|
|
33
|
+
if (_ || v) return;
|
|
34
|
+
let n = g ? .5 : 1;
|
|
34
35
|
if (t.key === "ArrowRight" || t.key === "ArrowUp") {
|
|
35
36
|
t.preventDefault();
|
|
36
|
-
let e = Math.min(
|
|
37
|
-
|
|
37
|
+
let e = Math.min(h, V + n), r = Math.min(Math.ceil(e) - 1, h - 1);
|
|
38
|
+
G(e), B.current[r]?.focus();
|
|
38
39
|
} else if (t.key === "ArrowLeft" || t.key === "ArrowDown") {
|
|
39
40
|
t.preventDefault();
|
|
40
|
-
let e = Math.max(0,
|
|
41
|
-
|
|
42
|
-
} else t.key === "Home" ? (t.preventDefault(),
|
|
43
|
-
},
|
|
44
|
-
let t = e + 1,
|
|
45
|
-
return /* @__PURE__ */
|
|
41
|
+
let e = Math.max(0, V - n), r = e === 0 ? 0 : Math.ceil(e) - 1;
|
|
42
|
+
G(e), B.current[r]?.focus();
|
|
43
|
+
} else t.key === "Home" ? (t.preventDefault(), G(0), B.current[0]?.focus()) : t.key === "End" && (t.preventDefault(), G(h), B.current[h - 1]?.focus());
|
|
44
|
+
}, J = (e) => {
|
|
45
|
+
let t = e + 1, n = H >= t, a = !n && H >= t - .5, s = V === t || g && V === t - .5;
|
|
46
|
+
return /* @__PURE__ */ f("div", {
|
|
46
47
|
ref: (t) => {
|
|
47
|
-
|
|
48
|
+
B.current[e] = t;
|
|
48
49
|
},
|
|
49
|
-
className:
|
|
50
|
-
onMouseMove: (t) =>
|
|
50
|
+
className: u(o.star, n && o.full, a && o.half),
|
|
51
|
+
onMouseMove: (t) => U(e, t),
|
|
51
52
|
onClick: (e) => {
|
|
52
53
|
let n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, i = t;
|
|
53
|
-
|
|
54
|
+
g && r <= n.width / 2 && (i -= .5), G(i);
|
|
54
55
|
},
|
|
55
56
|
onKeyDown: (n) => {
|
|
56
|
-
n.key === "Enter" || n.key === " " ? (n.preventDefault(),
|
|
57
|
+
n.key === "Enter" || n.key === " " ? (n.preventDefault(), G(t)) : q(e, n);
|
|
57
58
|
},
|
|
58
|
-
role:
|
|
59
|
-
tabIndex:
|
|
60
|
-
"aria-checked":
|
|
61
|
-
"aria-label":
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
-
className:
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
component:
|
|
66
|
-
size:
|
|
67
|
-
className:
|
|
59
|
+
role: v ? "presentation" : "radio",
|
|
60
|
+
tabIndex: _ || v ? -1 : e === K ? 0 : -1,
|
|
61
|
+
"aria-checked": v ? void 0 : s,
|
|
62
|
+
"aria-label": v ? void 0 : A(e + 1),
|
|
63
|
+
children: [/* @__PURE__ */ d("div", {
|
|
64
|
+
className: o.background,
|
|
65
|
+
children: /* @__PURE__ */ d(i, {
|
|
66
|
+
component: r,
|
|
67
|
+
size: y,
|
|
68
|
+
className: o.icon
|
|
68
69
|
})
|
|
69
|
-
}), /* @__PURE__ */
|
|
70
|
-
className:
|
|
71
|
-
children: /* @__PURE__ */
|
|
72
|
-
component:
|
|
73
|
-
size:
|
|
74
|
-
className:
|
|
70
|
+
}), /* @__PURE__ */ d("div", {
|
|
71
|
+
className: o.foreground,
|
|
72
|
+
children: /* @__PURE__ */ d(i, {
|
|
73
|
+
component: r,
|
|
74
|
+
size: y,
|
|
75
|
+
className: o.icon
|
|
75
76
|
})
|
|
76
77
|
})]
|
|
77
78
|
}, e);
|
|
78
|
-
},
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
label:
|
|
81
|
-
error:
|
|
82
|
-
required:
|
|
83
|
-
layout:
|
|
84
|
-
labelId:
|
|
85
|
-
errorId:
|
|
86
|
-
className:
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
className:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"aria-
|
|
92
|
-
"aria-
|
|
93
|
-
"aria-
|
|
94
|
-
"aria-
|
|
95
|
-
"aria-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
children: [
|
|
79
|
+
}, Y = Array.from({ length: h }, (e, t) => J(t));
|
|
80
|
+
return /* @__PURE__ */ d(a, {
|
|
81
|
+
label: S,
|
|
82
|
+
error: C,
|
|
83
|
+
required: w,
|
|
84
|
+
layout: T,
|
|
85
|
+
labelId: R,
|
|
86
|
+
errorId: z,
|
|
87
|
+
className: x,
|
|
88
|
+
children: /* @__PURE__ */ f(D ? e : "div", {
|
|
89
|
+
className: u("wim-rating", o.root, o[y], _ && o.disabled),
|
|
90
|
+
role: v ? "img" : "radiogroup",
|
|
91
|
+
"aria-label": v ? j(V, h) : void 0,
|
|
92
|
+
"aria-labelledby": !v && S ? R : void 0,
|
|
93
|
+
"aria-disabled": !v && _ ? !0 : void 0,
|
|
94
|
+
"aria-required": v ? void 0 : w,
|
|
95
|
+
"aria-describedby": !v && C ? z : void 0,
|
|
96
|
+
"aria-invalid": !v && C ? !0 : void 0,
|
|
97
|
+
...k,
|
|
98
|
+
onMouseLeave: n(k.onMouseLeave, v ? void 0 : W),
|
|
99
|
+
children: [Y, /* @__PURE__ */ d(t, { children: O })]
|
|
99
100
|
})
|
|
100
101
|
});
|
|
101
102
|
};
|
|
102
103
|
//#endregion
|
|
103
|
-
export {
|
|
104
|
+
export { p as Rating };
|
|
@@ -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"),
|
|
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("../FieldTemplate/FieldTemplate.cjs"),i=require("../../../utilities/slider-utils.cjs"),a=require("./slider.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=(0,o.forwardRef)(({value:e,defaultValue:l=0,min:u=0,max:d=100,step:f=1,disabled:p=!1,onChange:m,onAfterChange:h,className:g,name:_,label:v,error:y,required:b,layout:x=`vertical`,id:S,"aria-label":C,"aria-labelledby":w,"aria-describedby":T,asChild:E=!1,styles:D,children:O,...k},A)=>{let j=e!==void 0,[M,N]=(0,o.useState)(l),P=j?e:M,F=(0,o.useRef)(null),I=(0,o.useRef)(null),L=(0,o.useRef)(null),R=(0,o.useRef)(null),z=(0,o.useRef)(!1),B=(0,o.useRef)(P),V=(0,o.useId)(),H=S||V,U=`wim-slider-label-${H}`,W=`wim-slider-error-${H}`,{calculateValue:G}=i.useSliderCommon(u,d,f),K=(0,o.useCallback)(e=>(e-u)/(d-u)*100,[u,d]),q=(0,o.useCallback)(e=>{let t=K(e);L.current&&(L.current.style.width=`${t}%`),I.current&&(I.current.style.left=`${t}%`,I.current.setAttribute(`aria-valuenow`,String(e))),R.current&&(R.current.value=String(e))},[K]);(0,o.useEffect)(()=>{z.current||q(P)},[P,q]);let J=e=>{if(p)return;z.current=!0;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=G(t,F.current);B.current=n,q(n),m?.(n),e.preventDefault()},Y=(0,o.useCallback)(e=>{if(!z.current||p)return;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=G(t,F.current);B.current=n,q(n),m?.(n)},[p,G,m,q]),X=(0,o.useCallback)(()=>{if(z.current){z.current=!1;let e=B.current;j||N(e),h?.(e)}},[j,h]);(0,o.useEffect)(()=>(document.addEventListener(`mousemove`,Y),document.addEventListener(`mouseup`,X),document.addEventListener(`touchmove`,Y,{passive:!1}),document.addEventListener(`touchend`,X),()=>{document.removeEventListener(`mousemove`,Y),document.removeEventListener(`mouseup`,X),document.removeEventListener(`touchmove`,Y),document.removeEventListener(`touchend`,X)}),[Y,X]);let Z=e=>{if(p)return;let t;if(e.key===`ArrowLeft`||e.key===`ArrowDown`)t=Math.max(u,P-f);else if(e.key===`ArrowRight`||e.key===`ArrowUp`)t=Math.min(d,P+f);else if(e.key===`Home`)t=u;else if(e.key===`End`)t=d;else return;j||N(t),m?.(t),e.preventDefault()},Q=K(P);return(0,c.jsx)(r.FieldTemplate,{label:v,error:y,required:b,layout:x,labelId:U,errorId:W,className:g,styles:D,children:(0,c.jsxs)(E?t.Root:`div`,{role:`presentation`,className:(0,s.default)(`wim-slider`,a.default.root,p&&a.default.disabled,y&&a.default.danger),ref:A,...k,onMouseDown:n.composeEventHandlers(k.onMouseDown,J),onTouchStart:n.composeEventHandlers(k.onTouchStart,J),children:[(0,c.jsxs)(`div`,{className:a.default.trackContainer,ref:F,children:[(0,c.jsx)(`div`,{ref:L,className:a.default.track,style:{width:`${Q}%`}}),(0,c.jsx)(`div`,{ref:I,className:a.default.thumb,style:{left:`${Q}%`},role:`slider`,"aria-valuemin":u,"aria-valuemax":d,"aria-valuenow":P,"aria-disabled":p,"aria-labelledby":v?U:w,"aria-label":v?void 0:C,"aria-describedby":[T,y?W:void 0].filter(Boolean).join(` `)||void 0,"aria-invalid":y?!0:void 0,tabIndex:p?-1:0,onKeyDown:Z})]}),(0,c.jsx)(`input`,{ref:R,type:`hidden`,name:_,value:P}),E?(0,c.jsx)(t.Slottable,{children:O}):null]})})});l.displayName=`Slider`,exports.Slider=l,exports.default=l;
|
|
@@ -1,106 +1,107 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
import
|
|
7
|
-
import d from "
|
|
8
|
-
import
|
|
3
|
+
import { composeEventHandlers as n } from "../../_internal/composeEventHandlers.js";
|
|
4
|
+
import { FieldTemplate as r } from "../FieldTemplate/FieldTemplate.js";
|
|
5
|
+
import { useSliderCommon as i } from "../../../utilities/slider-utils.js";
|
|
6
|
+
import a from "./slider.module.js";
|
|
7
|
+
import { forwardRef as o, useCallback as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import f from "classnames";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/form/Slider/Slider.tsx
|
|
10
|
-
var
|
|
11
|
-
let N =
|
|
11
|
+
var h = o(({ value: o, defaultValue: h = 0, min: g = 0, max: _ = 100, step: v = 1, disabled: y = !1, onChange: b, onAfterChange: x, className: S, name: C, label: w, error: T, required: E, layout: ee = "vertical", id: te, "aria-label": ne, "aria-labelledby": re, "aria-describedby": D, asChild: O = !1, styles: k, children: A, ...j }, M) => {
|
|
12
|
+
let N = o !== void 0, [P, F] = d(h), I = N ? o : P, L = u(null), R = u(null), z = u(null), B = u(null), V = u(!1), H = u(I), U = l(), W = te || U, G = `wim-slider-label-${W}`, K = `wim-slider-error-${W}`, { calculateValue: q } = i(g, _, v), J = s((e) => (e - g) / (_ - g) * 100, [g, _]), Y = s((e) => {
|
|
12
13
|
let t = J(e);
|
|
13
14
|
z.current && (z.current.style.width = `${t}%`), R.current && (R.current.style.left = `${t}%`, R.current.setAttribute("aria-valuenow", String(e))), B.current && (B.current.value = String(e));
|
|
14
15
|
}, [J]);
|
|
15
|
-
|
|
16
|
+
c(() => {
|
|
16
17
|
V.current || Y(I);
|
|
17
18
|
}, [I, Y]);
|
|
18
19
|
let X = (e) => {
|
|
19
|
-
if (
|
|
20
|
+
if (y) return;
|
|
20
21
|
V.current = !0;
|
|
21
22
|
let t = "touches" in e ? e.touches[0].clientX : e.clientX, n = q(t, L.current);
|
|
22
|
-
H.current = n, Y(n),
|
|
23
|
-
}, Z =
|
|
24
|
-
if (!V.current ||
|
|
23
|
+
H.current = n, Y(n), b?.(n), e.preventDefault();
|
|
24
|
+
}, Z = s((e) => {
|
|
25
|
+
if (!V.current || y) return;
|
|
25
26
|
let t = "touches" in e ? e.touches[0].clientX : e.clientX, n = q(t, L.current);
|
|
26
|
-
H.current = n, Y(n),
|
|
27
|
+
H.current = n, Y(n), b?.(n);
|
|
27
28
|
}, [
|
|
28
|
-
v,
|
|
29
|
-
q,
|
|
30
29
|
y,
|
|
30
|
+
q,
|
|
31
|
+
b,
|
|
31
32
|
Y
|
|
32
|
-
]), Q =
|
|
33
|
+
]), Q = s(() => {
|
|
33
34
|
if (V.current) {
|
|
34
35
|
V.current = !1;
|
|
35
36
|
let e = H.current;
|
|
36
|
-
N || F(e),
|
|
37
|
+
N || F(e), x?.(e);
|
|
37
38
|
}
|
|
38
|
-
}, [N,
|
|
39
|
-
|
|
39
|
+
}, [N, x]);
|
|
40
|
+
c(() => (document.addEventListener("mousemove", Z), document.addEventListener("mouseup", Q), document.addEventListener("touchmove", Z, { passive: !1 }), document.addEventListener("touchend", Q), () => {
|
|
40
41
|
document.removeEventListener("mousemove", Z), document.removeEventListener("mouseup", Q), document.removeEventListener("touchmove", Z), document.removeEventListener("touchend", Q);
|
|
41
42
|
}), [Z, Q]);
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
43
|
+
let ie = (e) => {
|
|
44
|
+
if (y) return;
|
|
44
45
|
let t;
|
|
45
|
-
if (e.key === "ArrowLeft" || e.key === "ArrowDown") t = Math.max(
|
|
46
|
-
else if (e.key === "ArrowRight" || e.key === "ArrowUp") t = Math.min(
|
|
47
|
-
else if (e.key === "Home") t =
|
|
48
|
-
else if (e.key === "End") t =
|
|
46
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowDown") t = Math.max(g, I - v);
|
|
47
|
+
else if (e.key === "ArrowRight" || e.key === "ArrowUp") t = Math.min(_, I + v);
|
|
48
|
+
else if (e.key === "Home") t = g;
|
|
49
|
+
else if (e.key === "End") t = _;
|
|
49
50
|
else return;
|
|
50
|
-
N || F(t),
|
|
51
|
+
N || F(t), b?.(t), e.preventDefault();
|
|
51
52
|
}, $ = J(I);
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
label:
|
|
54
|
-
error:
|
|
55
|
-
required:
|
|
56
|
-
layout:
|
|
53
|
+
return /* @__PURE__ */ p(r, {
|
|
54
|
+
label: w,
|
|
55
|
+
error: T,
|
|
56
|
+
required: E,
|
|
57
|
+
layout: ee,
|
|
57
58
|
labelId: G,
|
|
58
59
|
errorId: K,
|
|
59
|
-
className:
|
|
60
|
+
className: S,
|
|
60
61
|
styles: k,
|
|
61
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ m(O ? e : "div", {
|
|
62
63
|
role: "presentation",
|
|
63
|
-
className:
|
|
64
|
-
onMouseDown: X,
|
|
65
|
-
onTouchStart: X,
|
|
64
|
+
className: f("wim-slider", a.root, y && a.disabled, T && a.danger),
|
|
66
65
|
ref: M,
|
|
67
66
|
...j,
|
|
67
|
+
onMouseDown: n(j.onMouseDown, X),
|
|
68
|
+
onTouchStart: n(j.onTouchStart, X),
|
|
68
69
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
className:
|
|
70
|
+
/* @__PURE__ */ m("div", {
|
|
71
|
+
className: a.trackContainer,
|
|
71
72
|
ref: L,
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ p("div", {
|
|
73
74
|
ref: z,
|
|
74
|
-
className:
|
|
75
|
+
className: a.track,
|
|
75
76
|
style: { width: `${$}%` }
|
|
76
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ p("div", {
|
|
77
78
|
ref: R,
|
|
78
|
-
className:
|
|
79
|
+
className: a.thumb,
|
|
79
80
|
style: { left: `${$}%` },
|
|
80
81
|
role: "slider",
|
|
81
|
-
"aria-valuemin":
|
|
82
|
-
"aria-valuemax":
|
|
82
|
+
"aria-valuemin": g,
|
|
83
|
+
"aria-valuemax": _,
|
|
83
84
|
"aria-valuenow": I,
|
|
84
|
-
"aria-disabled":
|
|
85
|
-
"aria-labelledby":
|
|
86
|
-
"aria-label":
|
|
87
|
-
"aria-describedby": [D,
|
|
88
|
-
"aria-invalid":
|
|
89
|
-
tabIndex:
|
|
90
|
-
onKeyDown:
|
|
85
|
+
"aria-disabled": y,
|
|
86
|
+
"aria-labelledby": w ? G : re,
|
|
87
|
+
"aria-label": w ? void 0 : ne,
|
|
88
|
+
"aria-describedby": [D, T ? K : void 0].filter(Boolean).join(" ") || void 0,
|
|
89
|
+
"aria-invalid": T ? !0 : void 0,
|
|
90
|
+
tabIndex: y ? -1 : 0,
|
|
91
|
+
onKeyDown: ie
|
|
91
92
|
})]
|
|
92
93
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ p("input", {
|
|
94
95
|
ref: B,
|
|
95
96
|
type: "hidden",
|
|
96
|
-
name:
|
|
97
|
+
name: C,
|
|
97
98
|
value: I
|
|
98
99
|
}),
|
|
99
|
-
O ? /* @__PURE__ */
|
|
100
|
+
O ? /* @__PURE__ */ p(t, { children: A }) : null
|
|
100
101
|
]
|
|
101
102
|
})
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
|
-
|
|
105
|
+
h.displayName = "Slider";
|
|
105
106
|
//#endregion
|
|
106
|
-
export {
|
|
107
|
+
export { h as Slider, h as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../InputBase/InputBase.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../_internal/composeEventHandlers.cjs"),r=require("../InputBase/InputBase.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("../../../hooks/useAutoResize.cjs"),s=require("../../_internal/FieldCharacterCount/FieldCharacterCount.cjs"),c=require("./smart-search-input.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.forwardRef)(({intent:e=`default`,variant:f=`outline`,fullWidth:p=!1,width:m,label:h,error:g,required:_,layout:v,maxRows:y=8,allowClear:b=!0,onClear:x,onSubmit:S,onChange:C,value:w,defaultValue:T=``,placeholder:E,disabled:D,className:O,id:k,maxLength:A,"aria-label":j,...M},N)=>{let{t:P}=t.useWimTranslation(i.formNs),F=w!==void 0,[I,L]=l.default.useState(T),R=F?w:I,z=o.useAutoResize(R,y);l.default.useImperativeHandle(N,()=>z.current);let B=(0,l.useId)(),V=k||`smart-search-${B}`,H=g?`${V}-error`:void 0,U=h?`${V}-label`:void 0,W=(0,l.useCallback)(e=>{let t=e.target.value;F||L(t),C?.(t)},[F,C]),G=(0,l.useCallback)(()=>{R.trim()&&!D&&S?.(R.trim())},[R,D,S]),K=(0,l.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),G())},[G]),q=()=>{F||L(``),C?.(``),x?.(),z.current?.focus()},J=g?`danger`:e;return(0,d.jsx)(a.FieldTemplate,{label:h,error:g,required:_,layout:v,htmlFor:V,labelId:U,errorId:H,className:(0,u.default)(`wim-smart-search-input`,O,p&&c.default.fullWidth),children:(0,d.jsxs)(`div`,{className:c.default.container,children:[(0,d.jsx)(r.InputBase,{intent:J,variant:f,fullWidth:p,width:m,disabled:D,leftIcon:`SearchIcon`,styles:{icon:c.default.icon,icons:c.default.icons},allowClear:b,hasValue:!!R,onClear:q,children:(0,d.jsx)(`textarea`,{id:V,ref:z,className:(0,u.default)(c.default.textarea,c.default[f]),value:R,onChange:W,placeholder:E,rows:1,disabled:D,maxLength:A,"aria-label":j??(h?void 0:P(`smart_search.input_label`)),...M,onKeyDown:n.composeEventHandlers(M.onKeyDown,K)})}),(0,d.jsx)(s.FieldCharacterCount,{count:R.length,maxLength:A,className:c.default.charCount})]})})});f.displayName=`SmartSearchInput`,exports.SmartSearchInput=f;
|
|
@@ -1,79 +1,80 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import o from "
|
|
9
|
-
import s
|
|
10
|
-
import d from "
|
|
11
|
-
import
|
|
3
|
+
import { composeEventHandlers as t } from "../../_internal/composeEventHandlers.js";
|
|
4
|
+
import { InputBase as n } from "../InputBase/InputBase.js";
|
|
5
|
+
import { formNs as r } from "../../../i18n/generated/form.js";
|
|
6
|
+
import { FieldTemplate as i } from "../FieldTemplate/FieldTemplate.js";
|
|
7
|
+
import { useAutoResize as a } from "../../../hooks/useAutoResize.js";
|
|
8
|
+
import { FieldCharacterCount as o } from "../../_internal/FieldCharacterCount/FieldCharacterCount.js";
|
|
9
|
+
import s from "./smart-search-input.module.js";
|
|
10
|
+
import c, { forwardRef as l, useCallback as u, useId as d } from "react";
|
|
11
|
+
import f from "classnames";
|
|
12
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/form/SmartSearchInput/SmartSearchInput.tsx
|
|
13
|
-
var
|
|
14
|
-
let { t:
|
|
15
|
-
|
|
16
|
-
let
|
|
14
|
+
var h = l(({ intent: l = "default", variant: h = "outline", fullWidth: g = !1, width: _, label: v, error: y, required: b, layout: x, maxRows: S = 8, allowClear: C = !0, onClear: w, onSubmit: T, onChange: E, value: D, defaultValue: O = "", placeholder: k, disabled: A, className: j, id: M, maxLength: N, "aria-label": P, ...F }, I) => {
|
|
15
|
+
let { t: L } = e(r), R = D !== void 0, [z, B] = c.useState(O), V = R ? D : z, H = a(V, S);
|
|
16
|
+
c.useImperativeHandle(I, () => H.current);
|
|
17
|
+
let U = d(), W = M || `smart-search-${U}`, G = y ? `${W}-error` : void 0, K = v ? `${W}-label` : void 0, q = u((e) => {
|
|
17
18
|
let t = e.target.value;
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
|
|
19
|
+
R || B(t), E?.(t);
|
|
20
|
+
}, [R, E]), J = u(() => {
|
|
21
|
+
V.trim() && !A && T?.(V.trim());
|
|
21
22
|
}, [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]),
|
|
26
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
label:
|
|
32
|
-
error:
|
|
33
|
-
required:
|
|
34
|
-
layout:
|
|
35
|
-
htmlFor:
|
|
36
|
-
labelId:
|
|
37
|
-
errorId:
|
|
38
|
-
className:
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
className:
|
|
41
|
-
children: [/* @__PURE__ */
|
|
42
|
-
intent:
|
|
43
|
-
variant:
|
|
44
|
-
fullWidth:
|
|
45
|
-
width:
|
|
46
|
-
disabled:
|
|
23
|
+
V,
|
|
24
|
+
A,
|
|
25
|
+
T
|
|
26
|
+
]), Y = u((e) => {
|
|
27
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), J());
|
|
28
|
+
}, [J]), X = () => {
|
|
29
|
+
R || B(""), E?.(""), w?.(), H.current?.focus();
|
|
30
|
+
}, Z = y ? "danger" : l;
|
|
31
|
+
return /* @__PURE__ */ p(i, {
|
|
32
|
+
label: v,
|
|
33
|
+
error: y,
|
|
34
|
+
required: b,
|
|
35
|
+
layout: x,
|
|
36
|
+
htmlFor: W,
|
|
37
|
+
labelId: K,
|
|
38
|
+
errorId: G,
|
|
39
|
+
className: f("wim-smart-search-input", j, g && s.fullWidth),
|
|
40
|
+
children: /* @__PURE__ */ m("div", {
|
|
41
|
+
className: s.container,
|
|
42
|
+
children: [/* @__PURE__ */ p(n, {
|
|
43
|
+
intent: Z,
|
|
44
|
+
variant: h,
|
|
45
|
+
fullWidth: g,
|
|
46
|
+
width: _,
|
|
47
|
+
disabled: A,
|
|
47
48
|
leftIcon: "SearchIcon",
|
|
48
49
|
styles: {
|
|
49
|
-
icon:
|
|
50
|
-
icons:
|
|
50
|
+
icon: s.icon,
|
|
51
|
+
icons: s.icons
|
|
51
52
|
},
|
|
52
|
-
allowClear:
|
|
53
|
-
hasValue: !!
|
|
54
|
-
onClear:
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
id:
|
|
57
|
-
ref:
|
|
58
|
-
className:
|
|
59
|
-
value:
|
|
60
|
-
onChange:
|
|
61
|
-
|
|
62
|
-
placeholder: O,
|
|
53
|
+
allowClear: C,
|
|
54
|
+
hasValue: !!V,
|
|
55
|
+
onClear: X,
|
|
56
|
+
children: /* @__PURE__ */ p("textarea", {
|
|
57
|
+
id: W,
|
|
58
|
+
ref: H,
|
|
59
|
+
className: f(s.textarea, s[h]),
|
|
60
|
+
value: V,
|
|
61
|
+
onChange: q,
|
|
62
|
+
placeholder: k,
|
|
63
63
|
rows: 1,
|
|
64
|
-
disabled:
|
|
65
|
-
maxLength:
|
|
66
|
-
"aria-label":
|
|
67
|
-
...
|
|
64
|
+
disabled: A,
|
|
65
|
+
maxLength: N,
|
|
66
|
+
"aria-label": P ?? (v ? void 0 : L("smart_search.input_label")),
|
|
67
|
+
...F,
|
|
68
|
+
onKeyDown: t(F.onKeyDown, Y)
|
|
68
69
|
})
|
|
69
|
-
}), /* @__PURE__ */
|
|
70
|
-
count:
|
|
71
|
-
maxLength:
|
|
72
|
-
className:
|
|
70
|
+
}), /* @__PURE__ */ p(o, {
|
|
71
|
+
count: V.length,
|
|
72
|
+
maxLength: N,
|
|
73
|
+
className: s.charCount
|
|
73
74
|
})]
|
|
74
75
|
})
|
|
75
76
|
});
|
|
76
77
|
});
|
|
77
|
-
|
|
78
|
+
h.displayName = "SmartSearchInput";
|
|
78
79
|
//#endregion
|
|
79
|
-
export {
|
|
80
|
+
export { h as SmartSearchInput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../Input/input.module.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../../_internal/composeEventHandlers.cjs"),r=require("../Input/input.module.cjs"),i=require("../Input/Input.cjs"),a=require("./time-picker.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=(0,o.forwardRef)(({intent:e=`default`,variant:l=`outline`,fullWidth:u=!1,className:d,disabled:f,allowClear:p=!0,value:m,defaultValue:h,onChange:g,..._},v)=>{let y=m!==void 0,[b,x]=(0,o.useState)(h??``),S=y?m:b,C=(0,o.useRef)(null),w=t.useMergedRef(v,C),T=p&&!!S&&!f,E=T?void 0:`ClockIcon`,D=e=>{y||x(e.target.value),g?.(e)},O=()=>{C.current?.showPicker?.()};return(0,c.jsx)(i.Input,{ref:w,type:`time`,allowClear:T,intent:e,variant:l,fullWidth:u,className:(0,s.default)(`wim-time-picker`,d),inputClassName:(0,s.default)(r.default.root,a.default.input),disabled:f,value:m,defaultValue:h,onChange:D,rightIcon:E,rightIconColor:f||T?void 0:`primary`,rightIconDecorative:!0,..._,onRightIconClick:T?_.onRightIconClick:n.composeEventHandlers(_.onRightIconClick,O)})});l.displayName=`TimePicker`,exports.TimePicker=l;
|