wimui 0.64.4 → 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/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 +19 -15
- 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/llms-full.txt +1 -1
- package/dist/llms.txt +1 -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,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs"),s=require("../../_internal/observeMove.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=16;function f(e){let t=getComputedStyle(e);return`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`}async function p(e){let t=document.fonts;if(t&&typeof t.load==`function`){try{await t.load(f(e))}catch{}for(;t.status===`loading`;)await new Promise(e=>{t.addEventListener(`loadingdone`,()=>e(),{once:!0})})}}function m(e){let t=document.fonts;return!t||typeof t.load!=`function`?!1:t.status===`loading`||typeof t.check==`function`&&!t.check(f(e))}function h(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.width)===Math.round(t.width)&&Math.round(e.height)===Math.round(t.height)}function g(e){return e.top>=d&&e.bottom<=window.innerHeight-d&&e.left>=d&&e.right<=window.innerWidth-d}var _=({steps:e,open:d,onClose:f,onFinish:_})=>{let{t:v}=t.useWimTranslation(n.commonNs),[y,b]=(0,c.useState)(0),[x,S]=(0,c.useState)(null),C=e[y],w=C?.target;(0,c.useLayoutEffect)(()=>{if(!d||!w){S(null);return}let e=!1,t=t=>{e||S(e=>t?e&&h(e,t)?e:t:null)},n=()=>{let e=document.querySelector(w);
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs"),s=require("../../_internal/observeMove.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=16;function f(e){let t=getComputedStyle(e);return`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`}async function p(e){let t=document.fonts;if(t&&typeof t.load==`function`){try{await t.load(f(e))}catch{}for(;t.status===`loading`;)await new Promise(e=>{t.addEventListener(`loadingdone`,()=>e(),{once:!0})})}}function m(e){let t=document.fonts;return!t||typeof t.load!=`function`?!1:t.status===`loading`||typeof t.check==`function`&&!t.check(f(e))}function h(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.width)===Math.round(t.width)&&Math.round(e.height)===Math.round(t.height)}function g(e){return e.top>=d&&e.bottom<=window.innerHeight-d&&e.left>=d&&e.right<=window.innerWidth-d}var _=({steps:e,open:d,onClose:f,onFinish:_})=>{let{t:v}=t.useWimTranslation(n.commonNs),[y,b]=(0,c.useState)(0),[x,S]=(0,c.useState)(null),C=e[y],w=C?.target;(0,c.useLayoutEffect)(()=>{if(!d||!w){S(null);return}let e=!1,t=t=>{e||S(e=>t?e&&h(e,t)?e:t:null)},n=()=>{let e=document.querySelector(w);e?(g(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`nearest`}),t(e.getBoundingClientRect())):t(null)},r=()=>{let e=document.querySelector(w);t(e?e.getBoundingClientRect():null)},i,a=()=>{window.addEventListener(`resize`,r),window.addEventListener(`scroll`,r,!0);let e=document.querySelector(w);e&&(i=s.observeMove(e,r))},o=async()=>{let t=document.querySelector(w);t&&await p(t),!e&&(n(),a())},c=document.querySelector(w);return c&&m(c)?o():(n(),a()),()=>{e=!0,window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,r,!0),i?.()}},[d,y,w]);let T=(0,c.useId)(),E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=d&&!!C&&!!x;if((0,c.useEffect)(()=>{if(!O)return;let e=E.current;e&&!e.contains(document.activeElement)&&D.current?.focus()},[O,y]),(0,c.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),f())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,f]),!d||!C)return null;let k=()=>{y<e.length-1?b(y+1):(_?_():f(),b(0))},A=()=>{y>0&&b(y-1)},j={},M=C.placement||`bottom`;if(x){let e=window.innerWidth,t=Math.min(300,e-32),n=M;if(e<640&&(n===`left`||n===`right`)&&(n=`bottom`),M=n,n===`top`||n===`bottom`){let r=x.left+x.width/2,i=t/2+16,a=e-t/2-16;r=i>a?e/2:Math.max(i,Math.min(a,r)),j.left=r,n===`top`?(j.top=x.top-12,j.transform=`translate(-50%, -100%)`):(j.top=x.bottom+12,j.transform=`translateX(-50%)`)}else n===`left`?(j.left=x.left-12,j.top=x.top+x.height/2,j.transform=`translate(-100%, -50%)`):n===`right`&&(j.left=x.right+12,j.top=x.top+x.height/2,j.transform=`translateY(-50%)`)}return(0,u.jsx)(r.Portal,{children:(0,u.jsx)(i.FocusTrap,{initialFocus:!1,children:(0,u.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":C.title,"aria-describedby":x?T:void 0,children:[x&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:o.default.highlight,style:{top:x.top-4,left:x.left-4,width:x.width+8,height:x.height+8}}),(0,u.jsx)(`div`,{ref:E,className:(0,l.default)(`wim-tour`,o.default.bubble),"data-placement":M,style:j,children:(0,u.jsxs)(`div`,{className:o.default.inner,children:[(0,u.jsx)(`h3`,{className:o.default.title,children:C.title}),(0,u.jsx)(`p`,{id:T,className:o.default.description,children:C.description}),(0,u.jsxs)(`div`,{className:o.default.footer,children:[(0,u.jsxs)(`span`,{className:o.default.progress,children:[y+1,` / `,e.length]}),(0,u.jsxs)(`div`,{className:o.default.buttons,children:[y>0&&(0,u.jsx)(a.Button,{size:`sm`,variant:`outline`,onClick:A,children:v(`action.back`)}),(0,u.jsx)(a.Button,{ref:D,size:`sm`,variant:`solid`,onClick:k,children:y===e.length-1?v(`action.finish`):v(`action.next`)})]})]})]})})]}),(0,u.jsx)(`div`,{className:o.default.mask,onClick:f,role:`button`,tabIndex:0,"aria-label":v(`a11y.close_tour`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f()}})]},y)})})};exports.Tour=_;
|
|
@@ -47,14 +47,10 @@ var S = ({ steps: g, open: _, onClose: S, onFinish: C }) => {
|
|
|
47
47
|
e || O((e) => t ? e && b(e, t) ? e : t : null);
|
|
48
48
|
}, n = () => {
|
|
49
49
|
let e = document.querySelector(A);
|
|
50
|
-
|
|
51
|
-
t(null);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
x(e.getBoundingClientRect()) || e.scrollIntoView({
|
|
50
|
+
e ? (x(e.getBoundingClientRect()) || e.scrollIntoView({
|
|
55
51
|
block: "center",
|
|
56
52
|
inline: "nearest"
|
|
57
|
-
}), t(e.getBoundingClientRect());
|
|
53
|
+
}), t(e.getBoundingClientRect())) : t(null);
|
|
58
54
|
}, r = () => {
|
|
59
55
|
let e = document.querySelector(A);
|
|
60
56
|
t(e ? e.getBoundingClientRect() : null);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../../icon/loading.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),s=require("../../../icon/loading.cjs"),c=require("../../media/Icon/Icon.cjs"),l=require("./button.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=u.default.forwardRef(({asChild:e=!1,size:p=`md`,variant:m=`outline`,intent:h=`default`,icon:g,iconPosition:_=`left`,loading:v=!1,backgroundColor:y,justify:b=`center`,animateWidth:x=!1,fullWidth:S=!1,styles:C,"aria-label":w,className:T,disabled:E,children:D,...O},k)=>{let A=u.default.useRef(null),j=a.useMergedRef(A,k),[M,N]=u.default.useState(`auto`),P=u.default.useRef(!0);u.default.useLayoutEffect(()=>{if(!x||!A.current)return;if(P.current){P.current=!1;return}let e=A.current,t=e.getBoundingClientRect().width;N(t);let n=e.style.width,r=e.style.minWidth;e.style.width=`auto`,e.style.minWidth=`0`;let i=Math.ceil(e.getBoundingClientRect().width)+2;e.style.width=n,e.style.minWidth=r;let a=requestAnimationFrame(()=>{N(i)});return()=>cancelAnimationFrame(a)},[D,x]);let{t:F}=r.useWimTranslation(i.commonNs),I=E,L;typeof w==`string`?L=w:w!==!1&&v&&!D&&typeof g!=`string`&&(L=F(`a11y.loading`));let R=!e&&!D&&!!g&&typeof w!=`string`&&!O[`aria-labelledby`]&&!O.title;u.default.useEffect(()=>{},[R]);let z=b===`start`?`flex-start`:b===`end`?`flex-end`:b===`between`?`space-between`:b,B=v?(0,f.jsx)(`span`,{className:(0,d.default)(l.default.loader,C?.loader),children:(0,f.jsx)(c.Icon,{component:s.default,spin:!0,size:p})}):g?typeof g==`string`?(0,f.jsx)(c.Icon,{name:g,size:p,className:C?.icon}):g:null,V=v&&D?(0,f.jsxs)(f.Fragment,{children:[` `,(0,f.jsx)(o.VisuallyHidden,{children:F(`a11y.loading`)})]}):null;return(0,f.jsxs)(e?t.Root:`button`,{ref:j,type:e?void 0:`button`,className:(0,d.default)(`wim-button`,l.default.root,l.default[p],l.default[m],l.default[h],v&&l.default.loading,x&&l.default.animatedWidth,S&&l.default.fullWidth,!D&&!!g&&l.default.iconOnly,T,C?.root),disabled:(I||v)&&!e?!0:void 0,"aria-label":L,"aria-busy":v||void 0,...e?O:{...O},style:{...O.style,justifyContent:z,...y?{backgroundColor:n.getColorValue(y)}:{},...x&&M!==`auto`?{width:`${M}px`,transitionProperty:O.style?.transitionProperty||`width, background-color, border-color, box-shadow, transform`,transitionDuration:O.style?.transitionDuration||`var(--wim-duration-base)`,transitionTimingFunction:O.style?.transitionTimingFunction||`var(--wim-easing-standard)`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`clip`}:{}},children:[e&&B&&_===`left`?B:null,e?(0,f.jsx)(t.Slottable,{children:D}):(0,f.jsxs)(`span`,{className:l.default.content,children:[B&&_===`left`&&B,D,V,B&&_===`right`&&B]}),e?V:null,e&&B&&_===`right`?B:null]})});p.displayName=`Button`,exports.Button=p;
|
|
@@ -4,84 +4,87 @@ import { getColorValue as n } from "../../../utilities/style-utils.js";
|
|
|
4
4
|
import { useWimTranslation as r } from "../../../i18n/useWimTranslation.js";
|
|
5
5
|
import { commonNs as i } from "../../../i18n/generated/common.js";
|
|
6
6
|
import { useMergedRef as a } from "../../../hooks/useMergedRef.js";
|
|
7
|
-
import o from "
|
|
8
|
-
import
|
|
9
|
-
import c from "
|
|
10
|
-
import l from "
|
|
11
|
-
import u from "
|
|
12
|
-
import
|
|
7
|
+
import { VisuallyHidden as o } from "../../layout/VisuallyHidden/VisuallyHidden.js";
|
|
8
|
+
import s from "../../../icon/loading.js";
|
|
9
|
+
import { Icon as c } from "../../media/Icon/Icon.js";
|
|
10
|
+
import l from "./button.module.js";
|
|
11
|
+
import u from "react";
|
|
12
|
+
import d from "classnames";
|
|
13
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
13
14
|
//#region src/components/form/Button/Button.tsx
|
|
14
|
-
var
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
if (!
|
|
18
|
-
if (
|
|
19
|
-
|
|
15
|
+
var h = u.forwardRef(({ asChild: h = !1, size: g = "md", variant: _ = "outline", intent: v = "default", icon: y, iconPosition: b = "left", loading: x = !1, backgroundColor: S, justify: C = "center", animateWidth: w = !1, fullWidth: T = !1, styles: E, "aria-label": D, className: O, disabled: k, children: A, ...j }, M) => {
|
|
16
|
+
let N = u.useRef(null), P = a(N, M), [F, I] = u.useState("auto"), L = u.useRef(!0);
|
|
17
|
+
u.useLayoutEffect(() => {
|
|
18
|
+
if (!w || !N.current) return;
|
|
19
|
+
if (L.current) {
|
|
20
|
+
L.current = !1;
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
|
-
let e =
|
|
23
|
-
|
|
23
|
+
let e = N.current, t = e.getBoundingClientRect().width;
|
|
24
|
+
I(t);
|
|
24
25
|
let n = e.style.width, r = e.style.minWidth;
|
|
25
26
|
e.style.width = "auto", e.style.minWidth = "0";
|
|
26
27
|
let i = Math.ceil(e.getBoundingClientRect().width) + 2;
|
|
27
28
|
e.style.width = n, e.style.minWidth = r;
|
|
28
29
|
let a = requestAnimationFrame(() => {
|
|
29
|
-
|
|
30
|
+
I(i);
|
|
30
31
|
});
|
|
31
32
|
return () => cancelAnimationFrame(a);
|
|
32
|
-
}, [
|
|
33
|
-
let { t:
|
|
34
|
-
typeof
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
className:
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
component:
|
|
33
|
+
}, [A, w]);
|
|
34
|
+
let { t: R } = r(i), z = k, B;
|
|
35
|
+
typeof D == "string" ? B = D : D !== !1 && x && !A && typeof y != "string" && (B = R("a11y.loading"));
|
|
36
|
+
let V = !h && !A && !!y && typeof D != "string" && !j["aria-labelledby"] && !j.title;
|
|
37
|
+
u.useEffect(() => {}, [V]);
|
|
38
|
+
let H = C === "start" ? "flex-start" : C === "end" ? "flex-end" : C === "between" ? "space-between" : C, U = x ? /* @__PURE__ */ p("span", {
|
|
39
|
+
className: d(l.loader, E?.loader),
|
|
40
|
+
children: /* @__PURE__ */ p(c, {
|
|
41
|
+
component: s,
|
|
41
42
|
spin: !0,
|
|
42
|
-
size:
|
|
43
|
+
size: g
|
|
43
44
|
})
|
|
44
|
-
}) :
|
|
45
|
-
name:
|
|
46
|
-
size:
|
|
47
|
-
className:
|
|
48
|
-
}) :
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
ref:
|
|
51
|
-
type:
|
|
52
|
-
className:
|
|
53
|
-
disabled: (
|
|
54
|
-
"aria-label":
|
|
55
|
-
"aria-busy":
|
|
56
|
-
...
|
|
45
|
+
}) : y ? typeof y == "string" ? /* @__PURE__ */ p(c, {
|
|
46
|
+
name: y,
|
|
47
|
+
size: g,
|
|
48
|
+
className: E?.icon
|
|
49
|
+
}) : y : null, W = x && A ? /* @__PURE__ */ m(f, { children: [" ", /* @__PURE__ */ p(o, { children: R("a11y.loading") })] }) : null;
|
|
50
|
+
return /* @__PURE__ */ m(h ? e : "button", {
|
|
51
|
+
ref: P,
|
|
52
|
+
type: h ? void 0 : "button",
|
|
53
|
+
className: d("wim-button", l.root, l[g], l[_], l[v], x && l.loading, w && l.animatedWidth, T && l.fullWidth, !A && !!y && l.iconOnly, O, E?.root),
|
|
54
|
+
disabled: (z || x) && !h ? !0 : void 0,
|
|
55
|
+
"aria-label": B,
|
|
56
|
+
"aria-busy": x || void 0,
|
|
57
|
+
...h ? j : { ...j },
|
|
57
58
|
style: {
|
|
58
|
-
...
|
|
59
|
-
justifyContent:
|
|
60
|
-
...
|
|
61
|
-
...
|
|
62
|
-
width: `${
|
|
63
|
-
transitionProperty:
|
|
64
|
-
transitionDuration:
|
|
65
|
-
transitionTimingFunction:
|
|
59
|
+
...j.style,
|
|
60
|
+
justifyContent: H,
|
|
61
|
+
...S ? { backgroundColor: n(S) } : {},
|
|
62
|
+
...w && F !== "auto" ? {
|
|
63
|
+
width: `${F}px`,
|
|
64
|
+
transitionProperty: j.style?.transitionProperty || "width, background-color, border-color, box-shadow, transform",
|
|
65
|
+
transitionDuration: j.style?.transitionDuration || "var(--wim-duration-base)",
|
|
66
|
+
transitionTimingFunction: j.style?.transitionTimingFunction || "var(--wim-easing-standard)",
|
|
66
67
|
overflow: "hidden",
|
|
67
68
|
whiteSpace: "nowrap",
|
|
68
69
|
textOverflow: "clip"
|
|
69
70
|
} : {}
|
|
70
71
|
},
|
|
71
72
|
children: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
className:
|
|
73
|
+
h && U && b === "left" ? U : null,
|
|
74
|
+
h ? /* @__PURE__ */ p(t, { children: A }) : /* @__PURE__ */ m("span", {
|
|
75
|
+
className: l.content,
|
|
75
76
|
children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
U && b === "left" && U,
|
|
78
|
+
A,
|
|
79
|
+
W,
|
|
80
|
+
U && b === "right" && U
|
|
79
81
|
]
|
|
80
82
|
}),
|
|
81
|
-
|
|
83
|
+
h ? W : null,
|
|
84
|
+
h && U && b === "right" ? U : null
|
|
82
85
|
]
|
|
83
86
|
});
|
|
84
87
|
});
|
|
85
|
-
|
|
88
|
+
h.displayName = "Button";
|
|
86
89
|
//#endregion
|
|
87
|
-
export {
|
|
90
|
+
export { h as Button };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../../_internal/BaseListItem/BaseListItem.cjs"),r=require("../InputBase/InputBase.cjs"),i=require("../../_internal/useInlineFloating.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./combobox.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=({options:e=[],onChange:u,placeholder:d,showSearchIcon:f=!0,allowClear:p=!0,defaultValue:m=``,className:h,disabled:g=!1,label:_,error:v,required:y,layout:b,fullWidth:x=!1,id:S,labels:C={},...w})=>{let{noResults:T=`No results found`}=C,[E,D]=(0,s.useState)(!1),[O,k]=(0,s.useState)(m),[A,j]=(0,s.useState)(-1),[M,N]=(0,s.useState)(!1),P=(0,s.useRef)(null),F=(0,s.useId)(),I=S||`wim-combobox-${F}`,L=`${I}-list`,R=_?`${I}-label`:void 0,z=v?`${I}-error`:void 0,B=(0,s.useMemo)(()=>{let t=(O||``).toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(t))},[e,O]);(0,s.useEffect)(()=>{let e=e=>{P.current&&!P.current.contains(e.target)&&D(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let V=e=>{let t=e.target.value;k(t),D(!0),j(-1)},H=e=>{k(e.label),D(!1),u&&u(e)},U=e=>{if(N(!0),!E&&e.key===`ArrowDown`)
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../../_internal/BaseListItem/BaseListItem.cjs"),r=require("../InputBase/InputBase.cjs"),i=require("../../_internal/useInlineFloating.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./combobox.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=({options:e=[],onChange:u,placeholder:d,showSearchIcon:f=!0,allowClear:p=!0,defaultValue:m=``,className:h,disabled:g=!1,label:_,error:v,required:y,layout:b,fullWidth:x=!1,id:S,labels:C={},...w})=>{let{noResults:T=`No results found`}=C,[E,D]=(0,s.useState)(!1),[O,k]=(0,s.useState)(m),[A,j]=(0,s.useState)(-1),[M,N]=(0,s.useState)(!1),P=(0,s.useRef)(null),F=(0,s.useId)(),I=S||`wim-combobox-${F}`,L=`${I}-list`,R=_?`${I}-label`:void 0,z=v?`${I}-error`:void 0,B=(0,s.useMemo)(()=>{let t=(O||``).toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(t))},[e,O]);(0,s.useEffect)(()=>{let e=e=>{P.current&&!P.current.contains(e.target)&&D(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let V=e=>{let t=e.target.value;k(t),D(!0),j(-1)},H=e=>{k(e.label),D(!1),u&&u(e)},U=e=>{if(N(!0),!E&&e.key===`ArrowDown`)D(!0);else switch(e.key){case`ArrowDown`:j(e=>e<B.length-1?e+1:0);break;case`ArrowUp`:j(e=>e<=0?B.length-1:e-1);break;case`Enter`:A>=0&&A<B.length&&H(B[A]);break;case`Escape`:D(!1);break;case`Tab`:D(!1)}},{setReference:W,setFloating:G,floatingProps:K}=i.useInlineFloating({open:E}),q=t.useMergedRef(P,W);return(0,l.jsx)(a.FieldTemplate,{label:_,error:v,required:y,layout:b,labelId:R,htmlFor:I,errorId:z,className:h,children:(0,l.jsxs)(`div`,{className:(0,c.default)(`wim-combobox`,o.default.root,x&&o.default.fullWidth),ref:q,onMouseMove:()=>N(!1),"data-keyboard-nav":M,children:[(0,l.jsx)(r.InputBase,{disabled:g,allowClear:p,hasValue:!!O,onClear:()=>k(``),intent:v?`danger`:`default`,leftIcon:f?`SearchIcon`:void 0,fullWidth:x,rightIcons:[{name:`ChevronDownIcon`,rotated:E,onClick:()=>D(!E),decorative:!0}],children:(0,l.jsx)(`input`,{id:I,className:o.default.input,placeholder:d,value:O,onChange:V,onKeyDown:U,onFocus:()=>D(!0),disabled:g,autoComplete:`off`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":E,"aria-controls":E?L:void 0,"aria-labelledby":R,"aria-describedby":z,required:y,"aria-invalid":!!v,"aria-activedescendant":E&&A>=0?`${L}-option-${A}`:void 0,...w})}),E&&B.length>0&&(0,l.jsx)(`div`,{className:o.default.dropdown,ref:G,...K,children:(0,l.jsx)(`ul`,{id:L,className:o.default.list,role:`listbox`,"aria-labelledby":R,children:B.map((e,t)=>(0,l.jsx)(n.BaseListItem,{asChild:!0,id:`${L}-option-${t}`,className:(0,c.default)(o.default.option,t===A&&o.default.selected),active:t===A,onClick:()=>H(e),onMouseEnter:()=>j(t),role:`option`,"aria-selected":t===A,children:(0,l.jsx)(`li`,{children:e.label})},e.value))})}),E&&B.length===0&&(0,l.jsx)(`div`,{className:o.default.dropdown,ref:G,...K,children:(0,l.jsx)(`div`,{className:o.default.empty,role:`region`,"aria-live":`polite`,children:T})})]})})};u.displayName=`Combobox`,exports.Combobox=u;
|
|
@@ -26,11 +26,8 @@ var m = ({ options: m = [], onChange: h, placeholder: g, showSearchIcon: _ = !0,
|
|
|
26
26
|
}, q = (e) => {
|
|
27
27
|
P(e.label), M(!1), h && h(e);
|
|
28
28
|
}, J = (e) => {
|
|
29
|
-
if (R(!0), !j && e.key === "ArrowDown")
|
|
30
|
-
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
switch (e.key) {
|
|
29
|
+
if (R(!0), !j && e.key === "ArrowDown") M(!0);
|
|
30
|
+
else switch (e.key) {
|
|
34
31
|
case "ArrowDown":
|
|
35
32
|
I((e) => e < G.length - 1 ? e + 1 : 0);
|
|
36
33
|
break;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/InteractiveArea/InteractiveArea.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../media/Icon/Icon.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/InteractiveArea/InteractiveArea.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../layout/VisuallyHidden/VisuallyHidden.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../FieldTemplate/FieldTemplate.cjs"),s=require("./dropzone.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=({label:e,description:d,accept:f,multiple:p=!1,disabled:m=!1,value:h,onChange:g,className:_,iconName:v=`UploadIcon`,error:y,required:b,layout:x=`vertical`,size:S=`md`,"aria-label":C,"aria-labelledby":w,"aria-describedby":T})=>{let{t:E}=n.useWimTranslation(a.formNs),D=d??E(`dropzone.description`),O=`wim-dropzone-${c.default.useId()}`,k=e?`${O}-label`:void 0,A=y?`${O}-error`:void 0,j=`${O}-description`,M=`${O}-files`,N=`${O}-name`,P=k??w??(C?N:void 0),F=(0,c.useRef)(null),[I,L]=(0,c.useState)(!1),[R,z]=(0,c.useState)(null),B=()=>{m||F.current?.click()},V=e=>{e.preventDefault(),!m&&L(!0)},H=()=>{L(!1)},U=e=>{if(e.preventDefault(),L(!1),m)return;let t=e.dataTransfer.files;z(t),g&&g(t)},W=e=>{let t=e.target.files;z(t),g&&g(t)},G=h===void 0?R?Array.from(R).map(e=>e.name):[]:h;return(0,u.jsxs)(o.FieldTemplate,{label:e,error:y,required:b,layout:x,labelId:k,errorId:A,className:(0,l.default)(`wim-dropzone`,s.default.container,_),children:[(0,u.jsx)(`input`,{type:`file`,ref:F,accept:f,multiple:p,disabled:m,onChange:W,style:{display:`none`},"aria-hidden":`true`,tabIndex:-1}),P===N&&(0,u.jsx)(r.VisuallyHidden,{id:N,children:C}),(0,u.jsx)(t.InteractiveArea,{size:S,isDragging:I,disabled:m,isClickable:!m,onClick:B,onDragOver:V,onDragLeave:H,onDrop:U,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&B()},"aria-labelledby":P?[P,j,G.length>0&&M].filter(Boolean).join(` `):void 0,"aria-describedby":[T,A].filter(Boolean).join(` `)||void 0,"aria-required":b,"aria-invalid":!!y,icon:v&&(0,u.jsx)(i.Icon,{name:v,color:m?`disabled`:`primary`}),description:(0,u.jsx)(`span`,{id:j,children:D}),children:G.length>0?(0,u.jsx)(`div`,{id:M,className:s.default.fileList,children:G.map((e,t)=>(0,u.jsx)(`span`,{className:s.default.fileName,children:e},t))}):null})]})};exports.Dropzone=d;
|
|
@@ -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=`${O}-files`,N=[E,M,A,j].filter(Boolean).join(` `),P=(0,s.useRef)(null),[
|
|
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;
|
|
@@ -15,18 +15,18 @@ var p = ({ label: p, buttonLabel: m, noFileLabel: h, accept: g, multiple: _ = !1
|
|
|
15
15
|
I,
|
|
16
16
|
P,
|
|
17
17
|
F
|
|
18
|
-
].filter(Boolean).join(" "), R = c(null), [
|
|
19
|
-
s(() => () => clearTimeout(
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
},
|
|
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) => {
|
|
23
23
|
let t = e.target.files;
|
|
24
|
-
if (
|
|
24
|
+
if (W(t), clearTimeout(q.current), K(""), t && t.length > 0) {
|
|
25
25
|
let e = Array.from(t).map((e) => e.name).join(", ");
|
|
26
|
-
|
|
26
|
+
q.current = setTimeout(() => K(j("fileupload.selected", { files: e })), 700);
|
|
27
27
|
}
|
|
28
28
|
b && b(t);
|
|
29
|
-
},
|
|
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
30
|
return /* @__PURE__ */ d(i, {
|
|
31
31
|
label: p,
|
|
32
32
|
error: T,
|
|
@@ -40,28 +40,32 @@ var p = ({ label: p, buttonLabel: m, noFileLabel: h, accept: g, multiple: _ = !1
|
|
|
40
40
|
children: [
|
|
41
41
|
/* @__PURE__ */ d("input", {
|
|
42
42
|
type: "file",
|
|
43
|
-
ref:
|
|
43
|
+
ref: H,
|
|
44
44
|
accept: g,
|
|
45
45
|
multiple: _,
|
|
46
46
|
disabled: v,
|
|
47
|
-
onChange:
|
|
47
|
+
onChange: Y,
|
|
48
48
|
className: a.input,
|
|
49
49
|
"aria-hidden": "true",
|
|
50
50
|
tabIndex: -1
|
|
51
51
|
}),
|
|
52
52
|
/* @__PURE__ */ d(n, {
|
|
53
|
-
onClick:
|
|
53
|
+
onClick: J,
|
|
54
54
|
disabled: v,
|
|
55
55
|
variant: "outline",
|
|
56
56
|
icon: S,
|
|
57
57
|
iconPosition: C,
|
|
58
58
|
size: w,
|
|
59
|
-
|
|
60
|
-
"aria-
|
|
59
|
+
id: R,
|
|
60
|
+
"aria-labelledby": V,
|
|
61
61
|
"aria-describedby": L,
|
|
62
62
|
"aria-invalid": T ? !0 : void 0,
|
|
63
63
|
children: m ?? j("fileupload.button")
|
|
64
64
|
}),
|
|
65
|
+
B === z && /* @__PURE__ */ d(t, {
|
|
66
|
+
id: z,
|
|
67
|
+
children: O
|
|
68
|
+
}),
|
|
65
69
|
E && /* @__PURE__ */ d(t, {
|
|
66
70
|
id: F,
|
|
67
71
|
children: j("form.required")
|
|
@@ -69,13 +73,13 @@ var p = ({ label: p, buttonLabel: m, noFileLabel: h, accept: g, multiple: _ = !1
|
|
|
69
73
|
/* @__PURE__ */ d(t, {
|
|
70
74
|
role: "status",
|
|
71
75
|
"aria-atomic": "true",
|
|
72
|
-
children:
|
|
76
|
+
children: G
|
|
73
77
|
}),
|
|
74
78
|
/* @__PURE__ */ d("span", {
|
|
75
79
|
id: I,
|
|
76
80
|
className: u(a.fileNames, a[w], v && a.disabled),
|
|
77
81
|
"aria-disabled": v || void 0,
|
|
78
|
-
children:
|
|
82
|
+
children: Z
|
|
79
83
|
})
|
|
80
84
|
]
|
|
81
85
|
})
|
|
@@ -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;
|