wimui 0.58.1 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai/PromptInput/PromptInput.cjs +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +30 -30
- package/dist/components/ai/Terminal/Terminal.cjs +2 -2
- package/dist/components/ai/Terminal/Terminal.js +16 -14
- package/dist/components/data-display/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/data-display/VirtualList/VirtualList.d.ts +2 -0
- package/dist/components/data-display/VirtualList/VirtualList.js +15 -14
- package/dist/components/form/CopyButton/CopyButton.cjs +1 -1
- package/dist/components/form/CopyButton/CopyButton.d.ts +5 -1
- package/dist/components/form/CopyButton/CopyButton.js +17 -15
- package/dist/components/form/Dropzone/Dropzone.cjs +1 -1
- package/dist/components/form/Dropzone/Dropzone.d.ts +7 -1
- package/dist/components/form/Dropzone/Dropzone.js +29 -28
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.d.ts +7 -1
- package/dist/components/form/FileUpload/FileUpload.js +22 -17
- package/dist/components/form/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/form/ImageCropper/ImageCropper.js +102 -100
- package/dist/components/form/QueryBuilder/QueryBuilder.cjs +1 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.d.ts +7 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.js +104 -102
- package/dist/components/form/ThemeToggle/ThemeToggle.cjs +1 -1
- package/dist/components/form/ThemeToggle/ThemeToggle.js +59 -54
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +33 -31
- package/dist/components/navigation/BackTop/BackTop.cjs +1 -1
- package/dist/components/navigation/BackTop/BackTop.d.ts +4 -0
- package/dist/components/navigation/BackTop/BackTop.js +18 -16
- package/dist/llms-full.txt +15 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +4 -4
- package/package.json +1 -1
|
@@ -9,55 +9,60 @@ import o, { useRef as s, useState as c } from "react";
|
|
|
9
9
|
import l from "classnames";
|
|
10
10
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/form/FileUpload/FileUpload.tsx
|
|
12
|
-
var f = ({ label: f, buttonLabel: p, noFileLabel: m, accept: h, multiple: g = !1, disabled: _ = !1, value: v, onChange: y, className: b, iconName: x, iconPosition: S, size: C = "md", error: w, required: T, layout: E = "vertical" }) => {
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
var f = ({ label: f, buttonLabel: p, noFileLabel: m, accept: h, multiple: g = !1, disabled: _ = !1, value: v, onChange: y, className: b, iconName: x, iconPosition: S, size: C = "md", error: w, required: T, layout: E = "vertical", "aria-label": D, "aria-labelledby": O, "aria-describedby": k }) => {
|
|
13
|
+
let { t: A } = e(r), j = `wim-fileupload-${o.useId()}`, M = f ? `${j}-label` : void 0, N = w ? `${j}-error` : void 0, P = T ? `${j}-required` : void 0, F = [
|
|
14
|
+
k,
|
|
15
|
+
N,
|
|
16
|
+
P
|
|
17
|
+
].filter(Boolean).join(" ") || void 0, I = s(null), [L, R] = c(null), z = () => {
|
|
18
|
+
I.current?.click();
|
|
19
|
+
}, B = (e) => {
|
|
16
20
|
let t = e.target.files;
|
|
17
|
-
|
|
18
|
-
},
|
|
21
|
+
R(t), y && y(t);
|
|
22
|
+
}, V = v === void 0 ? L ? Array.from(L).map((e) => e.name) : [] : v, H = V.length > 0 ? V.join(", ") : m ?? A("fileupload.no_file");
|
|
19
23
|
return /* @__PURE__ */ u(i, {
|
|
20
24
|
label: f,
|
|
21
25
|
error: w,
|
|
22
26
|
required: T,
|
|
23
27
|
layout: E,
|
|
24
|
-
labelId:
|
|
25
|
-
errorId:
|
|
28
|
+
labelId: M,
|
|
29
|
+
errorId: N,
|
|
26
30
|
className: l("wim-file-upload", a.root, a[C], b),
|
|
27
31
|
children: /* @__PURE__ */ d("div", {
|
|
28
32
|
className: a.controls,
|
|
29
33
|
children: [
|
|
30
34
|
/* @__PURE__ */ u("input", {
|
|
31
35
|
type: "file",
|
|
32
|
-
ref:
|
|
36
|
+
ref: I,
|
|
33
37
|
accept: h,
|
|
34
38
|
multiple: g,
|
|
35
39
|
disabled: _,
|
|
36
|
-
onChange:
|
|
40
|
+
onChange: B,
|
|
37
41
|
className: a.input,
|
|
38
42
|
"aria-hidden": "true",
|
|
39
43
|
tabIndex: -1
|
|
40
44
|
}),
|
|
41
45
|
/* @__PURE__ */ u(n, {
|
|
42
|
-
onClick:
|
|
46
|
+
onClick: z,
|
|
43
47
|
disabled: _,
|
|
44
48
|
variant: "outline",
|
|
45
49
|
icon: x,
|
|
46
50
|
iconPosition: S,
|
|
47
51
|
size: C,
|
|
48
|
-
"aria-labelledby":
|
|
49
|
-
"aria-
|
|
52
|
+
"aria-labelledby": M ?? O,
|
|
53
|
+
"aria-label": M || O ? void 0 : D,
|
|
54
|
+
"aria-describedby": F,
|
|
50
55
|
"aria-invalid": w ? !0 : void 0,
|
|
51
|
-
children: p ??
|
|
56
|
+
children: p ?? A("fileupload.button")
|
|
52
57
|
}),
|
|
53
58
|
T && /* @__PURE__ */ u(t, {
|
|
54
|
-
id:
|
|
55
|
-
children:
|
|
59
|
+
id: P,
|
|
60
|
+
children: A("form.required")
|
|
56
61
|
}),
|
|
57
62
|
/* @__PURE__ */ u("span", {
|
|
58
63
|
className: l(a.fileNames, a[C], _ && a.disabled),
|
|
59
64
|
"aria-disabled": _ || void 0,
|
|
60
|
-
children:
|
|
65
|
+
children: H
|
|
61
66
|
})
|
|
62
67
|
]
|
|
63
68
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),i=require("../Button/Button.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../Slider/Slider.cjs"),s=require("../IconButton/IconButton.cjs"),c=require("../../overlay/Dialog/Dialog.cjs"),l=require("./cropImage.cjs"),u=require("./image-cropper.module.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("classnames");f=e.__toESM(f,1);let p=require("react/jsx-runtime");var m=10,h=50,g=d.default.forwardRef(({src:e,aspectRatio:g=1,circular:_=!1,onCrop:v,showRotation:y=!0,showZoom:b=!0,showApplyButton:x=!0,applyLabel:S,onApply:C,onCropError:w,maxOutputSize:T,outputType:E=`image/png`,outputQuality:D=.92,crossOrigin:O,className:k,...A},j)=>{let{t:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),i=require("../Button/Button.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../Slider/Slider.cjs"),s=require("../IconButton/IconButton.cjs"),c=require("../../overlay/Dialog/Dialog.cjs"),l=require("./cropImage.cjs"),u=require("./image-cropper.module.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("classnames");f=e.__toESM(f,1);let p=require("react/jsx-runtime");var m=10,h=50,g=d.default.forwardRef(({src:e,aspectRatio:g=1,circular:_=!1,onCrop:v,showRotation:y=!0,showZoom:b=!0,showApplyButton:x=!0,applyLabel:S,onApply:C,onCropError:w,maxOutputSize:T,outputType:E=`image/png`,outputQuality:D=.92,crossOrigin:O,className:k,...A},j)=>{let M=A.role??(A[`aria-label`]||A[`aria-labelledby`]?`group`:void 0),{t:N}=t.useWimTranslation([a.formNs,n.commonNs]),[P,F]=(0,d.useState)(1),[I,L]=(0,d.useState)(0),[R,z]=(0,d.useState)({x:0,y:0}),[B,V]=(0,d.useState)(!1),[H,U]=(0,d.useState)({x:0,y:0}),[W,G]=(0,d.useState)(!1),K=(0,d.useRef)(null),q=(0,d.useRef)(null),J=(0,d.useRef)(null),Y=(0,d.useId)();(0,d.useEffect)(()=>{z({x:0,y:0}),F(1),L(0)},[e]);let X=e=>{(e.pointerType!==`mouse`||e.button===0)&&(V(!0),U({x:e.clientX-R.x,y:e.clientY-R.y}))},Z=(0,d.useCallback)(e=>{B&&z({x:e.clientX-H.x,y:e.clientY-H.y})},[B,H]),Q=(0,d.useCallback)(()=>{V(!1)},[]);(0,d.useEffect)(()=>{if(B)return window.addEventListener(`pointermove`,Z),window.addEventListener(`pointerup`,Q),window.addEventListener(`pointercancel`,Q),()=>{window.removeEventListener(`pointermove`,Z),window.removeEventListener(`pointerup`,Q),window.removeEventListener(`pointercancel`,Q)}},[B,Z,Q]);let $=e=>{let t=e.shiftKey?h:m,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];n?(e.preventDefault(),z(e=>({x:e.x+n[0],y:e.y+n[1]}))):e.key===`Home`&&(e.preventDefault(),z({x:0,y:0}))},ee=()=>{L(e=>(e+90)%360)},te=()=>{G(!0)},ne=()=>{let e=K.current,t=J.current;if(G(!1),!e||!t)return;let n={x:R.x,y:R.y,zoom:P,rotation:I,frameWidth:t.clientWidth,frameHeight:t.clientHeight,layoutWidth:e.offsetWidth,layoutHeight:e.offsetHeight,naturalWidth:e.naturalWidth,naturalHeight:e.naturalHeight,maxOutputSize:T};try{let{dataUrl:t,detail:r}=l.cropImage(e,n,E,D);v?.(t,r),C?.(t,r)}catch(e){w?.(e instanceof Error?e:Error(String(e)),l.resolveCropDetail(n).detail)}};return e?(0,p.jsxs)(`div`,{ref:j,role:M,className:(0,f.default)(`wim-image-cropper`,u.default.root,k),...A,children:[(0,p.jsxs)(`div`,{ref:q,className:u.default.viewer,onPointerDown:X,onKeyDown:$,role:`application`,tabIndex:0,"aria-label":N(`image_cropper.position_label`),"aria-describedby":Y,children:[(0,p.jsx)(r.VisuallyHidden,{id:Y,children:N(`image_cropper.position_hint`)}),(0,p.jsx)(`div`,{className:u.default.imageContainer,children:(0,p.jsx)(`img`,{ref:K,src:e,alt:N(`a11y.crop_target`),crossOrigin:O,className:u.default.image,style:{transform:`translate(${R.x}px, ${R.y}px) rotate(${I}deg) scale(${P})`},draggable:!1})}),(0,p.jsx)(`div`,{className:u.default.overlay,children:(0,p.jsx)(`div`,{ref:J,className:(0,f.default)(u.default.cropArea,{[u.default.circular]:_}),style:{aspectRatio:g}})})]}),(0,p.jsxs)(`div`,{className:u.default.controls,children:[b&&(0,p.jsx)(`div`,{className:u.default.zoomControl,children:(0,p.jsx)(o.Slider,{min:1,max:3,step:.1,value:P,onChange:e=>F(e),label:N(`image_cropper.zoom`),styles:{root:u.default.zoomSlider}})}),y&&(0,p.jsx)(`div`,{className:u.default.rotationControl,children:(0,p.jsx)(s.IconButton,{iconName:`RefreshIcon`,onClick:ee,"aria-label":N(`image_cropper.rotate`),variant:`outline`,size:`sm`})}),x&&(0,p.jsx)(`div`,{className:u.default.applyControl,children:(0,p.jsx)(i.Button,{onClick:te,size:`sm`,variant:`solid`,children:S||N(`image_cropper.apply`)})})]}),(0,p.jsx)(c.Dialog,{open:W,onOpenChange:G,children:(0,p.jsxs)(c.DialogContent,{children:[(0,p.jsx)(c.DialogHeader,{children:(0,p.jsx)(c.DialogTitle,{children:N(`image_cropper.confirm_title`)})}),(0,p.jsx)(c.DialogDescription,{children:N(`image_cropper.confirm_message`)}),(0,p.jsxs)(c.DialogFooter,{children:[(0,p.jsx)(c.DialogClose,{asChild:!0,children:(0,p.jsx)(i.Button,{variant:`ghost`,children:N(`image_cropper.cancel`)})}),(0,p.jsx)(i.Button,{onClick:ne,variant:`solid`,children:N(`image_cropper.confirm`)})]})]})})]}):(0,p.jsx)(`div`,{ref:j,role:M,className:(0,f.default)(`wim-image-cropper`,u.default.root,u.default.empty,k),...A,children:(0,p.jsx)(`div`,{className:u.default.emptyContent,children:N(`image_cropper.no_image`)})})});g.displayName=`ImageCropper`,exports.ImageCropper=g;
|
|
@@ -6,75 +6,75 @@ import { Button as r } from "../Button/Button.js";
|
|
|
6
6
|
import { formNs as i } from "../../../i18n/generated/form.js";
|
|
7
7
|
import { Slider as a } from "../Slider/Slider.js";
|
|
8
8
|
import { IconButton as o } from "../IconButton/IconButton.js";
|
|
9
|
-
import { Dialog as s, DialogClose as c, DialogContent as l, DialogDescription as u, DialogFooter as
|
|
10
|
-
import { cropImage as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { jsx as
|
|
9
|
+
import { Dialog as s, DialogClose as c, DialogContent as l, DialogDescription as u, DialogFooter as d, DialogHeader as ee, DialogTitle as f } from "../../overlay/Dialog/Dialog.js";
|
|
10
|
+
import { cropImage as p, resolveCropDetail as m } from "./cropImage.js";
|
|
11
|
+
import h from "./image-cropper.module.js";
|
|
12
|
+
import g, { useCallback as _, useEffect as v, useId as y, useRef as b, useState as x } from "react";
|
|
13
|
+
import S from "classnames";
|
|
14
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/form/ImageCropper/ImageCropper.tsx
|
|
16
|
-
var
|
|
17
|
-
let { t:
|
|
16
|
+
var T = 10, E = 50, D = g.forwardRef(({ src: g, aspectRatio: D = 1, circular: te = !1, onCrop: ne, showRotation: re = !0, showZoom: ie = !0, showApplyButton: ae = !0, applyLabel: oe, onApply: O, onCropError: k, maxOutputSize: A, outputType: j = "image/png", outputQuality: M = .92, crossOrigin: N, className: P, ...F }, I) => {
|
|
17
|
+
let L = F.role ?? (F["aria-label"] || F["aria-labelledby"] ? "group" : void 0), { t: R } = e([i, t]), [z, B] = x(1), [V, H] = x(0), [U, W] = x({
|
|
18
18
|
x: 0,
|
|
19
19
|
y: 0
|
|
20
|
-
}), [
|
|
20
|
+
}), [G, K] = x(!1), [q, se] = x({
|
|
21
21
|
x: 0,
|
|
22
22
|
y: 0
|
|
23
|
-
}), [
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
}), [ce, J] = x(!1), Y = b(null), le = b(null), X = b(null), Z = y();
|
|
24
|
+
v(() => {
|
|
25
|
+
W({
|
|
26
26
|
x: 0,
|
|
27
27
|
y: 0
|
|
28
|
-
}),
|
|
29
|
-
}, [
|
|
30
|
-
let
|
|
31
|
-
(e.pointerType !== "mouse" || e.button === 0) && (
|
|
32
|
-
x: e.clientX -
|
|
33
|
-
y: e.clientY -
|
|
28
|
+
}), B(1), H(0);
|
|
29
|
+
}, [g]);
|
|
30
|
+
let ue = (e) => {
|
|
31
|
+
(e.pointerType !== "mouse" || e.button === 0) && (K(!0), se({
|
|
32
|
+
x: e.clientX - U.x,
|
|
33
|
+
y: e.clientY - U.y
|
|
34
34
|
}));
|
|
35
|
-
}, Q =
|
|
36
|
-
|
|
37
|
-
x: e.clientX -
|
|
38
|
-
y: e.clientY -
|
|
35
|
+
}, Q = _((e) => {
|
|
36
|
+
G && W({
|
|
37
|
+
x: e.clientX - q.x,
|
|
38
|
+
y: e.clientY - q.y
|
|
39
39
|
});
|
|
40
|
-
}, [
|
|
41
|
-
|
|
40
|
+
}, [G, q]), $ = _(() => {
|
|
41
|
+
K(!1);
|
|
42
42
|
}, []);
|
|
43
|
-
|
|
44
|
-
if (
|
|
43
|
+
v(() => {
|
|
44
|
+
if (G) return window.addEventListener("pointermove", Q), window.addEventListener("pointerup", $), window.addEventListener("pointercancel", $), () => {
|
|
45
45
|
window.removeEventListener("pointermove", Q), window.removeEventListener("pointerup", $), window.removeEventListener("pointercancel", $);
|
|
46
46
|
};
|
|
47
47
|
}, [
|
|
48
|
-
|
|
48
|
+
G,
|
|
49
49
|
Q,
|
|
50
50
|
$
|
|
51
51
|
]);
|
|
52
|
-
let
|
|
53
|
-
let t = e.shiftKey ?
|
|
52
|
+
let de = (e) => {
|
|
53
|
+
let t = e.shiftKey ? E : T, n = {
|
|
54
54
|
ArrowLeft: [-t, 0],
|
|
55
55
|
ArrowRight: [t, 0],
|
|
56
56
|
ArrowUp: [0, -t],
|
|
57
57
|
ArrowDown: [0, t]
|
|
58
58
|
}[e.key];
|
|
59
|
-
n ? (e.preventDefault(),
|
|
59
|
+
n ? (e.preventDefault(), W((e) => ({
|
|
60
60
|
x: e.x + n[0],
|
|
61
61
|
y: e.y + n[1]
|
|
62
|
-
}))) : e.key === "Home" && (e.preventDefault(),
|
|
62
|
+
}))) : e.key === "Home" && (e.preventDefault(), W({
|
|
63
63
|
x: 0,
|
|
64
64
|
y: 0
|
|
65
65
|
}));
|
|
66
|
-
}, de = () => {
|
|
67
|
-
V((e) => (e + 90) % 360);
|
|
68
66
|
}, fe = () => {
|
|
69
|
-
|
|
67
|
+
H((e) => (e + 90) % 360);
|
|
70
68
|
}, pe = () => {
|
|
69
|
+
J(!0);
|
|
70
|
+
}, me = () => {
|
|
71
71
|
let e = Y.current, t = X.current;
|
|
72
72
|
if (J(!1), !e || !t) return;
|
|
73
73
|
let n = {
|
|
74
|
-
x:
|
|
75
|
-
y:
|
|
76
|
-
zoom:
|
|
77
|
-
rotation:
|
|
74
|
+
x: U.x,
|
|
75
|
+
y: U.y,
|
|
76
|
+
zoom: z,
|
|
77
|
+
rotation: V,
|
|
78
78
|
frameWidth: t.clientWidth,
|
|
79
79
|
frameHeight: t.clientHeight,
|
|
80
80
|
layoutWidth: e.offsetWidth,
|
|
@@ -84,119 +84,121 @@ var w = 10, T = 50, E = h.forwardRef(({ src: h, aspectRatio: E = 1, circular: ne
|
|
|
84
84
|
maxOutputSize: A
|
|
85
85
|
};
|
|
86
86
|
try {
|
|
87
|
-
let { dataUrl: t, detail: r } =
|
|
88
|
-
|
|
87
|
+
let { dataUrl: t, detail: r } = p(e, n, j, M);
|
|
88
|
+
ne?.(t, r), O?.(t, r);
|
|
89
89
|
} catch (e) {
|
|
90
|
-
k?.(e instanceof Error ? e : Error(String(e)),
|
|
90
|
+
k?.(e instanceof Error ? e : Error(String(e)), m(n).detail);
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
return
|
|
93
|
+
return g ? /* @__PURE__ */ w("div", {
|
|
94
94
|
ref: I,
|
|
95
|
-
|
|
95
|
+
role: L,
|
|
96
|
+
className: S("wim-image-cropper", h.root, P),
|
|
96
97
|
...F,
|
|
97
98
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
ref:
|
|
100
|
-
className:
|
|
101
|
-
onPointerDown:
|
|
102
|
-
onKeyDown:
|
|
99
|
+
/* @__PURE__ */ w("div", {
|
|
100
|
+
ref: le,
|
|
101
|
+
className: h.viewer,
|
|
102
|
+
onPointerDown: ue,
|
|
103
|
+
onKeyDown: de,
|
|
103
104
|
role: "application",
|
|
104
105
|
tabIndex: 0,
|
|
105
|
-
"aria-label":
|
|
106
|
+
"aria-label": R("image_cropper.position_label"),
|
|
106
107
|
"aria-describedby": Z,
|
|
107
108
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ C(n, {
|
|
109
110
|
id: Z,
|
|
110
|
-
children:
|
|
111
|
+
children: R("image_cropper.position_hint")
|
|
111
112
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
className:
|
|
114
|
-
children: /* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ C("div", {
|
|
114
|
+
className: h.imageContainer,
|
|
115
|
+
children: /* @__PURE__ */ C("img", {
|
|
115
116
|
ref: Y,
|
|
116
|
-
src:
|
|
117
|
-
alt:
|
|
117
|
+
src: g,
|
|
118
|
+
alt: R("a11y.crop_target"),
|
|
118
119
|
crossOrigin: N,
|
|
119
|
-
className:
|
|
120
|
-
style: { transform: `translate(${
|
|
120
|
+
className: h.image,
|
|
121
|
+
style: { transform: `translate(${U.x}px, ${U.y}px) rotate(${V}deg) scale(${z})` },
|
|
121
122
|
draggable: !1
|
|
122
123
|
})
|
|
123
124
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
className:
|
|
126
|
-
children: /* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ C("div", {
|
|
126
|
+
className: h.overlay,
|
|
127
|
+
children: /* @__PURE__ */ C("div", {
|
|
127
128
|
ref: X,
|
|
128
|
-
className:
|
|
129
|
-
style: { aspectRatio:
|
|
129
|
+
className: S(h.cropArea, { [h.circular]: te }),
|
|
130
|
+
style: { aspectRatio: D }
|
|
130
131
|
})
|
|
131
132
|
})
|
|
132
133
|
]
|
|
133
134
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
className:
|
|
135
|
+
/* @__PURE__ */ w("div", {
|
|
136
|
+
className: h.controls,
|
|
136
137
|
children: [
|
|
137
|
-
|
|
138
|
-
className:
|
|
139
|
-
children: /* @__PURE__ */
|
|
138
|
+
ie && /* @__PURE__ */ C("div", {
|
|
139
|
+
className: h.zoomControl,
|
|
140
|
+
children: /* @__PURE__ */ C(a, {
|
|
140
141
|
min: 1,
|
|
141
142
|
max: 3,
|
|
142
143
|
step: .1,
|
|
143
|
-
value:
|
|
144
|
-
onChange: (e) =>
|
|
145
|
-
label:
|
|
146
|
-
styles: { root:
|
|
144
|
+
value: z,
|
|
145
|
+
onChange: (e) => B(e),
|
|
146
|
+
label: R("image_cropper.zoom"),
|
|
147
|
+
styles: { root: h.zoomSlider }
|
|
147
148
|
})
|
|
148
149
|
}),
|
|
149
|
-
|
|
150
|
-
className:
|
|
151
|
-
children: /* @__PURE__ */
|
|
150
|
+
re && /* @__PURE__ */ C("div", {
|
|
151
|
+
className: h.rotationControl,
|
|
152
|
+
children: /* @__PURE__ */ C(o, {
|
|
152
153
|
iconName: "RefreshIcon",
|
|
153
|
-
onClick:
|
|
154
|
-
"aria-label":
|
|
154
|
+
onClick: fe,
|
|
155
|
+
"aria-label": R("image_cropper.rotate"),
|
|
155
156
|
variant: "outline",
|
|
156
157
|
size: "sm"
|
|
157
158
|
})
|
|
158
159
|
}),
|
|
159
|
-
|
|
160
|
-
className:
|
|
161
|
-
children: /* @__PURE__ */
|
|
162
|
-
onClick:
|
|
160
|
+
ae && /* @__PURE__ */ C("div", {
|
|
161
|
+
className: h.applyControl,
|
|
162
|
+
children: /* @__PURE__ */ C(r, {
|
|
163
|
+
onClick: pe,
|
|
163
164
|
size: "sm",
|
|
164
165
|
variant: "solid",
|
|
165
|
-
children:
|
|
166
|
+
children: oe || R("image_cropper.apply")
|
|
166
167
|
})
|
|
167
168
|
})
|
|
168
169
|
]
|
|
169
170
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
open:
|
|
171
|
+
/* @__PURE__ */ C(s, {
|
|
172
|
+
open: ce,
|
|
172
173
|
onOpenChange: J,
|
|
173
|
-
children: /* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ w(l, { children: [
|
|
175
|
+
/* @__PURE__ */ C(ee, { children: /* @__PURE__ */ C(f, { children: R("image_cropper.confirm_title") }) }),
|
|
176
|
+
/* @__PURE__ */ C(u, { children: R("image_cropper.confirm_message") }),
|
|
177
|
+
/* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C(c, {
|
|
177
178
|
asChild: !0,
|
|
178
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ C(r, {
|
|
179
180
|
variant: "ghost",
|
|
180
|
-
children:
|
|
181
|
+
children: R("image_cropper.cancel")
|
|
181
182
|
})
|
|
182
|
-
}), /* @__PURE__ */
|
|
183
|
-
onClick:
|
|
183
|
+
}), /* @__PURE__ */ C(r, {
|
|
184
|
+
onClick: me,
|
|
184
185
|
variant: "solid",
|
|
185
|
-
children:
|
|
186
|
+
children: R("image_cropper.confirm")
|
|
186
187
|
})] })
|
|
187
188
|
] })
|
|
188
189
|
})
|
|
189
190
|
]
|
|
190
|
-
}) : /* @__PURE__ */
|
|
191
|
+
}) : /* @__PURE__ */ C("div", {
|
|
191
192
|
ref: I,
|
|
192
|
-
|
|
193
|
+
role: L,
|
|
194
|
+
className: S("wim-image-cropper", h.root, h.empty, P),
|
|
193
195
|
...F,
|
|
194
|
-
children: /* @__PURE__ */
|
|
195
|
-
className:
|
|
196
|
-
children:
|
|
196
|
+
children: /* @__PURE__ */ C("div", {
|
|
197
|
+
className: h.emptyContent,
|
|
198
|
+
children: R("image_cropper.no_image")
|
|
197
199
|
})
|
|
198
200
|
});
|
|
199
201
|
});
|
|
200
|
-
|
|
202
|
+
D.displayName = "ImageCropper";
|
|
201
203
|
//#endregion
|
|
202
|
-
export {
|
|
204
|
+
export { D as ImageCropper };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/components.cjs"),r=require("../Button/Button.cjs"),i=require("../Input/Input.cjs"),a=require("../DatePicker/DatePicker.cjs"),o=require("../NumberInput/NumberInput.cjs"),s=require("../SegmentedControl/SegmentedControl.cjs"),c=require("../Select/Select.cjs"),l=require("../Switch/Switch.cjs"),u=require("../IconButton/IconButton.cjs"),d=require("./querybuilder.module.cjs"),f=require("./warn-unknown-operator.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("classnames");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=0,_=()=>typeof window<`u`&&window.__VRT__?(g+=1,`vrt-id-${g}`):Math.random().toString(36).substring(2,11),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/components.cjs"),r=require("../Button/Button.cjs"),i=require("../Input/Input.cjs"),a=require("../DatePicker/DatePicker.cjs"),o=require("../NumberInput/NumberInput.cjs"),s=require("../SegmentedControl/SegmentedControl.cjs"),c=require("../Select/Select.cjs"),l=require("../Switch/Switch.cjs"),u=require("../IconButton/IconButton.cjs"),d=require("./querybuilder.module.cjs"),f=require("./warn-unknown-operator.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("classnames");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var g=0,_=()=>typeof window<`u`&&window.__VRT__?(g+=1,`vrt-id-${g}`):Math.random().toString(36).substring(2,11),ee={string:[{value:`=`,key:`equal`},{value:`!=`,key:`not_equal`},{value:`contains`,key:`contains`},{value:`starts_with`,key:`starts_with`},{value:`ends_with`,key:`ends_with`},{value:`is_null`,key:`is_null`},{value:`is_not_null`,key:`is_not_null`}],number:[{value:`=`,key:`equal`},{value:`!=`,key:`not_equal`},{value:`>`,key:`greater_than`},{value:`<`,key:`less_than`},{value:`>=`,key:`greater_than_or_equal`},{value:`<=`,key:`less_than_or_equal`},{value:`is_null`,key:`is_null`},{value:`is_not_null`,key:`is_not_null`}],date:[{value:`=`,key:`equal`},{value:`!=`,key:`not_equal`},{value:`>`,key:`after`},{value:`<`,key:`before`},{value:`>=`,key:`after_or_on`},{value:`<=`,key:`before_or_on`},{value:`is_null`,key:`is_null`},{value:`is_not_null`,key:`is_not_null`}],boolean:[{value:`=`,key:`equal`},{value:`!=`,key:`not_equal`},{value:`is_null`,key:`is_null`},{value:`is_not_null`,key:`is_not_null`}]},v=({fields:e,query:g,defaultQuery:v,onChange:y,maxDepth:b=3,className:x,id:S,labels:C={},"aria-label":w,"aria-labelledby":T,"aria-describedby":te})=>{let{t:E}=t.useWimTranslation(n.componentsNs),{ruleAdded:D=E(`query.builder.rule_added`),groupAdded:O=E(`query.builder.group_added`),removed:k=E(`query.builder.removed`),ruleAriaLabel:A=E(`query.builder.rule`),fieldAriaLabel:j=E(`query.builder.field`),operatorAriaLabel:M=E(`query.builder.operator`),valueAriaLabel:N=E(`query.builder.value`),trueLabel:P=E(`query.builder.true`),falseLabel:F=E(`query.builder.false`),removeRuleAriaLabel:I=E(`query.builder.remove_rule`),removeGroupAriaLabel:L=E(`query.builder.remove_group`),addRuleLabel:R=E(`query.builder.add_rule`),addGroupLabel:z=E(`query.builder.add_group`),regionAriaLabel:B=E(`query.builder.region_label`),combinatorAriaLabel:V=E(`query.builder.combinator`),operators:H={}}=C,U=(0,p.useId)(),W=S||`wim-qb-${U}`,G=(0,p.useRef)(null),[K,q]=(0,p.useState)(v||{id:_(),combinator:`and`,not:!1,rules:[]}),J=g===void 0?K:g,Y=(0,p.useCallback)(e=>{G.current&&(G.current.textContent=``,setTimeout(()=>{G.current&&(G.current.textContent=e)},50))},[]),X=(0,p.useCallback)(e=>{g===void 0&&q(e),y?.(e)},[g,y]),Z=(e,t)=>{let n=r=>r.id===e?{...r,...t}:{...r,rules:r.rules.map(r=>r.id===e?{...r,...t}:`rules`in r?n(r):r)};X(n(J))},ne=t=>{let n=e[0],r={id:_(),field:n?.name||``,operator:`=`,value:n?.type!==`boolean`&&``},i=e=>e.id===t?{...e,rules:[...e.rules,r]}:{...e,rules:e.rules.map(e=>`rules`in e?i(e):e)};X(i(J)),Y(D)},re=e=>{let t={id:_(),combinator:`and`,not:!1,rules:[]},n=r=>r.id===e?{...r,rules:[...r.rules,t]}:{...r,rules:r.rules.map(e=>`rules`in e?n(e):e)};X(n(J)),Y(O)},Q=e=>{let t=n=>({...n,rules:n.rules.filter(t=>t.id!==e).map(e=>`rules`in e?t(e):e)});X(t(J)),Y(k)},$=(e,t,n)=>{let i=`${e.combinator.toUpperCase()} group`;return(0,h.jsxs)(`div`,{role:`group`,"aria-label":i,className:(0,m.default)(d.default.group,t>0&&d.default.nested,n&&d.default.excluded),children:[(0,h.jsxs)(`div`,{className:d.default.groupHeader,children:[(0,h.jsxs)(`div`,{className:d.default.groupHeaderLeft,children:[(0,h.jsx)(s.SegmentedControl,{size:`md`,options:[{label:`AND`,value:`and`},{label:`OR`,value:`or`}],value:e.combinator,onChange:t=>Z(e.id,{combinator:t}),"aria-label":V,styles:{root:d.default.segmentedControl,item:d.default.segmentedControlItem,slider:d.default.segmentedControlSlider}}),(0,h.jsx)(l.Switch,{size:`md`,checked:e.not,onChange:t=>Z(e.id,{not:t.target.checked}),children:`NOT`})]}),t>0&&(0,h.jsx)(u.IconButton,{iconName:`TrashIcon`,"aria-label":L,variant:`ghost`,size:`md`,intent:`danger`,onClick:()=>Q(e.id),className:d.default.removeGroup})]}),(0,h.jsx)(`div`,{className:d.default.ruleList,children:e.rules.map(e=>`rules`in e?$(e,t+1,n):ie(e))}),(0,h.jsxs)(`div`,{className:d.default.groupActions,children:[(0,h.jsx)(r.Button,{size:`md`,variant:`ghost`,icon:`PlusIcon`,onClick:()=>ne(e.id),children:R}),t<b&&(0,h.jsx)(r.Button,{size:`md`,variant:`ghost`,icon:`PlusIcon`,onClick:()=>re(e.id),children:z})]})]},e.id)},ie=t=>{let n=e.find(e=>e.name===t.field)?.type||`string`,r=ee[n].map(e=>({...e,label:H[e.key]||E(`query.builder.operators.${e.key}`)})),s=n=>{let r=e.find(e=>e.name===n);Z(t.id,{field:n,operator:`=`,value:r?.type!==`boolean`&&``})};r.some(e=>e.value===t.operator)||f.warnUnknownOperator(t.operator,n,r.map(e=>e.value));let l=t.operator===`is_null`||t.operator===`is_not_null`;return(0,h.jsx)(`div`,{className:d.default.rule,role:`group`,"aria-label":A,children:(0,h.jsxs)(`div`,{className:d.default.ruleFields,children:[(0,h.jsx)(c.Select,{className:d.default.field,options:e.map(e=>({label:e.label,value:e.name})),value:t.field,onChange:s,"aria-label":j,fullWidth:!0,styles:{root:d.default.select,trigger:d.default.selectTrigger,inputBase:{root:d.default.inputBase}}}),(0,h.jsx)(c.Select,{className:d.default.operator,options:r.map(e=>({label:e.label,value:e.value})),value:t.operator,onChange:e=>Z(t.id,{operator:e}),"aria-label":M,fullWidth:!0,styles:{root:d.default.select,trigger:d.default.selectTrigger,inputBase:{root:d.default.inputBase}}}),!l&&(0,h.jsx)(`div`,{className:d.default.value,children:n===`number`?(0,h.jsx)(o.NumberInput,{value:typeof t.value==`boolean`?void 0:t.value??void 0,onChange:e=>Z(t.id,{value:e.target.value}),"aria-label":N}):n===`date`?(0,h.jsx)(a.DatePicker,{value:typeof t.value==`string`||typeof t.value==`number`?new Date(t.value):void 0,onChange:e=>Z(t.id,{value:e?e.toISOString():``}),"aria-label":N}):n===`boolean`?(0,h.jsx)(c.Select,{options:[{label:P,value:`true`},{label:F,value:`false`}],value:String(t.value),onChange:e=>Z(t.id,{value:e===`true`}),"aria-label":N,fullWidth:!0,styles:{root:d.default.select,trigger:d.default.selectTrigger,inputBase:{root:d.default.inputBase}}}):(0,h.jsx)(i.Input,{value:typeof t.value==`boolean`?void 0:t.value??void 0,onChange:e=>Z(t.id,{value:e.target.value}),"aria-label":N,styles:{root:d.default.inputBase}})}),(0,h.jsx)(u.IconButton,{iconName:`TrashIcon`,"aria-label":I,variant:`ghost`,size:`md`,intent:`danger`,onClick:()=>Q(t.id),className:d.default.removeRule})]})},t.id)};return(0,h.jsxs)(`div`,{id:W,role:`region`,"aria-label":T?void 0:w??B,"aria-labelledby":T,"aria-describedby":te,className:(0,m.default)(`wim-query-builder`,d.default.root,x),children:[(0,h.jsx)(`div`,{ref:G,"aria-live":`polite`,"aria-atomic":`true`,className:d.default.srOnly}),$(J,0,!1)]})};exports.QueryBuilder=v;
|
|
@@ -68,6 +68,12 @@ export interface QueryBuilderProps {
|
|
|
68
68
|
* Labels for internationalization
|
|
69
69
|
*/
|
|
70
70
|
labels?: QueryBuilderLabels;
|
|
71
|
+
/** Accessible name for the query builder region. Takes precedence over `labels.regionAriaLabel`. */
|
|
72
|
+
"aria-label"?: string;
|
|
73
|
+
/** ID of the element that labels the query builder region. Takes precedence over `aria-label`. */
|
|
74
|
+
"aria-labelledby"?: string;
|
|
75
|
+
/** ID of the element that describes the query builder region. */
|
|
76
|
+
"aria-describedby"?: string;
|
|
71
77
|
}
|
|
72
78
|
/**
|
|
73
79
|
* 演算子の語彙。**利用者が `QueryRule.operator` に渡すのは `value`(記号)**で、
|
|
@@ -167,5 +173,5 @@ export type QueryOperator = (typeof DEFAULT_OPERATORS)[QueryFieldType][number]["
|
|
|
167
173
|
/**
|
|
168
174
|
* 複雑な検索条件をネスト状に組み立てるためのクエリビルダーコンポーネント。
|
|
169
175
|
*/
|
|
170
|
-
export declare const QueryBuilder: ({ fields, query, defaultQuery, onChange, maxDepth, className, id: customId, labels, }: QueryBuilderProps) => React.JSX.Element;
|
|
176
|
+
export declare const QueryBuilder: ({ fields, query, defaultQuery, onChange, maxDepth, className, id: customId, labels, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: QueryBuilderProps) => React.JSX.Element;
|
|
171
177
|
export {};
|