wimui 0.57.2 → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +125 -122
- package/dist/components/data-display/Timeline/Timeline.cjs +1 -1
- package/dist/components/data-display/Timeline/Timeline.js +45 -39
- package/dist/components/form/CheckboxGroup/CheckboxGroup.cjs +1 -1
- package/dist/components/form/CheckboxGroup/CheckboxGroup.js +2 -2
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +82 -78
- package/dist/components/form/FieldTemplate/FieldTemplate.cjs +1 -1
- package/dist/components/form/FieldTemplate/FieldTemplate.js +29 -23
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +62 -60
- package/dist/components/form/Mentions/Mentions.cjs +1 -1
- package/dist/components/form/Mentions/Mentions.js +71 -70
- package/dist/components/form/OtpInput/OtpInput.cjs +1 -1
- package/dist/components/form/OtpInput/OtpInput.js +2 -2
- package/dist/components/form/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/form/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +71 -67
- package/dist/components/form/Slider/Slider.cjs +1 -1
- package/dist/components/form/Slider/Slider.js +35 -31
- package/dist/components/form/SwitchGroup/SwitchGroup.cjs +1 -1
- package/dist/components/form/SwitchGroup/SwitchGroup.js +2 -2
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +44 -44
- package/dist/components/navigation/Stepper/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper/Stepper.d.ts +5 -0
- package/dist/components/navigation/Stepper/Stepper.js +51 -51
- package/dist/llms-full.txt +5 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +1 -1
- package/package.json +1 -1
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
4
4
|
import { Transition as r } from "../../layout/Transition/Transition.js";
|
|
5
|
-
import { FocusTrap as
|
|
6
|
-
import { componentsNs as
|
|
7
|
-
import { InputBase as
|
|
8
|
-
import { FieldTemplate as
|
|
9
|
-
import
|
|
5
|
+
import { FocusTrap as i } from "../../overlay/FocusTrap/FocusTrap.js";
|
|
6
|
+
import { componentsNs as a } from "../../../i18n/generated/components.js";
|
|
7
|
+
import { InputBase as o } from "../InputBase/InputBase.js";
|
|
8
|
+
import { FieldTemplate as s } from "../FieldTemplate/FieldTemplate.js";
|
|
9
|
+
import ee from "../Input/input.module.js";
|
|
10
10
|
import { Calendar as te } from "../../data-display/Calendar/Calendar.js";
|
|
11
|
-
import { mergeRefs as
|
|
12
|
-
import
|
|
13
|
-
import { forwardRef as
|
|
14
|
-
import
|
|
15
|
-
import { jsx as
|
|
11
|
+
import { mergeRefs as c } from "../../_internal/mergeRefs.js";
|
|
12
|
+
import l from "./date-picker.module.js";
|
|
13
|
+
import { forwardRef as u, useEffect as d, useId as f, useRef as p, useState as m } from "react";
|
|
14
|
+
import h from "classnames";
|
|
15
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
16
16
|
//#region src/components/form/DatePicker/DatePicker.tsx
|
|
17
|
-
var
|
|
18
|
-
let [I, L] =
|
|
19
|
-
|
|
17
|
+
var v = u(({ intent: u = "default", variant: v = "outline", fullWidth: y = !1, className: b, disabled: x, value: S, defaultValue: C, onChange: w, format: ne = "YYYY-MM-DD", clearable: re = !0, placeholder: ie, minDate: ae, maxDate: oe, disabledDates: se, label: T, error: E, required: D, layout: O, id: k, labels: A, width: j, asChild: M = !1, children: N, ...P }, F) => {
|
|
18
|
+
let [I, L] = m(!1), [R, z] = m(C || null), B = p(null), V = p(null), H = c(B, F), { t: U } = n(a), W = f(), G = k || `wim-datepicker-${W}`, K = `${G}-dropdown`, q = T ? `${G}-label` : void 0, J = E ? `${G}-error` : void 0, Y = S !== void 0, X = Y ? S : R, ce = ie ?? A?.placeholder, Z = x, Q = E ? "danger" : u;
|
|
19
|
+
d(() => {
|
|
20
20
|
let e = (e) => {
|
|
21
21
|
B.current && !B.current.contains(e.target) && L(!1);
|
|
22
22
|
};
|
|
23
23
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
24
|
-
}, []),
|
|
24
|
+
}, []), d(() => {
|
|
25
25
|
let e = (e) => {
|
|
26
26
|
e.key === "Escape" && I && (L(!1), V.current?.focus());
|
|
27
27
|
};
|
|
@@ -30,15 +30,15 @@ var _ = l(({ intent: l = "default", variant: _ = "outline", fullWidth: v = !1, c
|
|
|
30
30
|
let le = (e) => {
|
|
31
31
|
if (!e) return "";
|
|
32
32
|
let t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
33
|
-
return
|
|
33
|
+
return ne.replace("YYYY", String(t)).replace("MM", n).replace("DD", r);
|
|
34
34
|
}, ue = (e) => {
|
|
35
|
-
Y || z(e),
|
|
35
|
+
Y || z(e), w?.(e), L(!1), V.current?.focus();
|
|
36
36
|
}, de = (e) => {
|
|
37
|
-
e?.stopPropagation(), Z || (Y || z(null),
|
|
37
|
+
e?.stopPropagation(), Z || (Y || z(null), w?.(null));
|
|
38
38
|
}, $ = () => {
|
|
39
39
|
Z || L(!I);
|
|
40
40
|
};
|
|
41
|
-
return
|
|
41
|
+
return d(() => {
|
|
42
42
|
if (I) {
|
|
43
43
|
let e = setTimeout(() => {
|
|
44
44
|
let e = B.current?.querySelector("[data-calendar-day][tabindex=\"0\"]:not(:disabled), [data-calendar-day][data-selected]:not(:disabled), [data-calendar-day]:focus");
|
|
@@ -46,7 +46,7 @@ var _ = l(({ intent: l = "default", variant: _ = "outline", fullWidth: v = !1, c
|
|
|
46
46
|
}, 50);
|
|
47
47
|
return () => clearTimeout(e);
|
|
48
48
|
}
|
|
49
|
-
}, [I]), /* @__PURE__ */
|
|
49
|
+
}, [I]), /* @__PURE__ */ g(s, {
|
|
50
50
|
label: T,
|
|
51
51
|
error: E,
|
|
52
52
|
required: D,
|
|
@@ -54,71 +54,75 @@ var _ = l(({ intent: l = "default", variant: _ = "outline", fullWidth: v = !1, c
|
|
|
54
54
|
labelId: q,
|
|
55
55
|
htmlFor: G,
|
|
56
56
|
errorId: J,
|
|
57
|
-
className:
|
|
58
|
-
children: /* @__PURE__ */
|
|
57
|
+
className: b,
|
|
58
|
+
children: /* @__PURE__ */ _(M ? e : "div", {
|
|
59
59
|
ref: H,
|
|
60
|
-
className:
|
|
61
|
-
children: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
allowClear: re,
|
|
68
|
-
hasValue: !!X,
|
|
69
|
-
onClear: de,
|
|
70
|
-
rightIcons: [{
|
|
71
|
-
name: "ChevronDownIcon",
|
|
72
|
-
rotated: I,
|
|
73
|
-
onClick: $,
|
|
74
|
-
decorative: !0
|
|
75
|
-
}],
|
|
76
|
-
children: /* @__PURE__ */ h("input", {
|
|
77
|
-
id: G,
|
|
78
|
-
ref: V,
|
|
79
|
-
type: "text",
|
|
80
|
-
readOnly: !0,
|
|
81
|
-
role: "combobox",
|
|
82
|
-
className: m(s.root, c.input),
|
|
83
|
-
value: le(X),
|
|
84
|
-
placeholder: ce,
|
|
60
|
+
className: h("wim-date-picker", l.root, y && l.fullWidth),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ g(o, {
|
|
63
|
+
intent: Q,
|
|
64
|
+
variant: v,
|
|
65
|
+
width: j,
|
|
66
|
+
fullWidth: y,
|
|
85
67
|
disabled: Z,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"aria-
|
|
68
|
+
allowClear: re,
|
|
69
|
+
hasValue: !!X,
|
|
70
|
+
onClear: de,
|
|
71
|
+
rightIcons: [{
|
|
72
|
+
name: "ChevronDownIcon",
|
|
73
|
+
rotated: I,
|
|
74
|
+
onClick: $,
|
|
75
|
+
decorative: !0
|
|
76
|
+
}],
|
|
77
|
+
children: /* @__PURE__ */ g("input", {
|
|
78
|
+
id: G,
|
|
79
|
+
ref: V,
|
|
80
|
+
type: "text",
|
|
81
|
+
readOnly: !0,
|
|
82
|
+
role: "combobox",
|
|
83
|
+
className: h(ee.root, l.input),
|
|
84
|
+
value: le(X),
|
|
85
|
+
placeholder: ce,
|
|
86
|
+
disabled: Z,
|
|
87
|
+
onClick: $,
|
|
88
|
+
onKeyDown: (e) => {
|
|
89
|
+
Z || (e.key === "Escape" ? (L(!1), V.current?.focus()) : (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" && (e.altKey || !I)) && (e.preventDefault(), L(!I)));
|
|
90
|
+
},
|
|
91
|
+
"aria-haspopup": "dialog",
|
|
92
|
+
"aria-expanded": I,
|
|
93
|
+
"aria-controls": I ? K : void 0,
|
|
94
|
+
"aria-invalid": Q === "danger",
|
|
95
|
+
"aria-describedby": J,
|
|
110
96
|
"aria-labelledby": q,
|
|
111
|
-
"aria-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
"aria-required": D,
|
|
98
|
+
...P
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ g(r, {
|
|
102
|
+
show: I && !x,
|
|
103
|
+
preset: "fade",
|
|
104
|
+
id: K,
|
|
105
|
+
className: l.dropdown,
|
|
106
|
+
children: /* @__PURE__ */ g(i, {
|
|
107
|
+
active: I,
|
|
108
|
+
initialFocus: !1,
|
|
109
|
+
children: /* @__PURE__ */ g("div", {
|
|
110
|
+
role: "dialog",
|
|
111
|
+
"aria-modal": "true",
|
|
112
|
+
"aria-labelledby": q,
|
|
113
|
+
"aria-label": q ? void 0 : P["aria-label"] ?? U("datepicker.dialog"),
|
|
114
|
+
children: /* @__PURE__ */ g(te, {
|
|
115
|
+
value: X ?? void 0,
|
|
116
|
+
onChange: ue
|
|
117
|
+
})
|
|
115
118
|
})
|
|
116
119
|
})
|
|
117
|
-
})
|
|
118
|
-
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ g(t, { children: N })
|
|
122
|
+
]
|
|
119
123
|
})
|
|
120
124
|
});
|
|
121
125
|
});
|
|
122
|
-
|
|
126
|
+
v.displayName = "DatePicker";
|
|
123
127
|
//#endregion
|
|
124
|
-
export {
|
|
128
|
+
export { v as DatePicker, v as default };
|
|
@@ -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("../../typography/Label/Label.cjs"),r=require("../FieldError/FieldError.cjs"),i=require("./field-template.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=a.default.forwardRef(({asChild:e=!1,label:a,error:c,children:l,required:u,layout:d=`vertical`,labelId:f,htmlFor:p,errorId:m,className:h,styles:g,..._},v)=>
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../typography/Label/Label.cjs"),r=require("../FieldError/FieldError.cjs"),i=require("./field-template.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=a.default.forwardRef(({asChild:e=!1,label:a,error:c,children:l,required:u,layout:d=`vertical`,labelId:f,htmlFor:p,errorId:m,className:h,styles:g,..._},v)=>{let y=e?t.Root:`div`,b=e=>(0,s.jsxs)(s.Fragment,{children:[a&&(0,s.jsx)(`div`,{className:(0,o.default)(i.default.labelWrapper,g?.labelWrapper),children:(0,s.jsx)(n.Label,{label:a,required:u,id:f,htmlFor:p,className:(0,o.default)(i.default.label,g?.label)})}),(0,s.jsxs)(`div`,{className:(0,o.default)(i.default.content,g?.content),children:[e,c&&(0,s.jsx)(r.FieldError,{id:m,content:c,className:(0,o.default)(i.default.danger,g?.error)})]})]});return(0,s.jsx)(y,{className:(0,o.default)(`wim-field-template`,i.default.root,i.default[d],h,g?.root),ref:v,..._,children:e?(0,s.jsx)(t.Slottable,{child:l,children:e=>b(e)}):b(l)})});c.displayName=`FieldTemplate`,exports.FieldTemplate=c;
|
|
@@ -5,30 +5,36 @@ import { FieldError as r } from "../FieldError/FieldError.js";
|
|
|
5
5
|
import i from "./field-template.module.js";
|
|
6
6
|
import a from "react";
|
|
7
7
|
import o from "classnames";
|
|
8
|
-
import {
|
|
8
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/form/FieldTemplate/FieldTemplate.tsx
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id: m,
|
|
20
|
-
htmlFor: h,
|
|
21
|
-
className: o(i.label, v?.label)
|
|
10
|
+
var u = a.forwardRef(({ asChild: a = !1, label: u, error: d, children: f, required: p, layout: m = "vertical", labelId: h, htmlFor: g, errorId: _, className: v, styles: y, ...b }, x) => {
|
|
11
|
+
let S = a ? e : "div", C = (e) => /* @__PURE__ */ l(s, { children: [u && /* @__PURE__ */ c("div", {
|
|
12
|
+
className: o(i.labelWrapper, y?.labelWrapper),
|
|
13
|
+
children: /* @__PURE__ */ c(n, {
|
|
14
|
+
label: u,
|
|
15
|
+
required: p,
|
|
16
|
+
id: h,
|
|
17
|
+
htmlFor: g,
|
|
18
|
+
className: o(i.label, y?.label)
|
|
22
19
|
})
|
|
23
|
-
}), /* @__PURE__ */
|
|
24
|
-
className: o(i.content,
|
|
25
|
-
children: [
|
|
26
|
-
id:
|
|
27
|
-
content:
|
|
28
|
-
className: o(i.danger,
|
|
20
|
+
}), /* @__PURE__ */ l("div", {
|
|
21
|
+
className: o(i.content, y?.content),
|
|
22
|
+
children: [e, d && /* @__PURE__ */ c(r, {
|
|
23
|
+
id: _,
|
|
24
|
+
content: d,
|
|
25
|
+
className: o(i.danger, y?.error)
|
|
29
26
|
})]
|
|
30
|
-
})]
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
})] });
|
|
28
|
+
return /* @__PURE__ */ c(S, {
|
|
29
|
+
className: o("wim-field-template", i.root, i[m], v, y?.root),
|
|
30
|
+
ref: x,
|
|
31
|
+
...b,
|
|
32
|
+
children: a ? /* @__PURE__ */ c(t, {
|
|
33
|
+
child: f,
|
|
34
|
+
children: (e) => C(e)
|
|
35
|
+
}) : C(f)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
u.displayName = "FieldTemplate";
|
|
33
39
|
//#endregion
|
|
34
|
-
export {
|
|
40
|
+
export { u as FieldTemplate };
|
|
@@ -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"),i=require("../Input/Input.cjs"),a=require("../IconButton/IconButton.cjs"),o=require("./inline-edit.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=s.default.forwardRef(({value:e,defaultValue:u,onChange:d,onSave:f,onCancel:p,onEdit:m,placeholder:h,disabled:g=!1,fullWidth:_=!1,label:v,className:y,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,...C},w)=>{let{t:T}=t.useWimTranslation(n.commonNs),[E,D]=(0,s.useState)(!1),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("../Input/Input.cjs"),a=require("../IconButton/IconButton.cjs"),o=require("./inline-edit.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=s.default.forwardRef(({value:e,defaultValue:u,onChange:d,onSave:f,onCancel:p,onEdit:m,placeholder:h,disabled:g=!1,fullWidth:_=!1,label:v,className:y,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,...C},w)=>{let{t:T}=t.useWimTranslation(n.commonNs),[E,D]=(0,s.useState)(!1),O=(0,s.useId)(),k=v?`wim-inline-edit-${O}-label`:void 0,A=`wim-inline-edit-${O}-text`,[j,M]=(0,s.useState)(u??``),[N,P]=(0,s.useState)(u??``),F=(0,s.useRef)(null),I=e!==void 0,L=I?e:N,R=()=>{g||(I||P(j),D(!0),m?.())},z=()=>{g||(I||M(L),D(!1),f?.(L))},B=()=>{g||(I||P(j),D(!1),p?.())},V=e=>{let t=e.target.value;I||P(t),d?.(t)},H=e=>{e.key===`Enter`?(e.preventDefault(),z()):e.key===`Escape`&&(e.preventDefault(),B())};return(0,s.useEffect)(()=>{E&&F.current&&F.current.focus()},[E]),(0,l.jsx)(r.FieldTemplate,{label:v,labelId:k,className:y,children:(0,l.jsx)(`div`,{ref:w,className:(0,c.default)(`wim-inline-edit`,o.default.root,_&&o.default.fullWidth,g&&o.default.disabled),...C,children:E?(0,l.jsxs)(`div`,{className:o.default.editWrapper,children:[(0,l.jsx)(i.Input,{ref:F,value:L,onChange:V,onKeyDown:H,disabled:g,placeholder:h,"aria-label":k?void 0:b,"aria-labelledby":k??x,"aria-describedby":S,fullWidth:_,className:o.default.input}),(0,l.jsxs)(`div`,{className:o.default.editActions,children:[(0,l.jsx)(a.IconButton,{iconName:`CheckIcon`,intent:`success`,variant:`outline`,"aria-label":T(`action.save`),onClick:z,disabled:g}),(0,l.jsx)(a.IconButton,{iconName:`CloseIcon`,intent:`default`,variant:`outline`,"aria-label":T(`action.cancel`),onClick:B,disabled:g})]})]}):(0,l.jsxs)(`div`,{className:o.default.preview,onClick:R,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),R())},tabIndex:g?-1:0,role:`button`,"aria-label":k?void 0:b,"aria-labelledby":k?`${k} ${A}`:x,"aria-describedby":S,"aria-disabled":g,children:[(0,l.jsx)(`span`,{id:A,className:(0,c.default)(o.default.text,!L&&o.default.placeholder),children:L||h||`\xA0`}),(0,l.jsx)(`span`,{className:o.default.editIconWrapper,children:(0,l.jsx)(a.IconButton,{iconName:`EditIcon`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":T(`action.edit`),"aria-hidden":`true`,asChild:!0,children:(0,l.jsx)(`span`,{})})})]})})})});u.displayName=`InlineEdit`,exports.InlineEdit=u;
|
|
@@ -5,96 +5,98 @@ import { FieldTemplate as n } from "../FieldTemplate/FieldTemplate.js";
|
|
|
5
5
|
import { Input as r } from "../Input/Input.js";
|
|
6
6
|
import { IconButton as i } from "../IconButton/IconButton.js";
|
|
7
7
|
import a from "./inline-edit.module.js";
|
|
8
|
-
import o, { useEffect as s,
|
|
9
|
-
import
|
|
10
|
-
import { jsx as
|
|
8
|
+
import o, { useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
9
|
+
import d from "classnames";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/form/InlineEdit/InlineEdit.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
12
|
+
var m = o.forwardRef(({ value: o, defaultValue: m, onChange: h, onSave: g, onCancel: _, onEdit: v, placeholder: y, disabled: b = !1, fullWidth: x = !1, label: S, className: C, "aria-label": w, "aria-labelledby": T, "aria-describedby": E, ...D }, O) => {
|
|
13
|
+
let { t: k } = e(t), [A, j] = u(!1), M = c(), N = S ? `wim-inline-edit-${M}-label` : void 0, P = `wim-inline-edit-${M}-text`, [F, I] = u(m ?? ""), [L, R] = u(m ?? ""), z = l(null), B = o !== void 0, V = B ? o : L, H = () => {
|
|
14
|
+
b || (B || R(F), j(!0), v?.());
|
|
15
|
+
}, U = () => {
|
|
16
|
+
b || (B || I(V), j(!1), g?.(V));
|
|
17
|
+
}, W = () => {
|
|
18
|
+
b || (B || R(F), j(!1), _?.());
|
|
19
|
+
}, G = (e) => {
|
|
20
20
|
let t = e.target.value;
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
e.key === "Enter" ? (e.preventDefault(),
|
|
21
|
+
B || R(t), h?.(t);
|
|
22
|
+
}, K = (e) => {
|
|
23
|
+
e.key === "Enter" ? (e.preventDefault(), U()) : e.key === "Escape" && (e.preventDefault(), W());
|
|
24
24
|
};
|
|
25
25
|
return s(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
label:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
A && z.current && z.current.focus();
|
|
27
|
+
}, [A]), /* @__PURE__ */ f(n, {
|
|
28
|
+
label: S,
|
|
29
|
+
labelId: N,
|
|
30
|
+
className: C,
|
|
31
|
+
children: /* @__PURE__ */ f("div", {
|
|
32
|
+
ref: O,
|
|
33
|
+
className: d("wim-inline-edit", a.root, x && a.fullWidth, b && a.disabled),
|
|
34
|
+
...D,
|
|
35
|
+
children: A ? /* @__PURE__ */ p("div", {
|
|
35
36
|
className: a.editWrapper,
|
|
36
|
-
children: [/* @__PURE__ */
|
|
37
|
-
ref:
|
|
38
|
-
value:
|
|
39
|
-
onChange:
|
|
40
|
-
onKeyDown:
|
|
41
|
-
disabled:
|
|
42
|
-
placeholder:
|
|
43
|
-
"aria-label":
|
|
44
|
-
"aria-labelledby":
|
|
45
|
-
"aria-describedby":
|
|
46
|
-
fullWidth:
|
|
37
|
+
children: [/* @__PURE__ */ f(r, {
|
|
38
|
+
ref: z,
|
|
39
|
+
value: V,
|
|
40
|
+
onChange: G,
|
|
41
|
+
onKeyDown: K,
|
|
42
|
+
disabled: b,
|
|
43
|
+
placeholder: y,
|
|
44
|
+
"aria-label": N ? void 0 : w,
|
|
45
|
+
"aria-labelledby": N ?? T,
|
|
46
|
+
"aria-describedby": E,
|
|
47
|
+
fullWidth: x,
|
|
47
48
|
className: a.input
|
|
48
|
-
}), /* @__PURE__ */
|
|
49
|
+
}), /* @__PURE__ */ p("div", {
|
|
49
50
|
className: a.editActions,
|
|
50
|
-
children: [/* @__PURE__ */
|
|
51
|
+
children: [/* @__PURE__ */ f(i, {
|
|
51
52
|
iconName: "CheckIcon",
|
|
52
53
|
intent: "success",
|
|
53
54
|
variant: "outline",
|
|
54
|
-
"aria-label":
|
|
55
|
-
onClick:
|
|
56
|
-
disabled:
|
|
57
|
-
}), /* @__PURE__ */
|
|
55
|
+
"aria-label": k("action.save"),
|
|
56
|
+
onClick: U,
|
|
57
|
+
disabled: b
|
|
58
|
+
}), /* @__PURE__ */ f(i, {
|
|
58
59
|
iconName: "CloseIcon",
|
|
59
60
|
intent: "default",
|
|
60
61
|
variant: "outline",
|
|
61
|
-
"aria-label":
|
|
62
|
-
onClick:
|
|
63
|
-
disabled:
|
|
62
|
+
"aria-label": k("action.cancel"),
|
|
63
|
+
onClick: W,
|
|
64
|
+
disabled: b
|
|
64
65
|
})]
|
|
65
66
|
})]
|
|
66
|
-
}) : /* @__PURE__ */
|
|
67
|
+
}) : /* @__PURE__ */ p("div", {
|
|
67
68
|
className: a.preview,
|
|
68
|
-
onClick:
|
|
69
|
+
onClick: H,
|
|
69
70
|
onKeyDown: (e) => {
|
|
70
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
71
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), H());
|
|
71
72
|
},
|
|
72
|
-
tabIndex:
|
|
73
|
+
tabIndex: b ? -1 : 0,
|
|
73
74
|
role: "button",
|
|
74
|
-
"aria-label":
|
|
75
|
-
"aria-labelledby":
|
|
76
|
-
"aria-describedby":
|
|
77
|
-
"aria-disabled":
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
"aria-label": N ? void 0 : w,
|
|
76
|
+
"aria-labelledby": N ? `${N} ${P}` : T,
|
|
77
|
+
"aria-describedby": E,
|
|
78
|
+
"aria-disabled": b,
|
|
79
|
+
children: [/* @__PURE__ */ f("span", {
|
|
80
|
+
id: P,
|
|
81
|
+
className: d(a.text, !V && a.placeholder),
|
|
82
|
+
children: V || y || "\xA0"
|
|
83
|
+
}), /* @__PURE__ */ f("span", {
|
|
82
84
|
className: a.editIconWrapper,
|
|
83
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ f(i, {
|
|
84
86
|
iconName: "EditIcon",
|
|
85
87
|
variant: "ghost",
|
|
86
88
|
size: "sm",
|
|
87
89
|
tabIndex: -1,
|
|
88
|
-
"aria-label":
|
|
90
|
+
"aria-label": k("action.edit"),
|
|
89
91
|
"aria-hidden": "true",
|
|
90
92
|
asChild: !0,
|
|
91
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ f("span", {})
|
|
92
94
|
})
|
|
93
95
|
})]
|
|
94
96
|
})
|
|
95
97
|
})
|
|
96
98
|
});
|
|
97
99
|
});
|
|
98
|
-
|
|
100
|
+
m.displayName = "InlineEdit";
|
|
99
101
|
//#endregion
|
|
100
|
-
export {
|
|
102
|
+
export { m as InlineEdit };
|
|
@@ -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("../../_internal/BaseListItem/BaseListItem.cjs"),r=require("../../_internal/mergeRefs.cjs"),i=require("../Textarea/Textarea.cjs"),a=require("./mentions.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(0,o.forwardRef)(({options:e,trigger:c=`@`,value:l,defaultValue:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../_internal/BaseListItem/BaseListItem.cjs"),r=require("../../_internal/mergeRefs.cjs"),i=require("../Textarea/Textarea.cjs"),a=require("./mentions.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(0,o.forwardRef)(({options:e,trigger:c=`@`,value:l,defaultValue:u,onChange:d,onSelect:f,asChild:p=!1,children:m,intent:h,variant:g,fullWidth:_,fieldSizing:v,label:y,error:ee,required:b,layout:x,width:S,placeholder:C,rows:w,cols:T,onCopy:E,onCut:D,onPaste:O,...k},A)=>{let j=(0,o.useId)(),M=k.id||`wim-mentions-${j}`,[N,P]=(0,o.useState)(u||``),F=l!==void 0,I=F?l:N,[L,R]=(0,o.useState)(!1),[z,B]=(0,o.useState)(``),[V,H]=(0,o.useState)(0),[U,W]=(0,o.useState)(-1),[G,K]=(0,o.useState)(0),q=(0,o.useRef)(null),J=(0,o.useRef)(null),Y=r.mergeRefs(J,A),X=e.filter(e=>e.display.toLowerCase().includes(z.toLowerCase())),Z=e=>{let t=e.target.value,n=e.target.selectionStart;H(n),F||P(t),d&&d(e);let r=t.slice(0,n),i=r.lastIndexOf(c);if(i!==-1){let e=r.slice(i+c.length);if(!e.includes(` `)){W(i),B(e),R(!0),K(0);return}}R(!1),W(-1)},Q=e=>{let t=I.slice(0,U),n=I.slice(V),r=`${t}${c}${e.display} ${n}`;F||P(r),d&&d({target:{value:r}}),f&&f(e),R(!1),W(-1),setTimeout(()=>{if(q.current){q.current.focus();let n=t.length+c.length+e.display.length+1;q.current.setSelectionRange(n,n)}},0)},te=e=>{L&&X.length>0&&(e.key===`ArrowDown`?(e.preventDefault(),K(e=>e>=X.length-1?0:e+1)):e.key===`ArrowUp`?(e.preventDefault(),K(e=>e<=0?X.length-1:e-1)):e.key===`Enter`||e.key===`Tab`?G>=0&&X[G]&&(e.preventDefault(),Q(X[G])):e.key===`Escape`&&R(!1))},ne=p?t.Root:`div`,re={intent:h,variant:g,fullWidth:_,fieldSizing:v,label:y,error:ee,required:b,layout:x,width:S,placeholder:C,rows:w,cols:T,onCopy:E,onCut:D,onPaste:O},$={...k};delete $[`aria-label`],delete $[`aria-labelledby`],delete $[`aria-describedby`],delete $.id;let ie=$;return(0,s.jsxs)(ne,{className:`wim-mentions ${a.default.container}`,ref:Y,...ie,children:[(0,s.jsx)(i.Textarea,{...k,...re,ref:q,value:I,onChange:Z,onKeyDown:te,"aria-autocomplete":`list`,"aria-controls":L?`${M}-list`:void 0,onBlur:e=>{J.current?.contains(e.relatedTarget)||R(!1)}}),L&&X.length>0&&(0,s.jsx)(`div`,{id:`${M}-list`,className:a.default.list,role:`listbox`,children:X.map((e,t)=>(0,s.jsx)(n.BaseListItem,{active:t===G,onMouseDown:e=>e.preventDefault(),onClick:()=>Q(e),onMouseEnter:()=>K(t),role:`option`,"aria-selected":t===G,tabIndex:-1,children:e.display},e.id))}),p?(0,s.jsx)(t.Slottable,{children:m}):null]})});c.displayName=`Mentions`,exports.Mentions=c,exports.default=c;
|