wimui 0.64.3 → 0.64.5
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/ai/code-diff-viewer.js +1 -2
- package/dist/ai/interactive-graph.js +1 -2
- package/dist/ai/markdown-renderer.js +1 -2
- package/dist/ai/streaming-text.js +1 -2
- package/dist/components/_internal/observeMove.cjs +1 -1
- package/dist/components/_internal/observeMove.js +9 -10
- package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
- package/dist/components/ai/SourceCitation/SourceCitation.js +1 -1
- package/dist/components/charts/SankeyChart/SankeyChart.cjs +1 -1
- package/dist/components/charts/SankeyChart/SankeyChart.js +1 -5
- package/dist/components/data-display/Accordion/Accordion.cjs +1 -1
- package/dist/components/data-display/Accordion/Accordion.js +1 -5
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +2 -14
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +180 -171
- package/dist/components/data-display/NodeGraph/NodeGraph.cjs +1 -1
- package/dist/components/data-display/NodeGraph/NodeGraph.js +1 -7
- package/dist/components/data-display/ScheduleView/ScheduleView.cjs +1 -1
- package/dist/components/data-display/ScheduleView/ScheduleView.js +3 -1
- package/dist/components/data-display/SwipeAction/SwipeAction.cjs +1 -1
- package/dist/components/data-display/SwipeAction/SwipeAction.js +9 -10
- package/dist/components/data-display/TreeDiagram/TreeDiagram.cjs +1 -1
- package/dist/components/data-display/TreeDiagram/TreeDiagram.js +94 -73
- package/dist/components/feedback/Tour/Tour.cjs +1 -1
- package/dist/components/feedback/Tour/Tour.js +2 -6
- package/dist/components/form/Button/Button.cjs +1 -1
- package/dist/components/form/Button/Button.js +58 -55
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +2 -5
- package/dist/components/form/Dropzone/Dropzone.cjs +1 -1
- package/dist/components/form/Dropzone/Dropzone.js +83 -68
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +64 -47
- package/dist/components/form/FloatButton/FloatButton.cjs +1 -1
- package/dist/components/form/FloatButton/FloatButton.js +7 -6
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +76 -73
- package/dist/components/form/RichTextEditor/RichTextEditor.cjs +1 -1
- package/dist/components/form/RichTextEditor/RichTextEditor.js +117 -129
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +1 -7
- package/dist/components/layout/InteractiveArea/InteractiveArea.cjs +1 -1
- package/dist/components/layout/InteractiveArea/InteractiveArea.js +1 -5
- package/dist/components/media/Audio/hooks/useAudioPlayer.cjs +1 -1
- package/dist/components/media/Audio/hooks/useAudioPlayer.js +1 -9
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +5 -9
- package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.js +1 -8
- package/dist/components/navigation/TabNavigation/TabNavigation.cjs +1 -1
- package/dist/components/navigation/TabNavigation/TabNavigation.js +1 -5
- package/dist/data-display/json-diff-viewer.js +1 -2
- package/dist/data-display/markdown.js +1 -2
- package/dist/data-display/node-graph.js +1 -2
- package/dist/data-display/qr-code.js +1 -2
- package/dist/data-display/schedule-view.js +1 -2
- package/dist/form/rich-text-editor.js +1 -2
- package/dist/i18n/generated/common.cjs +1 -1
- package/dist/i18n/generated/common.d.ts +1 -1
- package/dist/i18n/generated/common.js +15 -6
- package/dist/i18n/generated/form.cjs +1 -1
- package/dist/i18n/generated/form.d.ts +1 -1
- package/dist/i18n/generated/form.js +6 -3
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/locales/en/common.json +5 -1
- package/dist/locales/en/form.json +2 -1
- package/dist/locales/ja/common.json +5 -1
- package/dist/locales/ja/form.json +2 -1
- package/dist/locales/pt/common.json +5 -1
- package/dist/locales/pt/form.json +2 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +18 -17
- package/dist/rhf/zod.js +1 -2
- package/dist/wimui.umd.js +5 -5
- package/package.json +44 -44
|
@@ -1,78 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { InteractiveArea as e } from "../../layout/InteractiveArea/InteractiveArea.js";
|
|
3
3
|
import { useWimTranslation as t } from "../../../i18n/useWimTranslation.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import a from "
|
|
8
|
-
import o
|
|
9
|
-
import l from "
|
|
10
|
-
import
|
|
4
|
+
import { VisuallyHidden as n } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
5
|
+
import { Icon as r } from "../../media/Icon/Icon.js";
|
|
6
|
+
import { formNs as i } from "../../../i18n/generated/form.js";
|
|
7
|
+
import { FieldTemplate as a } from "../FieldTemplate/FieldTemplate.js";
|
|
8
|
+
import o from "./dropzone.module.js";
|
|
9
|
+
import s, { useRef as c, useState as l } from "react";
|
|
10
|
+
import u from "classnames";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/Dropzone/Dropzone.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
e.preventDefault(), !
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
if (e.preventDefault(),
|
|
13
|
+
var p = ({ label: p, description: m, accept: h, multiple: g = !1, disabled: _ = !1, value: v, onChange: y, className: b, iconName: x = "UploadIcon", error: S, required: C, layout: w = "vertical", size: T = "md", "aria-label": E, "aria-labelledby": D, "aria-describedby": O }) => {
|
|
14
|
+
let { t: k } = t(i), A = m ?? k("dropzone.description"), j = `wim-dropzone-${s.useId()}`, M = p ? `${j}-label` : void 0, N = S ? `${j}-error` : void 0, P = `${j}-description`, F = `${j}-files`, I = `${j}-name`, L = M ?? D ?? (E ? I : void 0), R = c(null), [z, B] = l(!1), [V, H] = l(null), U = () => {
|
|
15
|
+
_ || R.current?.click();
|
|
16
|
+
}, W = (e) => {
|
|
17
|
+
e.preventDefault(), !_ && B(!0);
|
|
18
|
+
}, G = () => {
|
|
19
|
+
B(!1);
|
|
20
|
+
}, K = (e) => {
|
|
21
|
+
if (e.preventDefault(), B(!1), _) return;
|
|
21
22
|
let t = e.dataTransfer.files;
|
|
22
|
-
|
|
23
|
-
},
|
|
23
|
+
H(t), y && y(t);
|
|
24
|
+
}, q = (e) => {
|
|
24
25
|
let t = e.target.files;
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
label:
|
|
29
|
-
error:
|
|
30
|
-
required:
|
|
31
|
-
layout:
|
|
32
|
-
labelId:
|
|
33
|
-
errorId:
|
|
34
|
-
className:
|
|
35
|
-
children: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
size: w,
|
|
47
|
-
isDragging: P,
|
|
48
|
-
disabled: g,
|
|
49
|
-
isClickable: !g,
|
|
50
|
-
onClick: R,
|
|
51
|
-
onDragOver: z,
|
|
52
|
-
onDragLeave: B,
|
|
53
|
-
onDrop: V,
|
|
54
|
-
onKeyDown: (e) => {
|
|
55
|
-
(e.key === "Enter" || e.key === " ") && R();
|
|
56
|
-
},
|
|
57
|
-
"aria-labelledby": j ?? E,
|
|
58
|
-
"aria-label": j || E ? void 0 : T,
|
|
59
|
-
"aria-describedby": [D, M].filter(Boolean).join(" ") || void 0,
|
|
60
|
-
"aria-required": S,
|
|
61
|
-
"aria-invalid": !!x,
|
|
62
|
-
icon: b && /* @__PURE__ */ u(n, {
|
|
63
|
-
name: b,
|
|
64
|
-
color: g ? "disabled" : "primary"
|
|
26
|
+
H(t), y && y(t);
|
|
27
|
+
}, J = v === void 0 ? V ? Array.from(V).map((e) => e.name) : [] : v;
|
|
28
|
+
return /* @__PURE__ */ f(a, {
|
|
29
|
+
label: p,
|
|
30
|
+
error: S,
|
|
31
|
+
required: C,
|
|
32
|
+
layout: w,
|
|
33
|
+
labelId: M,
|
|
34
|
+
errorId: N,
|
|
35
|
+
className: u("wim-dropzone", o.container, b),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ d("input", {
|
|
38
|
+
type: "file",
|
|
39
|
+
ref: R,
|
|
40
|
+
accept: h,
|
|
41
|
+
multiple: g,
|
|
42
|
+
disabled: _,
|
|
43
|
+
onChange: q,
|
|
44
|
+
style: { display: "none" },
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
tabIndex: -1
|
|
65
47
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
L === I && /* @__PURE__ */ d(n, {
|
|
49
|
+
id: I,
|
|
50
|
+
children: E
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ d(e, {
|
|
53
|
+
size: T,
|
|
54
|
+
isDragging: z,
|
|
55
|
+
disabled: _,
|
|
56
|
+
isClickable: !_,
|
|
57
|
+
onClick: U,
|
|
58
|
+
onDragOver: W,
|
|
59
|
+
onDragLeave: G,
|
|
60
|
+
onDrop: K,
|
|
61
|
+
onKeyDown: (e) => {
|
|
62
|
+
(e.key === "Enter" || e.key === " ") && U();
|
|
63
|
+
},
|
|
64
|
+
"aria-labelledby": L ? [
|
|
65
|
+
L,
|
|
66
|
+
P,
|
|
67
|
+
J.length > 0 && F
|
|
68
|
+
].filter(Boolean).join(" ") : void 0,
|
|
69
|
+
"aria-describedby": [O, N].filter(Boolean).join(" ") || void 0,
|
|
70
|
+
"aria-required": C,
|
|
71
|
+
"aria-invalid": !!S,
|
|
72
|
+
icon: x && /* @__PURE__ */ d(r, {
|
|
73
|
+
name: x,
|
|
74
|
+
color: _ ? "disabled" : "primary"
|
|
75
|
+
}),
|
|
76
|
+
description: /* @__PURE__ */ d("span", {
|
|
77
|
+
id: P,
|
|
78
|
+
children: A
|
|
79
|
+
}),
|
|
80
|
+
children: J.length > 0 ? /* @__PURE__ */ d("div", {
|
|
81
|
+
id: F,
|
|
82
|
+
className: o.fileList,
|
|
83
|
+
children: J.map((e, t) => /* @__PURE__ */ d("span", {
|
|
84
|
+
className: o.fileName,
|
|
85
|
+
children: e
|
|
86
|
+
}, t))
|
|
87
|
+
}) : null
|
|
88
|
+
})
|
|
89
|
+
]
|
|
75
90
|
});
|
|
76
91
|
};
|
|
77
92
|
//#endregion
|
|
78
|
-
export {
|
|
93
|
+
export { p as Dropzone };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../Button/Button.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./file-upload.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({label:e,buttonLabel:u,noFileLabel:d,accept:f,multiple:p=!1,disabled:m=!1,value:h,onChange:g,className:_,iconName:v,iconPosition:y,size:b=`md`,error:x,required:S,layout:C=`vertical`,"aria-label":w,"aria-labelledby":T,"aria-describedby":E})=>{let{t:D}=t.useWimTranslation(i.formNs),O=`wim-fileupload-${s.default.useId()}`,k=e?`${O}-label`:void 0,A=x?`${O}-error`:void 0,j=S?`${O}-required`:void 0,M=[E,A,j].filter(Boolean).join(` `)
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),r=require("../Button/Button.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./file-upload.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({label:e,buttonLabel:u,noFileLabel:d,accept:f,multiple:p=!1,disabled:m=!1,value:h,onChange:g,className:_,iconName:v,iconPosition:y,size:b=`md`,error:x,required:S,layout:C=`vertical`,"aria-label":w,"aria-labelledby":T,"aria-describedby":E})=>{let{t:D}=t.useWimTranslation(i.formNs),O=`wim-fileupload-${s.default.useId()}`,k=e?`${O}-label`:void 0,A=x?`${O}-error`:void 0,j=S?`${O}-required`:void 0,M=`${O}-files`,N=[E,M,A,j].filter(Boolean).join(` `),P=`${O}-button`,F=`${O}-name`,I=k??T??(w?F:void 0),L=I?`${I} ${P}`:void 0,R=(0,s.useRef)(null),[z,B]=(0,s.useState)(null),[V,H]=(0,s.useState)(``),U=(0,s.useRef)(void 0);(0,s.useEffect)(()=>()=>clearTimeout(U.current),[]);let W=()=>{R.current?.click()},G=e=>{let t=e.target.files;if(B(t),clearTimeout(U.current),H(``),t&&t.length>0){let e=Array.from(t).map(e=>e.name).join(`, `);U.current=setTimeout(()=>H(D(`fileupload.selected`,{files:e})),700)}g&&g(t)},K=h===void 0?z?Array.from(z).map(e=>e.name):[]:h,q=K.length>0?K.join(`, `):d??D(`fileupload.no_file`);return(0,l.jsx)(a.FieldTemplate,{label:e,error:x,required:S,layout:C,labelId:k,errorId:A,className:(0,c.default)(`wim-file-upload`,o.default.root,o.default[b],_),children:(0,l.jsxs)(`div`,{className:o.default.controls,children:[(0,l.jsx)(`input`,{type:`file`,ref:R,accept:f,multiple:p,disabled:m,onChange:G,className:o.default.input,"aria-hidden":`true`,tabIndex:-1}),(0,l.jsx)(r.Button,{onClick:W,disabled:m,variant:`outline`,icon:v,iconPosition:y,size:b,id:P,"aria-labelledby":L,"aria-describedby":N,"aria-invalid":x?!0:void 0,children:u??D(`fileupload.button`)}),I===F&&(0,l.jsx)(n.VisuallyHidden,{id:F,children:w}),S&&(0,l.jsx)(n.VisuallyHidden,{id:j,children:D(`form.required`)}),(0,l.jsx)(n.VisuallyHidden,{role:`status`,"aria-atomic":`true`,children:V}),(0,l.jsx)(`span`,{id:M,className:(0,c.default)(o.default.fileNames,o.default[b],m&&o.default.disabled),"aria-disabled":m||void 0,children:q})]})})};exports.FileUpload=u;
|
|
@@ -5,68 +5,85 @@ import { Button as n } from "../Button/Button.js";
|
|
|
5
5
|
import { formNs as r } from "../../../i18n/generated/form.js";
|
|
6
6
|
import { FieldTemplate as i } from "../FieldTemplate/FieldTemplate.js";
|
|
7
7
|
import a from "./file-upload.module.js";
|
|
8
|
-
import o, {
|
|
9
|
-
import
|
|
10
|
-
import { jsx as
|
|
8
|
+
import o, { useEffect 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";
|
|
11
11
|
//#region src/components/form/FileUpload/FileUpload.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
P
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
var p = ({ label: p, buttonLabel: m, noFileLabel: h, accept: g, multiple: _ = !1, disabled: v = !1, value: y, onChange: b, className: x, iconName: S, iconPosition: C, size: w = "md", error: T, required: E, layout: D = "vertical", "aria-label": O, "aria-labelledby": k, "aria-describedby": A }) => {
|
|
13
|
+
let { t: j } = e(r), M = `wim-fileupload-${o.useId()}`, N = p ? `${M}-label` : void 0, P = T ? `${M}-error` : void 0, F = E ? `${M}-required` : void 0, I = `${M}-files`, L = [
|
|
14
|
+
A,
|
|
15
|
+
I,
|
|
16
|
+
P,
|
|
17
|
+
F
|
|
18
|
+
].filter(Boolean).join(" "), R = `${M}-button`, z = `${M}-name`, B = N ?? k ?? (O ? z : void 0), V = B ? `${B} ${R}` : void 0, H = c(null), [U, W] = l(null), [G, K] = l(""), q = c(void 0);
|
|
19
|
+
s(() => () => clearTimeout(q.current), []);
|
|
20
|
+
let J = () => {
|
|
21
|
+
H.current?.click();
|
|
22
|
+
}, Y = (e) => {
|
|
20
23
|
let t = e.target.files;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (W(t), clearTimeout(q.current), K(""), t && t.length > 0) {
|
|
25
|
+
let e = Array.from(t).map((e) => e.name).join(", ");
|
|
26
|
+
q.current = setTimeout(() => K(j("fileupload.selected", { files: e })), 700);
|
|
27
|
+
}
|
|
28
|
+
b && b(t);
|
|
29
|
+
}, X = y === void 0 ? U ? Array.from(U).map((e) => e.name) : [] : y, Z = X.length > 0 ? X.join(", ") : h ?? j("fileupload.no_file");
|
|
30
|
+
return /* @__PURE__ */ d(i, {
|
|
31
|
+
label: p,
|
|
32
|
+
error: T,
|
|
33
|
+
required: E,
|
|
34
|
+
layout: D,
|
|
35
|
+
labelId: N,
|
|
36
|
+
errorId: P,
|
|
37
|
+
className: u("wim-file-upload", a.root, a[w], x),
|
|
38
|
+
children: /* @__PURE__ */ f("div", {
|
|
32
39
|
className: a.controls,
|
|
33
40
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ d("input", {
|
|
35
42
|
type: "file",
|
|
36
|
-
ref:
|
|
37
|
-
accept:
|
|
38
|
-
multiple:
|
|
39
|
-
disabled:
|
|
40
|
-
onChange:
|
|
43
|
+
ref: H,
|
|
44
|
+
accept: g,
|
|
45
|
+
multiple: _,
|
|
46
|
+
disabled: v,
|
|
47
|
+
onChange: Y,
|
|
41
48
|
className: a.input,
|
|
42
49
|
"aria-hidden": "true",
|
|
43
50
|
tabIndex: -1
|
|
44
51
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
onClick:
|
|
47
|
-
disabled:
|
|
52
|
+
/* @__PURE__ */ d(n, {
|
|
53
|
+
onClick: J,
|
|
54
|
+
disabled: v,
|
|
48
55
|
variant: "outline",
|
|
49
|
-
icon:
|
|
50
|
-
iconPosition:
|
|
51
|
-
size:
|
|
52
|
-
|
|
53
|
-
"aria-
|
|
54
|
-
"aria-describedby":
|
|
55
|
-
"aria-invalid":
|
|
56
|
-
children:
|
|
56
|
+
icon: S,
|
|
57
|
+
iconPosition: C,
|
|
58
|
+
size: w,
|
|
59
|
+
id: R,
|
|
60
|
+
"aria-labelledby": V,
|
|
61
|
+
"aria-describedby": L,
|
|
62
|
+
"aria-invalid": T ? !0 : void 0,
|
|
63
|
+
children: m ?? j("fileupload.button")
|
|
57
64
|
}),
|
|
58
|
-
|
|
59
|
-
id:
|
|
60
|
-
children:
|
|
65
|
+
B === z && /* @__PURE__ */ d(t, {
|
|
66
|
+
id: z,
|
|
67
|
+
children: O
|
|
61
68
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
69
|
+
E && /* @__PURE__ */ d(t, {
|
|
70
|
+
id: F,
|
|
71
|
+
children: j("form.required")
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ d(t, {
|
|
74
|
+
role: "status",
|
|
75
|
+
"aria-atomic": "true",
|
|
76
|
+
children: G
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ d("span", {
|
|
79
|
+
id: I,
|
|
80
|
+
className: u(a.fileNames, a[w], v && a.disabled),
|
|
81
|
+
"aria-disabled": v || void 0,
|
|
82
|
+
children: Z
|
|
66
83
|
})
|
|
67
84
|
]
|
|
68
85
|
})
|
|
69
86
|
});
|
|
70
87
|
};
|
|
71
88
|
//#endregion
|
|
72
|
-
export {
|
|
89
|
+
export { p as FileUpload };
|
|
@@ -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"),r=require("./float-button.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=i.default.forwardRef(({asChild:e=!1,iconName:s=`CircleIcon`,variant:c,intent:l=`default`,shape:u=`circle`,size:d=`md`,label:f,shrink:p=!1,position:m=`bottom-right`,description:h,badge:g,backTop:_=!1,visibilityHeight:v=400,className:y,style:b,onClick:x,"aria-label":S,children:C,...w},T)=>{let[E,D]=(0,i.useState)(()=>!_||typeof window<`u`&&(window.pageYOffset||document.documentElement.scrollTop)>v),O=(0,i.useCallback)(()=>{if(_){let e=window.pageYOffset||document.documentElement.scrollTop;D(e>v)}},[_,v]);(0,i.useEffect)(()=>{if(_)return window.addEventListener(`scroll`,O),()=>window.removeEventListener(`scroll`,O)},[_,O]);let k=e=>{_&&window.scrollTo({top:0,behavior:`smooth`}),x?.(e)},A=S||(typeof f==`string`?f:void 0),j=!!
|
|
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"),r=require("./float-button.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=i.default.forwardRef(({asChild:e=!1,iconName:s=`CircleIcon`,variant:c,intent:l=`default`,shape:u=`circle`,size:d=`md`,label:f,shrink:p=!1,position:m=`bottom-right`,description:h,badge:g,backTop:_=!1,visibilityHeight:v=400,className:y,style:b,onClick:x,"aria-label":S,children:C,...w},T)=>{let[E,D]=(0,i.useState)(()=>!_||typeof window<`u`&&(window.pageYOffset||document.documentElement.scrollTop)>v),O=(0,i.useCallback)(()=>{if(_){let e=window.pageYOffset||document.documentElement.scrollTop;D(e>v)}},[_,v]);(0,i.useEffect)(()=>{if(_)return window.addEventListener(`scroll`,O),()=>window.removeEventListener(`scroll`,O)},[_,O]);let k=e=>{_&&window.scrollTo({top:0,behavior:`smooth`}),x?.(e)},A=S||(typeof f==`string`?f:void 0),j=A&&typeof g==`number`?`${A} ${g}`:A,M=!!j||!!f||!!C||!!w[`aria-labelledby`]||typeof h==`string`;if((0,i.useEffect)(()=>{},[M]),!E&&_)return null;let N=e?t.Root:`button`,P=m===`bottom-right`?r.default.bottomRight:m===`bottom-left`?r.default.bottomLeft:m===`bottom-center`?r.default.bottomCenter:m===`top-right`?r.default.topRight:m===`top-left`?r.default.topLeft:r.default.inline;return(0,o.jsxs)(N,{ref:T,type:e?void 0:`button`,className:(0,a.default)(`wim-float-button`,r.default.root,!c&&r.default[l],c===`outline`&&r.default.outline,c===`glass`&&r.default.glass,l===`danger`&&r.default.danger,l===`success`&&r.default.success,r.default[u],r.default[d],P,!!f&&r.default.extended,!!p&&r.default.shrink,y),style:b,onClick:k,title:typeof h==`string`?h:void 0,"aria-label":j,...w,children:[(0,o.jsx)(t.Slottable,{children:C}),(0,o.jsxs)(`span`,{className:r.default.inner,children:[(0,o.jsx)(n.Icon,{name:_?`ChevronUpIcon`:s,size:d,className:(0,a.default)(_&&r.default.iconBacktop)}),f&&(0,o.jsx)(`span`,{className:r.default.labelWrapper,children:(0,o.jsx)(`span`,{className:r.default.label,children:f})}),typeof g==`number`&&` `,g&&(0,o.jsx)(`span`,{className:(0,a.default)(r.default.badge,g===!0&&r.default.dot),children:typeof g==`number`?g:``})]}),h&&(0,o.jsx)(`span`,{className:r.default.description,children:h})]})});s.displayName=`FloatButton`,exports.FloatButton=s,exports.default=s;
|
|
@@ -21,17 +21,17 @@ var d = i.forwardRef(({ asChild: i = !1, iconName: d = "CircleIcon", variant: f,
|
|
|
21
21
|
top: 0,
|
|
22
22
|
behavior: "smooth"
|
|
23
23
|
}), T?.(e);
|
|
24
|
-
}, P = E || (typeof g == "string" ? g : void 0), F =
|
|
25
|
-
if (o(() => {}, [
|
|
26
|
-
let
|
|
27
|
-
return /* @__PURE__ */ u(
|
|
24
|
+
}, P = E || (typeof g == "string" ? g : void 0), F = P && typeof b == "number" ? `${P} ${b}` : P, I = !!F || !!g || !!D || !!O["aria-labelledby"] || typeof y == "string";
|
|
25
|
+
if (o(() => {}, [I]), !A && x) return null;
|
|
26
|
+
let L = i ? e : "button", R = v === "bottom-right" ? r.bottomRight : v === "bottom-left" ? r.bottomLeft : v === "bottom-center" ? r.bottomCenter : v === "top-right" ? r.topRight : v === "top-left" ? r.topLeft : r.inline;
|
|
27
|
+
return /* @__PURE__ */ u(L, {
|
|
28
28
|
ref: k,
|
|
29
29
|
type: i ? void 0 : "button",
|
|
30
|
-
className: c("wim-float-button", r.root, !f && r[p], f === "outline" && r.outline, f === "glass" && r.glass, p === "danger" && r.danger, p === "success" && r.success, r[m], r[h],
|
|
30
|
+
className: c("wim-float-button", r.root, !f && r[p], f === "outline" && r.outline, f === "glass" && r.glass, p === "danger" && r.danger, p === "success" && r.success, r[m], r[h], R, !!g && r.extended, !!_ && r.shrink, C),
|
|
31
31
|
style: w,
|
|
32
32
|
onClick: N,
|
|
33
33
|
title: typeof y == "string" ? y : void 0,
|
|
34
|
-
"aria-label":
|
|
34
|
+
"aria-label": F,
|
|
35
35
|
...O,
|
|
36
36
|
children: [
|
|
37
37
|
/* @__PURE__ */ l(t, { children: D }),
|
|
@@ -50,6 +50,7 @@ var d = i.forwardRef(({ asChild: i = !1, iconName: d = "CircleIcon", variant: f,
|
|
|
50
50
|
children: g
|
|
51
51
|
})
|
|
52
52
|
}),
|
|
53
|
+
typeof b == "number" && " ",
|
|
53
54
|
b && /* @__PURE__ */ l("span", {
|
|
54
55
|
className: c(r.badge, b === !0 && r.dot),
|
|
55
56
|
children: typeof b == "number" ? b : ""
|
|
@@ -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("../FieldTemplate/FieldTemplate.cjs"),
|
|
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("../FieldTemplate/FieldTemplate.cjs"),a=require("../Input/Input.cjs"),o=require("../IconButton/IconButton.cjs"),s=require("./inline-edit.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=c.default.forwardRef(({value:e,defaultValue:d,onChange:f,onSave:p,onCancel:m,onEdit:h,placeholder:g,disabled:_=!1,fullWidth:v=!1,label:y,className:b,"aria-label":x,"aria-labelledby":S,"aria-describedby":C,...w},T)=>{let{t:E}=t.useWimTranslation(n.commonNs),[D,O]=(0,c.useState)(!1),k=(0,c.useId)(),A=y?`wim-inline-edit-${k}-label`:void 0,j=`wim-inline-edit-${k}-text`,M=`wim-inline-edit-${k}-name`,N=A??S??(x?M:void 0),[P,F]=(0,c.useState)(d??``),[I,L]=(0,c.useState)(d??``),R=(0,c.useRef)(null),z=e!==void 0,B=z?e:I,V=()=>{_||(z||L(P),O(!0),h?.())},H=()=>{_||(z||F(B),O(!1),p?.(B))},U=()=>{_||(z||L(P),O(!1),m?.())},W=e=>{let t=e.target.value;z||L(t),f?.(t)},G=e=>{e.key===`Enter`?(e.preventDefault(),H()):e.key===`Escape`&&(e.preventDefault(),U())};return(0,c.useEffect)(()=>{D&&R.current&&R.current.focus()},[D]),(0,u.jsx)(i.FieldTemplate,{label:y,labelId:A,className:b,children:(0,u.jsxs)(`div`,{ref:T,className:(0,l.default)(`wim-inline-edit`,s.default.root,v&&s.default.fullWidth,_&&s.default.disabled),...w,children:[!D&&N===M&&(0,u.jsx)(r.VisuallyHidden,{id:M,children:x}),D?(0,u.jsxs)(`div`,{className:s.default.editWrapper,children:[(0,u.jsx)(a.Input,{ref:R,value:B,onChange:W,onKeyDown:G,disabled:_,placeholder:g,"aria-label":A?void 0:x,"aria-labelledby":A??S,"aria-describedby":C,fullWidth:v,className:s.default.input}),(0,u.jsxs)(`div`,{className:s.default.editActions,children:[(0,u.jsx)(o.IconButton,{iconName:`CheckIcon`,intent:`success`,variant:`outline`,"aria-label":E(`action.save`),onClick:H,disabled:_}),(0,u.jsx)(o.IconButton,{iconName:`CloseIcon`,intent:`default`,variant:`outline`,"aria-label":E(`action.cancel`),onClick:U,disabled:_})]})]}):(0,u.jsxs)(`div`,{className:s.default.preview,onClick:V,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V())},tabIndex:_?-1:0,role:`button`,"aria-labelledby":N?`${N} ${j}`:void 0,"aria-describedby":C,"aria-disabled":_,children:[(0,u.jsx)(`span`,{id:j,className:(0,l.default)(s.default.text,!B&&s.default.placeholder),children:B||g||`\xA0`}),(0,u.jsx)(`span`,{className:s.default.editIconWrapper,children:(0,u.jsx)(o.IconButton,{iconName:`EditIcon`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":E(`action.edit`),"aria-hidden":`true`,asChild:!0,children:(0,u.jsx)(`span`,{})})})]})]})})});d.displayName=`InlineEdit`,exports.InlineEdit=d;
|
|
@@ -1,102 +1,105 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import a from "
|
|
8
|
-
import o
|
|
9
|
-
import d from "
|
|
10
|
-
import
|
|
4
|
+
import { VisuallyHidden as n } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
5
|
+
import { FieldTemplate as r } from "../FieldTemplate/FieldTemplate.js";
|
|
6
|
+
import { Input as i } from "../Input/Input.js";
|
|
7
|
+
import { IconButton as a } from "../IconButton/IconButton.js";
|
|
8
|
+
import o from "./inline-edit.module.js";
|
|
9
|
+
import s, { useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
10
|
+
import f from "classnames";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/InlineEdit/InlineEdit.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
13
|
+
var h = s.forwardRef(({ value: s, defaultValue: h, onChange: g, onSave: _, onCancel: v, onEdit: y, placeholder: b, disabled: x = !1, fullWidth: S = !1, label: C, className: w, "aria-label": T, "aria-labelledby": E, "aria-describedby": D, ...O }, k) => {
|
|
14
|
+
let { t: A } = e(t), [j, M] = d(!1), N = l(), P = C ? `wim-inline-edit-${N}-label` : void 0, F = `wim-inline-edit-${N}-text`, I = `wim-inline-edit-${N}-name`, L = P ?? E ?? (T ? I : void 0), [R, z] = d(h ?? ""), [B, V] = d(h ?? ""), H = u(null), U = s !== void 0, W = U ? s : B, G = () => {
|
|
15
|
+
x || (U || V(R), M(!0), y?.());
|
|
16
|
+
}, K = () => {
|
|
17
|
+
x || (U || z(W), M(!1), _?.(W));
|
|
18
|
+
}, q = () => {
|
|
19
|
+
x || (U || V(R), M(!1), v?.());
|
|
20
|
+
}, J = (e) => {
|
|
20
21
|
let t = e.target.value;
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
e.key === "Enter" ? (e.preventDefault(),
|
|
22
|
+
U || V(t), g?.(t);
|
|
23
|
+
}, Y = (e) => {
|
|
24
|
+
e.key === "Enter" ? (e.preventDefault(), K()) : e.key === "Escape" && (e.preventDefault(), q());
|
|
24
25
|
};
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
label:
|
|
29
|
-
labelId:
|
|
30
|
-
className:
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
ref:
|
|
33
|
-
className:
|
|
34
|
-
...
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
return c(() => {
|
|
27
|
+
j && H.current && H.current.focus();
|
|
28
|
+
}, [j]), /* @__PURE__ */ p(r, {
|
|
29
|
+
label: C,
|
|
30
|
+
labelId: P,
|
|
31
|
+
className: w,
|
|
32
|
+
children: /* @__PURE__ */ m("div", {
|
|
33
|
+
ref: k,
|
|
34
|
+
className: f("wim-inline-edit", o.root, S && o.fullWidth, x && o.disabled),
|
|
35
|
+
...O,
|
|
36
|
+
children: [!j && L === I && /* @__PURE__ */ p(n, {
|
|
37
|
+
id: I,
|
|
38
|
+
children: T
|
|
39
|
+
}), j ? /* @__PURE__ */ m("div", {
|
|
40
|
+
className: o.editWrapper,
|
|
41
|
+
children: [/* @__PURE__ */ p(i, {
|
|
42
|
+
ref: H,
|
|
43
|
+
value: W,
|
|
44
|
+
onChange: J,
|
|
45
|
+
onKeyDown: Y,
|
|
46
|
+
disabled: x,
|
|
47
|
+
placeholder: b,
|
|
48
|
+
"aria-label": P ? void 0 : T,
|
|
49
|
+
"aria-labelledby": P ?? E,
|
|
50
|
+
"aria-describedby": D,
|
|
51
|
+
fullWidth: S,
|
|
52
|
+
className: o.input
|
|
53
|
+
}), /* @__PURE__ */ m("div", {
|
|
54
|
+
className: o.editActions,
|
|
55
|
+
children: [/* @__PURE__ */ p(a, {
|
|
52
56
|
iconName: "CheckIcon",
|
|
53
57
|
intent: "success",
|
|
54
58
|
variant: "outline",
|
|
55
|
-
"aria-label":
|
|
56
|
-
onClick:
|
|
57
|
-
disabled:
|
|
58
|
-
}), /* @__PURE__ */
|
|
59
|
+
"aria-label": A("action.save"),
|
|
60
|
+
onClick: K,
|
|
61
|
+
disabled: x
|
|
62
|
+
}), /* @__PURE__ */ p(a, {
|
|
59
63
|
iconName: "CloseIcon",
|
|
60
64
|
intent: "default",
|
|
61
65
|
variant: "outline",
|
|
62
|
-
"aria-label":
|
|
63
|
-
onClick:
|
|
64
|
-
disabled:
|
|
66
|
+
"aria-label": A("action.cancel"),
|
|
67
|
+
onClick: q,
|
|
68
|
+
disabled: x
|
|
65
69
|
})]
|
|
66
70
|
})]
|
|
67
|
-
}) : /* @__PURE__ */
|
|
68
|
-
className:
|
|
69
|
-
onClick:
|
|
71
|
+
}) : /* @__PURE__ */ m("div", {
|
|
72
|
+
className: o.preview,
|
|
73
|
+
onClick: G,
|
|
70
74
|
onKeyDown: (e) => {
|
|
71
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
75
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), G());
|
|
72
76
|
},
|
|
73
|
-
tabIndex:
|
|
77
|
+
tabIndex: x ? -1 : 0,
|
|
74
78
|
role: "button",
|
|
75
|
-
"aria-
|
|
76
|
-
"aria-
|
|
77
|
-
"aria-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
children: /* @__PURE__ */ f(i, {
|
|
79
|
+
"aria-labelledby": L ? `${L} ${F}` : void 0,
|
|
80
|
+
"aria-describedby": D,
|
|
81
|
+
"aria-disabled": x,
|
|
82
|
+
children: [/* @__PURE__ */ p("span", {
|
|
83
|
+
id: F,
|
|
84
|
+
className: f(o.text, !W && o.placeholder),
|
|
85
|
+
children: W || b || "\xA0"
|
|
86
|
+
}), /* @__PURE__ */ p("span", {
|
|
87
|
+
className: o.editIconWrapper,
|
|
88
|
+
children: /* @__PURE__ */ p(a, {
|
|
86
89
|
iconName: "EditIcon",
|
|
87
90
|
variant: "ghost",
|
|
88
91
|
size: "sm",
|
|
89
92
|
tabIndex: -1,
|
|
90
|
-
"aria-label":
|
|
93
|
+
"aria-label": A("action.edit"),
|
|
91
94
|
"aria-hidden": "true",
|
|
92
95
|
asChild: !0,
|
|
93
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ p("span", {})
|
|
94
97
|
})
|
|
95
98
|
})]
|
|
96
|
-
})
|
|
99
|
+
})]
|
|
97
100
|
})
|
|
98
101
|
});
|
|
99
102
|
});
|
|
100
|
-
|
|
103
|
+
h.displayName = "InlineEdit";
|
|
101
104
|
//#endregion
|
|
102
|
-
export {
|
|
105
|
+
export { h as InlineEdit };
|