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.
Files changed (34) hide show
  1. package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
  2. package/dist/components/data-display/Carousel/Carousel.js +125 -122
  3. package/dist/components/data-display/Timeline/Timeline.cjs +1 -1
  4. package/dist/components/data-display/Timeline/Timeline.js +45 -39
  5. package/dist/components/form/CheckboxGroup/CheckboxGroup.cjs +1 -1
  6. package/dist/components/form/CheckboxGroup/CheckboxGroup.js +2 -2
  7. package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
  8. package/dist/components/form/DatePicker/DatePicker.js +82 -78
  9. package/dist/components/form/FieldTemplate/FieldTemplate.cjs +1 -1
  10. package/dist/components/form/FieldTemplate/FieldTemplate.js +29 -23
  11. package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
  12. package/dist/components/form/InlineEdit/InlineEdit.js +62 -60
  13. package/dist/components/form/Mentions/Mentions.cjs +1 -1
  14. package/dist/components/form/Mentions/Mentions.js +71 -70
  15. package/dist/components/form/OtpInput/OtpInput.cjs +1 -1
  16. package/dist/components/form/OtpInput/OtpInput.js +2 -2
  17. package/dist/components/form/RadioGroup/RadioGroup.cjs +1 -1
  18. package/dist/components/form/RadioGroup/RadioGroup.js +2 -2
  19. package/dist/components/form/Select/Select.cjs +1 -1
  20. package/dist/components/form/Select/Select.js +71 -67
  21. package/dist/components/form/Slider/Slider.cjs +1 -1
  22. package/dist/components/form/Slider/Slider.js +35 -31
  23. package/dist/components/form/SwitchGroup/SwitchGroup.cjs +1 -1
  24. package/dist/components/form/SwitchGroup/SwitchGroup.js +2 -2
  25. package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
  26. package/dist/components/navigation/Breadcrumb/Breadcrumb.d.ts +5 -0
  27. package/dist/components/navigation/Breadcrumb/Breadcrumb.js +44 -44
  28. package/dist/components/navigation/Stepper/Stepper.cjs +1 -1
  29. package/dist/components/navigation/Stepper/Stepper.d.ts +5 -0
  30. package/dist/components/navigation/Stepper/Stepper.js +51 -51
  31. package/dist/llms-full.txt +5 -1
  32. package/dist/llms.txt +1 -1
  33. package/dist/wimui.umd.js +1 -1
  34. 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 ee } from "../../overlay/FocusTrap/FocusTrap.js";
