wimui 0.47.8 → 0.47.10
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/ai/ModelSelector/ModelSelector.cjs +1 -1
- package/dist/components/ai/ModelSelector/ModelSelector.js +2 -1
- package/dist/components/feedback/Snackbar/snackbar.module.cjs +1 -1
- package/dist/components/feedback/Snackbar/snackbar.module.js +7 -7
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +67 -65
- package/dist/components/form/Combobox/combobox.module.cjs +1 -1
- package/dist/components/form/Combobox/combobox.module.js +1 -1
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +45 -43
- package/dist/components/form/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.js +22 -20
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +54 -53
- package/dist/i18n/generated/keys.d.ts +1 -1
- package/dist/i18n/generated/resources.cjs +1 -1
- package/dist/i18n/generated/resources.js +3 -0
- package/dist/llms-full.txt +1 -1
- package/dist/llms.txt +1 -1
- package/dist/locales/en/components.json +3 -0
- package/dist/locales/ja/components.json +3 -0
- package/dist/locales/pt/components.json +3 -0
- package/dist/styles.css +2 -2
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +3 -3
- package/package.json +1 -1
|
@@ -70,16 +70,16 @@ var p = [
|
|
|
70
70
|
flag: "🇧🇷"
|
|
71
71
|
}
|
|
72
72
|
], m = a(({ value: a = "", onChange: m, countryCode: h = "US", onCountryChange: g, placeholder: _ = "000-0000-0000", disabled: v = !1, error: y, required: b = !1, label: x, layout: S = "vertical", className: C, fullWidth: w = !1, ...T }, E) => {
|
|
73
|
-
let D = `wim-phone-input-${s()}`, O = x ? `${D}-label` : void 0, k = y ? `${D}-error` : void 0, [
|
|
73
|
+
let D = `wim-phone-input-${s()}`, O = x ? `${D}-label` : void 0, k = x ? void 0 : "Select country", A = y ? `${D}-error` : void 0, [j, M] = l(!1), N = c(null);
|
|
74
74
|
o(() => {
|
|
75
75
|
let e = (e) => {
|
|
76
|
-
|
|
76
|
+
N.current && !N.current.contains(e.target) && M(!1);
|
|
77
77
|
};
|
|
78
|
-
return
|
|
78
|
+
return j && document.addEventListener("mousedown", e), () => {
|
|
79
79
|
document.removeEventListener("mousedown", e);
|
|
80
80
|
};
|
|
81
|
-
}, [
|
|
82
|
-
let
|
|
81
|
+
}, [j]);
|
|
82
|
+
let P = p.find((e) => e.code === h) ?? p[0], F = (e) => {
|
|
83
83
|
m?.(e.target.value);
|
|
84
84
|
};
|
|
85
85
|
return /* @__PURE__ */ d(r, {
|
|
@@ -88,11 +88,11 @@ var p = [
|
|
|
88
88
|
htmlFor: D,
|
|
89
89
|
required: b,
|
|
90
90
|
error: y,
|
|
91
|
-
errorId:
|
|
91
|
+
errorId: A,
|
|
92
92
|
layout: S,
|
|
93
93
|
className: C,
|
|
94
94
|
children: /* @__PURE__ */ f("div", {
|
|
95
|
-
ref:
|
|
95
|
+
ref: N,
|
|
96
96
|
className: u("wim-phone-input", i.root, w && i.fullWidth, v && i.disabled, y && i.danger),
|
|
97
97
|
"data-testid": "phone-input-root",
|
|
98
98
|
...T,
|
|
@@ -102,43 +102,45 @@ var p = [
|
|
|
102
102
|
children: [/* @__PURE__ */ f("button", {
|
|
103
103
|
type: "button",
|
|
104
104
|
className: i.countryTrigger,
|
|
105
|
-
onClick: () => !v &&
|
|
105
|
+
onClick: () => !v && M(!j),
|
|
106
106
|
disabled: v,
|
|
107
107
|
"aria-haspopup": "listbox",
|
|
108
|
-
"aria-expanded":
|
|
108
|
+
"aria-expanded": j,
|
|
109
109
|
"aria-labelledby": O,
|
|
110
|
-
"aria-label":
|
|
110
|
+
"aria-label": k,
|
|
111
111
|
children: [
|
|
112
112
|
/* @__PURE__ */ d("span", {
|
|
113
113
|
"aria-hidden": "true",
|
|
114
114
|
style: { fontSize: "1.2em" },
|
|
115
|
-
children:
|
|
115
|
+
children: P.flag
|
|
116
116
|
}),
|
|
117
|
-
/* @__PURE__ */ f("span", { children: ["+",
|
|
117
|
+
/* @__PURE__ */ f("span", { children: ["+", P.dialCode] }),
|
|
118
118
|
/* @__PURE__ */ d(n, {
|
|
119
119
|
component: t,
|
|
120
120
|
size: "sm",
|
|
121
|
-
className: u(i.chevron,
|
|
121
|
+
className: u(i.chevron, j && i.chevronOpen)
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
}), /* @__PURE__ */ d(e, {
|
|
125
|
-
show:
|
|
125
|
+
show: j,
|
|
126
126
|
preset: "fade",
|
|
127
127
|
className: i.dropdown,
|
|
128
128
|
children: /* @__PURE__ */ d("ul", {
|
|
129
129
|
className: i.countryList,
|
|
130
130
|
role: "listbox",
|
|
131
|
+
"aria-labelledby": x ? O : void 0,
|
|
132
|
+
"aria-label": k,
|
|
131
133
|
children: p.map((e) => /* @__PURE__ */ f("li", {
|
|
132
|
-
className: u(i.countryOption,
|
|
134
|
+
className: u(i.countryOption, P.code === e.code && i.selected),
|
|
133
135
|
onClick: () => {
|
|
134
|
-
g?.(e.code),
|
|
136
|
+
g?.(e.code), M(!1);
|
|
135
137
|
},
|
|
136
138
|
onKeyDown: (t) => {
|
|
137
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), g?.(e.code),
|
|
139
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), g?.(e.code), M(!1));
|
|
138
140
|
},
|
|
139
141
|
tabIndex: 0,
|
|
140
142
|
role: "option",
|
|
141
|
-
"aria-selected":
|
|
143
|
+
"aria-selected": P.code === e.code,
|
|
142
144
|
children: [
|
|
143
145
|
/* @__PURE__ */ d("span", {
|
|
144
146
|
"aria-hidden": "true",
|
|
@@ -166,12 +168,12 @@ var p = [
|
|
|
166
168
|
ref: E,
|
|
167
169
|
type: "tel",
|
|
168
170
|
value: a,
|
|
169
|
-
onChange:
|
|
171
|
+
onChange: F,
|
|
170
172
|
placeholder: _,
|
|
171
173
|
disabled: v,
|
|
172
174
|
className: i.number,
|
|
173
175
|
"aria-invalid": !!y,
|
|
174
|
-
"aria-describedby":
|
|
176
|
+
"aria-describedby": A
|
|
175
177
|
})
|
|
176
178
|
]
|
|
177
179
|
})
|
|
@@ -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("../../layout/Transition/Transition.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../layout/Transition/Transition.cjs"),ee=require("../../overlay/FocusTrap/FocusTrap.cjs"),r=require("../../../hooks/useMergedRef.cjs"),i=require("../InputBase/InputBase.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),te=require("../../data-display/TreeView/TreeView.cjs"),o=require("./tree-select.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");function u(e){return e.map(e=>({value:e.value,label:e.label,disabled:e.disabled,icon:e.icon,children:e.children?u(e.children):void 0}))}var d=(0,s.forwardRef)(({treeData:e=[],value:d,onChange:f,placeholder:p,label:m,error:h,required:g,layout:_,className:v,disabled:y=!1,multiple:b=!1,searchable:x=!1,defaultExpandedKeys:S=[],allowClear:C=!1,checkStrategy:w=`cascade`,id:T,width:E,fullWidth:D=!1,asChild:O=!1,children:ne,...re},ie)=>{let ae=(0,s.useId)(),k=T||`wim-tree-select-${ae}`,A=m?`${k}-label`:void 0,j=h?`${k}-error`:void 0,M=`${k}-trigger`,N=`${k}-dropdown`,[P,F]=(0,s.useState)(!1),[I,L]=(0,s.useState)(b?[]:``),R=(0,s.useRef)(null),z=(0,s.useRef)(null),B=d!==void 0,V=B?d:I;(0,s.useEffect)(()=>{let e=e=>{R.current&&!R.current.contains(e.target)&&F(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,s.useEffect)(()=>{if(P){let e=setTimeout(()=>{let e=R.current?.querySelector(`[data-testid="tree-view-search-input"]`);e?e.focus():(R.current?.querySelector(`[data-testid="tree-view-root"]`))?.focus()},100);return()=>clearTimeout(e)}},[P]);let H=()=>{if(!y){let e=!P;F(e),e||z.current?.focus()}},U=e=>{if(!y){if(!P){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),F(!0));return}e.key===`Escape`&&(e.preventDefault(),F(!1),z.current?.focus())}},W=(0,s.useMemo)(()=>{let t={},n=e=>{e.forEach(e=>{t[e.value]=e,e.children&&n(e.children)})};return n(e),t},[e]),G=()=>{if(b){let e=Array.isArray(V)?V:[];return e.length===0?null:e.map(e=>W[e]?W[e].label:e).reduce((e,t)=>[e,`, `,t])}{let e=V;return e?W[e]?W[e].label:e:null}},K=e=>{let t;b?t=e:(t=e[0]||``,F(!1),z.current?.focus()),B||L(t),f&&f(t)},q=()=>{if(y)return;let e=b?[]:``;B||L(e),f&&f(e)},oe=(0,s.useMemo)(()=>u(e),[e]),J=(0,s.useMemo)(()=>b?Array.isArray(V)?V:[]:V?[V]:[],[V,b]),Y=G(),{"aria-label":X,"aria-labelledby":Z,"aria-describedby":se,...ce}=re,Q=typeof p==`string`?p:`Select`,le=O?t.Root:`div`,$=r.useMergedRef(R,ie);return(0,l.jsx)(a.FieldTemplate,{label:m,error:h,required:g,layout:_,labelId:A,errorId:j,className:(0,c.default)(o.default.container,v),children:(0,l.jsxs)(le,{className:(0,c.default)(`wim-tree-select`,o.default.root,D&&o.default.fullWidth),ref:$,...ce,children:[(0,l.jsx)(t.Slottable,{children:ne}),(0,l.jsx)(i.InputBase,{disabled:y,allowClear:C,hasValue:!!Y,onClear:q,intent:h?`danger`:`default`,width:E,fullWidth:D,rightIcons:[{name:`ChevronDownIcon`,rotated:P,onClick:H}],className:(0,c.default)(P&&o.default.open),children:(0,l.jsx)(`div`,{id:M,className:(0,c.default)(o.default.trigger,y&&o.default.disabled),onClick:H,onKeyDown:U,tabIndex:y?-1:0,role:`combobox`,"aria-expanded":P,"aria-haspopup":`tree`,"aria-controls":P?N:void 0,"aria-disabled":y,"aria-labelledby":A||Z,"aria-label":m?void 0:X||Q,"aria-describedby":j||se,"aria-required":g,"aria-invalid":!!h,ref:z,children:(0,l.jsx)(`div`,{className:(0,c.default)(o.default.value,!Y&&o.default.placeholder),children:Y||p})})}),(0,l.jsx)(n.Transition,{show:P&&!y,preset:`fade`,className:o.default.dropdown,children:(0,l.jsx)(`div`,{id:N,children:(0,l.jsx)(ee.FocusTrap,{active:P,initialFocus:!1,children:(0,l.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":A||Z,"aria-label":m?void 0:X||Q,children:(0,l.jsx)(te.TreeView,{multiSelect:b,defaultSelectedValues:J,defaultCheckedValues:b?J:[],nodes:oe,onCheckedChange:K,onSelectedChange:K,checkable:b,checkStrategy:w,searchable:x,defaultExpandedValues:S,styles:{root:o.default.treeView,item:o.default.treeViewItem,search:o.default.treeViewSearch}})})})})})]})})});d.displayName=`TreeSelect`,exports.TreeSelect=d;
|
|
@@ -20,134 +20,135 @@ function g(e) {
|
|
|
20
20
|
children: e.children ? g(e.children) : void 0
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
|
-
var _ = s(({ treeData: s = [], value: _, onChange: v, placeholder: y, label: b, error: x, required: S, layout: C, className: w, disabled: T = !1, multiple: E = !1, searchable: D = !1, defaultExpandedKeys: O = [], allowClear: k = !1, checkStrategy: A = "cascade", id: ne, width: re, fullWidth: j = !1, asChild: M = !1, children: ie, ...
|
|
24
|
-
let
|
|
23
|
+
var _ = s(({ treeData: s = [], value: _, onChange: v, placeholder: y, label: b, error: x, required: S, layout: C, className: w, disabled: T = !1, multiple: E = !1, searchable: D = !1, defaultExpandedKeys: O = [], allowClear: k = !1, checkStrategy: A = "cascade", id: ne, width: re, fullWidth: j = !1, asChild: M = !1, children: ie, ...ae }, oe) => {
|
|
24
|
+
let se = l(), N = ne || `wim-tree-select-${se}`, P = b ? `${N}-label` : void 0, F = x ? `${N}-error` : void 0, I = `${N}-trigger`, L = `${N}-dropdown`, [R, z] = f(!1), [B, V] = f(E ? [] : ""), H = d(null), U = d(null), W = _ !== void 0, G = W ? _ : B;
|
|
25
25
|
c(() => {
|
|
26
26
|
let e = (e) => {
|
|
27
|
-
|
|
27
|
+
H.current && !H.current.contains(e.target) && z(!1);
|
|
28
28
|
};
|
|
29
29
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
30
30
|
}, []), c(() => {
|
|
31
|
-
if (
|
|
31
|
+
if (R) {
|
|
32
32
|
let e = setTimeout(() => {
|
|
33
|
-
let e =
|
|
34
|
-
e ? e.focus() : (
|
|
33
|
+
let e = H.current?.querySelector("[data-testid=\"tree-view-search-input\"]");
|
|
34
|
+
e ? e.focus() : (H.current?.querySelector("[data-testid=\"tree-view-root\"]"))?.focus();
|
|
35
35
|
}, 100);
|
|
36
36
|
return () => clearTimeout(e);
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
39
|
-
let
|
|
38
|
+
}, [R]);
|
|
39
|
+
let K = () => {
|
|
40
40
|
if (!T) {
|
|
41
|
-
let e = !
|
|
42
|
-
|
|
41
|
+
let e = !R;
|
|
42
|
+
z(e), e || U.current?.focus();
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, ce = (e) => {
|
|
45
45
|
if (!T) {
|
|
46
|
-
if (!
|
|
47
|
-
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(),
|
|
46
|
+
if (!R) {
|
|
47
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), z(!0));
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
50
|
+
e.key === "Escape" && (e.preventDefault(), z(!1), U.current?.focus());
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, q = u(() => {
|
|
53
53
|
let e = {}, t = (n) => {
|
|
54
54
|
n.forEach((n) => {
|
|
55
55
|
e[n.value] = n, n.children && t(n.children);
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
return t(s), e;
|
|
59
|
-
}, [s]),
|
|
59
|
+
}, [s]), le = () => {
|
|
60
60
|
if (E) {
|
|
61
|
-
let e = Array.isArray(
|
|
62
|
-
return e.length === 0 ? null : e.map((e) =>
|
|
61
|
+
let e = Array.isArray(G) ? G : [];
|
|
62
|
+
return e.length === 0 ? null : e.map((e) => q[e] ? q[e].label : e).reduce((e, t) => [
|
|
63
63
|
e,
|
|
64
64
|
", ",
|
|
65
65
|
t
|
|
66
66
|
]);
|
|
67
67
|
}
|
|
68
68
|
{
|
|
69
|
-
let e =
|
|
70
|
-
return e ?
|
|
69
|
+
let e = G;
|
|
70
|
+
return e ? q[e] ? q[e].label : e : null;
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, J = (e) => {
|
|
73
73
|
let t;
|
|
74
|
-
E ? t = e : (t = e[0] || "",
|
|
75
|
-
},
|
|
74
|
+
E ? t = e : (t = e[0] || "", z(!1), U.current?.focus()), W || V(t), v && v(t);
|
|
75
|
+
}, ue = () => {
|
|
76
76
|
if (T) return;
|
|
77
77
|
let e = E ? [] : "";
|
|
78
|
-
|
|
79
|
-
},
|
|
78
|
+
W || V(e), v && v(e);
|
|
79
|
+
}, de = u(() => g(s), [s]), Y = u(() => E ? Array.isArray(G) ? G : [] : G ? [G] : [], [G, E]), X = le(), { "aria-label": Z, "aria-labelledby": Q, "aria-describedby": fe, ...pe } = ae, $ = typeof y == "string" ? y : "Select", me = M ? e : "div", he = r(H, oe);
|
|
80
80
|
return /* @__PURE__ */ m(a, {
|
|
81
81
|
label: b,
|
|
82
82
|
error: x,
|
|
83
83
|
required: S,
|
|
84
84
|
layout: C,
|
|
85
|
-
labelId:
|
|
86
|
-
errorId:
|
|
85
|
+
labelId: P,
|
|
86
|
+
errorId: F,
|
|
87
87
|
className: p(o.container, w),
|
|
88
88
|
children: /* @__PURE__ */ h(me, {
|
|
89
89
|
className: p("wim-tree-select", o.root, j && o.fullWidth),
|
|
90
90
|
ref: he,
|
|
91
|
-
...
|
|
91
|
+
...pe,
|
|
92
92
|
children: [
|
|
93
93
|
/* @__PURE__ */ m(t, { children: ie }),
|
|
94
94
|
/* @__PURE__ */ m(i, {
|
|
95
95
|
disabled: T,
|
|
96
96
|
allowClear: k,
|
|
97
|
-
hasValue:
|
|
98
|
-
onClear:
|
|
97
|
+
hasValue: !!X,
|
|
98
|
+
onClear: ue,
|
|
99
99
|
intent: x ? "danger" : "default",
|
|
100
100
|
width: re,
|
|
101
101
|
fullWidth: j,
|
|
102
102
|
rightIcons: [{
|
|
103
103
|
name: "ChevronDownIcon",
|
|
104
|
-
rotated:
|
|
105
|
-
onClick:
|
|
104
|
+
rotated: R,
|
|
105
|
+
onClick: K
|
|
106
106
|
}],
|
|
107
|
-
className: p(
|
|
107
|
+
className: p(R && o.open),
|
|
108
108
|
children: /* @__PURE__ */ m("div", {
|
|
109
|
-
id:
|
|
109
|
+
id: I,
|
|
110
110
|
className: p(o.trigger, T && o.disabled),
|
|
111
|
-
onClick:
|
|
112
|
-
onKeyDown:
|
|
111
|
+
onClick: K,
|
|
112
|
+
onKeyDown: ce,
|
|
113
113
|
tabIndex: T ? -1 : 0,
|
|
114
114
|
role: "combobox",
|
|
115
|
-
"aria-expanded":
|
|
115
|
+
"aria-expanded": R,
|
|
116
116
|
"aria-haspopup": "tree",
|
|
117
|
-
"aria-controls":
|
|
117
|
+
"aria-controls": R ? L : void 0,
|
|
118
118
|
"aria-disabled": T,
|
|
119
|
-
"aria-labelledby":
|
|
120
|
-
"aria-label": b ? void 0 :
|
|
121
|
-
"aria-describedby":
|
|
119
|
+
"aria-labelledby": P || Q,
|
|
120
|
+
"aria-label": b ? void 0 : Z || $,
|
|
121
|
+
"aria-describedby": F || fe,
|
|
122
122
|
"aria-required": S,
|
|
123
123
|
"aria-invalid": !!x,
|
|
124
|
-
ref:
|
|
124
|
+
ref: U,
|
|
125
125
|
children: /* @__PURE__ */ m("div", {
|
|
126
|
-
className: p(o.value,
|
|
127
|
-
children:
|
|
126
|
+
className: p(o.value, !X && o.placeholder),
|
|
127
|
+
children: X || y
|
|
128
128
|
})
|
|
129
129
|
})
|
|
130
130
|
}),
|
|
131
131
|
/* @__PURE__ */ m(n, {
|
|
132
|
-
show:
|
|
132
|
+
show: R && !T,
|
|
133
133
|
preset: "fade",
|
|
134
134
|
className: o.dropdown,
|
|
135
135
|
children: /* @__PURE__ */ m("div", {
|
|
136
|
-
id:
|
|
136
|
+
id: L,
|
|
137
137
|
children: /* @__PURE__ */ m(ee, {
|
|
138
|
-
active:
|
|
138
|
+
active: R,
|
|
139
139
|
initialFocus: !1,
|
|
140
140
|
children: /* @__PURE__ */ m("div", {
|
|
141
141
|
role: "dialog",
|
|
142
142
|
"aria-modal": "true",
|
|
143
|
-
"aria-labelledby":
|
|
143
|
+
"aria-labelledby": P || Q,
|
|
144
|
+
"aria-label": b ? void 0 : Z || $,
|
|
144
145
|
children: /* @__PURE__ */ m(te, {
|
|
145
146
|
multiSelect: E,
|
|
146
|
-
defaultSelectedValues:
|
|
147
|
-
defaultCheckedValues: E ?
|
|
148
|
-
nodes:
|
|
149
|
-
onCheckedChange:
|
|
150
|
-
onSelectedChange:
|
|
147
|
+
defaultSelectedValues: Y,
|
|
148
|
+
defaultCheckedValues: E ? Y : [],
|
|
149
|
+
nodes: de,
|
|
150
|
+
onCheckedChange: J,
|
|
151
|
+
onSelectedChange: J,
|
|
151
152
|
checkable: E,
|
|
152
153
|
checkStrategy: A,
|
|
153
154
|
searchable: D,
|