wimui 0.57.2 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/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/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("../../../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;
|
|
@@ -4,88 +4,89 @@ import { BaseListItem as n } from "../../_internal/BaseListItem/BaseListItem.js"
|
|
|
4
4
|
import { mergeRefs as r } from "../../_internal/mergeRefs.js";
|
|
5
5
|
import { Textarea as i } from "../Textarea/Textarea.js";
|
|
6
6
|
import a from "./mentions.module.js";
|
|
7
|
-
import { forwardRef as o, useId as
|
|
8
|
-
import { jsx as
|
|
7
|
+
import { forwardRef as o, useId as s, useRef as c, useState as l } from "react";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/form/Mentions/Mentions.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
10
|
+
var f = o(({ options: o, trigger: f = "@", value: p, defaultValue: ee, onChange: m, onSelect: h, asChild: g = !1, children: _, intent: v, variant: y, fullWidth: b, fieldSizing: x, label: S, error: C, required: w, layout: T, width: E, placeholder: D, rows: te, cols: ne, onCopy: O, onCut: k, onPaste: A, ...j }, M) => {
|
|
11
|
+
let N = s(), P = j.id || `wim-mentions-${N}`, [F, I] = l(ee || ""), L = p !== void 0, R = L ? p : F, [z, B] = l(!1), [V, H] = l(""), [U, W] = l(0), [G, K] = l(-1), [q, J] = l(0), Y = c(null), X = c(null), re = r(X, M), Z = o.filter((e) => e.display.toLowerCase().includes(V.toLowerCase())), ie = (e) => {
|
|
12
12
|
let t = e.target.value, n = e.target.selectionStart;
|
|
13
|
-
|
|
14
|
-
let r = t.slice(0, n), i = r.lastIndexOf(
|
|
13
|
+
W(n), L || I(t), m && m(e);
|
|
14
|
+
let r = t.slice(0, n), i = r.lastIndexOf(f);
|
|
15
15
|
if (i !== -1) {
|
|
16
|
-
let e = r.slice(i +
|
|
16
|
+
let e = r.slice(i + f.length);
|
|
17
17
|
if (!e.includes(" ")) {
|
|
18
|
-
|
|
18
|
+
K(i), H(e), B(!0), J(0);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
let t =
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
let n = t.length +
|
|
29
|
-
|
|
22
|
+
B(!1), K(-1);
|
|
23
|
+
}, Q = (e) => {
|
|
24
|
+
let t = R.slice(0, G), n = R.slice(U), r = `${t}${f}${e.display} ${n}`;
|
|
25
|
+
L || I(r), m && m({ target: { value: r } }), h && h(e), B(!1), K(-1), setTimeout(() => {
|
|
26
|
+
if (Y.current) {
|
|
27
|
+
Y.current.focus();
|
|
28
|
+
let n = t.length + f.length + e.display.length + 1;
|
|
29
|
+
Y.current.setSelectionRange(n, n);
|
|
30
30
|
}
|
|
31
31
|
}, 0);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
intent:
|
|
36
|
-
variant:
|
|
37
|
-
fullWidth:
|
|
38
|
-
fieldSizing:
|
|
39
|
-
label:
|
|
40
|
-
error:
|
|
41
|
-
required:
|
|
42
|
-
layout:
|
|
43
|
-
width:
|
|
44
|
-
placeholder:
|
|
45
|
-
rows:
|
|
46
|
-
cols:
|
|
47
|
-
onCopy:
|
|
48
|
-
onCut:
|
|
49
|
-
onPaste:
|
|
50
|
-
}, $ = { ...
|
|
32
|
+
}, ae = (e) => {
|
|
33
|
+
z && Z.length > 0 && (e.key === "ArrowDown" ? (e.preventDefault(), J((e) => e >= Z.length - 1 ? 0 : e + 1)) : e.key === "ArrowUp" ? (e.preventDefault(), J((e) => e <= 0 ? Z.length - 1 : e - 1)) : e.key === "Enter" || e.key === "Tab" ? q >= 0 && Z[q] && (e.preventDefault(), Q(Z[q])) : e.key === "Escape" && B(!1));
|
|
34
|
+
}, oe = g ? e : "div", se = {
|
|
35
|
+
intent: v,
|
|
36
|
+
variant: y,
|
|
37
|
+
fullWidth: b,
|
|
38
|
+
fieldSizing: x,
|
|
39
|
+
label: S,
|
|
40
|
+
error: C,
|
|
41
|
+
required: w,
|
|
42
|
+
layout: T,
|
|
43
|
+
width: E,
|
|
44
|
+
placeholder: D,
|
|
45
|
+
rows: te,
|
|
46
|
+
cols: ne,
|
|
47
|
+
onCopy: O,
|
|
48
|
+
onCut: k,
|
|
49
|
+
onPaste: A
|
|
50
|
+
}, $ = { ...j };
|
|
51
51
|
delete $["aria-label"], delete $["aria-labelledby"], delete $["aria-describedby"], delete $.id;
|
|
52
|
-
let ce =
|
|
53
|
-
|
|
54
|
-
...A
|
|
55
|
-
} : $;
|
|
56
|
-
return /* @__PURE__ */ u(se, {
|
|
52
|
+
let ce = $;
|
|
53
|
+
return /* @__PURE__ */ d(oe, {
|
|
57
54
|
className: `wim-mentions ${a.container}`,
|
|
58
|
-
ref:
|
|
55
|
+
ref: re,
|
|
59
56
|
...ce,
|
|
60
|
-
children: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ u(i, {
|
|
59
|
+
...j,
|
|
60
|
+
...se,
|
|
61
|
+
ref: Y,
|
|
62
|
+
value: R,
|
|
63
|
+
onChange: ie,
|
|
64
|
+
onKeyDown: ae,
|
|
65
|
+
"aria-autocomplete": "list",
|
|
66
|
+
"aria-controls": z ? `${P}-list` : void 0,
|
|
67
|
+
onBlur: (e) => {
|
|
68
|
+
X.current?.contains(e.relatedTarget) || B(!1);
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
z && Z.length > 0 && /* @__PURE__ */ u("div", {
|
|
72
|
+
id: `${P}-list`,
|
|
73
|
+
className: a.list,
|
|
74
|
+
role: "listbox",
|
|
75
|
+
children: Z.map((e, t) => /* @__PURE__ */ u(n, {
|
|
76
|
+
active: t === q,
|
|
77
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
78
|
+
onClick: () => Q(e),
|
|
79
|
+
onMouseEnter: () => J(t),
|
|
80
|
+
role: "option",
|
|
81
|
+
"aria-selected": t === q,
|
|
82
|
+
tabIndex: -1,
|
|
83
|
+
children: e.display
|
|
84
|
+
}, e.id))
|
|
85
|
+
}),
|
|
86
|
+
g ? /* @__PURE__ */ u(t, { children: _ }) : null
|
|
87
|
+
]
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
|
-
|
|
90
|
+
f.displayName = "Mentions";
|
|
90
91
|
//#endregion
|
|
91
|
-
export {
|
|
92
|
+
export { f as Mentions, f 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("../FieldTemplate/FieldTemplate.cjs"),r=require("./otp-input.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=(e,t)=>{let n=e.split(``).slice(0,t);return Array(t).fill(``).map((e,t)=>n[t]??``)},c=(0,i.forwardRef)(({length:e=6,value:c=``,onChange:l,disabled:u=!1,error:d,required:f,label:p,layout:m,className:h,labels:g={},asChild:_=!1,fullWidth:v=!1,children:y,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,...C},w)=>{let{digitAriaLabel:T=e=>`Digit ${e}`}=g,[E,D]=(0,i.useState)(()=>s(c,e)),[O,k]=(0,i.useState)(c),A=(0,i.useRef)([]),j=`wim-otp-input-${(0,i.useId)()}`,M=p?`${j}-label`:void 0,N=d?`${j}-error`:void 0,P=M??x,F=[S,N].filter(Boolean).join(` `)||void 0;c!==O&&(k(c),D(s(c,e)));let I=e=>{let t=e.join(``);l&&l(t)},L=(t,n)=>{let r=t.target.value.slice(-1),i=[...E];i[n]=r,D(i),I(i),r&&n<e-1&&A.current[n+1]?.focus()},R=(t,n)=>{if(t.key===`Backspace`){if(!E[n]&&n>0){let e=[...E];e[n-1]=``,D(e),I(e),A.current[n-1]?.focus()}else if(E[n]){let e=[...E];e[n]=``,D(e),I(e)}}else t.key===`ArrowLeft`&&n>0?(t.preventDefault(),A.current[n-1]?.focus()):t.key===`ArrowRight`&&n<e-1&&(t.preventDefault(),A.current[n+1]?.focus())},z=t=>{t.preventDefault();let n=t.clipboardData.getData(`text`).slice(0,e).split(``),r=[...E];n.forEach((t,n)=>{n<e&&(r[n]=t)}),D(r),I(r);let i=Math.min(n.length,e-1);A.current[i]?.focus()},B=_?t.Root:`div`;return(0,o.jsx)(n.FieldTemplate,{label:p,error:d,required:f,layout:m,labelId:M,htmlFor:j,errorId:N,className:(0,a.default)(h,v&&r.default.fullWidth),children:(0,o.jsxs)(B,{className:(0,a.default)(`wim-otp-input`,r.default.root,v&&r.default.fullWidth),ref:w,...C,children:[(0,o.jsx)(
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),r=require("./otp-input.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=(e,t)=>{let n=e.split(``).slice(0,t);return Array(t).fill(``).map((e,t)=>n[t]??``)},c=(0,i.forwardRef)(({length:e=6,value:c=``,onChange:l,disabled:u=!1,error:d,required:f,label:p,layout:m,className:h,labels:g={},asChild:_=!1,fullWidth:v=!1,children:y,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,...C},w)=>{let{digitAriaLabel:T=e=>`Digit ${e}`}=g,[E,D]=(0,i.useState)(()=>s(c,e)),[O,k]=(0,i.useState)(c),A=(0,i.useRef)([]),j=`wim-otp-input-${(0,i.useId)()}`,M=p?`${j}-label`:void 0,N=d?`${j}-error`:void 0,P=M??x,F=[S,N].filter(Boolean).join(` `)||void 0;c!==O&&(k(c),D(s(c,e)));let I=e=>{let t=e.join(``);l&&l(t)},L=(t,n)=>{let r=t.target.value.slice(-1),i=[...E];i[n]=r,D(i),I(i),r&&n<e-1&&A.current[n+1]?.focus()},R=(t,n)=>{if(t.key===`Backspace`){if(!E[n]&&n>0){let e=[...E];e[n-1]=``,D(e),I(e),A.current[n-1]?.focus()}else if(E[n]){let e=[...E];e[n]=``,D(e),I(e)}}else t.key===`ArrowLeft`&&n>0?(t.preventDefault(),A.current[n-1]?.focus()):t.key===`ArrowRight`&&n<e-1&&(t.preventDefault(),A.current[n+1]?.focus())},z=t=>{t.preventDefault();let n=t.clipboardData.getData(`text`).slice(0,e).split(``),r=[...E];n.forEach((t,n)=>{n<e&&(r[n]=t)}),D(r),I(r);let i=Math.min(n.length,e-1);A.current[i]?.focus()},B=_?t.Root:`div`;return(0,o.jsx)(n.FieldTemplate,{label:p,error:d,required:f,layout:m,labelId:M,htmlFor:j,errorId:N,className:(0,a.default)(h,v&&r.default.fullWidth),children:(0,o.jsxs)(B,{className:(0,a.default)(`wim-otp-input`,r.default.root,v&&r.default.fullWidth),ref:w,...C,children:[(0,o.jsx)(`div`,{className:(0,a.default)(r.default.container,u&&r.default.disabled),role:`group`,"aria-labelledby":P,"aria-label":P?void 0:b,"data-testid":`otp-input-container`,"data-disabled":u,children:Array.from({length:e}).map((e,t)=>(0,o.jsx)(`input`,{id:t===0?j:void 0,ref:e=>{A.current[t]=e},"data-testid":`otp-input`,className:(0,a.default)(r.default.input,d&&r.default.danger,u&&r.default.disabled),type:`text`,maxLength:1,value:E[t],onChange:e=>L(e,t),onKeyDown:e=>R(e,t),onPaste:z,disabled:u,"aria-label":T(t+1),"aria-invalid":d?`true`:`false`,"aria-describedby":F,"aria-required":f?`true`:void 0},t))}),(0,o.jsx)(t.Slottable,{children:y})]})})});c.displayName=`OtpInput`,exports.OtpInput=c,exports.default=c;
|
|
@@ -50,7 +50,7 @@ var d = (e, t) => {
|
|
|
50
50
|
className: c("wim-otp-input", r.root, S && r.fullWidth),
|
|
51
51
|
ref: O,
|
|
52
52
|
...D,
|
|
53
|
-
children: [/* @__PURE__ */ l(
|
|
53
|
+
children: [/* @__PURE__ */ l("div", {
|
|
54
54
|
className: c(r.container, m && r.disabled),
|
|
55
55
|
role: "group",
|
|
56
56
|
"aria-labelledby": R,
|
|
@@ -76,7 +76,7 @@ var d = (e, t) => {
|
|
|
76
76
|
"aria-describedby": z,
|
|
77
77
|
"aria-required": g ? "true" : void 0
|
|
78
78
|
}, t))
|
|
79
|
-
})
|
|
79
|
+
}), /* @__PURE__ */ l(t, { children: C })]
|
|
80
80
|
})
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -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("../FieldTemplate/FieldTemplate.cjs"),r=require("../Radio/Radio.cjs"),i=require("./radio-group.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=(0,a.forwardRef)(({options:e,value:c,defaultValue:l,onChange:u,direction:d=`vertical`,name:f,className:p,label:m,error:h,required:g,disabled:_,asChild:v=!1,children:y,...b},x)=>{let S=c!==void 0,[C,w]=(0,a.useState)(l),T=`wim-radio-group-${(0,a.useId)()}`,E=`${T}-label`,D=h?`${T}-error`:void 0,O=S?c:C,k=e=>{S||w(e),u&&u(e)};return(0,s.jsx)(n.FieldTemplate,{label:m,error:h,required:g,labelId:E,errorId:D,className:p,children:(0,s.jsxs)(v?t.Root:`div`,{...b,ref:x,className:(0,o.default)(`wim-radio-group`,i.default.root,d===`horizontal`&&i.default.horizontal),role:`radiogroup`,"aria-labelledby":m?E:b[`aria-labelledby`],"aria-describedby":[b[`aria-describedby`],D].filter(Boolean).join(` `)||void 0,"aria-required":g,"aria-invalid":!!h,children:[
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),r=require("../Radio/Radio.cjs"),i=require("./radio-group.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=(0,a.forwardRef)(({options:e,value:c,defaultValue:l,onChange:u,direction:d=`vertical`,name:f,className:p,label:m,error:h,required:g,disabled:_,asChild:v=!1,children:y,...b},x)=>{let S=c!==void 0,[C,w]=(0,a.useState)(l),T=`wim-radio-group-${(0,a.useId)()}`,E=`${T}-label`,D=h?`${T}-error`:void 0,O=S?c:C,k=e=>{S||w(e),u&&u(e)};return(0,s.jsx)(n.FieldTemplate,{label:m,error:h,required:g,labelId:E,errorId:D,className:p,children:(0,s.jsxs)(v?t.Root:`div`,{...b,ref:x,className:(0,o.default)(`wim-radio-group`,i.default.root,d===`horizontal`&&i.default.horizontal),role:`radiogroup`,"aria-labelledby":m?E:b[`aria-labelledby`],"aria-describedby":[b[`aria-describedby`],D].filter(Boolean).join(` `)||void 0,"aria-required":g,"aria-invalid":!!h,children:[e.map(e=>(0,s.jsx)(r.Radio,{value:e.value,checked:O===e.value,disabled:_||e.disabled,error:!!h,name:f,onChange:()=>k(e.value),children:e.label},e.value)),(0,s.jsx)(t.Slottable,{children:y})]})})});c.displayName=`RadioGroup`,exports.RadioGroup=c,exports.default=c;
|
|
@@ -27,7 +27,7 @@ var d = a(({ options: a, value: d, defaultValue: f, onChange: p, direction: m =
|
|
|
27
27
|
"aria-describedby": [C["aria-describedby"], A].filter(Boolean).join(" ") || void 0,
|
|
28
28
|
"aria-required": y,
|
|
29
29
|
"aria-invalid": !!v,
|
|
30
|
-
children: [
|
|
30
|
+
children: [a.map((e) => /* @__PURE__ */ l(r, {
|
|
31
31
|
value: e.value,
|
|
32
32
|
checked: j === e.value,
|
|
33
33
|
disabled: b || e.disabled,
|
|
@@ -35,7 +35,7 @@ var d = a(({ options: a, value: d, defaultValue: f, onChange: p, direction: m =
|
|
|
35
35
|
name: h,
|
|
36
36
|
onChange: () => M(e.value),
|
|
37
37
|
children: e.label
|
|
38
|
-
}, e.value))
|
|
38
|
+
}, e.value)), /* @__PURE__ */ l(t, { children: S })]
|
|
39
39
|
})
|
|
40
40
|
});
|
|
41
41
|
});
|
|
@@ -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("../../../i18n/useWimTranslation.cjs"),r=require("../../layout/Transition/Transition.cjs"),i=require("../../_internal/BaseListItem/BaseListItem.cjs"),a=require("../InputBase/InputBase.cjs"),o=require("../../../i18n/generated/form.cjs"),s=require("../FieldTemplate/FieldTemplate.cjs"),c=require("../../_internal/mergeRefs.cjs"),l=require("./select.module.cjs"),ee=require("./useSelect.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=(0,u.forwardRef)(({options:e=[],value:p,onChange:m,placeholder:h,label:g,error:_,required:v,layout:y,className:b,disabled:x=!1,defaultValue:te,searchable:S=!1,searchPlaceholder:C,filterOption:w,grouped:T=!1,allowClear:E=!1,fullWidth:D=!1,intent:ne=`default`,id:re,noOptionsFoundLabel:ie,width:ae,styles:O,asChild:oe=!1,children:k,...se},ce)=>{let{t:le}=n.useWimTranslation(o.formNs),ue=(0,u.useId)(),A=re||`wim-select-${ue}`,j=g?`${A}-label`:void 0,M=_?`${A}-error`:void 0,N=`${A}-list`,P=`${A}-trigger`,F=_?`danger`:ne,{isOpen:I,searchValue:L,setSearchValue:R,focusedIndex:z,setFocusedIndex:B,isKeyboardNavigating:V,setIsKeyboardNavigating:H,containerRef:de,triggerRef:fe,searchInputRef:pe,listItemsRef:U,currentValue:W,filteredOptions:G,selectedOption:K,focusedOption:q,handleToggle:J,handleSelect:Y,handleClear:me,handleKeyDown:X}=ee.useSelect({options:e,value:p,onChange:m,defaultValue:te,searchable:S,grouped:T,disabled:x,filterOption:w}),he=c.mergeRefs(de,ce),ge=()=>{let t=0;return T&&e.length>0&&`options`in e[0]?e.map((e,n)=>{let r=e.options.filter(e=>e.type===`separator`||!L||(w||((e,t)=>(typeof e.label==`string`?e.label:``).toLowerCase().includes(t.toLowerCase())))(e,L));return r.length===0?null:(0,f.jsxs)(u.default.Fragment,{children:[(0,f.jsx)(`li`,{className:(0,d.default)(l.default.groupLabel,O?.groupLabel),role:`presentation`,children:e.label}),r.map((e,r)=>{let a=t++;if(e.type===`separator`)return(0,f.jsx)(`li`,{className:(0,d.default)(l.default.separator,O?.separator),role:`presentation`},`sep-${n}-${r}`);let o=a===z,s=W===e.value,c=`wim-select-option-${A}-${e.value}`;return(0,f.jsx)(i.BaseListItem,{asChild:!0,id:c,ref:e=>{U.current[a]=e},active:o,disabled:e.disabled,className:(0,d.default)(l.default.option,s&&l.default.selected,O?.option),onClick:t=>{t.stopPropagation(),Y(e)},onMouseEnter:()=>B(a),role:`option`,"aria-selected":s,children:(0,f.jsx)(`li`,{children:e.label})},e.value)})]},n)}):G.map((e,n)=>{let r=t++;if(e.type===`separator`)return(0,f.jsx)(`li`,{className:(0,d.default)(l.default.separator,O?.separator),role:`presentation`},`sep-${n}`);let a=r===z,o=W===e.value,s=`wim-select-option-${A}-${e.value}`;return(0,f.jsx)(i.BaseListItem,{asChild:!0,id:s,ref:e=>{U.current[r]=e},active:a,disabled:e.disabled,className:(0,d.default)(l.default.option,o&&l.default.selected,O?.option),onClick:t=>{t.stopPropagation(),Y(e)},onMouseEnter:()=>B(r),role:`option`,"aria-selected":o,children:(0,f.jsx)(`li`,{children:e.label})},e.value)})},Z=q&&q.type!==`separator`?`wim-select-option-${A}-${q.value}`:void 0,{"aria-label":Q,"aria-labelledby":$,"aria-describedby":_e,...ve}=se;return(0,f.jsx)(s.FieldTemplate,{label:g,error:_,required:v,layout:y,labelId:j,htmlFor:P,errorId:M,className:b,children:(0,f.jsxs)(oe?t.Root:`div`,{className:(0,d.default)(`wim-select`,l.default.root,D&&l.default.fullWidth,O?.root),ref:he,onMouseMove:()=>H(!1),"data-keyboard-nav":V,...ve,children:[(0,f.
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../layout/Transition/Transition.cjs"),i=require("../../_internal/BaseListItem/BaseListItem.cjs"),a=require("../InputBase/InputBase.cjs"),o=require("../../../i18n/generated/form.cjs"),s=require("../FieldTemplate/FieldTemplate.cjs"),c=require("../../_internal/mergeRefs.cjs"),l=require("./select.module.cjs"),ee=require("./useSelect.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=(0,u.forwardRef)(({options:e=[],value:p,onChange:m,placeholder:h,label:g,error:_,required:v,layout:y,className:b,disabled:x=!1,defaultValue:te,searchable:S=!1,searchPlaceholder:C,filterOption:w,grouped:T=!1,allowClear:E=!1,fullWidth:D=!1,intent:ne=`default`,id:re,noOptionsFoundLabel:ie,width:ae,styles:O,asChild:oe=!1,children:k,...se},ce)=>{let{t:le}=n.useWimTranslation(o.formNs),ue=(0,u.useId)(),A=re||`wim-select-${ue}`,j=g?`${A}-label`:void 0,M=_?`${A}-error`:void 0,N=`${A}-list`,P=`${A}-trigger`,F=_?`danger`:ne,{isOpen:I,searchValue:L,setSearchValue:R,focusedIndex:z,setFocusedIndex:B,isKeyboardNavigating:V,setIsKeyboardNavigating:H,containerRef:de,triggerRef:fe,searchInputRef:pe,listItemsRef:U,currentValue:W,filteredOptions:G,selectedOption:K,focusedOption:q,handleToggle:J,handleSelect:Y,handleClear:me,handleKeyDown:X}=ee.useSelect({options:e,value:p,onChange:m,defaultValue:te,searchable:S,grouped:T,disabled:x,filterOption:w}),he=c.mergeRefs(de,ce),ge=()=>{let t=0;return T&&e.length>0&&`options`in e[0]?e.map((e,n)=>{let r=e.options.filter(e=>e.type===`separator`||!L||(w||((e,t)=>(typeof e.label==`string`?e.label:``).toLowerCase().includes(t.toLowerCase())))(e,L));return r.length===0?null:(0,f.jsxs)(u.default.Fragment,{children:[(0,f.jsx)(`li`,{className:(0,d.default)(l.default.groupLabel,O?.groupLabel),role:`presentation`,children:e.label}),r.map((e,r)=>{let a=t++;if(e.type===`separator`)return(0,f.jsx)(`li`,{className:(0,d.default)(l.default.separator,O?.separator),role:`presentation`},`sep-${n}-${r}`);let o=a===z,s=W===e.value,c=`wim-select-option-${A}-${e.value}`;return(0,f.jsx)(i.BaseListItem,{asChild:!0,id:c,ref:e=>{U.current[a]=e},active:o,disabled:e.disabled,className:(0,d.default)(l.default.option,s&&l.default.selected,O?.option),onClick:t=>{t.stopPropagation(),Y(e)},onMouseEnter:()=>B(a),role:`option`,"aria-selected":s,children:(0,f.jsx)(`li`,{children:e.label})},e.value)})]},n)}):G.map((e,n)=>{let r=t++;if(e.type===`separator`)return(0,f.jsx)(`li`,{className:(0,d.default)(l.default.separator,O?.separator),role:`presentation`},`sep-${n}`);let a=r===z,o=W===e.value,s=`wim-select-option-${A}-${e.value}`;return(0,f.jsx)(i.BaseListItem,{asChild:!0,id:s,ref:e=>{U.current[r]=e},active:a,disabled:e.disabled,className:(0,d.default)(l.default.option,o&&l.default.selected,O?.option),onClick:t=>{t.stopPropagation(),Y(e)},onMouseEnter:()=>B(r),role:`option`,"aria-selected":o,children:(0,f.jsx)(`li`,{children:e.label})},e.value)})},Z=q&&q.type!==`separator`?`wim-select-option-${A}-${q.value}`:void 0,{"aria-label":Q,"aria-labelledby":$,"aria-describedby":_e,...ve}=se;return(0,f.jsx)(s.FieldTemplate,{label:g,error:_,required:v,layout:y,labelId:j,htmlFor:P,errorId:M,className:b,children:(0,f.jsxs)(oe?t.Root:`div`,{className:(0,d.default)(`wim-select`,l.default.root,D&&l.default.fullWidth,O?.root),ref:he,onMouseMove:()=>H(!1),"data-keyboard-nav":V,...ve,children:[(0,f.jsx)(a.InputBase,{disabled:x,allowClear:E,hasValue:!!W,onClear:me,intent:F,rightIcons:[{name:`ChevronDownIcon`,rotated:I}],width:ae,fullWidth:D,styles:O?.inputBase,children:(0,f.jsx)(`div`,{id:P,className:(0,d.default)(l.default.trigger,I&&l.default.open,x&&l.default.disabled,O?.trigger),onClick:J,onKeyDown:X,tabIndex:x?-1:0,role:`combobox`,"aria-expanded":I,"aria-haspopup":`listbox`,"aria-controls":I?N:void 0,"aria-disabled":x,"aria-labelledby":j||$,"aria-label":g?void 0:typeof Q==`string`?Q:typeof h==`string`?h:void 0,"aria-describedby":M||_e,"aria-required":v?`true`:void 0,"aria-invalid":F===`danger`?`true`:`false`,"aria-activedescendant":I?Z:void 0,ref:fe,children:(0,f.jsx)(`div`,{className:(0,d.default)(l.default.value,!K&&l.default.placeholder,O?.value),children:K?K.label:h})})}),(0,f.jsxs)(r.Transition,{show:I&&!x,preset:`fade`,className:(0,d.default)(l.default.dropdown,O?.dropdown),children:[S&&(0,f.jsx)(`div`,{className:(0,d.default)(l.default.search,O?.search),children:(0,f.jsx)(`input`,{ref:pe,type:`text`,className:(0,d.default)(l.default.searchInput,O?.searchInput),placeholder:C,value:L,onChange:e=>{R(e.target.value),B(-1)},onClick:e=>e.stopPropagation(),onKeyDown:X,"aria-label":C,"aria-controls":N,"aria-activedescendant":Z})}),(0,f.jsx)(`ul`,{id:N,className:(0,d.default)(l.default.list,O?.list),role:`listbox`,"aria-labelledby":g?j:$||void 0,children:G.length===0?(0,f.jsx)(`li`,{className:(0,d.default)(l.default.empty,O?.empty),role:`option`,"aria-selected":`false`,children:ie??le(`select.no_options`)}):ge()})]}),(0,f.jsx)(t.Slottable,{children:k})]})})});p.displayName=`Select`,exports.Select=p,exports.default=p;
|