6
- import { componentsNs as i } from "../../../i18n/generated/components.js";
7
- import { InputBase as a } from "../InputBase/InputBase.js";
8
- import { FieldTemplate as o } from "../FieldTemplate/FieldTemplate.js";
9
- import s from "../Input/input.module.js";
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 ne } from "../../_internal/mergeRefs.js";
12
- import c from "./date-picker.module.js";
13
- import { forwardRef as l, useEffect as u, useId as d, useRef as f, useState as p } from "react";
14
- import m from "classnames";
15
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
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 _ = l(({ intent: l = "default", variant: _ = "outline", fullWidth: v = !1, className: y, disabled: b, value: x, defaultValue: S, onChange: C, format: w = "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] = p(!1), [R, z] = p(S || null), B = f(null), V = f(null), H = ne(B, F), { t: U } = n(i), W = d(), G = k || `wim-datepicker-${W}`, K = `${G}-dropdown`, q = T ? `${G}-label` : void 0, J = E ? `${G}-error` : void 0, Y = x !== void 0, X = Y ? x : R, ce = ie ?? A?.placeholder, Z = b, Q = E ? "danger" : l;
19
- u(() => {
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
- }, []), u(() => {
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 w.replace("YYYY", String(t)).replace("MM", n).replace("DD", r);
33
+ return ne.replace("YYYY", String(t)).replace("MM", n).replace("DD", r);
34
34
  }, ue = (e) => {
35
- Y || z(e), C?.(e), L(!1), V.current?.focus();
35
+ Y || z(e), w?.(e), L(!1), V.current?.focus();
36
36
  }, de = (e) => {
37
- e?.stopPropagation(), Z || (Y || z(null), C?.(null));
37
+ e?.stopPropagation(), Z || (Y || z(null), w?.(null));
38
38
  }, $ = () => {
39
39
  Z || L(!I);
40
40
  };
41
- return u(() => {
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__ */ h(o, {
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: y,
58
- children: /* @__PURE__ */ g(M ? e : "div", {
57
+ className: b,
58
+ children: /* @__PURE__ */ _(M ? e : "div", {
59
59
  ref: H,
60
- className: m("wim-date-picker", c.root, v && c.fullWidth),
61
- children: [/* @__PURE__ */ g(t, { children: [/* @__PURE__ */ h(a, {
62
- intent: Q,
63
- variant: _,
64
- width: j,
65
- fullWidth: v,
66
- disabled: Z,
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
- onClick: $,
87
- onKeyDown: (e) => {
88
- Z || (e.key === "Escape" ? (L(!1), V.current?.focus()) : (e.key === "Enter" || e.key === " " || e.key === "ArrowDown" && (e.altKey || !I)) && (e.preventDefault(), L(!I)));
89
- },
90
- "aria-haspopup": "dialog",
91
- "aria-expanded": I,
92
- "aria-controls": I ? K : void 0,
93
- "aria-invalid": Q === "danger",
94
- "aria-describedby": J,
95
- "aria-labelledby": q,
96
- "aria-required": D,
97
- ...P
98
- })
99
- }), /* @__PURE__ */ h(r, {
100
- show: I && !b,
101
- preset: "fade",
102
- id: K,
103
- className: c.dropdown,
104
- children: /* @__PURE__ */ h(ee, {
105
- active: I,
106
- initialFocus: !1,
107
- children: /* @__PURE__ */ h("div", {
108
- role: "dialog",
109
- "aria-modal": "true",
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-label": q ? void 0 : P["aria-label"] ?? U("datepicker.dialog"),
112
- children: /* @__PURE__ */ h(te, {
113
- value: X ?? void 0,
114
- onChange: ue
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
- })] }), N]
120
+ }),
121
+ /* @__PURE__ */ g(t, { children: N })
122
+ ]
119
123
  })
120
124
  });
121
125
  });
122
- _.displayName = "DatePicker";
126
+ v.displayName = "DatePicker";
123
127
  //#endregion
124
- export { _ as DatePicker, _ as default };
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)=>(0,s.jsxs)(e?t.Root:`div`,{className:(0,o.default)(`wim-field-template`,i.default.root,i.default[d],h,g?.root),ref:v,..._,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:[(0,s.jsx)(t.Slottable,{children:l}),c&&(0,s.jsx)(r.FieldError,{id:m,content:c,className:(0,o.default)(i.default.danger,g?.error)})]})]}));c.displayName=`FieldTemplate`,exports.FieldTemplate=c;
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 { jsx as s, jsxs as c } from "react/jsx-runtime";
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 l = a.forwardRef(({ asChild: a = !1, label: l, error: u, children: d, required: f, layout: p = "vertical", labelId: m, htmlFor: h, errorId: g, className: _, styles: v, ...y }, b) => /* @__PURE__ */ c(a ? e : "div", {
11
- className: o("wim-field-template", i.root, i[p], _, v?.root),
12
- ref: b,
13
- ...y,
14
- children: [l && /* @__PURE__ */ s("div", {
15
- className: o(i.labelWrapper, v?.labelWrapper),
16
- children: /* @__PURE__ */ s(n, {
17
- label: l,
18
- required: f,
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__ */ c("div", {
24
- className: o(i.content, v?.content),
25
- children: [/* @__PURE__ */ s(t, { children: d }), u && /* @__PURE__ */ s(r, {
26
- id: g,
27
- content: u,
28
- className: o(i.danger, v?.error)
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
- l.displayName = "FieldTemplate";
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 { l as FieldTemplate };
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),[O,k]=(0,s.useState)(u??``),[A,j]=(0,s.useState)(u??``),M=(0,s.useRef)(null),N=e!==void 0,P=N?e:A,F=()=>{g||(N||j(O),D(!0),m?.())},I=()=>{g||(N||k(P),D(!1),f?.(P))},L=()=>{g||(N||j(O),D(!1),p?.())},R=e=>{let t=e.target.value;N||j(t),d?.(t)},z=e=>{e.key===`Enter`?(e.preventDefault(),I()):e.key===`Escape`&&(e.preventDefault(),L())};return(0,s.useEffect)(()=>{E&&M.current&&M.current.focus()},[E]),(0,l.jsx)(r.FieldTemplate,{label:v,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:M,value:P,onChange:R,onKeyDown:z,disabled:g,placeholder:h,"aria-label":b,"aria-labelledby":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:I,disabled:g}),(0,l.jsx)(a.IconButton,{iconName:`CloseIcon`,intent:`default`,variant:`outline`,"aria-label":T(`action.cancel`),onClick:L,disabled:g})]})]}):(0,l.jsxs)(`div`,{className:o.default.preview,onClick:F,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},tabIndex:g?-1:0,role:`button`,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,"aria-disabled":g,children:[(0,l.jsx)(`span`,{className:(0,c.default)(o.default.text,!P&&o.default.placeholder),children:P||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;
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, 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";
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 p = o.forwardRef(({ value: o, defaultValue: p, onChange: m, onSave: h, onCancel: g, onEdit: _, placeholder: v, disabled: y = !1, fullWidth: b = !1, label: x, className: S, "aria-label": C, "aria-labelledby": w, "aria-describedby": T, ...E }, D) => {
13
- let { t: O } = e(t), [k, A] = l(!1), [j, M] = l(p ?? ""), [N, P] = l(p ?? ""), F = c(null), I = o !== void 0, L = I ? o : N, R = () => {
14
- y || (I || P(j), A(!0), _?.());
15
- }, z = () => {
16
- y || (I || M(L), A(!1), h?.(L));
17
- }, B = () => {
18
- y || (I || P(j), A(!1), g?.());
19
- }, V = (e) => {
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
- I || P(t), m?.(t);
22
- }, H = (e) => {
23
- e.key === "Enter" ? (e.preventDefault(), z()) : e.key === "Escape" && (e.preventDefault(), B());
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
- k && F.current && F.current.focus();
27
- }, [k]), /* @__PURE__ */ d(n, {
28
- label: x,
29
- className: S,
30
- children: /* @__PURE__ */ d("div", {
31
- ref: D,
32
- className: u("wim-inline-edit", a.root, b && a.fullWidth, y && a.disabled),
33
- ...E,
34
- children: k ? /* @__PURE__ */ f("div", {
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__ */ d(r, {
37
- ref: F,
38
- value: L,
39
- onChange: V,
40
- onKeyDown: H,
41
- disabled: y,
42
- placeholder: v,
43
- "aria-label": C,
44
- "aria-labelledby": w,
45
- "aria-describedby": T,
46
- fullWidth: b,
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__ */ f("div", {
49
+ }), /* @__PURE__ */ p("div", {
49
50
  className: a.editActions,
50
- children: [/* @__PURE__ */ d(i, {
51
+ children: [/* @__PURE__ */ f(i, {
51
52
  iconName: "CheckIcon",
52
53
  intent: "success",
53
54
  variant: "outline",
54
- "aria-label": O("action.save"),
55
- onClick: z,
56
- disabled: y
57
- }), /* @__PURE__ */ d(i, {
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": O("action.cancel"),
62
- onClick: B,
63
- disabled: y
62
+ "aria-label": k("action.cancel"),
63
+ onClick: W,
64
+ disabled: b
64
65
  })]
65
66
  })]
66
- }) : /* @__PURE__ */ f("div", {
67
+ }) : /* @__PURE__ */ p("div", {
67
68
  className: a.preview,
68
- onClick: R,
69
+ onClick: H,
69
70
  onKeyDown: (e) => {
70
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
71
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), H());
71
72
  },
72
- tabIndex: y ? -1 : 0,
73
+ tabIndex: b ? -1 : 0,
73
74
  role: "button",
74
- "aria-label": C,
75
- "aria-labelledby": w,
76
- "aria-describedby": T,
77
- "aria-disabled": y,
78
- children: [/* @__PURE__ */ d("span", {
79
- className: u(a.text, !L && a.placeholder),
80
- children: L || v || "\xA0"
81
- }), /* @__PURE__ */ d("span", {
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__ */ d(i, {
85
+ children: /* @__PURE__ */ f(i, {
84
86
  iconName: "EditIcon",
85
87
  variant: "ghost",
86
88
  size: "sm",
87
89
  tabIndex: -1,
88
- "aria-label": O("action.edit"),
90
+ "aria-label": k("action.edit"),
89
91
  "aria-hidden": "true",
90
92
  asChild: !0,
91
- children: /* @__PURE__ */ d("span", {})
93
+ children: /* @__PURE__ */ f("span", {})
92
94
  })
93
95
  })]
94
96
  })
95
97
  })
96
98
  });
97
99
  });
98
- p.displayName = "InlineEdit";
100
+ m.displayName = "InlineEdit";
99
101
  //#endregion
100
- export { p as InlineEdit };
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:ee,onChange:u,onSelect:d,asChild:f=!1,children:p,intent:m,variant:h,fullWidth:g,fieldSizing:_,label:v,error:y,required:te,layout:b,width:x,placeholder:S,rows:C,cols:w,onCopy:T,onCut:E,onPaste:D,...O},k)=>{let A=(0,o.useId)(),j=O.id||`wim-mentions-${A}`,[M,N]=(0,o.useState)(ee||``),P=l!==void 0,F=P?l:M,[I,L]=(0,o.useState)(!1),[R,z]=(0,o.useState)(``),[B,V]=(0,o.useState)(0),[H,U]=(0,o.useState)(-1),[W,G]=(0,o.useState)(0),K=(0,o.useRef)(null),q=(0,o.useRef)(null),J=r.mergeRefs(q,k),Y=e.filter(e=>e.display.toLowerCase().includes(R.toLowerCase())),X=e=>{let t=e.target.value,n=e.target.selectionStart;V(n),P||N(t),u&&u(e);let r=t.slice(0,n),i=r.lastIndexOf(c);if(i!==-1){let e=r.slice(i+c.length);if(!e.includes(` `)){U(i),z(e),L(!0),G(0);return}}L(!1),U(-1)},Z=e=>{let t=F.slice(0,H),n=F.slice(B),r=`${t}${c}${e.display} ${n}`;P||N(r),u&&u({target:{value:r}}),d&&d(e),L(!1),U(-1),setTimeout(()=>{if(K.current){K.current.focus();let n=t.length+c.length+e.display.length+1;K.current.setSelectionRange(n,n)}},0)},ne=e=>{I&&Y.length>0&&(e.key===`ArrowDown`?(e.preventDefault(),G(e=>e>=Y.length-1?0:e+1)):e.key===`ArrowUp`?(e.preventDefault(),G(e=>e<=0?Y.length-1:e-1)):e.key===`Enter`||e.key===`Tab`?W>=0&&Y[W]&&(e.preventDefault(),Z(Y[W])):e.key===`Escape`&&L(!1))},re=f?t.Root:`div`,Q={intent:m,variant:h,fullWidth:g,fieldSizing:_,label:v,error:y,required:te,layout:b,width:x,placeholder:S,rows:C,cols:w,onCopy:T,onCut:E,onPaste:D},$={...O};delete $[`aria-label`],delete $[`aria-labelledby`],delete $[`aria-describedby`],delete $.id;let ie=f?{...Q,...O}:$;return(0,s.jsxs)(re,{className:`wim-mentions ${a.default.container}`,ref:J,...ie,children:[(0,s.jsxs)(t.Slottable,{children:[(0,s.jsx)(i.Textarea,{...O,...Q,ref:K,value:F,onChange:X,onKeyDown:ne,"aria-autocomplete":`list`,"aria-controls":I?`${j}-list`:void 0,onBlur:e=>{q.current?.contains(e.relatedTarget)||L(!1)}}),I&&Y.length>0&&(0,s.jsx)(`div`,{id:`${j}-list`,className:a.default.list,role:`listbox`,children:Y.map((e,t)=>(0,s.jsx)(n.BaseListItem,{active:t===W,onMouseDown:e=>e.preventDefault(),onClick:()=>Z(e),onMouseEnter:()=>G(t),role:`option`,"aria-selected":t===W,tabIndex:-1,children:e.display},e.id))})]}),f?p:null]})});c.displayName=`Mentions`,exports.Mentions=c,exports.default=c;
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;